1 @c Copyright (C) 1988-2021 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-2021 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 @command{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.
175 * C++ Modules:: Experimental C++20 module system.
181 @section Option Summary
183 Here is a summary of all the options, grouped by type. Explanations are
184 in the following sections.
187 @item Overall Options
188 @xref{Overall Options,,Options Controlling the Kind of Output}.
189 @gccoptlist{-c -S -E -o @var{file} @gol
190 -dumpbase @var{dumpbase} -dumpbase-ext @var{auxdropsuf} @gol
191 -dumpdir @var{dumppfx} -x @var{language} @gol
192 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
193 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
194 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
195 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
196 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
198 @item C Language Options
199 @xref{C Dialect Options,,Options Controlling C Dialect}.
200 @gccoptlist{-ansi -std=@var{standard} -aux-info @var{filename} @gol
201 -fallow-parameterless-variadic-functions -fno-asm @gol
202 -fno-builtin -fno-builtin-@var{function} -fcond-mismatch @gol
203 -ffreestanding -fgimple -fgnu-tm -fgnu89-inline -fhosted @gol
204 -flax-vector-conversions -fms-extensions @gol
205 -foffload=@var{arg} -foffload-options=@var{arg} @gol
206 -fopenacc -fopenacc-dim=@var{geom} @gol
207 -fopenmp -fopenmp-simd @gol
208 -fpermitted-flt-eval-methods=@var{standard} @gol
209 -fplan9-extensions -fsigned-bitfields -funsigned-bitfields @gol
210 -fsigned-char -funsigned-char -fsso-struct=@var{endianness}}
212 @item C++ Language Options
213 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
214 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
215 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
216 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
217 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
218 -fno-elide-constructors @gol
219 -fno-enforce-eh-specs @gol
220 -fno-gnu-keywords @gol
221 -fno-implicit-templates @gol
222 -fno-implicit-inline-templates @gol
223 -fno-implement-inlines @gol
224 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts @gol
225 -fmodule-implicit-inline @gol
226 -fno-module-lazy @gol
227 -fmodule-mapper=@var{specification} @gol
228 -fmodule-version-ignore @gol
230 -fnew-inheriting-ctors @gol
231 -fnew-ttp-matching @gol
232 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
233 -fno-optional-diags -fpermissive @gol
234 -fno-pretty-templates @gol
235 -fno-rtti -fsized-deallocation @gol
236 -ftemplate-backtrace-limit=@var{n} @gol
237 -ftemplate-depth=@var{n} @gol
238 -fno-threadsafe-statics -fuse-cxa-atexit @gol
239 -fno-weak -nostdinc++ @gol
240 -fvisibility-inlines-hidden @gol
241 -fvisibility-ms-compat @gol
242 -fext-numeric-literals @gol
243 -flang-info-include-translate@r{[}=@var{header}@r{]} @gol
244 -flang-info-include-translate-not @gol
245 -flang-info-module-cmi@r{[}=@var{module}@r{]} @gol
246 -stdlib=@var{libstdc++,libc++} @gol
247 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
248 -Wno-class-conversion -Wclass-memaccess @gol
249 -Wcomma-subscript -Wconditionally-supported @gol
250 -Wno-conversion-null -Wctad-maybe-unsupported @gol
251 -Wctor-dtor-privacy -Wno-delete-incomplete @gol
252 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
253 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol
254 -Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base @gol
255 -Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
256 -Winvalid-imported-macros @gol
257 -Wno-invalid-offsetof -Wno-literal-suffix @gol
258 -Wmismatched-new-delete -Wmismatched-tags @gol
259 -Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
260 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol
261 -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol
262 -Wrange-loop-construct -Wredundant-move -Wredundant-tags @gol
263 -Wreorder -Wregister @gol
264 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol
265 -Wno-non-template-friend -Wold-style-cast @gol
266 -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol
267 -Wsized-deallocation -Wsuggest-final-methods @gol
268 -Wsuggest-final-types -Wsuggest-override @gol
269 -Wno-terminate -Wuseless-cast -Wno-vexing-parse @gol
270 -Wvirtual-inheritance @gol
271 -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
273 @item Objective-C and Objective-C++ Language Options
274 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
275 Objective-C and Objective-C++ Dialects}.
276 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
277 -fgnu-runtime -fnext-runtime @gol
278 -fno-nil-receivers @gol
279 -fobjc-abi-version=@var{n} @gol
280 -fobjc-call-cxx-cdtors @gol
281 -fobjc-direct-dispatch @gol
282 -fobjc-exceptions @gol
285 -fobjc-std=objc1 @gol
286 -fno-local-ivars @gol
287 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
288 -freplace-objc-classes @gol
291 -Wassign-intercept -Wno-property-assign-default @gol
292 -Wno-protocol -Wobjc-root-class -Wselector @gol
293 -Wstrict-selector-match @gol
294 -Wundeclared-selector}
296 @item Diagnostic Message Formatting Options
297 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
298 @gccoptlist{-fmessage-length=@var{n} @gol
299 -fdiagnostics-plain-output @gol
300 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
301 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
302 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
303 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
304 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
305 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
306 -fno-diagnostics-show-cwe @gol
307 -fdiagnostics-minimum-margin-width=@var{width} @gol
308 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
309 -fdiagnostics-show-template-tree -fno-elide-type @gol
310 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
311 -fdiagnostics-show-path-depths @gol
312 -fno-show-column @gol
313 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol
314 -fdiagnostics-column-origin=@var{origin}}
316 @item Warning Options
317 @xref{Warning Options,,Options to Request or Suppress Warnings}.
318 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
319 -pedantic-errors @gol
320 -w -Wextra -Wall -Wabi=@var{n} @gol
321 -Waddress -Wno-address-of-packed-member -Waggregate-return @gol
322 -Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol
323 -Walloca -Walloca-larger-than=@var{byte-size} @gol
324 -Wno-aggressive-loop-optimizations @gol
325 -Warith-conversion @gol
326 -Warray-bounds -Warray-bounds=@var{n} @gol
327 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
328 -Wno-attribute-warning -Wbool-compare -Wbool-operation @gol
329 -Wno-builtin-declaration-mismatch @gol
330 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
331 -Wc11-c2x-compat @gol
332 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
334 -Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions @gol
335 -Wno-c++20-extensions -Wno-c++23-extensions @gol
336 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
337 -Wchar-subscripts @gol
338 -Wclobbered -Wcomment @gol
339 -Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
340 -Wdangling-else -Wdate-time @gol
341 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
342 -Wdisabled-optimization @gol
343 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
344 -Wno-div-by-zero -Wdouble-promotion @gol
345 -Wduplicated-branches -Wduplicated-cond @gol
346 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol
347 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol
348 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol
349 -Wno-format-contains-nul -Wno-format-extra-args @gol
350 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
351 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
352 -Wformat-y2k -Wframe-address @gol
353 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
354 -Wno-if-not-aligned -Wno-ignored-attributes @gol
355 -Wignored-qualifiers -Wno-incompatible-pointer-types @gol
356 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
357 -Wno-implicit-function-declaration -Wno-implicit-int @gol
358 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
359 -Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol
360 -Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol
361 -Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol
362 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol
363 -Wmemset-elt-size -Wmemset-transposed-args @gol
364 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
365 -Wmissing-field-initializers -Wmissing-format-attribute @gol
366 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol
367 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
368 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
369 -Wnull-dereference -Wno-odr @gol
370 -Wopenacc-parallelism @gol
372 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol
373 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
374 -Wparentheses -Wno-pedantic-ms-format @gol
375 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
376 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
377 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
378 -Wno-scalar-storage-order -Wsequence-point @gol
379 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
380 -Wno-shadow-ivar @gol
381 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol
382 -Wno-shift-overflow -Wshift-overflow=@var{n} @gol
383 -Wsign-compare -Wsign-conversion @gol
384 -Wno-sizeof-array-argument @gol
385 -Wsizeof-array-div @gol
386 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
387 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
388 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
389 -Wstring-compare @gol
390 -Wno-stringop-overflow -Wno-stringop-overread @gol
391 -Wno-stringop-truncation @gol
392 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
393 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol
394 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol
395 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
396 -Wtsan -Wtype-limits -Wundef @gol
397 -Wuninitialized -Wunknown-pragmas @gol
398 -Wunsuffixed-float-constants -Wunused @gol
399 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
400 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
401 -Wunused-function -Wunused-label -Wunused-local-typedefs @gol
403 -Wunused-parameter -Wno-unused-result @gol
404 -Wunused-value -Wunused-variable @gol
405 -Wno-varargs -Wvariadic-macros @gol
406 -Wvector-operation-performance @gol
407 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol
408 -Wvolatile-register-var -Wwrite-strings @gol
409 -Wzero-length-bounds}
411 @item Static Analyzer Options
414 -fanalyzer-call-summaries @gol
415 -fanalyzer-checker=@var{name} @gol
416 -fno-analyzer-feasibility @gol
417 -fanalyzer-fine-grained @gol
418 -fanalyzer-state-merge @gol
419 -fanalyzer-state-purge @gol
420 -fanalyzer-transitivity @gol
421 -fanalyzer-verbose-edges @gol
422 -fanalyzer-verbose-state-changes @gol
423 -fanalyzer-verbosity=@var{level} @gol
425 -fdump-analyzer-stderr @gol
426 -fdump-analyzer-callgraph @gol
427 -fdump-analyzer-exploded-graph @gol
428 -fdump-analyzer-exploded-nodes @gol
429 -fdump-analyzer-exploded-nodes-2 @gol
430 -fdump-analyzer-exploded-nodes-3 @gol
431 -fdump-analyzer-exploded-paths @gol
432 -fdump-analyzer-feasibility @gol
433 -fdump-analyzer-json @gol
434 -fdump-analyzer-state-purge @gol
435 -fdump-analyzer-supergraph @gol
436 -Wno-analyzer-double-fclose @gol
437 -Wno-analyzer-double-free @gol
438 -Wno-analyzer-exposure-through-output-file @gol
439 -Wno-analyzer-file-leak @gol
440 -Wno-analyzer-free-of-non-heap @gol
441 -Wno-analyzer-malloc-leak @gol
442 -Wno-analyzer-mismatching-deallocation @gol
443 -Wno-analyzer-null-argument @gol
444 -Wno-analyzer-null-dereference @gol
445 -Wno-analyzer-possible-null-argument @gol
446 -Wno-analyzer-possible-null-dereference @gol
447 -Wno-analyzer-shift-count-negative @gol
448 -Wno-analyzer-shift-count-overflow @gol
449 -Wno-analyzer-stale-setjmp-buffer @gol
450 -Wno-analyzer-tainted-array-index @gol
451 -Wanalyzer-too-complex @gol
452 -Wno-analyzer-unsafe-call-within-signal-handler @gol
453 -Wno-analyzer-use-after-free @gol
454 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
455 -Wno-analyzer-use-of-uninitialized-value @gol
456 -Wno-analyzer-write-to-const @gol
457 -Wno-analyzer-write-to-string-literal @gol
460 @item C and Objective-C-only Warning Options
461 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
462 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
463 -Wold-style-declaration -Wold-style-definition @gol
464 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
465 -Wdeclaration-after-statement -Wpointer-sign}
467 @item Debugging Options
468 @xref{Debugging Options,,Options for Debugging Your Program}.
469 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
470 -gbtf -gctf -gctf@var{level} @gol
471 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
472 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
473 -gas-loc-support -gno-as-loc-support @gol
474 -gas-locview-support -gno-as-locview-support @gol
475 -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64 @gol
476 -gstatement-frontiers -gno-statement-frontiers @gol
477 -gvariable-location-views -gno-variable-location-views @gol
478 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
479 -ginline-points -gno-inline-points @gol
480 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
481 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
482 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
483 -fno-eliminate-unused-debug-types @gol
484 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
485 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
486 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
487 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
488 -fvar-tracking -fvar-tracking-assignments}
490 @item Optimization Options
491 @xref{Optimize Options,,Options that Control Optimization}.
492 @gccoptlist{-faggressive-loop-optimizations @gol
493 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
494 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
495 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
496 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
497 -fno-allocation-dce -fallow-store-data-races @gol
498 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
499 -fauto-inc-dec -fbranch-probabilities @gol
501 -fcombine-stack-adjustments -fconserve-stack @gol
502 -fcompare-elim -fcprop-registers -fcrossjumping @gol
503 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
504 -fcx-limited-range @gol
505 -fdata-sections -fdce -fdelayed-branch @gol
506 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
507 -fdevirtualize-at-ltrans -fdse @gol
508 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
509 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
511 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
512 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
513 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
514 -fif-conversion2 -findirect-inlining @gol
515 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
516 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone @gol
517 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
518 -fipa-reference -fipa-reference-addressable @gol
519 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
520 -flive-patching=@var{level} @gol
521 -fira-region=@var{region} -fira-hoist-pressure @gol
522 -fira-loop-pressure -fno-ira-share-save-slots @gol
523 -fno-ira-share-spill-slots @gol
524 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
525 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
526 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
527 -floop-block -floop-interchange -floop-strip-mine @gol
528 -floop-unroll-and-jam -floop-nest-optimize @gol
529 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
530 -flto-partition=@var{alg} -fmerge-all-constants @gol
531 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
532 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg @gol
533 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
534 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
535 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
536 -fno-sched-spec -fno-signed-zeros @gol
537 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
538 -fomit-frame-pointer -foptimize-sibling-calls @gol
539 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
540 -fprefetch-loop-arrays @gol
541 -fprofile-correction @gol
542 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol
543 -fprofile-values -fprofile-reorder-functions @gol
544 -freciprocal-math -free -frename-registers -freorder-blocks @gol
545 -freorder-blocks-algorithm=@var{algorithm} @gol
546 -freorder-blocks-and-partition -freorder-functions @gol
547 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
548 -frounding-math -fsave-optimization-record @gol
549 -fsched2-use-superblocks -fsched-pressure @gol
550 -fsched-spec-load -fsched-spec-load-dangerous @gol
551 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
552 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
553 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
554 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
555 -fschedule-fusion @gol
556 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
557 -fselective-scheduling -fselective-scheduling2 @gol
558 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
559 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
560 -fsignaling-nans @gol
561 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
563 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
564 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
565 -fthread-jumps -ftracer -ftree-bit-ccp @gol
566 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
567 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
568 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
569 -ftree-loop-if-convert -ftree-loop-im @gol
570 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
571 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
572 -ftree-loop-vectorize @gol
573 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
574 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
575 -ftree-switch-conversion -ftree-tail-merge @gol
576 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init @gol
577 -funconstrained-commons -funit-at-a-time -funroll-all-loops @gol
578 -funroll-loops -funsafe-math-optimizations -funswitch-loops @gol
579 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
580 -fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs @gol
581 --param @var{name}=@var{value}
582 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
584 @item Program Instrumentation Options
585 @xref{Instrumentation Options,,Program Instrumentation Options}.
586 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
587 -fprofile-abs-path @gol
588 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
589 -fprofile-info-section -fprofile-info-section=@var{name} @gol
590 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
591 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
592 -fprofile-exclude-files=@var{regex} @gol
593 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol
594 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
595 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
596 -fsanitize-undefined-trap-on-error -fbounds-check @gol
597 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
598 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
599 -fstack-protector-explicit -fstack-check @gol
600 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
601 -fno-stack-limit -fsplit-stack @gol
602 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
603 -fvtv-counts -fvtv-debug @gol
604 -finstrument-functions @gol
605 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
606 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
608 @item Preprocessor Options
609 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
610 @gccoptlist{-A@var{question}=@var{answer} @gol
611 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
612 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
613 -dD -dI -dM -dN -dU @gol
614 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
615 -fexec-charset=@var{charset} -fextended-identifiers @gol
616 -finput-charset=@var{charset} -flarge-source-files @gol
617 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
618 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
619 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
620 -fwide-exec-charset=@var{charset} -fworking-directory @gol
621 -H -imacros @var{file} -include @var{file} @gol
622 -M -MD -MF -MG -MM -MMD -MP -MQ -MT -Mno-modules @gol
623 -no-integrated-cpp -P -pthread -remap @gol
624 -traditional -traditional-cpp -trigraphs @gol
625 -U@var{macro} -undef @gol
626 -Wp,@var{option} -Xpreprocessor @var{option}}
628 @item Assembler Options
629 @xref{Assembler Options,,Passing Options to the Assembler}.
630 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
633 @xref{Link Options,,Options for Linking}.
634 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
635 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
636 -e @var{entry} --entry=@var{entry} @gol
637 -pie -pthread -r -rdynamic @gol
638 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
639 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
640 -shared -shared-libgcc -symbolic @gol
641 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
642 -u @var{symbol} -z @var{keyword}}
644 @item Directory Options
645 @xref{Directory Options,,Options for Directory Search}.
646 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
647 -idirafter @var{dir} @gol
648 -imacros @var{file} -imultilib @var{dir} @gol
649 -iplugindir=@var{dir} -iprefix @var{file} @gol
650 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
651 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
652 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
653 -nostdinc -nostdinc++ --sysroot=@var{dir}}
655 @item Code Generation Options
656 @xref{Code Gen Options,,Options for Code Generation Conventions}.
657 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
658 -ffixed-@var{reg} -fexceptions @gol
659 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
660 -fasynchronous-unwind-tables @gol
662 -finhibit-size-directive -fcommon -fno-ident @gol
663 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
664 -fno-jump-tables -fno-bit-tests @gol
665 -frecord-gcc-switches @gol
666 -freg-struct-return -fshort-enums -fshort-wchar @gol
667 -fverbose-asm -fpack-struct[=@var{n}] @gol
668 -fleading-underscore -ftls-model=@var{model} @gol
669 -fstack-reuse=@var{reuse_level} @gol
670 -ftrampolines -ftrapv -fwrapv @gol
671 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
672 -fstrict-volatile-bitfields -fsync-libcalls}
674 @item Developer Options
675 @xref{Developer Options,,GCC Developer Options}.
676 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
677 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
678 -fchecking -fchecking=@var{n}
679 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
680 -fdisable-ipa-@var{pass_name} @gol
681 -fdisable-rtl-@var{pass_name} @gol
682 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
683 -fdisable-tree-@var{pass_name} @gol
684 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
685 -fdump-debug -fdump-earlydebug @gol
686 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
687 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
688 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
690 -fdump-lang-@var{switch} @gol
691 -fdump-lang-@var{switch}-@var{options} @gol
692 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
694 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
695 -fdump-statistics @gol
697 -fdump-tree-@var{switch} @gol
698 -fdump-tree-@var{switch}-@var{options} @gol
699 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
700 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
701 -fenable-@var{kind}-@var{pass} @gol
702 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
703 -fira-verbose=@var{n} @gol
704 -flto-report -flto-report-wpa -fmem-report-wpa @gol
705 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
706 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
707 -fprofile-report @gol
708 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
709 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
710 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
711 -fvar-tracking-assignments-toggle -gtoggle @gol
712 -print-file-name=@var{library} -print-libgcc-file-name @gol
713 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
714 -print-prog-name=@var{program} -print-search-dirs -Q @gol
715 -print-sysroot -print-sysroot-headers-suffix @gol
716 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
718 @item Machine-Dependent Options
719 @xref{Submodel Options,,Machine-Dependent Options}.
720 @c This list is ordered alphanumerically by subsection name.
721 @c Try and put the significant identifier (CPU or system) first,
722 @c so users have a clue at guessing where the ones they want will be.
724 @emph{AArch64 Options}
725 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
726 -mgeneral-regs-only @gol
727 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
728 -mstrict-align -mno-strict-align @gol
729 -momit-leaf-frame-pointer @gol
730 -mtls-dialect=desc -mtls-dialect=traditional @gol
731 -mtls-size=@var{size} @gol
732 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
733 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
734 -mpc-relative-literal-loads @gol
735 -msign-return-address=@var{scope} @gol
736 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
737 +@var{b-key}]|@var{bti} @gol
738 -mharden-sls=@var{opts} @gol
739 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
740 -moverride=@var{string} -mverbose-cost-dump @gol
741 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
742 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
745 @emph{Adapteva Epiphany Options}
746 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
747 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
748 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
749 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
750 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
751 -msplit-vecmove-early -m1reg-@var{reg}}
753 @emph{AMD GCN Options}
754 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
757 @gccoptlist{-mbarrel-shifter -mjli-always @gol
758 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
759 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
760 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
761 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
762 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
763 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
764 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
765 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
766 -mvolatile-cache -mtp-regno=@var{regno} @gol
767 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
768 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
769 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
770 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
771 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
772 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
773 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
774 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
777 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
778 -mabi=@var{name} @gol
779 -mapcs-stack-check -mno-apcs-stack-check @gol
780 -mapcs-reentrant -mno-apcs-reentrant @gol
781 -mgeneral-regs-only @gol
782 -msched-prolog -mno-sched-prolog @gol
783 -mlittle-endian -mbig-endian @gol
785 -mfloat-abi=@var{name} @gol
786 -mfp16-format=@var{name}
787 -mthumb-interwork -mno-thumb-interwork @gol
788 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
789 -mtune=@var{name} -mprint-tune-info @gol
790 -mstructure-size-boundary=@var{n} @gol
791 -mabort-on-noreturn @gol
792 -mlong-calls -mno-long-calls @gol
793 -msingle-pic-base -mno-single-pic-base @gol
794 -mpic-register=@var{reg} @gol
795 -mnop-fun-dllimport @gol
796 -mpoke-function-name @gol
797 -mthumb -marm -mflip-thumb @gol
798 -mtpcs-frame -mtpcs-leaf-frame @gol
799 -mcaller-super-interworking -mcallee-super-interworking @gol
800 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
801 -mword-relocations @gol
802 -mfix-cortex-m3-ldrd @gol
803 -munaligned-access @gol
804 -mneon-for-64bits @gol
805 -mslow-flash-data @gol
806 -masm-syntax-unified @gol
808 -mverbose-cost-dump @gol
811 -mfix-cmse-cve-2021-35465 @gol
815 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
816 -mbranch-cost=@var{cost} @gol
817 -mcall-prologues -mgas-isr-prologues -mint8 @gol
818 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
819 -mn_flash=@var{size} -mno-interrupts @gol
820 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
821 -mfract-convert-truncate @gol
822 -mshort-calls -nodevicelib -nodevicespecs @gol
823 -Waddr-space-convert -Wmisspelled-isr}
825 @emph{Blackfin Options}
826 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
827 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
828 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
829 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
830 -mno-id-shared-library -mshared-library-id=@var{n} @gol
831 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
832 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
833 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
837 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
838 -msim -msdata=@var{sdata-type}}
841 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
842 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
843 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
844 -mstack-align -mdata-align -mconst-align @gol
845 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
846 -melf -maout -melinux -mlinux -sim -sim2 @gol
847 -mmul-bug-workaround -mno-mul-bug-workaround}
850 @gccoptlist{-mmac @gol
851 -mcr16cplus -mcr16c @gol
852 -msim -mint32 -mbit-ops
853 -mdata-model=@var{model}}
856 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
857 -mbig-endian -EB -mlittle-endian -EL @gol
858 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
859 -mfloat-abi=@var{name} @gol
860 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
861 -mdsp -medsp -mvdsp @gol
862 -mdiv -msmart -mhigh-registers -manchor @gol
863 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
864 -mbranch-cost=@var{n} -mcse-cc -msched-prolog -msim}
866 @emph{Darwin Options}
867 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
868 -arch_only -bind_at_load -bundle -bundle_loader @gol
869 -client_name -compatibility_version -current_version @gol
871 -dependency-file -dylib_file -dylinker_install_name @gol
872 -dynamic -dynamiclib -exported_symbols_list @gol
873 -filelist -flat_namespace -force_cpusubtype_ALL @gol
874 -force_flat_namespace -headerpad_max_install_names @gol
876 -image_base -init -install_name -keep_private_externs @gol
877 -multi_module -multiply_defined -multiply_defined_unused @gol
878 -noall_load -no_dead_strip_inits_and_terms @gol
879 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
880 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
881 -private_bundle -read_only_relocs -sectalign @gol
882 -sectobjectsymbols -whyload -seg1addr @gol
883 -sectcreate -sectobjectsymbols -sectorder @gol
884 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
885 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
886 -segprot -segs_read_only_addr -segs_read_write_addr @gol
887 -single_module -static -sub_library -sub_umbrella @gol
888 -twolevel_namespace -umbrella -undefined @gol
889 -unexported_symbols_list -weak_reference_mismatches @gol
890 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
891 -mkernel -mone-byte-bool}
893 @emph{DEC Alpha Options}
894 @gccoptlist{-mno-fp-regs -msoft-float @gol
895 -mieee -mieee-with-inexact -mieee-conformant @gol
896 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
897 -mtrap-precision=@var{mode} -mbuild-constants @gol
898 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
899 -mbwx -mmax -mfix -mcix @gol
900 -mfloat-vax -mfloat-ieee @gol
901 -mexplicit-relocs -msmall-data -mlarge-data @gol
902 -msmall-text -mlarge-text @gol
903 -mmemory-latency=@var{time}}
906 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
907 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re
908 -mjmpext -mjmp32 -malu32 -mcpu=@var{version}}
911 @gccoptlist{-msmall-model -mno-lsim}
914 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
917 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
918 -mhard-float -msoft-float @gol
919 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
920 -mdouble -mno-double @gol
921 -mmedia -mno-media -mmuladd -mno-muladd @gol
922 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
923 -mlinked-fp -mlong-calls -malign-labels @gol
924 -mlibrary-pic -macc-4 -macc-8 @gol
925 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
926 -moptimize-membar -mno-optimize-membar @gol
927 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
928 -mvliw-branch -mno-vliw-branch @gol
929 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
930 -mno-nested-cond-exec -mtomcat-stats @gol
934 @emph{GNU/Linux Options}
935 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
936 -tno-android-cc -tno-android-ld}
938 @emph{H8/300 Options}
939 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
942 @gccoptlist{-march=@var{architecture-type} @gol
943 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
944 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
945 -mfixed-range=@var{register-range} @gol
946 -mjump-in-delay -mlinker-opt -mlong-calls @gol
947 -mlong-load-store -mno-disable-fpregs @gol
948 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
949 -mno-jump-in-delay -mno-long-load-store @gol
950 -mno-portable-runtime -mno-soft-float @gol
951 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
952 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
953 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
954 -munix=@var{unix-std} -nolibdld -static -threads}
957 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
958 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
959 -mconstant-gp -mauto-pic -mfused-madd @gol
960 -minline-float-divide-min-latency @gol
961 -minline-float-divide-max-throughput @gol
962 -mno-inline-float-divide @gol
963 -minline-int-divide-min-latency @gol
964 -minline-int-divide-max-throughput @gol
965 -mno-inline-int-divide @gol
966 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
967 -mno-inline-sqrt @gol
968 -mdwarf2-asm -mearly-stop-bits @gol
969 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
970 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
971 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
972 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
973 -msched-spec-ldc -msched-spec-control-ldc @gol
974 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
975 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
976 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
977 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
980 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
981 -msign-extend-enabled -muser-enabled}
983 @emph{M32R/D Options}
984 @gccoptlist{-m32r2 -m32rx -m32r @gol
986 -malign-loops -mno-align-loops @gol
987 -missue-rate=@var{number} @gol
988 -mbranch-cost=@var{number} @gol
989 -mmodel=@var{code-size-model-type} @gol
990 -msdata=@var{sdata-type} @gol
991 -mno-flush-func -mflush-func=@var{name} @gol
992 -mno-flush-trap -mflush-trap=@var{number} @gol
996 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
998 @emph{M680x0 Options}
999 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
1000 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
1001 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
1002 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
1003 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
1004 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
1005 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
1006 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
1007 -mxgot -mno-xgot -mlong-jump-table-offsets}
1009 @emph{MCore Options}
1010 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
1011 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
1012 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
1013 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
1014 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
1017 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
1018 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
1019 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
1020 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
1023 @emph{MicroBlaze Options}
1024 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
1025 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
1026 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
1027 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
1028 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
1029 -mpic-data-is-text-relative}
1032 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
1033 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
1034 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
1035 -mips16 -mno-mips16 -mflip-mips16 @gol
1036 -minterlink-compressed -mno-interlink-compressed @gol
1037 -minterlink-mips16 -mno-interlink-mips16 @gol
1038 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
1039 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
1040 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
1041 -mno-float -msingle-float -mdouble-float @gol
1042 -modd-spreg -mno-odd-spreg @gol
1043 -mabs=@var{mode} -mnan=@var{encoding} @gol
1044 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1045 -mmcu -mmno-mcu @gol
1047 -mvirt -mno-virt @gol
1050 -mginv -mno-ginv @gol
1051 -mmicromips -mno-micromips @gol
1053 -mloongson-mmi -mno-loongson-mmi @gol
1054 -mloongson-ext -mno-loongson-ext @gol
1055 -mloongson-ext2 -mno-loongson-ext2 @gol
1056 -mfpu=@var{fpu-type} @gol
1057 -msmartmips -mno-smartmips @gol
1058 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1059 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1060 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1061 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1062 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1063 -membedded-data -mno-embedded-data @gol
1064 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1065 -mcode-readable=@var{setting} @gol
1066 -msplit-addresses -mno-split-addresses @gol
1067 -mexplicit-relocs -mno-explicit-relocs @gol
1068 -mcheck-zero-division -mno-check-zero-division @gol
1069 -mdivide-traps -mdivide-breaks @gol
1070 -mload-store-pairs -mno-load-store-pairs @gol
1071 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1072 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1073 -mfix-24k -mno-fix-24k @gol
1074 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1075 -mfix-r5900 -mno-fix-r5900 @gol
1076 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1077 -mfix-vr4120 -mno-fix-vr4120 @gol
1078 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1079 -mflush-func=@var{func} -mno-flush-func @gol
1080 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1081 -mcompact-branches=@var{policy} @gol
1082 -mfp-exceptions -mno-fp-exceptions @gol
1083 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1084 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1085 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1086 -mframe-header-opt -mno-frame-header-opt}
1089 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1090 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1091 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1092 -mno-base-addresses -msingle-exit -mno-single-exit}
1094 @emph{MN10300 Options}
1095 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1096 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1097 -mtune=@var{cpu-type} @gol
1098 -mreturn-pointer-on-d0 @gol
1099 -mno-crt0 -mrelax -mliw -msetlb}
1101 @emph{Moxie Options}
1102 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1104 @emph{MSP430 Options}
1105 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1107 -mcode-region= -mdata-region= @gol
1108 -msilicon-errata= -msilicon-errata-warn= @gol
1109 -mhwmult= -minrt -mtiny-printf -mmax-inline-shift=}
1111 @emph{NDS32 Options}
1112 @gccoptlist{-mbig-endian -mlittle-endian @gol
1113 -mreduced-regs -mfull-regs @gol
1114 -mcmov -mno-cmov @gol
1115 -mext-perf -mno-ext-perf @gol
1116 -mext-perf2 -mno-ext-perf2 @gol
1117 -mext-string -mno-ext-string @gol
1118 -mv3push -mno-v3push @gol
1119 -m16bit -mno-16bit @gol
1120 -misr-vector-size=@var{num} @gol
1121 -mcache-block-size=@var{num} @gol
1122 -march=@var{arch} @gol
1123 -mcmodel=@var{code-model} @gol
1124 -mctor-dtor -mrelax}
1126 @emph{Nios II Options}
1127 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1128 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1130 -mno-bypass-cache -mbypass-cache @gol
1131 -mno-cache-volatile -mcache-volatile @gol
1132 -mno-fast-sw-div -mfast-sw-div @gol
1133 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1134 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1135 -mcustom-fpu-cfg=@var{name} @gol
1136 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1137 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1139 @emph{Nvidia PTX Options}
1140 @gccoptlist{-m64 -mmainkernel -moptimize}
1142 @emph{OpenRISC Options}
1143 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1144 -msoft-mul -msoft-div @gol
1145 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1146 -mcmov -mror -mrori -msext -msfimm -mshftimm @gol
1147 -mcmodel=@var{code-model}}
1149 @emph{PDP-11 Options}
1150 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1151 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1152 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1154 @emph{picoChip Options}
1155 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1156 -msymbol-as-address -mno-inefficient-warnings}
1158 @emph{PowerPC Options}
1159 See RS/6000 and PowerPC Options.
1162 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1163 -mabi=@var{variant} @gol}
1165 @emph{RISC-V Options}
1166 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1168 -mabi=@var{ABI-string} @gol
1169 -mfdiv -mno-fdiv @gol
1171 -march=@var{ISA-string} @gol
1172 -mtune=@var{processor-string} @gol
1173 -mpreferred-stack-boundary=@var{num} @gol
1174 -msmall-data-limit=@var{N-bytes} @gol
1175 -msave-restore -mno-save-restore @gol
1176 -mshorten-memrefs -mno-shorten-memrefs @gol
1177 -mstrict-align -mno-strict-align @gol
1178 -mcmodel=medlow -mcmodel=medany @gol
1179 -mexplicit-relocs -mno-explicit-relocs @gol
1180 -mrelax -mno-relax @gol
1181 -mriscv-attribute -mmo-riscv-attribute @gol
1182 -malign-data=@var{type} @gol
1183 -mbig-endian -mlittle-endian @gol
1184 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1185 -mstack-protector-guard-offset=@var{offset}}
1188 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1189 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1190 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1192 @emph{RS/6000 and PowerPC Options}
1193 @gccoptlist{-mcpu=@var{cpu-type} @gol
1194 -mtune=@var{cpu-type} @gol
1195 -mcmodel=@var{code-model} @gol
1197 -maltivec -mno-altivec @gol
1198 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1199 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1200 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1201 -mfprnd -mno-fprnd @gol
1202 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1203 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1204 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1205 -malign-power -malign-natural @gol
1206 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1207 -mupdate -mno-update @gol
1208 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1209 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1210 -mstrict-align -mno-strict-align -mrelocatable @gol
1211 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1212 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1213 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1214 -mprioritize-restricted-insns=@var{priority} @gol
1215 -msched-costly-dep=@var{dependence_type} @gol
1216 -minsert-sched-nops=@var{scheme} @gol
1217 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1218 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1219 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1220 -mtraceback=@var{traceback_type} @gol
1221 -maix-struct-return -msvr4-struct-return @gol
1222 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1223 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1224 -mblock-move-inline-limit=@var{num} @gol
1225 -mblock-compare-inline-limit=@var{num} @gol
1226 -mblock-compare-inline-loop-limit=@var{num} @gol
1227 -mno-block-ops-unaligned-vsx @gol
1228 -mstring-compare-inline-limit=@var{num} @gol
1229 -misel -mno-isel @gol
1230 -mvrsave -mno-vrsave @gol
1231 -mmulhw -mno-mulhw @gol
1232 -mdlmzb -mno-dlmzb @gol
1233 -mprototype -mno-prototype @gol
1234 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1235 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1236 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1237 -mno-recip-precision @gol
1238 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1239 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1240 -msave-toc-indirect -mno-save-toc-indirect @gol
1241 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1242 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1243 -mquad-memory -mno-quad-memory @gol
1244 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1245 -mcompat-align-parm -mno-compat-align-parm @gol
1246 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1247 -mgnu-attribute -mno-gnu-attribute @gol
1248 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1249 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1250 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol
1251 -mprivileged -mno-privileged}
1254 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1256 -mbig-endian-data -mlittle-endian-data @gol
1259 -mas100-syntax -mno-as100-syntax@gol
1261 -mmax-constant-size=@gol
1264 -mallow-string-insns -mno-allow-string-insns@gol
1266 -mno-warn-multiple-fast-interrupts@gol
1267 -msave-acc-in-interrupts}
1269 @emph{S/390 and zSeries Options}
1270 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1271 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1272 -mlong-double-64 -mlong-double-128 @gol
1273 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1274 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1275 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1276 -mhtm -mvx -mzvector @gol
1277 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1278 -mfused-madd -mno-fused-madd @gol
1279 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1280 -mhotpatch=@var{halfwords},@var{halfwords}}
1282 @emph{Score Options}
1283 @gccoptlist{-meb -mel @gol
1287 -mscore5 -mscore5u -mscore7 -mscore7d}
1290 @gccoptlist{-m1 -m2 -m2e @gol
1291 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1293 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1294 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1295 -mb -ml -mdalign -mrelax @gol
1296 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1297 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1298 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1299 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1300 -maccumulate-outgoing-args @gol
1301 -matomic-model=@var{atomic-model} @gol
1302 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1303 -mcbranch-force-delay-slot @gol
1304 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1305 -mpretend-cmove -mtas}
1307 @emph{Solaris 2 Options}
1308 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1311 @emph{SPARC Options}
1312 @gccoptlist{-mcpu=@var{cpu-type} @gol
1313 -mtune=@var{cpu-type} @gol
1314 -mcmodel=@var{code-model} @gol
1315 -mmemory-model=@var{mem-model} @gol
1316 -m32 -m64 -mapp-regs -mno-app-regs @gol
1317 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1318 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1319 -mhard-quad-float -msoft-quad-float @gol
1320 -mstack-bias -mno-stack-bias @gol
1321 -mstd-struct-return -mno-std-struct-return @gol
1322 -munaligned-doubles -mno-unaligned-doubles @gol
1323 -muser-mode -mno-user-mode @gol
1324 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1325 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1326 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1327 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1328 -mpopc -mno-popc -msubxc -mno-subxc @gol
1329 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1332 @emph{System V Options}
1333 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1335 @emph{TILE-Gx Options}
1336 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1337 -mcmodel=@var{code-model}}
1339 @emph{TILEPro Options}
1340 @gccoptlist{-mcpu=@var{cpu} -m32}
1343 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1344 -mprolog-function -mno-prolog-function -mspace @gol
1345 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1346 -mapp-regs -mno-app-regs @gol
1347 -mdisable-callt -mno-disable-callt @gol
1348 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1349 -mv850e -mv850 -mv850e3v5 @gol
1360 @gccoptlist{-mg -mgnu -munix}
1362 @emph{Visium Options}
1363 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1364 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1367 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1368 -mpointer-size=@var{size}}
1370 @emph{VxWorks Options}
1371 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1372 -Xbind-lazy -Xbind-now}
1375 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1376 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1377 -mfpmath=@var{unit} @gol
1378 -masm=@var{dialect} -mno-fancy-math-387 @gol
1379 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1380 -mno-wide-multiply -mrtd -malign-double @gol
1381 -mpreferred-stack-boundary=@var{num} @gol
1382 -mincoming-stack-boundary=@var{num} @gol
1383 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mmwait @gol
1384 -mrecip -mrecip=@var{opt} @gol
1385 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1386 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1387 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1388 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1389 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1390 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1391 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1392 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1393 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1394 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1395 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1396 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1397 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1398 -mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni@gol
1400 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1401 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1403 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1404 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1405 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1406 -mregparm=@var{num} -msseregparm @gol
1407 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1408 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1409 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1410 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1411 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1412 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1413 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1414 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1415 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1416 -mstack-protector-guard-reg=@var{reg} @gol
1417 -mstack-protector-guard-offset=@var{offset} @gol
1418 -mstack-protector-guard-symbol=@var{symbol} @gol
1419 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1420 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1421 -mindirect-branch-register -mneeded}
1423 @emph{x86 Windows Options}
1424 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1425 -mnop-fun-dllimport -mthread @gol
1426 -municode -mwin32 -mwindows -fno-set-stack-executable}
1428 @emph{Xstormy16 Options}
1431 @emph{Xtensa Options}
1432 @gccoptlist{-mconst16 -mno-const16 @gol
1433 -mfused-madd -mno-fused-madd @gol
1435 -mserialize-volatile -mno-serialize-volatile @gol
1436 -mtext-section-literals -mno-text-section-literals @gol
1437 -mauto-litpools -mno-auto-litpools @gol
1438 -mtarget-align -mno-target-align @gol
1439 -mlongcalls -mno-longcalls @gol
1440 -mabi=@var{abi-type}}
1442 @emph{zSeries Options}
1443 See S/390 and zSeries Options.
1447 @node Overall Options
1448 @section Options Controlling the Kind of Output
1450 Compilation can involve up to four stages: preprocessing, compilation
1451 proper, assembly and linking, always in that order. GCC is capable of
1452 preprocessing and compiling several files either into several
1453 assembler input files, or into one assembler input file; then each
1454 assembler input file produces an object file, and linking combines all
1455 the object files (those newly compiled, and those specified as input)
1456 into an executable file.
1458 @cindex file name suffix
1459 For any given input file, the file name suffix determines what kind of
1460 compilation is done:
1464 C source code that must be preprocessed.
1467 C source code that should not be preprocessed.
1470 C++ source code that should not be preprocessed.
1473 Objective-C source code. Note that you must link with the @file{libobjc}
1474 library to make an Objective-C program work.
1477 Objective-C source code that should not be preprocessed.
1481 Objective-C++ source code. Note that you must link with the @file{libobjc}
1482 library to make an Objective-C++ program work. Note that @samp{.M} refers
1483 to a literal capital M@.
1485 @item @var{file}.mii
1486 Objective-C++ source code that should not be preprocessed.
1489 C, C++, Objective-C or Objective-C++ header file to be turned into a
1490 precompiled header (default), or C, C++ header file to be turned into an
1491 Ada spec (via the @option{-fdump-ada-spec} switch).
1494 @itemx @var{file}.cp
1495 @itemx @var{file}.cxx
1496 @itemx @var{file}.cpp
1497 @itemx @var{file}.CPP
1498 @itemx @var{file}.c++
1500 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1501 the last two letters must both be literally @samp{x}. Likewise,
1502 @samp{.C} refers to a literal capital C@.
1506 Objective-C++ source code that must be preprocessed.
1508 @item @var{file}.mii
1509 Objective-C++ source code that should not be preprocessed.
1513 @itemx @var{file}.hp
1514 @itemx @var{file}.hxx
1515 @itemx @var{file}.hpp
1516 @itemx @var{file}.HPP
1517 @itemx @var{file}.h++
1518 @itemx @var{file}.tcc
1519 C++ header file to be turned into a precompiled header or Ada spec.
1522 @itemx @var{file}.for
1523 @itemx @var{file}.ftn
1524 Fixed form Fortran source code that should not be preprocessed.
1527 @itemx @var{file}.FOR
1528 @itemx @var{file}.fpp
1529 @itemx @var{file}.FPP
1530 @itemx @var{file}.FTN
1531 Fixed form Fortran source code that must be preprocessed (with the traditional
1534 @item @var{file}.f90
1535 @itemx @var{file}.f95
1536 @itemx @var{file}.f03
1537 @itemx @var{file}.f08
1538 Free form Fortran source code that should not be preprocessed.
1540 @item @var{file}.F90
1541 @itemx @var{file}.F95
1542 @itemx @var{file}.F03
1543 @itemx @var{file}.F08
1544 Free form Fortran source code that must be preprocessed (with the
1545 traditional preprocessor).
1557 D documentation code (Ddoc).
1559 @item @var{file}.ads
1560 Ada source code file that contains a library unit declaration (a
1561 declaration of a package, subprogram, or generic, or a generic
1562 instantiation), or a library unit renaming declaration (a package,
1563 generic, or subprogram renaming declaration). Such files are also
1566 @item @var{file}.adb
1567 Ada source code file containing a library unit body (a subprogram or
1568 package body). Such files are also called @dfn{bodies}.
1570 @c GCC also knows about some suffixes for languages not yet included:
1578 @itemx @var{file}.sx
1579 Assembler code that must be preprocessed.
1582 An object file to be fed straight into linking.
1583 Any file name with no recognized suffix is treated this way.
1587 You can specify the input language explicitly with the @option{-x} option:
1590 @item -x @var{language}
1591 Specify explicitly the @var{language} for the following input files
1592 (rather than letting the compiler choose a default based on the file
1593 name suffix). This option applies to all following input files until
1594 the next @option{-x} option. Possible values for @var{language} are:
1596 c c-header cpp-output
1597 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1598 objective-c objective-c-header objective-c-cpp-output
1599 objective-c++ objective-c++-header objective-c++-cpp-output
1600 assembler assembler-with-cpp
1603 f77 f77-cpp-input f95 f95-cpp-input
1608 Turn off any specification of a language, so that subsequent files are
1609 handled according to their file name suffixes (as they are if @option{-x}
1610 has not been used at all).
1613 If you only want some of the stages of compilation, you can use
1614 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1615 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1616 @command{gcc} is to stop. Note that some combinations (for example,
1617 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1622 Compile or assemble the source files, but do not link. The linking
1623 stage simply is not done. The ultimate output is in the form of an
1624 object file for each source file.
1626 By default, the object file name for a source file is made by replacing
1627 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1629 Unrecognized input files, not requiring compilation or assembly, are
1634 Stop after the stage of compilation proper; do not assemble. The output
1635 is in the form of an assembler code file for each non-assembler input
1638 By default, the assembler file name for a source file is made by
1639 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1641 Input files that don't require compilation are ignored.
1645 Stop after the preprocessing stage; do not run the compiler proper. The
1646 output is in the form of preprocessed source code, which is sent to the
1649 Input files that don't require preprocessing are ignored.
1651 @cindex output file option
1654 Place the primary output in file @var{file}. This applies to whatever
1655 sort of output is being produced, whether it be an executable file, an
1656 object file, an assembler file or preprocessed C code.
1658 If @option{-o} is not specified, the default is to put an executable
1659 file in @file{a.out}, the object file for
1660 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1661 assembler file in @file{@var{source}.s}, a precompiled header file in
1662 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1665 Though @option{-o} names only the primary output, it also affects the
1666 naming of auxiliary and dump outputs. See the examples below. Unless
1667 overridden, both auxiliary outputs and dump outputs are placed in the
1668 same directory as the primary output. In auxiliary outputs, the suffix
1669 of the input file is replaced with that of the auxiliary output file
1670 type; in dump outputs, the suffix of the dump file is appended to the
1671 input file suffix. In compilation commands, the base name of both
1672 auxiliary and dump outputs is that of the primary output; in compile and
1673 link commands, the primary output name, minus the executable suffix, is
1674 combined with the input file name. If both share the same base name,
1675 disregarding the suffix, the result of the combination is that base
1676 name, otherwise, they are concatenated, separated by a dash.
1682 will use @file{foo.o} as the primary output, and place aux outputs and
1683 dumps next to it, e.g., aux file @file{foo.dwo} for
1684 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1685 @option{-fdump-rtl-final}.
1687 If a non-linker output file is explicitly specified, aux and dump files
1688 by default take the same base name:
1691 gcc -c foo.c -o dir/foobar.o ...
1694 will name aux outputs @file{dir/foobar.*} and dump outputs
1695 @file{dir/foobar.c.*}.
1697 A linker output will instead prefix aux and dump outputs:
1700 gcc foo.c bar.c -o dir/foobar ...
1703 will generally name aux outputs @file{dir/foobar-foo.*} and
1704 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1705 @file{dir/foobar-bar.c.*}.
1707 The one exception to the above is when the executable shares the base
1708 name with the single input:
1711 gcc foo.c -o dir/foo ...
1714 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1715 named @file{dir/foo.c.*}.
1717 The location and the names of auxiliary and dump outputs can be adjusted
1718 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1719 @option{-dumpdir}, @option{-save-temps=cwd}, and
1720 @option{-save-temps=obj}.
1723 @item -dumpbase @var{dumpbase}
1725 This option sets the base name for auxiliary and dump output files. It
1726 does not affect the name of the primary output file. Intermediate
1727 outputs, when preserved, are not regarded as primary outputs, but as
1731 gcc -save-temps -S foo.c
1734 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1735 then compiles to the (implied) output file @file{foo.s}, whereas:
1738 gcc -save-temps -dumpbase save-foo -c foo.c
1741 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1742 an intermediate, thus auxiliary output), and then assembles to the
1743 (implied) output file @file{foo.o}.
1745 Absent this option, dump and aux files take their names from the input
1746 file, or from the (non-linker) output file, if one is explicitly
1747 specified: dump output files (e.g. those requested by @option{-fdump-*}
1748 options) with the input name suffix, and aux output files (those
1749 requested by other non-dump options, e.g. @code{-save-temps},
1750 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1752 Similar suffix differentiation of dump and aux outputs can be attained
1753 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1754 @option{-dumpbase-ext .suf}.
1756 If @var{dumpbase} is explicitly specified with any directory component,
1757 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1758 @option{-save-temps=*}) is ignored, and instead of appending to it,
1759 @var{dumpbase} fully overrides it:
1762 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1763 -dumpdir pfx- -save-temps=cwd ...
1766 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1767 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1768 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1770 When @option{-dumpbase} is specified in a command that compiles multiple
1771 inputs, or that compiles and then links, it may be combined with
1772 @var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
1773 file is compiled using the combined @var{dumppfx}, and default values
1774 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1778 gcc foo.c bar.c -c -dumpbase main ...
1781 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1782 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1783 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1784 and @file{main-bar.*}.
1786 An empty string specified as @var{dumpbase} avoids the influence of the
1787 output basename in the naming of auxiliary and dump outputs during
1788 compilation, computing default values :
1791 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1794 will name aux outputs @file{dir/foo.*} and dump outputs
1795 @file{dir/foo.c.*}. Note how their basenames are taken from the input
1796 name, but the directory still defaults to that of the output.
1798 The empty-string dumpbase does not prevent the use of the output
1799 basename for outputs during linking:
1802 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1805 The compilation of the source files will name auxiliary outputs
1806 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1807 @file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
1808 linking will use @file{dir/foobar.} as the prefix for dumps and
1812 @item -dumpbase-ext @var{auxdropsuf}
1813 @opindex dumpbase-ext
1814 When forming the name of an auxiliary (but not a dump) output file, drop
1815 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1816 suffixes. If not specified, this option defaults to the suffix of a
1817 default @var{dumpbase}, i.e., the suffix of the input file when
1818 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1819 is combined with @var{dumppfx}.
1822 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1825 creates @file{dir/foo.o} as the main output, and generates auxiliary
1826 outputs in @file{dir/x-foo.*}, taking the location of the primary
1827 output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
1828 outputs retain the suffix: @file{dir/x-foo.c.*}.
1830 This option is disregarded if it does not match the suffix of a
1831 specified @var{dumpbase}, except as an alternative to the executable
1832 suffix when appending the linker output base name to @var{dumppfx}, as
1836 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1839 creates @file{main.out} as the primary output, and avoids overwriting
1840 the auxiliary and dump outputs by using the executable name minus
1841 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1842 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1843 @file{main-foo.c.*} and @file{main-bar.c.*}.
1846 @item -dumpdir @var{dumppfx}
1848 When forming the name of an auxiliary or dump output file, use
1849 @var{dumppfx} as a prefix:
1852 gcc -dumpdir pfx- -c foo.c ...
1855 creates @file{foo.o} as the primary output, and auxiliary outputs named
1856 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1857 @var{dumpbase} derived from the default primary output, derived in turn
1858 from the input name. Dump outputs also take the input name suffix:
1861 If @var{dumppfx} is to be used as a directory name, it must end with a
1862 directory separator:
1865 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1868 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1869 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1870 default @var{dumpbase} derived from the primary output name. Dump
1871 outputs also take the input name suffix: @file{dir/bar.c.*}.
1873 It defaults to the location of the output file; options
1874 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1875 default, just like an explicit @option{-dumpdir} option. In case
1876 multiple such options are given, the last one prevails:
1879 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1882 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1883 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1884 @option{-dumpdir} option. It does not matter that @option{=obj} is the
1885 default for @option{-save-temps}, nor that the output directory is
1886 implicitly the current directory. Dump outputs are named
1889 When compiling from multiple input files, if @option{-dumpbase} is
1890 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1891 are appended to (or override, if containing any directory components) an
1892 explicit or defaulted @var{dumppfx}, so that each of the multiple
1893 compilations gets differently-named aux and dump outputs.
1896 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1899 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1900 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1901 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1902 and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
1903 single-input compilation:
1906 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1909 that, applying @option{-dumpbase} to a single source, does not compute
1910 and append a separate @var{dumpbase} per input file. Its auxiliary and
1911 dump outputs go in @file{dir/pfx-main.*}.
1913 When compiling and then linking from multiple input files, a defaulted
1914 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1915 transformation above (e.g. the compilation of @file{foo.c} and
1916 @file{bar.c} above, but without @option{-c}). If neither
1917 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1918 base name, minus @var{auxdropsuf}, if specified, or the executable
1919 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1920 instead. Note, however, that unlike earlier cases of linking:
1923 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1926 does not append the output name @file{main} to @var{dumppfx}, because
1927 @option{-dumpdir} is explicitly specified. The goal is that the
1928 explicitly-specified @var{dumppfx} may contain the specified output name
1929 as part of the prefix, if desired; only an explicitly-specified
1930 @option{-dumpbase} would be combined with it, in order to avoid simply
1931 discarding a meaningful option.
1933 When compiling and then linking from a single input file, the linker
1934 output base name will only be appended to the default @var{dumppfx} as
1935 above if it does not share the base name with the single input file
1936 name. This has been covered in single-input linking cases above, but
1937 not with an explicit @option{-dumpdir} that inhibits the combination,
1938 even if overridden by @option{-save-temps=*}:
1941 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1944 Auxiliary outputs are named @file{foo.*}, and dump outputs
1945 @file{foo.c.*}, in the current working directory as ultimately requested
1946 by @option{-save-temps=cwd}.
1948 Summing it all up for an intuitive though slightly imprecise data flow:
1949 the primary output name is broken into a directory part and a basename
1950 part; @var{dumppfx} is set to the former, unless overridden by
1951 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1952 to the latter, unless overriden by @option{-dumpbase}. If there are
1953 multiple inputs or linking, this @var{dumpbase} may be combined with
1954 @var{dumppfx} and taken from each input file. Auxiliary output names
1955 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1956 minus suffix, and the auxiliary output suffix; dump output names are
1957 only different in that the suffix from @var{dumpbase} is retained.
1959 When it comes to auxiliary and dump outputs created during LTO
1960 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1961 given or as derived from the linker output name but not from inputs,
1962 even in cases in which this combination would not otherwise be used as
1963 such, is passed down with a trailing period replacing the compiler-added
1964 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1965 being involved in linking, this program does not normally get any
1966 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
1968 When running sub-compilers, @command{lto-wrapper} appends LTO stage
1969 names to the received @var{dumppfx}, ensures it contains a directory
1970 component so that it overrides any @option{-dumpdir}, and passes that as
1971 @option{-dumpbase} to sub-compilers.
1975 Print (on standard error output) the commands executed to run the stages
1976 of compilation. Also print the version number of the compiler driver
1977 program and of the preprocessor and the compiler proper.
1981 Like @option{-v} except the commands are not executed and arguments
1982 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1983 This is useful for shell scripts to capture the driver-generated command lines.
1987 Print (on the standard output) a description of the command-line options
1988 understood by @command{gcc}. If the @option{-v} option is also specified
1989 then @option{--help} is also passed on to the various processes
1990 invoked by @command{gcc}, so that they can display the command-line options
1991 they accept. If the @option{-Wextra} option has also been specified
1992 (prior to the @option{--help} option), then command-line options that
1993 have no documentation associated with them are also displayed.
1996 @opindex target-help
1997 Print (on the standard output) a description of target-specific command-line
1998 options for each tool. For some targets extra target-specific
1999 information may also be printed.
2001 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2002 Print (on the standard output) a description of the command-line
2003 options understood by the compiler that fit into all specified classes
2004 and qualifiers. These are the supported classes:
2007 @item @samp{optimizers}
2008 Display all of the optimization options supported by the
2011 @item @samp{warnings}
2012 Display all of the options controlling warning messages
2013 produced by the compiler.
2016 Display target-specific options. Unlike the
2017 @option{--target-help} option however, target-specific options of the
2018 linker and assembler are not displayed. This is because those
2019 tools do not currently support the extended @option{--help=} syntax.
2022 Display the values recognized by the @option{--param}
2025 @item @var{language}
2026 Display the options supported for @var{language}, where
2027 @var{language} is the name of one of the languages supported in this
2028 version of GCC@. If an option is supported by all languages, one needs
2029 to select @samp{common} class.
2032 Display the options that are common to all languages.
2035 These are the supported qualifiers:
2038 @item @samp{undocumented}
2039 Display only those options that are undocumented.
2042 Display options taking an argument that appears after an equal
2043 sign in the same continuous piece of text, such as:
2044 @samp{--help=target}.
2046 @item @samp{separate}
2047 Display options taking an argument that appears as a separate word
2048 following the original option, such as: @samp{-o output-file}.
2051 Thus for example to display all the undocumented target-specific
2052 switches supported by the compiler, use:
2055 --help=target,undocumented
2058 The sense of a qualifier can be inverted by prefixing it with the
2059 @samp{^} character, so for example to display all binary warning
2060 options (i.e., ones that are either on or off and that do not take an
2061 argument) that have a description, use:
2064 --help=warnings,^joined,^undocumented
2067 The argument to @option{--help=} should not consist solely of inverted
2070 Combining several classes is possible, although this usually
2071 restricts the output so much that there is nothing to display. One
2072 case where it does work, however, is when one of the classes is
2073 @var{target}. For example, to display all the target-specific
2074 optimization options, use:
2077 --help=target,optimizers
2080 The @option{--help=} option can be repeated on the command line. Each
2081 successive use displays its requested class of options, skipping
2082 those that have already been displayed. If @option{--help} is also
2083 specified anywhere on the command line then this takes precedence
2084 over any @option{--help=} option.
2086 If the @option{-Q} option appears on the command line before the
2087 @option{--help=} option, then the descriptive text displayed by
2088 @option{--help=} is changed. Instead of describing the displayed
2089 options, an indication is given as to whether the option is enabled,
2090 disabled or set to a specific value (assuming that the compiler
2091 knows this at the point where the @option{--help=} option is used).
2093 Here is a truncated example from the ARM port of @command{gcc}:
2096 % gcc -Q -mabi=2 --help=target -c
2097 The following options are target specific:
2099 -mabort-on-noreturn [disabled]
2103 The output is sensitive to the effects of previous command-line
2104 options, so for example it is possible to find out which optimizations
2105 are enabled at @option{-O2} by using:
2108 -Q -O2 --help=optimizers
2111 Alternatively you can discover which binary optimizations are enabled
2112 by @option{-O3} by using:
2115 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2116 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2117 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2122 Display the version number and copyrights of the invoked GCC@.
2124 @item -pass-exit-codes
2125 @opindex pass-exit-codes
2126 Normally the @command{gcc} program exits with the code of 1 if any
2127 phase of the compiler returns a non-success return code. If you specify
2128 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2129 the numerically highest error produced by any phase returning an error
2130 indication. The C, C++, and Fortran front ends return 4 if an internal
2131 compiler error is encountered.
2135 Use pipes rather than temporary files for communication between the
2136 various stages of compilation. This fails to work on some systems where
2137 the assembler is unable to read from a pipe; but the GNU assembler has
2140 @item -specs=@var{file}
2142 Process @var{file} after the compiler reads in the standard @file{specs}
2143 file, in order to override the defaults which the @command{gcc} driver
2144 program uses when determining what switches to pass to @command{cc1},
2145 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
2146 @option{-specs=@var{file}} can be specified on the command line, and they
2147 are processed in order, from left to right. @xref{Spec Files}, for
2148 information about the format of the @var{file}.
2152 Invoke all subcommands under a wrapper program. The name of the
2153 wrapper program and its parameters are passed as a comma separated
2157 gcc -c t.c -wrapper gdb,--args
2161 This invokes all subprograms of @command{gcc} under
2162 @samp{gdb --args}, thus the invocation of @command{cc1} is
2163 @samp{gdb --args cc1 @dots{}}.
2165 @item -ffile-prefix-map=@var{old}=@var{new}
2166 @opindex ffile-prefix-map
2167 When compiling files residing in directory @file{@var{old}}, record
2168 any references to them in the result of the compilation as if the
2169 files resided in directory @file{@var{new}} instead. Specifying this
2170 option is equivalent to specifying all the individual
2171 @option{-f*-prefix-map} options. This can be used to make reproducible
2172 builds that are location independent. See also
2173 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
2175 @item -fplugin=@var{name}.so
2177 Load the plugin code in file @var{name}.so, assumed to be a
2178 shared object to be dlopen'd by the compiler. The base name of
2179 the shared object file is used to identify the plugin for the
2180 purposes of argument parsing (See
2181 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2182 Each plugin should define the callback functions specified in the
2185 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2186 @opindex fplugin-arg
2187 Define an argument called @var{key} with a value of @var{value}
2188 for the plugin called @var{name}.
2190 @item -fdump-ada-spec@r{[}-slim@r{]}
2191 @opindex fdump-ada-spec
2192 For C and C++ source and include files, generate corresponding Ada specs.
2193 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2194 GNAT User's Guide}, which provides detailed documentation on this feature.
2196 @item -fada-spec-parent=@var{unit}
2197 @opindex fada-spec-parent
2198 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2199 Ada specs as child units of parent @var{unit}.
2201 @item -fdump-go-spec=@var{file}
2202 @opindex fdump-go-spec
2203 For input files in any language, generate corresponding Go
2204 declarations in @var{file}. This generates Go @code{const},
2205 @code{type}, @code{var}, and @code{func} declarations which may be a
2206 useful way to start writing a Go interface to code written in some
2209 @include @value{srcdir}/../libiberty/at-file.texi
2213 @section Compiling C++ Programs
2215 @cindex suffixes for C++ source
2216 @cindex C++ source file suffixes
2217 C++ source files conventionally use one of the suffixes @samp{.C},
2218 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2219 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2220 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2221 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
2222 files with these names and compiles them as C++ programs even if you
2223 call the compiler the same way as for compiling C programs (usually
2224 with the name @command{gcc}).
2228 However, the use of @command{gcc} does not add the C++ library.
2229 @command{g++} is a program that calls GCC and automatically specifies linking
2230 against the C++ library. It treats @samp{.c},
2231 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2232 files unless @option{-x} is used. This program is also useful when
2233 precompiling a C header file with a @samp{.h} extension for use in C++
2234 compilations. On many systems, @command{g++} is also installed with
2235 the name @command{c++}.
2237 @cindex invoking @command{g++}
2238 When you compile C++ programs, you may specify many of the same
2239 command-line options that you use for compiling programs in any
2240 language; or command-line options meaningful for C and related
2241 languages; or options that are meaningful only for C++ programs.
2242 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2243 explanations of options for languages related to C@.
2244 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2245 explanations of options that are meaningful only for C++ programs.
2247 @node C Dialect Options
2248 @section Options Controlling C Dialect
2249 @cindex dialect options
2250 @cindex language dialect options
2251 @cindex options, dialect
2253 The following options control the dialect of C (or languages derived
2254 from C, such as C++, Objective-C and Objective-C++) that the compiler
2258 @cindex ANSI support
2262 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2263 equivalent to @option{-std=c++98}.
2265 This turns off certain features of GCC that are incompatible with ISO
2266 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2267 such as the @code{asm} and @code{typeof} keywords, and
2268 predefined macros such as @code{unix} and @code{vax} that identify the
2269 type of system you are using. It also enables the undesirable and
2270 rarely used ISO trigraph feature. For the C compiler,
2271 it disables recognition of C++ style @samp{//} comments as well as
2272 the @code{inline} keyword.
2274 The alternate keywords @code{__asm__}, @code{__extension__},
2275 @code{__inline__} and @code{__typeof__} continue to work despite
2276 @option{-ansi}. You would not want to use them in an ISO C program, of
2277 course, but it is useful to put them in header files that might be included
2278 in compilations done with @option{-ansi}. Alternate predefined macros
2279 such as @code{__unix__} and @code{__vax__} are also available, with or
2280 without @option{-ansi}.
2282 The @option{-ansi} option does not cause non-ISO programs to be
2283 rejected gratuitously. For that, @option{-Wpedantic} is required in
2284 addition to @option{-ansi}. @xref{Warning Options}.
2286 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2287 option is used. Some header files may notice this macro and refrain
2288 from declaring certain functions or defining certain macros that the
2289 ISO standard doesn't call for; this is to avoid interfering with any
2290 programs that might use these names for other things.
2292 Functions that are normally built in but do not have semantics
2293 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2294 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2295 built-in functions provided by GCC}, for details of the functions
2300 Determine the language standard. @xref{Standards,,Language Standards
2301 Supported by GCC}, for details of these standard versions. This option
2302 is currently only supported when compiling C or C++.
2304 The compiler can accept several base standards, such as @samp{c90} or
2305 @samp{c++98}, and GNU dialects of those standards, such as
2306 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
2307 compiler accepts all programs following that standard plus those
2308 using GNU extensions that do not contradict it. For example,
2309 @option{-std=c90} turns off certain features of GCC that are
2310 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2311 keywords, but not other GNU extensions that do not have a meaning in
2312 ISO C90, such as omitting the middle term of a @code{?:}
2313 expression. On the other hand, when a GNU dialect of a standard is
2314 specified, all features supported by the compiler are enabled, even when
2315 those features change the meaning of the base standard. As a result, some
2316 strict-conforming programs may be rejected. The particular standard
2317 is used by @option{-Wpedantic} to identify which features are GNU
2318 extensions given that version of the standard. For example
2319 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2320 comments, while @option{-std=gnu99 -Wpedantic} does not.
2322 A value for this option must be provided; possible values are
2328 Support all ISO C90 programs (certain GNU extensions that conflict
2329 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2331 @item iso9899:199409
2332 ISO C90 as modified in amendment 1.
2338 ISO C99. This standard is substantially completely supported, modulo
2339 bugs and floating-point issues
2340 (mainly but not entirely relating to optional C99 features from
2341 Annexes F and G). See
2342 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
2343 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2348 ISO C11, the 2011 revision of the ISO C standard. This standard is
2349 substantially completely supported, modulo bugs, floating-point issues
2350 (mainly but not entirely relating to optional C11 features from
2351 Annexes F and G) and the optional Annexes K (Bounds-checking
2352 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
2358 ISO C17, the 2017 revision of the ISO C standard
2359 (published in 2018). This standard is
2360 same as C11 except for corrections of defects (all of which are also
2361 applied with @option{-std=c11}) and a new value of
2362 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2365 The next version of the ISO C standard, still under development. The
2366 support for this version is experimental and incomplete.
2370 GNU dialect of ISO C90 (including some C99 features).
2374 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2378 GNU dialect of ISO C11.
2379 The name @samp{gnu1x} is deprecated.
2383 GNU dialect of ISO C17. This is the default for C code.
2386 The next version of the ISO C standard, still under development, plus
2387 GNU extensions. The support for this version is experimental and
2392 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2393 additional defect reports. Same as @option{-ansi} for C++ code.
2397 GNU dialect of @option{-std=c++98}.
2401 The 2011 ISO C++ standard plus amendments.
2402 The name @samp{c++0x} is deprecated.
2406 GNU dialect of @option{-std=c++11}.
2407 The name @samp{gnu++0x} is deprecated.
2411 The 2014 ISO C++ standard plus amendments.
2412 The name @samp{c++1y} is deprecated.
2416 GNU dialect of @option{-std=c++14}.
2417 The name @samp{gnu++1y} is deprecated.
2421 The 2017 ISO C++ standard plus amendments.
2422 The name @samp{c++1z} is deprecated.
2426 GNU dialect of @option{-std=c++17}.
2427 This is the default for C++ code.
2428 The name @samp{gnu++1z} is deprecated.
2432 The 2020 ISO C++ standard plus amendments.
2433 Support is experimental, and could change in incompatible ways in
2435 The name @samp{c++2a} is deprecated.
2439 GNU dialect of @option{-std=c++20}.
2440 Support is experimental, and could change in incompatible ways in
2442 The name @samp{gnu++2a} is deprecated.
2446 The next revision of the ISO C++ standard, planned for
2447 2023. Support is highly experimental, and will almost certainly
2448 change in incompatible ways in future releases.
2452 GNU dialect of @option{-std=c++2b}. Support is highly experimental,
2453 and will almost certainly change in incompatible ways in future
2457 @item -aux-info @var{filename}
2459 Output to the given filename prototyped declarations for all functions
2460 declared and/or defined in a translation unit, including those in header
2461 files. This option is silently ignored in any language other than C@.
2463 Besides declarations, the file indicates, in comments, the origin of
2464 each declaration (source file and line), whether the declaration was
2465 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2466 @samp{O} for old, respectively, in the first character after the line
2467 number and the colon), and whether it came from a declaration or a
2468 definition (@samp{C} or @samp{F}, respectively, in the following
2469 character). In the case of function definitions, a K&R-style list of
2470 arguments followed by their declarations is also provided, inside
2471 comments, after the declaration.
2473 @item -fallow-parameterless-variadic-functions
2474 @opindex fallow-parameterless-variadic-functions
2475 Accept variadic functions without named parameters.
2477 Although it is possible to define such a function, this is not very
2478 useful as it is not possible to read the arguments. This is only
2479 supported for C as this construct is allowed by C++.
2484 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2485 keyword, so that code can use these words as identifiers. You can use
2486 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2487 instead. @option{-ansi} implies @option{-fno-asm}.
2489 In C++, this switch only affects the @code{typeof} keyword, since
2490 @code{asm} and @code{inline} are standard keywords. You may want to
2491 use the @option{-fno-gnu-keywords} flag instead, which has the same
2492 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2493 switch only affects the @code{asm} and @code{typeof} keywords, since
2494 @code{inline} is a standard keyword in ISO C99.
2497 @itemx -fno-builtin-@var{function}
2498 @opindex fno-builtin
2500 @cindex built-in functions
2501 Don't recognize built-in functions that do not begin with
2502 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2503 functions provided by GCC}, for details of the functions affected,
2504 including those which are not built-in functions when @option{-ansi} or
2505 @option{-std} options for strict ISO C conformance are used because they
2506 do not have an ISO standard meaning.
2508 GCC normally generates special code to handle certain built-in functions
2509 more efficiently; for instance, calls to @code{alloca} may become single
2510 instructions which adjust the stack directly, and calls to @code{memcpy}
2511 may become inline copy loops. The resulting code is often both smaller
2512 and faster, but since the function calls no longer appear as such, you
2513 cannot set a breakpoint on those calls, nor can you change the behavior
2514 of the functions by linking with a different library. In addition,
2515 when a function is recognized as a built-in function, GCC may use
2516 information about that function to warn about problems with calls to
2517 that function, or to generate more efficient code, even if the
2518 resulting code still contains calls to that function. For example,
2519 warnings are given with @option{-Wformat} for bad calls to
2520 @code{printf} when @code{printf} is built in and @code{strlen} is
2521 known not to modify global memory.
2523 With the @option{-fno-builtin-@var{function}} option
2524 only the built-in function @var{function} is
2525 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2526 function is named that is not built-in in this version of GCC, this
2527 option is ignored. There is no corresponding
2528 @option{-fbuiltin-@var{function}} option; if you wish to enable
2529 built-in functions selectively when using @option{-fno-builtin} or
2530 @option{-ffreestanding}, you may define macros such as:
2533 #define abs(n) __builtin_abs ((n))
2534 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2537 @item -fcond-mismatch
2538 @opindex fcond-mismatch
2539 Allow conditional expressions with mismatched types in the second and
2540 third arguments. The value of such an expression is void. This option
2541 is not supported for C++.
2543 @item -ffreestanding
2544 @opindex ffreestanding
2545 @cindex hosted environment
2547 Assert that compilation targets a freestanding environment. This
2548 implies @option{-fno-builtin}. A freestanding environment
2549 is one in which the standard library may not exist, and program startup may
2550 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2551 This is equivalent to @option{-fno-hosted}.
2553 @xref{Standards,,Language Standards Supported by GCC}, for details of
2554 freestanding and hosted environments.
2559 Enable parsing of function definitions marked with @code{__GIMPLE}.
2560 This is an experimental feature that allows unit testing of GIMPLE
2565 When the option @option{-fgnu-tm} is specified, the compiler
2566 generates code for the Linux variant of Intel's current Transactional
2567 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2568 an experimental feature whose interface may change in future versions
2569 of GCC, as the official specification changes. Please note that not
2570 all architectures are supported for this feature.
2572 For more information on GCC's support for transactional memory,
2573 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2574 Transactional Memory Library}.
2576 Note that the transactional memory feature is not supported with
2577 non-call exceptions (@option{-fnon-call-exceptions}).
2579 @item -fgnu89-inline
2580 @opindex fgnu89-inline
2581 The option @option{-fgnu89-inline} tells GCC to use the traditional
2582 GNU semantics for @code{inline} functions when in C99 mode.
2583 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2584 Using this option is roughly equivalent to adding the
2585 @code{gnu_inline} function attribute to all inline functions
2586 (@pxref{Function Attributes}).
2588 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2589 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2590 specifies the default behavior).
2591 This option is not supported in @option{-std=c90} or
2592 @option{-std=gnu90} mode.
2594 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2595 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2596 in effect for @code{inline} functions. @xref{Common Predefined
2597 Macros,,,cpp,The C Preprocessor}.
2601 @cindex hosted environment
2603 Assert that compilation targets a hosted environment. This implies
2604 @option{-fbuiltin}. A hosted environment is one in which the
2605 entire standard library is available, and in which @code{main} has a return
2606 type of @code{int}. Examples are nearly everything except a kernel.
2607 This is equivalent to @option{-fno-freestanding}.
2609 @item -flax-vector-conversions
2610 @opindex flax-vector-conversions
2611 Allow implicit conversions between vectors with differing numbers of
2612 elements and/or incompatible element types. This option should not be
2615 @item -fms-extensions
2616 @opindex fms-extensions
2617 Accept some non-standard constructs used in Microsoft header files.
2619 In C++ code, this allows member names in structures to be similar
2620 to previous types declarations.
2629 Some cases of unnamed fields in structures and unions are only
2630 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2631 fields within structs/unions}, for details.
2633 Note that this option is off for all targets except for x86
2634 targets using ms-abi.
2636 @item -foffload=disable
2637 @itemx -foffload=default
2638 @itemx -foffload=@var{target-list}
2640 @cindex Offloading targets
2641 @cindex OpenACC offloading targets
2642 @cindex OpenMP offloading targets
2643 Specify for which OpenMP and OpenACC offload targets code should be generated.
2644 The default behavior, equivalent to @option{-foffload=default}, is to generate
2645 code for all supported offload targets. The @option{-foffload=disable} form
2646 generates code only for the host fallback, while
2647 @option{-foffload=@var{target-list}} generates code only for the specified
2648 comma-separated list of offload targets.
2650 Offload targets are specified in GCC's internal target-triplet format. You can
2651 run the compiler with @option{-v} to show the list of configured offload targets
2652 under @code{OFFLOAD_TARGET_NAMES}.
2654 @item -foffload-options=@var{options}
2655 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2656 @opindex foffload-options
2657 @cindex Offloading options
2658 @cindex OpenACC offloading options
2659 @cindex OpenMP offloading options
2661 With @option{-foffload-options=@var{options}}, GCC passes the specified
2662 @var{options} to the compilers for all enabled offloading targets. You can
2663 specify options that apply only to a specific target or targets by using
2664 the @option{-foffload-options=@var{target-list}=@var{options}} form. The
2665 @var{target-list} is a comma-separated list in the same format as for the
2666 @option{-foffload=} option.
2668 Typical command lines are
2671 -foffload-options=-lgfortran -foffload-options=-lm
2672 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2673 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2678 @cindex OpenACC accelerator programming
2679 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2680 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2681 compiler generates accelerated code according to the OpenACC Application
2682 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2683 implies @option{-pthread}, and thus is only supported on targets that
2684 have support for @option{-pthread}.
2686 @item -fopenacc-dim=@var{geom}
2687 @opindex fopenacc-dim
2688 @cindex OpenACC accelerator programming
2689 Specify default compute dimensions for parallel offload regions that do
2690 not explicitly specify. The @var{geom} value is a triple of
2691 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2692 can be omitted, to use a target-specific default value.
2696 @cindex OpenMP parallel
2697 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2698 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2699 compiler generates parallel code according to the OpenMP Application
2700 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2701 implies @option{-pthread}, and thus is only supported on targets that
2702 have support for @option{-pthread}. @option{-fopenmp} implies
2703 @option{-fopenmp-simd}.
2706 @opindex fopenmp-simd
2709 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2710 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2713 @item -fpermitted-flt-eval-methods=@var{style}
2714 @opindex fpermitted-flt-eval-methods
2715 @opindex fpermitted-flt-eval-methods=c11
2716 @opindex fpermitted-flt-eval-methods=ts-18661-3
2717 ISO/IEC TS 18661-3 defines new permissible values for
2718 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2719 a semantic type that is an interchange or extended format should be
2720 evaluated to the precision and range of that type. These new values are
2721 a superset of those permitted under C99/C11, which does not specify the
2722 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2723 conforming to C11 may not have been written expecting the possibility of
2726 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2727 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2728 or the extended set of values specified in ISO/IEC TS 18661-3.
2730 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2732 The default when in a standards compliant mode (@option{-std=c11} or similar)
2733 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2734 dialect (@option{-std=gnu11} or similar) is
2735 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2737 @item -fplan9-extensions
2738 @opindex fplan9-extensions
2739 Accept some non-standard constructs used in Plan 9 code.
2741 This enables @option{-fms-extensions}, permits passing pointers to
2742 structures with anonymous fields to functions that expect pointers to
2743 elements of the type of the field, and permits referring to anonymous
2744 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2745 struct/union fields within structs/unions}, for details. This is only
2746 supported for C, not C++.
2748 @item -fsigned-bitfields
2749 @itemx -funsigned-bitfields
2750 @itemx -fno-signed-bitfields
2751 @itemx -fno-unsigned-bitfields
2752 @opindex fsigned-bitfields
2753 @opindex funsigned-bitfields
2754 @opindex fno-signed-bitfields
2755 @opindex fno-unsigned-bitfields
2756 These options control whether a bit-field is signed or unsigned, when the
2757 declaration does not use either @code{signed} or @code{unsigned}. By
2758 default, such a bit-field is signed, because this is consistent: the
2759 basic integer types such as @code{int} are signed types.
2762 @opindex fsigned-char
2763 Let the type @code{char} be signed, like @code{signed char}.
2765 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2766 the negative form of @option{-funsigned-char}. Likewise, the option
2767 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2769 @item -funsigned-char
2770 @opindex funsigned-char
2771 Let the type @code{char} be unsigned, like @code{unsigned char}.
2773 Each kind of machine has a default for what @code{char} should
2774 be. It is either like @code{unsigned char} by default or like
2775 @code{signed char} by default.
2777 Ideally, a portable program should always use @code{signed char} or
2778 @code{unsigned char} when it depends on the signedness of an object.
2779 But many programs have been written to use plain @code{char} and
2780 expect it to be signed, or expect it to be unsigned, depending on the
2781 machines they were written for. This option, and its inverse, let you
2782 make such a program work with the opposite default.
2784 The type @code{char} is always a distinct type from each of
2785 @code{signed char} or @code{unsigned char}, even though its behavior
2786 is always just like one of those two.
2788 @item -fsso-struct=@var{endianness}
2789 @opindex fsso-struct
2790 Set the default scalar storage order of structures and unions to the
2791 specified endianness. The accepted values are @samp{big-endian},
2792 @samp{little-endian} and @samp{native} for the native endianness of
2793 the target (the default). This option is not supported for C++.
2795 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2796 code that is not binary compatible with code generated without it if the
2797 specified endianness is not the native endianness of the target.
2800 @node C++ Dialect Options
2801 @section Options Controlling C++ Dialect
2803 @cindex compiler options, C++
2804 @cindex C++ options, command-line
2805 @cindex options, C++
2806 This section describes the command-line options that are only meaningful
2807 for C++ programs. You can also use most of the GNU compiler options
2808 regardless of what language your program is in. For example, you
2809 might compile a file @file{firstClass.C} like this:
2812 g++ -g -fstrict-enums -O -c firstClass.C
2816 In this example, only @option{-fstrict-enums} is an option meant
2817 only for C++ programs; you can use the other options with any
2818 language supported by GCC@.
2820 Some options for compiling C programs, such as @option{-std}, are also
2821 relevant for C++ programs.
2822 @xref{C Dialect Options,,Options Controlling C Dialect}.
2824 Here is a list of options that are @emph{only} for compiling C++ programs:
2828 @item -fabi-version=@var{n}
2829 @opindex fabi-version
2830 Use version @var{n} of the C++ ABI@. The default is version 0.
2832 Version 0 refers to the version conforming most closely to
2833 the C++ ABI specification. Therefore, the ABI obtained using version 0
2834 will change in different versions of G++ as ABI bugs are fixed.
2836 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2838 Version 2 is the version of the C++ ABI that first appeared in G++
2839 3.4, and was the default through G++ 4.9.
2841 Version 3 corrects an error in mangling a constant address as a
2844 Version 4, which first appeared in G++ 4.5, implements a standard
2845 mangling for vector types.
2847 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2848 attribute const/volatile on function pointer types, decltype of a
2849 plain decl, and use of a function parameter in the declaration of
2852 Version 6, which first appeared in G++ 4.7, corrects the promotion
2853 behavior of C++11 scoped enums and the mangling of template argument
2854 packs, const/static_cast, prefix ++ and --, and a class scope function
2855 used as a template argument.
2857 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2858 builtin type and corrects the mangling of lambdas in default argument
2861 Version 8, which first appeared in G++ 4.9, corrects the substitution
2862 behavior of function types with function-cv-qualifiers.
2864 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2867 Version 10, which first appeared in G++ 6.1, adds mangling of
2868 attributes that affect type identity, such as ia32 calling convention
2869 attributes (e.g.@: @samp{stdcall}).
2871 Version 11, which first appeared in G++ 7, corrects the mangling of
2872 sizeof... expressions and operator names. For multiple entities with
2873 the same name within a function, that are declared in different scopes,
2874 the mangling now changes starting with the twelfth occurrence. It also
2875 implies @option{-fnew-inheriting-ctors}.
2877 Version 12, which first appeared in G++ 8, corrects the calling
2878 conventions for empty classes on the x86_64 target and for classes
2879 with only deleted copy/move constructors. It accidentally changes the
2880 calling convention for classes with a deleted copy constructor and a
2881 trivial move constructor.
2883 Version 13, which first appeared in G++ 8.2, fixes the accidental
2884 change in version 12.
2886 Version 14, which first appeared in G++ 10, corrects the mangling of
2887 the nullptr expression.
2889 Version 15, which first appeared in G++ 11, changes the mangling of
2890 @code{__alignof__} to be distinct from that of @code{alignof}, and
2891 dependent operator names.
2893 See also @option{-Wabi}.
2895 @item -fabi-compat-version=@var{n}
2896 @opindex fabi-compat-version
2897 On targets that support strong aliases, G++
2898 works around mangling changes by creating an alias with the correct
2899 mangled name when defining a symbol with an incorrect mangled name.
2900 This switch specifies which ABI version to use for the alias.
2902 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2903 compatibility). If another ABI version is explicitly selected, this
2904 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2905 use @option{-fabi-compat-version=2}.
2907 If this option is not provided but @option{-Wabi=@var{n}} is, that
2908 version is used for compatibility aliases. If this option is provided
2909 along with @option{-Wabi} (without the version), the version from this
2910 option is used for the warning.
2912 @item -fno-access-control
2913 @opindex fno-access-control
2914 @opindex faccess-control
2915 Turn off all access checking. This switch is mainly useful for working
2916 around bugs in the access control code.
2919 @opindex faligned-new
2920 Enable support for C++17 @code{new} of types that require more
2921 alignment than @code{void* ::operator new(std::size_t)} provides. A
2922 numeric argument such as @code{-faligned-new=32} can be used to
2923 specify how much alignment (in bytes) is provided by that function,
2924 but few users will need to override the default of
2925 @code{alignof(std::max_align_t)}.
2927 This flag is enabled by default for @option{-std=c++17}.
2932 @opindex fno-char8_t
2933 Enable support for @code{char8_t} as adopted for C++20. This includes
2934 the addition of a new @code{char8_t} fundamental type, changes to the
2935 types of UTF-8 string and character literals, new signatures for
2936 user-defined literals, associated standard library updates, and new
2937 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2939 This option enables functions to be overloaded for ordinary and UTF-8
2943 int f(const char *); // #1
2944 int f(const char8_t *); // #2
2945 int v1 = f("text"); // Calls #1
2946 int v2 = f(u8"text"); // Calls #2
2950 and introduces new signatures for user-defined literals:
2953 int operator""_udl1(char8_t);
2954 int v3 = u8'x'_udl1;
2955 int operator""_udl2(const char8_t*, std::size_t);
2956 int v4 = u8"text"_udl2;
2957 template<typename T, T...> int operator""_udl3();
2958 int v5 = u8"text"_udl3;
2962 The change to the types of UTF-8 string and character literals introduces
2963 incompatibilities with ISO C++11 and later standards. For example, the
2964 following code is well-formed under ISO C++11, but is ill-formed when
2965 @option{-fchar8_t} is specified.
2968 char ca[] = u8"xx"; // error: char-array initialized from wide
2970 const char *cp = u8"xx";// error: invalid conversion from
2971 // `const char8_t*' to `const char*'
2973 auto v = f(u8"xx"); // error: invalid conversion from
2974 // `const char8_t*' to `const char*'
2975 std::string s@{u8"xx"@}; // error: no matching function for call to
2976 // `std::basic_string<char>::basic_string()'
2977 using namespace std::literals;
2978 s = u8"xx"s; // error: conversion from
2979 // `basic_string<char8_t>' to non-scalar
2980 // type `basic_string<char>' requested
2985 Check that the pointer returned by @code{operator new} is non-null
2986 before attempting to modify the storage allocated. This check is
2987 normally unnecessary because the C++ standard specifies that
2988 @code{operator new} only returns @code{0} if it is declared
2989 @code{throw()}, in which case the compiler always checks the
2990 return value even without this option. In all other cases, when
2991 @code{operator new} has a non-empty exception specification, memory
2992 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2993 @samp{new (nothrow)}.
2996 @itemx -fconcepts-ts
2998 @opindex fconcepts-ts
2999 Below @option{-std=c++20}, @option{-fconcepts} enables support for the
3000 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
3002 With @option{-std=c++20} and above, Concepts are part of the language
3003 standard, so @option{-fconcepts} defaults to on. But the standard
3004 specification of Concepts differs significantly from the TS, so some
3005 constructs that were allowed in the TS but didn't make it into the
3006 standard can still be enabled by @option{-fconcepts-ts}.
3008 @item -fconstexpr-depth=@var{n}
3009 @opindex fconstexpr-depth
3010 Set the maximum nested evaluation depth for C++11 constexpr functions
3011 to @var{n}. A limit is needed to detect endless recursion during
3012 constant expression evaluation. The minimum specified by the standard
3015 @item -fconstexpr-cache-depth=@var{n}
3016 @opindex fconstexpr-cache-depth
3017 Set the maximum level of nested evaluation depth for C++11 constexpr
3018 functions that will be cached to @var{n}. This is a heuristic that
3019 trades off compilation speed (when the cache avoids repeated
3020 calculations) against memory consumption (when the cache grows very
3021 large from highly recursive evaluations). The default is 8. Very few
3022 users are likely to want to adjust it, but if your code does heavy
3023 constexpr calculations you might want to experiment to find which
3024 value works best for you.
3026 @item -fconstexpr-loop-limit=@var{n}
3027 @opindex fconstexpr-loop-limit
3028 Set the maximum number of iterations for a loop in C++14 constexpr functions
3029 to @var{n}. A limit is needed to detect infinite loops during
3030 constant expression evaluation. The default is 262144 (1<<18).
3032 @item -fconstexpr-ops-limit=@var{n}
3033 @opindex fconstexpr-ops-limit
3034 Set the maximum number of operations during a single constexpr evaluation.
3035 Even when number of iterations of a single loop is limited with the above limit,
3036 if there are several nested loops and each of them has many iterations but still
3037 smaller than the above limit, or if in a body of some loop or even outside
3038 of a loop too many expressions need to be evaluated, the resulting constexpr
3039 evaluation might take too long.
3040 The default is 33554432 (1<<25).
3043 @opindex fcoroutines
3044 Enable support for the C++ coroutines extension (experimental).
3046 @item -fno-elide-constructors
3047 @opindex fno-elide-constructors
3048 @opindex felide-constructors
3049 The C++ standard allows an implementation to omit creating a temporary
3050 that is only used to initialize another object of the same type.
3051 Specifying this option disables that optimization, and forces G++ to
3052 call the copy constructor in all cases. This option also causes G++
3053 to call trivial member functions which otherwise would be expanded inline.
3055 In C++17, the compiler is required to omit these temporaries, but this
3056 option still affects trivial member functions.
3058 @item -fno-enforce-eh-specs
3059 @opindex fno-enforce-eh-specs
3060 @opindex fenforce-eh-specs
3061 Don't generate code to check for violation of exception specifications
3062 at run time. This option violates the C++ standard, but may be useful
3063 for reducing code size in production builds, much like defining
3064 @code{NDEBUG}. This does not give user code permission to throw
3065 exceptions in violation of the exception specifications; the compiler
3066 still optimizes based on the specifications, so throwing an
3067 unexpected exception results in undefined behavior at run time.
3069 @item -fextern-tls-init
3070 @itemx -fno-extern-tls-init
3071 @opindex fextern-tls-init
3072 @opindex fno-extern-tls-init
3073 The C++11 and OpenMP standards allow @code{thread_local} and
3074 @code{threadprivate} variables to have dynamic (runtime)
3075 initialization. To support this, any use of such a variable goes
3076 through a wrapper function that performs any necessary initialization.
3077 When the use and definition of the variable are in the same
3078 translation unit, this overhead can be optimized away, but when the
3079 use is in a different translation unit there is significant overhead
3080 even if the variable doesn't actually need dynamic initialization. If
3081 the programmer can be sure that no use of the variable in a
3082 non-defining TU needs to trigger dynamic initialization (either
3083 because the variable is statically initialized, or a use of the
3084 variable in the defining TU will be executed before any uses in
3085 another TU), they can avoid this overhead with the
3086 @option{-fno-extern-tls-init} option.
3088 On targets that support symbol aliases, the default is
3089 @option{-fextern-tls-init}. On targets that do not support symbol
3090 aliases, the default is @option{-fno-extern-tls-init}.
3092 @item -fno-gnu-keywords
3093 @opindex fno-gnu-keywords
3094 @opindex fgnu-keywords
3095 Do not recognize @code{typeof} as a keyword, so that code can use this
3096 word as an identifier. You can use the keyword @code{__typeof__} instead.
3097 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3098 @option{-std=c++98}, @option{-std=c++11}, etc.
3100 @item -fno-implicit-templates
3101 @opindex fno-implicit-templates
3102 @opindex fimplicit-templates
3103 Never emit code for non-inline templates that are instantiated
3104 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3105 If you use this option, you must take care to structure your code to
3106 include all the necessary explicit instantiations to avoid getting
3107 undefined symbols at link time.
3108 @xref{Template Instantiation}, for more information.
3110 @item -fno-implicit-inline-templates
3111 @opindex fno-implicit-inline-templates
3112 @opindex fimplicit-inline-templates
3113 Don't emit code for implicit instantiations of inline templates, either.
3114 The default is to handle inlines differently so that compiles with and
3115 without optimization need the same set of explicit instantiations.
3117 @item -fno-implement-inlines
3118 @opindex fno-implement-inlines
3119 @opindex fimplement-inlines
3120 To save space, do not emit out-of-line copies of inline functions
3121 controlled by @code{#pragma implementation}. This causes linker
3122 errors if these functions are not inlined everywhere they are called.
3125 @itemx -fno-modules-ts
3126 @opindex fmodules-ts
3127 @opindex fno-modules-ts
3128 Enable support for C++20 modules (@xref{C++ Modules}). The
3129 @option{-fno-modules-ts} is usually not needed, as that is the
3130 default. Even though this is a C++20 feature, it is not currently
3131 implicitly enabled by selecting that standard version.
3133 @item -fmodule-header
3134 @itemx -fmodule-header=user
3135 @itemx -fmodule-header=system
3136 @opindex fmodule-header
3137 Compile a header file to create an importable header unit.
3139 @item -fmodule-implicit-inline
3140 @opindex fmodule-implicit-inline
3141 Member functions defined in their class definitions are not implicitly
3142 inline for modular code. This is different to traditional C++
3143 behavior, for good reasons. However, it may result in a difficulty
3144 during code porting. This option makes such function definitions
3145 implicitly inline. It does however generate an ABI incompatibility,
3146 so you must use it everywhere or nowhere. (Such definitions outside
3147 of a named module remain implicitly inline, regardless.)
3149 @item -fno-module-lazy
3150 @opindex fno-module-lazy
3151 @opindex fmodule-lazy
3152 Disable lazy module importing and module mapper creation.
3154 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3155 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3156 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3157 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3158 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3159 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3160 @vindex CXX_MODULE_MAPPER @r{environment variable}
3161 @opindex fmodule-mapper
3162 An oracle to query for module name to filename mappings. If
3163 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3164 and if that is unset, an in-process default is provided.
3167 @opindex fmodule-only
3168 Only emit the Compiled Module Interface, inhibiting any object file.
3170 @item -fms-extensions
3171 @opindex fms-extensions
3172 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3173 int and getting a pointer to member function via non-standard syntax.
3175 @item -fnew-inheriting-ctors
3176 @opindex fnew-inheriting-ctors
3177 Enable the P0136 adjustment to the semantics of C++11 constructor
3178 inheritance. This is part of C++17 but also considered to be a Defect
3179 Report against C++11 and C++14. This flag is enabled by default
3180 unless @option{-fabi-version=10} or lower is specified.
3182 @item -fnew-ttp-matching
3183 @opindex fnew-ttp-matching
3184 Enable the P0522 resolution to Core issue 150, template template
3185 parameters and default arguments: this allows a template with default
3186 template arguments as an argument for a template template parameter
3187 with fewer template parameters. This flag is enabled by default for
3188 @option{-std=c++17}.
3190 @item -fno-nonansi-builtins
3191 @opindex fno-nonansi-builtins
3192 @opindex fnonansi-builtins
3193 Disable built-in declarations of functions that are not mandated by
3194 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
3195 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3198 @opindex fnothrow-opt
3199 Treat a @code{throw()} exception specification as if it were a
3200 @code{noexcept} specification to reduce or eliminate the text size
3201 overhead relative to a function with no exception specification. If
3202 the function has local variables of types with non-trivial
3203 destructors, the exception specification actually makes the
3204 function smaller because the EH cleanups for those variables can be
3205 optimized away. The semantic effect is that an exception thrown out of
3206 a function with such an exception specification results in a call
3207 to @code{terminate} rather than @code{unexpected}.
3209 @item -fno-operator-names
3210 @opindex fno-operator-names
3211 @opindex foperator-names
3212 Do not treat the operator name keywords @code{and}, @code{bitand},
3213 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3214 synonyms as keywords.
3216 @item -fno-optional-diags
3217 @opindex fno-optional-diags
3218 @opindex foptional-diags
3219 Disable diagnostics that the standard says a compiler does not need to
3220 issue. Currently, the only such diagnostic issued by G++ is the one for
3221 a name having multiple meanings within a class.
3224 @opindex fpermissive
3225 Downgrade some diagnostics about nonconformant code from errors to
3226 warnings. Thus, using @option{-fpermissive} allows some
3227 nonconforming code to compile.
3229 @item -fno-pretty-templates
3230 @opindex fno-pretty-templates
3231 @opindex fpretty-templates
3232 When an error message refers to a specialization of a function
3233 template, the compiler normally prints the signature of the
3234 template followed by the template arguments and any typedefs or
3235 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3236 rather than @code{void f(int)}) so that it's clear which template is
3237 involved. When an error message refers to a specialization of a class
3238 template, the compiler omits any template arguments that match
3239 the default template arguments for that template. If either of these
3240 behaviors make it harder to understand the error message rather than
3241 easier, you can use @option{-fno-pretty-templates} to disable them.
3246 Disable generation of information about every class with virtual
3247 functions for use by the C++ run-time type identification features
3248 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
3249 of the language, you can save some space by using this flag. Note that
3250 exception handling uses the same information, but G++ generates it as
3251 needed. The @code{dynamic_cast} operator can still be used for casts that
3252 do not require run-time type information, i.e.@: casts to @code{void *} or to
3253 unambiguous base classes.
3255 Mixing code compiled with @option{-frtti} with that compiled with
3256 @option{-fno-rtti} may not work. For example, programs may
3257 fail to link if a class compiled with @option{-fno-rtti} is used as a base
3258 for a class compiled with @option{-frtti}.
3260 @item -fsized-deallocation
3261 @opindex fsized-deallocation
3262 Enable the built-in global declarations
3264 void operator delete (void *, std::size_t) noexcept;
3265 void operator delete[] (void *, std::size_t) noexcept;
3267 as introduced in C++14. This is useful for user-defined replacement
3268 deallocation functions that, for example, use the size of the object
3269 to make deallocation faster. Enabled by default under
3270 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
3271 warns about places that might want to add a definition.
3273 @item -fstrict-enums
3274 @opindex fstrict-enums
3275 Allow the compiler to optimize using the assumption that a value of
3276 enumerated type can only be one of the values of the enumeration (as
3277 defined in the C++ standard; basically, a value that can be
3278 represented in the minimum number of bits needed to represent all the
3279 enumerators). This assumption may not be valid if the program uses a
3280 cast to convert an arbitrary integer value to the enumerated type.
3282 @item -fstrong-eval-order
3283 @opindex fstrong-eval-order
3284 Evaluate member access, array subscripting, and shift expressions in
3285 left-to-right order, and evaluate assignment in right-to-left order,
3286 as adopted for C++17. Enabled by default with @option{-std=c++17}.
3287 @option{-fstrong-eval-order=some} enables just the ordering of member
3288 access and shift expressions, and is the default without
3289 @option{-std=c++17}.
3291 @item -ftemplate-backtrace-limit=@var{n}
3292 @opindex ftemplate-backtrace-limit
3293 Set the maximum number of template instantiation notes for a single
3294 warning or error to @var{n}. The default value is 10.
3296 @item -ftemplate-depth=@var{n}
3297 @opindex ftemplate-depth
3298 Set the maximum instantiation depth for template classes to @var{n}.
3299 A limit on the template instantiation depth is needed to detect
3300 endless recursions during template class instantiation. ANSI/ISO C++
3301 conforming programs must not rely on a maximum depth greater than 17
3302 (changed to 1024 in C++11). The default value is 900, as the compiler
3303 can run out of stack space before hitting 1024 in some situations.
3305 @item -fno-threadsafe-statics
3306 @opindex fno-threadsafe-statics
3307 @opindex fthreadsafe-statics
3308 Do not emit the extra code to use the routines specified in the C++
3309 ABI for thread-safe initialization of local statics. You can use this
3310 option to reduce code size slightly in code that doesn't need to be
3313 @item -fuse-cxa-atexit
3314 @opindex fuse-cxa-atexit
3315 Register destructors for objects with static storage duration with the
3316 @code{__cxa_atexit} function rather than the @code{atexit} function.
3317 This option is required for fully standards-compliant handling of static
3318 destructors, but only works if your C library supports
3319 @code{__cxa_atexit}.
3321 @item -fno-use-cxa-get-exception-ptr
3322 @opindex fno-use-cxa-get-exception-ptr
3323 @opindex fuse-cxa-get-exception-ptr
3324 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
3325 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3326 if the runtime routine is not available.
3328 @item -fvisibility-inlines-hidden
3329 @opindex fvisibility-inlines-hidden
3330 This switch declares that the user does not attempt to compare
3331 pointers to inline functions or methods where the addresses of the two functions
3332 are taken in different shared objects.
3334 The effect of this is that GCC may, effectively, mark inline methods with
3335 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3336 appear in the export table of a DSO and do not require a PLT indirection
3337 when used within the DSO@. Enabling this option can have a dramatic effect
3338 on load and link times of a DSO as it massively reduces the size of the
3339 dynamic export table when the library makes heavy use of templates.
3341 The behavior of this switch is not quite the same as marking the
3342 methods as hidden directly, because it does not affect static variables
3343 local to the function or cause the compiler to deduce that
3344 the function is defined in only one shared object.
3346 You may mark a method as having a visibility explicitly to negate the
3347 effect of the switch for that method. For example, if you do want to
3348 compare pointers to a particular inline method, you might mark it as
3349 having default visibility. Marking the enclosing class with explicit
3350 visibility has no effect.
3352 Explicitly instantiated inline methods are unaffected by this option
3353 as their linkage might otherwise cross a shared library boundary.
3354 @xref{Template Instantiation}.
3356 @item -fvisibility-ms-compat
3357 @opindex fvisibility-ms-compat
3358 This flag attempts to use visibility settings to make GCC's C++
3359 linkage model compatible with that of Microsoft Visual Studio.
3361 The flag makes these changes to GCC's linkage model:
3365 It sets the default visibility to @code{hidden}, like
3366 @option{-fvisibility=hidden}.
3369 Types, but not their members, are not hidden by default.
3372 The One Definition Rule is relaxed for types without explicit
3373 visibility specifications that are defined in more than one
3374 shared object: those declarations are permitted if they are
3375 permitted when this option is not used.
3378 In new code it is better to use @option{-fvisibility=hidden} and
3379 export those classes that are intended to be externally visible.
3380 Unfortunately it is possible for code to rely, perhaps accidentally,
3381 on the Visual Studio behavior.
3383 Among the consequences of these changes are that static data members
3384 of the same type with the same name but defined in different shared
3385 objects are different, so changing one does not change the other;
3386 and that pointers to function members defined in different shared
3387 objects may not compare equal. When this flag is given, it is a
3388 violation of the ODR to define types with the same name differently.
3393 Do not use weak symbol support, even if it is provided by the linker.
3394 By default, G++ uses weak symbols if they are available. This
3395 option exists only for testing, and should not be used by end-users;
3396 it results in inferior code and has no benefits. This option may
3397 be removed in a future release of G++.
3399 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3400 @opindex fext-numeric-literals
3401 @opindex fno-ext-numeric-literals
3402 Accept imaginary, fixed-point, or machine-defined
3403 literal number suffixes as GNU extensions.
3404 When this option is turned off these suffixes are treated
3405 as C++11 user-defined literal numeric suffixes.
3406 This is on by default for all pre-C++11 dialects and all GNU dialects:
3407 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3408 @option{-std=gnu++14}.
3409 This option is off by default
3410 for ISO C++11 onwards (@option{-std=c++11}, ...).
3414 Do not search for header files in the standard directories specific to
3415 C++, but do still search the other standard directories. (This option
3416 is used when building the C++ library.)
3418 @item -flang-info-include-translate
3419 @itemx -flang-info-include-translate-not
3420 @itemx -flang-info-include-translate=@var{header}
3421 @opindex flang-info-include-translate
3422 @opindex flang-info-include-translate-not
3423 Inform of include translation events. The first will note accepted
3424 include translations, the second will note declined include
3425 translations. The @var{header} form will inform of include
3426 translations relating to that specific header. If @var{header} is of
3427 the form @code{"user"} or @code{<system>} it will be resolved to a
3428 specific user or system header using the include path.
3430 @item -flang-info-module-cmi
3431 @itemx -flang-info-module-cmi=@var{module}
3432 @opindex flang-info-module-cmi
3433 Inform of Compiled Module Interface pathnames. The first will note
3434 all read CMI pathnames. The @var{module} form will not reading a
3435 specific module's CMI. @var{module} may be a named module or a
3436 header-unit (the latter indicated by either being a pathname containing
3437 directory separators or enclosed in @code{<>} or @code{""}).
3439 @item -stdlib=@var{libstdc++,libc++}
3441 When G++ is configured to support this option, it allows specification of
3442 alternate C++ runtime libraries. Two options are available: @var{libstdc++}
3443 (the default, native C++ runtime for G++) and @var{libc++} which is the
3444 C++ runtime installed on some operating systems (e.g. Darwin versions from
3445 Darwin11 onwards). The option switches G++ to use the headers from the
3446 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3447 when a C++ runtime is required for linking.
3450 In addition, these warning options have meanings only for C++ programs:
3453 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3455 Warn when a type with an ABI tag is used in a context that does not
3456 have that ABI tag. See @ref{C++ Attributes} for more information
3459 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3460 @opindex Wcomma-subscript
3461 @opindex Wno-comma-subscript
3462 Warn about uses of a comma expression within a subscripting expression.
3463 This usage was deprecated in C++20. However, a comma expression wrapped
3464 in @code{( )} is not deprecated. Example:
3468 void f(int *a, int b, int c) @{
3469 a[b,c]; // deprecated
3475 Enabled by default with @option{-std=c++20}.
3477 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3478 @opindex Wctad-maybe-unsupported
3479 @opindex Wno-ctad-maybe-unsupported
3480 Warn when performing class template argument deduction (CTAD) on a type with
3481 no explicitly written deduction guides. This warning will point out cases
3482 where CTAD succeeded only because the compiler synthesized the implicit
3483 deduction guides, which might not be what the programmer intended. Certain
3484 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3485 types that are designed to support CTAD. This warning can be suppressed with
3486 the following pattern:
3489 struct allow_ctad_t; // any name works
3490 template <typename T> struct S @{
3493 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
3496 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3497 @opindex Wctor-dtor-privacy
3498 @opindex Wno-ctor-dtor-privacy
3499 Warn when a class seems unusable because all the constructors or
3500 destructors in that class are private, and it has neither friends nor
3501 public static member functions. Also warn if there are no non-private
3502 methods, and there's at least one private member function that isn't
3503 a constructor or destructor.
3505 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3506 @opindex Wdelete-non-virtual-dtor
3507 @opindex Wno-delete-non-virtual-dtor
3508 Warn when @code{delete} is used to destroy an instance of a class that
3509 has virtual functions and non-virtual destructor. It is unsafe to delete
3510 an instance of a derived class through a pointer to a base class if the
3511 base class does not have a virtual destructor. This warning is enabled
3514 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3515 @opindex Wdeprecated-copy
3516 @opindex Wno-deprecated-copy
3517 Warn that the implicit declaration of a copy constructor or copy
3518 assignment operator is deprecated if the class has a user-provided
3519 copy constructor or copy assignment operator, in C++11 and up. This
3520 warning is enabled by @option{-Wextra}. With
3521 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3522 user-provided destructor.
3524 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3525 @opindex Wdeprecated-enum-enum-conversion
3526 @opindex Wno-deprecated-enum-enum-conversion
3527 Disable the warning about the case when the usual arithmetic conversions
3528 are applied on operands where one is of enumeration type and the other is
3529 of a different enumeration type. This conversion was deprecated in C++20.
3538 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3539 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3540 by @option{-Wenum-conversion}.
3542 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3543 @opindex Wdeprecated-enum-float-conversion
3544 @opindex Wno-deprecated-enum-float-conversion
3545 Disable the warning about the case when the usual arithmetic conversions
3546 are applied on operands where one is of enumeration type and the other is
3547 of a floating-point type. This conversion was deprecated in C++20. For
3556 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3557 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3558 by @option{-Wenum-conversion}.
3560 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3561 @opindex Winit-list-lifetime
3562 @opindex Wno-init-list-lifetime
3563 Do not warn about uses of @code{std::initializer_list} that are likely
3564 to result in dangling pointers. Since the underlying array for an
3565 @code{initializer_list} is handled like a normal C++ temporary object,
3566 it is easy to inadvertently keep a pointer to the array past the end
3567 of the array's lifetime. For example:
3571 If a function returns a temporary @code{initializer_list}, or a local
3572 @code{initializer_list} variable, the array's lifetime ends at the end
3573 of the return statement, so the value returned has a dangling pointer.
3576 If a new-expression creates an @code{initializer_list}, the array only
3577 lives until the end of the enclosing full-expression, so the
3578 @code{initializer_list} in the heap has a dangling pointer.
3581 When an @code{initializer_list} variable is assigned from a
3582 brace-enclosed initializer list, the temporary array created for the
3583 right side of the assignment only lives until the end of the
3584 full-expression, so at the next statement the @code{initializer_list}
3585 variable has a dangling pointer.
3588 // li's initial underlying array lives as long as li
3589 std::initializer_list<int> li = @{ 1,2,3 @};
3590 // assignment changes li to point to a temporary array
3592 // now the temporary is gone and li has a dangling pointer
3593 int i = li.begin()[0] // undefined behavior
3597 When a list constructor stores the @code{begin} pointer from the
3598 @code{initializer_list} argument, this doesn't extend the lifetime of
3599 the array, so if a class variable is constructed from a temporary
3600 @code{initializer_list}, the pointer is left dangling by the end of
3601 the variable declaration statement.
3605 @item -Winvalid-imported-macros
3606 @opindex Winvalid-imported-macros
3607 @opindex Wno-invalid-imported-macros
3608 Verify all imported macro definitions are valid at the end of
3609 compilation. This is not enabled by default, as it requires
3610 additional processing to determine. It may be useful when preparing
3611 sets of header-units to ensure consistent macros.
3613 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3614 @opindex Wliteral-suffix
3615 @opindex Wno-literal-suffix
3616 Do not warn when a string or character literal is followed by a
3617 ud-suffix which does not begin with an underscore. As a conforming
3618 extension, GCC treats such suffixes as separate preprocessing tokens
3619 in order to maintain backwards compatibility with code that uses
3620 formatting macros from @code{<inttypes.h>}. For example:
3623 #define __STDC_FORMAT_MACROS
3624 #include <inttypes.h>
3629 printf("My int64: %" PRId64"\n", i64);
3633 In this case, @code{PRId64} is treated as a separate preprocessing token.
3635 This option also controls warnings when a user-defined literal
3636 operator is declared with a literal suffix identifier that doesn't
3637 begin with an underscore. Literal suffix identifiers that don't begin
3638 with an underscore are reserved for future standardization.
3640 These warnings are enabled by default.
3642 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3644 @opindex Wno-narrowing
3645 For C++11 and later standards, narrowing conversions are diagnosed by default,
3646 as required by the standard. A narrowing conversion from a constant produces
3647 an error, and a narrowing conversion from a non-constant produces a warning,
3648 but @option{-Wno-narrowing} suppresses the diagnostic.
3649 Note that this does not affect the meaning of well-formed code;
3650 narrowing conversions are still considered ill-formed in SFINAE contexts.
3652 With @option{-Wnarrowing} in C++98, warn when a narrowing
3653 conversion prohibited by C++11 occurs within
3657 int i = @{ 2.2 @}; // error: narrowing from double to int
3660 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3662 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3664 @opindex Wno-noexcept
3665 Warn when a noexcept-expression evaluates to false because of a call
3666 to a function that does not have a non-throwing exception
3667 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3668 the compiler to never throw an exception.
3670 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3671 @opindex Wnoexcept-type
3672 @opindex Wno-noexcept-type
3673 Warn if the C++17 feature making @code{noexcept} part of a function
3674 type changes the mangled name of a symbol relative to C++14. Enabled
3675 by @option{-Wabi} and @option{-Wc++17-compat}.
3680 template <class T> void f(T t) @{ t(); @};
3682 void h() @{ f(g); @}
3686 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3687 C++17 it calls @code{f<void(*)()noexcept>}.
3689 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3690 @opindex Wclass-memaccess
3691 @opindex Wno-class-memaccess
3692 Warn when the destination of a call to a raw memory function such as
3693 @code{memset} or @code{memcpy} is an object of class type, and when writing
3694 into such an object might bypass the class non-trivial or deleted constructor
3695 or copy assignment, violate const-correctness or encapsulation, or corrupt
3696 virtual table pointers. Modifying the representation of such objects may
3697 violate invariants maintained by member functions of the class. For example,
3698 the call to @code{memset} below is undefined because it modifies a non-trivial
3699 class object and is, therefore, diagnosed. The safe way to either initialize
3700 or clear the storage of objects of such types is by using the appropriate
3701 constructor or assignment operator, if one is available.
3703 std::string str = "abc";
3704 memset (&str, 0, sizeof str);
3706 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3707 Explicitly casting the pointer to the class object to @code{void *} or
3708 to a type that can be safely accessed by the raw memory function suppresses
3711 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3712 @opindex Wnon-virtual-dtor
3713 @opindex Wno-non-virtual-dtor
3714 Warn when a class has virtual functions and an accessible non-virtual
3715 destructor itself or in an accessible polymorphic base class, in which
3716 case it is possible but unsafe to delete an instance of a derived
3717 class through a pointer to the class itself or base class. This
3718 warning is automatically enabled if @option{-Weffc++} is specified.
3720 @item -Wregister @r{(C++ and Objective-C++ only)}
3722 @opindex Wno-register
3723 Warn on uses of the @code{register} storage class specifier, except
3724 when it is part of the GNU @ref{Explicit Register Variables} extension.
3725 The use of the @code{register} keyword as storage class specifier has
3726 been deprecated in C++11 and removed in C++17.
3727 Enabled by default with @option{-std=c++17}.
3729 @item -Wreorder @r{(C++ and Objective-C++ only)}
3731 @opindex Wno-reorder
3732 @cindex reordering, warning
3733 @cindex warning for reordering of member initializers
3734 Warn when the order of member initializers given in the code does not
3735 match the order in which they must be executed. For instance:
3741 A(): j (0), i (1) @{ @}
3746 The compiler rearranges the member initializers for @code{i}
3747 and @code{j} to match the declaration order of the members, emitting
3748 a warning to that effect. This warning is enabled by @option{-Wall}.
3750 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3751 @opindex Wpessimizing-move
3752 @opindex Wno-pessimizing-move
3753 This warning warns when a call to @code{std::move} prevents copy
3754 elision. A typical scenario when copy elision can occur is when returning in
3755 a function with a class return type, when the expression being returned is the
3756 name of a non-volatile automatic object, and is not a function parameter, and
3757 has the same type as the function return type.
3767 return std::move (t);
3771 But in this example, the @code{std::move} call prevents copy elision.
3773 This warning is enabled by @option{-Wall}.
3775 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3776 @opindex Wredundant-move
3777 @opindex Wno-redundant-move
3778 This warning warns about redundant calls to @code{std::move}; that is, when
3779 a move operation would have been performed even without the @code{std::move}
3780 call. This happens because the compiler is forced to treat the object as if
3781 it were an rvalue in certain situations such as returning a local variable,
3782 where copy elision isn't applicable. Consider:
3791 return std::move (t);
3795 Here, the @code{std::move} call is redundant. Because G++ implements Core
3796 Issue 1579, another example is:
3799 struct T @{ // convertible to U
3809 return std::move (t);
3812 In this example, copy elision isn't applicable because the type of the
3813 expression being returned and the function return type differ, yet G++
3814 treats the return value as if it were designated by an rvalue.
3816 This warning is enabled by @option{-Wextra}.
3818 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
3819 @opindex Wrange-loop-construct
3820 @opindex Wno-range-loop-construct
3821 This warning warns when a C++ range-based for-loop is creating an unnecessary
3822 copy. This can happen when the range declaration is not a reference, but
3823 probably should be. For example:
3826 struct S @{ char arr[128]; @};
3829 for (const auto x : arr) @{ @dots{} @}
3833 It does not warn when the type being copied is a trivially-copyable type whose
3834 size is less than 64 bytes.
3836 This warning also warns when a loop variable in a range-based for-loop is
3837 initialized with a value of a different type resulting in a copy. For example:
3842 for (const double &x : arr) @{ @dots{} @}
3846 In the example above, in every iteration of the loop a temporary value of
3847 type @code{double} is created and destroyed, to which the reference
3848 @code{const double &} is bound.
3850 This warning is enabled by @option{-Wall}.
3852 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3853 @opindex Wredundant-tags
3854 @opindex Wno-redundant-tags
3855 Warn about redundant class-key and enum-key in references to class types
3856 and enumerated types in contexts where the key can be eliminated without
3857 causing an ambiguity. For example:
3861 struct foo *p; // warn that keyword struct can be eliminated
3865 On the other hand, in this example there is no warning:
3869 void foo (); // "hides" struct foo
3870 void bar (struct foo&); // no warning, keyword struct is necessary
3873 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3874 @opindex Wsubobject-linkage
3875 @opindex Wno-subobject-linkage
3877 if a class type has a base or a field whose type uses the anonymous
3878 namespace or depends on a type with no linkage. If a type A depends on
3879 a type B with no or internal linkage, defining it in multiple
3880 translation units would be an ODR violation because the meaning of B
3881 is different in each translation unit. If A only appears in a single
3882 translation unit, the best way to silence the warning is to give it
3883 internal linkage by putting it in an anonymous namespace as well. The
3884 compiler doesn't give this warning for types defined in the main .C
3885 file, as those are unlikely to have multiple definitions.
3886 @option{-Wsubobject-linkage} is enabled by default.
3888 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3891 Warn about violations of the following style guidelines from Scott Meyers'
3892 @cite{Effective C++} series of books:
3896 Define a copy constructor and an assignment operator for classes
3897 with dynamically-allocated memory.
3900 Prefer initialization to assignment in constructors.
3903 Have @code{operator=} return a reference to @code{*this}.
3906 Don't try to return a reference when you must return an object.
3909 Distinguish between prefix and postfix forms of increment and
3910 decrement operators.
3913 Never overload @code{&&}, @code{||}, or @code{,}.
3917 This option also enables @option{-Wnon-virtual-dtor}, which is also
3918 one of the effective C++ recommendations. However, the check is
3919 extended to warn about the lack of virtual destructor in accessible
3920 non-polymorphic bases classes too.
3922 When selecting this option, be aware that the standard library
3923 headers do not obey all of these guidelines; use @samp{grep -v}
3924 to filter out those warnings.
3926 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
3927 @opindex Wexceptions
3928 @opindex Wno-exceptions
3929 Disable the warning about the case when an exception handler is shadowed by
3930 another handler, which can point out a wrong ordering of exception handlers.
3932 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3933 @opindex Wstrict-null-sentinel
3934 @opindex Wno-strict-null-sentinel
3935 Warn about the use of an uncasted @code{NULL} as sentinel. When
3936 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3937 to @code{__null}. Although it is a null pointer constant rather than a
3938 null pointer, it is guaranteed to be of the same size as a pointer.
3939 But this use is not portable across different compilers.
3941 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3942 @opindex Wno-non-template-friend
3943 @opindex Wnon-template-friend
3944 Disable warnings when non-template friend functions are declared
3945 within a template. In very old versions of GCC that predate implementation
3946 of the ISO standard, declarations such as
3947 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3948 could be interpreted as a particular specialization of a template
3949 function; the warning exists to diagnose compatibility problems,
3950 and is enabled by default.
3952 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3953 @opindex Wold-style-cast
3954 @opindex Wno-old-style-cast
3955 Warn if an old-style (C-style) cast to a non-void type is used within
3956 a C++ program. The new-style casts (@code{dynamic_cast},
3957 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3958 less vulnerable to unintended effects and much easier to search for.
3960 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3961 @opindex Woverloaded-virtual
3962 @opindex Wno-overloaded-virtual
3963 @cindex overloaded virtual function, warning
3964 @cindex warning for overloaded virtual function
3965 Warn when a function declaration hides virtual functions from a
3966 base class. For example, in:
3973 struct B: public A @{
3978 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3989 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3990 @opindex Wno-pmf-conversions
3991 @opindex Wpmf-conversions
3992 Disable the diagnostic for converting a bound pointer to member function
3995 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3996 @opindex Wsign-promo
3997 @opindex Wno-sign-promo
3998 Warn when overload resolution chooses a promotion from unsigned or
3999 enumerated type to a signed type, over a conversion to an unsigned type of
4000 the same size. Previous versions of G++ tried to preserve
4001 unsignedness, but the standard mandates the current behavior.
4003 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4005 @opindex Wno-templates
4006 Warn when a primary template declaration is encountered. Some coding
4007 rules disallow templates, and this may be used to enforce that rule.
4008 The warning is inactive inside a system header file, such as the STL, so
4009 one can still use the STL. One may also instantiate or specialize
4012 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4013 @opindex Wmismatched-new-delete
4014 @opindex Wno-mismatched-new-delete
4015 Warn for mismatches between calls to @code{operator new} or @code{operator
4016 delete} and the corresponding call to the allocation or deallocation function.
4017 This includes invocations of C++ @code{operator delete} with pointers
4018 returned from either mismatched forms of @code{operator new}, or from other
4019 functions that allocate objects for which the @code{operator delete} isn't
4020 a suitable deallocator, as well as calls to other deallocation functions
4021 with pointers returned from @code{operator new} for which the deallocation
4022 function isn't suitable.
4024 For example, the @code{delete} expression in the function below is diagnosed
4025 because it doesn't match the array form of the @code{new} expression
4026 the pointer argument was returned from. Similarly, the call to @code{free}
4032 int *a = new int[n];
4033 delete a; // warning: mismatch in array forms of expressions
4035 char *p = new char[n];
4036 free (p); // warning: mismatch between new and free
4040 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4041 involving allocation and deallocation functions other than @code{operator
4042 new} and @code{operator delete}.
4044 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4046 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4047 @opindex Wmismatched-tags
4048 @opindex Wno-mismatched-tags
4049 Warn for declarations of structs, classes, and class templates and their
4050 specializations with a class-key that does not match either the definition
4051 or the first declaration if no definition is provided.
4053 For example, the declaration of @code{struct Object} in the argument list
4054 of @code{draw} triggers the warning. To avoid it, either remove the redundant
4055 class-key @code{struct} or replace it with @code{class} to match its definition.
4059 virtual ~Object () = 0;
4061 void draw (struct Object*);
4064 It is not wrong to declare a class with the class-key @code{struct} as
4065 the example above shows. The @option{-Wmismatched-tags} option is intended
4066 to help achieve a consistent style of class declarations. In code that is
4067 intended to be portable to Windows-based compilers the warning helps prevent
4068 unresolved references due to the difference in the mangling of symbols
4069 declared with different class-keys. The option can be used either on its
4070 own or in conjunction with @option{-Wredundant-tags}.
4072 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4073 @opindex Wmultiple-inheritance
4074 @opindex Wno-multiple-inheritance
4075 Warn when a class is defined with multiple direct base classes. Some
4076 coding rules disallow multiple inheritance, and this may be used to
4077 enforce that rule. The warning is inactive inside a system header file,
4078 such as the STL, so one can still use the STL. One may also define
4079 classes that indirectly use multiple inheritance.
4081 @item -Wvirtual-inheritance
4082 @opindex Wvirtual-inheritance
4083 @opindex Wno-virtual-inheritance
4084 Warn when a class is defined with a virtual direct base class. Some
4085 coding rules disallow multiple inheritance, and this may be used to
4086 enforce that rule. The warning is inactive inside a system header file,
4087 such as the STL, so one can still use the STL. One may also define
4088 classes that indirectly use virtual inheritance.
4090 @item -Wno-virtual-move-assign
4091 @opindex Wvirtual-move-assign
4092 @opindex Wno-virtual-move-assign
4093 Suppress warnings about inheriting from a virtual base with a
4094 non-trivial C++11 move assignment operator. This is dangerous because
4095 if the virtual base is reachable along more than one path, it is
4096 moved multiple times, which can mean both objects end up in the
4097 moved-from state. If the move assignment operator is written to avoid
4098 moving from a moved-from object, this warning can be disabled.
4101 @opindex Wnamespaces
4102 @opindex Wno-namespaces
4103 Warn when a namespace definition is opened. Some coding rules disallow
4104 namespaces, and this may be used to enforce that rule. The warning is
4105 inactive inside a system header file, such as the STL, so one can still
4106 use the STL. One may also use using directives and qualified names.
4108 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4110 @opindex Wno-terminate
4111 Disable the warning about a throw-expression that will immediately
4112 result in a call to @code{terminate}.
4114 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4115 @opindex Wvexing-parse
4116 @opindex Wno-vexing-parse
4117 Warn about the most vexing parse syntactic ambiguity. This warns about
4118 the cases when a declaration looks like a variable definition, but the
4119 C++ language requires it to be interpreted as a function declaration.
4124 int i(); // extern int i (void);
4125 int n(int(a)); // extern int n (int);
4132 struct S @{ S(int); @};
4134 S x(int(a)); // extern struct S x (int);
4135 S y(int()); // extern struct S y (int (*) (void));
4136 S z(); // extern struct S z (void);
4140 The warning will suggest options how to deal with such an ambiguity; e.g.,
4141 it can suggest removing the parentheses or using braces instead.
4143 This warning is enabled by default.
4145 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4146 @opindex Wno-class-conversion
4147 @opindex Wclass-conversion
4148 Do not warn when a conversion function converts an
4149 object to the same type, to a base class of that type, or to void; such
4150 a conversion function will never be called.
4152 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4154 @opindex Wno-volatile
4155 Warn about deprecated uses of the @code{volatile} qualifier. This includes
4156 postfix and prefix @code{++} and @code{--} expressions of
4157 @code{volatile}-qualified types, using simple assignments where the left
4158 operand is a @code{volatile}-qualified non-class type for their value,
4159 compound assignments where the left operand is a @code{volatile}-qualified
4160 non-class type, @code{volatile}-qualified function return type,
4161 @code{volatile}-qualified parameter type, and structured bindings of a
4162 @code{volatile}-qualified type. This usage was deprecated in C++20.
4164 Enabled by default with @option{-std=c++20}.
4166 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4167 @opindex Wzero-as-null-pointer-constant
4168 @opindex Wno-zero-as-null-pointer-constant
4169 Warn when a literal @samp{0} is used as null pointer constant. This can
4170 be useful to facilitate the conversion to @code{nullptr} in C++11.
4173 @opindex Waligned-new
4174 @opindex Wno-aligned-new
4175 Warn about a new-expression of a type that requires greater alignment
4176 than the @code{alignof(std::max_align_t)} but uses an allocation
4177 function without an explicit alignment parameter. This option is
4178 enabled by @option{-Wall}.
4180 Normally this only warns about global allocation functions, but
4181 @option{-Waligned-new=all} also warns about class member allocation
4184 @item -Wno-placement-new
4185 @itemx -Wplacement-new=@var{n}
4186 @opindex Wplacement-new
4187 @opindex Wno-placement-new
4188 Warn about placement new expressions with undefined behavior, such as
4189 constructing an object in a buffer that is smaller than the type of
4190 the object. For example, the placement new expression below is diagnosed
4191 because it attempts to construct an array of 64 integers in a buffer only
4197 This warning is enabled by default.
4200 @item -Wplacement-new=1
4201 This is the default warning level of @option{-Wplacement-new}. At this
4202 level the warning is not issued for some strictly undefined constructs that
4203 GCC allows as extensions for compatibility with legacy code. For example,
4204 the following @code{new} expression is not diagnosed at this level even
4205 though it has undefined behavior according to the C++ standard because
4206 it writes past the end of the one-element array.
4208 struct S @{ int n, a[1]; @};
4209 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4210 new (s->a)int [32]();
4213 @item -Wplacement-new=2
4214 At this level, in addition to diagnosing all the same constructs as at level
4215 1, a diagnostic is also issued for placement new expressions that construct
4216 an object in the last member of structure whose type is an array of a single
4217 element and whose size is less than the size of the object being constructed.
4218 While the previous example would be diagnosed, the following construct makes
4219 use of the flexible member array extension to avoid the warning at level 2.
4221 struct S @{ int n, a[]; @};
4222 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4223 new (s->a)int [32]();
4229 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4230 @opindex Wcatch-value
4231 @opindex Wno-catch-value
4232 Warn about catch handlers that do not catch via reference.
4233 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4234 warn about polymorphic class types that are caught by value.
4235 With @option{-Wcatch-value=2} warn about all class types that are caught
4236 by value. With @option{-Wcatch-value=3} warn about all types that are
4237 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4239 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4240 @opindex Wconditionally-supported
4241 @opindex Wno-conditionally-supported
4242 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4244 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4245 @opindex Wdelete-incomplete
4246 @opindex Wno-delete-incomplete
4247 Do not warn when deleting a pointer to incomplete type, which may cause
4248 undefined behavior at runtime. This warning is enabled by default.
4250 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4251 @opindex Wextra-semi
4252 @opindex Wno-extra-semi
4253 Warn about redundant semicolons after in-class function definitions.
4255 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4256 @opindex Winaccessible-base
4257 @opindex Wno-inaccessible-base
4258 This option controls warnings
4259 when a base class is inaccessible in a class derived from it due to
4260 ambiguity. The warning is enabled by default.
4261 Note that the warning for ambiguous virtual
4262 bases is enabled by the @option{-Wextra} option.
4265 struct A @{ int a; @};
4269 struct C : B, A @{ @};
4273 @item -Wno-inherited-variadic-ctor
4274 @opindex Winherited-variadic-ctor
4275 @opindex Wno-inherited-variadic-ctor
4276 Suppress warnings about use of C++11 inheriting constructors when the
4277 base class inherited from has a C variadic constructor; the warning is
4278 on by default because the ellipsis is not inherited.
4280 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4281 @opindex Wno-invalid-offsetof
4282 @opindex Winvalid-offsetof
4283 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4284 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
4285 to a non-standard-layout type is undefined. In existing C++ implementations,
4286 however, @code{offsetof} typically gives meaningful results.
4287 This flag is for users who are aware that they are
4288 writing nonportable code and who have deliberately chosen to ignore the
4291 The restrictions on @code{offsetof} may be relaxed in a future version
4292 of the C++ standard.
4294 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4295 @opindex Wsized-deallocation
4296 @opindex Wno-sized-deallocation
4297 Warn about a definition of an unsized deallocation function
4299 void operator delete (void *) noexcept;
4300 void operator delete[] (void *) noexcept;
4302 without a definition of the corresponding sized deallocation function
4304 void operator delete (void *, std::size_t) noexcept;
4305 void operator delete[] (void *, std::size_t) noexcept;
4307 or vice versa. Enabled by @option{-Wextra} along with
4308 @option{-fsized-deallocation}.
4310 @item -Wsuggest-final-types
4311 @opindex Wno-suggest-final-types
4312 @opindex Wsuggest-final-types
4313 Warn about types with virtual methods where code quality would be improved
4314 if the type were declared with the C++11 @code{final} specifier,
4316 declared in an anonymous namespace. This allows GCC to more aggressively
4317 devirtualize the polymorphic calls. This warning is more effective with
4318 link-time optimization,
4319 where the information about the class hierarchy graph is
4322 @item -Wsuggest-final-methods
4323 @opindex Wno-suggest-final-methods
4324 @opindex Wsuggest-final-methods
4325 Warn about virtual methods where code quality would be improved if the method
4326 were declared with the C++11 @code{final} specifier,
4327 or, if possible, its type were
4328 declared in an anonymous namespace or with the @code{final} specifier.
4330 more effective with link-time optimization, where the information about the
4331 class hierarchy graph is more complete. It is recommended to first consider
4332 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4335 @item -Wsuggest-override
4336 @opindex Wsuggest-override
4337 @opindex Wno-suggest-override
4338 Warn about overriding virtual functions that are not marked with the
4339 @code{override} keyword.
4341 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4342 @opindex Wuseless-cast
4343 @opindex Wno-useless-cast
4344 Warn when an expression is casted to its own type.
4346 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4347 @opindex Wconversion-null
4348 @opindex Wno-conversion-null
4349 Do not warn for conversions between @code{NULL} and non-pointer
4350 types. @option{-Wconversion-null} is enabled by default.
4354 @node Objective-C and Objective-C++ Dialect Options
4355 @section Options Controlling Objective-C and Objective-C++ Dialects
4357 @cindex compiler options, Objective-C and Objective-C++
4358 @cindex Objective-C and Objective-C++ options, command-line
4359 @cindex options, Objective-C and Objective-C++
4360 (NOTE: This manual does not describe the Objective-C and Objective-C++
4361 languages themselves. @xref{Standards,,Language Standards
4362 Supported by GCC}, for references.)
4364 This section describes the command-line options that are only meaningful
4365 for Objective-C and Objective-C++ programs. You can also use most of
4366 the language-independent GNU compiler options.
4367 For example, you might compile a file @file{some_class.m} like this:
4370 gcc -g -fgnu-runtime -O -c some_class.m
4374 In this example, @option{-fgnu-runtime} is an option meant only for
4375 Objective-C and Objective-C++ programs; you can use the other options with
4376 any language supported by GCC@.
4378 Note that since Objective-C is an extension of the C language, Objective-C
4379 compilations may also use options specific to the C front-end (e.g.,
4380 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
4381 C++-specific options (e.g., @option{-Wabi}).
4383 Here is a list of options that are @emph{only} for compiling Objective-C
4384 and Objective-C++ programs:
4387 @item -fconstant-string-class=@var{class-name}
4388 @opindex fconstant-string-class
4389 Use @var{class-name} as the name of the class to instantiate for each
4390 literal string specified with the syntax @code{@@"@dots{}"}. The default
4391 class name is @code{NXConstantString} if the GNU runtime is being used, and
4392 @code{NSConstantString} if the NeXT runtime is being used (see below). The
4393 @option{-fconstant-cfstrings} option, if also present, overrides the
4394 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4395 to be laid out as constant CoreFoundation strings.
4398 @opindex fgnu-runtime
4399 Generate object code compatible with the standard GNU Objective-C
4400 runtime. This is the default for most types of systems.
4402 @item -fnext-runtime
4403 @opindex fnext-runtime
4404 Generate output compatible with the NeXT runtime. This is the default
4405 for NeXT-based systems, including Darwin and Mac OS X@. The macro
4406 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4409 @item -fno-nil-receivers
4410 @opindex fno-nil-receivers
4411 @opindex fnil-receivers
4412 Assume that all Objective-C message dispatches (@code{[receiver
4413 message:arg]}) in this translation unit ensure that the receiver is
4414 not @code{nil}. This allows for more efficient entry points in the
4415 runtime to be used. This option is only available in conjunction with
4416 the NeXT runtime and ABI version 0 or 1.
4418 @item -fobjc-abi-version=@var{n}
4419 @opindex fobjc-abi-version
4420 Use version @var{n} of the Objective-C ABI for the selected runtime.
4421 This option is currently supported only for the NeXT runtime. In that
4422 case, Version 0 is the traditional (32-bit) ABI without support for
4423 properties and other Objective-C 2.0 additions. Version 1 is the
4424 traditional (32-bit) ABI with support for properties and other
4425 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
4426 nothing is specified, the default is Version 0 on 32-bit target
4427 machines, and Version 2 on 64-bit target machines.
4429 @item -fobjc-call-cxx-cdtors
4430 @opindex fobjc-call-cxx-cdtors
4431 For each Objective-C class, check if any of its instance variables is a
4432 C++ object with a non-trivial default constructor. If so, synthesize a
4433 special @code{- (id) .cxx_construct} instance method which runs
4434 non-trivial default constructors on any such instance variables, in order,
4435 and then return @code{self}. Similarly, check if any instance variable
4436 is a C++ object with a non-trivial destructor, and if so, synthesize a
4437 special @code{- (void) .cxx_destruct} method which runs
4438 all such default destructors, in reverse order.
4440 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4441 methods thusly generated only operate on instance variables
4442 declared in the current Objective-C class, and not those inherited
4443 from superclasses. It is the responsibility of the Objective-C
4444 runtime to invoke all such methods in an object's inheritance
4445 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
4446 by the runtime immediately after a new object instance is allocated;
4447 the @code{- (void) .cxx_destruct} methods are invoked immediately
4448 before the runtime deallocates an object instance.
4450 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4451 support for invoking the @code{- (id) .cxx_construct} and
4452 @code{- (void) .cxx_destruct} methods.
4454 @item -fobjc-direct-dispatch
4455 @opindex fobjc-direct-dispatch
4456 Allow fast jumps to the message dispatcher. On Darwin this is
4457 accomplished via the comm page.
4459 @item -fobjc-exceptions
4460 @opindex fobjc-exceptions
4461 Enable syntactic support for structured exception handling in
4462 Objective-C, similar to what is offered by C++. This option
4463 is required to use the Objective-C keywords @code{@@try},
4464 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4465 @code{@@synchronized}. This option is available with both the GNU
4466 runtime and the NeXT runtime (but not available in conjunction with
4467 the NeXT runtime on Mac OS X 10.2 and earlier).
4471 Enable garbage collection (GC) in Objective-C and Objective-C++
4472 programs. This option is only available with the NeXT runtime; the
4473 GNU runtime has a different garbage collection implementation that
4474 does not require special compiler flags.
4476 @item -fobjc-nilcheck
4477 @opindex fobjc-nilcheck
4478 For the NeXT runtime with version 2 of the ABI, check for a nil
4479 receiver in method invocations before doing the actual method call.
4480 This is the default and can be disabled using
4481 @option{-fno-objc-nilcheck}. Class methods and super calls are never
4482 checked for nil in this way no matter what this flag is set to.
4483 Currently this flag does nothing when the GNU runtime, or an older
4484 version of the NeXT runtime ABI, is used.
4486 @item -fobjc-std=objc1
4488 Conform to the language syntax of Objective-C 1.0, the language
4489 recognized by GCC 4.0. This only affects the Objective-C additions to
4490 the C/C++ language; it does not affect conformance to C/C++ standards,
4491 which is controlled by the separate C/C++ dialect option flags. When
4492 this option is used with the Objective-C or Objective-C++ compiler,
4493 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4494 This is useful if you need to make sure that your Objective-C code can
4495 be compiled with older versions of GCC@.
4497 @item -freplace-objc-classes
4498 @opindex freplace-objc-classes
4499 Emit a special marker instructing @command{ld(1)} not to statically link in
4500 the resulting object file, and allow @command{dyld(1)} to load it in at
4501 run time instead. This is used in conjunction with the Fix-and-Continue
4502 debugging mode, where the object file in question may be recompiled and
4503 dynamically reloaded in the course of program execution, without the need
4504 to restart the program itself. Currently, Fix-and-Continue functionality
4505 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4510 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4511 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4512 compile time) with static class references that get initialized at load time,
4513 which improves run-time performance. Specifying the @option{-fzero-link} flag
4514 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4515 to be retained. This is useful in Zero-Link debugging mode, since it allows
4516 for individual class implementations to be modified during program execution.
4517 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4518 regardless of command-line options.
4520 @item -fno-local-ivars
4521 @opindex fno-local-ivars
4522 @opindex flocal-ivars
4523 By default instance variables in Objective-C can be accessed as if
4524 they were local variables from within the methods of the class they're
4525 declared in. This can lead to shadowing between instance variables
4526 and other variables declared either locally inside a class method or
4527 globally with the same name. Specifying the @option{-fno-local-ivars}
4528 flag disables this behavior thus avoiding variable shadowing issues.
4530 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4531 @opindex fivar-visibility
4532 Set the default instance variable visibility to the specified option
4533 so that instance variables declared outside the scope of any access
4534 modifier directives default to the specified visibility.
4538 Dump interface declarations for all classes seen in the source file to a
4539 file named @file{@var{sourcename}.decl}.
4541 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4542 @opindex Wassign-intercept
4543 @opindex Wno-assign-intercept
4544 Warn whenever an Objective-C assignment is being intercepted by the
4547 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4548 @opindex Wproperty-assign-default
4549 @opindex Wno-property-assign-default
4550 Do not warn if a property for an Objective-C object has no assign
4551 semantics specified.
4553 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4554 @opindex Wno-protocol
4556 If a class is declared to implement a protocol, a warning is issued for
4557 every method in the protocol that is not implemented by the class. The
4558 default behavior is to issue a warning for every method not explicitly
4559 implemented in the class, even if a method implementation is inherited
4560 from the superclass. If you use the @option{-Wno-protocol} option, then
4561 methods inherited from the superclass are considered to be implemented,
4562 and no warning is issued for them.
4564 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4565 @opindex Wobjc-root-class
4566 Warn if a class interface lacks a superclass. Most classes will inherit
4567 from @code{NSObject} (or @code{Object}) for example. When declaring
4568 classes intended to be root classes, the warning can be suppressed by
4569 marking their interfaces with @code{__attribute__((objc_root_class))}.
4571 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4573 @opindex Wno-selector
4574 Warn if multiple methods of different types for the same selector are
4575 found during compilation. The check is performed on the list of methods
4576 in the final stage of compilation. Additionally, a check is performed
4577 for each selector appearing in a @code{@@selector(@dots{})}
4578 expression, and a corresponding method for that selector has been found
4579 during compilation. Because these checks scan the method table only at
4580 the end of compilation, these warnings are not produced if the final
4581 stage of compilation is not reached, for example because an error is
4582 found during compilation, or because the @option{-fsyntax-only} option is
4585 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4586 @opindex Wstrict-selector-match
4587 @opindex Wno-strict-selector-match
4588 Warn if multiple methods with differing argument and/or return types are
4589 found for a given selector when attempting to send a message using this
4590 selector to a receiver of type @code{id} or @code{Class}. When this flag
4591 is off (which is the default behavior), the compiler omits such warnings
4592 if any differences found are confined to types that share the same size
4595 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4596 @opindex Wundeclared-selector
4597 @opindex Wno-undeclared-selector
4598 Warn if a @code{@@selector(@dots{})} expression referring to an
4599 undeclared selector is found. A selector is considered undeclared if no
4600 method with that name has been declared before the
4601 @code{@@selector(@dots{})} expression, either explicitly in an
4602 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4603 an @code{@@implementation} section. This option always performs its
4604 checks as soon as a @code{@@selector(@dots{})} expression is found,
4605 while @option{-Wselector} only performs its checks in the final stage of
4606 compilation. This also enforces the coding style convention
4607 that methods and selectors must be declared before being used.
4609 @item -print-objc-runtime-info
4610 @opindex print-objc-runtime-info
4611 Generate C header describing the largest structure that is passed by
4616 @node Diagnostic Message Formatting Options
4617 @section Options to Control Diagnostic Messages Formatting
4618 @cindex options to control diagnostics formatting
4619 @cindex diagnostic messages
4620 @cindex message formatting
4622 Traditionally, diagnostic messages have been formatted irrespective of
4623 the output device's aspect (e.g.@: its width, @dots{}). You can use the
4624 options described below
4625 to control the formatting algorithm for diagnostic messages,
4626 e.g.@: how many characters per line, how often source location
4627 information should be reported. Note that some language front ends may not
4628 honor these options.
4631 @item -fmessage-length=@var{n}
4632 @opindex fmessage-length
4633 Try to format error messages so that they fit on lines of about
4634 @var{n} characters. If @var{n} is zero, then no line-wrapping is
4635 done; each error message appears on a single line. This is the
4636 default for all front ends.
4638 Note - this option also affects the display of the @samp{#error} and
4639 @samp{#warning} pre-processor directives, and the @samp{deprecated}
4640 function/type/variable attribute. It does not however affect the
4641 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
4643 @item -fdiagnostics-plain-output
4644 This option requests that diagnostic output look as plain as possible, which
4645 may be useful when running @command{dejagnu} or other utilities that need to
4646 parse diagnostics output and prefer that it remain more stable over time.
4647 @option{-fdiagnostics-plain-output} is currently equivalent to the following
4649 @gccoptlist{-fno-diagnostics-show-caret @gol
4650 -fno-diagnostics-show-line-numbers @gol
4651 -fdiagnostics-color=never @gol
4652 -fdiagnostics-urls=never @gol
4653 -fdiagnostics-path-format=separate-events}
4654 In the future, if GCC changes the default appearance of its diagnostics, the
4655 corresponding option to disable the new behavior will be added to this list.
4657 @item -fdiagnostics-show-location=once
4658 @opindex fdiagnostics-show-location
4659 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
4660 reporter to emit source location information @emph{once}; that is, in
4661 case the message is too long to fit on a single physical line and has to
4662 be wrapped, the source location won't be emitted (as prefix) again,
4663 over and over, in subsequent continuation lines. This is the default
4666 @item -fdiagnostics-show-location=every-line
4667 Only meaningful in line-wrapping mode. Instructs the diagnostic
4668 messages reporter to emit the same source location information (as
4669 prefix) for physical lines that result from the process of breaking
4670 a message which is too long to fit on a single line.
4672 @item -fdiagnostics-color[=@var{WHEN}]
4673 @itemx -fno-diagnostics-color
4674 @opindex fdiagnostics-color
4675 @cindex highlight, color
4676 @vindex GCC_COLORS @r{environment variable}
4677 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
4678 or @samp{auto}. The default depends on how the compiler has been configured,
4679 it can be any of the above @var{WHEN} options or also @samp{never}
4680 if @env{GCC_COLORS} environment variable isn't present in the environment,
4681 and @samp{auto} otherwise.
4682 @samp{auto} makes GCC use color only when the standard error is a terminal,
4683 and when not executing in an emacs shell.
4684 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4685 aliases for @option{-fdiagnostics-color=always} and
4686 @option{-fdiagnostics-color=never}, respectively.
4688 The colors are defined by the environment variable @env{GCC_COLORS}.
4689 Its value is a colon-separated list of capabilities and Select Graphic
4690 Rendition (SGR) substrings. SGR commands are interpreted by the
4691 terminal or terminal emulator. (See the section in the documentation
4692 of your text terminal for permitted values and their meanings as
4693 character attributes.) These substring values are integers in decimal
4694 representation and can be concatenated with semicolons.
4695 Common values to concatenate include
4697 @samp{4} for underline,
4699 @samp{7} for inverse,
4700 @samp{39} for default foreground color,
4701 @samp{30} to @samp{37} for foreground colors,
4702 @samp{90} to @samp{97} for 16-color mode foreground colors,
4703 @samp{38;5;0} to @samp{38;5;255}
4704 for 88-color and 256-color modes foreground colors,
4705 @samp{49} for default background color,
4706 @samp{40} to @samp{47} for background colors,
4707 @samp{100} to @samp{107} for 16-color mode background colors,
4708 and @samp{48;5;0} to @samp{48;5;255}
4709 for 88-color and 256-color modes background colors.
4711 The default @env{GCC_COLORS} is
4713 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4714 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4715 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4719 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4720 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4721 @samp{01} is bold, and @samp{31} is red.
4722 Setting @env{GCC_COLORS} to the empty string disables colors.
4723 Supported capabilities are as follows.
4727 @vindex error GCC_COLORS @r{capability}
4728 SGR substring for error: markers.
4731 @vindex warning GCC_COLORS @r{capability}
4732 SGR substring for warning: markers.
4735 @vindex note GCC_COLORS @r{capability}
4736 SGR substring for note: markers.
4739 @vindex path GCC_COLORS @r{capability}
4740 SGR substring for colorizing paths of control-flow events as printed
4741 via @option{-fdiagnostics-path-format=}, such as the identifiers of
4742 individual events and lines indicating interprocedural calls and returns.
4745 @vindex range1 GCC_COLORS @r{capability}
4746 SGR substring for first additional range.
4749 @vindex range2 GCC_COLORS @r{capability}
4750 SGR substring for second additional range.
4753 @vindex locus GCC_COLORS @r{capability}
4754 SGR substring for location information, @samp{file:line} or
4755 @samp{file:line:column} etc.
4758 @vindex quote GCC_COLORS @r{capability}
4759 SGR substring for information printed within quotes.
4762 @vindex fixit-insert GCC_COLORS @r{capability}
4763 SGR substring for fix-it hints suggesting text to
4764 be inserted or replaced.
4767 @vindex fixit-delete GCC_COLORS @r{capability}
4768 SGR substring for fix-it hints suggesting text to
4771 @item diff-filename=
4772 @vindex diff-filename GCC_COLORS @r{capability}
4773 SGR substring for filename headers within generated patches.
4776 @vindex diff-hunk GCC_COLORS @r{capability}
4777 SGR substring for the starts of hunks within generated patches.
4780 @vindex diff-delete GCC_COLORS @r{capability}
4781 SGR substring for deleted lines within generated patches.
4784 @vindex diff-insert GCC_COLORS @r{capability}
4785 SGR substring for inserted lines within generated patches.
4788 @vindex type-diff GCC_COLORS @r{capability}
4789 SGR substring for highlighting mismatching types within template
4790 arguments in the C++ frontend.
4793 @item -fdiagnostics-urls[=@var{WHEN}]
4794 @opindex fdiagnostics-urls
4796 @vindex GCC_URLS @r{environment variable}
4797 @vindex TERM_URLS @r{environment variable}
4798 Use escape sequences to embed URLs in diagnostics. For example, when
4799 @option{-fdiagnostics-show-option} emits text showing the command-line
4800 option controlling a diagnostic, embed a URL for documentation of that
4803 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4804 @samp{auto} makes GCC use URL escape sequences only when the standard error
4805 is a terminal, and when not executing in an emacs shell or any graphical
4806 terminal which is known to be incompatible with this feature, see below.
4808 The default depends on how the compiler has been configured.
4809 It can be any of the above @var{WHEN} options.
4811 GCC can also be configured (via the
4812 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4813 so that the default is affected by environment variables.
4814 Under such a configuration, GCC defaults to using @samp{auto}
4815 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4816 present and non-empty in the environment of the compiler, or @samp{never}
4819 However, even with @option{-fdiagnostics-urls=always} the behavior is
4820 dependent on those environment variables:
4821 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4822 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
4823 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4824 Any other non-empty value enables the feature.
4825 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4826 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4827 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4829 At this time GCC tries to detect also a few terminals that are known to
4830 not implement the URL feature, and have bugs or at least had bugs in
4831 some versions that are still in use, where the URL escapes are likely
4832 to misbehave, i.e. print garbage on the screen.
4833 That list is currently xfce4-terminal, certain known to be buggy
4834 gnome-terminal versions, the linux console, and mingw.
4835 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4837 @item -fno-diagnostics-show-option
4838 @opindex fno-diagnostics-show-option
4839 @opindex fdiagnostics-show-option
4840 By default, each diagnostic emitted includes text indicating the
4841 command-line option that directly controls the diagnostic (if such an
4842 option is known to the diagnostic machinery). Specifying the
4843 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4845 @item -fno-diagnostics-show-caret
4846 @opindex fno-diagnostics-show-caret
4847 @opindex fdiagnostics-show-caret
4848 By default, each diagnostic emitted includes the original source line
4849 and a caret @samp{^} indicating the column. This option suppresses this
4850 information. The source line is truncated to @var{n} characters, if
4851 the @option{-fmessage-length=n} option is given. When the output is done
4852 to the terminal, the width is limited to the width given by the
4853 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4855 @item -fno-diagnostics-show-labels
4856 @opindex fno-diagnostics-show-labels
4857 @opindex fdiagnostics-show-labels
4858 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4859 diagnostics can label ranges of source code with pertinent information, such
4860 as the types of expressions:
4863 printf ("foo %s bar", long_i + long_j);
4869 This option suppresses the printing of these labels (in the example above,
4870 the vertical bars and the ``char *'' and ``long int'' text).
4872 @item -fno-diagnostics-show-cwe
4873 @opindex fno-diagnostics-show-cwe
4874 @opindex fdiagnostics-show-cwe
4875 Diagnostic messages can optionally have an associated
4876 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4877 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4878 diagnostics. GCC plugins may also provide diagnostics with such metadata.
4879 By default, if this information is present, it will be printed with
4880 the diagnostic. This option suppresses the printing of this metadata.
4882 @item -fno-diagnostics-show-line-numbers
4883 @opindex fno-diagnostics-show-line-numbers
4884 @opindex fdiagnostics-show-line-numbers
4885 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4886 a left margin is printed, showing line numbers. This option suppresses this
4889 @item -fdiagnostics-minimum-margin-width=@var{width}
4890 @opindex fdiagnostics-minimum-margin-width
4891 This option controls the minimum width of the left margin printed by
4892 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
4894 @item -fdiagnostics-parseable-fixits
4895 @opindex fdiagnostics-parseable-fixits
4896 Emit fix-it hints in a machine-parseable format, suitable for consumption
4897 by IDEs. For each fix-it, a line will be printed after the relevant
4898 diagnostic, starting with the string ``fix-it:''. For example:
4901 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4904 The location is expressed as a half-open range, expressed as a count of
4905 bytes, starting at byte 1 for the initial column. In the above example,
4906 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4910 00000000011111111112222222222
4911 12345678901234567890123456789
4912 gtk_widget_showall (dlg);
4917 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4918 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4919 (e.g. vertical tab as ``\013'').
4921 An empty replacement string indicates that the given range is to be removed.
4922 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4923 be inserted at the given position.
4925 @item -fdiagnostics-generate-patch
4926 @opindex fdiagnostics-generate-patch
4927 Print fix-it hints to stderr in unified diff format, after any diagnostics
4928 are printed. For example:
4935 void show_cb(GtkDialog *dlg)
4937 - gtk_widget_showall(dlg);
4938 + gtk_widget_show_all(dlg);
4943 The diff may or may not be colorized, following the same rules
4944 as for diagnostics (see @option{-fdiagnostics-color}).
4946 @item -fdiagnostics-show-template-tree
4947 @opindex fdiagnostics-show-template-tree
4949 In the C++ frontend, when printing diagnostics showing mismatching
4950 template types, such as:
4953 could not convert 'std::map<int, std::vector<double> >()'
4954 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4957 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4958 tree-like structure showing the common and differing parts of the types,
4968 The parts that differ are highlighted with color (``double'' and
4969 ``float'' in this case).
4971 @item -fno-elide-type
4972 @opindex fno-elide-type
4973 @opindex felide-type
4974 By default when the C++ frontend prints diagnostics showing mismatching
4975 template types, common parts of the types are printed as ``[...]'' to
4976 simplify the error message. For example:
4979 could not convert 'std::map<int, std::vector<double> >()'
4980 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4983 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4984 This flag also affects the output of the
4985 @option{-fdiagnostics-show-template-tree} flag.
4987 @item -fdiagnostics-path-format=@var{KIND}
4988 @opindex fdiagnostics-path-format
4989 Specify how to print paths of control-flow events for diagnostics that
4990 have such a path associated with them.
4992 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4995 @samp{none} means to not print diagnostic paths.
4997 @samp{separate-events} means to print a separate ``note'' diagnostic for
4998 each event within the diagnostic. For example:
5001 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5002 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5003 test.c:27:3: note: (2) when 'i < count'
5004 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5007 @samp{inline-events} means to print the events ``inline'' within the source
5008 code. This view attempts to consolidate the events into runs of
5009 sufficiently-close events, printing them as labelled ranges within the source.
5011 For example, the same events as above might be printed as:
5016 | 25 | list = PyList_New(0);
5019 | | (1) when 'PyList_New' fails, returning NULL
5021 | 27 | for (i = 0; i < count; i++) @{
5024 | | (2) when 'i < count'
5025 | 28 | item = PyLong_FromLong(random());
5026 | 29 | PyList_Append(list, item);
5027 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
5029 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5033 Interprocedural control flow is shown by grouping the events by stack frame,
5034 and using indentation to show how stack frames are nested, pushed, and popped.
5044 | | (1) entering 'test'
5045 | 134 | boxed_int *obj = make_boxed_int (i);
5046 | | ~~~~~~~~~~~~~~~~~~
5048 | | (2) calling 'make_boxed_int'
5050 +--> 'make_boxed_int': events 3-4
5055 | | (3) entering 'make_boxed_int'
5056 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5057 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5059 | | (4) calling 'wrapped_malloc'
5061 +--> 'wrapped_malloc': events 5-6
5066 | | (5) entering 'wrapped_malloc'
5067 | 8 | return malloc (size);
5070 | | (6) calling 'malloc'
5076 | 138 | free_boxed_int (obj);
5077 | | ^~~~~~~~~~~~~~~~~~~~
5079 | | (7) calling 'free_boxed_int'
5084 @item -fdiagnostics-show-path-depths
5085 @opindex fdiagnostics-show-path-depths
5086 This option provides additional information when printing control-flow paths
5087 associated with a diagnostic.
5089 If this is option is provided then the stack depth will be printed for
5090 each run of events within @option{-fdiagnostics-path-format=separate-events}.
5092 This is intended for use by GCC developers and plugin developers when
5093 debugging diagnostics that report interprocedural control flow.
5095 @item -fno-show-column
5096 @opindex fno-show-column
5097 @opindex fshow-column
5098 Do not print column numbers in diagnostics. This may be necessary if
5099 diagnostics are being scanned by a program that does not understand the
5100 column numbers, such as @command{dejagnu}.
5102 @item -fdiagnostics-column-unit=@var{UNIT}
5103 @opindex fdiagnostics-column-unit
5104 Select the units for the column number. This affects traditional diagnostics
5105 (in the absence of @option{-fno-show-column}), as well as JSON format
5106 diagnostics if requested.
5108 The default @var{UNIT}, @samp{display}, considers the number of display
5109 columns occupied by each character. This may be larger than the number
5110 of bytes required to encode the character, in the case of tab
5111 characters, or it may be smaller, in the case of multibyte characters.
5112 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5113 display column, and its UTF-8 encoding requires two bytes; the character
5114 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5115 its UTF-8 encoding requires four bytes.
5117 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5118 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5120 @item -fdiagnostics-column-origin=@var{ORIGIN}
5121 @opindex fdiagnostics-column-origin
5122 Select the origin for column numbers, i.e. the column number assigned to the
5123 first column. The default value of 1 corresponds to traditional GCC
5124 behavior and to the GNU style guide. Some utilities may perform better with an
5125 origin of 0; any non-negative value may be specified.
5127 @item -fdiagnostics-format=@var{FORMAT}
5128 @opindex fdiagnostics-format
5129 Select a different format for printing diagnostics.
5130 @var{FORMAT} is @samp{text} or @samp{json}.
5131 The default is @samp{text}.
5133 The @samp{json} format consists of a top-level JSON array containing JSON
5134 objects representing the diagnostics.
5136 The JSON is emitted as one line, without formatting; the examples below
5137 have been formatted for clarity.
5139 Diagnostics can have child diagnostics. For example, this error and note:
5142 misleading-indentation.c:15:3: warning: this 'if' clause does not
5143 guard... [-Wmisleading-indentation]
5146 misleading-indentation.c:17:5: note: ...this statement, but the latter
5147 is misleadingly indented as if it were guarded by the 'if'
5153 might be printed in JSON form (after formatting) like this:
5162 "display-column": 3,
5165 "file": "misleading-indentation.c",
5169 "display-column": 4,
5172 "file": "misleading-indentation.c",
5177 "message": "this \u2018if\u2019 clause does not guard...",
5178 "option": "-Wmisleading-indentation",
5179 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5186 "display-column": 5,
5189 "file": "misleading-indentation.c",
5194 "message": "...this statement, but the latter is @dots{}"
5203 where the @code{note} is a child of the @code{warning}.
5205 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
5206 an @code{option} key describing the command-line option controlling the
5209 A diagnostic can contain zero or more locations. Each location has an
5210 optional @code{label} string and up to three positions within it: a
5211 @code{caret} position and optional @code{start} and @code{finish} positions.
5212 A position is described by a @code{file} name, a @code{line} number, and
5213 three numbers indicating a column position:
5217 @code{display-column} counts display columns, accounting for tabs and
5218 multibyte characters.
5221 @code{byte-column} counts raw bytes.
5224 @code{column} is equal to one of
5225 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5229 All three columns are relative to the origin specified by
5230 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5231 be set, for instance, to 0 for compatibility with other utilities that
5232 number columns from 0. The column origin is recorded in the JSON output in
5233 the @code{column-origin} tag. In the remaining examples below, the extra
5234 column number outputs have been omitted for brevity.
5236 For example, this error:
5239 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5240 'struct s'@} and 'T' @{aka 'struct t'@})
5241 64 | return callee_4a () + callee_4b ();
5242 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5244 | | T @{aka struct t@}
5245 | S @{aka struct s@}
5249 has three locations. Its primary location is at the ``+'' token at column
5250 23. It has two secondary locations, describing the left and right-hand sides
5251 of the expression, which have labels. It might be printed in JSON form as:
5260 "column": 23, "file": "bad-binary-ops.c", "line": 64
5265 "column": 10, "file": "bad-binary-ops.c", "line": 64
5268 "column": 21, "file": "bad-binary-ops.c", "line": 64
5270 "label": "S @{aka struct s@}"
5274 "column": 25, "file": "bad-binary-ops.c", "line": 64
5277 "column": 36, "file": "bad-binary-ops.c", "line": 64
5279 "label": "T @{aka struct t@}"
5282 "message": "invalid operands to binary + @dots{}"
5286 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5287 consisting of half-open intervals, similar to the output of
5288 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
5289 with a replacement fix-it hint:
5292 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5294 8 | return ptr->colour;
5300 might be printed in JSON form as:
5335 "message": "\u2018struct s\u2019 has no member named @dots{}"
5340 where the fix-it hint suggests replacing the text from @code{start} up
5341 to but not including @code{next} with @code{string}'s value. Deletions
5342 are expressed via an empty value for @code{string}, insertions by
5343 having @code{start} equal @code{next}.
5345 If the diagnostic has a path of control-flow events associated with it,
5346 it has a @code{path} array of objects representing the events. Each
5347 event object has a @code{description} string, a @code{location} object,
5348 along with a @code{function} string and a @code{depth} number for
5349 representing interprocedural paths. The @code{function} represents the
5350 current function at that event, and the @code{depth} represents the
5351 stack depth relative to some baseline: the higher, the more frames are
5354 For example, the intraprocedural example shown for
5355 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5361 "description": "when 'PyList_New' fails, returning NULL",
5371 "description": "when 'i < count'",
5381 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5394 @node Warning Options
5395 @section Options to Request or Suppress Warnings
5396 @cindex options to control warnings
5397 @cindex warning messages
5398 @cindex messages, warning
5399 @cindex suppressing warnings
5401 Warnings are diagnostic messages that report constructions that
5402 are not inherently erroneous but that are risky or suggest there
5403 may have been an error.
5405 The following language-independent options do not enable specific
5406 warnings but control the kinds of diagnostics produced by GCC@.
5409 @cindex syntax checking
5411 @opindex fsyntax-only
5412 Check the code for syntax errors, but don't do anything beyond that.
5414 @item -fmax-errors=@var{n}
5415 @opindex fmax-errors
5416 Limits the maximum number of error messages to @var{n}, at which point
5417 GCC bails out rather than attempting to continue processing the source
5418 code. If @var{n} is 0 (the default), there is no limit on the number
5419 of error messages produced. If @option{-Wfatal-errors} is also
5420 specified, then @option{-Wfatal-errors} takes precedence over this
5425 Inhibit all warning messages.
5430 Make all warnings into errors.
5435 Make the specified warning into an error. The specifier for a warning
5436 is appended; for example @option{-Werror=switch} turns the warnings
5437 controlled by @option{-Wswitch} into errors. This switch takes a
5438 negative form, to be used to negate @option{-Werror} for specific
5439 warnings; for example @option{-Wno-error=switch} makes
5440 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5443 The warning message for each controllable warning includes the
5444 option that controls the warning. That option can then be used with
5445 @option{-Werror=} and @option{-Wno-error=} as described above.
5446 (Printing of the option in the warning message can be disabled using the
5447 @option{-fno-diagnostics-show-option} flag.)
5449 Note that specifying @option{-Werror=}@var{foo} automatically implies
5450 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
5453 @item -Wfatal-errors
5454 @opindex Wfatal-errors
5455 @opindex Wno-fatal-errors
5456 This option causes the compiler to abort compilation on the first error
5457 occurred rather than trying to keep going and printing further error
5462 You can request many specific warnings with options beginning with
5463 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5464 implicit declarations. Each of these specific warning options also
5465 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5466 example, @option{-Wno-implicit}. This manual lists only one of the
5467 two forms, whichever is not the default. For further
5468 language-specific options also refer to @ref{C++ Dialect Options} and
5469 @ref{Objective-C and Objective-C++ Dialect Options}.
5470 Additional warnings can be produced by enabling the static analyzer;
5471 @xref{Static Analyzer Options}.
5473 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5474 options, such as @option{-Wunused}, which may turn on further options,
5475 such as @option{-Wunused-value}. The combined effect of positive and
5476 negative forms is that more specific options have priority over less
5477 specific ones, independently of their position in the command-line. For
5478 options of the same specificity, the last one takes effect. Options
5479 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5480 as if they appeared at the end of the command-line.
5482 When an unrecognized warning option is requested (e.g.,
5483 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5484 that the option is not recognized. However, if the @option{-Wno-} form
5485 is used, the behavior is slightly different: no diagnostic is
5486 produced for @option{-Wno-unknown-warning} unless other diagnostics
5487 are being produced. This allows the use of new @option{-Wno-} options
5488 with old compilers, but if something goes wrong, the compiler
5489 warns that an unrecognized option is present.
5491 The effectiveness of some warnings depends on optimizations also being
5492 enabled. For example @option{-Wsuggest-final-types} is more effective
5493 with link-time optimization and @option{-Wmaybe-uninitialized} does not
5494 warn at all unless optimization is enabled.
5501 @opindex Wno-pedantic
5502 Issue all the warnings demanded by strict ISO C and ISO C++;
5503 reject all programs that use forbidden extensions, and some other
5504 programs that do not follow ISO C and ISO C++. For ISO C, follows the
5505 version of the ISO C standard specified by any @option{-std} option used.
5507 Valid ISO C and ISO C++ programs should compile properly with or without
5508 this option (though a rare few require @option{-ansi} or a
5509 @option{-std} option specifying the required version of ISO C)@. However,
5510 without this option, certain GNU extensions and traditional C and C++
5511 features are supported as well. With this option, they are rejected.
5513 @option{-Wpedantic} does not cause warning messages for use of the
5514 alternate keywords whose names begin and end with @samp{__}. This alternate
5515 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5516 i.e. @samp{__intN__}.
5517 Pedantic warnings are also disabled in the expression that follows
5518 @code{__extension__}. However, only system header files should use
5519 these escape routes; application programs should avoid them.
5520 @xref{Alternate Keywords}.
5522 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5523 C conformance. They soon find that it does not do quite what they want:
5524 it finds some non-ISO practices, but not all---only those for which
5525 ISO C @emph{requires} a diagnostic, and some others for which
5526 diagnostics have been added.
5528 A feature to report any failure to conform to ISO C might be useful in
5529 some instances, but would require considerable additional work and would
5530 be quite different from @option{-Wpedantic}. We don't have plans to
5531 support such a feature in the near future.
5533 Where the standard specified with @option{-std} represents a GNU
5534 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5535 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5536 extended dialect is based. Warnings from @option{-Wpedantic} are given
5537 where they are required by the base standard. (It does not make sense
5538 for such warnings to be given only for features not in the specified GNU
5539 C dialect, since by definition the GNU dialects of C include all
5540 features the compiler supports with the given option, and there would be
5541 nothing to warn about.)
5543 @item -pedantic-errors
5544 @opindex pedantic-errors
5545 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
5546 requires a diagnostic, in some cases where there is undefined behavior
5547 at compile-time and in some other cases that do not prevent compilation
5548 of programs that are valid according to the standard. This is not
5549 equivalent to @option{-Werror=pedantic}, since there are errors enabled
5550 by this option and not enabled by the latter and vice versa.
5555 This enables all the warnings about constructions that some users
5556 consider questionable, and that are easy to avoid (or modify to
5557 prevent the warning), even in conjunction with macros. This also
5558 enables some language-specific warnings described in @ref{C++ Dialect
5559 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
5561 @option{-Wall} turns on the following warning flags:
5563 @gccoptlist{-Waddress @gol
5564 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
5565 -Warray-parameter=2 @r{(C and Objective-C only)} @gol
5567 -Wbool-operation @gol
5568 -Wc++11-compat -Wc++14-compat @gol
5569 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
5570 -Wchar-subscripts @gol
5572 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
5573 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
5575 -Wformat-overflow @gol
5576 -Wformat-truncation @gol
5577 -Wint-in-bool-context @gol
5578 -Wimplicit @r{(C and Objective-C only)} @gol
5579 -Wimplicit-int @r{(C and Objective-C only)} @gol
5580 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
5581 -Winit-self @r{(only for C++)} @gol
5582 -Wlogical-not-parentheses @gol
5583 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
5584 -Wmaybe-uninitialized @gol
5585 -Wmemset-elt-size @gol
5586 -Wmemset-transposed-args @gol
5587 -Wmisleading-indentation @r{(only for C/C++)} @gol
5588 -Wmismatched-dealloc @gol
5589 -Wmismatched-new-delete @r{(only for C/C++)} @gol
5590 -Wmissing-attributes @gol
5591 -Wmissing-braces @r{(only for C/ObjC)} @gol
5592 -Wmultistatement-macros @gol
5593 -Wnarrowing @r{(only for C++)} @gol
5595 -Wnonnull-compare @gol
5598 -Wpessimizing-move @r{(only for C++)} @gol
5600 -Wrange-loop-construct @r{(only for C++)} @gol
5604 -Wsequence-point @gol
5605 -Wsign-compare @r{(only in C++)} @gol
5606 -Wsizeof-array-div @gol
5607 -Wsizeof-pointer-div @gol
5608 -Wsizeof-pointer-memaccess @gol
5609 -Wstrict-aliasing @gol
5610 -Wstrict-overflow=1 @gol
5612 -Wtautological-compare @gol
5614 -Wuninitialized @gol
5615 -Wunknown-pragmas @gol
5616 -Wunused-function @gol
5619 -Wunused-variable @gol
5620 -Wvla-parameter @r{(C and Objective-C only)} @gol
5621 -Wvolatile-register-var @gol
5622 -Wzero-length-bounds}
5624 Note that some warning flags are not implied by @option{-Wall}. Some of
5625 them warn about constructions that users generally do not consider
5626 questionable, but which occasionally you might wish to check for;
5627 others warn about constructions that are necessary or hard to avoid in
5628 some cases, and there is no simple way to modify the code to suppress
5629 the warning. Some of them are enabled by @option{-Wextra} but many of
5630 them must be enabled individually.
5636 This enables some extra warning flags that are not enabled by
5637 @option{-Wall}. (This option used to be called @option{-W}. The older
5638 name is still supported, but the newer name is more descriptive.)
5640 @gccoptlist{-Wclobbered @gol
5641 -Wcast-function-type @gol
5642 -Wdeprecated-copy @r{(C++ only)} @gol
5644 -Wenum-conversion @r{(C only)} @gol
5645 -Wignored-qualifiers @gol
5646 -Wimplicit-fallthrough=3 @gol
5647 -Wmissing-field-initializers @gol
5648 -Wmissing-parameter-type @r{(C only)} @gol
5649 -Wold-style-declaration @r{(C only)} @gol
5650 -Woverride-init @gol
5651 -Wsign-compare @r{(C only)} @gol
5652 -Wstring-compare @gol
5653 -Wredundant-move @r{(only for C++)} @gol
5655 -Wuninitialized @gol
5656 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
5657 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
5658 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
5661 The option @option{-Wextra} also prints warning messages for the
5667 A pointer is compared against integer zero with @code{<}, @code{<=},
5668 @code{>}, or @code{>=}.
5671 (C++ only) An enumerator and a non-enumerator both appear in a
5672 conditional expression.
5675 (C++ only) Ambiguous virtual bases.
5678 (C++ only) Subscripting an array that has been declared @code{register}.
5681 (C++ only) Taking the address of a variable that has been declared
5685 (C++ only) A base class is not initialized in the copy constructor
5690 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
5694 Warn about code affected by ABI changes. This includes code that may
5695 not be compatible with the vendor-neutral C++ ABI as well as the psABI
5696 for the particular target.
5698 Since G++ now defaults to updating the ABI with each major release,
5699 normally @option{-Wabi} warns only about C++ ABI compatibility
5700 problems if there is a check added later in a release series for an
5701 ABI issue discovered since the initial release. @option{-Wabi} warns
5702 about more things if an older ABI version is selected (with
5703 @option{-fabi-version=@var{n}}).
5705 @option{-Wabi} can also be used with an explicit version number to
5706 warn about C++ ABI compatibility with a particular @option{-fabi-version}
5707 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
5708 @option{-fabi-version=2}.
5710 If an explicit version number is provided and
5711 @option{-fabi-compat-version} is not specified, the version number
5712 from this option is used for compatibility aliases. If no explicit
5713 version number is provided with this option, but
5714 @option{-fabi-compat-version} is specified, that version number is
5715 used for C++ ABI warnings.
5717 Although an effort has been made to warn about
5718 all such cases, there are probably some cases that are not warned about,
5719 even though G++ is generating incompatible code. There may also be
5720 cases where warnings are emitted even though the code that is generated
5723 You should rewrite your code to avoid these warnings if you are
5724 concerned about the fact that code generated by G++ may not be binary
5725 compatible with code generated by other compilers.
5727 Known incompatibilities in @option{-fabi-version=2} (which was the
5728 default from GCC 3.4 to 4.9) include:
5733 A template with a non-type template parameter of reference type was
5734 mangled incorrectly:
5737 template <int &> struct S @{@};
5741 This was fixed in @option{-fabi-version=3}.
5744 SIMD vector types declared using @code{__attribute ((vector_size))} were
5745 mangled in a non-standard way that does not allow for overloading of
5746 functions taking vectors of different sizes.
5748 The mangling was changed in @option{-fabi-version=4}.
5751 @code{__attribute ((const))} and @code{noreturn} were mangled as type
5752 qualifiers, and @code{decltype} of a plain declaration was folded away.
5754 These mangling issues were fixed in @option{-fabi-version=5}.
5757 Scoped enumerators passed as arguments to a variadic function are
5758 promoted like unscoped enumerators, causing @code{va_arg} to complain.
5759 On most targets this does not actually affect the parameter passing
5760 ABI, as there is no way to pass an argument smaller than @code{int}.
5762 Also, the ABI changed the mangling of template argument packs,
5763 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5764 a class scope function used as a template argument.
5766 These issues were corrected in @option{-fabi-version=6}.
5769 Lambdas in default argument scope were mangled incorrectly, and the
5770 ABI changed the mangling of @code{nullptr_t}.
5772 These issues were corrected in @option{-fabi-version=7}.
5775 When mangling a function type with function-cv-qualifiers, the
5776 un-qualified function type was incorrectly treated as a substitution
5779 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5782 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5783 unaligned accesses. Note that this did not affect the ABI of a
5784 function with a @code{nullptr_t} parameter, as parameters have a
5787 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5790 Target-specific attributes that affect the identity of a type, such as
5791 ia32 calling conventions on a function type (stdcall, regparm, etc.),
5792 did not affect the mangled name, leading to name collisions when
5793 function pointers were used as template arguments.
5795 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5799 This option also enables warnings about psABI-related changes.
5800 The known psABI changes at this point include:
5805 For SysV/x86-64, unions with @code{long double} members are
5806 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
5807 the case. For example:
5817 @code{union U} is now always passed in memory.
5821 @item -Wchar-subscripts
5822 @opindex Wchar-subscripts
5823 @opindex Wno-char-subscripts
5824 Warn if an array subscript has type @code{char}. This is a common cause
5825 of error, as programmers often forget that this type is signed on some
5827 This warning is enabled by @option{-Wall}.
5829 @item -Wno-coverage-mismatch
5830 @opindex Wno-coverage-mismatch
5831 @opindex Wcoverage-mismatch
5832 Warn if feedback profiles do not match when using the
5833 @option{-fprofile-use} option.
5834 If a source file is changed between compiling with @option{-fprofile-generate}
5835 and with @option{-fprofile-use}, the files with the profile feedback can fail
5836 to match the source file and GCC cannot use the profile feedback
5837 information. By default, this warning is enabled and is treated as an
5838 error. @option{-Wno-coverage-mismatch} can be used to disable the
5839 warning or @option{-Wno-error=coverage-mismatch} can be used to
5840 disable the error. Disabling the error for this warning can result in
5841 poorly optimized code and is useful only in the
5842 case of very minor changes such as bug fixes to an existing code-base.
5843 Completely disabling the warning is not recommended.
5845 @item -Wno-coverage-invalid-line-number
5846 @opindex Wno-coverage-invalid-line-number
5847 @opindex Wcoverage-invalid-line-number
5848 Warn in case a function ends earlier than it begins due
5849 to an invalid linenum macros. The warning is emitted only
5850 with @option{--coverage} enabled.
5852 By default, this warning is enabled and is treated as an
5853 error. @option{-Wno-coverage-invalid-line-number} can be used to disable the
5854 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
5857 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5860 Suppress warning messages emitted by @code{#warning} directives.
5862 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5863 @opindex Wdouble-promotion
5864 @opindex Wno-double-promotion
5865 Give a warning when a value of type @code{float} is implicitly
5866 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
5867 floating-point unit implement @code{float} in hardware, but emulate
5868 @code{double} in software. On such a machine, doing computations
5869 using @code{double} values is much more expensive because of the
5870 overhead required for software emulation.
5872 It is easy to accidentally do computations with @code{double} because
5873 floating-point literals are implicitly of type @code{double}. For
5877 float area(float radius)
5879 return 3.14159 * radius * radius;
5883 the compiler performs the entire computation with @code{double}
5884 because the floating-point literal is a @code{double}.
5886 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5887 @opindex Wduplicate-decl-specifier
5888 @opindex Wno-duplicate-decl-specifier
5889 Warn if a declaration has duplicate @code{const}, @code{volatile},
5890 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
5894 @itemx -Wformat=@var{n}
5897 @opindex ffreestanding
5898 @opindex fno-builtin
5900 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5901 the arguments supplied have types appropriate to the format string
5902 specified, and that the conversions specified in the format string make
5903 sense. This includes standard functions, and others specified by format
5904 attributes (@pxref{Function Attributes}), in the @code{printf},
5905 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5906 not in the C standard) families (or other target-specific families).
5907 Which functions are checked without format attributes having been
5908 specified depends on the standard version selected, and such checks of
5909 functions without the attribute specified are disabled by
5910 @option{-ffreestanding} or @option{-fno-builtin}.
5912 The formats are checked against the format features supported by GNU
5913 libc version 2.2. These include all ISO C90 and C99 features, as well
5914 as features from the Single Unix Specification and some BSD and GNU
5915 extensions. Other library implementations may not support all these
5916 features; GCC does not support warning about features that go beyond a
5917 particular library's limitations. However, if @option{-Wpedantic} is used
5918 with @option{-Wformat}, warnings are given about format features not
5919 in the selected standard version (but not for @code{strfmon} formats,
5920 since those are not in any version of the C standard). @xref{C Dialect
5921 Options,,Options Controlling C Dialect}.
5928 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5929 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
5930 @option{-Wformat} also checks for null format arguments for several
5931 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
5932 aspects of this level of format checking can be disabled by the
5933 options: @option{-Wno-format-contains-nul},
5934 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5935 @option{-Wformat} is enabled by @option{-Wall}.
5939 Enable @option{-Wformat} plus additional format checks. Currently
5940 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5944 @item -Wno-format-contains-nul
5945 @opindex Wno-format-contains-nul
5946 @opindex Wformat-contains-nul
5947 If @option{-Wformat} is specified, do not warn about format strings that
5950 @item -Wno-format-extra-args
5951 @opindex Wno-format-extra-args
5952 @opindex Wformat-extra-args
5953 If @option{-Wformat} is specified, do not warn about excess arguments to a
5954 @code{printf} or @code{scanf} format function. The C standard specifies
5955 that such arguments are ignored.
5957 Where the unused arguments lie between used arguments that are
5958 specified with @samp{$} operand number specifications, normally
5959 warnings are still given, since the implementation could not know what
5960 type to pass to @code{va_arg} to skip the unused arguments. However,
5961 in the case of @code{scanf} formats, this option suppresses the
5962 warning if the unused arguments are all pointers, since the Single
5963 Unix Specification says that such unused arguments are allowed.
5965 @item -Wformat-overflow
5966 @itemx -Wformat-overflow=@var{level}
5967 @opindex Wformat-overflow
5968 @opindex Wno-format-overflow
5969 Warn about calls to formatted input/output functions such as @code{sprintf}
5970 and @code{vsprintf} that might overflow the destination buffer. When the
5971 exact number of bytes written by a format directive cannot be determined
5972 at compile-time it is estimated based on heuristics that depend on the
5973 @var{level} argument and on optimization. While enabling optimization
5974 will in most cases improve the accuracy of the warning, it may also
5975 result in false positives.
5978 @item -Wformat-overflow
5979 @itemx -Wformat-overflow=1
5980 @opindex Wformat-overflow
5981 @opindex Wno-format-overflow
5982 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5983 employs a conservative approach that warns only about calls that most
5984 likely overflow the buffer. At this level, numeric arguments to format
5985 directives with unknown values are assumed to have the value of one, and
5986 strings of unknown length to be empty. Numeric arguments that are known
5987 to be bounded to a subrange of their type, or string arguments whose output
5988 is bounded either by their directive's precision or by a finite set of
5989 string literals, are assumed to take on the value within the range that
5990 results in the most bytes on output. For example, the call to @code{sprintf}
5991 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5992 the terminating NUL character (@code{'\0'}) appended by the function
5993 to the destination buffer will be written past its end. Increasing
5994 the size of the buffer by a single byte is sufficient to avoid the
5995 warning, though it may not be sufficient to avoid the overflow.
5998 void f (int a, int b)
6001 sprintf (buf, "a = %i, b = %i\n", a, b);
6005 @item -Wformat-overflow=2
6006 Level @var{2} warns also about calls that might overflow the destination
6007 buffer given an argument of sufficient length or magnitude. At level
6008 @var{2}, unknown numeric arguments are assumed to have the minimum
6009 representable value for signed types with a precision greater than 1, and
6010 the maximum representable value otherwise. Unknown string arguments whose
6011 length cannot be assumed to be bounded either by the directive's precision,
6012 or by a finite set of string literals they may evaluate to, or the character
6013 array they may point to, are assumed to be 1 character long.
6015 At level @var{2}, the call in the example above is again diagnosed, but
6016 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6017 @code{%i} directive will write some of its digits beyond the end of
6018 the destination buffer. To make the call safe regardless of the values
6019 of the two variables, the size of the destination buffer must be increased
6020 to at least 34 bytes. GCC includes the minimum size of the buffer in
6021 an informational note following the warning.
6023 An alternative to increasing the size of the destination buffer is to
6024 constrain the range of formatted values. The maximum length of string
6025 arguments can be bounded by specifying the precision in the format
6026 directive. When numeric arguments of format directives can be assumed
6027 to be bounded by less than the precision of their type, choosing
6028 an appropriate length modifier to the format specifier will reduce
6029 the required buffer size. For example, if @var{a} and @var{b} in the
6030 example above can be assumed to be within the precision of
6031 the @code{short int} type then using either the @code{%hi} format
6032 directive or casting the argument to @code{short} reduces the maximum
6033 required size of the buffer to 24 bytes.
6036 void f (int a, int b)
6039 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6044 @item -Wno-format-zero-length
6045 @opindex Wno-format-zero-length
6046 @opindex Wformat-zero-length
6047 If @option{-Wformat} is specified, do not warn about zero-length formats.
6048 The C standard specifies that zero-length formats are allowed.
6050 @item -Wformat-nonliteral
6051 @opindex Wformat-nonliteral
6052 @opindex Wno-format-nonliteral
6053 If @option{-Wformat} is specified, also warn if the format string is not a
6054 string literal and so cannot be checked, unless the format function
6055 takes its format arguments as a @code{va_list}.
6057 @item -Wformat-security
6058 @opindex Wformat-security
6059 @opindex Wno-format-security
6060 If @option{-Wformat} is specified, also warn about uses of format
6061 functions that represent possible security problems. At present, this
6062 warns about calls to @code{printf} and @code{scanf} functions where the
6063 format string is not a string literal and there are no format arguments,
6064 as in @code{printf (foo);}. This may be a security hole if the format
6065 string came from untrusted input and contains @samp{%n}. (This is
6066 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6067 in future warnings may be added to @option{-Wformat-security} that are not
6068 included in @option{-Wformat-nonliteral}.)
6070 @item -Wformat-signedness
6071 @opindex Wformat-signedness
6072 @opindex Wno-format-signedness
6073 If @option{-Wformat} is specified, also warn if the format string
6074 requires an unsigned argument and the argument is signed and vice versa.
6076 @item -Wformat-truncation
6077 @itemx -Wformat-truncation=@var{level}
6078 @opindex Wformat-truncation
6079 @opindex Wno-format-truncation
6080 Warn about calls to formatted input/output functions such as @code{snprintf}
6081 and @code{vsnprintf} that might result in output truncation. When the exact
6082 number of bytes written by a format directive cannot be determined at
6083 compile-time it is estimated based on heuristics that depend on
6084 the @var{level} argument and on optimization. While enabling optimization
6085 will in most cases improve the accuracy of the warning, it may also result
6086 in false positives. Except as noted otherwise, the option uses the same
6087 logic @option{-Wformat-overflow}.
6090 @item -Wformat-truncation
6091 @itemx -Wformat-truncation=1
6092 @opindex Wformat-truncation
6093 @opindex Wno-format-truncation
6094 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6095 employs a conservative approach that warns only about calls to bounded
6096 functions whose return value is unused and that will most likely result
6097 in output truncation.
6099 @item -Wformat-truncation=2
6100 Level @var{2} warns also about calls to bounded functions whose return
6101 value is used and that might result in truncation given an argument of
6102 sufficient length or magnitude.
6106 @opindex Wformat-y2k
6107 @opindex Wno-format-y2k
6108 If @option{-Wformat} is specified, also warn about @code{strftime}
6109 formats that may yield only a two-digit year.
6113 @opindex Wno-nonnull
6114 Warn about passing a null pointer for arguments marked as
6115 requiring a non-null value by the @code{nonnull} function attribute.
6117 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
6118 can be disabled with the @option{-Wno-nonnull} option.
6120 @item -Wnonnull-compare
6121 @opindex Wnonnull-compare
6122 @opindex Wno-nonnull-compare
6123 Warn when comparing an argument marked with the @code{nonnull}
6124 function attribute against null inside the function.
6126 @option{-Wnonnull-compare} is included in @option{-Wall}. It
6127 can be disabled with the @option{-Wno-nonnull-compare} option.
6129 @item -Wnull-dereference
6130 @opindex Wnull-dereference
6131 @opindex Wno-null-dereference
6132 Warn if the compiler detects paths that trigger erroneous or
6133 undefined behavior due to dereferencing a null pointer. This option
6134 is only active when @option{-fdelete-null-pointer-checks} is active,
6135 which is enabled by optimizations in most targets. The precision of
6136 the warnings depends on the optimization options used.
6138 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6140 @opindex Wno-init-self
6141 Warn about uninitialized variables that are initialized with themselves.
6142 Note this option can only be used with the @option{-Wuninitialized} option.
6144 For example, GCC warns about @code{i} being uninitialized in the
6145 following snippet only when @option{-Winit-self} has been specified:
6156 This warning is enabled by @option{-Wall} in C++.
6158 @item -Wno-implicit-int @r{(C and Objective-C only)}
6159 @opindex Wimplicit-int
6160 @opindex Wno-implicit-int
6161 This option controls warnings when a declaration does not specify a type.
6162 This warning is enabled by default in C99 and later dialects of C,
6163 and also by @option{-Wall}.
6165 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6166 @opindex Wimplicit-function-declaration
6167 @opindex Wno-implicit-function-declaration
6168 This option controls warnings when a function is used before being declared.
6169 This warning is enabled by default in C99 and later dialects of C,
6170 and also by @option{-Wall}.
6171 The warning is made into an error by @option{-pedantic-errors}.
6173 @item -Wimplicit @r{(C and Objective-C only)}
6175 @opindex Wno-implicit
6176 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6177 This warning is enabled by @option{-Wall}.
6179 @item -Wimplicit-fallthrough
6180 @opindex Wimplicit-fallthrough
6181 @opindex Wno-implicit-fallthrough
6182 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6183 and @option{-Wno-implicit-fallthrough} is the same as
6184 @option{-Wimplicit-fallthrough=0}.
6186 @item -Wimplicit-fallthrough=@var{n}
6187 @opindex Wimplicit-fallthrough=
6188 Warn when a switch case falls through. For example:
6206 This warning does not warn when the last statement of a case cannot
6207 fall through, e.g. when there is a return statement or a call to function
6208 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
6209 also takes into account control flow statements, such as ifs, and only
6210 warns when appropriate. E.g.@:
6220 @} else if (i < 1) @{
6230 Since there are occasions where a switch case fall through is desirable,
6231 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6232 to be used along with a null statement to suppress this warning that
6233 would normally occur:
6241 __attribute__ ((fallthrough));
6248 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6249 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
6250 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6251 Instead of these attributes, it is also possible to add a fallthrough comment
6252 to silence the warning. The whole body of the C or C++ style comment should
6253 match the given regular expressions listed below. The option argument @var{n}
6254 specifies what kind of comments are accepted:
6258 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6260 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6261 expression, any comment is used as fallthrough comment.
6263 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6264 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6266 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6267 following regular expressions:
6271 @item @code{-fallthrough}
6273 @item @code{@@fallthrough@@}
6275 @item @code{lint -fallthrough[ \t]*}
6277 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6279 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6281 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6285 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6286 following regular expressions:
6290 @item @code{-fallthrough}
6292 @item @code{@@fallthrough@@}
6294 @item @code{lint -fallthrough[ \t]*}
6296 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6300 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6301 fallthrough comments, only attributes disable the warning.
6305 The comment needs to be followed after optional whitespace and other comments
6306 by @code{case} or @code{default} keywords or by a user label that precedes some
6307 @code{case} or @code{default} label.
6322 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6324 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6325 @opindex Wif-not-aligned
6326 @opindex Wno-if-not-aligned
6327 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6328 should be issued. These warnings are enabled by default.
6330 @item -Wignored-qualifiers @r{(C and C++ only)}
6331 @opindex Wignored-qualifiers
6332 @opindex Wno-ignored-qualifiers
6333 Warn if the return type of a function has a type qualifier
6334 such as @code{const}. For ISO C such a type qualifier has no effect,
6335 since the value returned by a function is not an lvalue.
6336 For C++, the warning is only emitted for scalar types or @code{void}.
6337 ISO C prohibits qualified @code{void} return types on function
6338 definitions, so such return types always receive a warning
6339 even without this option.
6341 This warning is also enabled by @option{-Wextra}.
6343 @item -Wno-ignored-attributes @r{(C and C++ only)}
6344 @opindex Wignored-attributes
6345 @opindex Wno-ignored-attributes
6346 This option controls warnings when an attribute is ignored.
6347 This is different from the
6348 @option{-Wattributes} option in that it warns whenever the compiler decides
6349 to drop an attribute, not that the attribute is either unknown, used in a
6350 wrong place, etc. This warning is enabled by default.
6355 Warn if the type of @code{main} is suspicious. @code{main} should be
6356 a function with external linkage, returning int, taking either zero
6357 arguments, two, or three arguments of appropriate types. This warning
6358 is enabled by default in C++ and is enabled by either @option{-Wall}
6359 or @option{-Wpedantic}.
6361 @item -Wmisleading-indentation @r{(C and C++ only)}
6362 @opindex Wmisleading-indentation
6363 @opindex Wno-misleading-indentation
6364 Warn when the indentation of the code does not reflect the block structure.
6365 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6366 @code{for} clauses with a guarded statement that does not use braces,
6367 followed by an unguarded statement with the same indentation.
6369 In the following example, the call to ``bar'' is misleadingly indented as
6370 if it were guarded by the ``if'' conditional.
6373 if (some_condition ())
6375 bar (); /* Gotcha: this is not guarded by the "if". */
6378 In the case of mixed tabs and spaces, the warning uses the
6379 @option{-ftabstop=} option to determine if the statements line up
6382 The warning is not issued for code involving multiline preprocessor logic
6383 such as the following example.
6388 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6394 The warning is not issued after a @code{#line} directive, since this
6395 typically indicates autogenerated code, and no assumptions can be made
6396 about the layout of the file that the directive references.
6398 This warning is enabled by @option{-Wall} in C and C++.
6400 @item -Wmissing-attributes
6401 @opindex Wmissing-attributes
6402 @opindex Wno-missing-attributes
6403 Warn when a declaration of a function is missing one or more attributes
6404 that a related function is declared with and whose absence may adversely
6405 affect the correctness or efficiency of generated code. For example,
6406 the warning is issued for declarations of aliases that use attributes
6407 to specify less restrictive requirements than those of their targets.
6408 This typically represents a potential optimization opportunity.
6409 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6410 issued when the alias is more restrictive than the target, which could
6411 lead to incorrect code generation.
6412 Attributes considered include @code{alloc_align}, @code{alloc_size},
6413 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6414 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6415 @code{returns_nonnull}, and @code{returns_twice}.
6417 In C++, the warning is issued when an explicit specialization of a primary
6418 template declared with attribute @code{alloc_align}, @code{alloc_size},
6419 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6420 or @code{nonnull} is declared without it. Attributes @code{deprecated},
6421 @code{error}, and @code{warning} suppress the warning.
6422 (@pxref{Function Attributes}).
6424 You can use the @code{copy} attribute to apply the same
6425 set of attributes to a declaration as that on another declaration without
6426 explicitly enumerating the attributes. This attribute can be applied
6427 to declarations of functions (@pxref{Common Function Attributes}),
6428 variables (@pxref{Common Variable Attributes}), or types
6429 (@pxref{Common Type Attributes}).
6431 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6433 For example, since the declaration of the primary function template
6434 below makes use of both attribute @code{malloc} and @code{alloc_size}
6435 the declaration of the explicit specialization of the template is
6436 diagnosed because it is missing one of the attributes.
6440 T* __attribute__ ((malloc, alloc_size (1)))
6444 void* __attribute__ ((malloc)) // missing alloc_size
6445 allocate<void> (size_t);
6448 @item -Wmissing-braces
6449 @opindex Wmissing-braces
6450 @opindex Wno-missing-braces
6451 Warn if an aggregate or union initializer is not fully bracketed. In
6452 the following example, the initializer for @code{a} is not fully
6453 bracketed, but that for @code{b} is fully bracketed.
6456 int a[2][2] = @{ 0, 1, 2, 3 @};
6457 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6460 This warning is enabled by @option{-Wall}.
6462 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
6463 @opindex Wmissing-include-dirs
6464 @opindex Wno-missing-include-dirs
6465 Warn if a user-supplied include directory does not exist. This opions is disabled
6466 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
6467 enabled by default by warning for -I and -J, only.
6469 @item -Wno-missing-profile
6470 @opindex Wmissing-profile
6471 @opindex Wno-missing-profile
6472 This option controls warnings if feedback profiles are missing when using the
6473 @option{-fprofile-use} option.
6474 This option diagnoses those cases where a new function or a new file is added
6475 between compiling with @option{-fprofile-generate} and with
6476 @option{-fprofile-use}, without regenerating the profiles.
6477 In these cases, the profile feedback data files do not contain any
6478 profile feedback information for
6479 the newly added function or file respectively. Also, in the case when profile
6480 count data (.gcda) files are removed, GCC cannot use any profile feedback
6481 information. In all these cases, warnings are issued to inform you that a
6482 profile generation step is due.
6483 Ignoring the warning can result in poorly optimized code.
6484 @option{-Wno-missing-profile} can be used to
6485 disable the warning, but this is not recommended and should be done only
6486 when non-existent profile data is justified.
6488 @item -Wmismatched-dealloc
6489 @opindex Wmismatched-dealloc
6490 @opindex Wno-mismatched-dealloc
6492 Warn for calls to deallocation functions with pointer arguments returned
6493 from from allocations functions for which the former isn't a suitable
6494 deallocator. A pair of functions can be associated as matching allocators
6495 and deallocators by use of attribute @code{malloc}. Unless disabled by
6496 the @option{-fno-builtin} option the standard functions @code{calloc},
6497 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
6498 forms of C++ @code{operator new} and @code{operator delete} are implicitly
6499 associated as matching allocators and deallocators. In the following
6500 example @code{mydealloc} is the deallocator for pointers returned from
6504 void mydealloc (void*);
6506 __attribute__ ((malloc (mydealloc, 1))) void*
6511 void *p = myalloc (32);
6512 // @dots{}use p@dots{}
6513 free (p); // warning: not a matching deallocator for myalloc
6514 mydealloc (p); // ok
6518 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
6519 mismatches involving either @code{operator new} or @code{operator delete}.
6521 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
6523 @item -Wmultistatement-macros
6524 @opindex Wmultistatement-macros
6525 @opindex Wno-multistatement-macros
6526 Warn about unsafe multiple statement macros that appear to be guarded
6527 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
6528 @code{while}, in which only the first statement is actually guarded after
6529 the macro is expanded.
6534 #define DOIT x++; y++
6539 will increment @code{y} unconditionally, not just when @code{c} holds.
6540 The can usually be fixed by wrapping the macro in a do-while loop:
6542 #define DOIT do @{ x++; y++; @} while (0)
6547 This warning is enabled by @option{-Wall} in C and C++.
6550 @opindex Wparentheses
6551 @opindex Wno-parentheses
6552 Warn if parentheses are omitted in certain contexts, such
6553 as when there is an assignment in a context where a truth value
6554 is expected, or when operators are nested whose precedence people
6555 often get confused about.
6557 Also warn if a comparison like @code{x<=y<=z} appears; this is
6558 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
6559 interpretation from that of ordinary mathematical notation.
6561 Also warn for dangerous uses of the GNU extension to
6562 @code{?:} with omitted middle operand. When the condition
6563 in the @code{?}: operator is a boolean expression, the omitted value is
6564 always 1. Often programmers expect it to be a value computed
6565 inside the conditional expression instead.
6567 For C++ this also warns for some cases of unnecessary parentheses in
6568 declarations, which can indicate an attempt at a function call instead
6572 // Declares a local variable called mymutex.
6573 std::unique_lock<std::mutex> (mymutex);
6574 // User meant std::unique_lock<std::mutex> lock (mymutex);
6578 This warning is enabled by @option{-Wall}.
6580 @item -Wsequence-point
6581 @opindex Wsequence-point
6582 @opindex Wno-sequence-point
6583 Warn about code that may have undefined semantics because of violations
6584 of sequence point rules in the C and C++ standards.
6586 The C and C++ standards define the order in which expressions in a C/C++
6587 program are evaluated in terms of @dfn{sequence points}, which represent
6588 a partial ordering between the execution of parts of the program: those
6589 executed before the sequence point, and those executed after it. These
6590 occur after the evaluation of a full expression (one which is not part
6591 of a larger expression), after the evaluation of the first operand of a
6592 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
6593 function is called (but after the evaluation of its arguments and the
6594 expression denoting the called function), and in certain other places.
6595 Other than as expressed by the sequence point rules, the order of
6596 evaluation of subexpressions of an expression is not specified. All
6597 these rules describe only a partial order rather than a total order,
6598 since, for example, if two functions are called within one expression
6599 with no sequence point between them, the order in which the functions
6600 are called is not specified. However, the standards committee have
6601 ruled that function calls do not overlap.
6603 It is not specified when between sequence points modifications to the
6604 values of objects take effect. Programs whose behavior depends on this
6605 have undefined behavior; the C and C++ standards specify that ``Between
6606 the previous and next sequence point an object shall have its stored
6607 value modified at most once by the evaluation of an expression.
6608 Furthermore, the prior value shall be read only to determine the value
6609 to be stored.''. If a program breaks these rules, the results on any
6610 particular implementation are entirely unpredictable.
6612 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
6613 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
6614 diagnosed by this option, and it may give an occasional false positive
6615 result, but in general it has been found fairly effective at detecting
6616 this sort of problem in programs.
6618 The C++17 standard will define the order of evaluation of operands in
6619 more cases: in particular it requires that the right-hand side of an
6620 assignment be evaluated before the left-hand side, so the above
6621 examples are no longer undefined. But this option will still warn
6622 about them, to help people avoid writing code that is undefined in C
6623 and earlier revisions of C++.
6625 The standard is worded confusingly, therefore there is some debate
6626 over the precise meaning of the sequence point rules in subtle cases.
6627 Links to discussions of the problem, including proposed formal
6628 definitions, may be found on the GCC readings page, at
6629 @uref{http://gcc.gnu.org/@/readings.html}.
6631 This warning is enabled by @option{-Wall} for C and C++.
6633 @item -Wno-return-local-addr
6634 @opindex Wno-return-local-addr
6635 @opindex Wreturn-local-addr
6636 Do not warn about returning a pointer (or in C++, a reference) to a
6637 variable that goes out of scope after the function returns.
6640 @opindex Wreturn-type
6641 @opindex Wno-return-type
6642 Warn whenever a function is defined with a return type that defaults
6643 to @code{int}. Also warn about any @code{return} statement with no
6644 return value in a function whose return type is not @code{void}
6645 (falling off the end of the function body is considered returning
6648 For C only, warn about a @code{return} statement with an expression in a
6649 function whose return type is @code{void}, unless the expression type is
6650 also @code{void}. As a GNU extension, the latter case is accepted
6651 without a warning unless @option{-Wpedantic} is used. Attempting
6652 to use the return value of a non-@code{void} function other than @code{main}
6653 that flows off the end by reaching the closing curly brace that terminates
6654 the function is undefined.
6656 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
6657 than @code{main} results in undefined behavior even when the value of
6658 the function is not used.
6660 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
6662 @item -Wno-shift-count-negative
6663 @opindex Wshift-count-negative
6664 @opindex Wno-shift-count-negative
6665 Controls warnings if a shift count is negative.
6666 This warning is enabled by default.
6668 @item -Wno-shift-count-overflow
6669 @opindex Wshift-count-overflow
6670 @opindex Wno-shift-count-overflow
6671 Controls warnings if a shift count is greater than or equal to the bit width
6672 of the type. This warning is enabled by default.
6674 @item -Wshift-negative-value
6675 @opindex Wshift-negative-value
6676 @opindex Wno-shift-negative-value
6677 Warn if left shifting a negative value. This warning is enabled by
6678 @option{-Wextra} in C99 and C++11 modes (and newer).
6680 @item -Wno-shift-overflow
6681 @itemx -Wshift-overflow=@var{n}
6682 @opindex Wshift-overflow
6683 @opindex Wno-shift-overflow
6684 These options control warnings about left shift overflows.
6687 @item -Wshift-overflow=1
6688 This is the warning level of @option{-Wshift-overflow} and is enabled
6689 by default in C99 and C++11 modes (and newer). This warning level does
6690 not warn about left-shifting 1 into the sign bit. (However, in C, such
6691 an overflow is still rejected in contexts where an integer constant expression
6692 is required.) No warning is emitted in C++20 mode (and newer), as signed left
6695 @item -Wshift-overflow=2
6696 This warning level also warns about left-shifting 1 into the sign bit,
6697 unless C++14 mode (or newer) is active.
6703 Warn whenever a @code{switch} statement has an index of enumerated type
6704 and lacks a @code{case} for one or more of the named codes of that
6705 enumeration. (The presence of a @code{default} label prevents this
6706 warning.) @code{case} labels outside the enumeration range also
6707 provoke warnings when this option is used (even if there is a
6708 @code{default} label).
6709 This warning is enabled by @option{-Wall}.
6711 @item -Wswitch-default
6712 @opindex Wswitch-default
6713 @opindex Wno-switch-default
6714 Warn whenever a @code{switch} statement does not have a @code{default}
6718 @opindex Wswitch-enum
6719 @opindex Wno-switch-enum
6720 Warn whenever a @code{switch} statement has an index of enumerated type
6721 and lacks a @code{case} for one or more of the named codes of that
6722 enumeration. @code{case} labels outside the enumeration range also
6723 provoke warnings when this option is used. The only difference
6724 between @option{-Wswitch} and this option is that this option gives a
6725 warning about an omitted enumeration code even if there is a
6726 @code{default} label.
6728 @item -Wno-switch-bool
6729 @opindex Wswitch-bool
6730 @opindex Wno-switch-bool
6731 Do not warn when a @code{switch} statement has an index of boolean type
6732 and the case values are outside the range of a boolean type.
6733 It is possible to suppress this warning by casting the controlling
6734 expression to a type other than @code{bool}. For example:
6737 switch ((int) (a == 4))
6743 This warning is enabled by default for C and C++ programs.
6745 @item -Wno-switch-outside-range
6746 @opindex Wswitch-outside-range
6747 @opindex Wno-switch-outside-range
6748 This option controls warnings when a @code{switch} case has a value
6749 that is outside of its
6750 respective type range. This warning is enabled by default for
6753 @item -Wno-switch-unreachable
6754 @opindex Wswitch-unreachable
6755 @opindex Wno-switch-unreachable
6756 Do not warn when a @code{switch} statement contains statements between the
6757 controlling expression and the first case label, which will never be
6758 executed. For example:
6770 @option{-Wswitch-unreachable} does not warn if the statement between the
6771 controlling expression and the first case label is just a declaration:
6784 This warning is enabled by default for C and C++ programs.
6786 @item -Wsync-nand @r{(C and C++ only)}
6788 @opindex Wno-sync-nand
6789 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6790 built-in functions are used. These functions changed semantics in GCC 4.4.
6792 @item -Wunused-but-set-parameter
6793 @opindex Wunused-but-set-parameter
6794 @opindex Wno-unused-but-set-parameter
6795 Warn whenever a function parameter is assigned to, but otherwise unused
6796 (aside from its declaration).
6798 To suppress this warning use the @code{unused} attribute
6799 (@pxref{Variable Attributes}).
6801 This warning is also enabled by @option{-Wunused} together with
6804 @item -Wunused-but-set-variable
6805 @opindex Wunused-but-set-variable
6806 @opindex Wno-unused-but-set-variable
6807 Warn whenever a local variable is assigned to, but otherwise unused
6808 (aside from its declaration).
6809 This warning is enabled by @option{-Wall}.
6811 To suppress this warning use the @code{unused} attribute
6812 (@pxref{Variable Attributes}).
6814 This warning is also enabled by @option{-Wunused}, which is enabled
6817 @item -Wunused-function
6818 @opindex Wunused-function
6819 @opindex Wno-unused-function
6820 Warn whenever a static function is declared but not defined or a
6821 non-inline static function is unused.
6822 This warning is enabled by @option{-Wall}.
6824 @item -Wunused-label
6825 @opindex Wunused-label
6826 @opindex Wno-unused-label
6827 Warn whenever a label is declared but not used.
6828 This warning is enabled by @option{-Wall}.
6830 To suppress this warning use the @code{unused} attribute
6831 (@pxref{Variable Attributes}).
6833 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6834 @opindex Wunused-local-typedefs
6835 @opindex Wno-unused-local-typedefs
6836 Warn when a typedef locally defined in a function is not used.
6837 This warning is enabled by @option{-Wall}.
6839 @item -Wunused-parameter
6840 @opindex Wunused-parameter
6841 @opindex Wno-unused-parameter
6842 Warn whenever a function parameter is unused aside from its declaration.
6844 To suppress this warning use the @code{unused} attribute
6845 (@pxref{Variable Attributes}).
6847 @item -Wno-unused-result
6848 @opindex Wunused-result
6849 @opindex Wno-unused-result
6850 Do not warn if a caller of a function marked with attribute
6851 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
6852 its return value. The default is @option{-Wunused-result}.
6854 @item -Wunused-variable
6855 @opindex Wunused-variable
6856 @opindex Wno-unused-variable
6857 Warn whenever a local or static variable is unused aside from its
6858 declaration. This option implies @option{-Wunused-const-variable=1} for C,
6859 but not for C++. This warning is enabled by @option{-Wall}.
6861 To suppress this warning use the @code{unused} attribute
6862 (@pxref{Variable Attributes}).
6864 @item -Wunused-const-variable
6865 @itemx -Wunused-const-variable=@var{n}
6866 @opindex Wunused-const-variable
6867 @opindex Wno-unused-const-variable
6868 Warn whenever a constant static variable is unused aside from its declaration.
6869 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6870 for C, but not for C++. In C this declares variable storage, but in C++ this
6871 is not an error since const variables take the place of @code{#define}s.
6873 To suppress this warning use the @code{unused} attribute
6874 (@pxref{Variable Attributes}).
6877 @item -Wunused-const-variable=1
6878 This is the warning level that is enabled by @option{-Wunused-variable} for
6879 C. It warns only about unused static const variables defined in the main
6880 compilation unit, but not about static const variables declared in any
6883 @item -Wunused-const-variable=2
6884 This warning level also warns for unused constant static variables in
6885 headers (excluding system headers). This is the warning level of
6886 @option{-Wunused-const-variable} and must be explicitly requested since
6887 in C++ this isn't an error and in C it might be harder to clean up all
6891 @item -Wunused-value
6892 @opindex Wunused-value
6893 @opindex Wno-unused-value
6894 Warn whenever a statement computes a result that is explicitly not
6895 used. To suppress this warning cast the unused expression to
6896 @code{void}. This includes an expression-statement or the left-hand
6897 side of a comma expression that contains no side effects. For example,
6898 an expression such as @code{x[i,j]} causes a warning, while
6899 @code{x[(void)i,j]} does not.
6901 This warning is enabled by @option{-Wall}.
6906 All the above @option{-Wunused} options combined.
6908 In order to get a warning about an unused function parameter, you must
6909 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6910 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6912 @item -Wuninitialized
6913 @opindex Wuninitialized
6914 @opindex Wno-uninitialized
6915 Warn if an object with automatic or allocated storage duration is used
6916 without having been initialized. In C++, also warn if a non-static
6917 reference or non-static @code{const} member appears in a class without
6920 In addition, passing a pointer (or in C++, a reference) to an uninitialized
6921 object to a @code{const}-qualified argument of a built-in function known to
6922 read the object is also diagnosed by this warning.
6923 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
6925 If you want to warn about code that uses the uninitialized value of the
6926 variable in its own initializer, use the @option{-Winit-self} option.
6928 These warnings occur for individual uninitialized elements of
6929 structure, union or array variables as well as for variables that are
6930 uninitialized as a whole. They do not occur for variables or elements
6931 declared @code{volatile}. Because these warnings depend on
6932 optimization, the exact variables or elements for which there are
6933 warnings depend on the precise optimization options and version of GCC
6936 Note that there may be no warning about a variable that is used only
6937 to compute a value that itself is never used, because such
6938 computations may be deleted by data flow analysis before the warnings
6941 @item -Wno-invalid-memory-model
6942 @opindex Winvalid-memory-model
6943 @opindex Wno-invalid-memory-model
6944 This option controls warnings
6945 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6946 and the C11 atomic generic functions with a memory consistency argument
6947 that is either invalid for the operation or outside the range of values
6948 of the @code{memory_order} enumeration. For example, since the
6949 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6950 defined for the relaxed, release, and sequentially consistent memory
6951 orders the following code is diagnosed:
6956 __atomic_store_n (i, 0, memory_order_consume);
6960 @option{-Winvalid-memory-model} is enabled by default.
6962 @item -Wmaybe-uninitialized
6963 @opindex Wmaybe-uninitialized
6964 @opindex Wno-maybe-uninitialized
6965 For an object with automatic or allocated storage duration, if there exists
6966 a path from the function entry to a use of the object that is initialized,
6967 but there exist some other paths for which the object is not initialized,
6968 the compiler emits a warning if it cannot prove the uninitialized paths
6969 are not executed at run time.
6971 In addition, passing a pointer (or in C++, a reference) to an uninitialized
6972 object to a @code{const}-qualified function argument is also diagnosed by
6973 this warning. (@option{-Wuninitialized} is issued for built-in functions
6974 known to read the object.) Annotating the function with attribute
6975 @code{access (none)} indicates that the argument isn't used to access
6976 the object and avoids the warning (@pxref{Common Function Attributes}).
6978 These warnings are only possible in optimizing compilation, because otherwise
6979 GCC does not keep track of the state of variables.
6981 These warnings are made optional because GCC may not be able to determine when
6982 the code is correct in spite of appearing to have an error. Here is one
6983 example of how this can happen:
7003 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7004 always initialized, but GCC doesn't know this. To suppress the
7005 warning, you need to provide a default case with assert(0) or
7008 @cindex @code{longjmp} warnings
7009 This option also warns when a non-volatile automatic variable might be
7010 changed by a call to @code{longjmp}.
7011 The compiler sees only the calls to @code{setjmp}. It cannot know
7012 where @code{longjmp} will be called; in fact, a signal handler could
7013 call it at any point in the code. As a result, you may get a warning
7014 even when there is in fact no problem because @code{longjmp} cannot
7015 in fact be called at the place that would cause a problem.
7017 Some spurious warnings can be avoided if you declare all the functions
7018 you use that never return as @code{noreturn}. @xref{Function
7021 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7023 @item -Wunknown-pragmas
7024 @opindex Wunknown-pragmas
7025 @opindex Wno-unknown-pragmas
7026 @cindex warning for unknown pragmas
7027 @cindex unknown pragmas, warning
7028 @cindex pragmas, warning of unknown
7029 Warn when a @code{#pragma} directive is encountered that is not understood by
7030 GCC@. If this command-line option is used, warnings are even issued
7031 for unknown pragmas in system header files. This is not the case if
7032 the warnings are only enabled by the @option{-Wall} command-line option.
7035 @opindex Wno-pragmas
7037 Do not warn about misuses of pragmas, such as incorrect parameters,
7038 invalid syntax, or conflicts between pragmas. See also
7039 @option{-Wunknown-pragmas}.
7041 @item -Wno-prio-ctor-dtor
7042 @opindex Wno-prio-ctor-dtor
7043 @opindex Wprio-ctor-dtor
7044 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7045 The use of constructor and destructor attributes allow you to assign a
7046 priority to the constructor/destructor to control its order of execution
7047 before @code{main} is called or after it returns. The priority values must be
7048 greater than 100 as the compiler reserves priority values between 0--100 for
7051 @item -Wstrict-aliasing
7052 @opindex Wstrict-aliasing
7053 @opindex Wno-strict-aliasing
7054 This option is only active when @option{-fstrict-aliasing} is active.
7055 It warns about code that might break the strict aliasing rules that the
7056 compiler is using for optimization. The warning does not catch all
7057 cases, but does attempt to catch the more common pitfalls. It is
7058 included in @option{-Wall}.
7059 It is equivalent to @option{-Wstrict-aliasing=3}
7061 @item -Wstrict-aliasing=n
7062 @opindex Wstrict-aliasing=n
7063 This option is only active when @option{-fstrict-aliasing} is active.
7064 It warns about code that might break the strict aliasing rules that the
7065 compiler is using for optimization.
7066 Higher levels correspond to higher accuracy (fewer false positives).
7067 Higher levels also correspond to more effort, similar to the way @option{-O}
7069 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7071 Level 1: Most aggressive, quick, least accurate.
7072 Possibly useful when higher levels
7073 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7074 false negatives. However, it has many false positives.
7075 Warns for all pointer conversions between possibly incompatible types,
7076 even if never dereferenced. Runs in the front end only.
7078 Level 2: Aggressive, quick, not too precise.
7079 May still have many false positives (not as many as level 1 though),
7080 and few false negatives (but possibly more than level 1).
7081 Unlike level 1, it only warns when an address is taken. Warns about
7082 incomplete types. Runs in the front end only.
7084 Level 3 (default for @option{-Wstrict-aliasing}):
7085 Should have very few false positives and few false
7086 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
7087 Takes care of the common pun+dereference pattern in the front end:
7088 @code{*(int*)&some_float}.
7089 If optimization is enabled, it also runs in the back end, where it deals
7090 with multiple statement cases using flow-sensitive points-to information.
7091 Only warns when the converted pointer is dereferenced.
7092 Does not warn about incomplete types.
7094 @item -Wstrict-overflow
7095 @itemx -Wstrict-overflow=@var{n}
7096 @opindex Wstrict-overflow
7097 @opindex Wno-strict-overflow
7098 This option is only active when signed overflow is undefined.
7099 It warns about cases where the compiler optimizes based on the
7100 assumption that signed overflow does not occur. Note that it does not
7101 warn about all cases where the code might overflow: it only warns
7102 about cases where the compiler implements some optimization. Thus
7103 this warning depends on the optimization level.
7105 An optimization that assumes that signed overflow does not occur is
7106 perfectly safe if the values of the variables involved are such that
7107 overflow never does, in fact, occur. Therefore this warning can
7108 easily give a false positive: a warning about code that is not
7109 actually a problem. To help focus on important issues, several
7110 warning levels are defined. No warnings are issued for the use of
7111 undefined signed overflow when estimating how many iterations a loop
7112 requires, in particular when determining whether a loop will be
7116 @item -Wstrict-overflow=1
7117 Warn about cases that are both questionable and easy to avoid. For
7118 example the compiler simplifies
7119 @code{x + 1 > x} to @code{1}. This level of
7120 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7121 are not, and must be explicitly requested.
7123 @item -Wstrict-overflow=2
7124 Also warn about other cases where a comparison is simplified to a
7125 constant. For example: @code{abs (x) >= 0}. This can only be
7126 simplified when signed integer overflow is undefined, because
7127 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7128 zero. @option{-Wstrict-overflow} (with no level) is the same as
7129 @option{-Wstrict-overflow=2}.
7131 @item -Wstrict-overflow=3
7132 Also warn about other cases where a comparison is simplified. For
7133 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7135 @item -Wstrict-overflow=4
7136 Also warn about other simplifications not covered by the above cases.
7137 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7139 @item -Wstrict-overflow=5
7140 Also warn about cases where the compiler reduces the magnitude of a
7141 constant involved in a comparison. For example: @code{x + 2 > y} is
7142 simplified to @code{x + 1 >= y}. This is reported only at the
7143 highest warning level because this simplification applies to many
7144 comparisons, so this warning level gives a very large number of
7148 @item -Wstring-compare
7149 @opindex Wstring-compare
7150 @opindex Wno-string-compare
7151 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7152 determined to be either zero or non-zero in tests for such equality
7153 owing to the length of one argument being greater than the size of
7154 the array the other argument is stored in (or the bound in the case
7155 of @code{strncmp}). Such calls could be mistakes. For example,
7156 the call to @code{strcmp} below is diagnosed because its result is
7157 necessarily non-zero irrespective of the contents of the array @code{a}.
7163 strcpy (d, "string");
7165 if (0 == strcmp (a, d)) // cannot be true
7166 puts ("a and d are the same");
7170 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7172 @item -Wno-stringop-overflow
7173 @item -Wstringop-overflow
7174 @itemx -Wstringop-overflow=@var{type}
7175 @opindex Wstringop-overflow
7176 @opindex Wno-stringop-overflow
7177 Warn for calls to string manipulation functions such as @code{memcpy} and
7178 @code{strcpy} that are determined to overflow the destination buffer. The
7179 optional argument is one greater than the type of Object Size Checking to
7180 perform to determine the size of the destination. @xref{Object Size Checking}.
7181 The argument is meaningful only for functions that operate on character arrays
7182 but not for raw memory functions like @code{memcpy} which always make use
7183 of Object Size type-0. The option also warns for calls that specify a size
7184 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7185 The option produces the best results with optimization enabled but can detect
7186 a small subset of simple buffer overflows even without optimization in
7187 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7188 correspond to the standard functions. In any case, the option warns about
7189 just a subset of buffer overflows detected by the corresponding overflow
7190 checking built-ins. For example, the option issues a warning for
7191 the @code{strcpy} call below because it copies at least 5 characters
7192 (the string @code{"blue"} including the terminating NUL) into the buffer
7196 enum Color @{ blue, purple, yellow @};
7197 const char* f (enum Color clr)
7199 static char buf [4];
7203 case blue: str = "blue"; break;
7204 case purple: str = "purple"; break;
7205 case yellow: str = "yellow"; break;
7208 return strcpy (buf, str); // warning here
7212 Option @option{-Wstringop-overflow=2} is enabled by default.
7215 @item -Wstringop-overflow
7216 @itemx -Wstringop-overflow=1
7217 @opindex Wstringop-overflow
7218 @opindex Wno-stringop-overflow
7219 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7220 to determine the sizes of destination objects. At this setting the option
7221 does not warn for writes past the end of subobjects of larger objects accessed
7222 by pointers unless the size of the largest surrounding object is known. When
7223 the destination may be one of several objects it is assumed to be the largest
7224 one of them. On Linux systems, when optimization is enabled at this setting
7225 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7226 is defined to a non-zero value.
7228 @item -Wstringop-overflow=2
7229 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7230 to determine the sizes of destination objects. At this setting the option
7231 warns about overflows when writing to members of the largest complete
7232 objects whose exact size is known. However, it does not warn for excessive
7233 writes to the same members of unknown objects referenced by pointers since
7234 they may point to arrays containing unknown numbers of elements. This is
7235 the default setting of the option.
7237 @item -Wstringop-overflow=3
7238 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7239 to determine the sizes of destination objects. At this setting the option
7240 warns about overflowing the smallest object or data member. This is the
7241 most restrictive setting of the option that may result in warnings for safe
7244 @item -Wstringop-overflow=4
7245 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7246 to determine the sizes of destination objects. At this setting the option
7247 warns about overflowing any data members, and when the destination is
7248 one of several objects it uses the size of the largest of them to decide
7249 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
7250 setting of the option may result in warnings for benign code.
7253 @item -Wno-stringop-overread
7254 @opindex Wstringop-overread
7255 @opindex Wno-stringop-overread
7256 Warn for calls to string manipulation functions such as @code{memchr}, or
7257 @code{strcpy} that are determined to read past the end of the source
7260 Option @option{-Wstringop-overread} is enabled by default.
7262 @item -Wno-stringop-truncation
7263 @opindex Wstringop-truncation
7264 @opindex Wno-stringop-truncation
7265 Do not warn for calls to bounded string manipulation functions
7266 such as @code{strncat},
7267 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7268 or leave the destination unchanged.
7270 In the following example, the call to @code{strncat} specifies a bound that
7271 is less than the length of the source string. As a result, the copy of
7272 the source will be truncated and so the call is diagnosed. To avoid the
7273 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7276 void append (char *buf, size_t bufsize)
7278 strncat (buf, ".txt", 3);
7282 As another example, the following call to @code{strncpy} results in copying
7283 to @code{d} just the characters preceding the terminating NUL, without
7284 appending the NUL to the end. Assuming the result of @code{strncpy} is
7285 necessarily a NUL-terminated string is a common mistake, and so the call
7286 is diagnosed. To avoid the warning when the result is not expected to be
7287 NUL-terminated, call @code{memcpy} instead.
7290 void copy (char *d, const char *s)
7292 strncpy (d, s, strlen (s));
7296 In the following example, the call to @code{strncpy} specifies the size
7297 of the destination buffer as the bound. If the length of the source
7298 string is equal to or greater than this size the result of the copy will
7299 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
7300 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7301 element of the buffer to @code{NUL}.
7304 void copy (const char *s)
7307 strncpy (buf, s, sizeof buf);
7312 In situations where a character array is intended to store a sequence
7313 of bytes with no terminating @code{NUL} such an array may be annotated
7314 with attribute @code{nonstring} to avoid this warning. Such arrays,
7315 however, are not suitable arguments to functions that expect
7316 @code{NUL}-terminated strings. To help detect accidental misuses of
7317 such arrays GCC issues warnings unless it can prove that the use is
7318 safe. @xref{Common Variable Attributes}.
7320 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7321 @opindex Wsuggest-attribute=
7322 @opindex Wno-suggest-attribute=
7323 Warn for cases where adding an attribute may be beneficial. The
7324 attributes currently supported are listed below.
7327 @item -Wsuggest-attribute=pure
7328 @itemx -Wsuggest-attribute=const
7329 @itemx -Wsuggest-attribute=noreturn
7330 @itemx -Wmissing-noreturn
7331 @itemx -Wsuggest-attribute=malloc
7332 @opindex Wsuggest-attribute=pure
7333 @opindex Wno-suggest-attribute=pure
7334 @opindex Wsuggest-attribute=const
7335 @opindex Wno-suggest-attribute=const
7336 @opindex Wsuggest-attribute=noreturn
7337 @opindex Wno-suggest-attribute=noreturn
7338 @opindex Wmissing-noreturn
7339 @opindex Wno-missing-noreturn
7340 @opindex Wsuggest-attribute=malloc
7341 @opindex Wno-suggest-attribute=malloc
7343 Warn about functions that might be candidates for attributes
7344 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7345 only warns for functions visible in other compilation units or (in the case of
7346 @code{pure} and @code{const}) if it cannot prove that the function returns
7347 normally. A function returns normally if it doesn't contain an infinite loop or
7348 return abnormally by throwing, calling @code{abort} or trapping. This analysis
7349 requires option @option{-fipa-pure-const}, which is enabled by default at
7350 @option{-O} and higher. Higher optimization levels improve the accuracy
7353 @item -Wsuggest-attribute=format
7354 @itemx -Wmissing-format-attribute
7355 @opindex Wsuggest-attribute=format
7356 @opindex Wmissing-format-attribute
7357 @opindex Wno-suggest-attribute=format
7358 @opindex Wno-missing-format-attribute
7362 Warn about function pointers that might be candidates for @code{format}
7363 attributes. Note these are only possible candidates, not absolute ones.
7364 GCC guesses that function pointers with @code{format} attributes that
7365 are used in assignment, initialization, parameter passing or return
7366 statements should have a corresponding @code{format} attribute in the
7367 resulting type. I.e.@: the left-hand side of the assignment or
7368 initialization, the type of the parameter variable, or the return type
7369 of the containing function respectively should also have a @code{format}
7370 attribute to avoid the warning.
7372 GCC also warns about function definitions that might be
7373 candidates for @code{format} attributes. Again, these are only
7374 possible candidates. GCC guesses that @code{format} attributes
7375 might be appropriate for any function that calls a function like
7376 @code{vprintf} or @code{vscanf}, but this might not always be the
7377 case, and some functions for which @code{format} attributes are
7378 appropriate may not be detected.
7380 @item -Wsuggest-attribute=cold
7381 @opindex Wsuggest-attribute=cold
7382 @opindex Wno-suggest-attribute=cold
7384 Warn about functions that might be candidates for @code{cold} attribute. This
7385 is based on static detection and generally only warns about functions which
7386 always leads to a call to another @code{cold} function such as wrappers of
7387 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7391 @opindex Wno-alloc-zero
7392 @opindex Walloc-zero
7393 Warn about calls to allocation functions decorated with attribute
7394 @code{alloc_size} that specify zero bytes, including those to the built-in
7395 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7396 @code{malloc}, and @code{realloc}. Because the behavior of these functions
7397 when called with a zero size differs among implementations (and in the case
7398 of @code{realloc} has been deprecated) relying on it may result in subtle
7399 portability bugs and should be avoided.
7401 @item -Walloc-size-larger-than=@var{byte-size}
7402 @opindex Walloc-size-larger-than=
7403 @opindex Wno-alloc-size-larger-than
7404 Warn about calls to functions decorated with attribute @code{alloc_size}
7405 that attempt to allocate objects larger than the specified number of bytes,
7406 or where the result of the size computation in an integer type with infinite
7407 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7408 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7409 Warnings controlled by the option can be disabled either by specifying
7410 @var{byte-size} of @samp{SIZE_MAX} or more or by
7411 @option{-Wno-alloc-size-larger-than}.
7412 @xref{Function Attributes}.
7414 @item -Wno-alloc-size-larger-than
7415 @opindex Wno-alloc-size-larger-than
7416 Disable @option{-Walloc-size-larger-than=} warnings. The option is
7417 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7423 This option warns on all uses of @code{alloca} in the source.
7425 @item -Walloca-larger-than=@var{byte-size}
7426 @opindex Walloca-larger-than=
7427 @opindex Wno-alloca-larger-than
7428 This option warns on calls to @code{alloca} with an integer argument whose
7429 value is either zero, or that is not bounded by a controlling predicate
7430 that limits its value to at most @var{byte-size}. It also warns for calls
7431 to @code{alloca} where the bound value is unknown. Arguments of non-integer
7432 types are considered unbounded even if they appear to be constrained to
7435 For example, a bounded case of @code{alloca} could be:
7438 void func (size_t n)
7449 In the above example, passing @code{-Walloca-larger-than=1000} would not
7450 issue a warning because the call to @code{alloca} is known to be at most
7451 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
7452 the compiler would emit a warning.
7454 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7455 controlling predicate constraining its integer argument. For example:
7460 void *p = alloca (n);
7465 If @code{-Walloca-larger-than=500} were passed, the above would trigger
7466 a warning, but this time because of the lack of bounds checking.
7468 Note, that even seemingly correct code involving signed integers could
7472 void func (signed int n)
7482 In the above example, @var{n} could be negative, causing a larger than
7483 expected argument to be implicitly cast into the @code{alloca} call.
7485 This option also warns when @code{alloca} is used in a loop.
7487 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
7488 but is usually only effective when @option{-ftree-vrp} is active (default
7489 for @option{-O2} and above).
7491 See also @option{-Wvla-larger-than=}@samp{byte-size}.
7493 @item -Wno-alloca-larger-than
7494 @opindex Wno-alloca-larger-than
7495 Disable @option{-Walloca-larger-than=} warnings. The option is
7496 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
7498 @item -Warith-conversion
7499 @opindex Warith-conversion
7500 @opindex Wno-arith-conversion
7501 Do warn about implicit conversions from arithmetic operations even
7502 when conversion of the operands to the same type cannot change their
7503 values. This affects warnings from @option{-Wconversion},
7504 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
7508 void f (char c, int i)
7510 c = c + i; // warns with @option{-Wconversion}
7511 c = c + 1; // only warns with @option{-Warith-conversion}
7516 @item -Warray-bounds
7517 @itemx -Warray-bounds=@var{n}
7518 @opindex Wno-array-bounds
7519 @opindex Warray-bounds
7520 This option is only active when @option{-ftree-vrp} is active
7521 (default for @option{-O2} and above). It warns about subscripts to arrays
7522 that are always out of bounds. This warning is enabled by @option{-Wall}.
7525 @item -Warray-bounds=1
7526 This is the warning level of @option{-Warray-bounds} and is enabled
7527 by @option{-Wall}; higher levels are not, and must be explicitly requested.
7529 @item -Warray-bounds=2
7530 This warning level also warns about out of bounds access for
7531 arrays at the end of a struct and for arrays accessed through
7532 pointers. This warning level may give a larger number of
7533 false positives and is deactivated by default.
7536 @item -Warray-parameter
7537 @itemx -Warray-parameter=@var{n}
7538 @opindex Wno-array-parameter
7539 Warn about redeclarations of functions involving arguments of array or
7540 pointer types of inconsistent kinds or forms, and enable the detection
7541 of out-of-bounds accesses to such parameters by warnings such as
7542 @option{-Warray-bounds}.
7544 If the first function declaration uses the array form the bound specified
7545 in the array is assumed to be the minimum number of elements expected to
7546 be provided in calls to the function and the maximum number of elements
7547 accessed by it. Failing to provide arguments of sufficient size or accessing
7548 more than the maximum number of elements may be diagnosed by warnings such
7549 as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies
7550 involving array parameters declared using the @code{T[static N]} form.
7552 For example, the warning triggers for the following redeclarations because
7553 the first one allows an array of any size to be passed to @code{f} while
7554 the second one with the keyword @code{static} specifies that the array
7555 argument must have at least four elements.
7558 void f (int[static 4]);
7559 void f (int[]); // warning (inconsistent array form)
7563 int *p = (int *)malloc (4);
7564 f (p); // warning (array too small)
7569 At level 2 the warning also triggers for redeclarations involving any other
7570 inconsistency in array or pointer argument forms denoting array sizes.
7571 Pointers and arrays of unspecified bound are considered equivalent and do
7572 not trigger a warning.
7576 void g (int[]); // no warning
7577 void g (int[8]); // warning (inconsistent array bound)
7580 @option{-Warray-parameter=2} is included in @option{-Wall}. The
7581 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
7582 involving Variable Length Array arguments.
7584 @item -Wattribute-alias=@var{n}
7585 @itemx -Wno-attribute-alias
7586 @opindex Wattribute-alias
7587 @opindex Wno-attribute-alias
7588 Warn about declarations using the @code{alias} and similar attributes whose
7589 target is incompatible with the type of the alias.
7590 @xref{Function Attributes,,Declaring Attributes of Functions}.
7593 @item -Wattribute-alias=1
7594 The default warning level of the @option{-Wattribute-alias} option diagnoses
7595 incompatibilities between the type of the alias declaration and that of its
7596 target. Such incompatibilities are typically indicative of bugs.
7598 @item -Wattribute-alias=2
7600 At this level @option{-Wattribute-alias} also diagnoses cases where
7601 the attributes of the alias declaration are more restrictive than the
7602 attributes applied to its target. These mismatches can potentially
7603 result in incorrect code generation. In other cases they may be
7604 benign and could be resolved simply by adding the missing attribute to
7605 the target. For comparison, see the @option{-Wmissing-attributes}
7606 option, which controls diagnostics when the alias declaration is less
7607 restrictive than the target, rather than more restrictive.
7609 Attributes considered include @code{alloc_align}, @code{alloc_size},
7610 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7611 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7612 @code{returns_nonnull}, and @code{returns_twice}.
7615 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
7616 This is the default. You can disable these warnings with either
7617 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
7619 @item -Wbool-compare
7620 @opindex Wno-bool-compare
7621 @opindex Wbool-compare
7622 Warn about boolean expression compared with an integer value different from
7623 @code{true}/@code{false}. For instance, the following comparison is
7628 if ((n > 1) == 2) @{ @dots{} @}
7630 This warning is enabled by @option{-Wall}.
7632 @item -Wbool-operation
7633 @opindex Wno-bool-operation
7634 @opindex Wbool-operation
7635 Warn about suspicious operations on expressions of a boolean type. For
7636 instance, bitwise negation of a boolean is very likely a bug in the program.
7637 For C, this warning also warns about incrementing or decrementing a boolean,
7638 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
7639 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
7641 This warning is enabled by @option{-Wall}.
7643 @item -Wduplicated-branches
7644 @opindex Wno-duplicated-branches
7645 @opindex Wduplicated-branches
7646 Warn when an if-else has identical branches. This warning detects cases like
7653 It doesn't warn when both branches contain just a null statement. This warning
7654 also warn for conditional operators:
7656 int i = x ? *p : *p;
7659 @item -Wduplicated-cond
7660 @opindex Wno-duplicated-cond
7661 @opindex Wduplicated-cond
7662 Warn about duplicated conditions in an if-else-if chain. For instance,
7663 warn for the following code:
7665 if (p->q != NULL) @{ @dots{} @}
7666 else if (p->q != NULL) @{ @dots{} @}
7669 @item -Wframe-address
7670 @opindex Wno-frame-address
7671 @opindex Wframe-address
7672 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
7673 is called with an argument greater than 0. Such calls may return indeterminate
7674 values or crash the program. The warning is included in @option{-Wall}.
7676 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
7677 @opindex Wno-discarded-qualifiers
7678 @opindex Wdiscarded-qualifiers
7679 Do not warn if type qualifiers on pointers are being discarded.
7680 Typically, the compiler warns if a @code{const char *} variable is
7681 passed to a function that takes a @code{char *} parameter. This option
7682 can be used to suppress such a warning.
7684 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
7685 @opindex Wno-discarded-array-qualifiers
7686 @opindex Wdiscarded-array-qualifiers
7687 Do not warn if type qualifiers on arrays which are pointer targets
7688 are being discarded. Typically, the compiler warns if a
7689 @code{const int (*)[]} variable is passed to a function that
7690 takes a @code{int (*)[]} parameter. This option can be used to
7691 suppress such a warning.
7693 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
7694 @opindex Wno-incompatible-pointer-types
7695 @opindex Wincompatible-pointer-types
7696 Do not warn when there is a conversion between pointers that have incompatible
7697 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
7698 which warns for pointer argument passing or assignment with different
7701 @item -Wno-int-conversion @r{(C and Objective-C only)}
7702 @opindex Wno-int-conversion
7703 @opindex Wint-conversion
7704 Do not warn about incompatible integer to pointer and pointer to integer
7705 conversions. This warning is about implicit conversions; for explicit
7706 conversions the warnings @option{-Wno-int-to-pointer-cast} and
7707 @option{-Wno-pointer-to-int-cast} may be used.
7709 @item -Wzero-length-bounds
7710 @opindex Wzero-length-bounds
7711 @opindex Wzero-length-bounds
7712 Warn about accesses to elements of zero-length array members that might
7713 overlap other members of the same object. Declaring interior zero-length
7714 arrays is discouraged because accesses to them are undefined. See
7717 For example, the first two stores in function @code{bad} are diagnosed
7718 because the array elements overlap the subsequent members @code{b} and
7719 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
7720 because it is beyond the bounds of the enclosing object.
7723 struct X @{ int a[0]; int b, c; @};
7728 x.a[0] = 0; // -Wzero-length-bounds
7729 x.a[1] = 1; // -Wzero-length-bounds
7730 x.a[2] = 2; // -Warray-bounds
7734 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
7736 @item -Wno-div-by-zero
7737 @opindex Wno-div-by-zero
7738 @opindex Wdiv-by-zero
7739 Do not warn about compile-time integer division by zero. Floating-point
7740 division by zero is not warned about, as it can be a legitimate way of
7741 obtaining infinities and NaNs.
7743 @item -Wsystem-headers
7744 @opindex Wsystem-headers
7745 @opindex Wno-system-headers
7746 @cindex warnings from system headers
7747 @cindex system headers, warnings from
7748 Print warning messages for constructs found in system header files.
7749 Warnings from system headers are normally suppressed, on the assumption
7750 that they usually do not indicate real problems and would only make the
7751 compiler output harder to read. Using this command-line option tells
7752 GCC to emit warnings from system headers as if they occurred in user
7753 code. However, note that using @option{-Wall} in conjunction with this
7754 option does @emph{not} warn about unknown pragmas in system
7755 headers---for that, @option{-Wunknown-pragmas} must also be used.
7757 @item -Wtautological-compare
7758 @opindex Wtautological-compare
7759 @opindex Wno-tautological-compare
7760 Warn if a self-comparison always evaluates to true or false. This
7761 warning detects various mistakes such as:
7765 if (i > i) @{ @dots{} @}
7768 This warning also warns about bitwise comparisons that always evaluate
7769 to true or false, for instance:
7771 if ((a & 16) == 10) @{ @dots{} @}
7773 will always be false.
7775 This warning is enabled by @option{-Wall}.
7778 @opindex Wtrampolines
7779 @opindex Wno-trampolines
7780 Warn about trampolines generated for pointers to nested functions.
7781 A trampoline is a small piece of data or code that is created at run
7782 time on the stack when the address of a nested function is taken, and is
7783 used to call the nested function indirectly. For some targets, it is
7784 made up of data only and thus requires no special treatment. But, for
7785 most targets, it is made up of code and thus requires the stack to be
7786 made executable in order for the program to work properly.
7789 @opindex Wfloat-equal
7790 @opindex Wno-float-equal
7791 Warn if floating-point values are used in equality comparisons.
7793 The idea behind this is that sometimes it is convenient (for the
7794 programmer) to consider floating-point values as approximations to
7795 infinitely precise real numbers. If you are doing this, then you need
7796 to compute (by analyzing the code, or in some other way) the maximum or
7797 likely maximum error that the computation introduces, and allow for it
7798 when performing comparisons (and when producing output, but that's a
7799 different problem). In particular, instead of testing for equality, you
7800 should check to see whether the two values have ranges that overlap; and
7801 this is done with the relational operators, so equality comparisons are
7804 @item -Wtraditional @r{(C and Objective-C only)}
7805 @opindex Wtraditional
7806 @opindex Wno-traditional
7807 Warn about certain constructs that behave differently in traditional and
7808 ISO C@. Also warn about ISO C constructs that have no traditional C
7809 equivalent, and/or problematic constructs that should be avoided.
7813 Macro parameters that appear within string literals in the macro body.
7814 In traditional C macro replacement takes place within string literals,
7815 but in ISO C it does not.
7818 In traditional C, some preprocessor directives did not exist.
7819 Traditional preprocessors only considered a line to be a directive
7820 if the @samp{#} appeared in column 1 on the line. Therefore
7821 @option{-Wtraditional} warns about directives that traditional C
7822 understands but ignores because the @samp{#} does not appear as the
7823 first character on the line. It also suggests you hide directives like
7824 @code{#pragma} not understood by traditional C by indenting them. Some
7825 traditional implementations do not recognize @code{#elif}, so this option
7826 suggests avoiding it altogether.
7829 A function-like macro that appears without arguments.
7832 The unary plus operator.
7835 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
7836 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
7837 constants.) Note, these suffixes appear in macros defined in the system
7838 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
7839 Use of these macros in user code might normally lead to spurious
7840 warnings, however GCC's integrated preprocessor has enough context to
7841 avoid warning in these cases.
7844 A function declared external in one block and then used after the end of
7848 A @code{switch} statement has an operand of type @code{long}.
7851 A non-@code{static} function declaration follows a @code{static} one.
7852 This construct is not accepted by some traditional C compilers.
7855 The ISO type of an integer constant has a different width or
7856 signedness from its traditional type. This warning is only issued if
7857 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
7858 typically represent bit patterns, are not warned about.
7861 Usage of ISO string concatenation is detected.
7864 Initialization of automatic aggregates.
7867 Identifier conflicts with labels. Traditional C lacks a separate
7868 namespace for labels.
7871 Initialization of unions. If the initializer is zero, the warning is
7872 omitted. This is done under the assumption that the zero initializer in
7873 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7874 initializer warnings and relies on default initialization to zero in the
7878 Conversions by prototypes between fixed/floating-point values and vice
7879 versa. The absence of these prototypes when compiling with traditional
7880 C causes serious problems. This is a subset of the possible
7881 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7884 Use of ISO C style function definitions. This warning intentionally is
7885 @emph{not} issued for prototype declarations or variadic functions
7886 because these ISO C features appear in your code when using
7887 libiberty's traditional C compatibility macros, @code{PARAMS} and
7888 @code{VPARAMS}. This warning is also bypassed for nested functions
7889 because that feature is already a GCC extension and thus not relevant to
7890 traditional C compatibility.
7893 @item -Wtraditional-conversion @r{(C and Objective-C only)}
7894 @opindex Wtraditional-conversion
7895 @opindex Wno-traditional-conversion
7896 Warn if a prototype causes a type conversion that is different from what
7897 would happen to the same argument in the absence of a prototype. This
7898 includes conversions of fixed point to floating and vice versa, and
7899 conversions changing the width or signedness of a fixed-point argument
7900 except when the same as the default promotion.
7902 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7903 @opindex Wdeclaration-after-statement
7904 @opindex Wno-declaration-after-statement
7905 Warn when a declaration is found after a statement in a block. This
7906 construct, known from C++, was introduced with ISO C99 and is by default
7907 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}.
7912 Warn whenever a local variable or type declaration shadows another
7913 variable, parameter, type, class member (in C++), or instance variable
7914 (in Objective-C) or whenever a built-in function is shadowed. Note
7915 that in C++, the compiler warns if a local variable shadows an
7916 explicit typedef, but not if it shadows a struct/class/enum.
7917 If this warning is enabled, it includes also all instances of
7918 local shadowing. This means that @option{-Wno-shadow=local}
7919 and @option{-Wno-shadow=compatible-local} are ignored when
7920 @option{-Wshadow} is used.
7921 Same as @option{-Wshadow=global}.
7923 @item -Wno-shadow-ivar @r{(Objective-C only)}
7924 @opindex Wno-shadow-ivar
7925 @opindex Wshadow-ivar
7926 Do not warn whenever a local variable shadows an instance variable in an
7929 @item -Wshadow=global
7930 @opindex Wshadow=global
7931 Warn for any shadowing.
7932 Same as @option{-Wshadow}.
7934 @item -Wshadow=local
7935 @opindex Wshadow=local
7936 Warn when a local variable shadows another local variable or parameter.
7938 @item -Wshadow=compatible-local
7939 @opindex Wshadow=compatible-local
7940 Warn when a local variable shadows another local variable or parameter
7941 whose type is compatible with that of the shadowing variable. In C++,
7942 type compatibility here means the type of the shadowing variable can be
7943 converted to that of the shadowed variable. The creation of this flag
7944 (in addition to @option{-Wshadow=local}) is based on the idea that when
7945 a local variable shadows another one of incompatible type, it is most
7946 likely intentional, not a bug or typo, as shown in the following example:
7950 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7952 for (int i = 0; i < N; ++i)
7961 Since the two variable @code{i} in the example above have incompatible types,
7962 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7963 Because their types are incompatible, if a programmer accidentally uses one
7964 in place of the other, type checking is expected to catch that and emit an
7965 error or warning. Use of this flag instead of @option{-Wshadow=local} can
7966 possibly reduce the number of warnings triggered by intentional shadowing.
7967 Note that this also means that shadowing @code{const char *i} by
7968 @code{char *i} does not emit a warning.
7970 This warning is also enabled by @option{-Wshadow=local}.
7972 @item -Wlarger-than=@var{byte-size}
7973 @opindex Wlarger-than=
7974 @opindex Wlarger-than-@var{byte-size}
7975 Warn whenever an object is defined whose size exceeds @var{byte-size}.
7976 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7977 Warnings controlled by the option can be disabled either by specifying
7978 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
7980 Also warn for calls to bounded functions such as @code{memchr} or
7981 @code{strnlen} that specify a bound greater than the largest possible
7982 object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings
7983 can only be disabled by @option{-Wno-larger-than}.
7985 @item -Wno-larger-than
7986 @opindex Wno-larger-than
7987 Disable @option{-Wlarger-than=} warnings. The option is equivalent
7988 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7990 @item -Wframe-larger-than=@var{byte-size}
7991 @opindex Wframe-larger-than=
7992 @opindex Wno-frame-larger-than
7993 Warn if the size of a function frame exceeds @var{byte-size}.
7994 The computation done to determine the stack frame size is approximate
7995 and not conservative.
7996 The actual requirements may be somewhat greater than @var{byte-size}
7997 even if you do not get a warning. In addition, any space allocated
7998 via @code{alloca}, variable-length arrays, or related constructs
7999 is not included by the compiler when determining
8000 whether or not to issue a warning.
8001 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8002 Warnings controlled by the option can be disabled either by specifying
8003 @var{byte-size} of @samp{SIZE_MAX} or more or by
8004 @option{-Wno-frame-larger-than}.
8006 @item -Wno-frame-larger-than
8007 @opindex Wno-frame-larger-than
8008 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
8009 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8011 @item -Wfree-nonheap-object
8012 @opindex Wfree-nonheap-object
8013 @opindex Wno-free-nonheap-object
8014 Warn when attempting to deallocate an object that was either not allocated
8015 on the heap, or by using a pointer that was not returned from a prior call
8016 to the corresponding allocation function. For example, because the call
8017 to @code{stpcpy} returns a pointer to the terminating nul character and
8018 not to the begginning of the object, the call to @code{free} below is
8024 p = stpcpy (p, "abc");
8026 free (p); // warning
8030 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8032 @item -Wstack-usage=@var{byte-size}
8033 @opindex Wstack-usage
8034 @opindex Wno-stack-usage
8035 Warn if the stack usage of a function might exceed @var{byte-size}.
8036 The computation done to determine the stack usage is conservative.
8037 Any space allocated via @code{alloca}, variable-length arrays, or related
8038 constructs is included by the compiler when determining whether or not to
8041 The message is in keeping with the output of @option{-fstack-usage}.
8045 If the stack usage is fully static but exceeds the specified amount, it's:
8048 warning: stack usage is 1120 bytes
8051 If the stack usage is (partly) dynamic but bounded, it's:
8054 warning: stack usage might be 1648 bytes
8057 If the stack usage is (partly) dynamic and not bounded, it's:
8060 warning: stack usage might be unbounded
8064 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8065 Warnings controlled by the option can be disabled either by specifying
8066 @var{byte-size} of @samp{SIZE_MAX} or more or by
8067 @option{-Wno-stack-usage}.
8069 @item -Wno-stack-usage
8070 @opindex Wno-stack-usage
8071 Disable @option{-Wstack-usage=} warnings. The option is equivalent
8072 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8074 @item -Wunsafe-loop-optimizations
8075 @opindex Wunsafe-loop-optimizations
8076 @opindex Wno-unsafe-loop-optimizations
8077 Warn if the loop cannot be optimized because the compiler cannot
8078 assume anything on the bounds of the loop indices. With
8079 @option{-funsafe-loop-optimizations} warn if the compiler makes
8082 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8083 @opindex Wno-pedantic-ms-format
8084 @opindex Wpedantic-ms-format
8085 When used in combination with @option{-Wformat}
8086 and @option{-pedantic} without GNU extensions, this option
8087 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8088 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8089 which depend on the MS runtime.
8091 @item -Wpointer-arith
8092 @opindex Wpointer-arith
8093 @opindex Wno-pointer-arith
8094 Warn about anything that depends on the ``size of'' a function type or
8095 of @code{void}. GNU C assigns these types a size of 1, for
8096 convenience in calculations with @code{void *} pointers and pointers
8097 to functions. In C++, warn also when an arithmetic operation involves
8098 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
8100 @item -Wno-pointer-compare
8101 @opindex Wpointer-compare
8102 @opindex Wno-pointer-compare
8103 Do not warn if a pointer is compared with a zero character constant.
8105 means that the pointer was meant to be dereferenced. For example:
8108 const char *p = foo ();
8113 Note that the code above is invalid in C++11.
8115 This warning is enabled by default.
8120 Warn about unsupported features in ThreadSanitizer.
8122 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8123 can report false positives.
8125 This warning is enabled by default.
8128 @opindex Wtype-limits
8129 @opindex Wno-type-limits
8130 Warn if a comparison is always true or always false due to the limited
8131 range of the data type, but do not warn for constant expressions. For
8132 example, warn if an unsigned variable is compared against zero with
8133 @code{<} or @code{>=}. This warning is also enabled by
8136 @item -Wabsolute-value @r{(C and Objective-C only)}
8137 @opindex Wabsolute-value
8138 @opindex Wno-absolute-value
8139 Warn for calls to standard functions that compute the absolute value
8140 of an argument when a more appropriate standard function is available.
8141 For example, calling @code{abs(3.14)} triggers the warning because the
8142 appropriate function to call to compute the absolute value of a double
8143 argument is @code{fabs}. The option also triggers warnings when the
8144 argument in a call to such a function has an unsigned type. This
8145 warning can be suppressed with an explicit type cast and it is also
8146 enabled by @option{-Wextra}.
8148 @include cppwarnopts.texi
8150 @item -Wbad-function-cast @r{(C and Objective-C only)}
8151 @opindex Wbad-function-cast
8152 @opindex Wno-bad-function-cast
8153 Warn when a function call is cast to a non-matching type.
8154 For example, warn if a call to a function returning an integer type
8155 is cast to a pointer type.
8157 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8158 @opindex Wc90-c99-compat
8159 @opindex Wno-c90-c99-compat
8160 Warn about features not present in ISO C90, but present in ISO C99.
8161 For instance, warn about use of variable length arrays, @code{long long}
8162 type, @code{bool} type, compound literals, designated initializers, and so
8163 on. This option is independent of the standards mode. Warnings are disabled
8164 in the expression that follows @code{__extension__}.
8166 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8167 @opindex Wc99-c11-compat
8168 @opindex Wno-c99-c11-compat
8169 Warn about features not present in ISO C99, but present in ISO C11.
8170 For instance, warn about use of anonymous structures and unions,
8171 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8172 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8173 and so on. This option is independent of the standards mode. Warnings are
8174 disabled in the expression that follows @code{__extension__}.
8176 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8177 @opindex Wc11-c2x-compat
8178 @opindex Wno-c11-c2x-compat
8179 Warn about features not present in ISO C11, but present in ISO C2X.
8180 For instance, warn about omitting the string in @code{_Static_assert},
8181 use of @samp{[[]]} syntax for attributes, use of decimal
8182 floating-point types, and so on. This option is independent of the
8183 standards mode. Warnings are disabled in the expression that follows
8184 @code{__extension__}.
8186 @item -Wc++-compat @r{(C and Objective-C only)}
8187 @opindex Wc++-compat
8188 @opindex Wno-c++-compat
8189 Warn about ISO C constructs that are outside of the common subset of
8190 ISO C and ISO C++, e.g.@: request for implicit conversion from
8191 @code{void *} to a pointer to non-@code{void} type.
8193 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8194 @opindex Wc++11-compat
8195 @opindex Wno-c++11-compat
8196 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8197 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8198 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
8199 enabled by @option{-Wall}.
8201 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8202 @opindex Wc++14-compat
8203 @opindex Wno-c++14-compat
8204 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8205 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
8207 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8208 @opindex Wc++17-compat
8209 @opindex Wno-c++17-compat
8210 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8211 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
8213 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8214 @opindex Wc++20-compat
8215 @opindex Wno-c++20-compat
8216 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8217 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
8219 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8220 @opindex Wc++11-extensions
8221 @opindex Wno-c++11-extensions
8222 Do not warn about C++11 constructs in code being compiled using
8223 an older C++ standard. Even without this option, some C++11 constructs
8224 will only be diagnosed if @option{-Wpedantic} is used.
8226 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8227 @opindex Wc++14-extensions
8228 @opindex Wno-c++14-extensions
8229 Do not warn about C++14 constructs in code being compiled using
8230 an older C++ standard. Even without this option, some C++14 constructs
8231 will only be diagnosed if @option{-Wpedantic} is used.
8233 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8234 @opindex Wc++17-extensions
8235 @opindex Wno-c++17-extensions
8236 Do not warn about C++17 constructs in code being compiled using
8237 an older C++ standard. Even without this option, some C++17 constructs
8238 will only be diagnosed if @option{-Wpedantic} is used.
8240 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8241 @opindex Wc++20-extensions
8242 @opindex Wno-c++20-extensions
8243 Do not warn about C++20 constructs in code being compiled using
8244 an older C++ standard. Even without this option, some C++20 constructs
8245 will only be diagnosed if @option{-Wpedantic} is used.
8247 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8248 @opindex Wc++23-extensions
8249 @opindex Wno-c++23-extensions
8250 Do not warn about C++23 constructs in code being compiled using
8251 an older C++ standard. Even without this option, some C++23 constructs
8252 will only be diagnosed if @option{-Wpedantic} is used.
8256 @opindex Wno-cast-qual
8257 Warn whenever a pointer is cast so as to remove a type qualifier from
8258 the target type. For example, warn if a @code{const char *} is cast
8259 to an ordinary @code{char *}.
8261 Also warn when making a cast that introduces a type qualifier in an
8262 unsafe way. For example, casting @code{char **} to @code{const char **}
8263 is unsafe, as in this example:
8266 /* p is char ** value. */
8267 const char **q = (const char **) p;
8268 /* Assignment of readonly string to const char * is OK. */
8270 /* Now char** pointer points to read-only memory. */
8275 @opindex Wcast-align
8276 @opindex Wno-cast-align
8277 Warn whenever a pointer is cast such that the required alignment of the
8278 target is increased. For example, warn if a @code{char *} is cast to
8279 an @code{int *} on machines where integers can only be accessed at
8280 two- or four-byte boundaries.
8282 @item -Wcast-align=strict
8283 @opindex Wcast-align=strict
8284 Warn whenever a pointer is cast such that the required alignment of the
8285 target is increased. For example, warn if a @code{char *} is cast to
8286 an @code{int *} regardless of the target machine.
8288 @item -Wcast-function-type
8289 @opindex Wcast-function-type
8290 @opindex Wno-cast-function-type
8291 Warn when a function pointer is cast to an incompatible function pointer.
8292 In a cast involving function types with a variable argument list only
8293 the types of initial arguments that are provided are considered.
8294 Any parameter of pointer-type matches any other pointer-type. Any benign
8295 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8296 on ILP32 targets. Likewise type qualifiers are ignored. The function
8297 type @code{void (*) (void)} is special and matches everything, which can
8298 be used to suppress this warning.
8299 In a cast involving pointer to member types this warning warns whenever
8300 the type cast is changing the pointer to member type.
8301 This warning is enabled by @option{-Wextra}.
8303 @item -Wwrite-strings
8304 @opindex Wwrite-strings
8305 @opindex Wno-write-strings
8306 When compiling C, give string constants the type @code{const
8307 char[@var{length}]} so that copying the address of one into a
8308 non-@code{const} @code{char *} pointer produces a warning. These
8309 warnings help you find at compile time code that can try to write
8310 into a string constant, but only if you have been very careful about
8311 using @code{const} in declarations and prototypes. Otherwise, it is
8312 just a nuisance. This is why we did not make @option{-Wall} request
8315 When compiling C++, warn about the deprecated conversion from string
8316 literals to @code{char *}. This warning is enabled by default for C++
8321 @opindex Wno-clobbered
8322 Warn for variables that might be changed by @code{longjmp} or
8323 @code{vfork}. This warning is also enabled by @option{-Wextra}.
8326 @opindex Wconversion
8327 @opindex Wno-conversion
8328 Warn for implicit conversions that may alter a value. This includes
8329 conversions between real and integer, like @code{abs (x)} when
8330 @code{x} is @code{double}; conversions between signed and unsigned,
8331 like @code{unsigned ui = -1}; and conversions to smaller types, like
8332 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8333 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8334 changed by the conversion like in @code{abs (2.0)}. Warnings about
8335 conversions between signed and unsigned integers can be disabled by
8336 using @option{-Wno-sign-conversion}.
8338 For C++, also warn for confusing overload resolution for user-defined
8339 conversions; and conversions that never use a type conversion
8340 operator: conversions to @code{void}, the same type, a base class or a
8341 reference to them. Warnings about conversions between signed and
8342 unsigned integers are disabled by default in C++ unless
8343 @option{-Wsign-conversion} is explicitly enabled.
8345 Warnings about conversion from arithmetic on a small type back to that
8346 type are only given with @option{-Warith-conversion}.
8348 @item -Wdangling-else
8349 @opindex Wdangling-else
8350 @opindex Wno-dangling-else
8351 Warn about constructions where there may be confusion to which
8352 @code{if} statement an @code{else} branch belongs. Here is an example of
8367 In C/C++, every @code{else} branch belongs to the innermost possible
8368 @code{if} statement, which in this example is @code{if (b)}. This is
8369 often not what the programmer expected, as illustrated in the above
8370 example by indentation the programmer chose. When there is the
8371 potential for this confusion, GCC issues a warning when this flag
8372 is specified. To eliminate the warning, add explicit braces around
8373 the innermost @code{if} statement so there is no way the @code{else}
8374 can belong to the enclosing @code{if}. The resulting code
8391 This warning is enabled by @option{-Wparentheses}.
8395 @opindex Wno-date-time
8396 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
8397 are encountered as they might prevent bit-wise-identical reproducible
8401 @opindex Wempty-body
8402 @opindex Wno-empty-body
8403 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
8404 while} statement. This warning is also enabled by @option{-Wextra}.
8406 @item -Wno-endif-labels
8407 @opindex Wendif-labels
8408 @opindex Wno-endif-labels
8409 Do not warn about stray tokens after @code{#else} and @code{#endif}.
8411 @item -Wenum-compare
8412 @opindex Wenum-compare
8413 @opindex Wno-enum-compare
8414 Warn about a comparison between values of different enumerated types.
8415 In C++ enumerated type mismatches in conditional expressions are also
8416 diagnosed and the warning is enabled by default. In C this warning is
8417 enabled by @option{-Wall}.
8419 @item -Wenum-conversion
8420 @opindex Wenum-conversion
8421 @opindex Wno-enum-conversion
8422 Warn when a value of enumerated type is implicitly converted to a
8423 different enumerated type. This warning is enabled by @option{-Wextra}
8426 @item -Wjump-misses-init @r{(C, Objective-C only)}
8427 @opindex Wjump-misses-init
8428 @opindex Wno-jump-misses-init
8429 Warn if a @code{goto} statement or a @code{switch} statement jumps
8430 forward across the initialization of a variable, or jumps backward to a
8431 label after the variable has been initialized. This only warns about
8432 variables that are initialized when they are declared. This warning is
8433 only supported for C and Objective-C; in C++ this sort of branch is an
8436 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
8437 can be disabled with the @option{-Wno-jump-misses-init} option.
8439 @item -Wsign-compare
8440 @opindex Wsign-compare
8441 @opindex Wno-sign-compare
8442 @cindex warning for comparison of signed and unsigned values
8443 @cindex comparison of signed and unsigned values, warning
8444 @cindex signed and unsigned values, comparison warning
8445 Warn when a comparison between signed and unsigned values could produce
8446 an incorrect result when the signed value is converted to unsigned.
8447 In C++, this warning is also enabled by @option{-Wall}. In C, it is
8448 also enabled by @option{-Wextra}.
8450 @item -Wsign-conversion
8451 @opindex Wsign-conversion
8452 @opindex Wno-sign-conversion
8453 Warn for implicit conversions that may change the sign of an integer
8454 value, like assigning a signed integer expression to an unsigned
8455 integer variable. An explicit cast silences the warning. In C, this
8456 option is enabled also by @option{-Wconversion}.
8458 @item -Wfloat-conversion
8459 @opindex Wfloat-conversion
8460 @opindex Wno-float-conversion
8461 Warn for implicit conversions that reduce the precision of a real value.
8462 This includes conversions from real to integer, and from higher precision
8463 real to lower precision real values. This option is also enabled by
8464 @option{-Wconversion}.
8466 @item -Wno-scalar-storage-order
8467 @opindex Wno-scalar-storage-order
8468 @opindex Wscalar-storage-order
8469 Do not warn on suspicious constructs involving reverse scalar storage order.
8471 @item -Wsizeof-array-div
8472 @opindex Wsizeof-array-div
8473 @opindex Wno-sizeof-array-div
8474 Warn about divisions of two sizeof operators when the first one is applied
8475 to an array and the divisor does not equal the size of the array element.
8476 In such a case, the computation will not yield the number of elements in the
8477 array, which is likely what the user intended. This warning warns e.g. about
8482 return sizeof (arr) / sizeof (short);
8486 This warning is enabled by @option{-Wall}.
8488 @item -Wsizeof-pointer-div
8489 @opindex Wsizeof-pointer-div
8490 @opindex Wno-sizeof-pointer-div
8491 Warn for suspicious divisions of two sizeof expressions that divide
8492 the pointer size by the element size, which is the usual way to compute
8493 the array size but won't work out correctly with pointers. This warning
8494 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
8495 not an array, but a pointer. This warning is enabled by @option{-Wall}.
8497 @item -Wsizeof-pointer-memaccess
8498 @opindex Wsizeof-pointer-memaccess
8499 @opindex Wno-sizeof-pointer-memaccess
8500 Warn for suspicious length parameters to certain string and memory built-in
8501 functions if the argument uses @code{sizeof}. This warning triggers for
8502 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
8503 an array, but a pointer, and suggests a possible fix, or about
8504 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
8505 also warns about calls to bounded string copy functions like @code{strncat}
8506 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
8507 the source array. For example, in the following function the call to
8508 @code{strncat} specifies the size of the source string as the bound. That
8509 is almost certainly a mistake and so the call is diagnosed.
8511 void make_file (const char *name)
8513 char path[PATH_MAX];
8514 strncpy (path, name, sizeof path - 1);
8515 strncat (path, ".text", sizeof ".text");
8520 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
8522 @item -Wno-sizeof-array-argument
8523 @opindex Wsizeof-array-argument
8524 @opindex Wno-sizeof-array-argument
8525 Do not warn when the @code{sizeof} operator is applied to a parameter that is
8526 declared as an array in a function definition. This warning is enabled by
8527 default for C and C++ programs.
8529 @item -Wmemset-elt-size
8530 @opindex Wmemset-elt-size
8531 @opindex Wno-memset-elt-size
8532 Warn for suspicious calls to the @code{memset} built-in function, if the
8533 first argument references an array, and the third argument is a number
8534 equal to the number of elements, but not equal to the size of the array
8535 in memory. This indicates that the user has omitted a multiplication by
8536 the element size. This warning is enabled by @option{-Wall}.
8538 @item -Wmemset-transposed-args
8539 @opindex Wmemset-transposed-args
8540 @opindex Wno-memset-transposed-args
8541 Warn for suspicious calls to the @code{memset} built-in function where
8542 the second argument is not zero and the third argument is zero. For
8543 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
8544 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
8545 is only emitted if the third argument is a literal zero. Otherwise, if
8546 it is an expression that is folded to zero, or a cast of zero to some
8547 type, it is far less likely that the arguments have been mistakenly
8548 transposed and no warning is emitted. This warning is enabled
8553 @opindex Wno-address
8554 Warn about suspicious uses of memory addresses. These include using
8555 the address of a function in a conditional expression, such as
8556 @code{void func(void); if (func)}, and comparisons against the memory
8557 address of a string literal, such as @code{if (x == "abc")}. Such
8558 uses typically indicate a programmer error: the address of a function
8559 always evaluates to true, so their use in a conditional usually
8560 indicate that the programmer forgot the parentheses in a function
8561 call; and comparisons against string literals result in unspecified
8562 behavior and are not portable in C, so they usually indicate that the
8563 programmer intended to use @code{strcmp}. This warning is enabled by
8566 @item -Wno-address-of-packed-member
8567 @opindex Waddress-of-packed-member
8568 @opindex Wno-address-of-packed-member
8569 Do not warn when the address of packed member of struct or union is taken,
8570 which usually results in an unaligned pointer value. This is
8574 @opindex Wlogical-op
8575 @opindex Wno-logical-op
8576 Warn about suspicious uses of logical operators in expressions.
8577 This includes using logical operators in contexts where a
8578 bit-wise operator is likely to be expected. Also warns when
8579 the operands of a logical operator are the same:
8582 if (a < 0 && a < 0) @{ @dots{} @}
8585 @item -Wlogical-not-parentheses
8586 @opindex Wlogical-not-parentheses
8587 @opindex Wno-logical-not-parentheses
8588 Warn about logical not used on the left hand side operand of a comparison.
8589 This option does not warn if the right operand is considered to be a boolean
8590 expression. Its purpose is to detect suspicious code like the following:
8594 if (!a > 1) @{ @dots{} @}
8597 It is possible to suppress the warning by wrapping the LHS into
8600 if ((!a) > 1) @{ @dots{} @}
8603 This warning is enabled by @option{-Wall}.
8605 @item -Waggregate-return
8606 @opindex Waggregate-return
8607 @opindex Wno-aggregate-return
8608 Warn if any functions that return structures or unions are defined or
8609 called. (In languages where you can return an array, this also elicits
8612 @item -Wno-aggressive-loop-optimizations
8613 @opindex Wno-aggressive-loop-optimizations
8614 @opindex Waggressive-loop-optimizations
8615 Warn if in a loop with constant number of iterations the compiler detects
8616 undefined behavior in some statement during one or more of the iterations.
8618 @item -Wno-attributes
8619 @opindex Wno-attributes
8620 @opindex Wattributes
8621 Do not warn if an unexpected @code{__attribute__} is used, such as
8622 unrecognized attributes, function attributes applied to variables,
8623 etc. This does not stop errors for incorrect use of supported
8626 @item -Wno-builtin-declaration-mismatch
8627 @opindex Wno-builtin-declaration-mismatch
8628 @opindex Wbuiltin-declaration-mismatch
8629 Warn if a built-in function is declared with an incompatible signature
8630 or as a non-function, or when a built-in function declared with a type
8631 that does not include a prototype is called with arguments whose promoted
8632 types do not match those expected by the function. When @option{-Wextra}
8633 is specified, also warn when a built-in function that takes arguments is
8634 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
8635 warning is enabled by default. To avoid the warning include the appropriate
8636 header to bring the prototypes of built-in functions into scope.
8638 For example, the call to @code{memset} below is diagnosed by the warning
8639 because the function expects a value of type @code{size_t} as its argument
8640 but the type of @code{32} is @code{int}. With @option{-Wextra},
8641 the declaration of the function is diagnosed as well.
8643 extern void* memset ();
8646 memset (d, '\0', 32);
8650 @item -Wno-builtin-macro-redefined
8651 @opindex Wno-builtin-macro-redefined
8652 @opindex Wbuiltin-macro-redefined
8653 Do not warn if certain built-in macros are redefined. This suppresses
8654 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
8655 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
8657 @item -Wstrict-prototypes @r{(C and Objective-C only)}
8658 @opindex Wstrict-prototypes
8659 @opindex Wno-strict-prototypes
8660 Warn if a function is declared or defined without specifying the
8661 argument types. (An old-style function definition is permitted without
8662 a warning if preceded by a declaration that specifies the argument
8665 @item -Wold-style-declaration @r{(C and Objective-C only)}
8666 @opindex Wold-style-declaration
8667 @opindex Wno-old-style-declaration
8668 Warn for obsolescent usages, according to the C Standard, in a
8669 declaration. For example, warn if storage-class specifiers like
8670 @code{static} are not the first things in a declaration. This warning
8671 is also enabled by @option{-Wextra}.
8673 @item -Wold-style-definition @r{(C and Objective-C only)}
8674 @opindex Wold-style-definition
8675 @opindex Wno-old-style-definition
8676 Warn if an old-style function definition is used. A warning is given
8677 even if there is a previous prototype. A definition using @samp{()}
8678 is not considered an old-style definition in C2X mode, because it is
8679 equivalent to @samp{(void)} in that case, but is considered an
8680 old-style definition for older standards.
8682 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
8683 @opindex Wmissing-parameter-type
8684 @opindex Wno-missing-parameter-type
8685 A function parameter is declared without a type specifier in K&R-style
8692 This warning is also enabled by @option{-Wextra}.
8694 @item -Wmissing-prototypes @r{(C and Objective-C only)}
8695 @opindex Wmissing-prototypes
8696 @opindex Wno-missing-prototypes
8697 Warn if a global function is defined without a previous prototype
8698 declaration. This warning is issued even if the definition itself
8699 provides a prototype. Use this option to detect global functions
8700 that do not have a matching prototype declaration in a header file.
8701 This option is not valid for C++ because all function declarations
8702 provide prototypes and a non-matching declaration declares an
8703 overload rather than conflict with an earlier declaration.
8704 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
8706 @item -Wmissing-declarations
8707 @opindex Wmissing-declarations
8708 @opindex Wno-missing-declarations
8709 Warn if a global function is defined without a previous declaration.
8710 Do so even if the definition itself provides a prototype.
8711 Use this option to detect global functions that are not declared in
8712 header files. In C, no warnings are issued for functions with previous
8713 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
8714 missing prototypes. In C++, no warnings are issued for function templates,
8715 or for inline functions, or for functions in anonymous namespaces.
8717 @item -Wmissing-field-initializers
8718 @opindex Wmissing-field-initializers
8719 @opindex Wno-missing-field-initializers
8723 Warn if a structure's initializer has some fields missing. For
8724 example, the following code causes such a warning, because
8725 @code{x.h} is implicitly zero:
8728 struct s @{ int f, g, h; @};
8729 struct s x = @{ 3, 4 @};
8732 This option does not warn about designated initializers, so the following
8733 modification does not trigger a warning:
8736 struct s @{ int f, g, h; @};
8737 struct s x = @{ .f = 3, .g = 4 @};
8740 In C this option does not warn about the universal zero initializer
8744 struct s @{ int f, g, h; @};
8745 struct s x = @{ 0 @};
8748 Likewise, in C++ this option does not warn about the empty @{ @}
8749 initializer, for example:
8752 struct s @{ int f, g, h; @};
8756 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
8757 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
8759 @item -Wno-missing-requires
8760 @opindex Wmissing-requires
8761 @opindex Wno-missing-requires
8763 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
8766 bool satisfied = requires @{ C<T> @};
8769 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
8770 expression, which it is for all T. Presumably the user meant to write
8773 bool satisfied = requires @{ requires C<T> @};
8776 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
8779 This warning can be disabled with @option{-Wno-missing-requires}.
8781 @item -Wno-multichar
8782 @opindex Wno-multichar
8784 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
8785 Usually they indicate a typo in the user's code, as they have
8786 implementation-defined values, and should not be used in portable code.
8788 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
8789 @opindex Wnormalized=
8790 @opindex Wnormalized
8791 @opindex Wno-normalized
8794 @cindex character set, input normalization
8795 In ISO C and ISO C++, two identifiers are different if they are
8796 different sequences of characters. However, sometimes when characters
8797 outside the basic ASCII character set are used, you can have two
8798 different character sequences that look the same. To avoid confusion,
8799 the ISO 10646 standard sets out some @dfn{normalization rules} which
8800 when applied ensure that two sequences that look the same are turned into
8801 the same sequence. GCC can warn you if you are using identifiers that
8802 have not been normalized; this option controls that warning.
8804 There are four levels of warning supported by GCC@. The default is
8805 @option{-Wnormalized=nfc}, which warns about any identifier that is
8806 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
8807 recommended form for most uses. It is equivalent to
8808 @option{-Wnormalized}.
8810 Unfortunately, there are some characters allowed in identifiers by
8811 ISO C and ISO C++ that, when turned into NFC, are not allowed in
8812 identifiers. That is, there's no way to use these symbols in portable
8813 ISO C or C++ and have all your identifiers in NFC@.
8814 @option{-Wnormalized=id} suppresses the warning for these characters.
8815 It is hoped that future versions of the standards involved will correct
8816 this, which is why this option is not the default.
8818 You can switch the warning off for all characters by writing
8819 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
8820 only do this if you are using some other normalization scheme (like
8821 ``D''), because otherwise you can easily create bugs that are
8822 literally impossible to see.
8824 Some characters in ISO 10646 have distinct meanings but look identical
8825 in some fonts or display methodologies, especially once formatting has
8826 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
8827 LETTER N'', displays just like a regular @code{n} that has been
8828 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
8829 normalization scheme to convert all these into a standard form as
8830 well, and GCC warns if your code is not in NFKC if you use
8831 @option{-Wnormalized=nfkc}. This warning is comparable to warning
8832 about every identifier that contains the letter O because it might be
8833 confused with the digit 0, and so is not the default, but may be
8834 useful as a local coding convention if the programming environment
8835 cannot be fixed to display these characters distinctly.
8837 @item -Wno-attribute-warning
8838 @opindex Wno-attribute-warning
8839 @opindex Wattribute-warning
8840 Do not warn about usage of functions (@pxref{Function Attributes})
8841 declared with @code{warning} attribute. By default, this warning is
8842 enabled. @option{-Wno-attribute-warning} can be used to disable the
8843 warning or @option{-Wno-error=attribute-warning} can be used to
8844 disable the error when compiled with @option{-Werror} flag.
8846 @item -Wno-deprecated
8847 @opindex Wno-deprecated
8848 @opindex Wdeprecated
8849 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
8851 @item -Wno-deprecated-declarations
8852 @opindex Wno-deprecated-declarations
8853 @opindex Wdeprecated-declarations
8854 Do not warn about uses of functions (@pxref{Function Attributes}),
8855 variables (@pxref{Variable Attributes}), and types (@pxref{Type
8856 Attributes}) marked as deprecated by using the @code{deprecated}
8860 @opindex Wno-overflow
8862 Do not warn about compile-time overflow in constant expressions.
8867 Warn about One Definition Rule violations during link-time optimization.
8870 @item -Wopenacc-parallelism
8871 @opindex Wopenacc-parallelism
8872 @opindex Wno-openacc-parallelism
8873 @cindex OpenACC accelerator programming
8874 Warn about potentially suboptimal choices related to OpenACC parallelism.
8877 @opindex Wopenmp-simd
8878 @opindex Wno-openmp-simd
8879 Warn if the vectorizer cost model overrides the OpenMP
8880 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
8881 option can be used to relax the cost model.
8883 @item -Woverride-init @r{(C and Objective-C only)}
8884 @opindex Woverride-init
8885 @opindex Wno-override-init
8889 Warn if an initialized field without side effects is overridden when
8890 using designated initializers (@pxref{Designated Inits, , Designated
8893 This warning is included in @option{-Wextra}. To get other
8894 @option{-Wextra} warnings without this one, use @option{-Wextra
8895 -Wno-override-init}.
8897 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
8898 @opindex Woverride-init-side-effects
8899 @opindex Wno-override-init-side-effects
8900 Do not warn if an initialized field with side effects is overridden when
8901 using designated initializers (@pxref{Designated Inits, , Designated
8902 Initializers}). This warning is enabled by default.
8907 Warn if a structure is given the packed attribute, but the packed
8908 attribute has no effect on the layout or size of the structure.
8909 Such structures may be mis-aligned for little benefit. For
8910 instance, in this code, the variable @code{f.x} in @code{struct bar}
8911 is misaligned even though @code{struct bar} does not itself
8912 have the packed attribute:
8919 @} __attribute__((packed));
8927 @item -Wnopacked-bitfield-compat
8928 @opindex Wpacked-bitfield-compat
8929 @opindex Wno-packed-bitfield-compat
8930 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
8931 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
8932 the change can lead to differences in the structure layout. GCC
8933 informs you when the offset of such a field has changed in GCC 4.4.
8934 For example there is no longer a 4-bit padding between field @code{a}
8935 and @code{b} in this structure:
8942 @} __attribute__ ((packed));
8945 This warning is enabled by default. Use
8946 @option{-Wno-packed-bitfield-compat} to disable this warning.
8948 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
8949 @opindex Wpacked-not-aligned
8950 @opindex Wno-packed-not-aligned
8951 Warn if a structure field with explicitly specified alignment in a
8952 packed struct or union is misaligned. For example, a warning will
8953 be issued on @code{struct S}, like, @code{warning: alignment 1 of
8954 'struct S' is less than 8}, in this code:
8958 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
8959 struct __attribute__ ((packed)) S @{
8965 This warning is enabled by @option{-Wall}.
8970 Warn if padding is included in a structure, either to align an element
8971 of the structure or to align the whole structure. Sometimes when this
8972 happens it is possible to rearrange the fields of the structure to
8973 reduce the padding and so make the structure smaller.
8975 @item -Wredundant-decls
8976 @opindex Wredundant-decls
8977 @opindex Wno-redundant-decls
8978 Warn if anything is declared more than once in the same scope, even in
8979 cases where multiple declaration is valid and changes nothing.
8983 @opindex Wno-restrict
8984 Warn when an object referenced by a @code{restrict}-qualified parameter
8985 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8986 argument, or when copies between such objects overlap. For example,
8987 the call to the @code{strcpy} function below attempts to truncate the string
8988 by replacing its initial characters with the last four. However, because
8989 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8990 the call is diagnosed.
8995 char a[] = "abcd1234";
9000 The @option{-Wrestrict} option detects some instances of simple overlap
9001 even without optimization but works best at @option{-O2} and above. It
9002 is included in @option{-Wall}.
9004 @item -Wnested-externs @r{(C and Objective-C only)}
9005 @opindex Wnested-externs
9006 @opindex Wno-nested-externs
9007 Warn if an @code{extern} declaration is encountered within a function.
9012 Warn if a function that is declared as inline cannot be inlined.
9013 Even with this option, the compiler does not warn about failures to
9014 inline functions declared in system headers.
9016 The compiler uses a variety of heuristics to determine whether or not
9017 to inline a function. For example, the compiler takes into account
9018 the size of the function being inlined and the amount of inlining
9019 that has already been done in the current function. Therefore,
9020 seemingly insignificant changes in the source program can cause the
9021 warnings produced by @option{-Winline} to appear or disappear.
9023 @item -Winterference-size
9024 @opindex Winterference-size
9025 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9026 without specifying its value with @option{--param destructive-interference-size}.
9027 Also warn about questionable values for that option.
9029 This variable is intended to be used for controlling class layout, to
9030 avoid false sharing in concurrent code:
9033 struct independent_fields @{
9034 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
9035 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
9039 Here @samp{one} and @samp{two} are intended to be far enough apart
9040 that stores to one won't require accesses to the other to reload the
9043 By default, @option{--param destructive-interference-size} and
9044 @option{--param constructive-interference-size} are set based on the
9045 current @option{-mtune} option, typically to the L1 cache line size
9046 for the particular target CPU, sometimes to a range if tuning for a
9047 generic target. So all translation units that depend on ABI
9048 compatibility for the use of these variables must be compiled with
9049 the same @option{-mtune} (or @option{-mcpu}).
9051 If ABI stability is important, such as if the use is in a header for a
9052 library, you should probably not use the hardware interference size
9053 variables at all. Alternatively, you can force a particular value
9054 with @option{--param}.
9056 If you are confident that your use of the variable does not affect ABI
9057 outside a single build of your project, you can turn off the warning
9058 with @option{-Wno-interference-size}.
9060 @item -Wint-in-bool-context
9061 @opindex Wint-in-bool-context
9062 @opindex Wno-int-in-bool-context
9063 Warn for suspicious use of integer values where boolean values are expected,
9064 such as conditional expressions (?:) using non-boolean integer constants in
9065 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
9066 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
9067 for all kinds of multiplications regardless of the data type.
9068 This warning is enabled by @option{-Wall}.
9070 @item -Wno-int-to-pointer-cast
9071 @opindex Wno-int-to-pointer-cast
9072 @opindex Wint-to-pointer-cast
9073 Suppress warnings from casts to pointer type of an integer of a
9074 different size. In C++, casting to a pointer type of smaller size is
9075 an error. @option{Wint-to-pointer-cast} is enabled by default.
9078 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9079 @opindex Wno-pointer-to-int-cast
9080 @opindex Wpointer-to-int-cast
9081 Suppress warnings from casts from a pointer to an integer type of a
9085 @opindex Winvalid-pch
9086 @opindex Wno-invalid-pch
9087 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9088 the search path but cannot be used.
9092 @opindex Wno-long-long
9093 Warn if @code{long long} type is used. This is enabled by either
9094 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9095 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
9097 @item -Wvariadic-macros
9098 @opindex Wvariadic-macros
9099 @opindex Wno-variadic-macros
9100 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9101 alternate syntax is used in ISO C99 mode. This is enabled by either
9102 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
9103 messages, use @option{-Wno-variadic-macros}.
9107 @opindex Wno-varargs
9108 Do not warn upon questionable usage of the macros used to handle variable
9109 arguments like @code{va_start}. These warnings are enabled by default.
9111 @item -Wvector-operation-performance
9112 @opindex Wvector-operation-performance
9113 @opindex Wno-vector-operation-performance
9114 Warn if vector operation is not implemented via SIMD capabilities of the
9115 architecture. Mainly useful for the performance tuning.
9116 Vector operation can be implemented @code{piecewise}, which means that the
9117 scalar operation is performed on every vector element;
9118 @code{in parallel}, which means that the vector operation is implemented
9119 using scalars of wider type, which normally is more performance efficient;
9120 and @code{as a single scalar}, which means that vector fits into a
9126 Warn if a variable-length array is used in the code.
9127 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9128 the variable-length array.
9130 @item -Wvla-larger-than=@var{byte-size}
9131 @opindex Wvla-larger-than=
9132 @opindex Wno-vla-larger-than
9133 If this option is used, the compiler warns for declarations of
9134 variable-length arrays whose size is either unbounded, or bounded
9135 by an argument that allows the array size to exceed @var{byte-size}
9136 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9137 works, but with variable-length arrays.
9139 Note that GCC may optimize small variable-length arrays of a known
9140 value into plain arrays, so this warning may not get triggered for
9143 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9144 is typically only effective when @option{-ftree-vrp} is active (default
9145 for @option{-O2} and above).
9147 See also @option{-Walloca-larger-than=@var{byte-size}}.
9149 @item -Wno-vla-larger-than
9150 @opindex Wno-vla-larger-than
9151 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
9152 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9154 @item -Wvla-parameter
9155 @opindex Wno-vla-parameter
9156 Warn about redeclarations of functions involving arguments of Variable
9157 Length Array types of inconsistent kinds or forms, and enable the detection
9158 of out-of-bounds accesses to such parameters by warnings such as
9159 @option{-Warray-bounds}.
9161 If the first function declaration uses the VLA form the bound specified
9162 in the array is assumed to be the minimum number of elements expected to
9163 be provided in calls to the function and the maximum number of elements
9164 accessed by it. Failing to provide arguments of sufficient size or
9165 accessing more than the maximum number of elements may be diagnosed.
9167 For example, the warning triggers for the following redeclarations because
9168 the first one allows an array of any size to be passed to @code{f} while
9169 the second one specifies that the array argument must have at least @code{n}
9170 elements. In addition, calling @code{f} with the assotiated VLA bound
9171 parameter in excess of the actual VLA bound triggers a warning as well.
9174 void f (int n, int[n]);
9175 void f (int, int[]); // warning: argument 2 previously declared as a VLA
9182 f (sizeof a, a); // warning: access to a by f may be out of bounds
9188 @option{-Wvla-parameter} is included in @option{-Wall}. The
9189 @option{-Warray-parameter} option triggers warnings for similar problems
9190 involving ordinary array arguments.
9192 @item -Wvolatile-register-var
9193 @opindex Wvolatile-register-var
9194 @opindex Wno-volatile-register-var
9195 Warn if a register variable is declared volatile. The volatile
9196 modifier does not inhibit all optimizations that may eliminate reads
9197 and/or writes to register variables. This warning is enabled by
9200 @item -Wdisabled-optimization
9201 @opindex Wdisabled-optimization
9202 @opindex Wno-disabled-optimization
9203 Warn if a requested optimization pass is disabled. This warning does
9204 not generally indicate that there is anything wrong with your code; it
9205 merely indicates that GCC's optimizers are unable to handle the code
9206 effectively. Often, the problem is that your code is too big or too
9207 complex; GCC refuses to optimize programs when the optimization
9208 itself is likely to take inordinate amounts of time.
9210 @item -Wpointer-sign @r{(C and Objective-C only)}
9211 @opindex Wpointer-sign
9212 @opindex Wno-pointer-sign
9213 Warn for pointer argument passing or assignment with different signedness.
9214 This option is only supported for C and Objective-C@. It is implied by
9215 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9216 @option{-Wno-pointer-sign}.
9218 @item -Wstack-protector
9219 @opindex Wstack-protector
9220 @opindex Wno-stack-protector
9221 This option is only active when @option{-fstack-protector} is active. It
9222 warns about functions that are not protected against stack smashing.
9224 @item -Woverlength-strings
9225 @opindex Woverlength-strings
9226 @opindex Wno-overlength-strings
9227 Warn about string constants that are longer than the ``minimum
9228 maximum'' length specified in the C standard. Modern compilers
9229 generally allow string constants that are much longer than the
9230 standard's minimum limit, but very portable programs should avoid
9231 using longer strings.
9233 The limit applies @emph{after} string constant concatenation, and does
9234 not count the trailing NUL@. In C90, the limit was 509 characters; in
9235 C99, it was raised to 4095. C++98 does not specify a normative
9236 minimum maximum, so we do not diagnose overlength strings in C++@.
9238 This option is implied by @option{-Wpedantic}, and can be disabled with
9239 @option{-Wno-overlength-strings}.
9241 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
9242 @opindex Wunsuffixed-float-constants
9243 @opindex Wno-unsuffixed-float-constants
9245 Issue a warning for any floating constant that does not have
9246 a suffix. When used together with @option{-Wsystem-headers} it
9247 warns about such constants in system header files. This can be useful
9248 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
9249 from the decimal floating-point extension to C99.
9251 @item -Wno-lto-type-mismatch
9252 @opindex Wlto-type-mismatch
9253 @opindex Wno-lto-type-mismatch
9255 During the link-time optimization, do not warn about type mismatches in
9256 global declarations from different compilation units.
9257 Requires @option{-flto} to be enabled. Enabled by default.
9259 @item -Wno-designated-init @r{(C and Objective-C only)}
9260 @opindex Wdesignated-init
9261 @opindex Wno-designated-init
9262 Suppress warnings when a positional initializer is used to initialize
9263 a structure that has been marked with the @code{designated_init}
9268 @node Static Analyzer Options
9269 @section Options That Control Static Analysis
9275 @opindex fno-analyzer
9276 This option enables an static analysis of program flow which looks
9277 for ``interesting'' interprocedural paths through the
9278 code, and issues warnings for problems found on them.
9280 This analysis is much more expensive than other GCC warnings.
9282 Enabling this option effectively enables the following warnings:
9285 -Wanalyzer-double-fclose @gol
9286 -Wanalyzer-double-free @gol
9287 -Wanalyzer-exposure-through-output-file @gol
9288 -Wanalyzer-file-leak @gol
9289 -Wanalyzer-free-of-non-heap @gol
9290 -Wanalyzer-malloc-leak @gol
9291 -Wanalyzer-mismatching-deallocation @gol
9292 -Wanalyzer-possible-null-argument @gol
9293 -Wanalyzer-possible-null-dereference @gol
9294 -Wanalyzer-null-argument @gol
9295 -Wanalyzer-null-dereference @gol
9296 -Wanalyzer-shift-count-negative @gol
9297 -Wanalyzer-shift-count-overflow @gol
9298 -Wanalyzer-stale-setjmp-buffer @gol
9299 -Wanalyzer-tainted-array-index @gol
9300 -Wanalyzer-unsafe-call-within-signal-handler @gol
9301 -Wanalyzer-use-after-free @gol
9302 -Wanalyzer-use-of-uninitialized-value @gol
9303 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
9304 -Wanalyzer-write-to-const @gol
9305 -Wanalyzer-write-to-string-literal @gol
9308 This option is only available if GCC was configured with analyzer
9311 @item -Wanalyzer-too-complex
9312 @opindex Wanalyzer-too-complex
9313 @opindex Wno-analyzer-too-complex
9314 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
9315 to attempt to explore the control flow and data flow in the program,
9316 but these can be defeated by sufficiently complicated code.
9318 By default, the analysis silently stops if the code is too
9319 complicated for the analyzer to fully explore and it reaches an internal
9320 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
9322 @item -Wno-analyzer-double-fclose
9323 @opindex Wanalyzer-double-fclose
9324 @opindex Wno-analyzer-double-fclose
9325 This warning requires @option{-fanalyzer}, which enables it; use
9326 @option{-Wno-analyzer-double-fclose} to disable it.
9328 This diagnostic warns for paths through the code in which a @code{FILE *}
9329 can have @code{fclose} called on it more than once.
9331 @item -Wno-analyzer-double-free
9332 @opindex Wanalyzer-double-free
9333 @opindex Wno-analyzer-double-free
9334 This warning requires @option{-fanalyzer}, which enables it; use
9335 @option{-Wno-analyzer-double-free} to disable it.
9337 This diagnostic warns for paths through the code in which a pointer
9338 can have a deallocator called on it more than once, either @code{free},
9339 or a deallocator referenced by attribute @code{malloc}.
9341 @item -Wno-analyzer-exposure-through-output-file
9342 @opindex Wanalyzer-exposure-through-output-file
9343 @opindex Wno-analyzer-exposure-through-output-file
9344 This warning requires @option{-fanalyzer}, which enables it; use
9345 @option{-Wno-analyzer-exposure-through-output-file}
9348 This diagnostic warns for paths through the code in which a
9349 security-sensitive value is written to an output file
9350 (such as writing a password to a log file).
9352 @item -Wno-analyzer-file-leak
9353 @opindex Wanalyzer-file-leak
9354 @opindex Wno-analyzer-file-leak
9355 This warning requires @option{-fanalyzer}, which enables it; use
9356 @option{-Wno-analyzer-file-leak}
9359 This diagnostic warns for paths through the code in which a
9360 @code{<stdio.h>} @code{FILE *} stream object is leaked.
9362 @item -Wno-analyzer-free-of-non-heap
9363 @opindex Wanalyzer-free-of-non-heap
9364 @opindex Wno-analyzer-free-of-non-heap
9365 This warning requires @option{-fanalyzer}, which enables it; use
9366 @option{-Wno-analyzer-free-of-non-heap}
9369 This diagnostic warns for paths through the code in which @code{free}
9370 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
9372 @item -Wno-analyzer-malloc-leak
9373 @opindex Wanalyzer-malloc-leak
9374 @opindex Wno-analyzer-malloc-leak
9375 This warning requires @option{-fanalyzer}, which enables it; use
9376 @option{-Wno-analyzer-malloc-leak}
9379 This diagnostic warns for paths through the code in which a
9380 pointer allocated via an allocator is leaked: either @code{malloc},
9381 or a function marked with attribute @code{malloc}.
9383 @item -Wno-analyzer-mismatching-deallocation
9384 @opindex Wanalyzer-mismatching-deallocation
9385 @opindex Wno-analyzer-mismatching-deallocation
9386 This warning requires @option{-fanalyzer}, which enables it; use
9387 @option{-Wno-analyzer-mismatching-deallocation}
9390 This diagnostic warns for paths through the code in which the
9391 wrong deallocation function is called on a pointer value, based on
9392 which function was used to allocate the pointer value. The diagnostic
9393 will warn about mismatches between @code{free}, scalar @code{delete}
9394 and vector @code{delete[]}, and those marked as allocator/deallocator
9395 pairs using attribute @code{malloc}.
9397 @item -Wno-analyzer-possible-null-argument
9398 @opindex Wanalyzer-possible-null-argument
9399 @opindex Wno-analyzer-possible-null-argument
9400 This warning requires @option{-fanalyzer}, which enables it; use
9401 @option{-Wno-analyzer-possible-null-argument} to disable it.
9403 This diagnostic warns for paths through the code in which a
9404 possibly-NULL value is passed to a function argument marked
9405 with @code{__attribute__((nonnull))} as requiring a non-NULL
9408 @item -Wno-analyzer-possible-null-dereference
9409 @opindex Wanalyzer-possible-null-dereference
9410 @opindex Wno-analyzer-possible-null-dereference
9411 This warning requires @option{-fanalyzer}, which enables it; use
9412 @option{-Wno-analyzer-possible-null-dereference} to disable it.
9414 This diagnostic warns for paths through the code in which a
9415 possibly-NULL value is dereferenced.
9417 @item -Wno-analyzer-null-argument
9418 @opindex Wanalyzer-null-argument
9419 @opindex Wno-analyzer-null-argument
9420 This warning requires @option{-fanalyzer}, which enables it; use
9421 @option{-Wno-analyzer-null-argument} to disable it.
9423 This diagnostic warns for paths through the code in which a
9424 value known to be NULL is passed to a function argument marked
9425 with @code{__attribute__((nonnull))} as requiring a non-NULL
9428 @item -Wno-analyzer-null-dereference
9429 @opindex Wanalyzer-null-dereference
9430 @opindex Wno-analyzer-null-dereference
9431 This warning requires @option{-fanalyzer}, which enables it; use
9432 @option{-Wno-analyzer-null-dereference} to disable it.
9434 This diagnostic warns for paths through the code in which a
9435 value known to be NULL is dereferenced.
9437 @item -Wno-analyzer-shift-count-negative
9438 @opindex Wanalyzer-shift-count-negative
9439 @opindex Wno-analyzer-shift-count-negative
9440 This warning requires @option{-fanalyzer}, which enables it; use
9441 @option{-Wno-analyzer-shift-count-negative} to disable it.
9443 This diagnostic warns for paths through the code in which a
9444 shift is attempted with a negative count. It is analogous to
9445 the @option{-Wshift-count-negative} diagnostic implemented in
9446 the C/C++ front ends, but is implemented based on analyzing
9447 interprocedural paths, rather than merely parsing the syntax tree.
9448 However, the analyzer does not prioritize detection of such paths, so
9449 false negatives are more likely relative to other warnings.
9451 @item -Wno-analyzer-shift-count-overflow
9452 @opindex Wanalyzer-shift-count-overflow
9453 @opindex Wno-analyzer-shift-count-overflow
9454 This warning requires @option{-fanalyzer}, which enables it; use
9455 @option{-Wno-analyzer-shift-count-overflow} to disable it.
9457 This diagnostic warns for paths through the code in which a
9458 shift is attempted with a count greater than or equal to the
9459 precision of the operand's type. It is analogous to
9460 the @option{-Wshift-count-overflow} diagnostic implemented in
9461 the C/C++ front ends, but is implemented based on analyzing
9462 interprocedural paths, rather than merely parsing the syntax tree.
9463 However, the analyzer does not prioritize detection of such paths, so
9464 false negatives are more likely relative to other warnings.
9466 @item -Wno-analyzer-stale-setjmp-buffer
9467 @opindex Wanalyzer-stale-setjmp-buffer
9468 @opindex Wno-analyzer-stale-setjmp-buffer
9469 This warning requires @option{-fanalyzer}, which enables it; use
9470 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
9472 This diagnostic warns for paths through the code in which
9473 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
9474 to a @code{setjmp} call in a function that has returned.
9476 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
9477 location, it records the stack frame. The stack frame becomes invalid
9478 when the function containing the @code{setjmp} call returns. Attempting
9479 to rewind to it via @code{longjmp} would reference a stack frame that
9480 no longer exists, and likely lead to a crash (or worse).
9482 @item -Wno-analyzer-tainted-array-index
9483 @opindex Wanalyzer-tainted-array-index
9484 @opindex Wno-analyzer-tainted-array-index
9485 This warning requires both @option{-fanalyzer} and
9486 @option{-fanalyzer-checker=taint} to enable it;
9487 use @option{-Wno-analyzer-tainted-array-index} to disable it.
9489 This diagnostic warns for paths through the code in which a value
9490 that could be under an attacker's control is used as the index
9491 of an array access without being sanitized.
9493 @item -Wno-analyzer-unsafe-call-within-signal-handler
9494 @opindex Wanalyzer-unsafe-call-within-signal-handler
9495 @opindex Wno-analyzer-unsafe-call-within-signal-handler
9496 This warning requires @option{-fanalyzer}, which enables it; use
9497 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
9499 This diagnostic warns for paths through the code in which a
9500 function known to be async-signal-unsafe (such as @code{fprintf}) is
9501 called from a signal handler.
9503 @item -Wno-analyzer-use-after-free
9504 @opindex Wanalyzer-use-after-free
9505 @opindex Wno-analyzer-use-after-free
9506 This warning requires @option{-fanalyzer}, which enables it; use
9507 @option{-Wno-analyzer-use-after-free} to disable it.
9509 This diagnostic warns for paths through the code in which a
9510 pointer is used after a deallocator is called on it: either @code{free},
9511 or a deallocator referenced by attribute @code{malloc}.
9513 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
9514 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
9515 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
9516 This warning requires @option{-fanalyzer}, which enables it; use
9517 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
9520 This diagnostic warns for paths through the code in which a pointer
9521 is dereferenced that points to a variable in a stale stack frame.
9523 @item -Wno-analyzer-write-to-const
9524 @opindex Wanalyzer-write-to-const
9525 @opindex Wno-analyzer-write-to-const
9526 This warning requires @option{-fanalyzer}, which enables it; use
9527 @option{-Wno-analyzer-write-to-const}
9530 This diagnostic warns for paths through the code in which the analyzer
9531 detects an attempt to write through a pointer to a @code{const} object.
9532 However, the analyzer does not prioritize detection of such paths, so
9533 false negatives are more likely relative to other warnings.
9535 @item -Wno-analyzer-write-to-string-literal
9536 @opindex Wanalyzer-write-to-string-literal
9537 @opindex Wno-analyzer-write-to-string-literal
9538 This warning requires @option{-fanalyzer}, which enables it; use
9539 @option{-Wno-analyzer-write-to-string-literal}
9542 This diagnostic warns for paths through the code in which the analyzer
9543 detects an attempt to write through a pointer to a string literal.
9544 However, the analyzer does not prioritize detection of such paths, so
9545 false negatives are more likely relative to other warnings.
9547 @item -Wno-analyzer-use-of-uninitialized-value
9548 @opindex Wanalyzer-use-of-uninitialized-value
9549 @opindex Wno-analyzer-use-of-uninitialized-value
9550 This warning requires @option{-fanalyzer}, which enables it; use
9551 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
9553 This diagnostic warns for paths through the code in which an uninitialized
9558 Pertinent parameters for controlling the exploration are:
9559 @option{--param analyzer-bb-explosion-factor=@var{value}},
9560 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
9561 @option{--param analyzer-max-recursion-depth=@var{value}}, and
9562 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
9564 The following options control the analyzer.
9568 @item -fanalyzer-call-summaries
9569 @opindex fanalyzer-call-summaries
9570 @opindex fno-analyzer-call-summaries
9571 Simplify interprocedural analysis by computing the effect of certain calls,
9572 rather than exploring all paths through the function from callsite to each
9575 If enabled, call summaries are only used for functions with more than one
9576 call site, and that are sufficiently complicated (as per
9577 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
9579 @item -fanalyzer-checker=@var{name}
9580 @opindex fanalyzer-checker
9581 Restrict the analyzer to run just the named checker, and enable it.
9583 Some checkers are disabled by default (even with @option{-fanalyzer}),
9584 such as the @code{taint} checker that implements
9585 @option{-Wanalyzer-tainted-array-index}, and this option is required
9588 @item -fno-analyzer-feasibility
9589 @opindex fanalyzer-feasibility
9590 @opindex fno-analyzer-feasibility
9591 This option is intended for analyzer developers.
9593 By default the analyzer verifies that there is a feasible control flow path
9594 for each diagnostic it emits: that the conditions that hold are not mutually
9595 exclusive. Diagnostics for which no feasible path can be found are rejected.
9596 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
9597 debugging issues in this code.
9599 @item -fanalyzer-fine-grained
9600 @opindex fanalyzer-fine-grained
9601 @opindex fno-analyzer-fine-grained
9602 This option is intended for analyzer developers.
9604 Internally the analyzer builds an ``exploded graph'' that combines
9605 control flow graphs with data flow information.
9607 By default, an edge in this graph can contain the effects of a run
9608 of multiple statements within a basic block. With
9609 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
9611 @item -fanalyzer-show-duplicate-count
9612 @opindex fanalyzer-show-duplicate-count
9613 @opindex fno-analyzer-show-duplicate-count
9614 This option is intended for analyzer developers: if multiple diagnostics
9615 have been detected as being duplicates of each other, it emits a note when
9616 reporting the best diagnostic, giving the number of additional diagnostics
9617 that were suppressed by the deduplication logic.
9619 @item -fno-analyzer-state-merge
9620 @opindex fanalyzer-state-merge
9621 @opindex fno-analyzer-state-merge
9622 This option is intended for analyzer developers.
9624 By default the analyzer attempts to simplify analysis by merging
9625 sufficiently similar states at each program point as it builds its
9626 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
9627 merging can be suppressed, for debugging state-handling issues.
9629 @item -fno-analyzer-state-purge
9630 @opindex fanalyzer-state-purge
9631 @opindex fno-analyzer-state-purge
9632 This option is intended for analyzer developers.
9634 By default the analyzer attempts to simplify analysis by purging
9635 aspects of state at a program point that appear to no longer be relevant
9636 e.g. the values of locals that aren't accessed later in the function
9637 and which aren't relevant to leak analysis.
9639 With @option{-fno-analyzer-state-purge} this purging of state can
9640 be suppressed, for debugging state-handling issues.
9642 @item -fanalyzer-transitivity
9643 @opindex fanalyzer-transitivity
9644 @opindex fno-analyzer-transitivity
9645 This option enables transitivity of constraints within the analyzer.
9647 @item -fanalyzer-verbose-edges
9648 This option is intended for analyzer developers. It enables more
9649 verbose, lower-level detail in the descriptions of control flow
9650 within diagnostic paths.
9652 @item -fanalyzer-verbose-state-changes
9653 This option is intended for analyzer developers. It enables more
9654 verbose, lower-level detail in the descriptions of events relating
9655 to state machines within diagnostic paths.
9657 @item -fanalyzer-verbosity=@var{level}
9658 This option controls the complexity of the control flow paths that are
9659 emitted for analyzer diagnostics.
9661 The @var{level} can be one of:
9665 At this level, interprocedural call and return events are displayed,
9666 along with the most pertinent state-change events relating to
9667 a diagnostic. For example, for a double-@code{free} diagnostic,
9668 both calls to @code{free} will be shown.
9671 As per the previous level, but also show events for the entry
9675 As per the previous level, but also show events relating to
9676 control flow that are significant to triggering the issue
9677 (e.g. ``true path taken'' at a conditional).
9679 This level is the default.
9682 As per the previous level, but show all control flow events, not
9683 just significant ones.
9686 This level is intended for analyzer developers; it adds various
9687 other events intended for debugging the analyzer.
9691 @item -fdump-analyzer
9692 @opindex fdump-analyzer
9693 Dump internal details about what the analyzer is doing to
9694 @file{@var{file}.analyzer.txt}.
9695 This option is overridden by @option{-fdump-analyzer-stderr}.
9697 @item -fdump-analyzer-stderr
9698 @opindex fdump-analyzer-stderr
9699 Dump internal details about what the analyzer is doing to stderr.
9700 This option overrides @option{-fdump-analyzer}.
9702 @item -fdump-analyzer-callgraph
9703 @opindex fdump-analyzer-callgraph
9704 Dump a representation of the call graph suitable for viewing with
9705 GraphViz to @file{@var{file}.callgraph.dot}.
9707 @item -fdump-analyzer-exploded-graph
9708 @opindex fdump-analyzer-exploded-graph
9709 Dump a representation of the ``exploded graph'' suitable for viewing with
9710 GraphViz to @file{@var{file}.eg.dot}.
9711 Nodes are color-coded based on state-machine states to emphasize
9714 @item -fdump-analyzer-exploded-nodes
9715 @opindex dump-analyzer-exploded-nodes
9716 Emit diagnostics showing where nodes in the ``exploded graph'' are
9717 in relation to the program source.
9719 @item -fdump-analyzer-exploded-nodes-2
9720 @opindex dump-analyzer-exploded-nodes-2
9721 Dump a textual representation of the ``exploded graph'' to
9722 @file{@var{file}.eg.txt}.
9724 @item -fdump-analyzer-exploded-nodes-3
9725 @opindex dump-analyzer-exploded-nodes-3
9726 Dump a textual representation of the ``exploded graph'' to
9727 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
9728 This is typically a large number of dump files.
9730 @item -fdump-analyzer-exploded-paths
9731 @opindex fdump-analyzer-exploded-paths
9732 Dump a textual representation of the ``exploded path'' for each
9733 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
9735 @item -fdump-analyzer-feasibility
9736 @opindex dump-analyzer-feasibility
9737 Dump internal details about the analyzer's search for feasible paths.
9738 The details are written in a form suitable for viewing with GraphViz
9739 to filenames of the form @file{@var{file}.*.fg.dot} and
9740 @file{@var{file}.*.tg.dot}.
9742 @item -fdump-analyzer-json
9743 @opindex fdump-analyzer-json
9744 Dump a compressed JSON representation of analyzer internals to
9745 @file{@var{file}.analyzer.json.gz}. The precise format is subject
9748 @item -fdump-analyzer-state-purge
9749 @opindex fdump-analyzer-state-purge
9750 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
9751 ``supergraph'' suitable for viewing with GraphViz, but annotate the
9752 graph with information on what state will be purged at each node.
9753 The graph is written to @file{@var{file}.state-purge.dot}.
9755 @item -fdump-analyzer-supergraph
9756 @opindex fdump-analyzer-supergraph
9757 Dump representations of the ``supergraph'' suitable for viewing with
9758 GraphViz to @file{@var{file}.supergraph.dot} and to
9759 @file{@var{file}.supergraph-eg.dot}. These show all of the
9760 control flow graphs in the program, with interprocedural edges for
9761 calls and returns. The second dump contains annotations showing nodes
9762 in the ``exploded graph'' and diagnostics associated with them.
9766 @node Debugging Options
9767 @section Options for Debugging Your Program
9768 @cindex options, debugging
9769 @cindex debugging information options
9771 To tell GCC to emit extra information for use by a debugger, in almost
9772 all cases you need only to add @option{-g} to your other options. Some debug
9773 formats can co-exist (like DWARF with CTF) when each of them is enabled
9774 explicitly by adding the respective command line option to your other options.
9776 GCC allows you to use @option{-g} with
9777 @option{-O}. The shortcuts taken by optimized code may occasionally
9778 be surprising: some variables you declared may not exist
9779 at all; flow of control may briefly move where you did not expect it;
9780 some statements may not be executed because they compute constant
9781 results or their values are already at hand; some statements may
9782 execute in different places because they have been moved out of loops.
9783 Nevertheless it is possible to debug optimized output. This makes
9784 it reasonable to use the optimizer for programs that might have bugs.
9786 If you are not using some other optimization option, consider
9787 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
9788 With no @option{-O} option at all, some compiler passes that collect
9789 information useful for debugging do not run at all, so that
9790 @option{-Og} may result in a better debugging experience.
9795 Produce debugging information in the operating system's native format
9796 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
9799 On most systems that use stabs format, @option{-g} enables use of extra
9800 debugging information that only GDB can use; this extra information
9801 makes debugging work better in GDB but probably makes other debuggers
9803 refuse to read the program. If you want to control for certain whether
9804 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
9805 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
9809 Produce debugging information for use by GDB@. This means to use the
9810 most expressive format available (DWARF, stabs, or the native format
9811 if neither of those are supported), including GDB extensions if at all
9815 @itemx -gdwarf-@var{version}
9817 Produce debugging information in DWARF format (if that is supported).
9818 The value of @var{version} may be either 2, 3, 4 or 5; the default
9819 version for most targets is 5 (with the exception of VxWorks, TPF and
9820 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
9823 Note that with DWARF Version 2, some ports require and always
9824 use some non-conflicting DWARF 3 extensions in the unwind tables.
9826 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
9827 for maximum benefit. Version 5 requires GDB 8.0 or higher.
9829 GCC no longer supports DWARF Version 1, which is substantially
9830 different than Version 2 and later. For historical reasons, some
9831 other DWARF-related options such as
9832 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
9833 in their names, but apply to all currently-supported versions of DWARF.
9837 Request BTF debug information. BTF is the default debugging format for the
9838 eBPF target. On other targets, like x86, BTF debug information can be
9839 generated along with DWARF debug information when both of the debug formats are
9840 enabled explicitly via their respective command line options.
9843 @itemx -gctf@var{level}
9845 Request CTF debug information and use level to specify how much CTF debug
9846 information should be produced. If @option{-gctf} is specified
9847 without a value for level, the default level of CTF debug information is 2.
9849 CTF debug information can be generated along with DWARF debug information when
9850 both of the debug formats are enabled explicitly via their respective command
9853 Level 0 produces no CTF debug information at all. Thus, @option{-gctf0}
9854 negates @option{-gctf}.
9856 Level 1 produces CTF information for tracebacks only. This includes callsite
9857 information, but does not include type information.
9859 Level 2 produces type information for entities (functions, data objects etc.)
9860 at file-scope or global-scope only.
9864 Produce debugging information in stabs format (if that is supported),
9865 without GDB extensions. This is the format used by DBX on most BSD
9866 systems. On MIPS, Alpha and System V Release 4 systems this option
9867 produces stabs debugging output that is not understood by DBX@.
9868 On System V Release 4 systems this option requires the GNU assembler.
9872 Produce debugging information in stabs format (if that is supported),
9873 using GNU extensions understood only by the GNU debugger (GDB)@. The
9874 use of these extensions is likely to make other debuggers crash or
9875 refuse to read the program.
9879 Produce debugging information in XCOFF format (if that is supported).
9880 This is the format used by the DBX debugger on IBM RS/6000 systems.
9884 Produce debugging information in XCOFF format (if that is supported),
9885 using GNU extensions understood only by the GNU debugger (GDB)@. The
9886 use of these extensions is likely to make other debuggers crash or
9887 refuse to read the program, and may cause assemblers other than the GNU
9888 assembler (GAS) to fail with an error.
9892 Produce debugging information in Alpha/VMS debug format (if that is
9893 supported). This is the format used by DEBUG on Alpha/VMS systems.
9896 @itemx -ggdb@var{level}
9897 @itemx -gstabs@var{level}
9898 @itemx -gxcoff@var{level}
9899 @itemx -gvms@var{level}
9900 Request debugging information and also use @var{level} to specify how
9901 much information. The default level is 2.
9903 Level 0 produces no debug information at all. Thus, @option{-g0} negates
9906 Level 1 produces minimal information, enough for making backtraces in
9907 parts of the program that you don't plan to debug. This includes
9908 descriptions of functions and external variables, and line number
9909 tables, but no information about local variables.
9911 Level 3 includes extra information, such as all the macro definitions
9912 present in the program. Some debuggers support macro expansion when
9913 you use @option{-g3}.
9915 If you use multiple @option{-g} options, with or without level numbers,
9916 the last such option is the one that is effective.
9918 @option{-gdwarf} does not accept a concatenated debug level, to avoid
9919 confusion with @option{-gdwarf-@var{level}}.
9920 Instead use an additional @option{-g@var{level}} option to change the
9921 debug level for DWARF.
9923 @item -fno-eliminate-unused-debug-symbols
9924 @opindex feliminate-unused-debug-symbols
9925 @opindex fno-eliminate-unused-debug-symbols
9926 By default, no debug information is produced for symbols that are not actually
9927 used. Use this option if you want debug information for all symbols.
9929 @item -femit-class-debug-always
9930 @opindex femit-class-debug-always
9931 Instead of emitting debugging information for a C++ class in only one
9932 object file, emit it in all object files using the class. This option
9933 should be used only with debuggers that are unable to handle the way GCC
9934 normally emits debugging information for classes because using this
9935 option increases the size of debugging information by as much as a
9938 @item -fno-merge-debug-strings
9939 @opindex fmerge-debug-strings
9940 @opindex fno-merge-debug-strings
9941 Direct the linker to not merge together strings in the debugging
9942 information that are identical in different object files. Merging is
9943 not supported by all assemblers or linkers. Merging decreases the size
9944 of the debug information in the output file at the cost of increasing
9945 link processing time. Merging is enabled by default.
9947 @item -fdebug-prefix-map=@var{old}=@var{new}
9948 @opindex fdebug-prefix-map
9949 When compiling files residing in directory @file{@var{old}}, record
9950 debugging information describing them as if the files resided in
9951 directory @file{@var{new}} instead. This can be used to replace a
9952 build-time path with an install-time path in the debug info. It can
9953 also be used to change an absolute path to a relative path by using
9954 @file{.} for @var{new}. This can give more reproducible builds, which
9955 are location independent, but may require an extra command to tell GDB
9956 where to find the source files. See also @option{-ffile-prefix-map}.
9958 @item -fvar-tracking
9959 @opindex fvar-tracking
9960 Run variable tracking pass. It computes where variables are stored at each
9961 position in code. Better debugging information is then generated
9962 (if the debugging information format supports this information).
9964 It is enabled by default when compiling with optimization (@option{-Os},
9965 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
9966 the debug info format supports it.
9968 @item -fvar-tracking-assignments
9969 @opindex fvar-tracking-assignments
9970 @opindex fno-var-tracking-assignments
9971 Annotate assignments to user variables early in the compilation and
9972 attempt to carry the annotations over throughout the compilation all the
9973 way to the end, in an attempt to improve debug information while
9974 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
9976 It can be enabled even if var-tracking is disabled, in which case
9977 annotations are created and maintained, but discarded at the end.
9978 By default, this flag is enabled together with @option{-fvar-tracking},
9979 except when selective scheduling is enabled.
9982 @opindex gsplit-dwarf
9983 If DWARF debugging information is enabled, separate as much debugging
9984 information as possible into a separate output file with the extension
9985 @file{.dwo}. This option allows the build system to avoid linking files with
9986 debug information. To be useful, this option requires a debugger capable of
9987 reading @file{.dwo} files.
9993 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
9994 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
9995 DWARF format. The default is target specific, on most targets it is
9996 @option{-gdwarf32} though. The 32-bit DWARF format is smaller, but
9997 can't support more than 2GiB of debug information in any of the DWARF
9998 debug information sections. The 64-bit DWARF format allows larger debug
9999 information and might not be well supported by all consumers yet.
10001 @item -gdescribe-dies
10002 @opindex gdescribe-dies
10003 Add description attributes to some DWARF DIEs that have no name attribute,
10004 such as artificial variables, external references and call site
10009 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
10011 @item -ggnu-pubnames
10012 @opindex ggnu-pubnames
10013 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
10014 suitable for conversion into a GDB@ index. This option is only useful
10015 with a linker that can produce GDB@ index version 7.
10017 @item -fdebug-types-section
10018 @opindex fdebug-types-section
10019 @opindex fno-debug-types-section
10020 When using DWARF Version 4 or higher, type DIEs can be put into
10021 their own @code{.debug_types} section instead of making them part of the
10022 @code{.debug_info} section. It is more efficient to put them in a separate
10023 comdat section since the linker can then remove duplicates.
10024 But not all DWARF consumers support @code{.debug_types} sections yet
10025 and on some objects @code{.debug_types} produces larger instead of smaller
10026 debugging information.
10028 @item -grecord-gcc-switches
10029 @itemx -gno-record-gcc-switches
10030 @opindex grecord-gcc-switches
10031 @opindex gno-record-gcc-switches
10032 This switch causes the command-line options used to invoke the
10033 compiler that may affect code generation to be appended to the
10034 DW_AT_producer attribute in DWARF debugging information. The options
10035 are concatenated with spaces separating them from each other and from
10036 the compiler version.
10037 It is enabled by default.
10038 See also @option{-frecord-gcc-switches} for another
10039 way of storing compiler options into the object file.
10041 @item -gstrict-dwarf
10042 @opindex gstrict-dwarf
10043 Disallow using extensions of later DWARF standard version than selected
10044 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
10045 DWARF extensions from later standard versions is allowed.
10047 @item -gno-strict-dwarf
10048 @opindex gno-strict-dwarf
10049 Allow using extensions of later DWARF standard version than selected with
10050 @option{-gdwarf-@var{version}}.
10052 @item -gas-loc-support
10053 @opindex gas-loc-support
10054 Inform the compiler that the assembler supports @code{.loc} directives.
10055 It may then use them for the assembler to generate DWARF2+ line number
10058 This is generally desirable, because assembler-generated line-number
10059 tables are a lot more compact than those the compiler can generate
10062 This option will be enabled by default if, at GCC configure time, the
10063 assembler was found to support such directives.
10065 @item -gno-as-loc-support
10066 @opindex gno-as-loc-support
10067 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
10068 line number tables are to be generated.
10070 @item -gas-locview-support
10071 @opindex gas-locview-support
10072 Inform the compiler that the assembler supports @code{view} assignment
10073 and reset assertion checking in @code{.loc} directives.
10075 This option will be enabled by default if, at GCC configure time, the
10076 assembler was found to support them.
10078 @item -gno-as-locview-support
10079 Force GCC to assign view numbers internally, if
10080 @option{-gvariable-location-views} are explicitly requested.
10082 @item -gcolumn-info
10083 @itemx -gno-column-info
10084 @opindex gcolumn-info
10085 @opindex gno-column-info
10086 Emit location column information into DWARF debugging information, rather
10087 than just file and line.
10088 This option is enabled by default.
10090 @item -gstatement-frontiers
10091 @itemx -gno-statement-frontiers
10092 @opindex gstatement-frontiers
10093 @opindex gno-statement-frontiers
10094 This option causes GCC to create markers in the internal representation
10095 at the beginning of statements, and to keep them roughly in place
10096 throughout compilation, using them to guide the output of @code{is_stmt}
10097 markers in the line number table. This is enabled by default when
10098 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
10099 @dots{}), and outputting DWARF 2 debug information at the normal level.
10101 @item -gvariable-location-views
10102 @itemx -gvariable-location-views=incompat5
10103 @itemx -gno-variable-location-views
10104 @opindex gvariable-location-views
10105 @opindex gvariable-location-views=incompat5
10106 @opindex gno-variable-location-views
10107 Augment variable location lists with progressive view numbers implied
10108 from the line number table. This enables debug information consumers to
10109 inspect state at certain points of the program, even if no instructions
10110 associated with the corresponding source locations are present at that
10111 point. If the assembler lacks support for view numbers in line number
10112 tables, this will cause the compiler to emit the line number table,
10113 which generally makes them somewhat less compact. The augmented line
10114 number tables and location lists are fully backward-compatible, so they
10115 can be consumed by debug information consumers that are not aware of
10116 these augmentations, but they won't derive any benefit from them either.
10118 This is enabled by default when outputting DWARF 2 debug information at
10119 the normal level, as long as there is assembler support,
10120 @option{-fvar-tracking-assignments} is enabled and
10121 @option{-gstrict-dwarf} is not. When assembler support is not
10122 available, this may still be enabled, but it will force GCC to output
10123 internal line number tables, and if
10124 @option{-ginternal-reset-location-views} is not enabled, that will most
10125 certainly lead to silently mismatching location views.
10127 There is a proposed representation for view numbers that is not backward
10128 compatible with the location list format introduced in DWARF 5, that can
10129 be enabled with @option{-gvariable-location-views=incompat5}. This
10130 option may be removed in the future, is only provided as a reference
10131 implementation of the proposed representation. Debug information
10132 consumers are not expected to support this extended format, and they
10133 would be rendered unable to decode location lists using it.
10135 @item -ginternal-reset-location-views
10136 @itemx -gno-internal-reset-location-views
10137 @opindex ginternal-reset-location-views
10138 @opindex gno-internal-reset-location-views
10139 Attempt to determine location views that can be omitted from location
10140 view lists. This requires the compiler to have very accurate insn
10141 length estimates, which isn't always the case, and it may cause
10142 incorrect view lists to be generated silently when using an assembler
10143 that does not support location view lists. The GNU assembler will flag
10144 any such error as a @code{view number mismatch}. This is only enabled
10145 on ports that define a reliable estimation function.
10147 @item -ginline-points
10148 @itemx -gno-inline-points
10149 @opindex ginline-points
10150 @opindex gno-inline-points
10151 Generate extended debug information for inlined functions. Location
10152 view tracking markers are inserted at inlined entry points, so that
10153 address and view numbers can be computed and output in debug
10154 information. This can be enabled independently of location views, in
10155 which case the view numbers won't be output, but it can only be enabled
10156 along with statement frontiers, and it is only enabled by default if
10157 location views are enabled.
10159 @item -gz@r{[}=@var{type}@r{]}
10161 Produce compressed debug sections in DWARF format, if that is supported.
10162 If @var{type} is not given, the default type depends on the capabilities
10163 of the assembler and linker used. @var{type} may be one of
10164 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
10165 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
10166 compression in traditional GNU format). If the linker doesn't support
10167 writing compressed debug sections, the option is rejected. Otherwise,
10168 if the assembler does not support them, @option{-gz} is silently ignored
10169 when producing object files.
10171 @item -femit-struct-debug-baseonly
10172 @opindex femit-struct-debug-baseonly
10173 Emit debug information for struct-like types
10174 only when the base name of the compilation source file
10175 matches the base name of file in which the struct is defined.
10177 This option substantially reduces the size of debugging information,
10178 but at significant potential loss in type information to the debugger.
10179 See @option{-femit-struct-debug-reduced} for a less aggressive option.
10180 See @option{-femit-struct-debug-detailed} for more detailed control.
10182 This option works only with DWARF debug output.
10184 @item -femit-struct-debug-reduced
10185 @opindex femit-struct-debug-reduced
10186 Emit debug information for struct-like types
10187 only when the base name of the compilation source file
10188 matches the base name of file in which the type is defined,
10189 unless the struct is a template or defined in a system header.
10191 This option significantly reduces the size of debugging information,
10192 with some potential loss in type information to the debugger.
10193 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
10194 See @option{-femit-struct-debug-detailed} for more detailed control.
10196 This option works only with DWARF debug output.
10198 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
10199 @opindex femit-struct-debug-detailed
10200 Specify the struct-like types
10201 for which the compiler generates debug information.
10202 The intent is to reduce duplicate struct debug information
10203 between different object files within the same program.
10205 This option is a detailed version of
10206 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
10207 which serves for most needs.
10209 A specification has the syntax@*
10210 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
10212 The optional first word limits the specification to
10213 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
10214 A struct type is used directly when it is the type of a variable, member.
10215 Indirect uses arise through pointers to structs.
10216 That is, when use of an incomplete struct is valid, the use is indirect.
10218 @samp{struct one direct; struct two * indirect;}.
10220 The optional second word limits the specification to
10221 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
10222 Generic structs are a bit complicated to explain.
10223 For C++, these are non-explicit specializations of template classes,
10224 or non-template classes within the above.
10225 Other programming languages have generics,
10226 but @option{-femit-struct-debug-detailed} does not yet implement them.
10228 The third word specifies the source files for those
10229 structs for which the compiler should emit debug information.
10230 The values @samp{none} and @samp{any} have the normal meaning.
10231 The value @samp{base} means that
10232 the base of name of the file in which the type declaration appears
10233 must match the base of the name of the main compilation file.
10234 In practice, this means that when compiling @file{foo.c}, debug information
10235 is generated for types declared in that file and @file{foo.h},
10236 but not other header files.
10237 The value @samp{sys} means those types satisfying @samp{base}
10238 or declared in system or compiler headers.
10240 You may need to experiment to determine the best settings for your application.
10242 The default is @option{-femit-struct-debug-detailed=all}.
10244 This option works only with DWARF debug output.
10246 @item -fno-dwarf2-cfi-asm
10247 @opindex fdwarf2-cfi-asm
10248 @opindex fno-dwarf2-cfi-asm
10249 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
10250 instead of using GAS @code{.cfi_*} directives.
10252 @item -fno-eliminate-unused-debug-types
10253 @opindex feliminate-unused-debug-types
10254 @opindex fno-eliminate-unused-debug-types
10255 Normally, when producing DWARF output, GCC avoids producing debug symbol
10256 output for types that are nowhere used in the source file being compiled.
10257 Sometimes it is useful to have GCC emit debugging
10258 information for all types declared in a compilation
10259 unit, regardless of whether or not they are actually used
10260 in that compilation unit, for example
10261 if, in the debugger, you want to cast a value to a type that is
10262 not actually used in your program (but is declared). More often,
10263 however, this results in a significant amount of wasted space.
10266 @node Optimize Options
10267 @section Options That Control Optimization
10268 @cindex optimize options
10269 @cindex options, optimization
10271 These options control various sorts of optimizations.
10273 Without any optimization option, the compiler's goal is to reduce the
10274 cost of compilation and to make debugging produce the expected
10275 results. Statements are independent: if you stop the program with a
10276 breakpoint between statements, you can then assign a new value to any
10277 variable or change the program counter to any other statement in the
10278 function and get exactly the results you expect from the source
10281 Turning on optimization flags makes the compiler attempt to improve
10282 the performance and/or code size at the expense of compilation time
10283 and possibly the ability to debug the program.
10285 The compiler performs optimization based on the knowledge it has of the
10286 program. Compiling multiple files at once to a single output file mode allows
10287 the compiler to use information gained from all of the files when compiling
10290 Not all optimizations are controlled directly by a flag. Only
10291 optimizations that have a flag are listed in this section.
10293 Most optimizations are completely disabled at @option{-O0} or if an
10294 @option{-O} level is not set on the command line, even if individual
10295 optimization flags are specified. Similarly, @option{-Og} suppresses
10296 many optimization passes.
10298 Depending on the target and how GCC was configured, a slightly different
10299 set of optimizations may be enabled at each @option{-O} level than
10300 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
10301 to find out the exact set of optimizations that are enabled at each level.
10302 @xref{Overall Options}, for examples.
10309 Optimize. Optimizing compilation takes somewhat more time, and a lot
10310 more memory for a large function.
10312 With @option{-O}, the compiler tries to reduce code size and execution
10313 time, without performing any optimizations that take a great deal of
10316 @c Note that in addition to the default_options_table list in opts.c,
10317 @c several optimization flags default to true but control optimization
10318 @c passes that are explicitly disabled at -O0.
10320 @option{-O} turns on the following optimization flags:
10322 @c Please keep the following list alphabetized.
10323 @gccoptlist{-fauto-inc-dec @gol
10324 -fbranch-count-reg @gol
10325 -fcombine-stack-adjustments @gol
10326 -fcompare-elim @gol
10327 -fcprop-registers @gol
10330 -fdelayed-branch @gol
10332 -fforward-propagate @gol
10333 -fguess-branch-probability @gol
10334 -fif-conversion @gol
10335 -fif-conversion2 @gol
10336 -finline-functions-called-once @gol
10339 -fipa-pure-const @gol
10340 -fipa-reference @gol
10341 -fipa-reference-addressable @gol
10342 -fmerge-constants @gol
10343 -fmove-loop-invariants @gol
10344 -fmove-loop-stores@gol
10345 -fomit-frame-pointer @gol
10346 -freorder-blocks @gol
10348 -fshrink-wrap-separate @gol
10349 -fsplit-wide-types @gol
10350 -fssa-backprop @gol
10352 -ftree-bit-ccp @gol
10355 -ftree-coalesce-vars @gol
10356 -ftree-copy-prop @gol
10358 -ftree-dominator-opts @gol
10360 -ftree-forwprop @gol
10362 -ftree-phiprop @gol
10364 -ftree-scev-cprop @gol
10373 Optimize even more. GCC performs nearly all supported optimizations
10374 that do not involve a space-speed tradeoff.
10375 As compared to @option{-O}, this option increases both compilation time
10376 and the performance of the generated code.
10378 @option{-O2} turns on all optimization flags specified by @option{-O1}. It
10379 also turns on the following optimization flags:
10381 @c Please keep the following list alphabetized!
10382 @gccoptlist{-falign-functions -falign-jumps @gol
10383 -falign-labels -falign-loops @gol
10384 -fcaller-saves @gol
10385 -fcode-hoisting @gol
10386 -fcrossjumping @gol
10387 -fcse-follow-jumps -fcse-skip-blocks @gol
10388 -fdelete-null-pointer-checks @gol
10389 -fdevirtualize -fdevirtualize-speculatively @gol
10390 -fexpensive-optimizations @gol
10391 -ffinite-loops @gol
10392 -fgcse -fgcse-lm @gol
10393 -fhoist-adjacent-loads @gol
10394 -finline-functions @gol
10395 -finline-small-functions @gol
10396 -findirect-inlining @gol
10397 -fipa-bit-cp -fipa-cp -fipa-icf @gol
10398 -fipa-ra -fipa-sra -fipa-vrp @gol
10399 -fisolate-erroneous-paths-dereference @gol
10401 -foptimize-sibling-calls @gol
10402 -foptimize-strlen @gol
10403 -fpartial-inlining @gol
10405 -freorder-blocks-algorithm=stc @gol
10406 -freorder-blocks-and-partition -freorder-functions @gol
10407 -frerun-cse-after-loop @gol
10408 -fschedule-insns -fschedule-insns2 @gol
10409 -fsched-interblock -fsched-spec @gol
10410 -fstore-merging @gol
10411 -fstrict-aliasing @gol
10412 -fthread-jumps @gol
10413 -ftree-builtin-call-dce @gol
10415 -ftree-switch-conversion -ftree-tail-merge @gol
10418 Please note the warning under @option{-fgcse} about
10419 invoking @option{-O2} on programs that use computed gotos.
10423 Optimize yet more. @option{-O3} turns on all optimizations specified
10424 by @option{-O2} and also turns on the following optimization flags:
10426 @c Please keep the following list alphabetized!
10427 @gccoptlist{-fgcse-after-reload @gol
10429 -floop-interchange @gol
10430 -floop-unroll-and-jam @gol
10432 -fpredictive-commoning @gol
10435 -ftree-loop-distribution @gol
10436 -ftree-loop-vectorize @gol
10437 -ftree-partial-pre @gol
10438 -ftree-slp-vectorize @gol
10439 -funswitch-loops @gol
10440 -fvect-cost-model @gol
10441 -fvect-cost-model=dynamic @gol
10442 -fversion-loops-for-strides}
10446 Reduce compilation time and make debugging produce the expected
10447 results. This is the default.
10451 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
10452 except those that often increase code size:
10454 @gccoptlist{-falign-functions -falign-jumps @gol
10455 -falign-labels -falign-loops @gol
10456 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
10458 It also enables @option{-finline-functions}, causes the compiler to tune for
10459 code size rather than execution speed, and performs further optimizations
10460 designed to reduce code size.
10464 Disregard strict standards compliance. @option{-Ofast} enables all
10465 @option{-O3} optimizations. It also enables optimizations that are not
10466 valid for all standard-compliant programs.
10467 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
10468 and the Fortran-specific @option{-fstack-arrays}, unless
10469 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
10473 Optimize debugging experience. @option{-Og} should be the optimization
10474 level of choice for the standard edit-compile-debug cycle, offering
10475 a reasonable level of optimization while maintaining fast compilation
10476 and a good debugging experience. It is a better choice than @option{-O0}
10477 for producing debuggable code because some compiler passes
10478 that collect debug information are disabled at @option{-O0}.
10480 Like @option{-O0}, @option{-Og} completely disables a number of
10481 optimization passes so that individual options controlling them have
10482 no effect. Otherwise @option{-Og} enables all @option{-O1}
10483 optimization flags except for those that may interfere with debugging:
10485 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
10486 -fdse -fif-conversion -fif-conversion2 @gol
10487 -finline-functions-called-once @gol
10488 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt @gol
10489 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
10493 If you use multiple @option{-O} options, with or without level numbers,
10494 the last such option is the one that is effective.
10496 Options of the form @option{-f@var{flag}} specify machine-independent
10497 flags. Most flags have both positive and negative forms; the negative
10498 form of @option{-ffoo} is @option{-fno-foo}. In the table
10499 below, only one of the forms is listed---the one you typically
10500 use. You can figure out the other form by either removing @samp{no-}
10503 The following options control specific optimizations. They are either
10504 activated by @option{-O} options or are related to ones that are. You
10505 can use the following flags in the rare cases when ``fine-tuning'' of
10506 optimizations to be performed is desired.
10509 @item -fno-defer-pop
10510 @opindex fno-defer-pop
10511 @opindex fdefer-pop
10512 For machines that must pop arguments after a function call, always pop
10513 the arguments as soon as each function returns.
10514 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
10515 this allows the compiler to let arguments accumulate on the stack for several
10516 function calls and pop them all at once.
10518 @item -fforward-propagate
10519 @opindex fforward-propagate
10520 Perform a forward propagation pass on RTL@. The pass tries to combine two
10521 instructions and checks if the result can be simplified. If loop unrolling
10522 is active, two passes are performed and the second is scheduled after
10525 This option is enabled by default at optimization levels @option{-O1},
10526 @option{-O2}, @option{-O3}, @option{-Os}.
10528 @item -ffp-contract=@var{style}
10529 @opindex ffp-contract
10530 @option{-ffp-contract=off} disables floating-point expression contraction.
10531 @option{-ffp-contract=fast} enables floating-point expression contraction
10532 such as forming of fused multiply-add operations if the target has
10533 native support for them.
10534 @option{-ffp-contract=on} enables floating-point expression contraction
10535 if allowed by the language standard. This is currently not implemented
10536 and treated equal to @option{-ffp-contract=off}.
10538 The default is @option{-ffp-contract=fast}.
10540 @item -fomit-frame-pointer
10541 @opindex fomit-frame-pointer
10542 Omit the frame pointer in functions that don't need one. This avoids the
10543 instructions to save, set up and restore the frame pointer; on many targets
10544 it also makes an extra register available.
10546 On some targets this flag has no effect because the standard calling sequence
10547 always uses a frame pointer, so it cannot be omitted.
10549 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
10550 is used in all functions. Several targets always omit the frame pointer in
10553 Enabled by default at @option{-O1} and higher.
10555 @item -foptimize-sibling-calls
10556 @opindex foptimize-sibling-calls
10557 Optimize sibling and tail recursive calls.
10559 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10561 @item -foptimize-strlen
10562 @opindex foptimize-strlen
10563 Optimize various standard C string functions (e.g.@: @code{strlen},
10564 @code{strchr} or @code{strcpy}) and
10565 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
10567 Enabled at levels @option{-O2}, @option{-O3}.
10570 @opindex fno-inline
10572 Do not expand any functions inline apart from those marked with
10573 the @code{always_inline} attribute. This is the default when not
10576 Single functions can be exempted from inlining by marking them
10577 with the @code{noinline} attribute.
10579 @item -finline-small-functions
10580 @opindex finline-small-functions
10581 Integrate functions into their callers when their body is smaller than expected
10582 function call code (so overall size of program gets smaller). The compiler
10583 heuristically decides which functions are simple enough to be worth integrating
10584 in this way. This inlining applies to all functions, even those not declared
10587 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10589 @item -findirect-inlining
10590 @opindex findirect-inlining
10591 Inline also indirect calls that are discovered to be known at compile
10592 time thanks to previous inlining. This option has any effect only
10593 when inlining itself is turned on by the @option{-finline-functions}
10594 or @option{-finline-small-functions} options.
10596 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10598 @item -finline-functions
10599 @opindex finline-functions
10600 Consider all functions for inlining, even if they are not declared inline.
10601 The compiler heuristically decides which functions are worth integrating
10604 If all calls to a given function are integrated, and the function is
10605 declared @code{static}, then the function is normally not output as
10606 assembler code in its own right.
10608 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
10609 by @option{-fprofile-use} and @option{-fauto-profile}.
10611 @item -finline-functions-called-once
10612 @opindex finline-functions-called-once
10613 Consider all @code{static} functions called once for inlining into their
10614 caller even if they are not marked @code{inline}. If a call to a given
10615 function is integrated, then the function is not output as assembler code
10618 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
10619 but not @option{-Og}.
10621 @item -fearly-inlining
10622 @opindex fearly-inlining
10623 Inline functions marked by @code{always_inline} and functions whose body seems
10624 smaller than the function call overhead early before doing
10625 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
10626 makes profiling significantly cheaper and usually inlining faster on programs
10627 having large chains of nested wrapper functions.
10629 Enabled by default.
10633 Perform interprocedural scalar replacement of aggregates, removal of
10634 unused parameters and replacement of parameters passed by reference
10635 by parameters passed by value.
10637 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
10639 @item -finline-limit=@var{n}
10640 @opindex finline-limit
10641 By default, GCC limits the size of functions that can be inlined. This flag
10642 allows coarse control of this limit. @var{n} is the size of functions that
10643 can be inlined in number of pseudo instructions.
10645 Inlining is actually controlled by a number of parameters, which may be
10646 specified individually by using @option{--param @var{name}=@var{value}}.
10647 The @option{-finline-limit=@var{n}} option sets some of these parameters
10651 @item max-inline-insns-single
10652 is set to @var{n}/2.
10653 @item max-inline-insns-auto
10654 is set to @var{n}/2.
10657 See below for a documentation of the individual
10658 parameters controlling inlining and for the defaults of these parameters.
10660 @emph{Note:} there may be no value to @option{-finline-limit} that results
10661 in default behavior.
10663 @emph{Note:} pseudo instruction represents, in this particular context, an
10664 abstract measurement of function's size. In no way does it represent a count
10665 of assembly instructions and as such its exact meaning might change from one
10666 release to an another.
10668 @item -fno-keep-inline-dllexport
10669 @opindex fno-keep-inline-dllexport
10670 @opindex fkeep-inline-dllexport
10671 This is a more fine-grained version of @option{-fkeep-inline-functions},
10672 which applies only to functions that are declared using the @code{dllexport}
10673 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
10676 @item -fkeep-inline-functions
10677 @opindex fkeep-inline-functions
10678 In C, emit @code{static} functions that are declared @code{inline}
10679 into the object file, even if the function has been inlined into all
10680 of its callers. This switch does not affect functions using the
10681 @code{extern inline} extension in GNU C90@. In C++, emit any and all
10682 inline functions into the object file.
10684 @item -fkeep-static-functions
10685 @opindex fkeep-static-functions
10686 Emit @code{static} functions into the object file, even if the function
10689 @item -fkeep-static-consts
10690 @opindex fkeep-static-consts
10691 Emit variables declared @code{static const} when optimization isn't turned
10692 on, even if the variables aren't referenced.
10694 GCC enables this option by default. If you want to force the compiler to
10695 check if a variable is referenced, regardless of whether or not
10696 optimization is turned on, use the @option{-fno-keep-static-consts} option.
10698 @item -fmerge-constants
10699 @opindex fmerge-constants
10700 Attempt to merge identical constants (string constants and floating-point
10701 constants) across compilation units.
10703 This option is the default for optimized compilation if the assembler and
10704 linker support it. Use @option{-fno-merge-constants} to inhibit this
10707 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
10709 @item -fmerge-all-constants
10710 @opindex fmerge-all-constants
10711 Attempt to merge identical constants and identical variables.
10713 This option implies @option{-fmerge-constants}. In addition to
10714 @option{-fmerge-constants} this considers e.g.@: even constant initialized
10715 arrays or initialized constant variables with integral or floating-point
10716 types. Languages like C or C++ require each variable, including multiple
10717 instances of the same variable in recursive calls, to have distinct locations,
10718 so using this option results in non-conforming
10721 @item -fmodulo-sched
10722 @opindex fmodulo-sched
10723 Perform swing modulo scheduling immediately before the first scheduling
10724 pass. This pass looks at innermost loops and reorders their
10725 instructions by overlapping different iterations.
10727 @item -fmodulo-sched-allow-regmoves
10728 @opindex fmodulo-sched-allow-regmoves
10729 Perform more aggressive SMS-based modulo scheduling with register moves
10730 allowed. By setting this flag certain anti-dependences edges are
10731 deleted, which triggers the generation of reg-moves based on the
10732 life-range analysis. This option is effective only with
10733 @option{-fmodulo-sched} enabled.
10735 @item -fno-branch-count-reg
10736 @opindex fno-branch-count-reg
10737 @opindex fbranch-count-reg
10738 Disable the optimization pass that scans for opportunities to use
10739 ``decrement and branch'' instructions on a count register instead of
10740 instruction sequences that decrement a register, compare it against zero, and
10741 then branch based upon the result. This option is only meaningful on
10742 architectures that support such instructions, which include x86, PowerPC,
10743 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
10744 doesn't remove the decrement and branch instructions from the generated
10745 instruction stream introduced by other optimization passes.
10747 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
10748 except for @option{-Og}.
10750 @item -fno-function-cse
10751 @opindex fno-function-cse
10752 @opindex ffunction-cse
10753 Do not put function addresses in registers; make each instruction that
10754 calls a constant function contain the function's address explicitly.
10756 This option results in less efficient code, but some strange hacks
10757 that alter the assembler output may be confused by the optimizations
10758 performed when this option is not used.
10760 The default is @option{-ffunction-cse}
10762 @item -fno-zero-initialized-in-bss
10763 @opindex fno-zero-initialized-in-bss
10764 @opindex fzero-initialized-in-bss
10765 If the target supports a BSS section, GCC by default puts variables that
10766 are initialized to zero into BSS@. This can save space in the resulting
10769 This option turns off this behavior because some programs explicitly
10770 rely on variables going to the data section---e.g., so that the
10771 resulting executable can find the beginning of that section and/or make
10772 assumptions based on that.
10774 The default is @option{-fzero-initialized-in-bss}.
10776 @item -fthread-jumps
10777 @opindex fthread-jumps
10778 Perform optimizations that check to see if a jump branches to a
10779 location where another comparison subsumed by the first is found. If
10780 so, the first branch is redirected to either the destination of the
10781 second branch or a point immediately following it, depending on whether
10782 the condition is known to be true or false.
10784 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
10786 @item -fsplit-wide-types
10787 @opindex fsplit-wide-types
10788 When using a type that occupies multiple registers, such as @code{long
10789 long} on a 32-bit system, split the registers apart and allocate them
10790 independently. This normally generates better code for those types,
10791 but may make debugging more difficult.
10793 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
10796 @item -fsplit-wide-types-early
10797 @opindex fsplit-wide-types-early
10798 Fully split wide types early, instead of very late.
10799 This option has no effect unless @option{-fsplit-wide-types} is turned on.
10801 This is the default on some targets.
10803 @item -fcse-follow-jumps
10804 @opindex fcse-follow-jumps
10805 In common subexpression elimination (CSE), scan through jump instructions
10806 when the target of the jump is not reached by any other path. For
10807 example, when CSE encounters an @code{if} statement with an
10808 @code{else} clause, CSE follows the jump when the condition
10811 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10813 @item -fcse-skip-blocks
10814 @opindex fcse-skip-blocks
10815 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
10816 follow jumps that conditionally skip over blocks. When CSE
10817 encounters a simple @code{if} statement with no else clause,
10818 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
10819 body of the @code{if}.
10821 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10823 @item -frerun-cse-after-loop
10824 @opindex frerun-cse-after-loop
10825 Re-run common subexpression elimination after loop optimizations are
10828 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10832 Perform a global common subexpression elimination pass.
10833 This pass also performs global constant and copy propagation.
10835 @emph{Note:} When compiling a program using computed gotos, a GCC
10836 extension, you may get better run-time performance if you disable
10837 the global common subexpression elimination pass by adding
10838 @option{-fno-gcse} to the command line.
10840 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10844 When @option{-fgcse-lm} is enabled, global common subexpression elimination
10845 attempts to move loads that are only killed by stores into themselves. This
10846 allows a loop containing a load/store sequence to be changed to a load outside
10847 the loop, and a copy/store within the loop.
10849 Enabled by default when @option{-fgcse} is enabled.
10853 When @option{-fgcse-sm} is enabled, a store motion pass is run after
10854 global common subexpression elimination. This pass attempts to move
10855 stores out of loops. When used in conjunction with @option{-fgcse-lm},
10856 loops containing a load/store sequence can be changed to a load before
10857 the loop and a store after the loop.
10859 Not enabled at any optimization level.
10863 When @option{-fgcse-las} is enabled, the global common subexpression
10864 elimination pass eliminates redundant loads that come after stores to the
10865 same memory location (both partial and full redundancies).
10867 Not enabled at any optimization level.
10869 @item -fgcse-after-reload
10870 @opindex fgcse-after-reload
10871 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
10872 pass is performed after reload. The purpose of this pass is to clean up
10873 redundant spilling.
10875 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
10877 @item -faggressive-loop-optimizations
10878 @opindex faggressive-loop-optimizations
10879 This option tells the loop optimizer to use language constraints to
10880 derive bounds for the number of iterations of a loop. This assumes that
10881 loop code does not invoke undefined behavior by for example causing signed
10882 integer overflows or out-of-bound array accesses. The bounds for the
10883 number of iterations of a loop are used to guide loop unrolling and peeling
10884 and loop exit test optimizations.
10885 This option is enabled by default.
10887 @item -funconstrained-commons
10888 @opindex funconstrained-commons
10889 This option tells the compiler that variables declared in common blocks
10890 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
10891 prevents certain optimizations that depend on knowing the array bounds.
10893 @item -fcrossjumping
10894 @opindex fcrossjumping
10895 Perform cross-jumping transformation.
10896 This transformation unifies equivalent code and saves code size. The
10897 resulting code may or may not perform better than without cross-jumping.
10899 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10901 @item -fauto-inc-dec
10902 @opindex fauto-inc-dec
10903 Combine increments or decrements of addresses with memory accesses.
10904 This pass is always skipped on architectures that do not have
10905 instructions to support this. Enabled by default at @option{-O1} and
10906 higher on architectures that support this.
10910 Perform dead code elimination (DCE) on RTL@.
10911 Enabled by default at @option{-O1} and higher.
10915 Perform dead store elimination (DSE) on RTL@.
10916 Enabled by default at @option{-O1} and higher.
10918 @item -fif-conversion
10919 @opindex fif-conversion
10920 Attempt to transform conditional jumps into branch-less equivalents. This
10921 includes use of conditional moves, min, max, set flags and abs instructions, and
10922 some tricks doable by standard arithmetics. The use of conditional execution
10923 on chips where it is available is controlled by @option{-fif-conversion2}.
10925 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
10926 not with @option{-Og}.
10928 @item -fif-conversion2
10929 @opindex fif-conversion2
10930 Use conditional execution (where available) to transform conditional jumps into
10931 branch-less equivalents.
10933 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
10934 not with @option{-Og}.
10936 @item -fdeclone-ctor-dtor
10937 @opindex fdeclone-ctor-dtor
10938 The C++ ABI requires multiple entry points for constructors and
10939 destructors: one for a base subobject, one for a complete object, and
10940 one for a virtual destructor that calls operator delete afterwards.
10941 For a hierarchy with virtual bases, the base and complete variants are
10942 clones, which means two copies of the function. With this option, the
10943 base and complete variants are changed to be thunks that call a common
10946 Enabled by @option{-Os}.
10948 @item -fdelete-null-pointer-checks
10949 @opindex fdelete-null-pointer-checks
10950 Assume that programs cannot safely dereference null pointers, and that
10951 no code or data element resides at address zero.
10952 This option enables simple constant
10953 folding optimizations at all optimization levels. In addition, other
10954 optimization passes in GCC use this flag to control global dataflow
10955 analyses that eliminate useless checks for null pointers; these assume
10956 that a memory access to address zero always results in a trap, so
10957 that if a pointer is checked after it has already been dereferenced,
10960 Note however that in some environments this assumption is not true.
10961 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
10962 for programs that depend on that behavior.
10964 This option is enabled by default on most targets. On Nios II ELF, it
10965 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
10967 Passes that use the dataflow information
10968 are enabled independently at different optimization levels.
10970 @item -fdevirtualize
10971 @opindex fdevirtualize
10972 Attempt to convert calls to virtual functions to direct calls. This
10973 is done both within a procedure and interprocedurally as part of
10974 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
10975 propagation (@option{-fipa-cp}).
10976 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10978 @item -fdevirtualize-speculatively
10979 @opindex fdevirtualize-speculatively
10980 Attempt to convert calls to virtual functions to speculative direct calls.
10981 Based on the analysis of the type inheritance graph, determine for a given call
10982 the set of likely targets. If the set is small, preferably of size 1, change
10983 the call into a conditional deciding between direct and indirect calls. The
10984 speculative calls enable more optimizations, such as inlining. When they seem
10985 useless after further optimization, they are converted back into original form.
10987 @item -fdevirtualize-at-ltrans
10988 @opindex fdevirtualize-at-ltrans
10989 Stream extra information needed for aggressive devirtualization when running
10990 the link-time optimizer in local transformation mode.
10991 This option enables more devirtualization but
10992 significantly increases the size of streamed data. For this reason it is
10993 disabled by default.
10995 @item -fexpensive-optimizations
10996 @opindex fexpensive-optimizations
10997 Perform a number of minor optimizations that are relatively expensive.
10999 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11003 Attempt to remove redundant extension instructions. This is especially
11004 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
11005 registers after writing to their lower 32-bit half.
11007 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
11008 @option{-O3}, @option{-Os}.
11010 @item -fno-lifetime-dse
11011 @opindex fno-lifetime-dse
11012 @opindex flifetime-dse
11013 In C++ the value of an object is only affected by changes within its
11014 lifetime: when the constructor begins, the object has an indeterminate
11015 value, and any changes during the lifetime of the object are dead when
11016 the object is destroyed. Normally dead store elimination will take
11017 advantage of this; if your code relies on the value of the object
11018 storage persisting beyond the lifetime of the object, you can use this
11019 flag to disable this optimization. To preserve stores before the
11020 constructor starts (e.g.@: because your operator new clears the object
11021 storage) but still treat the object as dead after the destructor, you
11022 can use @option{-flifetime-dse=1}. The default behavior can be
11023 explicitly selected with @option{-flifetime-dse=2}.
11024 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
11026 @item -flive-range-shrinkage
11027 @opindex flive-range-shrinkage
11028 Attempt to decrease register pressure through register live range
11029 shrinkage. This is helpful for fast processors with small or moderate
11030 size register sets.
11032 @item -fira-algorithm=@var{algorithm}
11033 @opindex fira-algorithm
11034 Use the specified coloring algorithm for the integrated register
11035 allocator. The @var{algorithm} argument can be @samp{priority}, which
11036 specifies Chow's priority coloring, or @samp{CB}, which specifies
11037 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
11038 for all architectures, but for those targets that do support it, it is
11039 the default because it generates better code.
11041 @item -fira-region=@var{region}
11042 @opindex fira-region
11043 Use specified regions for the integrated register allocator. The
11044 @var{region} argument should be one of the following:
11049 Use all loops as register allocation regions.
11050 This can give the best results for machines with a small and/or
11051 irregular register set.
11054 Use all loops except for loops with small register pressure
11055 as the regions. This value usually gives
11056 the best results in most cases and for most architectures,
11057 and is enabled by default when compiling with optimization for speed
11058 (@option{-O}, @option{-O2}, @dots{}).
11061 Use all functions as a single region.
11062 This typically results in the smallest code size, and is enabled by default for
11063 @option{-Os} or @option{-O0}.
11067 @item -fira-hoist-pressure
11068 @opindex fira-hoist-pressure
11069 Use IRA to evaluate register pressure in the code hoisting pass for
11070 decisions to hoist expressions. This option usually results in smaller
11071 code, but it can slow the compiler down.
11073 This option is enabled at level @option{-Os} for all targets.
11075 @item -fira-loop-pressure
11076 @opindex fira-loop-pressure
11077 Use IRA to evaluate register pressure in loops for decisions to move
11078 loop invariants. This option usually results in generation
11079 of faster and smaller code on machines with large register files (>= 32
11080 registers), but it can slow the compiler down.
11082 This option is enabled at level @option{-O3} for some targets.
11084 @item -fno-ira-share-save-slots
11085 @opindex fno-ira-share-save-slots
11086 @opindex fira-share-save-slots
11087 Disable sharing of stack slots used for saving call-used hard
11088 registers living through a call. Each hard register gets a
11089 separate stack slot, and as a result function stack frames are
11092 @item -fno-ira-share-spill-slots
11093 @opindex fno-ira-share-spill-slots
11094 @opindex fira-share-spill-slots
11095 Disable sharing of stack slots allocated for pseudo-registers. Each
11096 pseudo-register that does not get a hard register gets a separate
11097 stack slot, and as a result function stack frames are larger.
11100 @opindex flra-remat
11101 Enable CFG-sensitive rematerialization in LRA. Instead of loading
11102 values of spilled pseudos, LRA tries to rematerialize (recalculate)
11103 values if it is profitable.
11105 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11107 @item -fdelayed-branch
11108 @opindex fdelayed-branch
11109 If supported for the target machine, attempt to reorder instructions
11110 to exploit instruction slots available after delayed branch
11113 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
11114 but not at @option{-Og}.
11116 @item -fschedule-insns
11117 @opindex fschedule-insns
11118 If supported for the target machine, attempt to reorder instructions to
11119 eliminate execution stalls due to required data being unavailable. This
11120 helps machines that have slow floating point or memory load instructions
11121 by allowing other instructions to be issued until the result of the load
11122 or floating-point instruction is required.
11124 Enabled at levels @option{-O2}, @option{-O3}.
11126 @item -fschedule-insns2
11127 @opindex fschedule-insns2
11128 Similar to @option{-fschedule-insns}, but requests an additional pass of
11129 instruction scheduling after register allocation has been done. This is
11130 especially useful on machines with a relatively small number of
11131 registers and where memory load instructions take more than one cycle.
11133 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11135 @item -fno-sched-interblock
11136 @opindex fno-sched-interblock
11137 @opindex fsched-interblock
11138 Disable instruction scheduling across basic blocks, which
11139 is normally enabled when scheduling before register allocation, i.e.@:
11140 with @option{-fschedule-insns} or at @option{-O2} or higher.
11142 @item -fno-sched-spec
11143 @opindex fno-sched-spec
11144 @opindex fsched-spec
11145 Disable speculative motion of non-load instructions, which
11146 is normally enabled when scheduling before register allocation, i.e.@:
11147 with @option{-fschedule-insns} or at @option{-O2} or higher.
11149 @item -fsched-pressure
11150 @opindex fsched-pressure
11151 Enable register pressure sensitive insn scheduling before register
11152 allocation. This only makes sense when scheduling before register
11153 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
11154 @option{-O2} or higher. Usage of this option can improve the
11155 generated code and decrease its size by preventing register pressure
11156 increase above the number of available hard registers and subsequent
11157 spills in register allocation.
11159 @item -fsched-spec-load
11160 @opindex fsched-spec-load
11161 Allow speculative motion of some load instructions. This only makes
11162 sense when scheduling before register allocation, i.e.@: with
11163 @option{-fschedule-insns} or at @option{-O2} or higher.
11165 @item -fsched-spec-load-dangerous
11166 @opindex fsched-spec-load-dangerous
11167 Allow speculative motion of more load instructions. This only makes
11168 sense when scheduling before register allocation, i.e.@: with
11169 @option{-fschedule-insns} or at @option{-O2} or higher.
11171 @item -fsched-stalled-insns
11172 @itemx -fsched-stalled-insns=@var{n}
11173 @opindex fsched-stalled-insns
11174 Define how many insns (if any) can be moved prematurely from the queue
11175 of stalled insns into the ready list during the second scheduling pass.
11176 @option{-fno-sched-stalled-insns} means that no insns are moved
11177 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
11178 on how many queued insns can be moved prematurely.
11179 @option{-fsched-stalled-insns} without a value is equivalent to
11180 @option{-fsched-stalled-insns=1}.
11182 @item -fsched-stalled-insns-dep
11183 @itemx -fsched-stalled-insns-dep=@var{n}
11184 @opindex fsched-stalled-insns-dep
11185 Define how many insn groups (cycles) are examined for a dependency
11186 on a stalled insn that is a candidate for premature removal from the queue
11187 of stalled insns. This has an effect only during the second scheduling pass,
11188 and only if @option{-fsched-stalled-insns} is used.
11189 @option{-fno-sched-stalled-insns-dep} is equivalent to
11190 @option{-fsched-stalled-insns-dep=0}.
11191 @option{-fsched-stalled-insns-dep} without a value is equivalent to
11192 @option{-fsched-stalled-insns-dep=1}.
11194 @item -fsched2-use-superblocks
11195 @opindex fsched2-use-superblocks
11196 When scheduling after register allocation, use superblock scheduling.
11197 This allows motion across basic block boundaries,
11198 resulting in faster schedules. This option is experimental, as not all machine
11199 descriptions used by GCC model the CPU closely enough to avoid unreliable
11200 results from the algorithm.
11202 This only makes sense when scheduling after register allocation, i.e.@: with
11203 @option{-fschedule-insns2} or at @option{-O2} or higher.
11205 @item -fsched-group-heuristic
11206 @opindex fsched-group-heuristic
11207 Enable the group heuristic in the scheduler. This heuristic favors
11208 the instruction that belongs to a schedule group. This is enabled
11209 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11210 or @option{-fschedule-insns2} or at @option{-O2} or higher.
11212 @item -fsched-critical-path-heuristic
11213 @opindex fsched-critical-path-heuristic
11214 Enable the critical-path heuristic in the scheduler. This heuristic favors
11215 instructions on the critical path. This is enabled by default when
11216 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11217 or @option{-fschedule-insns2} or at @option{-O2} or higher.
11219 @item -fsched-spec-insn-heuristic
11220 @opindex fsched-spec-insn-heuristic
11221 Enable the speculative instruction heuristic in the scheduler. This
11222 heuristic favors speculative instructions with greater dependency weakness.
11223 This is enabled by default when scheduling is enabled, i.e.@:
11224 with @option{-fschedule-insns} or @option{-fschedule-insns2}
11225 or at @option{-O2} or higher.
11227 @item -fsched-rank-heuristic
11228 @opindex fsched-rank-heuristic
11229 Enable the rank heuristic in the scheduler. This heuristic favors
11230 the instruction belonging to a basic block with greater size or frequency.
11231 This is enabled by default when scheduling is enabled, i.e.@:
11232 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11233 at @option{-O2} or higher.
11235 @item -fsched-last-insn-heuristic
11236 @opindex fsched-last-insn-heuristic
11237 Enable the last-instruction heuristic in the scheduler. This heuristic
11238 favors the instruction that is less dependent on the last instruction
11239 scheduled. This is enabled by default when scheduling is enabled,
11240 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11241 at @option{-O2} or higher.
11243 @item -fsched-dep-count-heuristic
11244 @opindex fsched-dep-count-heuristic
11245 Enable the dependent-count heuristic in the scheduler. This heuristic
11246 favors the instruction that has more instructions depending on it.
11247 This is enabled by default when scheduling is enabled, i.e.@:
11248 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11249 at @option{-O2} or higher.
11251 @item -freschedule-modulo-scheduled-loops
11252 @opindex freschedule-modulo-scheduled-loops
11253 Modulo scheduling is performed before traditional scheduling. If a loop
11254 is modulo scheduled, later scheduling passes may change its schedule.
11255 Use this option to control that behavior.
11257 @item -fselective-scheduling
11258 @opindex fselective-scheduling
11259 Schedule instructions using selective scheduling algorithm. Selective
11260 scheduling runs instead of the first scheduler pass.
11262 @item -fselective-scheduling2
11263 @opindex fselective-scheduling2
11264 Schedule instructions using selective scheduling algorithm. Selective
11265 scheduling runs instead of the second scheduler pass.
11267 @item -fsel-sched-pipelining
11268 @opindex fsel-sched-pipelining
11269 Enable software pipelining of innermost loops during selective scheduling.
11270 This option has no effect unless one of @option{-fselective-scheduling} or
11271 @option{-fselective-scheduling2} is turned on.
11273 @item -fsel-sched-pipelining-outer-loops
11274 @opindex fsel-sched-pipelining-outer-loops
11275 When pipelining loops during selective scheduling, also pipeline outer loops.
11276 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
11278 @item -fsemantic-interposition
11279 @opindex fsemantic-interposition
11280 Some object formats, like ELF, allow interposing of symbols by the
11282 This means that for symbols exported from the DSO, the compiler cannot perform
11283 interprocedural propagation, inlining and other optimizations in anticipation
11284 that the function or variable in question may change. While this feature is
11285 useful, for example, to rewrite memory allocation functions by a debugging
11286 implementation, it is expensive in the terms of code quality.
11287 With @option{-fno-semantic-interposition} the compiler assumes that
11288 if interposition happens for functions the overwriting function will have
11289 precisely the same semantics (and side effects).
11290 Similarly if interposition happens
11291 for variables, the constructor of the variable will be the same. The flag
11292 has no effect for functions explicitly declared inline
11293 (where it is never allowed for interposition to change semantics)
11294 and for symbols explicitly declared weak.
11296 @item -fshrink-wrap
11297 @opindex fshrink-wrap
11298 Emit function prologues only before parts of the function that need it,
11299 rather than at the top of the function. This flag is enabled by default at
11300 @option{-O} and higher.
11302 @item -fshrink-wrap-separate
11303 @opindex fshrink-wrap-separate
11304 Shrink-wrap separate parts of the prologue and epilogue separately, so that
11305 those parts are only executed when needed.
11306 This option is on by default, but has no effect unless @option{-fshrink-wrap}
11307 is also turned on and the target supports this.
11309 @item -fcaller-saves
11310 @opindex fcaller-saves
11311 Enable allocation of values to registers that are clobbered by
11312 function calls, by emitting extra instructions to save and restore the
11313 registers around such calls. Such allocation is done only when it
11314 seems to result in better code.
11316 This option is always enabled by default on certain machines, usually
11317 those which have no call-preserved registers to use instead.
11319 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11321 @item -fcombine-stack-adjustments
11322 @opindex fcombine-stack-adjustments
11323 Tracks stack adjustments (pushes and pops) and stack memory references
11324 and then tries to find ways to combine them.
11326 Enabled by default at @option{-O1} and higher.
11330 Use caller save registers for allocation if those registers are not used by
11331 any called function. In that case it is not necessary to save and restore
11332 them around calls. This is only possible if called functions are part of
11333 same compilation unit as current function and they are compiled before it.
11335 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
11336 is disabled if generated code will be instrumented for profiling
11337 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
11338 exactly (this happens on targets that do not expose prologues
11339 and epilogues in RTL).
11341 @item -fconserve-stack
11342 @opindex fconserve-stack
11343 Attempt to minimize stack usage. The compiler attempts to use less
11344 stack space, even if that makes the program slower. This option
11345 implies setting the @option{large-stack-frame} parameter to 100
11346 and the @option{large-stack-frame-growth} parameter to 400.
11348 @item -ftree-reassoc
11349 @opindex ftree-reassoc
11350 Perform reassociation on trees. This flag is enabled by default
11351 at @option{-O1} and higher.
11353 @item -fcode-hoisting
11354 @opindex fcode-hoisting
11355 Perform code hoisting. Code hoisting tries to move the
11356 evaluation of expressions executed on all paths to the function exit
11357 as early as possible. This is especially useful as a code size
11358 optimization, but it often helps for code speed as well.
11359 This flag is enabled by default at @option{-O2} and higher.
11363 Perform partial redundancy elimination (PRE) on trees. This flag is
11364 enabled by default at @option{-O2} and @option{-O3}.
11366 @item -ftree-partial-pre
11367 @opindex ftree-partial-pre
11368 Make partial redundancy elimination (PRE) more aggressive. This flag is
11369 enabled by default at @option{-O3}.
11371 @item -ftree-forwprop
11372 @opindex ftree-forwprop
11373 Perform forward propagation on trees. This flag is enabled by default
11374 at @option{-O1} and higher.
11378 Perform full redundancy elimination (FRE) on trees. The difference
11379 between FRE and PRE is that FRE only considers expressions
11380 that are computed on all paths leading to the redundant computation.
11381 This analysis is faster than PRE, though it exposes fewer redundancies.
11382 This flag is enabled by default at @option{-O1} and higher.
11384 @item -ftree-phiprop
11385 @opindex ftree-phiprop
11386 Perform hoisting of loads from conditional pointers on trees. This
11387 pass is enabled by default at @option{-O1} and higher.
11389 @item -fhoist-adjacent-loads
11390 @opindex fhoist-adjacent-loads
11391 Speculatively hoist loads from both branches of an if-then-else if the
11392 loads are from adjacent locations in the same structure and the target
11393 architecture has a conditional move instruction. This flag is enabled
11394 by default at @option{-O2} and higher.
11396 @item -ftree-copy-prop
11397 @opindex ftree-copy-prop
11398 Perform copy propagation on trees. This pass eliminates unnecessary
11399 copy operations. This flag is enabled by default at @option{-O1} and
11402 @item -fipa-pure-const
11403 @opindex fipa-pure-const
11404 Discover which functions are pure or constant.
11405 Enabled by default at @option{-O1} and higher.
11407 @item -fipa-reference
11408 @opindex fipa-reference
11409 Discover which static variables do not escape the
11411 Enabled by default at @option{-O1} and higher.
11413 @item -fipa-reference-addressable
11414 @opindex fipa-reference-addressable
11415 Discover read-only, write-only and non-addressable static variables.
11416 Enabled by default at @option{-O1} and higher.
11418 @item -fipa-stack-alignment
11419 @opindex fipa-stack-alignment
11420 Reduce stack alignment on call sites if possible.
11421 Enabled by default.
11425 Perform interprocedural pointer analysis and interprocedural modification
11426 and reference analysis. This option can cause excessive memory and
11427 compile-time usage on large compilation units. It is not enabled by
11428 default at any optimization level.
11430 @item -fipa-profile
11431 @opindex fipa-profile
11432 Perform interprocedural profile propagation. The functions called only from
11433 cold functions are marked as cold. Also functions executed once (such as
11434 @code{cold}, @code{noreturn}, static constructors or destructors) are
11435 identified. Cold functions and loop less parts of functions executed once are
11436 then optimized for size.
11437 Enabled by default at @option{-O1} and higher.
11440 @opindex fipa-modref
11441 Perform interprocedural mod/ref analysis. This optimization analyzes the side
11442 effects of functions (memory locations that are modified or referenced) and
11443 enables better optimization across the function call boundary. This flag is
11444 enabled by default at @option{-O1} and higher.
11448 Perform interprocedural constant propagation.
11449 This optimization analyzes the program to determine when values passed
11450 to functions are constants and then optimizes accordingly.
11451 This optimization can substantially increase performance
11452 if the application has constants passed to functions.
11453 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
11454 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11456 @item -fipa-cp-clone
11457 @opindex fipa-cp-clone
11458 Perform function cloning to make interprocedural constant propagation stronger.
11459 When enabled, interprocedural constant propagation performs function cloning
11460 when externally visible function can be called with constant arguments.
11461 Because this optimization can create multiple copies of functions,
11462 it may significantly increase code size
11463 (see @option{--param ipa-cp-unit-growth=@var{value}}).
11464 This flag is enabled by default at @option{-O3}.
11465 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11468 @opindex fipa-bit-cp
11469 When enabled, perform interprocedural bitwise constant
11470 propagation. This flag is enabled by default at @option{-O2} and
11471 by @option{-fprofile-use} and @option{-fauto-profile}.
11472 It requires that @option{-fipa-cp} is enabled.
11476 When enabled, perform interprocedural propagation of value
11477 ranges. This flag is enabled by default at @option{-O2}. It requires
11478 that @option{-fipa-cp} is enabled.
11482 Perform Identical Code Folding for functions and read-only variables.
11483 The optimization reduces code size and may disturb unwind stacks by replacing
11484 a function by equivalent one with a different name. The optimization works
11485 more effectively with link-time optimization enabled.
11487 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
11488 works on different levels and thus the optimizations are not same - there are
11489 equivalences that are found only by GCC and equivalences found only by Gold.
11491 This flag is enabled by default at @option{-O2} and @option{-Os}.
11493 @item -flive-patching=@var{level}
11494 @opindex flive-patching
11495 Control GCC's optimizations to produce output suitable for live-patching.
11497 If the compiler's optimization uses a function's body or information extracted
11498 from its body to optimize/change another function, the latter is called an
11499 impacted function of the former. If a function is patched, its impacted
11500 functions should be patched too.
11502 The impacted functions are determined by the compiler's interprocedural
11503 optimizations. For example, a caller is impacted when inlining a function
11505 cloning a function and changing its caller to call this new clone,
11506 or extracting a function's pureness/constness information to optimize
11507 its direct or indirect callers, etc.
11509 Usually, the more IPA optimizations enabled, the larger the number of
11510 impacted functions for each function. In order to control the number of
11511 impacted functions and more easily compute the list of impacted function,
11512 IPA optimizations can be partially enabled at two different levels.
11514 The @var{level} argument should be one of the following:
11520 Only enable inlining and cloning optimizations, which includes inlining,
11521 cloning, interprocedural scalar replacement of aggregates and partial inlining.
11522 As a result, when patching a function, all its callers and its clones'
11523 callers are impacted, therefore need to be patched as well.
11525 @option{-flive-patching=inline-clone} disables the following optimization flags:
11526 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
11527 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
11528 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
11529 -fipa-stack-alignment -fipa-modref}
11531 @item inline-only-static
11533 Only enable inlining of static functions.
11534 As a result, when patching a static function, all its callers are impacted
11535 and so need to be patched as well.
11537 In addition to all the flags that @option{-flive-patching=inline-clone}
11539 @option{-flive-patching=inline-only-static} disables the following additional
11540 optimization flags:
11541 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
11545 When @option{-flive-patching} is specified without any value, the default value
11546 is @var{inline-clone}.
11548 This flag is disabled by default.
11550 Note that @option{-flive-patching} is not supported with link-time optimization
11553 @item -fisolate-erroneous-paths-dereference
11554 @opindex fisolate-erroneous-paths-dereference
11555 Detect paths that trigger erroneous or undefined behavior due to
11556 dereferencing a null pointer. Isolate those paths from the main control
11557 flow and turn the statement with erroneous or undefined behavior into a trap.
11558 This flag is enabled by default at @option{-O2} and higher and depends on
11559 @option{-fdelete-null-pointer-checks} also being enabled.
11561 @item -fisolate-erroneous-paths-attribute
11562 @opindex fisolate-erroneous-paths-attribute
11563 Detect paths that trigger erroneous or undefined behavior due to a null value
11564 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
11565 attribute. Isolate those paths from the main control flow and turn the
11566 statement with erroneous or undefined behavior into a trap. This is not
11567 currently enabled, but may be enabled by @option{-O2} in the future.
11570 @opindex ftree-sink
11571 Perform forward store motion on trees. This flag is
11572 enabled by default at @option{-O1} and higher.
11574 @item -ftree-bit-ccp
11575 @opindex ftree-bit-ccp
11576 Perform sparse conditional bit constant propagation on trees and propagate
11577 pointer alignment information.
11578 This pass only operates on local scalar variables and is enabled by default
11579 at @option{-O1} and higher, except for @option{-Og}.
11580 It requires that @option{-ftree-ccp} is enabled.
11584 Perform sparse conditional constant propagation (CCP) on trees. This
11585 pass only operates on local scalar variables and is enabled by default
11586 at @option{-O1} and higher.
11588 @item -fssa-backprop
11589 @opindex fssa-backprop
11590 Propagate information about uses of a value up the definition chain
11591 in order to simplify the definitions. For example, this pass strips
11592 sign operations if the sign of a value never matters. The flag is
11593 enabled by default at @option{-O1} and higher.
11596 @opindex fssa-phiopt
11597 Perform pattern matching on SSA PHI nodes to optimize conditional
11598 code. This pass is enabled by default at @option{-O1} and higher,
11599 except for @option{-Og}.
11601 @item -ftree-switch-conversion
11602 @opindex ftree-switch-conversion
11603 Perform conversion of simple initializations in a switch to
11604 initializations from a scalar array. This flag is enabled by default
11605 at @option{-O2} and higher.
11607 @item -ftree-tail-merge
11608 @opindex ftree-tail-merge
11609 Look for identical code sequences. When found, replace one with a jump to the
11610 other. This optimization is known as tail merging or cross jumping. This flag
11611 is enabled by default at @option{-O2} and higher. The compilation time
11613 be limited using @option{max-tail-merge-comparisons} parameter and
11614 @option{max-tail-merge-iterations} parameter.
11618 Perform dead code elimination (DCE) on trees. This flag is enabled by
11619 default at @option{-O1} and higher.
11621 @item -ftree-builtin-call-dce
11622 @opindex ftree-builtin-call-dce
11623 Perform conditional dead code elimination (DCE) for calls to built-in functions
11624 that may set @code{errno} but are otherwise free of side effects. This flag is
11625 enabled by default at @option{-O2} and higher if @option{-Os} is not also
11628 @item -ffinite-loops
11629 @opindex ffinite-loops
11630 @opindex fno-finite-loops
11631 Assume that a loop with an exit will eventually take the exit and not loop
11632 indefinitely. This allows the compiler to remove loops that otherwise have
11633 no side-effects, not considering eventual endless looping as such.
11635 This option is enabled by default at @option{-O2} for C++ with -std=c++11
11638 @item -ftree-dominator-opts
11639 @opindex ftree-dominator-opts
11640 Perform a variety of simple scalar cleanups (constant/copy
11641 propagation, redundancy elimination, range propagation and expression
11642 simplification) based on a dominator tree traversal. This also
11643 performs jump threading (to reduce jumps to jumps). This flag is
11644 enabled by default at @option{-O1} and higher.
11648 Perform dead store elimination (DSE) on trees. A dead store is a store into
11649 a memory location that is later overwritten by another store without
11650 any intervening loads. In this case the earlier store can be deleted. This
11651 flag is enabled by default at @option{-O1} and higher.
11655 Perform loop header copying on trees. This is beneficial since it increases
11656 effectiveness of code motion optimizations. It also saves one jump. This flag
11657 is enabled by default at @option{-O1} and higher. It is not enabled
11658 for @option{-Os}, since it usually increases code size.
11660 @item -ftree-loop-optimize
11661 @opindex ftree-loop-optimize
11662 Perform loop optimizations on trees. This flag is enabled by default
11663 at @option{-O1} and higher.
11665 @item -ftree-loop-linear
11666 @itemx -floop-strip-mine
11667 @itemx -floop-block
11668 @opindex ftree-loop-linear
11669 @opindex floop-strip-mine
11670 @opindex floop-block
11671 Perform loop nest optimizations. Same as
11672 @option{-floop-nest-optimize}. To use this code transformation, GCC has
11673 to be configured with @option{--with-isl} to enable the Graphite loop
11674 transformation infrastructure.
11676 @item -fgraphite-identity
11677 @opindex fgraphite-identity
11678 Enable the identity transformation for graphite. For every SCoP we generate
11679 the polyhedral representation and transform it back to gimple. Using
11680 @option{-fgraphite-identity} we can check the costs or benefits of the
11681 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
11682 are also performed by the code generator isl, like index splitting and
11683 dead code elimination in loops.
11685 @item -floop-nest-optimize
11686 @opindex floop-nest-optimize
11687 Enable the isl based loop nest optimizer. This is a generic loop nest
11688 optimizer based on the Pluto optimization algorithms. It calculates a loop
11689 structure optimized for data-locality and parallelism. This option
11692 @item -floop-parallelize-all
11693 @opindex floop-parallelize-all
11694 Use the Graphite data dependence analysis to identify loops that can
11695 be parallelized. Parallelize all the loops that can be analyzed to
11696 not contain loop carried dependences without checking that it is
11697 profitable to parallelize the loops.
11699 @item -ftree-coalesce-vars
11700 @opindex ftree-coalesce-vars
11701 While transforming the program out of the SSA representation, attempt to
11702 reduce copying by coalescing versions of different user-defined
11703 variables, instead of just compiler temporaries. This may severely
11704 limit the ability to debug an optimized program compiled with
11705 @option{-fno-var-tracking-assignments}. In the negated form, this flag
11706 prevents SSA coalescing of user variables. This option is enabled by
11707 default if optimization is enabled, and it does very little otherwise.
11709 @item -ftree-loop-if-convert
11710 @opindex ftree-loop-if-convert
11711 Attempt to transform conditional jumps in the innermost loops to
11712 branch-less equivalents. The intent is to remove control-flow from
11713 the innermost loops in order to improve the ability of the
11714 vectorization pass to handle these loops. This is enabled by default
11715 if vectorization is enabled.
11717 @item -ftree-loop-distribution
11718 @opindex ftree-loop-distribution
11719 Perform loop distribution. This flag can improve cache performance on
11720 big loop bodies and allow further loop optimizations, like
11721 parallelization or vectorization, to take place. For example, the loop
11737 This flag is enabled by default at @option{-O3}.
11738 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11740 @item -ftree-loop-distribute-patterns
11741 @opindex ftree-loop-distribute-patterns
11742 Perform loop distribution of patterns that can be code generated with
11743 calls to a library. This flag is enabled by default at @option{-O2} and
11744 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
11746 This pass distributes the initialization loops and generates a call to
11747 memset zero. For example, the loop
11763 and the initialization loop is transformed into a call to memset zero.
11764 This flag is enabled by default at @option{-O3}.
11765 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11767 @item -floop-interchange
11768 @opindex floop-interchange
11769 Perform loop interchange outside of graphite. This flag can improve cache
11770 performance on loop nest and allow further loop optimizations, like
11771 vectorization, to take place. For example, the loop
11773 for (int i = 0; i < N; i++)
11774 for (int j = 0; j < N; j++)
11775 for (int k = 0; k < N; k++)
11776 c[i][j] = c[i][j] + a[i][k]*b[k][j];
11780 for (int i = 0; i < N; i++)
11781 for (int k = 0; k < N; k++)
11782 for (int j = 0; j < N; j++)
11783 c[i][j] = c[i][j] + a[i][k]*b[k][j];
11785 This flag is enabled by default at @option{-O3}.
11786 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11788 @item -floop-unroll-and-jam
11789 @opindex floop-unroll-and-jam
11790 Apply unroll and jam transformations on feasible loops. In a loop
11791 nest this unrolls the outer loop by some factor and fuses the resulting
11792 multiple inner loops. This flag is enabled by default at @option{-O3}.
11793 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11795 @item -ftree-loop-im
11796 @opindex ftree-loop-im
11797 Perform loop invariant motion on trees. This pass moves only invariants that
11798 are hard to handle at RTL level (function calls, operations that expand to
11799 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
11800 operands of conditions that are invariant out of the loop, so that we can use
11801 just trivial invariantness analysis in loop unswitching. The pass also includes
11804 @item -ftree-loop-ivcanon
11805 @opindex ftree-loop-ivcanon
11806 Create a canonical counter for number of iterations in loops for which
11807 determining number of iterations requires complicated analysis. Later
11808 optimizations then may determine the number easily. Useful especially
11809 in connection with unrolling.
11811 @item -ftree-scev-cprop
11812 @opindex ftree-scev-cprop
11813 Perform final value replacement. If a variable is modified in a loop
11814 in such a way that its value when exiting the loop can be determined using
11815 only its initial value and the number of loop iterations, replace uses of
11816 the final value by such a computation, provided it is sufficiently cheap.
11817 This reduces data dependencies and may allow further simplifications.
11818 Enabled by default at @option{-O1} and higher.
11822 Perform induction variable optimizations (strength reduction, induction
11823 variable merging and induction variable elimination) on trees.
11825 @item -ftree-parallelize-loops=n
11826 @opindex ftree-parallelize-loops
11827 Parallelize loops, i.e., split their iteration space to run in n threads.
11828 This is only possible for loops whose iterations are independent
11829 and can be arbitrarily reordered. The optimization is only
11830 profitable on multiprocessor machines, for loops that are CPU-intensive,
11831 rather than constrained e.g.@: by memory bandwidth. This option
11832 implies @option{-pthread}, and thus is only supported on targets
11833 that have support for @option{-pthread}.
11837 Perform function-local points-to analysis on trees. This flag is
11838 enabled by default at @option{-O1} and higher, except for @option{-Og}.
11842 Perform scalar replacement of aggregates. This pass replaces structure
11843 references with scalars to prevent committing structures to memory too
11844 early. This flag is enabled by default at @option{-O1} and higher,
11845 except for @option{-Og}.
11847 @item -fstore-merging
11848 @opindex fstore-merging
11849 Perform merging of narrow stores to consecutive memory addresses. This pass
11850 merges contiguous stores of immediate values narrower than a word into fewer
11851 wider stores to reduce the number of instructions. This is enabled by default
11852 at @option{-O2} and higher as well as @option{-Os}.
11856 Perform temporary expression replacement during the SSA->normal phase. Single
11857 use/single def temporaries are replaced at their use location with their
11858 defining expression. This results in non-GIMPLE code, but gives the expanders
11859 much more complex trees to work on resulting in better RTL generation. This is
11860 enabled by default at @option{-O1} and higher.
11863 @opindex ftree-slsr
11864 Perform straight-line strength reduction on trees. This recognizes related
11865 expressions involving multiplications and replaces them by less expensive
11866 calculations when possible. This is enabled by default at @option{-O1} and
11869 @item -ftree-vectorize
11870 @opindex ftree-vectorize
11871 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
11872 and @option{-ftree-slp-vectorize} if not explicitly specified.
11874 @item -ftree-loop-vectorize
11875 @opindex ftree-loop-vectorize
11876 Perform loop vectorization on trees. This flag is enabled by default at
11877 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
11878 and @option{-fauto-profile}.
11880 @item -ftree-slp-vectorize
11881 @opindex ftree-slp-vectorize
11882 Perform basic block vectorization on trees. This flag is enabled by default at
11883 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
11884 and @option{-fauto-profile}.
11886 @item -ftrivial-auto-var-init=@var{choice}
11887 @opindex ftrivial-auto-var-init
11888 Initialize automatic variables with either a pattern or with zeroes to increase
11889 the security and predictability of a program by preventing uninitialized memory
11890 disclosure and use.
11891 GCC still considers an automatic variable that doesn't have an explicit
11892 initializer as uninitialized, -Wuninitialized will still report warning messages
11893 on such automatic variables.
11894 With this option, GCC will also initialize any padding of automatic variables
11895 that have structure or union types to zeroes.
11897 The three values of @var{choice} are:
11901 @samp{uninitialized} doesn't initialize any automatic variables.
11902 This is C and C++'s default.
11905 @samp{pattern} Initialize automatic variables with values which will likely
11906 transform logic bugs into crashes down the line, are easily recognized in a
11907 crash dump and without being values that programmers can rely on for useful
11909 The current value is byte-repeatable pattern with byte "0xFE".
11910 The values used for pattern initialization might be changed in the future.
11913 @samp{zero} Initialize automatic variables with zeroes.
11916 The default is @samp{uninitialized}.
11918 You can control this behavior for a specific variable by using the variable
11919 attribute @code{uninitialized} (@pxref{Variable Attributes}).
11921 @item -fvect-cost-model=@var{model}
11922 @opindex fvect-cost-model
11923 Alter the cost model used for vectorization. The @var{model} argument
11924 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
11926 With the @samp{unlimited} model the vectorized code-path is assumed
11927 to be profitable while with the @samp{dynamic} model a runtime check
11928 guards the vectorized code-path to enable it only for iteration
11929 counts that will likely execute faster than when executing the original
11930 scalar loop. The @samp{cheap} model disables vectorization of
11931 loops where doing so would be cost prohibitive for example due to
11932 required runtime checks for data dependence or alignment but otherwise
11933 is equal to the @samp{dynamic} model. The @samp{very-cheap} model only
11934 allows vectorization if the vector code would entirely replace the
11935 scalar code that is being vectorized. For example, if each iteration
11936 of a vectorized loop would only be able to handle exactly four iterations
11937 of the scalar loop, the @samp{very-cheap} model would only allow
11938 vectorization if the scalar iteration count is known to be a multiple
11941 The default cost model depends on other optimization flags and is
11942 either @samp{dynamic} or @samp{cheap}.
11944 @item -fsimd-cost-model=@var{model}
11945 @opindex fsimd-cost-model
11946 Alter the cost model used for vectorization of loops marked with the OpenMP
11947 simd directive. The @var{model} argument should be one of
11948 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
11949 have the same meaning as described in @option{-fvect-cost-model} and by
11950 default a cost model defined with @option{-fvect-cost-model} is used.
11954 Perform Value Range Propagation on trees. This is similar to the
11955 constant propagation pass, but instead of values, ranges of values are
11956 propagated. This allows the optimizers to remove unnecessary range
11957 checks like array bound checks and null pointer checks. This is
11958 enabled by default at @option{-O2} and higher. Null pointer check
11959 elimination is only done if @option{-fdelete-null-pointer-checks} is
11962 @item -fsplit-paths
11963 @opindex fsplit-paths
11964 Split paths leading to loop backedges. This can improve dead code
11965 elimination and common subexpression elimination. This is enabled by
11966 default at @option{-O3} and above.
11968 @item -fsplit-ivs-in-unroller
11969 @opindex fsplit-ivs-in-unroller
11970 Enables expression of values of induction variables in later iterations
11971 of the unrolled loop using the value in the first iteration. This breaks
11972 long dependency chains, thus improving efficiency of the scheduling passes.
11974 A combination of @option{-fweb} and CSE is often sufficient to obtain the
11975 same effect. However, that is not reliable in cases where the loop body
11976 is more complicated than a single basic block. It also does not work at all
11977 on some architectures due to restrictions in the CSE pass.
11979 This optimization is enabled by default.
11981 @item -fvariable-expansion-in-unroller
11982 @opindex fvariable-expansion-in-unroller
11983 With this option, the compiler creates multiple copies of some
11984 local variables when unrolling a loop, which can result in superior code.
11986 This optimization is enabled by default for PowerPC targets, but disabled
11987 by default otherwise.
11989 @item -fpartial-inlining
11990 @opindex fpartial-inlining
11991 Inline parts of functions. This option has any effect only
11992 when inlining itself is turned on by the @option{-finline-functions}
11993 or @option{-finline-small-functions} options.
11995 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11997 @item -fpredictive-commoning
11998 @opindex fpredictive-commoning
11999 Perform predictive commoning optimization, i.e., reusing computations
12000 (especially memory loads and stores) performed in previous
12001 iterations of loops.
12003 This option is enabled at level @option{-O3}.
12004 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12006 @item -fprefetch-loop-arrays
12007 @opindex fprefetch-loop-arrays
12008 If supported by the target machine, generate instructions to prefetch
12009 memory to improve the performance of loops that access large arrays.
12011 This option may generate better or worse code; results are highly
12012 dependent on the structure of loops within the source code.
12014 Disabled at level @option{-Os}.
12016 @item -fno-printf-return-value
12017 @opindex fno-printf-return-value
12018 @opindex fprintf-return-value
12019 Do not substitute constants for known return value of formatted output
12020 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
12021 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
12022 transformation allows GCC to optimize or even eliminate branches based
12023 on the known return value of these functions called with arguments that
12024 are either constant, or whose values are known to be in a range that
12025 makes determining the exact return value possible. For example, when
12026 @option{-fprintf-return-value} is in effect, both the branch and the
12027 body of the @code{if} statement (but not the call to @code{snprint})
12028 can be optimized away when @code{i} is a 32-bit or smaller integer
12029 because the return value is guaranteed to be at most 8.
12033 if (snprintf (buf, "%08x", i) >= sizeof buf)
12037 The @option{-fprintf-return-value} option relies on other optimizations
12038 and yields best results with @option{-O2} and above. It works in tandem
12039 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
12040 options. The @option{-fprintf-return-value} option is enabled by default.
12042 @item -fno-peephole
12043 @itemx -fno-peephole2
12044 @opindex fno-peephole
12046 @opindex fno-peephole2
12047 @opindex fpeephole2
12048 Disable any machine-specific peephole optimizations. The difference
12049 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
12050 are implemented in the compiler; some targets use one, some use the
12051 other, a few use both.
12053 @option{-fpeephole} is enabled by default.
12054 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12056 @item -fno-guess-branch-probability
12057 @opindex fno-guess-branch-probability
12058 @opindex fguess-branch-probability
12059 Do not guess branch probabilities using heuristics.
12061 GCC uses heuristics to guess branch probabilities if they are
12062 not provided by profiling feedback (@option{-fprofile-arcs}). These
12063 heuristics are based on the control flow graph. If some branch probabilities
12064 are specified by @code{__builtin_expect}, then the heuristics are
12065 used to guess branch probabilities for the rest of the control flow graph,
12066 taking the @code{__builtin_expect} info into account. The interactions
12067 between the heuristics and @code{__builtin_expect} can be complex, and in
12068 some cases, it may be useful to disable the heuristics so that the effects
12069 of @code{__builtin_expect} are easier to understand.
12071 It is also possible to specify expected probability of the expression
12072 with @code{__builtin_expect_with_probability} built-in function.
12074 The default is @option{-fguess-branch-probability} at levels
12075 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12077 @item -freorder-blocks
12078 @opindex freorder-blocks
12079 Reorder basic blocks in the compiled function in order to reduce number of
12080 taken branches and improve code locality.
12082 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12084 @item -freorder-blocks-algorithm=@var{algorithm}
12085 @opindex freorder-blocks-algorithm
12086 Use the specified algorithm for basic block reordering. The
12087 @var{algorithm} argument can be @samp{simple}, which does not increase
12088 code size (except sometimes due to secondary effects like alignment),
12089 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
12090 put all often executed code together, minimizing the number of branches
12091 executed by making extra copies of code.
12093 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
12094 @samp{stc} at levels @option{-O2}, @option{-O3}.
12096 @item -freorder-blocks-and-partition
12097 @opindex freorder-blocks-and-partition
12098 In addition to reordering basic blocks in the compiled function, in order
12099 to reduce number of taken branches, partitions hot and cold basic blocks
12100 into separate sections of the assembly and @file{.o} files, to improve
12101 paging and cache locality performance.
12103 This optimization is automatically turned off in the presence of
12104 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
12105 section attribute and on any architecture that does not support named
12106 sections. When @option{-fsplit-stack} is used this option is not
12107 enabled by default (to avoid linker errors), but may be enabled
12108 explicitly (if using a working linker).
12110 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
12112 @item -freorder-functions
12113 @opindex freorder-functions
12114 Reorder functions in the object file in order to
12115 improve code locality. This is implemented by using special
12116 subsections @code{.text.hot} for most frequently executed functions and
12117 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
12118 the linker so object file format must support named sections and linker must
12119 place them in a reasonable way.
12121 This option isn't effective unless you either provide profile feedback
12122 (see @option{-fprofile-arcs} for details) or manually annotate functions with
12123 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
12125 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12127 @item -fstrict-aliasing
12128 @opindex fstrict-aliasing
12129 Allow the compiler to assume the strictest aliasing rules applicable to
12130 the language being compiled. For C (and C++), this activates
12131 optimizations based on the type of expressions. In particular, an
12132 object of one type is assumed never to reside at the same address as an
12133 object of a different type, unless the types are almost the same. For
12134 example, an @code{unsigned int} can alias an @code{int}, but not a
12135 @code{void*} or a @code{double}. A character type may alias any other
12138 @anchor{Type-punning}Pay special attention to code like this:
12151 The practice of reading from a different union member than the one most
12152 recently written to (called ``type-punning'') is common. Even with
12153 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
12154 is accessed through the union type. So, the code above works as
12155 expected. @xref{Structures unions enumerations and bit-fields
12156 implementation}. However, this code might not:
12167 Similarly, access by taking the address, casting the resulting pointer
12168 and dereferencing the result has undefined behavior, even if the cast
12169 uses a union type, e.g.:
12173 return ((union a_union *) &d)->i;
12177 The @option{-fstrict-aliasing} option is enabled at levels
12178 @option{-O2}, @option{-O3}, @option{-Os}.
12180 @item -falign-functions
12181 @itemx -falign-functions=@var{n}
12182 @itemx -falign-functions=@var{n}:@var{m}
12183 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
12184 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
12185 @opindex falign-functions
12186 Align the start of functions to the next power-of-two greater than or
12187 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
12188 least the first @var{m} bytes of the function can be fetched by the CPU
12189 without crossing an @var{n}-byte alignment boundary.
12191 If @var{m} is not specified, it defaults to @var{n}.
12193 Examples: @option{-falign-functions=32} aligns functions to the next
12194 32-byte boundary, @option{-falign-functions=24} aligns to the next
12195 32-byte boundary only if this can be done by skipping 23 bytes or less,
12196 @option{-falign-functions=32:7} aligns to the next
12197 32-byte boundary only if this can be done by skipping 6 bytes or less.
12199 The second pair of @var{n2}:@var{m2} values allows you to specify
12200 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
12201 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
12202 otherwise aligns to the next 32-byte boundary if this can be done
12203 by skipping 2 bytes or less.
12204 If @var{m2} is not specified, it defaults to @var{n2}.
12206 Some assemblers only support this flag when @var{n} is a power of two;
12207 in that case, it is rounded up.
12209 @option{-fno-align-functions} and @option{-falign-functions=1} are
12210 equivalent and mean that functions are not aligned.
12212 If @var{n} is not specified or is zero, use a machine-dependent default.
12213 The maximum allowed @var{n} option value is 65536.
12215 Enabled at levels @option{-O2}, @option{-O3}.
12217 @item -flimit-function-alignment
12218 If this option is enabled, the compiler tries to avoid unnecessarily
12219 overaligning functions. It attempts to instruct the assembler to align
12220 by the amount specified by @option{-falign-functions}, but not to
12221 skip more bytes than the size of the function.
12223 @item -falign-labels
12224 @itemx -falign-labels=@var{n}
12225 @itemx -falign-labels=@var{n}:@var{m}
12226 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
12227 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
12228 @opindex falign-labels
12229 Align all branch targets to a power-of-two boundary.
12231 Parameters of this option are analogous to the @option{-falign-functions} option.
12232 @option{-fno-align-labels} and @option{-falign-labels=1} are
12233 equivalent and mean that labels are not aligned.
12235 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
12236 are greater than this value, then their values are used instead.
12238 If @var{n} is not specified or is zero, use a machine-dependent default
12239 which is very likely to be @samp{1}, meaning no alignment.
12240 The maximum allowed @var{n} option value is 65536.
12242 Enabled at levels @option{-O2}, @option{-O3}.
12244 @item -falign-loops
12245 @itemx -falign-loops=@var{n}
12246 @itemx -falign-loops=@var{n}:@var{m}
12247 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
12248 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
12249 @opindex falign-loops
12250 Align loops to a power-of-two boundary. If the loops are executed
12251 many times, this makes up for any execution of the dummy padding
12254 If @option{-falign-labels} is greater than this value, then its value
12257 Parameters of this option are analogous to the @option{-falign-functions} option.
12258 @option{-fno-align-loops} and @option{-falign-loops=1} are
12259 equivalent and mean that loops are not aligned.
12260 The maximum allowed @var{n} option value is 65536.
12262 If @var{n} is not specified or is zero, use a machine-dependent default.
12264 Enabled at levels @option{-O2}, @option{-O3}.
12266 @item -falign-jumps
12267 @itemx -falign-jumps=@var{n}
12268 @itemx -falign-jumps=@var{n}:@var{m}
12269 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
12270 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
12271 @opindex falign-jumps
12272 Align branch targets to a power-of-two boundary, for branch targets
12273 where the targets can only be reached by jumping. In this case,
12274 no dummy operations need be executed.
12276 If @option{-falign-labels} is greater than this value, then its value
12279 Parameters of this option are analogous to the @option{-falign-functions} option.
12280 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
12281 equivalent and mean that loops are not aligned.
12283 If @var{n} is not specified or is zero, use a machine-dependent default.
12284 The maximum allowed @var{n} option value is 65536.
12286 Enabled at levels @option{-O2}, @option{-O3}.
12288 @item -fno-allocation-dce
12289 @opindex fno-allocation-dce
12290 Do not remove unused C++ allocations in dead code elimination.
12292 @item -fallow-store-data-races
12293 @opindex fallow-store-data-races
12294 Allow the compiler to perform optimizations that may introduce new data races
12295 on stores, without proving that the variable cannot be concurrently accessed
12296 by other threads. Does not affect optimization of local data. It is safe to
12297 use this option if it is known that global data will not be accessed by
12300 Examples of optimizations enabled by @option{-fallow-store-data-races} include
12301 hoisting or if-conversions that may cause a value that was already in memory
12302 to be re-written with that same value. Such re-writing is safe in a single
12303 threaded context but may be unsafe in a multi-threaded context. Note that on
12304 some processors, if-conversions may be required in order to enable
12307 Enabled at level @option{-Ofast}.
12309 @item -funit-at-a-time
12310 @opindex funit-at-a-time
12311 This option is left for compatibility reasons. @option{-funit-at-a-time}
12312 has no effect, while @option{-fno-unit-at-a-time} implies
12313 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
12315 Enabled by default.
12317 @item -fno-toplevel-reorder
12318 @opindex fno-toplevel-reorder
12319 @opindex ftoplevel-reorder
12320 Do not reorder top-level functions, variables, and @code{asm}
12321 statements. Output them in the same order that they appear in the
12322 input file. When this option is used, unreferenced static variables
12323 are not removed. This option is intended to support existing code
12324 that relies on a particular ordering. For new code, it is better to
12325 use attributes when possible.
12327 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
12328 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
12329 Additionally @option{-fno-toplevel-reorder} implies
12330 @option{-fno-section-anchors}.
12334 Constructs webs as commonly used for register allocation purposes and assign
12335 each web individual pseudo register. This allows the register allocation pass
12336 to operate on pseudos directly, but also strengthens several other optimization
12337 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
12338 however, make debugging impossible, since variables no longer stay in a
12341 Enabled by default with @option{-funroll-loops}.
12343 @item -fwhole-program
12344 @opindex fwhole-program
12345 Assume that the current compilation unit represents the whole program being
12346 compiled. All public functions and variables with the exception of @code{main}
12347 and those merged by attribute @code{externally_visible} become static functions
12348 and in effect are optimized more aggressively by interprocedural optimizers.
12350 This option should not be used in combination with @option{-flto}.
12351 Instead relying on a linker plugin should provide safer and more precise
12354 @item -flto[=@var{n}]
12356 This option runs the standard link-time optimizer. When invoked
12357 with source code, it generates GIMPLE (one of GCC's internal
12358 representations) and writes it to special ELF sections in the object
12359 file. When the object files are linked together, all the function
12360 bodies are read from these ELF sections and instantiated as if they
12361 had been part of the same translation unit.
12363 To use the link-time optimizer, @option{-flto} and optimization
12364 options should be specified at compile time and during the final link.
12365 It is recommended that you compile all the files participating in the
12366 same link with the same options and also specify those options at
12371 gcc -c -O2 -flto foo.c
12372 gcc -c -O2 -flto bar.c
12373 gcc -o myprog -flto -O2 foo.o bar.o
12376 The first two invocations to GCC save a bytecode representation
12377 of GIMPLE into special ELF sections inside @file{foo.o} and
12378 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
12379 @file{foo.o} and @file{bar.o}, merges the two files into a single
12380 internal image, and compiles the result as usual. Since both
12381 @file{foo.o} and @file{bar.o} are merged into a single image, this
12382 causes all the interprocedural analyses and optimizations in GCC to
12383 work across the two files as if they were a single one. This means,
12384 for example, that the inliner is able to inline functions in
12385 @file{bar.o} into functions in @file{foo.o} and vice-versa.
12387 Another (simpler) way to enable link-time optimization is:
12390 gcc -o myprog -flto -O2 foo.c bar.c
12393 The above generates bytecode for @file{foo.c} and @file{bar.c},
12394 merges them together into a single GIMPLE representation and optimizes
12395 them as usual to produce @file{myprog}.
12397 The important thing to keep in mind is that to enable link-time
12398 optimizations you need to use the GCC driver to perform the link step.
12399 GCC automatically performs link-time optimization if any of the
12400 objects involved were compiled with the @option{-flto} command-line option.
12401 You can always override
12402 the automatic decision to do link-time optimization
12403 by passing @option{-fno-lto} to the link command.
12405 To make whole program optimization effective, it is necessary to make
12406 certain whole program assumptions. The compiler needs to know
12407 what functions and variables can be accessed by libraries and runtime
12408 outside of the link-time optimized unit. When supported by the linker,
12409 the linker plugin (see @option{-fuse-linker-plugin}) passes information
12410 to the compiler about used and externally visible symbols. When
12411 the linker plugin is not available, @option{-fwhole-program} should be
12412 used to allow the compiler to make these assumptions, which leads
12413 to more aggressive optimization decisions.
12415 When a file is compiled with @option{-flto} without
12416 @option{-fuse-linker-plugin}, the generated object file is larger than
12417 a regular object file because it contains GIMPLE bytecodes and the usual
12418 final code (see @option{-ffat-lto-objects}). This means that
12419 object files with LTO information can be linked as normal object
12420 files; if @option{-fno-lto} is passed to the linker, no
12421 interprocedural optimizations are applied. Note that when
12422 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
12423 but you cannot perform a regular, non-LTO link on them.
12425 When producing the final binary, GCC only
12426 applies link-time optimizations to those files that contain bytecode.
12427 Therefore, you can mix and match object files and libraries with
12428 GIMPLE bytecodes and final object code. GCC automatically selects
12429 which files to optimize in LTO mode and which files to link without
12430 further processing.
12432 Generally, options specified at link time override those
12433 specified at compile time, although in some cases GCC attempts to infer
12434 link-time options from the settings used to compile the input files.
12436 If you do not specify an optimization level option @option{-O} at
12437 link time, then GCC uses the highest optimization level
12438 used when compiling the object files. Note that it is generally
12439 ineffective to specify an optimization level option only at link time and
12440 not at compile time, for two reasons. First, compiling without
12441 optimization suppresses compiler passes that gather information
12442 needed for effective optimization at link time. Second, some early
12443 optimization passes can be performed only at compile time and
12446 There are some code generation flags preserved by GCC when
12447 generating bytecodes, as they need to be used during the final link.
12448 Currently, the following options and their settings are taken from
12449 the first object file that explicitly specifies them:
12450 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
12451 @option{-fgnu-tm} and all the @option{-m} target flags.
12453 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
12454 @option{-fPIE} are combined based on the following scheme:
12457 @option{-fPIC} + @option{-fpic} = @option{-fpic}
12458 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
12459 @option{-fpic/-fPIC} + (no option) = (no option)
12460 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
12461 @option{-fpic} + @option{-fPIE} = @option{-fpie}
12462 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
12465 Certain ABI-changing flags are required to match in all compilation units,
12466 and trying to override this at link time with a conflicting value
12467 is ignored. This includes options such as @option{-freg-struct-return}
12468 and @option{-fpcc-struct-return}.
12470 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
12471 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
12472 are passed through to the link stage and merged conservatively for
12473 conflicting translation units. Specifically
12474 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
12475 precedence; and for example @option{-ffp-contract=off} takes precedence
12476 over @option{-ffp-contract=fast}. You can override them at link time.
12478 Diagnostic options such as @option{-Wstringop-overflow} are passed
12479 through to the link stage and their setting matches that of the
12480 compile-step at function granularity. Note that this matters only
12481 for diagnostics emitted during optimization. Note that code
12482 transforms such as inlining can lead to warnings being enabled
12483 or disabled for regions if code not consistent with the setting
12486 When you need to pass options to the assembler via @option{-Wa} or
12487 @option{-Xassembler} make sure to either compile such translation
12488 units with @option{-fno-lto} or consistently use the same assembler
12489 options on all translation units. You can alternatively also
12490 specify assembler options at LTO link time.
12492 To enable debug info generation you need to supply @option{-g} at
12493 compile time. If any of the input files at link time were built
12494 with debug info generation enabled the link will enable debug info
12495 generation as well. Any elaborate debug info settings
12496 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
12497 at the linker command line and mixing different settings in different
12498 translation units is discouraged.
12500 If LTO encounters objects with C linkage declared with incompatible
12501 types in separate translation units to be linked together (undefined
12502 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
12503 issued. The behavior is still undefined at run time. Similar
12504 diagnostics may be raised for other languages.
12506 Another feature of LTO is that it is possible to apply interprocedural
12507 optimizations on files written in different languages:
12511 g++ -c -flto bar.cc
12512 gfortran -c -flto baz.f90
12513 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
12516 Notice that the final link is done with @command{g++} to get the C++
12517 runtime libraries and @option{-lgfortran} is added to get the Fortran
12518 runtime libraries. In general, when mixing languages in LTO mode, you
12519 should use the same link command options as when mixing languages in a
12520 regular (non-LTO) compilation.
12522 If object files containing GIMPLE bytecode are stored in a library archive, say
12523 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
12524 are using a linker with plugin support. To create static libraries suitable
12525 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
12526 and @command{ranlib};
12527 to show the symbols of object files with GIMPLE bytecode, use
12528 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
12529 and @command{nm} have been compiled with plugin support. At link time, use the
12530 flag @option{-fuse-linker-plugin} to ensure that the library participates in
12531 the LTO optimization process:
12534 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
12537 With the linker plugin enabled, the linker extracts the needed
12538 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
12539 to make them part of the aggregated GIMPLE image to be optimized.
12541 If you are not using a linker with plugin support and/or do not
12542 enable the linker plugin, then the objects inside @file{libfoo.a}
12543 are extracted and linked as usual, but they do not participate
12544 in the LTO optimization process. In order to make a static library suitable
12545 for both LTO optimization and usual linkage, compile its object files with
12546 @option{-flto} @option{-ffat-lto-objects}.
12548 Link-time optimizations do not require the presence of the whole program to
12549 operate. If the program does not require any symbols to be exported, it is
12550 possible to combine @option{-flto} and @option{-fwhole-program} to allow
12551 the interprocedural optimizers to use more aggressive assumptions which may
12552 lead to improved optimization opportunities.
12553 Use of @option{-fwhole-program} is not needed when linker plugin is
12554 active (see @option{-fuse-linker-plugin}).
12556 The current implementation of LTO makes no
12557 attempt to generate bytecode that is portable between different
12558 types of hosts. The bytecode files are versioned and there is a
12559 strict version check, so bytecode files generated in one version of
12560 GCC do not work with an older or newer version of GCC.
12562 Link-time optimization does not work well with generation of debugging
12563 information on systems other than those using a combination of ELF and
12566 If you specify the optional @var{n}, the optimization and code
12567 generation done at link time is executed in parallel using @var{n}
12568 parallel jobs by utilizing an installed @command{make} program. The
12569 environment variable @env{MAKE} may be used to override the program
12572 You can also specify @option{-flto=jobserver} to use GNU make's
12573 job server mode to determine the number of parallel jobs. This
12574 is useful when the Makefile calling GCC is already executing in parallel.
12575 You must prepend a @samp{+} to the command recipe in the parent Makefile
12576 for this to work. This option likely only works if @env{MAKE} is
12577 GNU make. Even without the option value, GCC tries to automatically
12578 detect a running GNU make's job server.
12580 Use @option{-flto=auto} to use GNU make's job server, if available,
12581 or otherwise fall back to autodetection of the number of CPU threads
12582 present in your system.
12584 @item -flto-partition=@var{alg}
12585 @opindex flto-partition
12586 Specify the partitioning algorithm used by the link-time optimizer.
12587 The value is either @samp{1to1} to specify a partitioning mirroring
12588 the original source files or @samp{balanced} to specify partitioning
12589 into equally sized chunks (whenever possible) or @samp{max} to create
12590 new partition for every symbol where possible. Specifying @samp{none}
12591 as an algorithm disables partitioning and streaming completely.
12592 The default value is @samp{balanced}. While @samp{1to1} can be used
12593 as an workaround for various code ordering issues, the @samp{max}
12594 partitioning is intended for internal testing only.
12595 The value @samp{one} specifies that exactly one partition should be
12596 used while the value @samp{none} bypasses partitioning and executes
12597 the link-time optimization step directly from the WPA phase.
12599 @item -flto-compression-level=@var{n}
12600 @opindex flto-compression-level
12601 This option specifies the level of compression used for intermediate
12602 language written to LTO object files, and is only meaningful in
12603 conjunction with LTO mode (@option{-flto}). GCC currently supports two
12604 LTO compression algorithms. For zstd, valid values are 0 (no compression)
12605 to 19 (maximum compression), while zlib supports values from 0 to 9.
12606 Values outside this range are clamped to either minimum or maximum
12607 of the supported values. If the option is not given,
12608 a default balanced compression setting is used.
12610 @item -fuse-linker-plugin
12611 @opindex fuse-linker-plugin
12612 Enables the use of a linker plugin during link-time optimization. This
12613 option relies on plugin support in the linker, which is available in gold
12614 or in GNU ld 2.21 or newer.
12616 This option enables the extraction of object files with GIMPLE bytecode out
12617 of library archives. This improves the quality of optimization by exposing
12618 more code to the link-time optimizer. This information specifies what
12619 symbols can be accessed externally (by non-LTO object or during dynamic
12620 linking). Resulting code quality improvements on binaries (and shared
12621 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
12622 See @option{-flto} for a description of the effect of this flag and how to
12625 This option is enabled by default when LTO support in GCC is enabled
12626 and GCC was configured for use with
12627 a linker supporting plugins (GNU ld 2.21 or newer or gold).
12629 @item -ffat-lto-objects
12630 @opindex ffat-lto-objects
12631 Fat LTO objects are object files that contain both the intermediate language
12632 and the object code. This makes them usable for both LTO linking and normal
12633 linking. This option is effective only when compiling with @option{-flto}
12634 and is ignored at link time.
12636 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
12637 requires the complete toolchain to be aware of LTO. It requires a linker with
12638 linker plugin support for basic functionality. Additionally,
12639 @command{nm}, @command{ar} and @command{ranlib}
12640 need to support linker plugins to allow a full-featured build environment
12641 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
12642 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
12643 to these tools. With non fat LTO makefiles need to be modified to use them.
12645 Note that modern binutils provide plugin auto-load mechanism.
12646 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
12647 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
12648 @command{gcc-ranlib}).
12650 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
12653 @item -fcompare-elim
12654 @opindex fcompare-elim
12655 After register allocation and post-register allocation instruction splitting,
12656 identify arithmetic instructions that compute processor flags similar to a
12657 comparison operation based on that arithmetic. If possible, eliminate the
12658 explicit comparison operation.
12660 This pass only applies to certain targets that cannot explicitly represent
12661 the comparison operation before register allocation is complete.
12663 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12665 @item -fcprop-registers
12666 @opindex fcprop-registers
12667 After register allocation and post-register allocation instruction splitting,
12668 perform a copy-propagation pass to try to reduce scheduling dependencies
12669 and occasionally eliminate the copy.
12671 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12673 @item -fprofile-correction
12674 @opindex fprofile-correction
12675 Profiles collected using an instrumented binary for multi-threaded programs may
12676 be inconsistent due to missed counter updates. When this option is specified,
12677 GCC uses heuristics to correct or smooth out such inconsistencies. By
12678 default, GCC emits an error message when an inconsistent profile is detected.
12680 This option is enabled by @option{-fauto-profile}.
12682 @item -fprofile-partial-training
12683 @opindex fprofile-partial-training
12684 With @code{-fprofile-use} all portions of programs not executed during train
12685 run are optimized agressively for size rather than speed. In some cases it is
12686 not practical to train all possible hot paths in the program. (For
12687 example, program may contain functions specific for a given hardware and
12688 trianing may not cover all hardware configurations program is run on.) With
12689 @code{-fprofile-partial-training} profile feedback will be ignored for all
12690 functions not executed during the train run leading them to be optimized as if
12691 they were compiled without profile feedback. This leads to better performance
12692 when train run is not representative but also leads to significantly bigger
12695 @item -fprofile-use
12696 @itemx -fprofile-use=@var{path}
12697 @opindex fprofile-use
12698 Enable profile feedback-directed optimizations,
12699 and the following optimizations, many of which
12700 are generally profitable only with profile feedback available:
12702 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
12703 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
12704 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
12705 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
12706 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
12707 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
12708 -fprofile-reorder-functions}
12710 Before you can use this option, you must first generate profiling information.
12711 @xref{Instrumentation Options}, for information about the
12712 @option{-fprofile-generate} option.
12714 By default, GCC emits an error message if the feedback profiles do not
12715 match the source code. This error can be turned into a warning by using
12716 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
12717 optimized code. Additionally, by default, GCC also emits a warning message if
12718 the feedback profiles do not exist (see @option{-Wmissing-profile}).
12720 If @var{path} is specified, GCC looks at the @var{path} to find
12721 the profile feedback data files. See @option{-fprofile-dir}.
12723 @item -fauto-profile
12724 @itemx -fauto-profile=@var{path}
12725 @opindex fauto-profile
12726 Enable sampling-based feedback-directed optimizations,
12727 and the following optimizations,
12728 many of which are generally profitable only with profile feedback available:
12730 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
12731 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
12732 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
12733 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
12734 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
12735 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
12736 -fprofile-correction}
12738 @var{path} is the name of a file containing AutoFDO profile information.
12739 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
12741 Producing an AutoFDO profile data file requires running your program
12742 with the @command{perf} utility on a supported GNU/Linux target system.
12743 For more information, see @uref{https://perf.wiki.kernel.org/}.
12747 perf record -e br_inst_retired:near_taken -b -o perf.data \
12751 Then use the @command{create_gcov} tool to convert the raw profile data
12752 to a format that can be used by GCC.@ You must also supply the
12753 unstripped binary for your program to this tool.
12754 See @uref{https://github.com/google/autofdo}.
12758 create_gcov --binary=your_program.unstripped --profile=perf.data \
12759 --gcov=profile.afdo
12763 The following options control compiler behavior regarding floating-point
12764 arithmetic. These options trade off between speed and
12765 correctness. All must be specifically enabled.
12768 @item -ffloat-store
12769 @opindex ffloat-store
12770 Do not store floating-point variables in registers, and inhibit other
12771 options that might change whether a floating-point value is taken from a
12772 register or memory.
12774 @cindex floating-point precision
12775 This option prevents undesirable excess precision on machines such as
12776 the 68000 where the floating registers (of the 68881) keep more
12777 precision than a @code{double} is supposed to have. Similarly for the
12778 x86 architecture. For most programs, the excess precision does only
12779 good, but a few programs rely on the precise definition of IEEE floating
12780 point. Use @option{-ffloat-store} for such programs, after modifying
12781 them to store all pertinent intermediate computations into variables.
12783 @item -fexcess-precision=@var{style}
12784 @opindex fexcess-precision
12785 This option allows further control over excess precision on machines
12786 where floating-point operations occur in a format with more precision or
12787 range than the IEEE standard and interchange floating-point types. By
12788 default, @option{-fexcess-precision=fast} is in effect; this means that
12789 operations may be carried out in a wider precision than the types specified
12790 in the source if that would result in faster code, and it is unpredictable
12791 when rounding to the types specified in the source code takes place.
12792 When compiling C, if @option{-fexcess-precision=standard} is specified then
12793 excess precision follows the rules specified in ISO C99; in particular,
12794 both casts and assignments cause values to be rounded to their
12795 semantic types (whereas @option{-ffloat-store} only affects
12796 assignments). This option is enabled by default for C if a strict
12797 conformance option such as @option{-std=c99} is used.
12798 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
12799 regardless of whether a strict conformance option is used.
12802 @option{-fexcess-precision=standard} is not implemented for languages
12803 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
12804 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
12805 semantics apply without excess precision, and in the latter, rounding
12809 @opindex ffast-math
12810 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
12811 @option{-ffinite-math-only}, @option{-fno-rounding-math},
12812 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
12813 @option{-fexcess-precision=fast}.
12815 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
12817 This option is not turned on by any @option{-O} option besides
12818 @option{-Ofast} since it can result in incorrect output for programs
12819 that depend on an exact implementation of IEEE or ISO rules/specifications
12820 for math functions. It may, however, yield faster code for programs
12821 that do not require the guarantees of these specifications.
12823 @item -fno-math-errno
12824 @opindex fno-math-errno
12825 @opindex fmath-errno
12826 Do not set @code{errno} after calling math functions that are executed
12827 with a single instruction, e.g., @code{sqrt}. A program that relies on
12828 IEEE exceptions for math error handling may want to use this flag
12829 for speed while maintaining IEEE arithmetic compatibility.
12831 This option is not turned on by any @option{-O} option since
12832 it can result in incorrect output for programs that depend on
12833 an exact implementation of IEEE or ISO rules/specifications for
12834 math functions. It may, however, yield faster code for programs
12835 that do not require the guarantees of these specifications.
12837 The default is @option{-fmath-errno}.
12839 On Darwin systems, the math library never sets @code{errno}. There is
12840 therefore no reason for the compiler to consider the possibility that
12841 it might, and @option{-fno-math-errno} is the default.
12843 @item -funsafe-math-optimizations
12844 @opindex funsafe-math-optimizations
12846 Allow optimizations for floating-point arithmetic that (a) assume
12847 that arguments and results are valid and (b) may violate IEEE or
12848 ANSI standards. When used at link time, it may include libraries
12849 or startup files that change the default FPU control word or other
12850 similar optimizations.
12852 This option is not turned on by any @option{-O} option since
12853 it can result in incorrect output for programs that depend on
12854 an exact implementation of IEEE or ISO rules/specifications for
12855 math functions. It may, however, yield faster code for programs
12856 that do not require the guarantees of these specifications.
12857 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
12858 @option{-fassociative-math} and @option{-freciprocal-math}.
12860 The default is @option{-fno-unsafe-math-optimizations}.
12862 @item -fassociative-math
12863 @opindex fassociative-math
12865 Allow re-association of operands in series of floating-point operations.
12866 This violates the ISO C and C++ language standard by possibly changing
12867 computation result. NOTE: re-ordering may change the sign of zero as
12868 well as ignore NaNs and inhibit or create underflow or overflow (and
12869 thus cannot be used on code that relies on rounding behavior like
12870 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
12871 and thus may not be used when ordered comparisons are required.
12872 This option requires that both @option{-fno-signed-zeros} and
12873 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
12874 much sense with @option{-frounding-math}. For Fortran the option
12875 is automatically enabled when both @option{-fno-signed-zeros} and
12876 @option{-fno-trapping-math} are in effect.
12878 The default is @option{-fno-associative-math}.
12880 @item -freciprocal-math
12881 @opindex freciprocal-math
12883 Allow the reciprocal of a value to be used instead of dividing by
12884 the value if this enables optimizations. For example @code{x / y}
12885 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
12886 is subject to common subexpression elimination. Note that this loses
12887 precision and increases the number of flops operating on the value.
12889 The default is @option{-fno-reciprocal-math}.
12891 @item -ffinite-math-only
12892 @opindex ffinite-math-only
12893 Allow optimizations for floating-point arithmetic that assume
12894 that arguments and results are not NaNs or +-Infs.
12896 This option is not turned on by any @option{-O} option since
12897 it can result in incorrect output for programs that depend on
12898 an exact implementation of IEEE or ISO rules/specifications for
12899 math functions. It may, however, yield faster code for programs
12900 that do not require the guarantees of these specifications.
12902 The default is @option{-fno-finite-math-only}.
12904 @item -fno-signed-zeros
12905 @opindex fno-signed-zeros
12906 @opindex fsigned-zeros
12907 Allow optimizations for floating-point arithmetic that ignore the
12908 signedness of zero. IEEE arithmetic specifies the behavior of
12909 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
12910 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
12911 This option implies that the sign of a zero result isn't significant.
12913 The default is @option{-fsigned-zeros}.
12915 @item -fno-trapping-math
12916 @opindex fno-trapping-math
12917 @opindex ftrapping-math
12918 Compile code assuming that floating-point operations cannot generate
12919 user-visible traps. These traps include division by zero, overflow,
12920 underflow, inexact result and invalid operation. This option requires
12921 that @option{-fno-signaling-nans} be in effect. Setting this option may
12922 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
12924 This option should never be turned on by any @option{-O} option since
12925 it can result in incorrect output for programs that depend on
12926 an exact implementation of IEEE or ISO rules/specifications for
12929 The default is @option{-ftrapping-math}.
12931 @item -frounding-math
12932 @opindex frounding-math
12933 Disable transformations and optimizations that assume default floating-point
12934 rounding behavior. This is round-to-zero for all floating point
12935 to integer conversions, and round-to-nearest for all other arithmetic
12936 truncations. This option should be specified for programs that change
12937 the FP rounding mode dynamically, or that may be executed with a
12938 non-default rounding mode. This option disables constant folding of
12939 floating-point expressions at compile time (which may be affected by
12940 rounding mode) and arithmetic transformations that are unsafe in the
12941 presence of sign-dependent rounding modes.
12943 The default is @option{-fno-rounding-math}.
12945 This option is experimental and does not currently guarantee to
12946 disable all GCC optimizations that are affected by rounding mode.
12947 Future versions of GCC may provide finer control of this setting
12948 using C99's @code{FENV_ACCESS} pragma. This command-line option
12949 will be used to specify the default state for @code{FENV_ACCESS}.
12951 @item -fsignaling-nans
12952 @opindex fsignaling-nans
12953 Compile code assuming that IEEE signaling NaNs may generate user-visible
12954 traps during floating-point operations. Setting this option disables
12955 optimizations that may change the number of exceptions visible with
12956 signaling NaNs. This option implies @option{-ftrapping-math}.
12958 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
12961 The default is @option{-fno-signaling-nans}.
12963 This option is experimental and does not currently guarantee to
12964 disable all GCC optimizations that affect signaling NaN behavior.
12966 @item -fno-fp-int-builtin-inexact
12967 @opindex fno-fp-int-builtin-inexact
12968 @opindex ffp-int-builtin-inexact
12969 Do not allow the built-in functions @code{ceil}, @code{floor},
12970 @code{round} and @code{trunc}, and their @code{float} and @code{long
12971 double} variants, to generate code that raises the ``inexact''
12972 floating-point exception for noninteger arguments. ISO C99 and C11
12973 allow these functions to raise the ``inexact'' exception, but ISO/IEC
12974 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
12975 ISO C2X, does not allow these functions to do so.
12977 The default is @option{-ffp-int-builtin-inexact}, allowing the
12978 exception to be raised, unless C2X or a later C standard is selected.
12979 This option does nothing unless @option{-ftrapping-math} is in effect.
12981 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
12982 generate a call to a library function then the ``inexact'' exception
12983 may be raised if the library implementation does not follow TS 18661.
12985 @item -fsingle-precision-constant
12986 @opindex fsingle-precision-constant
12987 Treat floating-point constants as single precision instead of
12988 implicitly converting them to double-precision constants.
12990 @item -fcx-limited-range
12991 @opindex fcx-limited-range
12992 When enabled, this option states that a range reduction step is not
12993 needed when performing complex division. Also, there is no checking
12994 whether the result of a complex multiplication or division is @code{NaN
12995 + I*NaN}, with an attempt to rescue the situation in that case. The
12996 default is @option{-fno-cx-limited-range}, but is enabled by
12997 @option{-ffast-math}.
12999 This option controls the default setting of the ISO C99
13000 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
13003 @item -fcx-fortran-rules
13004 @opindex fcx-fortran-rules
13005 Complex multiplication and division follow Fortran rules. Range
13006 reduction is done as part of complex division, but there is no checking
13007 whether the result of a complex multiplication or division is @code{NaN
13008 + I*NaN}, with an attempt to rescue the situation in that case.
13010 The default is @option{-fno-cx-fortran-rules}.
13014 The following options control optimizations that may improve
13015 performance, but are not enabled by any @option{-O} options. This
13016 section includes experimental options that may produce broken code.
13019 @item -fbranch-probabilities
13020 @opindex fbranch-probabilities
13021 After running a program compiled with @option{-fprofile-arcs}
13022 (@pxref{Instrumentation Options}),
13023 you can compile it a second time using
13024 @option{-fbranch-probabilities}, to improve optimizations based on
13025 the number of times each branch was taken. When a program
13026 compiled with @option{-fprofile-arcs} exits, it saves arc execution
13027 counts to a file called @file{@var{sourcename}.gcda} for each source
13028 file. The information in this data file is very dependent on the
13029 structure of the generated code, so you must use the same source code
13030 and the same optimization options for both compilations.
13032 With @option{-fbranch-probabilities}, GCC puts a
13033 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
13034 These can be used to improve optimization. Currently, they are only
13035 used in one place: in @file{reorg.c}, instead of guessing which path a
13036 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
13037 exactly determine which path is taken more often.
13039 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13041 @item -fprofile-values
13042 @opindex fprofile-values
13043 If combined with @option{-fprofile-arcs}, it adds code so that some
13044 data about values of expressions in the program is gathered.
13046 With @option{-fbranch-probabilities}, it reads back the data gathered
13047 from profiling values of expressions for usage in optimizations.
13049 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
13050 @option{-fauto-profile}.
13052 @item -fprofile-reorder-functions
13053 @opindex fprofile-reorder-functions
13054 Function reordering based on profile instrumentation collects
13055 first time of execution of a function and orders these functions
13056 in ascending order.
13058 Enabled with @option{-fprofile-use}.
13062 If combined with @option{-fprofile-arcs}, this option instructs the compiler
13063 to add code to gather information about values of expressions.
13065 With @option{-fbranch-probabilities}, it reads back the data gathered
13066 and actually performs the optimizations based on them.
13067 Currently the optimizations include specialization of division operations
13068 using the knowledge about the value of the denominator.
13070 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
13072 @item -frename-registers
13073 @opindex frename-registers
13074 Attempt to avoid false dependencies in scheduled code by making use
13075 of registers left over after register allocation. This optimization
13076 most benefits processors with lots of registers. Depending on the
13077 debug information format adopted by the target, however, it can
13078 make debugging impossible, since variables no longer stay in
13079 a ``home register''.
13081 Enabled by default with @option{-funroll-loops}.
13083 @item -fschedule-fusion
13084 @opindex fschedule-fusion
13085 Performs a target dependent pass over the instruction stream to schedule
13086 instructions of same type together because target machine can execute them
13087 more efficiently if they are adjacent to each other in the instruction flow.
13089 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13093 Perform tail duplication to enlarge superblock size. This transformation
13094 simplifies the control flow of the function allowing other optimizations to do
13097 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13099 @item -funroll-loops
13100 @opindex funroll-loops
13101 Unroll loops whose number of iterations can be determined at compile time or
13102 upon entry to the loop. @option{-funroll-loops} implies
13103 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
13104 It also turns on complete loop peeling (i.e.@: complete removal of loops with
13105 a small constant number of iterations). This option makes code larger, and may
13106 or may not make it run faster.
13108 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13110 @item -funroll-all-loops
13111 @opindex funroll-all-loops
13112 Unroll all loops, even if their number of iterations is uncertain when
13113 the loop is entered. This usually makes programs run more slowly.
13114 @option{-funroll-all-loops} implies the same options as
13115 @option{-funroll-loops}.
13118 @opindex fpeel-loops
13119 Peels loops for which there is enough information that they do not
13120 roll much (from profile feedback or static analysis). It also turns on
13121 complete loop peeling (i.e.@: complete removal of loops with small constant
13122 number of iterations).
13124 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
13126 @item -fmove-loop-invariants
13127 @opindex fmove-loop-invariants
13128 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
13129 at level @option{-O1} and higher, except for @option{-Og}.
13131 @item -fmove-loop-stores
13132 @opindex fmove-loop-stores
13133 Enables the loop store motion pass in the GIMPLE loop optimizer. This
13134 moves invariant stores to after the end of the loop in exchange for
13135 carrying the stored value in a register across the iteration.
13136 Note for this option to have an effect @option{-ftree-loop-im} has to
13137 be enabled as well. Enabled at level @option{-O1} and higher, except
13140 @item -fsplit-loops
13141 @opindex fsplit-loops
13142 Split a loop into two if it contains a condition that's always true
13143 for one side of the iteration space and false for the other.
13145 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13147 @item -funswitch-loops
13148 @opindex funswitch-loops
13149 Move branches with loop invariant conditions out of the loop, with duplicates
13150 of the loop on both branches (modified according to result of the condition).
13152 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13154 @item -fversion-loops-for-strides
13155 @opindex fversion-loops-for-strides
13156 If a loop iterates over an array with a variable stride, create another
13157 version of the loop that assumes the stride is always one. For example:
13160 for (int i = 0; i < n; ++i)
13161 x[i * stride] = @dots{};
13168 for (int i = 0; i < n; ++i)
13171 for (int i = 0; i < n; ++i)
13172 x[i * stride] = @dots{};
13175 This is particularly useful for assumed-shape arrays in Fortran where
13176 (for example) it allows better vectorization assuming contiguous accesses.
13177 This flag is enabled by default at @option{-O3}.
13178 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13180 @item -ffunction-sections
13181 @itemx -fdata-sections
13182 @opindex ffunction-sections
13183 @opindex fdata-sections
13184 Place each function or data item into its own section in the output
13185 file if the target supports arbitrary sections. The name of the
13186 function or the name of the data item determines the section's name
13187 in the output file.
13189 Use these options on systems where the linker can perform optimizations to
13190 improve locality of reference in the instruction space. Most systems using the
13191 ELF object format have linkers with such optimizations. On AIX, the linker
13192 rearranges sections (CSECTs) based on the call graph. The performance impact
13195 Together with a linker garbage collection (linker @option{--gc-sections}
13196 option) these options may lead to smaller statically-linked executables (after
13199 On ELF/DWARF systems these options do not degenerate the quality of the debug
13200 information. There could be issues with other object files/debug info formats.
13202 Only use these options when there are significant benefits from doing so. When
13203 you specify these options, the assembler and linker create larger object and
13204 executable files and are also slower. These options affect code generation.
13205 They prevent optimizations by the compiler and assembler using relative
13206 locations inside a translation unit since the locations are unknown until
13207 link time. An example of such an optimization is relaxing calls to short call
13211 @opindex fstdarg-opt
13212 Optimize the prologue of variadic argument functions with respect to usage of
13215 @item -fsection-anchors
13216 @opindex fsection-anchors
13217 Try to reduce the number of symbolic address calculations by using
13218 shared ``anchor'' symbols to address nearby objects. This transformation
13219 can help to reduce the number of GOT entries and GOT accesses on some
13222 For example, the implementation of the following function @code{foo}:
13225 static int a, b, c;
13226 int foo (void) @{ return a + b + c; @}
13230 usually calculates the addresses of all three variables, but if you
13231 compile it with @option{-fsection-anchors}, it accesses the variables
13232 from a common anchor point instead. The effect is similar to the
13233 following pseudocode (which isn't valid C):
13238 register int *xr = &x;
13239 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
13243 Not all targets support this option.
13245 @item -fzero-call-used-regs=@var{choice}
13246 @opindex fzero-call-used-regs
13247 Zero call-used registers at function return to increase program
13248 security by either mitigating Return-Oriented Programming (ROP)
13249 attacks or preventing information leakage through registers.
13251 The possible values of @var{choice} are the same as for the
13252 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
13253 The default is @samp{skip}.
13255 You can control this behavior for a specific function by using the function
13256 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
13258 @item --param @var{name}=@var{value}
13260 In some places, GCC uses various constants to control the amount of
13261 optimization that is done. For example, GCC does not inline functions
13262 that contain more than a certain number of instructions. You can
13263 control some of these constants on the command line using the
13264 @option{--param} option.
13266 The names of specific parameters, and the meaning of the values, are
13267 tied to the internals of the compiler, and are subject to change
13268 without notice in future releases.
13270 In order to get minimal, maximal and default value of a parameter,
13271 one can use @option{--help=param -Q} options.
13273 In each case, the @var{value} is an integer. The following choices
13274 of @var{name} are recognized for all targets:
13277 @item predictable-branch-outcome
13278 When branch is predicted to be taken with probability lower than this threshold
13279 (in percent), then it is considered well predictable.
13281 @item max-rtl-if-conversion-insns
13282 RTL if-conversion tries to remove conditional branches around a block and
13283 replace them with conditionally executed instructions. This parameter
13284 gives the maximum number of instructions in a block which should be
13285 considered for if-conversion. The compiler will
13286 also use other heuristics to decide whether if-conversion is likely to be
13289 @item max-rtl-if-conversion-predictable-cost
13290 RTL if-conversion will try to remove conditional branches around a block
13291 and replace them with conditionally executed instructions. These parameters
13292 give the maximum permissible cost for the sequence that would be generated
13293 by if-conversion depending on whether the branch is statically determined
13294 to be predictable or not. The units for this parameter are the same as
13295 those for the GCC internal seq_cost metric. The compiler will try to
13296 provide a reasonable default for this parameter using the BRANCH_COST
13299 @item max-crossjump-edges
13300 The maximum number of incoming edges to consider for cross-jumping.
13301 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
13302 the number of edges incoming to each block. Increasing values mean
13303 more aggressive optimization, making the compilation time increase with
13304 probably small improvement in executable size.
13306 @item min-crossjump-insns
13307 The minimum number of instructions that must be matched at the end
13308 of two blocks before cross-jumping is performed on them. This
13309 value is ignored in the case where all instructions in the block being
13310 cross-jumped from are matched.
13312 @item max-grow-copy-bb-insns
13313 The maximum code size expansion factor when copying basic blocks
13314 instead of jumping. The expansion is relative to a jump instruction.
13316 @item max-goto-duplication-insns
13317 The maximum number of instructions to duplicate to a block that jumps
13318 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
13319 passes, GCC factors computed gotos early in the compilation process,
13320 and unfactors them as late as possible. Only computed jumps at the
13321 end of a basic blocks with no more than max-goto-duplication-insns are
13324 @item max-delay-slot-insn-search
13325 The maximum number of instructions to consider when looking for an
13326 instruction to fill a delay slot. If more than this arbitrary number of
13327 instructions are searched, the time savings from filling the delay slot
13328 are minimal, so stop searching. Increasing values mean more
13329 aggressive optimization, making the compilation time increase with probably
13330 small improvement in execution time.
13332 @item max-delay-slot-live-search
13333 When trying to fill delay slots, the maximum number of instructions to
13334 consider when searching for a block with valid live register
13335 information. Increasing this arbitrarily chosen value means more
13336 aggressive optimization, increasing the compilation time. This parameter
13337 should be removed when the delay slot code is rewritten to maintain the
13338 control-flow graph.
13340 @item max-gcse-memory
13341 The approximate maximum amount of memory in @code{kB} that can be allocated in
13342 order to perform the global common subexpression elimination
13343 optimization. If more memory than specified is required, the
13344 optimization is not done.
13346 @item max-gcse-insertion-ratio
13347 If the ratio of expression insertions to deletions is larger than this value
13348 for any expression, then RTL PRE inserts or removes the expression and thus
13349 leaves partially redundant computations in the instruction stream.
13351 @item max-pending-list-length
13352 The maximum number of pending dependencies scheduling allows
13353 before flushing the current state and starting over. Large functions
13354 with few branches or calls can create excessively large lists which
13355 needlessly consume memory and resources.
13357 @item max-modulo-backtrack-attempts
13358 The maximum number of backtrack attempts the scheduler should make
13359 when modulo scheduling a loop. Larger values can exponentially increase
13362 @item max-inline-insns-single
13363 Several parameters control the tree inliner used in GCC@. This number sets the
13364 maximum number of instructions (counted in GCC's internal representation) in a
13365 single function that the tree inliner considers for inlining. This only
13366 affects functions declared inline and methods implemented in a class
13370 @item max-inline-insns-auto
13371 When you use @option{-finline-functions} (included in @option{-O3}),
13372 a lot of functions that would otherwise not be considered for inlining
13373 by the compiler are investigated. To those functions, a different
13374 (more restrictive) limit compared to functions declared inline can
13375 be applied (@option{--param max-inline-insns-auto}).
13377 @item max-inline-insns-small
13378 This is bound applied to calls which are considered relevant with
13379 @option{-finline-small-functions}.
13381 @item max-inline-insns-size
13382 This is bound applied to calls which are optimized for size. Small growth
13383 may be desirable to anticipate optimization oppurtunities exposed by inlining.
13385 @item uninlined-function-insns
13386 Number of instructions accounted by inliner for function overhead such as
13387 function prologue and epilogue.
13389 @item uninlined-function-time
13390 Extra time accounted by inliner for function overhead such as time needed to
13391 execute function prologue and epilogue.
13393 @item inline-heuristics-hint-percent
13394 The scale (in percents) applied to @option{inline-insns-single},
13395 @option{inline-insns-single-O2}, @option{inline-insns-auto}
13396 when inline heuristics hints that inlining is
13397 very profitable (will enable later optimizations).
13399 @item uninlined-thunk-insns
13400 @item uninlined-thunk-time
13401 Same as @option{--param uninlined-function-insns} and
13402 @option{--param uninlined-function-time} but applied to function thunks.
13404 @item inline-min-speedup
13405 When estimated performance improvement of caller + callee runtime exceeds this
13406 threshold (in percent), the function can be inlined regardless of the limit on
13407 @option{--param max-inline-insns-single} and @option{--param
13408 max-inline-insns-auto}.
13410 @item large-function-insns
13411 The limit specifying really large functions. For functions larger than this
13412 limit after inlining, inlining is constrained by
13413 @option{--param large-function-growth}. This parameter is useful primarily
13414 to avoid extreme compilation time caused by non-linear algorithms used by the
13417 @item large-function-growth
13418 Specifies maximal growth of large function caused by inlining in percents.
13419 For example, parameter value 100 limits large function growth to 2.0 times
13422 @item large-unit-insns
13423 The limit specifying large translation unit. Growth caused by inlining of
13424 units larger than this limit is limited by @option{--param inline-unit-growth}.
13425 For small units this might be too tight.
13426 For example, consider a unit consisting of function A
13427 that is inline and B that just calls A three times. If B is small relative to
13428 A, the growth of unit is 300\% and yet such inlining is very sane. For very
13429 large units consisting of small inlineable functions, however, the overall unit
13430 growth limit is needed to avoid exponential explosion of code size. Thus for
13431 smaller units, the size is increased to @option{--param large-unit-insns}
13432 before applying @option{--param inline-unit-growth}.
13435 Maximum number of concurrently open C++ module files when lazy loading.
13437 @item inline-unit-growth
13438 Specifies maximal overall growth of the compilation unit caused by inlining.
13439 For example, parameter value 20 limits unit growth to 1.2 times the original
13440 size. Cold functions (either marked cold via an attribute or by profile
13441 feedback) are not accounted into the unit size.
13443 @item ipa-cp-unit-growth
13444 Specifies maximal overall growth of the compilation unit caused by
13445 interprocedural constant propagation. For example, parameter value 10 limits
13446 unit growth to 1.1 times the original size.
13448 @item ipa-cp-large-unit-insns
13449 The size of translation unit that IPA-CP pass considers large.
13451 @item large-stack-frame
13452 The limit specifying large stack frames. While inlining the algorithm is trying
13453 to not grow past this limit too much.
13455 @item large-stack-frame-growth
13456 Specifies maximal growth of large stack frames caused by inlining in percents.
13457 For example, parameter value 1000 limits large stack frame growth to 11 times
13460 @item max-inline-insns-recursive
13461 @itemx max-inline-insns-recursive-auto
13462 Specifies the maximum number of instructions an out-of-line copy of a
13463 self-recursive inline
13464 function can grow into by performing recursive inlining.
13466 @option{--param max-inline-insns-recursive} applies to functions
13468 For functions not declared inline, recursive inlining
13469 happens only when @option{-finline-functions} (included in @option{-O3}) is
13470 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
13472 @item max-inline-recursive-depth
13473 @itemx max-inline-recursive-depth-auto
13474 Specifies the maximum recursion depth used for recursive inlining.
13476 @option{--param max-inline-recursive-depth} applies to functions
13477 declared inline. For functions not declared inline, recursive inlining
13478 happens only when @option{-finline-functions} (included in @option{-O3}) is
13479 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
13481 @item min-inline-recursive-probability
13482 Recursive inlining is profitable only for function having deep recursion
13483 in average and can hurt for function having little recursion depth by
13484 increasing the prologue size or complexity of function body to other
13487 When profile feedback is available (see @option{-fprofile-generate}) the actual
13488 recursion depth can be guessed from the probability that function recurses
13489 via a given call expression. This parameter limits inlining only to call
13490 expressions whose probability exceeds the given threshold (in percents).
13492 @item early-inlining-insns
13493 Specify growth that the early inliner can make. In effect it increases
13494 the amount of inlining for code having a large abstraction penalty.
13496 @item max-early-inliner-iterations
13497 Limit of iterations of the early inliner. This basically bounds
13498 the number of nested indirect calls the early inliner can resolve.
13499 Deeper chains are still handled by late inlining.
13501 @item comdat-sharing-probability
13502 Probability (in percent) that C++ inline function with comdat visibility
13503 are shared across multiple compilation units.
13505 @item modref-max-bases
13506 @item modref-max-refs
13507 @item modref-max-accesses
13508 Specifies the maximal number of base pointers, references and accesses stored
13509 for a single function by mod/ref analysis.
13511 @item modref-max-tests
13512 Specifies the maxmal number of tests alias oracle can perform to disambiguate
13513 memory locations using the mod/ref information. This parameter ought to be
13514 bigger than @option{--param modref-max-bases} and @option{--param
13517 @item modref-max-depth
13518 Specifies the maximum depth of DFS walk used by modref escape analysis.
13519 Setting to 0 disables the analysis completely.
13521 @item modref-max-escape-points
13522 Specifies the maximum number of escape points tracked by modref per SSA-name.
13524 @item modref-max-adjustments
13525 Specifies the maximum number the access range is enlarged during modref dataflow
13528 @item profile-func-internal-id
13529 A parameter to control whether to use function internal id in profile
13530 database lookup. If the value is 0, the compiler uses an id that
13531 is based on function assembler name and filename, which makes old profile
13532 data more tolerant to source changes such as function reordering etc.
13534 @item min-vect-loop-bound
13535 The minimum number of iterations under which loops are not vectorized
13536 when @option{-ftree-vectorize} is used. The number of iterations after
13537 vectorization needs to be greater than the value specified by this option
13538 to allow vectorization.
13540 @item gcse-cost-distance-ratio
13541 Scaling factor in calculation of maximum distance an expression
13542 can be moved by GCSE optimizations. This is currently supported only in the
13543 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
13544 is with simple expressions, i.e., the expressions that have cost
13545 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
13546 hoisting of simple expressions.
13548 @item gcse-unrestricted-cost
13549 Cost, roughly measured as the cost of a single typical machine
13550 instruction, at which GCSE optimizations do not constrain
13551 the distance an expression can travel. This is currently
13552 supported only in the code hoisting pass. The lesser the cost,
13553 the more aggressive code hoisting is. Specifying 0
13554 allows all expressions to travel unrestricted distances.
13556 @item max-hoist-depth
13557 The depth of search in the dominator tree for expressions to hoist.
13558 This is used to avoid quadratic behavior in hoisting algorithm.
13559 The value of 0 does not limit on the search, but may slow down compilation
13562 @item max-tail-merge-comparisons
13563 The maximum amount of similar bbs to compare a bb with. This is used to
13564 avoid quadratic behavior in tree tail merging.
13566 @item max-tail-merge-iterations
13567 The maximum amount of iterations of the pass over the function. This is used to
13568 limit compilation time in tree tail merging.
13570 @item store-merging-allow-unaligned
13571 Allow the store merging pass to introduce unaligned stores if it is legal to
13574 @item max-stores-to-merge
13575 The maximum number of stores to attempt to merge into wider stores in the store
13578 @item max-store-chains-to-track
13579 The maximum number of store chains to track at the same time in the attempt
13580 to merge them into wider stores in the store merging pass.
13582 @item max-stores-to-track
13583 The maximum number of stores to track at the same time in the attemt to
13584 to merge them into wider stores in the store merging pass.
13586 @item max-unrolled-insns
13587 The maximum number of instructions that a loop may have to be unrolled.
13588 If a loop is unrolled, this parameter also determines how many times
13589 the loop code is unrolled.
13591 @item max-average-unrolled-insns
13592 The maximum number of instructions biased by probabilities of their execution
13593 that a loop may have to be unrolled. If a loop is unrolled,
13594 this parameter also determines how many times the loop code is unrolled.
13596 @item max-unroll-times
13597 The maximum number of unrollings of a single loop.
13599 @item max-peeled-insns
13600 The maximum number of instructions that a loop may have to be peeled.
13601 If a loop is peeled, this parameter also determines how many times
13602 the loop code is peeled.
13604 @item max-peel-times
13605 The maximum number of peelings of a single loop.
13607 @item max-peel-branches
13608 The maximum number of branches on the hot path through the peeled sequence.
13610 @item max-completely-peeled-insns
13611 The maximum number of insns of a completely peeled loop.
13613 @item max-completely-peel-times
13614 The maximum number of iterations of a loop to be suitable for complete peeling.
13616 @item max-completely-peel-loop-nest-depth
13617 The maximum depth of a loop nest suitable for complete peeling.
13619 @item max-unswitch-insns
13620 The maximum number of insns of an unswitched loop.
13622 @item max-unswitch-level
13623 The maximum number of branches unswitched in a single loop.
13625 @item lim-expensive
13626 The minimum cost of an expensive expression in the loop invariant motion.
13628 @item min-loop-cond-split-prob
13629 When FDO profile information is available, @option{min-loop-cond-split-prob}
13630 specifies minimum threshold for probability of semi-invariant condition
13631 statement to trigger loop split.
13633 @item iv-consider-all-candidates-bound
13634 Bound on number of candidates for induction variables, below which
13635 all candidates are considered for each use in induction variable
13636 optimizations. If there are more candidates than this,
13637 only the most relevant ones are considered to avoid quadratic time complexity.
13639 @item iv-max-considered-uses
13640 The induction variable optimizations give up on loops that contain more
13641 induction variable uses.
13643 @item iv-always-prune-cand-set-bound
13644 If the number of candidates in the set is smaller than this value,
13645 always try to remove unnecessary ivs from the set
13646 when adding a new one.
13648 @item avg-loop-niter
13649 Average number of iterations of a loop.
13651 @item dse-max-object-size
13652 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
13653 Larger values may result in larger compilation times.
13655 @item dse-max-alias-queries-per-store
13656 Maximum number of queries into the alias oracle per store.
13657 Larger values result in larger compilation times and may result in more
13658 removed dead stores.
13660 @item scev-max-expr-size
13661 Bound on size of expressions used in the scalar evolutions analyzer.
13662 Large expressions slow the analyzer.
13664 @item scev-max-expr-complexity
13665 Bound on the complexity of the expressions in the scalar evolutions analyzer.
13666 Complex expressions slow the analyzer.
13668 @item max-tree-if-conversion-phi-args
13669 Maximum number of arguments in a PHI supported by TREE if conversion
13670 unless the loop is marked with simd pragma.
13672 @item vect-max-version-for-alignment-checks
13673 The maximum number of run-time checks that can be performed when
13674 doing loop versioning for alignment in the vectorizer.
13676 @item vect-max-version-for-alias-checks
13677 The maximum number of run-time checks that can be performed when
13678 doing loop versioning for alias in the vectorizer.
13680 @item vect-max-peeling-for-alignment
13681 The maximum number of loop peels to enhance access alignment
13682 for vectorizer. Value -1 means no limit.
13684 @item max-iterations-to-track
13685 The maximum number of iterations of a loop the brute-force algorithm
13686 for analysis of the number of iterations of the loop tries to evaluate.
13688 @item hot-bb-count-fraction
13689 The denominator n of fraction 1/n of the maximal execution count of a
13690 basic block in the entire program that a basic block needs to at least
13691 have in order to be considered hot. The default is 10000, which means
13692 that a basic block is considered hot if its execution count is greater
13693 than 1/10000 of the maximal execution count. 0 means that it is never
13694 considered hot. Used in non-LTO mode.
13696 @item hot-bb-count-ws-permille
13697 The number of most executed permilles, ranging from 0 to 1000, of the
13698 profiled execution of the entire program to which the execution count
13699 of a basic block must be part of in order to be considered hot. The
13700 default is 990, which means that a basic block is considered hot if
13701 its execution count contributes to the upper 990 permilles, or 99.0%,
13702 of the profiled execution of the entire program. 0 means that it is
13703 never considered hot. Used in LTO mode.
13705 @item hot-bb-frequency-fraction
13706 The denominator n of fraction 1/n of the execution frequency of the
13707 entry block of a function that a basic block of this function needs
13708 to at least have in order to be considered hot. The default is 1000,
13709 which means that a basic block is considered hot in a function if it
13710 is executed more frequently than 1/1000 of the frequency of the entry
13711 block of the function. 0 means that it is never considered hot.
13713 @item unlikely-bb-count-fraction
13714 The denominator n of fraction 1/n of the number of profiled runs of
13715 the entire program below which the execution count of a basic block
13716 must be in order for the basic block to be considered unlikely executed.
13717 The default is 20, which means that a basic block is considered unlikely
13718 executed if it is executed in fewer than 1/20, or 5%, of the runs of
13719 the program. 0 means that it is always considered unlikely executed.
13721 @item max-predicted-iterations
13722 The maximum number of loop iterations we predict statically. This is useful
13723 in cases where a function contains a single loop with known bound and
13724 another loop with unknown bound.
13725 The known number of iterations is predicted correctly, while
13726 the unknown number of iterations average to roughly 10. This means that the
13727 loop without bounds appears artificially cold relative to the other one.
13729 @item builtin-expect-probability
13730 Control the probability of the expression having the specified value. This
13731 parameter takes a percentage (i.e.@: 0 ... 100) as input.
13733 @item builtin-string-cmp-inline-length
13734 The maximum length of a constant string for a builtin string cmp call
13735 eligible for inlining.
13737 @item align-threshold
13739 Select fraction of the maximal frequency of executions of a basic block in
13740 a function to align the basic block.
13742 @item align-loop-iterations
13744 A loop expected to iterate at least the selected number of iterations is
13747 @item tracer-dynamic-coverage
13748 @itemx tracer-dynamic-coverage-feedback
13750 This value is used to limit superblock formation once the given percentage of
13751 executed instructions is covered. This limits unnecessary code size
13754 The @option{tracer-dynamic-coverage-feedback} parameter
13755 is used only when profile
13756 feedback is available. The real profiles (as opposed to statically estimated
13757 ones) are much less balanced allowing the threshold to be larger value.
13759 @item tracer-max-code-growth
13760 Stop tail duplication once code growth has reached given percentage. This is
13761 a rather artificial limit, as most of the duplicates are eliminated later in
13762 cross jumping, so it may be set to much higher values than is the desired code
13765 @item tracer-min-branch-ratio
13767 Stop reverse growth when the reverse probability of best edge is less than this
13768 threshold (in percent).
13770 @item tracer-min-branch-probability
13771 @itemx tracer-min-branch-probability-feedback
13773 Stop forward growth if the best edge has probability lower than this
13776 Similarly to @option{tracer-dynamic-coverage} two parameters are
13777 provided. @option{tracer-min-branch-probability-feedback} is used for
13778 compilation with profile feedback and @option{tracer-min-branch-probability}
13779 compilation without. The value for compilation with profile feedback
13780 needs to be more conservative (higher) in order to make tracer
13783 @item stack-clash-protection-guard-size
13784 Specify the size of the operating system provided stack guard as
13785 2 raised to @var{num} bytes. Higher values may reduce the
13786 number of explicit probes, but a value larger than the operating system
13787 provided guard will leave code vulnerable to stack clash style attacks.
13789 @item stack-clash-protection-probe-interval
13790 Stack clash protection involves probing stack space as it is allocated. This
13791 param controls the maximum distance between probes into the stack as 2 raised
13792 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
13793 larger than the operating system provided guard will leave code vulnerable to
13794 stack clash style attacks.
13796 @item max-cse-path-length
13798 The maximum number of basic blocks on path that CSE considers.
13800 @item max-cse-insns
13801 The maximum number of instructions CSE processes before flushing.
13803 @item ggc-min-expand
13805 GCC uses a garbage collector to manage its own memory allocation. This
13806 parameter specifies the minimum percentage by which the garbage
13807 collector's heap should be allowed to expand between collections.
13808 Tuning this may improve compilation speed; it has no effect on code
13811 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
13812 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
13813 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
13814 GCC is not able to calculate RAM on a particular platform, the lower
13815 bound of 30% is used. Setting this parameter and
13816 @option{ggc-min-heapsize} to zero causes a full collection to occur at
13817 every opportunity. This is extremely slow, but can be useful for
13820 @item ggc-min-heapsize
13822 Minimum size of the garbage collector's heap before it begins bothering
13823 to collect garbage. The first collection occurs after the heap expands
13824 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
13825 tuning this may improve compilation speed, and has no effect on code
13828 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
13829 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
13830 with a lower bound of 4096 (four megabytes) and an upper bound of
13831 131072 (128 megabytes). If GCC is not able to calculate RAM on a
13832 particular platform, the lower bound is used. Setting this parameter
13833 very large effectively disables garbage collection. Setting this
13834 parameter and @option{ggc-min-expand} to zero causes a full collection
13835 to occur at every opportunity.
13837 @item max-reload-search-insns
13838 The maximum number of instruction reload should look backward for equivalent
13839 register. Increasing values mean more aggressive optimization, making the
13840 compilation time increase with probably slightly better performance.
13842 @item max-cselib-memory-locations
13843 The maximum number of memory locations cselib should take into account.
13844 Increasing values mean more aggressive optimization, making the compilation time
13845 increase with probably slightly better performance.
13847 @item max-sched-ready-insns
13848 The maximum number of instructions ready to be issued the scheduler should
13849 consider at any given time during the first scheduling pass. Increasing
13850 values mean more thorough searches, making the compilation time increase
13851 with probably little benefit.
13853 @item max-sched-region-blocks
13854 The maximum number of blocks in a region to be considered for
13855 interblock scheduling.
13857 @item max-pipeline-region-blocks
13858 The maximum number of blocks in a region to be considered for
13859 pipelining in the selective scheduler.
13861 @item max-sched-region-insns
13862 The maximum number of insns in a region to be considered for
13863 interblock scheduling.
13865 @item max-pipeline-region-insns
13866 The maximum number of insns in a region to be considered for
13867 pipelining in the selective scheduler.
13869 @item min-spec-prob
13870 The minimum probability (in percents) of reaching a source block
13871 for interblock speculative scheduling.
13873 @item max-sched-extend-regions-iters
13874 The maximum number of iterations through CFG to extend regions.
13875 A value of 0 disables region extensions.
13877 @item max-sched-insn-conflict-delay
13878 The maximum conflict delay for an insn to be considered for speculative motion.
13880 @item sched-spec-prob-cutoff
13881 The minimal probability of speculation success (in percents), so that
13882 speculative insns are scheduled.
13884 @item sched-state-edge-prob-cutoff
13885 The minimum probability an edge must have for the scheduler to save its
13888 @item sched-mem-true-dep-cost
13889 Minimal distance (in CPU cycles) between store and load targeting same
13892 @item selsched-max-lookahead
13893 The maximum size of the lookahead window of selective scheduling. It is a
13894 depth of search for available instructions.
13896 @item selsched-max-sched-times
13897 The maximum number of times that an instruction is scheduled during
13898 selective scheduling. This is the limit on the number of iterations
13899 through which the instruction may be pipelined.
13901 @item selsched-insns-to-rename
13902 The maximum number of best instructions in the ready list that are considered
13903 for renaming in the selective scheduler.
13906 The minimum value of stage count that swing modulo scheduler
13909 @item max-last-value-rtl
13910 The maximum size measured as number of RTLs that can be recorded in an expression
13911 in combiner for a pseudo register as last known value of that register.
13913 @item max-combine-insns
13914 The maximum number of instructions the RTL combiner tries to combine.
13916 @item integer-share-limit
13917 Small integer constants can use a shared data structure, reducing the
13918 compiler's memory usage and increasing its speed. This sets the maximum
13919 value of a shared integer constant.
13921 @item ssp-buffer-size
13922 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
13923 protection when @option{-fstack-protection} is used.
13925 @item min-size-for-stack-sharing
13926 The minimum size of variables taking part in stack slot sharing when not
13929 @item max-jump-thread-duplication-stmts
13930 Maximum number of statements allowed in a block that needs to be
13931 duplicated when threading jumps.
13933 @item max-fields-for-field-sensitive
13934 Maximum number of fields in a structure treated in
13935 a field sensitive manner during pointer analysis.
13937 @item prefetch-latency
13938 Estimate on average number of instructions that are executed before
13939 prefetch finishes. The distance prefetched ahead is proportional
13940 to this constant. Increasing this number may also lead to less
13941 streams being prefetched (see @option{simultaneous-prefetches}).
13943 @item simultaneous-prefetches
13944 Maximum number of prefetches that can run at the same time.
13946 @item l1-cache-line-size
13947 The size of cache line in L1 data cache, in bytes.
13949 @item l1-cache-size
13950 The size of L1 data cache, in kilobytes.
13952 @item l2-cache-size
13953 The size of L2 data cache, in kilobytes.
13955 @item prefetch-dynamic-strides
13956 Whether the loop array prefetch pass should issue software prefetch hints
13957 for strides that are non-constant. In some cases this may be
13958 beneficial, though the fact the stride is non-constant may make it
13959 hard to predict when there is clear benefit to issuing these hints.
13961 Set to 1 if the prefetch hints should be issued for non-constant
13962 strides. Set to 0 if prefetch hints should be issued only for strides that
13963 are known to be constant and below @option{prefetch-minimum-stride}.
13965 @item prefetch-minimum-stride
13966 Minimum constant stride, in bytes, to start using prefetch hints for. If
13967 the stride is less than this threshold, prefetch hints will not be issued.
13969 This setting is useful for processors that have hardware prefetchers, in
13970 which case there may be conflicts between the hardware prefetchers and
13971 the software prefetchers. If the hardware prefetchers have a maximum
13972 stride they can handle, it should be used here to improve the use of
13973 software prefetchers.
13975 A value of -1 means we don't have a threshold and therefore
13976 prefetch hints can be issued for any constant stride.
13978 This setting is only useful for strides that are known and constant.
13980 @item destructive-interference-size
13981 @item constructive-interference-size
13982 The values for the C++17 variables
13983 @code{std::hardware_destructive_interference_size} and
13984 @code{std::hardware_constructive_interference_size}. The destructive
13985 interference size is the minimum recommended offset between two
13986 independent concurrently-accessed objects; the constructive
13987 interference size is the maximum recommended size of contiguous memory
13988 accessed together. Typically both will be the size of an L1 cache
13989 line for the target, in bytes. For a generic target covering a range of L1
13990 cache line sizes, typically the constructive interference size will be
13991 the small end of the range and the destructive size will be the large
13994 The destructive interference size is intended to be used for layout,
13995 and thus has ABI impact. The default value is not expected to be
13996 stable, and on some targets varies with @option{-mtune}, so use of
13997 this variable in a context where ABI stability is important, such as
13998 the public interface of a library, is strongly discouraged; if it is
13999 used in that context, users can stabilize the value using this
14002 The constructive interference size is less sensitive, as it is
14003 typically only used in a @samp{static_assert} to make sure that a type
14004 fits within a cache line.
14006 See also @option{-Winterference-size}.
14008 @item loop-interchange-max-num-stmts
14009 The maximum number of stmts in a loop to be interchanged.
14011 @item loop-interchange-stride-ratio
14012 The minimum ratio between stride of two loops for interchange to be profitable.
14014 @item min-insn-to-prefetch-ratio
14015 The minimum ratio between the number of instructions and the
14016 number of prefetches to enable prefetching in a loop.
14018 @item prefetch-min-insn-to-mem-ratio
14019 The minimum ratio between the number of instructions and the
14020 number of memory references to enable prefetching in a loop.
14022 @item use-canonical-types
14023 Whether the compiler should use the ``canonical'' type system.
14024 Should always be 1, which uses a more efficient internal
14025 mechanism for comparing types in C++ and Objective-C++. However, if
14026 bugs in the canonical type system are causing compilation failures,
14027 set this value to 0 to disable canonical types.
14029 @item switch-conversion-max-branch-ratio
14030 Switch initialization conversion refuses to create arrays that are
14031 bigger than @option{switch-conversion-max-branch-ratio} times the number of
14032 branches in the switch.
14034 @item max-partial-antic-length
14035 Maximum length of the partial antic set computed during the tree
14036 partial redundancy elimination optimization (@option{-ftree-pre}) when
14037 optimizing at @option{-O3} and above. For some sorts of source code
14038 the enhanced partial redundancy elimination optimization can run away,
14039 consuming all of the memory available on the host machine. This
14040 parameter sets a limit on the length of the sets that are computed,
14041 which prevents the runaway behavior. Setting a value of 0 for
14042 this parameter allows an unlimited set length.
14044 @item rpo-vn-max-loop-depth
14045 Maximum loop depth that is value-numbered optimistically.
14046 When the limit hits the innermost
14047 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
14048 loop nest are value-numbered optimistically and the remaining ones not.
14050 @item sccvn-max-alias-queries-per-access
14051 Maximum number of alias-oracle queries we perform when looking for
14052 redundancies for loads and stores. If this limit is hit the search
14053 is aborted and the load or store is not considered redundant. The
14054 number of queries is algorithmically limited to the number of
14055 stores on all paths from the load to the function entry.
14057 @item ira-max-loops-num
14058 IRA uses regional register allocation by default. If a function
14059 contains more loops than the number given by this parameter, only at most
14060 the given number of the most frequently-executed loops form regions
14061 for regional register allocation.
14063 @item ira-max-conflict-table-size
14064 Although IRA uses a sophisticated algorithm to compress the conflict
14065 table, the table can still require excessive amounts of memory for
14066 huge functions. If the conflict table for a function could be more
14067 than the size in MB given by this parameter, the register allocator
14068 instead uses a faster, simpler, and lower-quality
14069 algorithm that does not require building a pseudo-register conflict table.
14071 @item ira-loop-reserved-regs
14072 IRA can be used to evaluate more accurate register pressure in loops
14073 for decisions to move loop invariants (see @option{-O3}). The number
14074 of available registers reserved for some other purposes is given
14075 by this parameter. Default of the parameter
14076 is the best found from numerous experiments.
14078 @item ira-consider-dup-in-all-alts
14079 Make IRA to consider matching constraint (duplicated operand number)
14080 heavily in all available alternatives for preferred register class.
14081 If it is set as zero, it means IRA only respects the matching
14082 constraint when it's in the only available alternative with an
14083 appropriate register class. Otherwise, it means IRA will check all
14084 available alternatives for preferred register class even if it has
14085 found some choice with an appropriate register class and respect the
14086 found qualified matching constraint.
14088 @item lra-inheritance-ebb-probability-cutoff
14089 LRA tries to reuse values reloaded in registers in subsequent insns.
14090 This optimization is called inheritance. EBB is used as a region to
14091 do this optimization. The parameter defines a minimal fall-through
14092 edge probability in percentage used to add BB to inheritance EBB in
14093 LRA. The default value was chosen
14094 from numerous runs of SPEC2000 on x86-64.
14096 @item loop-invariant-max-bbs-in-loop
14097 Loop invariant motion can be very expensive, both in compilation time and
14098 in amount of needed compile-time memory, with very large loops. Loops
14099 with more basic blocks than this parameter won't have loop invariant
14100 motion optimization performed on them.
14102 @item loop-max-datarefs-for-datadeps
14103 Building data dependencies is expensive for very large loops. This
14104 parameter limits the number of data references in loops that are
14105 considered for data dependence analysis. These large loops are no
14106 handled by the optimizations using loop data dependencies.
14108 @item max-vartrack-size
14109 Sets a maximum number of hash table slots to use during variable
14110 tracking dataflow analysis of any function. If this limit is exceeded
14111 with variable tracking at assignments enabled, analysis for that
14112 function is retried without it, after removing all debug insns from
14113 the function. If the limit is exceeded even without debug insns, var
14114 tracking analysis is completely disabled for the function. Setting
14115 the parameter to zero makes it unlimited.
14117 @item max-vartrack-expr-depth
14118 Sets a maximum number of recursion levels when attempting to map
14119 variable names or debug temporaries to value expressions. This trades
14120 compilation time for more complete debug information. If this is set too
14121 low, value expressions that are available and could be represented in
14122 debug information may end up not being used; setting this higher may
14123 enable the compiler to find more complex debug expressions, but compile
14124 time and memory use may grow.
14126 @item max-debug-marker-count
14127 Sets a threshold on the number of debug markers (e.g.@: begin stmt
14128 markers) to avoid complexity explosion at inlining or expanding to RTL.
14129 If a function has more such gimple stmts than the set limit, such stmts
14130 will be dropped from the inlined copy of a function, and from its RTL
14133 @item min-nondebug-insn-uid
14134 Use uids starting at this parameter for nondebug insns. The range below
14135 the parameter is reserved exclusively for debug insns created by
14136 @option{-fvar-tracking-assignments}, but debug insns may get
14137 (non-overlapping) uids above it if the reserved range is exhausted.
14139 @item ipa-sra-ptr-growth-factor
14140 IPA-SRA replaces a pointer to an aggregate with one or more new
14141 parameters only when their cumulative size is less or equal to
14142 @option{ipa-sra-ptr-growth-factor} times the size of the original
14145 @item ipa-sra-max-replacements
14146 Maximum pieces of an aggregate that IPA-SRA tracks. As a
14147 consequence, it is also the maximum number of replacements of a formal
14150 @item sra-max-scalarization-size-Ospeed
14151 @itemx sra-max-scalarization-size-Osize
14152 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
14153 replace scalar parts of aggregates with uses of independent scalar
14154 variables. These parameters control the maximum size, in storage units,
14155 of aggregate which is considered for replacement when compiling for
14157 (@option{sra-max-scalarization-size-Ospeed}) or size
14158 (@option{sra-max-scalarization-size-Osize}) respectively.
14160 @item sra-max-propagations
14161 The maximum number of artificial accesses that Scalar Replacement of
14162 Aggregates (SRA) will track, per one local variable, in order to
14163 facilitate copy propagation.
14165 @item tm-max-aggregate-size
14166 When making copies of thread-local variables in a transaction, this
14167 parameter specifies the size in bytes after which variables are
14168 saved with the logging functions as opposed to save/restore code
14169 sequence pairs. This option only applies when using
14172 @item graphite-max-nb-scop-params
14173 To avoid exponential effects in the Graphite loop transforms, the
14174 number of parameters in a Static Control Part (SCoP) is bounded.
14175 A value of zero can be used to lift
14176 the bound. A variable whose value is unknown at compilation time and
14177 defined outside a SCoP is a parameter of the SCoP.
14179 @item loop-block-tile-size
14180 Loop blocking or strip mining transforms, enabled with
14181 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
14182 loop in the loop nest by a given number of iterations. The strip
14183 length can be changed using the @option{loop-block-tile-size}
14186 @item ipa-jump-function-lookups
14187 Specifies number of statements visited during jump function offset discovery.
14189 @item ipa-cp-value-list-size
14190 IPA-CP attempts to track all possible values and types passed to a function's
14191 parameter in order to propagate them and perform devirtualization.
14192 @option{ipa-cp-value-list-size} is the maximum number of values and types it
14193 stores per one formal parameter of a function.
14195 @item ipa-cp-eval-threshold
14196 IPA-CP calculates its own score of cloning profitability heuristics
14197 and performs those cloning opportunities with scores that exceed
14198 @option{ipa-cp-eval-threshold}.
14200 @item ipa-cp-max-recursive-depth
14201 Maximum depth of recursive cloning for self-recursive function.
14203 @item ipa-cp-min-recursive-probability
14204 Recursive cloning only when the probability of call being executed exceeds
14207 @item ipa-cp-recursion-penalty
14208 Percentage penalty the recursive functions will receive when they
14209 are evaluated for cloning.
14211 @item ipa-cp-single-call-penalty
14212 Percentage penalty functions containing a single call to another
14213 function will receive when they are evaluated for cloning.
14215 @item ipa-max-agg-items
14216 IPA-CP is also capable to propagate a number of scalar values passed
14217 in an aggregate. @option{ipa-max-agg-items} controls the maximum
14218 number of such values per one parameter.
14220 @item ipa-cp-loop-hint-bonus
14221 When IPA-CP determines that a cloning candidate would make the number
14222 of iterations of a loop known, it adds a bonus of
14223 @option{ipa-cp-loop-hint-bonus} to the profitability score of
14226 @item ipa-max-loop-predicates
14227 The maximum number of different predicates IPA will use to describe when
14228 loops in a function have known properties.
14230 @item ipa-max-aa-steps
14231 During its analysis of function bodies, IPA-CP employs alias analysis
14232 in order to track values pointed to by function parameters. In order
14233 not spend too much time analyzing huge functions, it gives up and
14234 consider all memory clobbered after examining
14235 @option{ipa-max-aa-steps} statements modifying memory.
14237 @item ipa-max-switch-predicate-bounds
14238 Maximal number of boundary endpoints of case ranges of switch statement.
14239 For switch exceeding this limit, IPA-CP will not construct cloning cost
14240 predicate, which is used to estimate cloning benefit, for default case
14241 of the switch statement.
14243 @item ipa-max-param-expr-ops
14244 IPA-CP will analyze conditional statement that references some function
14245 parameter to estimate benefit for cloning upon certain constant value.
14246 But if number of operations in a parameter expression exceeds
14247 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
14248 one, and is not handled by IPA analysis.
14250 @item lto-partitions
14251 Specify desired number of partitions produced during WHOPR compilation.
14252 The number of partitions should exceed the number of CPUs used for compilation.
14254 @item lto-min-partition
14255 Size of minimal partition for WHOPR (in estimated instructions).
14256 This prevents expenses of splitting very small programs into too many
14259 @item lto-max-partition
14260 Size of max partition for WHOPR (in estimated instructions).
14261 to provide an upper bound for individual size of partition.
14262 Meant to be used only with balanced partitioning.
14264 @item lto-max-streaming-parallelism
14265 Maximal number of parallel processes used for LTO streaming.
14267 @item cxx-max-namespaces-for-diagnostic-help
14268 The maximum number of namespaces to consult for suggestions when C++
14269 name lookup fails for an identifier.
14271 @item sink-frequency-threshold
14272 The maximum relative execution frequency (in percents) of the target block
14273 relative to a statement's original block to allow statement sinking of a
14274 statement. Larger numbers result in more aggressive statement sinking.
14275 A small positive adjustment is applied for
14276 statements with memory operands as those are even more profitable so sink.
14278 @item max-stores-to-sink
14279 The maximum number of conditional store pairs that can be sunk. Set to 0
14280 if either vectorization (@option{-ftree-vectorize}) or if-conversion
14281 (@option{-ftree-loop-if-convert}) is disabled.
14283 @item case-values-threshold
14284 The smallest number of different values for which it is best to use a
14285 jump-table instead of a tree of conditional branches. If the value is
14286 0, use the default for the machine.
14288 @item jump-table-max-growth-ratio-for-size
14289 The maximum code size growth ratio when expanding
14290 into a jump table (in percent). The parameter is used when
14291 optimizing for size.
14293 @item jump-table-max-growth-ratio-for-speed
14294 The maximum code size growth ratio when expanding
14295 into a jump table (in percent). The parameter is used when
14296 optimizing for speed.
14298 @item tree-reassoc-width
14299 Set the maximum number of instructions executed in parallel in
14300 reassociated tree. This parameter overrides target dependent
14301 heuristics used by default if has non zero value.
14303 @item sched-pressure-algorithm
14304 Choose between the two available implementations of
14305 @option{-fsched-pressure}. Algorithm 1 is the original implementation
14306 and is the more likely to prevent instructions from being reordered.
14307 Algorithm 2 was designed to be a compromise between the relatively
14308 conservative approach taken by algorithm 1 and the rather aggressive
14309 approach taken by the default scheduler. It relies more heavily on
14310 having a regular register file and accurate register pressure classes.
14311 See @file{haifa-sched.c} in the GCC sources for more details.
14313 The default choice depends on the target.
14315 @item max-slsr-cand-scan
14316 Set the maximum number of existing candidates that are considered when
14317 seeking a basis for a new straight-line strength reduction candidate.
14320 Enable buffer overflow detection for global objects. This kind
14321 of protection is enabled by default if you are using
14322 @option{-fsanitize=address} option.
14323 To disable global objects protection use @option{--param asan-globals=0}.
14326 Enable buffer overflow detection for stack objects. This kind of
14327 protection is enabled by default when using @option{-fsanitize=address}.
14328 To disable stack protection use @option{--param asan-stack=0} option.
14330 @item asan-instrument-reads
14331 Enable buffer overflow detection for memory reads. This kind of
14332 protection is enabled by default when using @option{-fsanitize=address}.
14333 To disable memory reads protection use
14334 @option{--param asan-instrument-reads=0}.
14336 @item asan-instrument-writes
14337 Enable buffer overflow detection for memory writes. This kind of
14338 protection is enabled by default when using @option{-fsanitize=address}.
14339 To disable memory writes protection use
14340 @option{--param asan-instrument-writes=0} option.
14342 @item asan-memintrin
14343 Enable detection for built-in functions. This kind of protection
14344 is enabled by default when using @option{-fsanitize=address}.
14345 To disable built-in functions protection use
14346 @option{--param asan-memintrin=0}.
14348 @item asan-use-after-return
14349 Enable detection of use-after-return. This kind of protection
14350 is enabled by default when using the @option{-fsanitize=address} option.
14351 To disable it use @option{--param asan-use-after-return=0}.
14353 Note: By default the check is disabled at run time. To enable it,
14354 add @code{detect_stack_use_after_return=1} to the environment variable
14355 @env{ASAN_OPTIONS}.
14357 @item asan-instrumentation-with-call-threshold
14358 If number of memory accesses in function being instrumented
14359 is greater or equal to this number, use callbacks instead of inline checks.
14360 E.g. to disable inline code use
14361 @option{--param asan-instrumentation-with-call-threshold=0}.
14363 @item hwasan-instrument-stack
14364 Enable hwasan instrumentation of statically sized stack-allocated variables.
14365 This kind of instrumentation is enabled by default when using
14366 @option{-fsanitize=hwaddress} and disabled by default when using
14367 @option{-fsanitize=kernel-hwaddress}.
14368 To disable stack instrumentation use
14369 @option{--param hwasan-instrument-stack=0}, and to enable it use
14370 @option{--param hwasan-instrument-stack=1}.
14372 @item hwasan-random-frame-tag
14373 When using stack instrumentation, decide tags for stack variables using a
14374 deterministic sequence beginning at a random tag for each frame. With this
14375 parameter unset tags are chosen using the same sequence but beginning from 1.
14376 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
14377 for @option{-fsanitize=kernel-hwaddress}.
14378 To disable it use @option{--param hwasan-random-frame-tag=0}.
14380 @item hwasan-instrument-allocas
14381 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
14382 This kind of instrumentation is enabled by default when using
14383 @option{-fsanitize=hwaddress} and disabled by default when using
14384 @option{-fsanitize=kernel-hwaddress}.
14385 To disable instrumentation of such variables use
14386 @option{--param hwasan-instrument-allocas=0}, and to enable it use
14387 @option{--param hwasan-instrument-allocas=1}.
14389 @item hwasan-instrument-reads
14390 Enable hwasan checks on memory reads. Instrumentation of reads is enabled by
14391 default for both @option{-fsanitize=hwaddress} and
14392 @option{-fsanitize=kernel-hwaddress}.
14393 To disable checking memory reads use
14394 @option{--param hwasan-instrument-reads=0}.
14396 @item hwasan-instrument-writes
14397 Enable hwasan checks on memory writes. Instrumentation of writes is enabled by
14398 default for both @option{-fsanitize=hwaddress} and
14399 @option{-fsanitize=kernel-hwaddress}.
14400 To disable checking memory writes use
14401 @option{--param hwasan-instrument-writes=0}.
14403 @item hwasan-instrument-mem-intrinsics
14404 Enable hwasan instrumentation of builtin functions. Instrumentation of these
14405 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
14406 and @option{-fsanitize=kernel-hwaddress}.
14407 To disable instrumentation of builtin functions use
14408 @option{--param hwasan-instrument-mem-intrinsics=0}.
14410 @item use-after-scope-direct-emission-threshold
14411 If the size of a local variable in bytes is smaller or equal to this
14412 number, directly poison (or unpoison) shadow memory instead of using
14413 run-time callbacks.
14415 @item tsan-distinguish-volatile
14416 Emit special instrumentation for accesses to volatiles.
14418 @item tsan-instrument-func-entry-exit
14419 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
14421 @item max-fsm-thread-path-insns
14422 Maximum number of instructions to copy when duplicating blocks on a
14423 finite state automaton jump thread path.
14425 @item max-fsm-thread-length
14426 Maximum number of basic blocks on a finite state automaton jump thread
14429 @item max-fsm-thread-paths
14430 Maximum number of new jump thread paths to create for a finite state
14433 @item parloops-chunk-size
14434 Chunk size of omp schedule for loops parallelized by parloops.
14436 @item parloops-schedule
14437 Schedule type of omp schedule for loops parallelized by parloops (static,
14438 dynamic, guided, auto, runtime).
14440 @item parloops-min-per-thread
14441 The minimum number of iterations per thread of an innermost parallelized
14442 loop for which the parallelized variant is preferred over the single threaded
14443 one. Note that for a parallelized loop nest the
14444 minimum number of iterations of the outermost loop per thread is two.
14446 @item max-ssa-name-query-depth
14447 Maximum depth of recursion when querying properties of SSA names in things
14448 like fold routines. One level of recursion corresponds to following a
14451 @item max-speculative-devirt-maydefs
14452 The maximum number of may-defs we analyze when looking for a must-def
14453 specifying the dynamic type of an object that invokes a virtual call
14454 we may be able to devirtualize speculatively.
14456 @item max-vrp-switch-assertions
14457 The maximum number of assertions to add along the default edge of a switch
14458 statement during VRP.
14460 @item evrp-sparse-threshold
14461 Maximum number of basic blocks before EVRP uses a sparse cache.
14464 Specifies the mode Early VRP should operate in.
14466 @item unroll-jam-min-percent
14467 The minimum percentage of memory references that must be optimized
14468 away for the unroll-and-jam transformation to be considered profitable.
14470 @item unroll-jam-max-unroll
14471 The maximum number of times the outer loop should be unrolled by
14472 the unroll-and-jam transformation.
14474 @item max-rtl-if-conversion-unpredictable-cost
14475 Maximum permissible cost for the sequence that would be generated
14476 by the RTL if-conversion pass for a branch that is considered unpredictable.
14478 @item max-variable-expansions-in-unroller
14479 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
14480 of times that an individual variable will be expanded during loop unrolling.
14482 @item tracer-min-branch-probability-feedback
14483 Stop forward growth if the probability of best edge is less than
14484 this threshold (in percent). Used when profile feedback is available.
14486 @item partial-inlining-entry-probability
14487 Maximum probability of the entry BB of split region
14488 (in percent relative to entry BB of the function)
14489 to make partial inlining happen.
14491 @item max-tracked-strlens
14492 Maximum number of strings for which strlen optimization pass will
14493 track string lengths.
14495 @item gcse-after-reload-partial-fraction
14496 The threshold ratio for performing partial redundancy
14497 elimination after reload.
14499 @item gcse-after-reload-critical-fraction
14500 The threshold ratio of critical edges execution count that
14501 permit performing redundancy elimination after reload.
14503 @item max-loop-header-insns
14504 The maximum number of insns in loop header duplicated
14505 by the copy loop headers pass.
14507 @item vect-epilogues-nomask
14508 Enable loop epilogue vectorization using smaller vector size.
14510 @item vect-partial-vector-usage
14511 Controls when the loop vectorizer considers using partial vector loads
14512 and stores as an alternative to falling back to scalar code. 0 stops
14513 the vectorizer from ever using partial vector loads and stores. 1 allows
14514 partial vector loads and stores if vectorization removes the need for the
14515 code to iterate. 2 allows partial vector loads and stores in all loops.
14516 The parameter only has an effect on targets that support partial
14517 vector loads and stores.
14519 @item vect-inner-loop-cost-factor
14520 The maximum factor which the loop vectorizer applies to the cost of statements
14521 in an inner loop relative to the loop being vectorized. The factor applied
14522 is the maximum of the estimated number of iterations of the inner loop and
14523 this parameter. The default value of this parameter is 50.
14525 @item avoid-fma-max-bits
14526 Maximum number of bits for which we avoid creating FMAs.
14528 @item sms-loop-average-count-threshold
14529 A threshold on the average loop count considered by the swing modulo scheduler.
14531 @item sms-dfa-history
14532 The number of cycles the swing modulo scheduler considers when checking
14533 conflicts using DFA.
14535 @item max-inline-insns-recursive-auto
14536 The maximum number of instructions non-inline function
14537 can grow to via recursive inlining.
14539 @item graphite-allow-codegen-errors
14540 Whether codegen errors should be ICEs when @option{-fchecking}.
14542 @item sms-max-ii-factor
14543 A factor for tuning the upper bound that swing modulo scheduler
14544 uses for scheduling a loop.
14546 @item lra-max-considered-reload-pseudos
14547 The max number of reload pseudos which are considered during
14548 spilling a non-reload pseudo.
14550 @item max-pow-sqrt-depth
14551 Maximum depth of sqrt chains to use when synthesizing exponentiation
14552 by a real constant.
14554 @item max-dse-active-local-stores
14555 Maximum number of active local stores in RTL dead store elimination.
14557 @item asan-instrument-allocas
14558 Enable asan allocas/VLAs protection.
14560 @item max-iterations-computation-cost
14561 Bound on the cost of an expression to compute the number of iterations.
14563 @item max-isl-operations
14564 Maximum number of isl operations, 0 means unlimited.
14566 @item graphite-max-arrays-per-scop
14567 Maximum number of arrays per scop.
14569 @item max-vartrack-reverse-op-size
14570 Max. size of loc list for which reverse ops should be added.
14572 @item tracer-dynamic-coverage-feedback
14573 The percentage of function, weighted by execution frequency,
14574 that must be covered by trace formation.
14575 Used when profile feedback is available.
14577 @item max-inline-recursive-depth-auto
14578 The maximum depth of recursive inlining for non-inline functions.
14580 @item fsm-scale-path-stmts
14581 Scale factor to apply to the number of statements in a threading path
14582 when comparing to the number of (scaled) blocks.
14584 @item fsm-maximum-phi-arguments
14585 Maximum number of arguments a PHI may have before the FSM threader
14586 will not try to thread through its block.
14588 @item uninit-control-dep-attempts
14589 Maximum number of nested calls to search for control dependencies
14590 during uninitialized variable analysis.
14592 @item sra-max-scalarization-size-Osize
14593 Maximum size, in storage units, of an aggregate
14594 which should be considered for scalarization when compiling for size.
14596 @item fsm-scale-path-blocks
14597 Scale factor to apply to the number of blocks in a threading path
14598 when comparing to the number of (scaled) statements.
14600 @item sched-autopref-queue-depth
14601 Hardware autoprefetcher scheduler model control flag.
14602 Number of lookahead cycles the model looks into; at '
14603 ' only enable instruction sorting heuristic.
14605 @item loop-versioning-max-inner-insns
14606 The maximum number of instructions that an inner loop can have
14607 before the loop versioning pass considers it too big to copy.
14609 @item loop-versioning-max-outer-insns
14610 The maximum number of instructions that an outer loop can have
14611 before the loop versioning pass considers it too big to copy,
14612 discounting any instructions in inner loops that directly benefit
14615 @item ssa-name-def-chain-limit
14616 The maximum number of SSA_NAME assignments to follow in determining
14617 a property of a variable such as its value. This limits the number
14618 of iterations or recursive calls GCC performs when optimizing certain
14619 statements or when determining their validity prior to issuing
14622 @item store-merging-max-size
14623 Maximum size of a single store merging region in bytes.
14625 @item hash-table-verification-limit
14626 The number of elements for which hash table verification is done
14627 for each searched element.
14629 @item max-find-base-term-values
14630 Maximum number of VALUEs handled during a single find_base_term call.
14632 @item analyzer-max-enodes-per-program-point
14633 The maximum number of exploded nodes per program point within
14634 the analyzer, before terminating analysis of that point.
14636 @item analyzer-max-constraints
14637 The maximum number of constraints per state.
14639 @item analyzer-min-snodes-for-call-summary
14640 The minimum number of supernodes within a function for the
14641 analyzer to consider summarizing its effects at call sites.
14643 @item analyzer-max-enodes-for-full-dump
14644 The maximum depth of exploded nodes that should appear in a dot dump
14645 before switching to a less verbose format.
14647 @item analyzer-max-recursion-depth
14648 The maximum number of times a callsite can appear in a call stack
14649 within the analyzer, before terminating analysis of a call that would
14652 @item analyzer-max-svalue-depth
14653 The maximum depth of a symbolic value, before approximating
14654 the value as unknown.
14656 @item analyzer-max-infeasible-edges
14657 The maximum number of infeasible edges to reject before declaring
14658 a diagnostic as infeasible.
14660 @item gimple-fe-computed-hot-bb-threshold
14661 The number of executions of a basic block which is considered hot.
14662 The parameter is used only in GIMPLE FE.
14664 @item analyzer-bb-explosion-factor
14665 The maximum number of 'after supernode' exploded nodes within the analyzer
14666 per supernode, before terminating analysis.
14668 @item ranger-logical-depth
14669 Maximum depth of logical expression evaluation ranger will look through
14670 when evaluating outgoing edge ranges.
14672 @item openacc-kernels
14673 Specify mode of OpenACC `kernels' constructs handling.
14674 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
14675 constructs are decomposed into parts, a sequence of compute
14676 constructs, each then handled individually.
14677 This is work in progress.
14678 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
14679 constructs are handled by the @samp{parloops} pass, en bloc.
14680 This is the current default.
14682 @item openacc-privatization
14683 Specify mode of OpenACC privatization diagnostics for
14684 @option{-fopt-info-omp-note} and applicable
14685 @option{-fdump-tree-*-details}.
14686 With @option{--param=openacc-privatization=quiet}, don't diagnose.
14687 This is the current default.
14688 With @option{--param=openacc-privatization=noisy}, do diagnose.
14692 The following choices of @var{name} are available on AArch64 targets:
14695 @item aarch64-sve-compare-costs
14696 When vectorizing for SVE, consider using ``unpacked'' vectors for
14697 smaller elements and use the cost model to pick the cheapest approach.
14698 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
14700 Using unpacked vectors includes storing smaller elements in larger
14701 containers and accessing elements with extending loads and truncating
14704 @item aarch64-float-recp-precision
14705 The number of Newton iterations for calculating the reciprocal for float type.
14706 The precision of division is proportional to this param when division
14707 approximation is enabled. The default value is 1.
14709 @item aarch64-double-recp-precision
14710 The number of Newton iterations for calculating the reciprocal for double type.
14711 The precision of division is propotional to this param when division
14712 approximation is enabled. The default value is 2.
14714 @item aarch64-autovec-preference
14715 Force an ISA selection strategy for auto-vectorization. Accepts values from
14719 Use the default heuristics.
14721 Use only Advanced SIMD for auto-vectorization.
14723 Use only SVE for auto-vectorization.
14725 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are
14728 Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal.
14730 The default value is 0.
14732 @item aarch64-loop-vect-issue-rate-niters
14733 The tuning for some AArch64 CPUs tries to take both latencies and issue
14734 rates into account when deciding whether a loop should be vectorized
14735 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
14736 If this parameter is set to @var{n}, GCC will not use this heuristic
14737 for loops that are known to execute in fewer than @var{n} Advanced
14744 @node Instrumentation Options
14745 @section Program Instrumentation Options
14746 @cindex instrumentation options
14747 @cindex program instrumentation options
14748 @cindex run-time error checking options
14749 @cindex profiling options
14750 @cindex options, program instrumentation
14751 @cindex options, run-time error checking
14752 @cindex options, profiling
14754 GCC supports a number of command-line options that control adding
14755 run-time instrumentation to the code it normally generates.
14756 For example, one purpose of instrumentation is collect profiling
14757 statistics for use in finding program hot spots, code coverage
14758 analysis, or profile-guided optimizations.
14759 Another class of program instrumentation is adding run-time checking
14760 to detect programming errors like invalid pointer
14761 dereferences or out-of-bounds array accesses, as well as deliberately
14762 hostile attacks such as stack smashing or C++ vtable hijacking.
14763 There is also a general hook which can be used to implement other
14764 forms of tracing or function-level instrumentation for debug or
14765 program analysis purposes.
14768 @cindex @command{prof}
14769 @cindex @command{gprof}
14774 Generate extra code to write profile information suitable for the
14775 analysis program @command{prof} (for @option{-p}) or @command{gprof}
14776 (for @option{-pg}). You must use this option when compiling
14777 the source files you want data about, and you must also use it when
14780 You can use the function attribute @code{no_instrument_function} to
14781 suppress profiling of individual functions when compiling with these options.
14782 @xref{Common Function Attributes}.
14784 @item -fprofile-arcs
14785 @opindex fprofile-arcs
14786 Add code so that program flow @dfn{arcs} are instrumented. During
14787 execution the program records how many times each branch and call is
14788 executed and how many times it is taken or returns. On targets that support
14789 constructors with priority support, profiling properly handles constructors,
14790 destructors and C++ constructors (and destructors) of classes which are used
14791 as a type of a global variable.
14794 program exits it saves this data to a file called
14795 @file{@var{auxname}.gcda} for each source file. The data may be used for
14796 profile-directed optimizations (@option{-fbranch-probabilities}), or for
14797 test coverage analysis (@option{-ftest-coverage}). Each object file's
14798 @var{auxname} is generated from the name of the output file, if
14799 explicitly specified and it is not the final executable, otherwise it is
14800 the basename of the source file. In both cases any suffix is removed
14801 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
14802 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
14803 @xref{Cross-profiling}.
14805 @cindex @command{gcov}
14809 This option is used to compile and link code instrumented for coverage
14810 analysis. The option is a synonym for @option{-fprofile-arcs}
14811 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
14812 linking). See the documentation for those options for more details.
14817 Compile the source files with @option{-fprofile-arcs} plus optimization
14818 and code generation options. For test coverage analysis, use the
14819 additional @option{-ftest-coverage} option. You do not need to profile
14820 every source file in a program.
14823 Compile the source files additionally with @option{-fprofile-abs-path}
14824 to create absolute path names in the @file{.gcno} files. This allows
14825 @command{gcov} to find the correct sources in projects where compilations
14826 occur with different working directories.
14829 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
14830 (the latter implies the former).
14833 Run the program on a representative workload to generate the arc profile
14834 information. This may be repeated any number of times. You can run
14835 concurrent instances of your program, and provided that the file system
14836 supports locking, the data files will be correctly updated. Unless
14837 a strict ISO C dialect option is in effect, @code{fork} calls are
14838 detected and correctly handled without double counting.
14841 For profile-directed optimizations, compile the source files again with
14842 the same optimization and code generation options plus
14843 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
14844 Control Optimization}).
14847 For test coverage analysis, use @command{gcov} to produce human readable
14848 information from the @file{.gcno} and @file{.gcda} files. Refer to the
14849 @command{gcov} documentation for further information.
14853 With @option{-fprofile-arcs}, for each function of your program GCC
14854 creates a program flow graph, then finds a spanning tree for the graph.
14855 Only arcs that are not on the spanning tree have to be instrumented: the
14856 compiler adds code to count the number of times that these arcs are
14857 executed. When an arc is the only exit or only entrance to a block, the
14858 instrumentation code can be added to the block; otherwise, a new basic
14859 block must be created to hold the instrumentation code.
14862 @item -ftest-coverage
14863 @opindex ftest-coverage
14864 Produce a notes file that the @command{gcov} code-coverage utility
14865 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
14866 show program coverage. Each source file's note file is called
14867 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
14868 above for a description of @var{auxname} and instructions on how to
14869 generate test coverage data. Coverage data matches the source files
14870 more closely if you do not optimize.
14872 @item -fprofile-abs-path
14873 @opindex fprofile-abs-path
14874 Automatically convert relative source file names to absolute path names
14875 in the @file{.gcno} files. This allows @command{gcov} to find the correct
14876 sources in projects where compilations occur with different working
14879 @item -fprofile-dir=@var{path}
14880 @opindex fprofile-dir
14882 Set the directory to search for the profile data files in to @var{path}.
14883 This option affects only the profile data generated by
14884 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
14885 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
14886 and its related options. Both absolute and relative paths can be used.
14887 By default, GCC uses the current directory as @var{path}, thus the
14888 profile data file appears in the same directory as the object file.
14889 In order to prevent the file name clashing, if the object file name is
14890 not an absolute path, we mangle the absolute path of the
14891 @file{@var{sourcename}.gcda} file and use it as the file name of a
14892 @file{.gcda} file. See similar option @option{-fprofile-note}.
14894 When an executable is run in a massive parallel environment, it is recommended
14895 to save profile to different folders. That can be done with variables
14896 in @var{path} that are exported during run-time:
14904 value of environment variable @var{VAR}
14908 @item -fprofile-generate
14909 @itemx -fprofile-generate=@var{path}
14910 @opindex fprofile-generate
14912 Enable options usually used for instrumenting application to produce
14913 profile useful for later recompilation with profile feedback based
14914 optimization. You must use @option{-fprofile-generate} both when
14915 compiling and when linking your program.
14917 The following options are enabled:
14918 @option{-fprofile-arcs}, @option{-fprofile-values},
14919 @option{-finline-functions}, and @option{-fipa-bit-cp}.
14921 If @var{path} is specified, GCC looks at the @var{path} to find
14922 the profile feedback data files. See @option{-fprofile-dir}.
14924 To optimize the program based on the collected profile information, use
14925 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
14927 @item -fprofile-info-section
14928 @itemx -fprofile-info-section=@var{name}
14929 @opindex fprofile-info-section
14931 Register the profile information in the specified section instead of using a
14932 constructor/destructor. The section name is @var{name} if it is specified,
14933 otherwise the section name defaults to @code{.gcov_info}. A pointer to the
14934 profile information generated by @option{-fprofile-arcs} is placed in the
14935 specified section for each translation unit. This option disables the profile
14936 information registration through a constructor and it disables the profile
14937 information processing through a destructor. This option is not intended to be
14938 used in hosted environments such as GNU/Linux. It targets free-standing
14939 environments (for example embedded systems) with limited resources which do not
14940 support constructors/destructors or the C library file I/O.
14942 The linker could collect the input sections in a continuous memory block and
14943 define start and end symbols. A GNU linker script example which defines a
14944 linker output section follows:
14949 PROVIDE (__gcov_info_start = .);
14950 KEEP (*(.gcov_info))
14951 PROVIDE (__gcov_info_end = .);
14955 The program could dump the profiling information registered in this linker set
14956 for example like this:
14961 #include <stdlib.h>
14963 extern const struct gcov_info *__gcov_info_start[];
14964 extern const struct gcov_info *__gcov_info_end[];
14967 filename (const char *f, void *arg)
14973 dump (const void *d, unsigned n, void *arg)
14975 const unsigned char *c = d;
14977 for (unsigned i = 0; i < n; ++i)
14978 printf ("%02x", c[i]);
14982 allocate (unsigned length, void *arg)
14984 return malloc (length);
14988 dump_gcov_info (void)
14990 const struct gcov_info **info = __gcov_info_start;
14991 const struct gcov_info **end = __gcov_info_end;
14993 /* Obfuscate variable to prevent compiler optimizations. */
14994 __asm__ ("" : "+r" (info));
14996 while (info != end)
14999 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
15013 @item -fprofile-note=@var{path}
15014 @opindex fprofile-note
15016 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
15017 location. If you combine the option with multiple source files,
15018 the @file{.gcno} file will be overwritten.
15020 @item -fprofile-prefix-path=@var{path}
15021 @opindex fprofile-prefix-path
15023 This option can be used in combination with
15024 @option{profile-generate=}@var{profile_dir} and
15025 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
15026 directory of built source tree. By default @var{profile_dir} will contain
15027 files with mangled absolute paths of all object files in the built project.
15028 This is not desirable when directory used to build the instrumented binary
15029 differs from the directory used to build the binary optimized with profile
15030 feedback because the profile data will not be found during the optimized build.
15031 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
15032 pointing to the base directory of the build can be used to strip the irrelevant
15033 part of the path and keep all file names relative to the main build directory.
15035 @item -fprofile-update=@var{method}
15036 @opindex fprofile-update
15038 Alter the update method for an application instrumented for profile
15039 feedback based optimization. The @var{method} argument should be one of
15040 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
15041 The first one is useful for single-threaded applications,
15042 while the second one prevents profile corruption by emitting thread-safe code.
15044 @strong{Warning:} When an application does not properly join all threads
15045 (or creates an detached thread), a profile file can be still corrupted.
15047 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
15048 when supported by a target, or to @samp{single} otherwise. The GCC driver
15049 automatically selects @samp{prefer-atomic} when @option{-pthread}
15050 is present in the command line.
15052 @item -fprofile-filter-files=@var{regex}
15053 @opindex fprofile-filter-files
15055 Instrument only functions from files whose name matches
15056 any of the regular expressions (separated by semi-colons).
15058 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
15059 only @file{main.c} and all C files starting with 'module'.
15061 @item -fprofile-exclude-files=@var{regex}
15062 @opindex fprofile-exclude-files
15064 Instrument only functions from files whose name does not match
15065 any of the regular expressions (separated by semi-colons).
15067 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
15068 of all files that are located in the @file{/usr/} folder.
15070 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
15071 @opindex fprofile-reproducible
15072 Control level of reproducibility of profile gathered by
15073 @code{-fprofile-generate}. This makes it possible to rebuild program
15074 with same outcome which is useful, for example, for distribution
15077 With @option{-fprofile-reproducible=serial} the profile gathered by
15078 @option{-fprofile-generate} is reproducible provided the trained program
15079 behaves the same at each invocation of the train run, it is not
15080 multi-threaded and profile data streaming is always done in the same
15081 order. Note that profile streaming happens at the end of program run but
15082 also before @code{fork} function is invoked.
15084 Note that it is quite common that execution counts of some part of
15085 programs depends, for example, on length of temporary file names or
15086 memory space randomization (that may affect hash-table collision rate).
15087 Such non-reproducible part of programs may be annotated by
15088 @code{no_instrument_function} function attribute. @command{gcov-dump} with
15089 @option{-l} can be used to dump gathered data and verify that they are
15090 indeed reproducible.
15092 With @option{-fprofile-reproducible=parallel-runs} collected profile
15093 stays reproducible regardless the order of streaming of the data into
15094 gcda files. This setting makes it possible to run multiple instances of
15095 instrumented program in parallel (such as with @code{make -j}). This
15096 reduces quality of gathered data, in particular of indirect call
15099 @item -fsanitize=address
15100 @opindex fsanitize=address
15101 Enable AddressSanitizer, a fast memory error detector.
15102 Memory access instructions are instrumented to detect
15103 out-of-bounds and use-after-free bugs.
15104 The option enables @option{-fsanitize-address-use-after-scope}.
15105 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
15106 more details. The run-time behavior can be influenced using the
15107 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
15108 the available options are shown at startup of the instrumented program. See
15109 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
15110 for a list of supported options.
15111 The option cannot be combined with @option{-fsanitize=thread} or
15112 @option{-fsanitize=hwaddress}. Note that the only target
15113 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
15115 @item -fsanitize=kernel-address
15116 @opindex fsanitize=kernel-address
15117 Enable AddressSanitizer for Linux kernel.
15118 See @uref{https://github.com/google/kasan} for more details.
15120 @item -fsanitize=hwaddress
15121 @opindex fsanitize=hwaddress
15122 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
15123 ignore the top byte of a pointer to allow the detection of memory errors with
15124 a low memory overhead.
15125 Memory access instructions are instrumented to detect out-of-bounds and
15126 use-after-free bugs.
15127 The option enables @option{-fsanitize-address-use-after-scope}.
15129 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
15130 for more details. The run-time behavior can be influenced using the
15131 @env{HWASAN_OPTIONS} environment variable. When set to @code{help=1},
15132 the available options are shown at startup of the instrumented program.
15133 The option cannot be combined with @option{-fsanitize=thread} or
15134 @option{-fsanitize=address}, and is currently only available on AArch64.
15136 @item -fsanitize=kernel-hwaddress
15137 @opindex fsanitize=kernel-hwaddress
15138 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
15139 Similar to @option{-fsanitize=kernel-address} but using an alternate
15140 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
15141 instrumentation differences necessary for compiling the Linux kernel.
15142 These differences are to avoid hwasan library initialization calls and to
15143 account for the stack pointer having a different value in its top byte.
15145 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
15146 Instrumenting the stack and alloca calls are not on by default but are still
15147 possible by specifying the command-line options
15148 @option{--param hwasan-instrument-stack=1} and
15149 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
15150 tag is not implemented for kernel instrumentation.
15152 @item -fsanitize=pointer-compare
15153 @opindex fsanitize=pointer-compare
15154 Instrument comparison operation (<, <=, >, >=) with pointer operands.
15155 The option must be combined with either @option{-fsanitize=kernel-address} or
15156 @option{-fsanitize=address}
15157 The option cannot be combined with @option{-fsanitize=thread}.
15158 Note: By default the check is disabled at run time. To enable it,
15159 add @code{detect_invalid_pointer_pairs=2} to the environment variable
15160 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
15161 invalid operation only when both pointers are non-null.
15163 @item -fsanitize=pointer-subtract
15164 @opindex fsanitize=pointer-subtract
15165 Instrument subtraction with pointer operands.
15166 The option must be combined with either @option{-fsanitize=kernel-address} or
15167 @option{-fsanitize=address}
15168 The option cannot be combined with @option{-fsanitize=thread}.
15169 Note: By default the check is disabled at run time. To enable it,
15170 add @code{detect_invalid_pointer_pairs=2} to the environment variable
15171 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
15172 invalid operation only when both pointers are non-null.
15174 @item -fsanitize=thread
15175 @opindex fsanitize=thread
15176 Enable ThreadSanitizer, a fast data race detector.
15177 Memory access instructions are instrumented to detect
15178 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
15179 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
15180 environment variable; see
15181 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
15183 The option cannot be combined with @option{-fsanitize=address},
15184 @option{-fsanitize=leak}.
15186 Note that sanitized atomic builtins cannot throw exceptions when
15187 operating on invalid memory addresses with non-call exceptions
15188 (@option{-fnon-call-exceptions}).
15190 @item -fsanitize=leak
15191 @opindex fsanitize=leak
15192 Enable LeakSanitizer, a memory leak detector.
15193 This option only matters for linking of executables and
15194 the executable is linked against a library that overrides @code{malloc}
15195 and other allocator functions. See
15196 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
15197 details. The run-time behavior can be influenced using the
15198 @env{LSAN_OPTIONS} environment variable.
15199 The option cannot be combined with @option{-fsanitize=thread}.
15201 @item -fsanitize=undefined
15202 @opindex fsanitize=undefined
15203 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
15204 Various computations are instrumented to detect undefined behavior
15205 at runtime. Current suboptions are:
15209 @item -fsanitize=shift
15210 @opindex fsanitize=shift
15211 This option enables checking that the result of a shift operation is
15212 not undefined. Note that what exactly is considered undefined differs
15213 slightly between C and C++, as well as between ISO C90 and C99, etc.
15214 This option has two suboptions, @option{-fsanitize=shift-base} and
15215 @option{-fsanitize=shift-exponent}.
15217 @item -fsanitize=shift-exponent
15218 @opindex fsanitize=shift-exponent
15219 This option enables checking that the second argument of a shift operation
15220 is not negative and is smaller than the precision of the promoted first
15223 @item -fsanitize=shift-base
15224 @opindex fsanitize=shift-base
15225 If the second argument of a shift operation is within range, check that the
15226 result of a shift operation is not undefined. Note that what exactly is
15227 considered undefined differs slightly between C and C++, as well as between
15228 ISO C90 and C99, etc.
15230 @item -fsanitize=integer-divide-by-zero
15231 @opindex fsanitize=integer-divide-by-zero
15232 Detect integer division by zero as well as @code{INT_MIN / -1} division.
15234 @item -fsanitize=unreachable
15235 @opindex fsanitize=unreachable
15236 With this option, the compiler turns the @code{__builtin_unreachable}
15237 call into a diagnostics message call instead. When reaching the
15238 @code{__builtin_unreachable} call, the behavior is undefined.
15240 @item -fsanitize=vla-bound
15241 @opindex fsanitize=vla-bound
15242 This option instructs the compiler to check that the size of a variable
15243 length array is positive.
15245 @item -fsanitize=null
15246 @opindex fsanitize=null
15247 This option enables pointer checking. Particularly, the application
15248 built with this option turned on will issue an error message when it
15249 tries to dereference a NULL pointer, or if a reference (possibly an
15250 rvalue reference) is bound to a NULL pointer, or if a method is invoked
15251 on an object pointed by a NULL pointer.
15253 @item -fsanitize=return
15254 @opindex fsanitize=return
15255 This option enables return statement checking. Programs
15256 built with this option turned on will issue an error message
15257 when the end of a non-void function is reached without actually
15258 returning a value. This option works in C++ only.
15260 @item -fsanitize=signed-integer-overflow
15261 @opindex fsanitize=signed-integer-overflow
15262 This option enables signed integer overflow checking. We check that
15263 the result of @code{+}, @code{*}, and both unary and binary @code{-}
15264 does not overflow in the signed arithmetics. Note, integer promotion
15265 rules must be taken into account. That is, the following is not an
15268 signed char a = SCHAR_MAX;
15272 @item -fsanitize=bounds
15273 @opindex fsanitize=bounds
15274 This option enables instrumentation of array bounds. Various out of bounds
15275 accesses are detected. Flexible array members, flexible array member-like
15276 arrays, and initializers of variables with static storage are not instrumented.
15278 @item -fsanitize=bounds-strict
15279 @opindex fsanitize=bounds-strict
15280 This option enables strict instrumentation of array bounds. Most out of bounds
15281 accesses are detected, including flexible array members and flexible array
15282 member-like arrays. Initializers of variables with static storage are not
15285 @item -fsanitize=alignment
15286 @opindex fsanitize=alignment
15288 This option enables checking of alignment of pointers when they are
15289 dereferenced, or when a reference is bound to insufficiently aligned target,
15290 or when a method or constructor is invoked on insufficiently aligned object.
15292 @item -fsanitize=object-size
15293 @opindex fsanitize=object-size
15294 This option enables instrumentation of memory references using the
15295 @code{__builtin_object_size} function. Various out of bounds pointer
15296 accesses are detected.
15298 @item -fsanitize=float-divide-by-zero
15299 @opindex fsanitize=float-divide-by-zero
15300 Detect floating-point division by zero. Unlike other similar options,
15301 @option{-fsanitize=float-divide-by-zero} is not enabled by
15302 @option{-fsanitize=undefined}, since floating-point division by zero can
15303 be a legitimate way of obtaining infinities and NaNs.
15305 @item -fsanitize=float-cast-overflow
15306 @opindex fsanitize=float-cast-overflow
15307 This option enables floating-point type to integer conversion checking.
15308 We check that the result of the conversion does not overflow.
15309 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
15310 not enabled by @option{-fsanitize=undefined}.
15311 This option does not work well with @code{FE_INVALID} exceptions enabled.
15313 @item -fsanitize=nonnull-attribute
15314 @opindex fsanitize=nonnull-attribute
15316 This option enables instrumentation of calls, checking whether null values
15317 are not passed to arguments marked as requiring a non-null value by the
15318 @code{nonnull} function attribute.
15320 @item -fsanitize=returns-nonnull-attribute
15321 @opindex fsanitize=returns-nonnull-attribute
15323 This option enables instrumentation of return statements in functions
15324 marked with @code{returns_nonnull} function attribute, to detect returning
15325 of null values from such functions.
15327 @item -fsanitize=bool
15328 @opindex fsanitize=bool
15330 This option enables instrumentation of loads from bool. If a value other
15331 than 0/1 is loaded, a run-time error is issued.
15333 @item -fsanitize=enum
15334 @opindex fsanitize=enum
15336 This option enables instrumentation of loads from an enum type. If
15337 a value outside the range of values for the enum type is loaded,
15338 a run-time error is issued.
15340 @item -fsanitize=vptr
15341 @opindex fsanitize=vptr
15343 This option enables instrumentation of C++ member function calls, member
15344 accesses and some conversions between pointers to base and derived classes,
15345 to verify the referenced object has the correct dynamic type.
15347 @item -fsanitize=pointer-overflow
15348 @opindex fsanitize=pointer-overflow
15350 This option enables instrumentation of pointer arithmetics. If the pointer
15351 arithmetics overflows, a run-time error is issued.
15353 @item -fsanitize=builtin
15354 @opindex fsanitize=builtin
15356 This option enables instrumentation of arguments to selected builtin
15357 functions. If an invalid value is passed to such arguments, a run-time
15358 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
15359 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
15364 While @option{-ftrapv} causes traps for signed overflows to be emitted,
15365 @option{-fsanitize=undefined} gives a diagnostic message.
15366 This currently works only for the C family of languages.
15368 @item -fno-sanitize=all
15369 @opindex fno-sanitize=all
15371 This option disables all previously enabled sanitizers.
15372 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
15375 @item -fasan-shadow-offset=@var{number}
15376 @opindex fasan-shadow-offset
15377 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
15378 It is useful for experimenting with different shadow memory layouts in
15379 Kernel AddressSanitizer.
15381 @item -fsanitize-sections=@var{s1},@var{s2},...
15382 @opindex fsanitize-sections
15383 Sanitize global variables in selected user-defined sections. @var{si} may
15386 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
15387 @opindex fsanitize-recover
15388 @opindex fno-sanitize-recover
15389 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
15390 mentioned in comma-separated list of @var{opts}. Enabling this option
15391 for a sanitizer component causes it to attempt to continue
15392 running the program as if no error happened. This means multiple
15393 runtime errors can be reported in a single program run, and the exit
15394 code of the program may indicate success even when errors
15395 have been reported. The @option{-fno-sanitize-recover=} option
15396 can be used to alter
15397 this behavior: only the first detected error is reported
15398 and program then exits with a non-zero exit code.
15400 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
15401 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
15402 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
15403 @option{-fsanitize=bounds-strict},
15404 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
15405 For these sanitizers error recovery is turned on by default,
15406 except @option{-fsanitize=address}, for which this feature is experimental.
15407 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
15408 accepted, the former enables recovery for all sanitizers that support it,
15409 the latter disables recovery for all sanitizers that support it.
15411 Even if a recovery mode is turned on the compiler side, it needs to be also
15412 enabled on the runtime library side, otherwise the failures are still fatal.
15413 The runtime library defaults to @code{halt_on_error=0} for
15414 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
15415 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
15416 setting the @code{halt_on_error} flag in the corresponding environment variable.
15418 Syntax without an explicit @var{opts} parameter is deprecated. It is
15419 equivalent to specifying an @var{opts} list of:
15422 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
15425 @item -fsanitize-address-use-after-scope
15426 @opindex fsanitize-address-use-after-scope
15427 Enable sanitization of local variables to detect use-after-scope bugs.
15428 The option sets @option{-fstack-reuse} to @samp{none}.
15430 @item -fsanitize-undefined-trap-on-error
15431 @opindex fsanitize-undefined-trap-on-error
15432 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
15433 report undefined behavior using @code{__builtin_trap} rather than
15434 a @code{libubsan} library routine. The advantage of this is that the
15435 @code{libubsan} library is not needed and is not linked in, so this
15436 is usable even in freestanding environments.
15438 @item -fsanitize-coverage=trace-pc
15439 @opindex fsanitize-coverage=trace-pc
15440 Enable coverage-guided fuzzing code instrumentation.
15441 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
15443 @item -fsanitize-coverage=trace-cmp
15444 @opindex fsanitize-coverage=trace-cmp
15445 Enable dataflow guided fuzzing code instrumentation.
15446 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
15447 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
15448 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
15449 variable or @code{__sanitizer_cov_trace_const_cmp1},
15450 @code{__sanitizer_cov_trace_const_cmp2},
15451 @code{__sanitizer_cov_trace_const_cmp4} or
15452 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
15453 operand constant, @code{__sanitizer_cov_trace_cmpf} or
15454 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
15455 @code{__sanitizer_cov_trace_switch} for switch statements.
15457 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
15458 @opindex fcf-protection
15459 Enable code instrumentation of control-flow transfers to increase
15460 program security by checking that target addresses of control-flow
15461 transfer instructions (such as indirect function call, function return,
15462 indirect jump) are valid. This prevents diverting the flow of control
15463 to an unexpected target. This is intended to protect against such
15464 threats as Return-oriented Programming (ROP), and similarly
15465 call/jmp-oriented programming (COP/JOP).
15467 The value @code{branch} tells the compiler to implement checking of
15468 validity of control-flow transfer at the point of indirect branch
15469 instructions, i.e.@: call/jmp instructions. The value @code{return}
15470 implements checking of validity at the point of returning from a
15471 function. The value @code{full} is an alias for specifying both
15472 @code{branch} and @code{return}. The value @code{none} turns off
15475 The value @code{check} is used for the final link with link-time
15476 optimization (LTO). An error is issued if LTO object files are
15477 compiled with different @option{-fcf-protection} values. The
15478 value @code{check} is ignored at the compile time.
15480 The macro @code{__CET__} is defined when @option{-fcf-protection} is
15481 used. The first bit of @code{__CET__} is set to 1 for the value
15482 @code{branch} and the second bit of @code{__CET__} is set to 1 for
15485 You can also use the @code{nocf_check} attribute to identify
15486 which functions and calls should be skipped from instrumentation
15487 (@pxref{Function Attributes}).
15489 Currently the x86 GNU/Linux target provides an implementation based
15490 on Intel Control-flow Enforcement Technology (CET).
15492 @item -fstack-protector
15493 @opindex fstack-protector
15494 Emit extra code to check for buffer overflows, such as stack smashing
15495 attacks. This is done by adding a guard variable to functions with
15496 vulnerable objects. This includes functions that call @code{alloca}, and
15497 functions with buffers larger than or equal to 8 bytes. The guards are
15498 initialized when a function is entered and then checked when the function
15499 exits. If a guard check fails, an error message is printed and the program
15500 exits. Only variables that are actually allocated on the stack are
15501 considered, optimized away variables or variables allocated in registers
15504 @item -fstack-protector-all
15505 @opindex fstack-protector-all
15506 Like @option{-fstack-protector} except that all functions are protected.
15508 @item -fstack-protector-strong
15509 @opindex fstack-protector-strong
15510 Like @option{-fstack-protector} but includes additional functions to
15511 be protected --- those that have local array definitions, or have
15512 references to local frame addresses. Only variables that are actually
15513 allocated on the stack are considered, optimized away variables or variables
15514 allocated in registers don't count.
15516 @item -fstack-protector-explicit
15517 @opindex fstack-protector-explicit
15518 Like @option{-fstack-protector} but only protects those functions which
15519 have the @code{stack_protect} attribute.
15521 @item -fstack-check
15522 @opindex fstack-check
15523 Generate code to verify that you do not go beyond the boundary of the
15524 stack. You should specify this flag if you are running in an
15525 environment with multiple threads, but you only rarely need to specify it in
15526 a single-threaded environment since stack overflow is automatically
15527 detected on nearly all systems if there is only one stack.
15529 Note that this switch does not actually cause checking to be done; the
15530 operating system or the language runtime must do that. The switch causes
15531 generation of code to ensure that they see the stack being extended.
15533 You can additionally specify a string parameter: @samp{no} means no
15534 checking, @samp{generic} means force the use of old-style checking,
15535 @samp{specific} means use the best checking method and is equivalent
15536 to bare @option{-fstack-check}.
15538 Old-style checking is a generic mechanism that requires no specific
15539 target support in the compiler but comes with the following drawbacks:
15543 Modified allocation strategy for large objects: they are always
15544 allocated dynamically if their size exceeds a fixed threshold. Note this
15545 may change the semantics of some code.
15548 Fixed limit on the size of the static frame of functions: when it is
15549 topped by a particular function, stack checking is not reliable and
15550 a warning is issued by the compiler.
15553 Inefficiency: because of both the modified allocation strategy and the
15554 generic implementation, code performance is hampered.
15557 Note that old-style stack checking is also the fallback method for
15558 @samp{specific} if no target support has been added in the compiler.
15560 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
15561 and stack overflows. @samp{specific} is an excellent choice when compiling
15562 Ada code. It is not generally sufficient to protect against stack-clash
15563 attacks. To protect against those you want @samp{-fstack-clash-protection}.
15565 @item -fstack-clash-protection
15566 @opindex fstack-clash-protection
15567 Generate code to prevent stack clash style attacks. When this option is
15568 enabled, the compiler will only allocate one page of stack space at a time
15569 and each page is accessed immediately after allocation. Thus, it prevents
15570 allocations from jumping over any stack guard page provided by the
15573 Most targets do not fully support stack clash protection. However, on
15574 those targets @option{-fstack-clash-protection} will protect dynamic stack
15575 allocations. @option{-fstack-clash-protection} may also provide limited
15576 protection for static stack allocations if the target supports
15577 @option{-fstack-check=specific}.
15579 @item -fstack-limit-register=@var{reg}
15580 @itemx -fstack-limit-symbol=@var{sym}
15581 @itemx -fno-stack-limit
15582 @opindex fstack-limit-register
15583 @opindex fstack-limit-symbol
15584 @opindex fno-stack-limit
15585 Generate code to ensure that the stack does not grow beyond a certain value,
15586 either the value of a register or the address of a symbol. If a larger
15587 stack is required, a signal is raised at run time. For most targets,
15588 the signal is raised before the stack overruns the boundary, so
15589 it is possible to catch the signal without taking special precautions.
15591 For instance, if the stack starts at absolute address @samp{0x80000000}
15592 and grows downwards, you can use the flags
15593 @option{-fstack-limit-symbol=__stack_limit} and
15594 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
15595 of 128KB@. Note that this may only work with the GNU linker.
15597 You can locally override stack limit checking by using the
15598 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
15600 @item -fsplit-stack
15601 @opindex fsplit-stack
15602 Generate code to automatically split the stack before it overflows.
15603 The resulting program has a discontiguous stack which can only
15604 overflow if the program is unable to allocate any more memory. This
15605 is most useful when running threaded programs, as it is no longer
15606 necessary to calculate a good stack size to use for each thread. This
15607 is currently only implemented for the x86 targets running
15610 When code compiled with @option{-fsplit-stack} calls code compiled
15611 without @option{-fsplit-stack}, there may not be much stack space
15612 available for the latter code to run. If compiling all code,
15613 including library code, with @option{-fsplit-stack} is not an option,
15614 then the linker can fix up these calls so that the code compiled
15615 without @option{-fsplit-stack} always has a large stack. Support for
15616 this is implemented in the gold linker in GNU binutils release 2.21
15619 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
15620 @opindex fvtable-verify
15621 This option is only available when compiling C++ code.
15622 It turns on (or off, if using @option{-fvtable-verify=none}) the security
15623 feature that verifies at run time, for every virtual call, that
15624 the vtable pointer through which the call is made is valid for the type of
15625 the object, and has not been corrupted or overwritten. If an invalid vtable
15626 pointer is detected at run time, an error is reported and execution of the
15627 program is immediately halted.
15629 This option causes run-time data structures to be built at program startup,
15630 which are used for verifying the vtable pointers.
15631 The options @samp{std} and @samp{preinit}
15632 control the timing of when these data structures are built. In both cases the
15633 data structures are built before execution reaches @code{main}. Using
15634 @option{-fvtable-verify=std} causes the data structures to be built after
15635 shared libraries have been loaded and initialized.
15636 @option{-fvtable-verify=preinit} causes them to be built before shared
15637 libraries have been loaded and initialized.
15639 If this option appears multiple times in the command line with different
15640 values specified, @samp{none} takes highest priority over both @samp{std} and
15641 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
15644 @opindex fvtv-debug
15645 When used in conjunction with @option{-fvtable-verify=std} or
15646 @option{-fvtable-verify=preinit}, causes debug versions of the
15647 runtime functions for the vtable verification feature to be called.
15648 This flag also causes the compiler to log information about which
15649 vtable pointers it finds for each class.
15650 This information is written to a file named @file{vtv_set_ptr_data.log}
15651 in the directory named by the environment variable @env{VTV_LOGS_DIR}
15652 if that is defined or the current working directory otherwise.
15654 Note: This feature @emph{appends} data to the log file. If you want a fresh log
15655 file, be sure to delete any existing one.
15658 @opindex fvtv-counts
15659 This is a debugging flag. When used in conjunction with
15660 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
15661 causes the compiler to keep track of the total number of virtual calls
15662 it encounters and the number of verifications it inserts. It also
15663 counts the number of calls to certain run-time library functions
15664 that it inserts and logs this information for each compilation unit.
15665 The compiler writes this information to a file named
15666 @file{vtv_count_data.log} in the directory named by the environment
15667 variable @env{VTV_LOGS_DIR} if that is defined or the current working
15668 directory otherwise. It also counts the size of the vtable pointer sets
15669 for each class, and writes this information to @file{vtv_class_set_sizes.log}
15670 in the same directory.
15672 Note: This feature @emph{appends} data to the log files. To get fresh log
15673 files, be sure to delete any existing ones.
15675 @item -finstrument-functions
15676 @opindex finstrument-functions
15677 Generate instrumentation calls for entry and exit to functions. Just
15678 after function entry and just before function exit, the following
15679 profiling functions are called with the address of the current
15680 function and its call site. (On some platforms,
15681 @code{__builtin_return_address} does not work beyond the current
15682 function, so the call site information may not be available to the
15683 profiling functions otherwise.)
15686 void __cyg_profile_func_enter (void *this_fn,
15688 void __cyg_profile_func_exit (void *this_fn,
15692 The first argument is the address of the start of the current function,
15693 which may be looked up exactly in the symbol table.
15695 This instrumentation is also done for functions expanded inline in other
15696 functions. The profiling calls indicate where, conceptually, the
15697 inline function is entered and exited. This means that addressable
15698 versions of such functions must be available. If all your uses of a
15699 function are expanded inline, this may mean an additional expansion of
15700 code size. If you use @code{extern inline} in your C code, an
15701 addressable version of such functions must be provided. (This is
15702 normally the case anyway, but if you get lucky and the optimizer always
15703 expands the functions inline, you might have gotten away without
15704 providing static copies.)
15706 A function may be given the attribute @code{no_instrument_function}, in
15707 which case this instrumentation is not done. This can be used, for
15708 example, for the profiling functions listed above, high-priority
15709 interrupt routines, and any functions from which the profiling functions
15710 cannot safely be called (perhaps signal handlers, if the profiling
15711 routines generate output or allocate memory).
15712 @xref{Common Function Attributes}.
15714 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
15715 @opindex finstrument-functions-exclude-file-list
15717 Set the list of functions that are excluded from instrumentation (see
15718 the description of @option{-finstrument-functions}). If the file that
15719 contains a function definition matches with one of @var{file}, then
15720 that function is not instrumented. The match is done on substrings:
15721 if the @var{file} parameter is a substring of the file name, it is
15722 considered to be a match.
15727 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
15731 excludes any inline function defined in files whose pathnames
15732 contain @file{/bits/stl} or @file{include/sys}.
15734 If, for some reason, you want to include letter @samp{,} in one of
15735 @var{sym}, write @samp{\,}. For example,
15736 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
15737 (note the single quote surrounding the option).
15739 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
15740 @opindex finstrument-functions-exclude-function-list
15742 This is similar to @option{-finstrument-functions-exclude-file-list},
15743 but this option sets the list of function names to be excluded from
15744 instrumentation. The function name to be matched is its user-visible
15745 name, such as @code{vector<int> blah(const vector<int> &)}, not the
15746 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
15747 match is done on substrings: if the @var{sym} parameter is a substring
15748 of the function name, it is considered to be a match. For C99 and C++
15749 extended identifiers, the function name must be given in UTF-8, not
15750 using universal character names.
15752 @item -fpatchable-function-entry=@var{N}[,@var{M}]
15753 @opindex fpatchable-function-entry
15754 Generate @var{N} NOPs right at the beginning
15755 of each function, with the function entry point before the @var{M}th NOP.
15756 If @var{M} is omitted, it defaults to @code{0} so the
15757 function entry points to the address just at the first NOP.
15758 The NOP instructions reserve extra space which can be used to patch in
15759 any desired instrumentation at run time, provided that the code segment
15760 is writable. The amount of space is controllable indirectly via
15761 the number of NOPs; the NOP instruction used corresponds to the instruction
15762 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
15763 is target-specific and may also depend on the architecture variant and/or
15764 other compilation options.
15766 For run-time identification, the starting addresses of these areas,
15767 which correspond to their respective function entries minus @var{M},
15768 are additionally collected in the @code{__patchable_function_entries}
15769 section of the resulting binary.
15771 Note that the value of @code{__attribute__ ((patchable_function_entry
15772 (N,M)))} takes precedence over command-line option
15773 @option{-fpatchable-function-entry=N,M}. This can be used to increase
15774 the area size or to remove it completely on a single function.
15775 If @code{N=0}, no pad location is recorded.
15777 The NOP instructions are inserted at---and maybe before, depending on
15778 @var{M}---the function entry address, even before the prologue.
15780 The maximum value of @var{N} and @var{M} is 65535.
15784 @node Preprocessor Options
15785 @section Options Controlling the Preprocessor
15786 @cindex preprocessor options
15787 @cindex options, preprocessor
15789 These options control the C preprocessor, which is run on each C source
15790 file before actual compilation.
15792 If you use the @option{-E} option, nothing is done except preprocessing.
15793 Some of these options make sense only together with @option{-E} because
15794 they cause the preprocessor output to be unsuitable for actual
15797 In addition to the options listed here, there are a number of options
15798 to control search paths for include files documented in
15799 @ref{Directory Options}.
15800 Options to control preprocessor diagnostics are listed in
15801 @ref{Warning Options}.
15804 @include cppopts.texi
15806 @item -Wp,@var{option}
15808 You can use @option{-Wp,@var{option}} to bypass the compiler driver
15809 and pass @var{option} directly through to the preprocessor. If
15810 @var{option} contains commas, it is split into multiple options at the
15811 commas. However, many options are modified, translated or interpreted
15812 by the compiler driver before being passed to the preprocessor, and
15813 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
15814 interface is undocumented and subject to change, so whenever possible
15815 you should avoid using @option{-Wp} and let the driver handle the
15818 @item -Xpreprocessor @var{option}
15819 @opindex Xpreprocessor
15820 Pass @var{option} as an option to the preprocessor. You can use this to
15821 supply system-specific preprocessor options that GCC does not
15824 If you want to pass an option that takes an argument, you must use
15825 @option{-Xpreprocessor} twice, once for the option and once for the argument.
15827 @item -no-integrated-cpp
15828 @opindex no-integrated-cpp
15829 Perform preprocessing as a separate pass before compilation.
15830 By default, GCC performs preprocessing as an integrated part of
15831 input tokenization and parsing.
15832 If this option is provided, the appropriate language front end
15833 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
15834 and Objective-C, respectively) is instead invoked twice,
15835 once for preprocessing only and once for actual compilation
15836 of the preprocessed input.
15837 This option may be useful in conjunction with the @option{-B} or
15838 @option{-wrapper} options to specify an alternate preprocessor or
15839 perform additional processing of the program source between
15840 normal preprocessing and compilation.
15842 @item -flarge-source-files
15843 @opindex flarge-source-files
15844 Adjust GCC to expect large source files, at the expense of slower
15845 compilation and higher memory usage.
15847 Specifically, GCC normally tracks both column numbers and line numbers
15848 within source files and it normally prints both of these numbers in
15849 diagnostics. However, once it has processed a certain number of source
15850 lines, it stops tracking column numbers and only tracks line numbers.
15851 This means that diagnostics for later lines do not include column numbers.
15852 It also means that options like @option{-Wmisleading-indentation} cease to work
15853 at that point, although the compiler prints a note if this happens.
15854 Passing @option{-flarge-source-files} significantly increases the number
15855 of source lines that GCC can process before it stops tracking columns.
15859 @node Assembler Options
15860 @section Passing Options to the Assembler
15862 @c prevent bad page break with this line
15863 You can pass options to the assembler.
15866 @item -Wa,@var{option}
15868 Pass @var{option} as an option to the assembler. If @var{option}
15869 contains commas, it is split into multiple options at the commas.
15871 @item -Xassembler @var{option}
15872 @opindex Xassembler
15873 Pass @var{option} as an option to the assembler. You can use this to
15874 supply system-specific assembler options that GCC does not
15877 If you want to pass an option that takes an argument, you must use
15878 @option{-Xassembler} twice, once for the option and once for the argument.
15883 @section Options for Linking
15884 @cindex link options
15885 @cindex options, linking
15887 These options come into play when the compiler links object files into
15888 an executable output file. They are meaningless if the compiler is
15889 not doing a link step.
15893 @item @var{object-file-name}
15894 A file name that does not end in a special recognized suffix is
15895 considered to name an object file or library. (Object files are
15896 distinguished from libraries by the linker according to the file
15897 contents.) If linking is done, these object files are used as input
15906 If any of these options is used, then the linker is not run, and
15907 object file names should not be used as arguments. @xref{Overall
15910 @item -flinker-output=@var{type}
15911 @opindex flinker-output
15912 This option controls code generation of the link-time optimizer. By
15913 default the linker output is automatically determined by the linker
15914 plugin. For debugging the compiler and if incremental linking with a
15915 non-LTO object file is desired, it may be useful to control the type
15918 If @var{type} is @samp{exec}, code generation produces a static
15919 binary. In this case @option{-fpic} and @option{-fpie} are both
15922 If @var{type} is @samp{dyn}, code generation produces a shared
15923 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
15924 but not enabled automatically. This allows to build shared libraries
15925 without position-independent code on architectures where this is
15926 possible, i.e.@: on x86.
15928 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
15929 executable. This results in similar optimizations as @samp{exec}
15930 except that @option{-fpie} is not disabled if specified at compilation
15933 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
15934 done. The sections containing intermediate code for link-time optimization are
15935 merged, pre-optimized, and output to the resulting object file. In addition, if
15936 @option{-ffat-lto-objects} is specified, binary code is produced for future
15937 non-LTO linking. The object file produced by incremental linking is smaller
15938 than a static library produced from the same object files. At link time the
15939 result of incremental linking also loads faster than a static
15940 library assuming that the majority of objects in the library are used.
15942 Finally @samp{nolto-rel} configures the compiler for incremental linking where
15943 code generation is forced, a final binary is produced, and the intermediate
15944 code for later link-time optimization is stripped. When multiple object files
15945 are linked together the resulting code is better optimized than with
15946 link-time optimizations disabled (for example, cross-module inlining
15947 happens), but most of benefits of whole program optimizations are lost.
15949 During the incremental link (by @option{-r}) the linker plugin defaults to
15950 @option{rel}. With current interfaces to GNU Binutils it is however not
15951 possible to incrementally link LTO objects and non-LTO objects into a single
15952 mixed object file. If any of object files in incremental link cannot
15953 be used for link-time optimization, the linker plugin issues a warning and
15954 uses @samp{nolto-rel}. To maintain whole program optimization, it is
15955 recommended to link such objects into static library instead. Alternatively it
15956 is possible to use H.J. Lu's binutils with support for mixed objects.
15959 @opindex fuse-ld=bfd
15960 Use the @command{bfd} linker instead of the default linker.
15962 @item -fuse-ld=gold
15963 @opindex fuse-ld=gold
15964 Use the @command{gold} linker instead of the default linker.
15967 @opindex fuse-ld=lld
15968 Use the LLVM @command{lld} linker instead of the default linker.
15971 @item -l@var{library}
15972 @itemx -l @var{library}
15974 Search the library named @var{library} when linking. (The second
15975 alternative with the library as a separate argument is only for
15976 POSIX compliance and is not recommended.)
15978 The @option{-l} option is passed directly to the linker by GCC. Refer
15979 to your linker documentation for exact details. The general
15980 description below applies to the GNU linker.
15982 The linker searches a standard list of directories for the library.
15983 The directories searched include several standard system directories
15984 plus any that you specify with @option{-L}.
15986 Static libraries are archives of object files, and have file names
15987 like @file{lib@var{library}.a}. Some targets also support shared
15988 libraries, which typically have names like @file{lib@var{library}.so}.
15989 If both static and shared libraries are found, the linker gives
15990 preference to linking with the shared library unless the
15991 @option{-static} option is used.
15993 It makes a difference where in the command you write this option; the
15994 linker searches and processes libraries and object files in the order they
15995 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
15996 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
15997 to functions in @samp{z}, those functions may not be loaded.
16001 You need this special case of the @option{-l} option in order to
16002 link an Objective-C or Objective-C++ program.
16004 @item -nostartfiles
16005 @opindex nostartfiles
16006 Do not use the standard system startup files when linking.
16007 The standard system libraries are used normally, unless @option{-nostdlib},
16008 @option{-nolibc}, or @option{-nodefaultlibs} is used.
16010 @item -nodefaultlibs
16011 @opindex nodefaultlibs
16012 Do not use the standard system libraries when linking.
16013 Only the libraries you specify are passed to the linker, and options
16014 specifying linkage of the system libraries, such as @option{-static-libgcc}
16015 or @option{-shared-libgcc}, are ignored.
16016 The standard startup files are used normally, unless @option{-nostartfiles}
16019 The compiler may generate calls to @code{memcmp},
16020 @code{memset}, @code{memcpy} and @code{memmove}.
16021 These entries are usually resolved by entries in
16022 libc. These entry points should be supplied through some other
16023 mechanism when this option is specified.
16027 Do not use the C library or system libraries tightly coupled with it when
16028 linking. Still link with the startup files, @file{libgcc} or toolchain
16029 provided language support libraries such as @file{libgnat}, @file{libgfortran}
16030 or @file{libstdc++} unless options preventing their inclusion are used as
16031 well. This typically removes @option{-lc} from the link command line, as well
16032 as system libraries that normally go with it and become meaningless when
16033 absence of a C library is assumed, for example @option{-lpthread} or
16034 @option{-lm} in some configurations. This is intended for bare-board
16035 targets when there is indeed no C library available.
16039 Do not use the standard system startup files or libraries when linking.
16040 No startup files and only the libraries you specify are passed to
16041 the linker, and options specifying linkage of the system libraries, such as
16042 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
16044 The compiler may generate calls to @code{memcmp}, @code{memset},
16045 @code{memcpy} and @code{memmove}.
16046 These entries are usually resolved by entries in
16047 libc. These entry points should be supplied through some other
16048 mechanism when this option is specified.
16050 @cindex @option{-lgcc}, use with @option{-nostdlib}
16051 @cindex @option{-nostdlib} and unresolved references
16052 @cindex unresolved references and @option{-nostdlib}
16053 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
16054 @cindex @option{-nodefaultlibs} and unresolved references
16055 @cindex unresolved references and @option{-nodefaultlibs}
16056 One of the standard libraries bypassed by @option{-nostdlib} and
16057 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
16058 which GCC uses to overcome shortcomings of particular machines, or special
16059 needs for some languages.
16060 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
16061 Collection (GCC) Internals},
16062 for more discussion of @file{libgcc.a}.)
16063 In most cases, you need @file{libgcc.a} even when you want to avoid
16064 other standard libraries. In other words, when you specify @option{-nostdlib}
16065 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
16066 This ensures that you have no unresolved references to internal GCC
16067 library subroutines.
16068 (An example of such an internal subroutine is @code{__main}, used to ensure C++
16069 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
16070 GNU Compiler Collection (GCC) Internals}.)
16072 @item -e @var{entry}
16073 @itemx --entry=@var{entry}
16077 Specify that the program entry point is @var{entry}. The argument is
16078 interpreted by the linker; the GNU linker accepts either a symbol name
16083 Produce a dynamically linked position independent executable on targets
16084 that support it. For predictable results, you must also specify the same
16085 set of options used for compilation (@option{-fpie}, @option{-fPIE},
16086 or model suboptions) when you specify this linker option.
16090 Don't produce a dynamically linked position independent executable.
16093 @opindex static-pie
16094 Produce a static position independent executable on targets that support
16095 it. A static position independent executable is similar to a static
16096 executable, but can be loaded at any address without a dynamic linker.
16097 For predictable results, you must also specify the same set of options
16098 used for compilation (@option{-fpie}, @option{-fPIE}, or model
16099 suboptions) when you specify this linker option.
16103 Link with the POSIX threads library. This option is supported on
16104 GNU/Linux targets, most other Unix derivatives, and also on
16105 x86 Cygwin and MinGW targets. On some targets this option also sets
16106 flags for the preprocessor, so it should be used consistently for both
16107 compilation and linking.
16111 Produce a relocatable object as output. This is also known as partial
16116 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
16117 that support it. This instructs the linker to add all symbols, not
16118 only used ones, to the dynamic symbol table. This option is needed
16119 for some uses of @code{dlopen} or to allow obtaining backtraces
16120 from within a program.
16124 Remove all symbol table and relocation information from the executable.
16128 On systems that support dynamic linking, this overrides @option{-pie}
16129 and prevents linking with the shared libraries. On other systems, this
16130 option has no effect.
16134 Produce a shared object which can then be linked with other objects to
16135 form an executable. Not all systems support this option. For predictable
16136 results, you must also specify the same set of options used for compilation
16137 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
16138 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
16139 needs to build supplementary stub code for constructors to work. On
16140 multi-libbed systems, @samp{gcc -shared} must select the correct support
16141 libraries to link against. Failing to supply the correct flags may lead
16142 to subtle defects. Supplying them in cases where they are not necessary
16145 @item -shared-libgcc
16146 @itemx -static-libgcc
16147 @opindex shared-libgcc
16148 @opindex static-libgcc
16149 On systems that provide @file{libgcc} as a shared library, these options
16150 force the use of either the shared or static version, respectively.
16151 If no shared version of @file{libgcc} was built when the compiler was
16152 configured, these options have no effect.
16154 There are several situations in which an application should use the
16155 shared @file{libgcc} instead of the static version. The most common
16156 of these is when the application wishes to throw and catch exceptions
16157 across different shared libraries. In that case, each of the libraries
16158 as well as the application itself should use the shared @file{libgcc}.
16160 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
16161 whenever you build a shared library or a main executable, because C++
16162 programs typically use exceptions, so this is the right thing to do.
16164 If, instead, you use the GCC driver to create shared libraries, you may
16165 find that they are not always linked with the shared @file{libgcc}.
16166 If GCC finds, at its configuration time, that you have a non-GNU linker
16167 or a GNU linker that does not support option @option{--eh-frame-hdr},
16168 it links the shared version of @file{libgcc} into shared libraries
16169 by default. Otherwise, it takes advantage of the linker and optimizes
16170 away the linking with the shared version of @file{libgcc}, linking with
16171 the static version of libgcc by default. This allows exceptions to
16172 propagate through such shared libraries, without incurring relocation
16173 costs at library load time.
16175 However, if a library or main executable is supposed to throw or catch
16176 exceptions, you must link it using the G++ driver, or using the option
16177 @option{-shared-libgcc}, such that it is linked with the shared
16180 @item -static-libasan
16181 @opindex static-libasan
16182 When the @option{-fsanitize=address} option is used to link a program,
16183 the GCC driver automatically links against @option{libasan}. If
16184 @file{libasan} is available as a shared library, and the @option{-static}
16185 option is not used, then this links against the shared version of
16186 @file{libasan}. The @option{-static-libasan} option directs the GCC
16187 driver to link @file{libasan} statically, without necessarily linking
16188 other libraries statically.
16190 @item -static-libtsan
16191 @opindex static-libtsan
16192 When the @option{-fsanitize=thread} option is used to link a program,
16193 the GCC driver automatically links against @option{libtsan}. If
16194 @file{libtsan} is available as a shared library, and the @option{-static}
16195 option is not used, then this links against the shared version of
16196 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
16197 driver to link @file{libtsan} statically, without necessarily linking
16198 other libraries statically.
16200 @item -static-liblsan
16201 @opindex static-liblsan
16202 When the @option{-fsanitize=leak} option is used to link a program,
16203 the GCC driver automatically links against @option{liblsan}. If
16204 @file{liblsan} is available as a shared library, and the @option{-static}
16205 option is not used, then this links against the shared version of
16206 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
16207 driver to link @file{liblsan} statically, without necessarily linking
16208 other libraries statically.
16210 @item -static-libubsan
16211 @opindex static-libubsan
16212 When the @option{-fsanitize=undefined} option is used to link a program,
16213 the GCC driver automatically links against @option{libubsan}. If
16214 @file{libubsan} is available as a shared library, and the @option{-static}
16215 option is not used, then this links against the shared version of
16216 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
16217 driver to link @file{libubsan} statically, without necessarily linking
16218 other libraries statically.
16220 @item -static-libstdc++
16221 @opindex static-libstdc++
16222 When the @command{g++} program is used to link a C++ program, it
16223 normally automatically links against @option{libstdc++}. If
16224 @file{libstdc++} is available as a shared library, and the
16225 @option{-static} option is not used, then this links against the
16226 shared version of @file{libstdc++}. That is normally fine. However, it
16227 is sometimes useful to freeze the version of @file{libstdc++} used by
16228 the program without going all the way to a fully static link. The
16229 @option{-static-libstdc++} option directs the @command{g++} driver to
16230 link @file{libstdc++} statically, without necessarily linking other
16231 libraries statically.
16235 Bind references to global symbols when building a shared object. Warn
16236 about any unresolved references (unless overridden by the link editor
16237 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
16240 @item -T @var{script}
16242 @cindex linker script
16243 Use @var{script} as the linker script. This option is supported by most
16244 systems using the GNU linker. On some targets, such as bare-board
16245 targets without an operating system, the @option{-T} option may be required
16246 when linking to avoid references to undefined symbols.
16248 @item -Xlinker @var{option}
16250 Pass @var{option} as an option to the linker. You can use this to
16251 supply system-specific linker options that GCC does not recognize.
16253 If you want to pass an option that takes a separate argument, you must use
16254 @option{-Xlinker} twice, once for the option and once for the argument.
16255 For example, to pass @option{-assert definitions}, you must write
16256 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
16257 @option{-Xlinker "-assert definitions"}, because this passes the entire
16258 string as a single argument, which is not what the linker expects.
16260 When using the GNU linker, it is usually more convenient to pass
16261 arguments to linker options using the @option{@var{option}=@var{value}}
16262 syntax than as separate arguments. For example, you can specify
16263 @option{-Xlinker -Map=output.map} rather than
16264 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
16265 this syntax for command-line options.
16267 @item -Wl,@var{option}
16269 Pass @var{option} as an option to the linker. If @var{option} contains
16270 commas, it is split into multiple options at the commas. You can use this
16271 syntax to pass an argument to the option.
16272 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
16273 linker. When using the GNU linker, you can also get the same effect with
16274 @option{-Wl,-Map=output.map}.
16276 @item -u @var{symbol}
16278 Pretend the symbol @var{symbol} is undefined, to force linking of
16279 library modules to define it. You can use @option{-u} multiple times with
16280 different symbols to force loading of additional library modules.
16282 @item -z @var{keyword}
16284 @option{-z} is passed directly on to the linker along with the keyword
16285 @var{keyword}. See the section in the documentation of your linker for
16286 permitted values and their meanings.
16289 @node Directory Options
16290 @section Options for Directory Search
16291 @cindex directory options
16292 @cindex options, directory search
16293 @cindex search path
16295 These options specify directories to search for header files, for
16296 libraries and for parts of the compiler:
16299 @include cppdiropts.texi
16301 @item -iplugindir=@var{dir}
16302 @opindex iplugindir=
16303 Set the directory to search for plugins that are passed
16304 by @option{-fplugin=@var{name}} instead of
16305 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
16306 to be used by the user, but only passed by the driver.
16310 Add directory @var{dir} to the list of directories to be searched
16313 @item -B@var{prefix}
16315 This option specifies where to find the executables, libraries,
16316 include files, and data files of the compiler itself.
16318 The compiler driver program runs one or more of the subprograms
16319 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
16320 @var{prefix} as a prefix for each program it tries to run, both with and
16321 without @samp{@var{machine}/@var{version}/} for the corresponding target
16322 machine and compiler version.
16324 For each subprogram to be run, the compiler driver first tries the
16325 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
16326 is not specified, the driver tries two standard prefixes,
16327 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
16328 those results in a file name that is found, the unmodified program
16329 name is searched for using the directories specified in your
16330 @env{PATH} environment variable.
16332 The compiler checks to see if the path provided by @option{-B}
16333 refers to a directory, and if necessary it adds a directory
16334 separator character at the end of the path.
16336 @option{-B} prefixes that effectively specify directory names also apply
16337 to libraries in the linker, because the compiler translates these
16338 options into @option{-L} options for the linker. They also apply to
16339 include files in the preprocessor, because the compiler translates these
16340 options into @option{-isystem} options for the preprocessor. In this case,
16341 the compiler appends @samp{include} to the prefix.
16343 The runtime support file @file{libgcc.a} can also be searched for using
16344 the @option{-B} prefix, if needed. If it is not found there, the two
16345 standard prefixes above are tried, and that is all. The file is left
16346 out of the link if it is not found by those means.
16348 Another way to specify a prefix much like the @option{-B} prefix is to use
16349 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
16352 As a special kludge, if the path provided by @option{-B} is
16353 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
16354 9, then it is replaced by @file{[dir/]include}. This is to help
16355 with boot-strapping the compiler.
16357 @item -no-canonical-prefixes
16358 @opindex no-canonical-prefixes
16359 Do not expand any symbolic links, resolve references to @samp{/../}
16360 or @samp{/./}, or make the path absolute when generating a relative
16363 @item --sysroot=@var{dir}
16365 Use @var{dir} as the logical root directory for headers and libraries.
16366 For example, if the compiler normally searches for headers in
16367 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
16368 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
16370 If you use both this option and the @option{-isysroot} option, then
16371 the @option{--sysroot} option applies to libraries, but the
16372 @option{-isysroot} option applies to header files.
16374 The GNU linker (beginning with version 2.16) has the necessary support
16375 for this option. If your linker does not support this option, the
16376 header file aspect of @option{--sysroot} still works, but the
16377 library aspect does not.
16379 @item --no-sysroot-suffix
16380 @opindex no-sysroot-suffix
16381 For some targets, a suffix is added to the root directory specified
16382 with @option{--sysroot}, depending on the other options used, so that
16383 headers may for example be found in
16384 @file{@var{dir}/@var{suffix}/usr/include} instead of
16385 @file{@var{dir}/usr/include}. This option disables the addition of
16390 @node Code Gen Options
16391 @section Options for Code Generation Conventions
16392 @cindex code generation conventions
16393 @cindex options, code generation
16394 @cindex run-time options
16396 These machine-independent options control the interface conventions
16397 used in code generation.
16399 Most of them have both positive and negative forms; the negative form
16400 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
16401 one of the forms is listed---the one that is not the default. You
16402 can figure out the other form by either removing @samp{no-} or adding
16406 @item -fstack-reuse=@var{reuse-level}
16407 @opindex fstack_reuse
16408 This option controls stack space reuse for user declared local/auto variables
16409 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
16410 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
16411 local variables and temporaries, @samp{named_vars} enables the reuse only for
16412 user defined local variables with names, and @samp{none} disables stack reuse
16413 completely. The default value is @samp{all}. The option is needed when the
16414 program extends the lifetime of a scoped local variable or a compiler generated
16415 temporary beyond the end point defined by the language. When a lifetime of
16416 a variable ends, and if the variable lives in memory, the optimizing compiler
16417 has the freedom to reuse its stack space with other temporaries or scoped
16418 local variables whose live range does not overlap with it. Legacy code extending
16419 local lifetime is likely to break with the stack reuse optimization.
16438 if (*p == 10) // out of scope use of local1
16449 A(int k) : i(k), j(k) @{ @}
16456 void foo(const A& ar)
16463 foo(A(10)); // temp object's lifetime ends when foo returns
16469 ap->i+= 10; // ap references out of scope temp whose space
16470 // is reused with a. What is the value of ap->i?
16475 The lifetime of a compiler generated temporary is well defined by the C++
16476 standard. When a lifetime of a temporary ends, and if the temporary lives
16477 in memory, the optimizing compiler has the freedom to reuse its stack
16478 space with other temporaries or scoped local variables whose live range
16479 does not overlap with it. However some of the legacy code relies on
16480 the behavior of older compilers in which temporaries' stack space is
16481 not reused, the aggressive stack reuse can lead to runtime errors. This
16482 option is used to control the temporary stack reuse optimization.
16486 This option generates traps for signed overflow on addition, subtraction,
16487 multiplication operations.
16488 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16489 @option{-ftrapv} @option{-fwrapv} on the command-line results in
16490 @option{-fwrapv} being effective. Note that only active options override, so
16491 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16492 results in @option{-ftrapv} being effective.
16496 This option instructs the compiler to assume that signed arithmetic
16497 overflow of addition, subtraction and multiplication wraps around
16498 using twos-complement representation. This flag enables some optimizations
16499 and disables others.
16500 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16501 @option{-ftrapv} @option{-fwrapv} on the command-line results in
16502 @option{-fwrapv} being effective. Note that only active options override, so
16503 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16504 results in @option{-ftrapv} being effective.
16506 @item -fwrapv-pointer
16507 @opindex fwrapv-pointer
16508 This option instructs the compiler to assume that pointer arithmetic
16509 overflow on addition and subtraction wraps around using twos-complement
16510 representation. This flag disables some optimizations which assume
16511 pointer overflow is invalid.
16513 @item -fstrict-overflow
16514 @opindex fstrict-overflow
16515 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
16516 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
16519 @opindex fexceptions
16520 Enable exception handling. Generates extra code needed to propagate
16521 exceptions. For some targets, this implies GCC generates frame
16522 unwind information for all functions, which can produce significant data
16523 size overhead, although it does not affect execution. If you do not
16524 specify this option, GCC enables it by default for languages like
16525 C++ that normally require exception handling, and disables it for
16526 languages like C that do not normally require it. However, you may need
16527 to enable this option when compiling C code that needs to interoperate
16528 properly with exception handlers written in C++. You may also wish to
16529 disable this option if you are compiling older C++ programs that don't
16530 use exception handling.
16532 @item -fnon-call-exceptions
16533 @opindex fnon-call-exceptions
16534 Generate code that allows trapping instructions to throw exceptions.
16535 Note that this requires platform-specific runtime support that does
16536 not exist everywhere. Moreover, it only allows @emph{trapping}
16537 instructions to throw exceptions, i.e.@: memory references or floating-point
16538 instructions. It does not allow exceptions to be thrown from
16539 arbitrary signal handlers such as @code{SIGALRM}. This enables
16540 @option{-fexceptions}.
16542 @item -fdelete-dead-exceptions
16543 @opindex fdelete-dead-exceptions
16544 Consider that instructions that may throw exceptions but don't otherwise
16545 contribute to the execution of the program can be optimized away.
16546 This does not affect calls to functions except those with the
16547 @code{pure} or @code{const} attributes.
16548 This option is enabled by default for the Ada and C++ compilers, as permitted by
16549 the language specifications.
16550 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
16552 @item -funwind-tables
16553 @opindex funwind-tables
16554 Similar to @option{-fexceptions}, except that it just generates any needed
16555 static data, but does not affect the generated code in any other way.
16556 You normally do not need to enable this option; instead, a language processor
16557 that needs this handling enables it on your behalf.
16559 @item -fasynchronous-unwind-tables
16560 @opindex fasynchronous-unwind-tables
16561 Generate unwind table in DWARF format, if supported by target machine. The
16562 table is exact at each instruction boundary, so it can be used for stack
16563 unwinding from asynchronous events (such as debugger or garbage collector).
16565 @item -fno-gnu-unique
16566 @opindex fno-gnu-unique
16567 @opindex fgnu-unique
16568 On systems with recent GNU assembler and C library, the C++ compiler
16569 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
16570 of template static data members and static local variables in inline
16571 functions are unique even in the presence of @code{RTLD_LOCAL}; this
16572 is necessary to avoid problems with a library used by two different
16573 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
16574 therefore disagreeing with the other one about the binding of the
16575 symbol. But this causes @code{dlclose} to be ignored for affected
16576 DSOs; if your program relies on reinitialization of a DSO via
16577 @code{dlclose} and @code{dlopen}, you can use
16578 @option{-fno-gnu-unique}.
16580 @item -fpcc-struct-return
16581 @opindex fpcc-struct-return
16582 Return ``short'' @code{struct} and @code{union} values in memory like
16583 longer ones, rather than in registers. This convention is less
16584 efficient, but it has the advantage of allowing intercallability between
16585 GCC-compiled files and files compiled with other compilers, particularly
16586 the Portable C Compiler (pcc).
16588 The precise convention for returning structures in memory depends
16589 on the target configuration macros.
16591 Short structures and unions are those whose size and alignment match
16592 that of some integer type.
16594 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
16595 switch is not binary compatible with code compiled with the
16596 @option{-freg-struct-return} switch.
16597 Use it to conform to a non-default application binary interface.
16599 @item -freg-struct-return
16600 @opindex freg-struct-return
16601 Return @code{struct} and @code{union} values in registers when possible.
16602 This is more efficient for small structures than
16603 @option{-fpcc-struct-return}.
16605 If you specify neither @option{-fpcc-struct-return} nor
16606 @option{-freg-struct-return}, GCC defaults to whichever convention is
16607 standard for the target. If there is no standard convention, GCC
16608 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
16609 the principal compiler. In those cases, we can choose the standard, and
16610 we chose the more efficient register return alternative.
16612 @strong{Warning:} code compiled with the @option{-freg-struct-return}
16613 switch is not binary compatible with code compiled with the
16614 @option{-fpcc-struct-return} switch.
16615 Use it to conform to a non-default application binary interface.
16617 @item -fshort-enums
16618 @opindex fshort-enums
16619 Allocate to an @code{enum} type only as many bytes as it needs for the
16620 declared range of possible values. Specifically, the @code{enum} type
16621 is equivalent to the smallest integer type that has enough room.
16623 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
16624 code that is not binary compatible with code generated without that switch.
16625 Use it to conform to a non-default application binary interface.
16627 @item -fshort-wchar
16628 @opindex fshort-wchar
16629 Override the underlying type for @code{wchar_t} to be @code{short
16630 unsigned int} instead of the default for the target. This option is
16631 useful for building programs to run under WINE@.
16633 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
16634 code that is not binary compatible with code generated without that switch.
16635 Use it to conform to a non-default application binary interface.
16639 @opindex fno-common
16640 @cindex tentative definitions
16641 In C code, this option controls the placement of global variables
16642 defined without an initializer, known as @dfn{tentative definitions}
16643 in the C standard. Tentative definitions are distinct from declarations
16644 of a variable with the @code{extern} keyword, which do not allocate storage.
16646 The default is @option{-fno-common}, which specifies that the compiler places
16647 uninitialized global variables in the BSS section of the object file.
16648 This inhibits the merging of tentative definitions by the linker so you get a
16649 multiple-definition error if the same variable is accidentally defined in more
16650 than one compilation unit.
16652 The @option{-fcommon} places uninitialized global variables in a common block.
16653 This allows the linker to resolve all tentative definitions of the same variable
16654 in different compilation units to the same object, or to a non-tentative
16655 definition. This behavior is inconsistent with C++, and on many targets implies
16656 a speed and code size penalty on global variable references. It is mainly
16657 useful to enable legacy code to link without errors.
16662 Ignore the @code{#ident} directive.
16664 @item -finhibit-size-directive
16665 @opindex finhibit-size-directive
16666 Don't output a @code{.size} assembler directive, or anything else that
16667 would cause trouble if the function is split in the middle, and the
16668 two halves are placed at locations far apart in memory. This option is
16669 used when compiling @file{crtstuff.c}; you should not need to use it
16672 @item -fverbose-asm
16673 @opindex fverbose-asm
16674 Put extra commentary information in the generated assembly code to
16675 make it more readable. This option is generally only of use to those
16676 who actually need to read the generated assembly code (perhaps while
16677 debugging the compiler itself).
16679 @option{-fno-verbose-asm}, the default, causes the
16680 extra information to be omitted and is useful when comparing two assembler
16683 The added comments include:
16688 information on the compiler version and command-line options,
16691 the source code lines associated with the assembly instructions,
16692 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16695 hints on which high-level expressions correspond to
16696 the various assembly instruction operands.
16700 For example, given this C source file:
16708 for (i = 0; i < n; i++)
16715 compiling to (x86_64) assembly via @option{-S} and emitting the result
16716 direct to stdout via @option{-o} @option{-}
16719 gcc -S test.c -fverbose-asm -Os -o -
16722 gives output similar to this:
16726 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
16733 .type test, @@function
16737 # test.c:4: int total = 0;
16738 xorl %eax, %eax # <retval>
16739 # test.c:6: for (i = 0; i < n; i++)
16740 xorl %edx, %edx # i
16742 # test.c:6: for (i = 0; i < n; i++)
16743 cmpl %edi, %edx # n, i
16745 # test.c:7: total += i * i;
16746 movl %edx, %ecx # i, tmp92
16747 imull %edx, %ecx # i, tmp92
16748 # test.c:6: for (i = 0; i < n; i++)
16750 # test.c:7: total += i * i;
16751 addl %ecx, %eax # tmp92, <retval>
16759 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
16760 .section .note.GNU-stack,"",@@progbits
16763 The comments are intended for humans rather than machines and hence the
16764 precise format of the comments is subject to change.
16766 @item -frecord-gcc-switches
16767 @opindex frecord-gcc-switches
16768 This switch causes the command line used to invoke the
16769 compiler to be recorded into the object file that is being created.
16770 This switch is only implemented on some targets and the exact format
16771 of the recording is target and binary file format dependent, but it
16772 usually takes the form of a section containing ASCII text. This
16773 switch is related to the @option{-fverbose-asm} switch, but that
16774 switch only records information in the assembler output file as
16775 comments, so it never reaches the object file.
16776 See also @option{-grecord-gcc-switches} for another
16777 way of storing compiler options into the object file.
16781 @cindex global offset table
16783 Generate position-independent code (PIC) suitable for use in a shared
16784 library, if supported for the target machine. Such code accesses all
16785 constant addresses through a global offset table (GOT)@. The dynamic
16786 loader resolves the GOT entries when the program starts (the dynamic
16787 loader is not part of GCC; it is part of the operating system). If
16788 the GOT size for the linked executable exceeds a machine-specific
16789 maximum size, you get an error message from the linker indicating that
16790 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
16791 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
16792 on the m68k and RS/6000. The x86 has no such limit.)
16794 Position-independent code requires special support, and therefore works
16795 only on certain machines. For the x86, GCC supports PIC for System V
16796 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
16797 position-independent.
16799 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
16804 If supported for the target machine, emit position-independent code,
16805 suitable for dynamic linking and avoiding any limit on the size of the
16806 global offset table. This option makes a difference on AArch64, m68k,
16807 PowerPC and SPARC@.
16809 Position-independent code requires special support, and therefore works
16810 only on certain machines.
16812 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
16819 These options are similar to @option{-fpic} and @option{-fPIC}, but the
16820 generated position-independent code can be only linked into executables.
16821 Usually these options are used to compile code that will be linked using
16822 the @option{-pie} GCC option.
16824 @option{-fpie} and @option{-fPIE} both define the macros
16825 @code{__pie__} and @code{__PIE__}. The macros have the value 1
16826 for @option{-fpie} and 2 for @option{-fPIE}.
16831 Do not use the PLT for external function calls in position-independent code.
16832 Instead, load the callee address at call sites from the GOT and branch to it.
16833 This leads to more efficient code by eliminating PLT stubs and exposing
16834 GOT loads to optimizations. On architectures such as 32-bit x86 where
16835 PLT stubs expect the GOT pointer in a specific register, this gives more
16836 register allocation freedom to the compiler.
16837 Lazy binding requires use of the PLT;
16838 with @option{-fno-plt} all external symbols are resolved at load time.
16840 Alternatively, the function attribute @code{noplt} can be used to avoid calls
16841 through the PLT for specific external functions.
16843 In position-dependent code, a few targets also convert calls to
16844 functions that are marked to not use the PLT to use the GOT instead.
16846 @item -fno-jump-tables
16847 @opindex fno-jump-tables
16848 @opindex fjump-tables
16849 Do not use jump tables for switch statements even where it would be
16850 more efficient than other code generation strategies. This option is
16851 of use in conjunction with @option{-fpic} or @option{-fPIC} for
16852 building code that forms part of a dynamic linker and cannot
16853 reference the address of a jump table. On some targets, jump tables
16854 do not require a GOT and this option is not needed.
16856 @item -fno-bit-tests
16857 @opindex fno-bit-tests
16858 @opindex fbit-tests
16859 Do not use bit tests for switch statements even where it would be
16860 more efficient than other code generation strategies.
16862 @item -ffixed-@var{reg}
16864 Treat the register named @var{reg} as a fixed register; generated code
16865 should never refer to it (except perhaps as a stack pointer, frame
16866 pointer or in some other fixed role).
16868 @var{reg} must be the name of a register. The register names accepted
16869 are machine-specific and are defined in the @code{REGISTER_NAMES}
16870 macro in the machine description macro file.
16872 This flag does not have a negative form, because it specifies a
16875 @item -fcall-used-@var{reg}
16876 @opindex fcall-used
16877 Treat the register named @var{reg} as an allocable register that is
16878 clobbered by function calls. It may be allocated for temporaries or
16879 variables that do not live across a call. Functions compiled this way
16880 do not save and restore the register @var{reg}.
16882 It is an error to use this flag with the frame pointer or stack pointer.
16883 Use of this flag for other registers that have fixed pervasive roles in
16884 the machine's execution model produces disastrous results.
16886 This flag does not have a negative form, because it specifies a
16889 @item -fcall-saved-@var{reg}
16890 @opindex fcall-saved
16891 Treat the register named @var{reg} as an allocable register saved by
16892 functions. It may be allocated even for temporaries or variables that
16893 live across a call. Functions compiled this way save and restore
16894 the register @var{reg} if they use it.
16896 It is an error to use this flag with the frame pointer or stack pointer.
16897 Use of this flag for other registers that have fixed pervasive roles in
16898 the machine's execution model produces disastrous results.
16900 A different sort of disaster results from the use of this flag for
16901 a register in which function values may be returned.
16903 This flag does not have a negative form, because it specifies a
16906 @item -fpack-struct[=@var{n}]
16907 @opindex fpack-struct
16908 Without a value specified, pack all structure members together without
16909 holes. When a value is specified (which must be a small power of two), pack
16910 structure members according to this value, representing the maximum
16911 alignment (that is, objects with default alignment requirements larger than
16912 this are output potentially unaligned at the next fitting location.
16914 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
16915 code that is not binary compatible with code generated without that switch.
16916 Additionally, it makes the code suboptimal.
16917 Use it to conform to a non-default application binary interface.
16919 @item -fleading-underscore
16920 @opindex fleading-underscore
16921 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
16922 change the way C symbols are represented in the object file. One use
16923 is to help link with legacy assembly code.
16925 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
16926 generate code that is not binary compatible with code generated without that
16927 switch. Use it to conform to a non-default application binary interface.
16928 Not all targets provide complete support for this switch.
16930 @item -ftls-model=@var{model}
16931 @opindex ftls-model
16932 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
16933 The @var{model} argument should be one of @samp{global-dynamic},
16934 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
16935 Note that the choice is subject to optimization: the compiler may use
16936 a more efficient model for symbols not visible outside of the translation
16937 unit, or if @option{-fpic} is not given on the command line.
16939 The default without @option{-fpic} is @samp{initial-exec}; with
16940 @option{-fpic} the default is @samp{global-dynamic}.
16942 @item -ftrampolines
16943 @opindex ftrampolines
16944 For targets that normally need trampolines for nested functions, always
16945 generate them instead of using descriptors. Otherwise, for targets that
16946 do not need them, like for example HP-PA or IA-64, do nothing.
16948 A trampoline is a small piece of code that is created at run time on the
16949 stack when the address of a nested function is taken, and is used to call
16950 the nested function indirectly. Therefore, it requires the stack to be
16951 made executable in order for the program to work properly.
16953 @option{-fno-trampolines} is enabled by default on a language by language
16954 basis to let the compiler avoid generating them, if it computes that this
16955 is safe, and replace them with descriptors. Descriptors are made up of data
16956 only, but the generated code must be prepared to deal with them. As of this
16957 writing, @option{-fno-trampolines} is enabled by default only for Ada.
16959 Moreover, code compiled with @option{-ftrampolines} and code compiled with
16960 @option{-fno-trampolines} are not binary compatible if nested functions are
16961 present. This option must therefore be used on a program-wide basis and be
16962 manipulated with extreme care.
16964 For languages other than Ada, the @code{-ftrampolines} and
16965 @code{-fno-trampolines} options currently have no effect, and
16966 trampolines are always generated on platforms that need them
16967 for nested functions.
16969 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
16970 @opindex fvisibility
16971 Set the default ELF image symbol visibility to the specified option---all
16972 symbols are marked with this unless overridden within the code.
16973 Using this feature can very substantially improve linking and
16974 load times of shared object libraries, produce more optimized
16975 code, provide near-perfect API export and prevent symbol clashes.
16976 It is @strong{strongly} recommended that you use this in any shared objects
16979 Despite the nomenclature, @samp{default} always means public; i.e.,
16980 available to be linked against from outside the shared object.
16981 @samp{protected} and @samp{internal} are pretty useless in real-world
16982 usage so the only other commonly used option is @samp{hidden}.
16983 The default if @option{-fvisibility} isn't specified is
16984 @samp{default}, i.e., make every symbol public.
16986 A good explanation of the benefits offered by ensuring ELF
16987 symbols have the correct visibility is given by ``How To Write
16988 Shared Libraries'' by Ulrich Drepper (which can be found at
16989 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
16990 solution made possible by this option to marking things hidden when
16991 the default is public is to make the default hidden and mark things
16992 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
16993 and @code{__attribute__ ((visibility("default")))} instead of
16994 @code{__declspec(dllexport)} you get almost identical semantics with
16995 identical syntax. This is a great boon to those working with
16996 cross-platform projects.
16998 For those adding visibility support to existing code, you may find
16999 @code{#pragma GCC visibility} of use. This works by you enclosing
17000 the declarations you wish to set visibility for with (for example)
17001 @code{#pragma GCC visibility push(hidden)} and
17002 @code{#pragma GCC visibility pop}.
17003 Bear in mind that symbol visibility should be viewed @strong{as
17004 part of the API interface contract} and thus all new code should
17005 always specify visibility when it is not the default; i.e., declarations
17006 only for use within the local DSO should @strong{always} be marked explicitly
17007 as hidden as so to avoid PLT indirection overheads---making this
17008 abundantly clear also aids readability and self-documentation of the code.
17009 Note that due to ISO C++ specification requirements, @code{operator new} and
17010 @code{operator delete} must always be of default visibility.
17012 Be aware that headers from outside your project, in particular system
17013 headers and headers from any other library you use, may not be
17014 expecting to be compiled with visibility other than the default. You
17015 may need to explicitly say @code{#pragma GCC visibility push(default)}
17016 before including any such headers.
17018 @code{extern} declarations are not affected by @option{-fvisibility}, so
17019 a lot of code can be recompiled with @option{-fvisibility=hidden} with
17020 no modifications. However, this means that calls to @code{extern}
17021 functions with no explicit visibility use the PLT, so it is more
17022 effective to use @code{__attribute ((visibility))} and/or
17023 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
17024 declarations should be treated as hidden.
17026 Note that @option{-fvisibility} does affect C++ vague linkage
17027 entities. This means that, for instance, an exception class that is
17028 be thrown between DSOs must be explicitly marked with default
17029 visibility so that the @samp{type_info} nodes are unified between
17032 An overview of these techniques, their benefits and how to use them
17033 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
17035 @item -fstrict-volatile-bitfields
17036 @opindex fstrict-volatile-bitfields
17037 This option should be used if accesses to volatile bit-fields (or other
17038 structure fields, although the compiler usually honors those types
17039 anyway) should use a single access of the width of the
17040 field's type, aligned to a natural alignment if possible. For
17041 example, targets with memory-mapped peripheral registers might require
17042 all such accesses to be 16 bits wide; with this flag you can
17043 declare all peripheral bit-fields as @code{unsigned short} (assuming short
17044 is 16 bits on these targets) to force GCC to use 16-bit accesses
17045 instead of, perhaps, a more efficient 32-bit access.
17047 If this option is disabled, the compiler uses the most efficient
17048 instruction. In the previous example, that might be a 32-bit load
17049 instruction, even though that accesses bytes that do not contain
17050 any portion of the bit-field, or memory-mapped registers unrelated to
17051 the one being updated.
17053 In some cases, such as when the @code{packed} attribute is applied to a
17054 structure field, it may not be possible to access the field with a single
17055 read or write that is correctly aligned for the target machine. In this
17056 case GCC falls back to generating multiple accesses rather than code that
17057 will fault or truncate the result at run time.
17059 Note: Due to restrictions of the C/C++11 memory model, write accesses are
17060 not allowed to touch non bit-field members. It is therefore recommended
17061 to define all bits of the field's type as bit-field members.
17063 The default value of this option is determined by the application binary
17064 interface for the target processor.
17066 @item -fsync-libcalls
17067 @opindex fsync-libcalls
17068 This option controls whether any out-of-line instance of the @code{__sync}
17069 family of functions may be used to implement the C++11 @code{__atomic}
17070 family of functions.
17072 The default value of this option is enabled, thus the only useful form
17073 of the option is @option{-fno-sync-libcalls}. This option is used in
17074 the implementation of the @file{libatomic} runtime library.
17078 @node Developer Options
17079 @section GCC Developer Options
17080 @cindex developer options
17081 @cindex debugging GCC
17082 @cindex debug dump options
17083 @cindex dump options
17084 @cindex compilation statistics
17086 This section describes command-line options that are primarily of
17087 interest to GCC developers, including options to support compiler
17088 testing and investigation of compiler bugs and compile-time
17089 performance problems. This includes options that produce debug dumps
17090 at various points in the compilation; that print statistics such as
17091 memory use and execution time; and that print information about GCC's
17092 configuration, such as where it searches for libraries. You should
17093 rarely need to use any of these options for ordinary compilation and
17096 Many developer options that cause GCC to dump output to a file take an
17097 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
17098 or @samp{-} to dump to standard output, and @samp{stderr} for standard
17101 If @samp{=@var{filename}} is omitted, a default dump file name is
17102 constructed by concatenating the base dump file name, a pass number,
17103 phase letter, and pass name. The base dump file name is the name of
17104 output file produced by the compiler if explicitly specified and not
17105 an executable; otherwise it is the source file name.
17106 The pass number is determined by the order passes are registered with
17107 the compiler's pass manager.
17108 This is generally the same as the order of execution, but passes
17109 registered by plugins, target-specific passes, or passes that are
17110 otherwise registered late are numbered higher than the pass named
17111 @samp{final}, even if they are executed earlier. The phase letter is
17112 one of @samp{i} (inter-procedural analysis), @samp{l}
17113 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
17114 The files are created in the directory of the output file.
17118 @item -fcallgraph-info
17119 @itemx -fcallgraph-info=@var{MARKERS}
17120 @opindex fcallgraph-info
17121 Makes the compiler output callgraph information for the program, on a
17122 per-object-file basis. The information is generated in the common VCG
17123 format. It can be decorated with additional, per-node and/or per-edge
17124 information, if a list of comma-separated markers is additionally
17125 specified. When the @code{su} marker is specified, the callgraph is
17126 decorated with stack usage information; it is equivalent to
17127 @option{-fstack-usage}. When the @code{da} marker is specified, the
17128 callgraph is decorated with information about dynamically allocated
17131 When compiling with @option{-flto}, no callgraph information is output
17132 along with the object file. At LTO link time, @option{-fcallgraph-info}
17133 may generate multiple callgraph information files next to intermediate
17136 @item -d@var{letters}
17137 @itemx -fdump-rtl-@var{pass}
17138 @itemx -fdump-rtl-@var{pass}=@var{filename}
17140 @opindex fdump-rtl-@var{pass}
17141 Says to make debugging dumps during compilation at times specified by
17142 @var{letters}. This is used for debugging the RTL-based passes of the
17145 Some @option{-d@var{letters}} switches have different meaning when
17146 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
17147 for information about preprocessor-specific dump options.
17149 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
17150 @option{-d} option @var{letters}. Here are the possible
17151 letters for use in @var{pass} and @var{letters}, and their meanings:
17155 @item -fdump-rtl-alignments
17156 @opindex fdump-rtl-alignments
17157 Dump after branch alignments have been computed.
17159 @item -fdump-rtl-asmcons
17160 @opindex fdump-rtl-asmcons
17161 Dump after fixing rtl statements that have unsatisfied in/out constraints.
17163 @item -fdump-rtl-auto_inc_dec
17164 @opindex fdump-rtl-auto_inc_dec
17165 Dump after auto-inc-dec discovery. This pass is only run on
17166 architectures that have auto inc or auto dec instructions.
17168 @item -fdump-rtl-barriers
17169 @opindex fdump-rtl-barriers
17170 Dump after cleaning up the barrier instructions.
17172 @item -fdump-rtl-bbpart
17173 @opindex fdump-rtl-bbpart
17174 Dump after partitioning hot and cold basic blocks.
17176 @item -fdump-rtl-bbro
17177 @opindex fdump-rtl-bbro
17178 Dump after block reordering.
17180 @item -fdump-rtl-btl1
17181 @itemx -fdump-rtl-btl2
17182 @opindex fdump-rtl-btl2
17183 @opindex fdump-rtl-btl2
17184 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
17185 after the two branch
17186 target load optimization passes.
17188 @item -fdump-rtl-bypass
17189 @opindex fdump-rtl-bypass
17190 Dump after jump bypassing and control flow optimizations.
17192 @item -fdump-rtl-combine
17193 @opindex fdump-rtl-combine
17194 Dump after the RTL instruction combination pass.
17196 @item -fdump-rtl-compgotos
17197 @opindex fdump-rtl-compgotos
17198 Dump after duplicating the computed gotos.
17200 @item -fdump-rtl-ce1
17201 @itemx -fdump-rtl-ce2
17202 @itemx -fdump-rtl-ce3
17203 @opindex fdump-rtl-ce1
17204 @opindex fdump-rtl-ce2
17205 @opindex fdump-rtl-ce3
17206 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
17207 @option{-fdump-rtl-ce3} enable dumping after the three
17208 if conversion passes.
17210 @item -fdump-rtl-cprop_hardreg
17211 @opindex fdump-rtl-cprop_hardreg
17212 Dump after hard register copy propagation.
17214 @item -fdump-rtl-csa
17215 @opindex fdump-rtl-csa
17216 Dump after combining stack adjustments.
17218 @item -fdump-rtl-cse1
17219 @itemx -fdump-rtl-cse2
17220 @opindex fdump-rtl-cse1
17221 @opindex fdump-rtl-cse2
17222 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
17223 the two common subexpression elimination passes.
17225 @item -fdump-rtl-dce
17226 @opindex fdump-rtl-dce
17227 Dump after the standalone dead code elimination passes.
17229 @item -fdump-rtl-dbr
17230 @opindex fdump-rtl-dbr
17231 Dump after delayed branch scheduling.
17233 @item -fdump-rtl-dce1
17234 @itemx -fdump-rtl-dce2
17235 @opindex fdump-rtl-dce1
17236 @opindex fdump-rtl-dce2
17237 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
17238 the two dead store elimination passes.
17240 @item -fdump-rtl-eh
17241 @opindex fdump-rtl-eh
17242 Dump after finalization of EH handling code.
17244 @item -fdump-rtl-eh_ranges
17245 @opindex fdump-rtl-eh_ranges
17246 Dump after conversion of EH handling range regions.
17248 @item -fdump-rtl-expand
17249 @opindex fdump-rtl-expand
17250 Dump after RTL generation.
17252 @item -fdump-rtl-fwprop1
17253 @itemx -fdump-rtl-fwprop2
17254 @opindex fdump-rtl-fwprop1
17255 @opindex fdump-rtl-fwprop2
17256 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
17257 dumping after the two forward propagation passes.
17259 @item -fdump-rtl-gcse1
17260 @itemx -fdump-rtl-gcse2
17261 @opindex fdump-rtl-gcse1
17262 @opindex fdump-rtl-gcse2
17263 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
17264 after global common subexpression elimination.
17266 @item -fdump-rtl-init-regs
17267 @opindex fdump-rtl-init-regs
17268 Dump after the initialization of the registers.
17270 @item -fdump-rtl-initvals
17271 @opindex fdump-rtl-initvals
17272 Dump after the computation of the initial value sets.
17274 @item -fdump-rtl-into_cfglayout
17275 @opindex fdump-rtl-into_cfglayout
17276 Dump after converting to cfglayout mode.
17278 @item -fdump-rtl-ira
17279 @opindex fdump-rtl-ira
17280 Dump after iterated register allocation.
17282 @item -fdump-rtl-jump
17283 @opindex fdump-rtl-jump
17284 Dump after the second jump optimization.
17286 @item -fdump-rtl-loop2
17287 @opindex fdump-rtl-loop2
17288 @option{-fdump-rtl-loop2} enables dumping after the rtl
17289 loop optimization passes.
17291 @item -fdump-rtl-mach
17292 @opindex fdump-rtl-mach
17293 Dump after performing the machine dependent reorganization pass, if that
17296 @item -fdump-rtl-mode_sw
17297 @opindex fdump-rtl-mode_sw
17298 Dump after removing redundant mode switches.
17300 @item -fdump-rtl-rnreg
17301 @opindex fdump-rtl-rnreg
17302 Dump after register renumbering.
17304 @item -fdump-rtl-outof_cfglayout
17305 @opindex fdump-rtl-outof_cfglayout
17306 Dump after converting from cfglayout mode.
17308 @item -fdump-rtl-peephole2
17309 @opindex fdump-rtl-peephole2
17310 Dump after the peephole pass.
17312 @item -fdump-rtl-postreload
17313 @opindex fdump-rtl-postreload
17314 Dump after post-reload optimizations.
17316 @item -fdump-rtl-pro_and_epilogue
17317 @opindex fdump-rtl-pro_and_epilogue
17318 Dump after generating the function prologues and epilogues.
17320 @item -fdump-rtl-sched1
17321 @itemx -fdump-rtl-sched2
17322 @opindex fdump-rtl-sched1
17323 @opindex fdump-rtl-sched2
17324 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
17325 after the basic block scheduling passes.
17327 @item -fdump-rtl-ree
17328 @opindex fdump-rtl-ree
17329 Dump after sign/zero extension elimination.
17331 @item -fdump-rtl-seqabstr
17332 @opindex fdump-rtl-seqabstr
17333 Dump after common sequence discovery.
17335 @item -fdump-rtl-shorten
17336 @opindex fdump-rtl-shorten
17337 Dump after shortening branches.
17339 @item -fdump-rtl-sibling
17340 @opindex fdump-rtl-sibling
17341 Dump after sibling call optimizations.
17343 @item -fdump-rtl-split1
17344 @itemx -fdump-rtl-split2
17345 @itemx -fdump-rtl-split3
17346 @itemx -fdump-rtl-split4
17347 @itemx -fdump-rtl-split5
17348 @opindex fdump-rtl-split1
17349 @opindex fdump-rtl-split2
17350 @opindex fdump-rtl-split3
17351 @opindex fdump-rtl-split4
17352 @opindex fdump-rtl-split5
17353 These options enable dumping after five rounds of
17354 instruction splitting.
17356 @item -fdump-rtl-sms
17357 @opindex fdump-rtl-sms
17358 Dump after modulo scheduling. This pass is only run on some
17361 @item -fdump-rtl-stack
17362 @opindex fdump-rtl-stack
17363 Dump after conversion from GCC's ``flat register file'' registers to the
17364 x87's stack-like registers. This pass is only run on x86 variants.
17366 @item -fdump-rtl-subreg1
17367 @itemx -fdump-rtl-subreg2
17368 @opindex fdump-rtl-subreg1
17369 @opindex fdump-rtl-subreg2
17370 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
17371 the two subreg expansion passes.
17373 @item -fdump-rtl-unshare
17374 @opindex fdump-rtl-unshare
17375 Dump after all rtl has been unshared.
17377 @item -fdump-rtl-vartrack
17378 @opindex fdump-rtl-vartrack
17379 Dump after variable tracking.
17381 @item -fdump-rtl-vregs
17382 @opindex fdump-rtl-vregs
17383 Dump after converting virtual registers to hard registers.
17385 @item -fdump-rtl-web
17386 @opindex fdump-rtl-web
17387 Dump after live range splitting.
17389 @item -fdump-rtl-regclass
17390 @itemx -fdump-rtl-subregs_of_mode_init
17391 @itemx -fdump-rtl-subregs_of_mode_finish
17392 @itemx -fdump-rtl-dfinit
17393 @itemx -fdump-rtl-dfinish
17394 @opindex fdump-rtl-regclass
17395 @opindex fdump-rtl-subregs_of_mode_init
17396 @opindex fdump-rtl-subregs_of_mode_finish
17397 @opindex fdump-rtl-dfinit
17398 @opindex fdump-rtl-dfinish
17399 These dumps are defined but always produce empty files.
17402 @itemx -fdump-rtl-all
17404 @opindex fdump-rtl-all
17405 Produce all the dumps listed above.
17409 Annotate the assembler output with miscellaneous debugging information.
17413 Dump all macro definitions, at the end of preprocessing, in addition to
17418 Produce a core dump whenever an error occurs.
17422 Annotate the assembler output with a comment indicating which
17423 pattern and alternative is used. The length and cost of each instruction are
17428 Dump the RTL in the assembler output as a comment before each instruction.
17429 Also turns on @option{-dp} annotation.
17433 Just generate RTL for a function instead of compiling it. Usually used
17434 with @option{-fdump-rtl-expand}.
17438 @opindex fdump-debug
17439 Dump debugging information generated during the debug
17442 @item -fdump-earlydebug
17443 @opindex fdump-earlydebug
17444 Dump debugging information generated during the early debug
17447 @item -fdump-noaddr
17448 @opindex fdump-noaddr
17449 When doing debugging dumps, suppress address output. This makes it more
17450 feasible to use diff on debugging dumps for compiler invocations with
17451 different compiler binaries and/or different
17452 text / bss / data / heap / stack / dso start locations.
17455 @opindex freport-bug
17456 Collect and dump debug information into a temporary file if an
17457 internal compiler error (ICE) occurs.
17459 @item -fdump-unnumbered
17460 @opindex fdump-unnumbered
17461 When doing debugging dumps, suppress instruction numbers and address output.
17462 This makes it more feasible to use diff on debugging dumps for compiler
17463 invocations with different options, in particular with and without
17466 @item -fdump-unnumbered-links
17467 @opindex fdump-unnumbered-links
17468 When doing debugging dumps (see @option{-d} option above), suppress
17469 instruction numbers for the links to the previous and next instructions
17472 @item -fdump-ipa-@var{switch}
17473 @itemx -fdump-ipa-@var{switch}-@var{options}
17475 Control the dumping at various stages of inter-procedural analysis
17476 language tree to a file. The file name is generated by appending a
17477 switch specific suffix to the source file name, and the file is created
17478 in the same directory as the output file. The following dumps are
17483 Enables all inter-procedural analysis dumps.
17486 Dumps information about call-graph optimization, unused function removal,
17487 and inlining decisions.
17490 Dump after function inlining.
17494 Additionally, the options @option{-optimized}, @option{-missed},
17495 @option{-note}, and @option{-all} can be provided, with the same meaning
17496 as for @option{-fopt-info}, defaulting to @option{-optimized}.
17498 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
17499 information on callsites that were inlined, along with callsites
17500 that were not inlined.
17502 By default, the dump will contain messages about successful
17503 optimizations (equivalent to @option{-optimized}) together with
17504 low-level details about the analysis.
17507 @opindex fdump-lang
17508 Dump language-specific information. The file name is made by appending
17509 @file{.lang} to the source file name.
17511 @item -fdump-lang-all
17512 @itemx -fdump-lang-@var{switch}
17513 @itemx -fdump-lang-@var{switch}-@var{options}
17514 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
17515 @opindex fdump-lang-all
17516 @opindex fdump-lang
17517 Control the dumping of language-specific information. The @var{options}
17518 and @var{filename} portions behave as described in the
17519 @option{-fdump-tree} option. The following @var{switch} values are
17525 Enable all language-specific dumps.
17528 Dump class hierarchy information. Virtual table information is emitted
17529 unless '@option{slim}' is specified. This option is applicable to C++ only.
17532 Dump module information. Options @option{lineno} (locations),
17533 @option{graph} (reachability), @option{blocks} (clusters),
17534 @option{uid} (serialization), @option{alias} (mergeable),
17535 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
17536 (macros) may provide additional information. This option is
17537 applicable to C++ only.
17540 Dump the raw internal tree data. This option is applicable to C++ only.
17544 @item -fdump-passes
17545 @opindex fdump-passes
17546 Print on @file{stderr} the list of optimization passes that are turned
17547 on and off by the current command-line options.
17549 @item -fdump-statistics-@var{option}
17550 @opindex fdump-statistics
17551 Enable and control dumping of pass statistics in a separate file. The
17552 file name is generated by appending a suffix ending in
17553 @samp{.statistics} to the source file name, and the file is created in
17554 the same directory as the output file. If the @samp{-@var{option}}
17555 form is used, @samp{-stats} causes counters to be summed over the
17556 whole compilation unit while @samp{-details} dumps every event as
17557 the passes generate them. The default with no option is to sum
17558 counters for each function compiled.
17560 @item -fdump-tree-all
17561 @itemx -fdump-tree-@var{switch}
17562 @itemx -fdump-tree-@var{switch}-@var{options}
17563 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
17564 @opindex fdump-tree-all
17565 @opindex fdump-tree
17566 Control the dumping at various stages of processing the intermediate
17567 language tree to a file. If the @samp{-@var{options}}
17568 form is used, @var{options} is a list of @samp{-} separated options
17569 which control the details of the dump. Not all options are applicable
17570 to all dumps; those that are not meaningful are ignored. The
17571 following options are available
17575 Print the address of each node. Usually this is not meaningful as it
17576 changes according to the environment and source file. Its primary use
17577 is for tying up a dump file with a debug environment.
17579 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
17580 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
17581 use working backward from mangled names in the assembly file.
17583 When dumping front-end intermediate representations, inhibit dumping
17584 of members of a scope or body of a function merely because that scope
17585 has been reached. Only dump such items when they are directly reachable
17586 by some other path.
17588 When dumping pretty-printed trees, this option inhibits dumping the
17589 bodies of control structures.
17591 When dumping RTL, print the RTL in slim (condensed) form instead of
17592 the default LISP-like representation.
17594 Print a raw representation of the tree. By default, trees are
17595 pretty-printed into a C-like representation.
17597 Enable more detailed dumps (not honored by every dump option). Also
17598 include information from the optimization passes.
17600 Enable dumping various statistics about the pass (not honored by every dump
17603 Enable showing basic block boundaries (disabled in raw dumps).
17605 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
17606 dump a representation of the control flow graph suitable for viewing with
17607 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
17608 the file is pretty-printed as a subgraph, so that GraphViz can render them
17609 all in a single plot.
17611 This option currently only works for RTL dumps, and the RTL is always
17612 dumped in slim form.
17614 Enable showing virtual operands for every statement.
17616 Enable showing line numbers for statements.
17618 Enable showing the unique ID (@code{DECL_UID}) for each variable.
17620 Enable showing the tree dump for each statement.
17622 Enable showing the EH region number holding each statement.
17624 Enable showing scalar evolution analysis details.
17626 Enable showing optimization information (only available in certain
17629 Enable showing missed optimization information (only available in certain
17632 Enable other detailed optimization information (only available in
17635 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
17636 and @option{lineno}.
17638 Turn on all optimization options, i.e., @option{optimized},
17639 @option{missed}, and @option{note}.
17642 To determine what tree dumps are available or find the dump for a pass
17643 of interest follow the steps below.
17647 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
17648 look for a code that corresponds to the pass you are interested in.
17649 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
17650 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
17651 The number at the end distinguishes distinct invocations of the same pass.
17653 To enable the creation of the dump file, append the pass code to
17654 the @option{-fdump-} option prefix and invoke GCC with it. For example,
17655 to enable the dump from the Early Value Range Propagation pass, invoke
17656 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
17657 specify the name of the dump file. If you don't specify one, GCC
17658 creates as described below.
17660 Find the pass dump in a file whose name is composed of three components
17661 separated by a period: the name of the source file GCC was invoked to
17662 compile, a numeric suffix indicating the pass number followed by the
17663 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
17664 and finally the pass code. For example, the Early VRP pass dump might
17665 be in a file named @file{myfile.c.038t.evrp} in the current working
17666 directory. Note that the numeric codes are not stable and may change
17667 from one version of GCC to another.
17671 @itemx -fopt-info-@var{options}
17672 @itemx -fopt-info-@var{options}=@var{filename}
17674 Controls optimization dumps from various optimization passes. If the
17675 @samp{-@var{options}} form is used, @var{options} is a list of
17676 @samp{-} separated option keywords to select the dump details and
17679 The @var{options} can be divided into three groups:
17682 options describing what kinds of messages should be emitted,
17684 options describing the verbosity of the dump, and
17686 options describing which optimizations should be included.
17688 The options from each group can be freely mixed as they are
17689 non-overlapping. However, in case of any conflicts,
17690 the later options override the earlier options on the command
17693 The following options control which kinds of messages should be emitted:
17697 Print information when an optimization is successfully applied. It is
17698 up to a pass to decide which information is relevant. For example, the
17699 vectorizer passes print the source location of loops which are
17700 successfully vectorized.
17702 Print information about missed optimizations. Individual passes
17703 control which information to include in the output.
17705 Print verbose information about optimizations, such as certain
17706 transformations, more detailed messages about decisions etc.
17708 Print detailed optimization information. This includes
17709 @samp{optimized}, @samp{missed}, and @samp{note}.
17712 The following option controls the dump verbosity:
17716 By default, only ``high-level'' messages are emitted. This option enables
17717 additional, more detailed, messages, which are likely to only be of interest
17721 One or more of the following option keywords can be used to describe a
17722 group of optimizations:
17726 Enable dumps from all interprocedural optimizations.
17728 Enable dumps from all loop optimizations.
17730 Enable dumps from all inlining optimizations.
17732 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
17734 Enable dumps from all vectorization optimizations.
17736 Enable dumps from all optimizations. This is a superset of
17737 the optimization groups listed above.
17740 If @var{options} is
17741 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
17742 about successful optimizations from all the passes, omitting messages
17743 that are treated as ``internals''.
17745 If the @var{filename} is provided, then the dumps from all the
17746 applicable optimizations are concatenated into the @var{filename}.
17747 Otherwise the dump is output onto @file{stderr}. Though multiple
17748 @option{-fopt-info} options are accepted, only one of them can include
17749 a @var{filename}. If other filenames are provided then all but the
17750 first such option are ignored.
17752 Note that the output @var{filename} is overwritten
17753 in case of multiple translation units. If a combined output from
17754 multiple translation units is desired, @file{stderr} should be used
17757 In the following example, the optimization info is output to
17766 gcc -O3 -fopt-info-missed=missed.all
17770 outputs missed optimization report from all the passes into
17771 @file{missed.all}, and this one:
17774 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
17778 prints information about missed optimization opportunities from
17779 vectorization passes on @file{stderr}.
17780 Note that @option{-fopt-info-vec-missed} is equivalent to
17781 @option{-fopt-info-missed-vec}. The order of the optimization group
17782 names and message types listed after @option{-fopt-info} does not matter.
17784 As another example,
17786 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
17790 outputs information about missed optimizations as well as
17791 optimized locations from all the inlining passes into
17797 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
17801 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
17802 in conflict since only one output file is allowed. In this case, only
17803 the first option takes effect and the subsequent options are
17804 ignored. Thus only @file{vec.miss} is produced which contains
17805 dumps from the vectorizer about missed opportunities.
17807 @item -fsave-optimization-record
17808 @opindex fsave-optimization-record
17809 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
17810 were performed, for those optimizations that support @option{-fopt-info}.
17812 This option is experimental and the format of the data within the
17813 compressed JSON file is subject to change.
17815 It is roughly equivalent to a machine-readable version of
17816 @option{-fopt-info-all}, as a collection of messages with source file,
17817 line number and column number, with the following additional data for
17823 the execution count of the code being optimized, along with metadata about
17824 whether this was from actual profile data, or just an estimate, allowing
17825 consumers to prioritize messages by code hotness,
17828 the function name of the code being optimized, where applicable,
17831 the ``inlining chain'' for the code being optimized, so that when
17832 a function is inlined into several different places (which might
17833 themselves be inlined), the reader can distinguish between the copies,
17836 objects identifying those parts of the message that refer to expressions,
17837 statements or symbol-table nodes, which of these categories they are, and,
17838 when available, their source code location,
17841 the GCC pass that emitted the message, and
17844 the location in GCC's own code from which the message was emitted
17848 Additionally, some messages are logically nested within other
17849 messages, reflecting implementation details of the optimization
17852 @item -fsched-verbose=@var{n}
17853 @opindex fsched-verbose
17854 On targets that use instruction scheduling, this option controls the
17855 amount of debugging output the scheduler prints to the dump files.
17857 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
17858 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
17859 For @var{n} greater than one, it also output basic block probabilities,
17860 detailed ready list information and unit/insn info. For @var{n} greater
17861 than two, it includes RTL at abort point, control-flow and regions info.
17862 And for @var{n} over four, @option{-fsched-verbose} also includes
17867 @item -fenable-@var{kind}-@var{pass}
17868 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
17872 This is a set of options that are used to explicitly disable/enable
17873 optimization passes. These options are intended for use for debugging GCC.
17874 Compiler users should use regular options for enabling/disabling
17879 @item -fdisable-ipa-@var{pass}
17880 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
17881 statically invoked in the compiler multiple times, the pass name should be
17882 appended with a sequential number starting from 1.
17884 @item -fdisable-rtl-@var{pass}
17885 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
17886 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
17887 statically invoked in the compiler multiple times, the pass name should be
17888 appended with a sequential number starting from 1. @var{range-list} is a
17889 comma-separated list of function ranges or assembler names. Each range is a number
17890 pair separated by a colon. The range is inclusive in both ends. If the range
17891 is trivial, the number pair can be simplified as a single number. If the
17892 function's call graph node's @var{uid} falls within one of the specified ranges,
17893 the @var{pass} is disabled for that function. The @var{uid} is shown in the
17894 function header of a dump file, and the pass names can be dumped by using
17895 option @option{-fdump-passes}.
17897 @item -fdisable-tree-@var{pass}
17898 @itemx -fdisable-tree-@var{pass}=@var{range-list}
17899 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
17902 @item -fenable-ipa-@var{pass}
17903 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
17904 statically invoked in the compiler multiple times, the pass name should be
17905 appended with a sequential number starting from 1.
17907 @item -fenable-rtl-@var{pass}
17908 @itemx -fenable-rtl-@var{pass}=@var{range-list}
17909 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
17910 description and examples.
17912 @item -fenable-tree-@var{pass}
17913 @itemx -fenable-tree-@var{pass}=@var{range-list}
17914 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
17915 of option arguments.
17919 Here are some examples showing uses of these options.
17923 # disable ccp1 for all functions
17924 -fdisable-tree-ccp1
17925 # disable complete unroll for function whose cgraph node uid is 1
17926 -fenable-tree-cunroll=1
17927 # disable gcse2 for functions at the following ranges [1,1],
17928 # [300,400], and [400,1000]
17929 # disable gcse2 for functions foo and foo2
17930 -fdisable-rtl-gcse2=foo,foo2
17931 # disable early inlining
17932 -fdisable-tree-einline
17933 # disable ipa inlining
17934 -fdisable-ipa-inline
17935 # enable tree full unroll
17936 -fenable-tree-unroll
17941 @itemx -fchecking=@var{n}
17943 @opindex fno-checking
17944 Enable internal consistency checking. The default depends on
17945 the compiler configuration. @option{-fchecking=2} enables further
17946 internal consistency checking that might affect code generation.
17948 @item -frandom-seed=@var{string}
17949 @opindex frandom-seed
17950 This option provides a seed that GCC uses in place of
17951 random numbers in generating certain symbol names
17952 that have to be different in every compiled file. It is also used to
17953 place unique stamps in coverage data files and the object files that
17954 produce them. You can use the @option{-frandom-seed} option to produce
17955 reproducibly identical object files.
17957 The @var{string} can either be a number (decimal, octal or hex) or an
17958 arbitrary string (in which case it's converted to a number by
17961 The @var{string} should be different for every file you compile.
17964 @opindex save-temps
17965 Store the usual ``temporary'' intermediate files permanently; name them
17966 as auxiliary output files, as specified described under
17967 @option{-dumpbase} and @option{-dumpdir}.
17969 When used in combination with the @option{-x} command-line option,
17970 @option{-save-temps} is sensible enough to avoid overwriting an
17971 input source file with the same extension as an intermediate file.
17972 The corresponding intermediate file may be obtained by renaming the
17973 source file before using @option{-save-temps}.
17975 @item -save-temps=cwd
17976 @opindex save-temps=cwd
17977 Equivalent to @option{-save-temps -dumpdir ./}.
17979 @item -save-temps=obj
17980 @opindex save-temps=obj
17981 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
17982 @file{outdir/} is the directory of the output file specified after the
17983 @option{-o} option, including any directory separators. If the
17984 @option{-o} option is not used, the @option{-save-temps=obj} switch
17985 behaves like @option{-save-temps=cwd}.
17987 @item -time@r{[}=@var{file}@r{]}
17989 Report the CPU time taken by each subprocess in the compilation
17990 sequence. For C source files, this is the compiler proper and assembler
17991 (plus the linker if linking is done).
17993 Without the specification of an output file, the output looks like this:
18000 The first number on each line is the ``user time'', that is time spent
18001 executing the program itself. The second number is ``system time'',
18002 time spent executing operating system routines on behalf of the program.
18003 Both numbers are in seconds.
18005 With the specification of an output file, the output is appended to the
18006 named file, and it looks like this:
18009 0.12 0.01 cc1 @var{options}
18010 0.00 0.01 as @var{options}
18013 The ``user time'' and the ``system time'' are moved before the program
18014 name, and the options passed to the program are displayed, so that one
18015 can later tell what file was being compiled, and with which options.
18017 @item -fdump-final-insns@r{[}=@var{file}@r{]}
18018 @opindex fdump-final-insns
18019 Dump the final internal representation (RTL) to @var{file}. If the
18020 optional argument is omitted (or if @var{file} is @code{.}), the name
18021 of the dump file is determined by appending @code{.gkd} to the
18022 dump base name, see @option{-dumpbase}.
18024 @item -fcompare-debug@r{[}=@var{opts}@r{]}
18025 @opindex fcompare-debug
18026 @opindex fno-compare-debug
18027 If no error occurs during compilation, run the compiler a second time,
18028 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
18029 passed to the second compilation. Dump the final internal
18030 representation in both compilations, and print an error if they differ.
18032 If the equal sign is omitted, the default @option{-gtoggle} is used.
18034 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
18035 and nonzero, implicitly enables @option{-fcompare-debug}. If
18036 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
18037 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
18040 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
18041 is equivalent to @option{-fno-compare-debug}, which disables the dumping
18042 of the final representation and the second compilation, preventing even
18043 @env{GCC_COMPARE_DEBUG} from taking effect.
18045 To verify full coverage during @option{-fcompare-debug} testing, set
18046 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
18047 which GCC rejects as an invalid option in any actual compilation
18048 (rather than preprocessing, assembly or linking). To get just a
18049 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
18050 not overridden} will do.
18052 @item -fcompare-debug-second
18053 @opindex fcompare-debug-second
18054 This option is implicitly passed to the compiler for the second
18055 compilation requested by @option{-fcompare-debug}, along with options to
18056 silence warnings, and omitting other options that would cause the compiler
18057 to produce output to files or to standard output as a side effect. Dump
18058 files and preserved temporary files are renamed so as to contain the
18059 @code{.gk} additional extension during the second compilation, to avoid
18060 overwriting those generated by the first.
18062 When this option is passed to the compiler driver, it causes the
18063 @emph{first} compilation to be skipped, which makes it useful for little
18064 other than debugging the compiler proper.
18068 Turn off generation of debug info, if leaving out this option
18069 generates it, or turn it on at level 2 otherwise. The position of this
18070 argument in the command line does not matter; it takes effect after all
18071 other options are processed, and it does so only once, no matter how
18072 many times it is given. This is mainly intended to be used with
18073 @option{-fcompare-debug}.
18075 @item -fvar-tracking-assignments-toggle
18076 @opindex fvar-tracking-assignments-toggle
18077 @opindex fno-var-tracking-assignments-toggle
18078 Toggle @option{-fvar-tracking-assignments}, in the same way that
18079 @option{-gtoggle} toggles @option{-g}.
18083 Makes the compiler print out each function name as it is compiled, and
18084 print some statistics about each pass when it finishes.
18086 @item -ftime-report
18087 @opindex ftime-report
18088 Makes the compiler print some statistics about the time consumed by each
18089 pass when it finishes.
18091 @item -ftime-report-details
18092 @opindex ftime-report-details
18093 Record the time consumed by infrastructure parts separately for each pass.
18095 @item -fira-verbose=@var{n}
18096 @opindex fira-verbose
18097 Control the verbosity of the dump file for the integrated register allocator.
18098 The default value is 5. If the value @var{n} is greater or equal to 10,
18099 the dump output is sent to stderr using the same format as @var{n} minus 10.
18102 @opindex flto-report
18103 Prints a report with internal details on the workings of the link-time
18104 optimizer. The contents of this report vary from version to version.
18105 It is meant to be useful to GCC developers when processing object
18106 files in LTO mode (via @option{-flto}).
18108 Disabled by default.
18110 @item -flto-report-wpa
18111 @opindex flto-report-wpa
18112 Like @option{-flto-report}, but only print for the WPA phase of link-time
18116 @opindex fmem-report
18117 Makes the compiler print some statistics about permanent memory
18118 allocation when it finishes.
18120 @item -fmem-report-wpa
18121 @opindex fmem-report-wpa
18122 Makes the compiler print some statistics about permanent memory
18123 allocation for the WPA phase only.
18125 @item -fpre-ipa-mem-report
18126 @opindex fpre-ipa-mem-report
18127 @item -fpost-ipa-mem-report
18128 @opindex fpost-ipa-mem-report
18129 Makes the compiler print some statistics about permanent memory
18130 allocation before or after interprocedural optimization.
18132 @item -fprofile-report
18133 @opindex fprofile-report
18134 Makes the compiler print some statistics about consistency of the
18135 (estimated) profile and effect of individual passes.
18137 @item -fstack-usage
18138 @opindex fstack-usage
18139 Makes the compiler output stack usage information for the program, on a
18140 per-function basis. The filename for the dump is made by appending
18141 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
18142 the output file, if explicitly specified and it is not an executable,
18143 otherwise it is the basename of the source file. An entry is made up
18148 The name of the function.
18152 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
18155 The qualifier @code{static} means that the function manipulates the stack
18156 statically: a fixed number of bytes are allocated for the frame on function
18157 entry and released on function exit; no stack adjustments are otherwise made
18158 in the function. The second field is this fixed number of bytes.
18160 The qualifier @code{dynamic} means that the function manipulates the stack
18161 dynamically: in addition to the static allocation described above, stack
18162 adjustments are made in the body of the function, for example to push/pop
18163 arguments around function calls. If the qualifier @code{bounded} is also
18164 present, the amount of these adjustments is bounded at compile time and
18165 the second field is an upper bound of the total amount of stack used by
18166 the function. If it is not present, the amount of these adjustments is
18167 not bounded at compile time and the second field only represents the
18172 Emit statistics about front-end processing at the end of the compilation.
18173 This option is supported only by the C++ front end, and
18174 the information is generally only useful to the G++ development team.
18176 @item -fdbg-cnt-list
18177 @opindex fdbg-cnt-list
18178 Print the name and the counter upper bound for all debug counters.
18181 @item -fdbg-cnt=@var{counter-value-list}
18183 Set the internal debug counter lower and upper bound. @var{counter-value-list}
18184 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
18185 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
18186 the name of the counter and list of closed intervals.
18187 The @var{lower_bound} is optional and is zero
18188 initialized if not set.
18189 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
18190 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
18191 eleventh invocation.
18192 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
18194 @item -print-file-name=@var{library}
18195 @opindex print-file-name
18196 Print the full absolute name of the library file @var{library} that
18197 would be used when linking---and don't do anything else. With this
18198 option, GCC does not compile or link anything; it just prints the
18201 @item -print-multi-directory
18202 @opindex print-multi-directory
18203 Print the directory name corresponding to the multilib selected by any
18204 other switches present in the command line. This directory is supposed
18205 to exist in @env{GCC_EXEC_PREFIX}.
18207 @item -print-multi-lib
18208 @opindex print-multi-lib
18209 Print the mapping from multilib directory names to compiler switches
18210 that enable them. The directory name is separated from the switches by
18211 @samp{;}, and each switch starts with an @samp{@@} instead of the
18212 @samp{-}, without spaces between multiple switches. This is supposed to
18213 ease shell processing.
18215 @item -print-multi-os-directory
18216 @opindex print-multi-os-directory
18217 Print the path to OS libraries for the selected
18218 multilib, relative to some @file{lib} subdirectory. If OS libraries are
18219 present in the @file{lib} subdirectory and no multilibs are used, this is
18220 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
18221 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
18222 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
18223 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
18225 @item -print-multiarch
18226 @opindex print-multiarch
18227 Print the path to OS libraries for the selected multiarch,
18228 relative to some @file{lib} subdirectory.
18230 @item -print-prog-name=@var{program}
18231 @opindex print-prog-name
18232 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
18234 @item -print-libgcc-file-name
18235 @opindex print-libgcc-file-name
18236 Same as @option{-print-file-name=libgcc.a}.
18238 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
18239 but you do want to link with @file{libgcc.a}. You can do:
18242 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
18245 @item -print-search-dirs
18246 @opindex print-search-dirs
18247 Print the name of the configured installation directory and a list of
18248 program and library directories @command{gcc} searches---and don't do anything else.
18250 This is useful when @command{gcc} prints the error message
18251 @samp{installation problem, cannot exec cpp0: No such file or directory}.
18252 To resolve this you either need to put @file{cpp0} and the other compiler
18253 components where @command{gcc} expects to find them, or you can set the environment
18254 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
18255 Don't forget the trailing @samp{/}.
18256 @xref{Environment Variables}.
18258 @item -print-sysroot
18259 @opindex print-sysroot
18260 Print the target sysroot directory that is used during
18261 compilation. This is the target sysroot specified either at configure
18262 time or using the @option{--sysroot} option, possibly with an extra
18263 suffix that depends on compilation options. If no target sysroot is
18264 specified, the option prints nothing.
18266 @item -print-sysroot-headers-suffix
18267 @opindex print-sysroot-headers-suffix
18268 Print the suffix added to the target sysroot when searching for
18269 headers, or give an error if the compiler is not configured with such
18270 a suffix---and don't do anything else.
18273 @opindex dumpmachine
18274 Print the compiler's target machine (for example,
18275 @samp{i686-pc-linux-gnu})---and don't do anything else.
18278 @opindex dumpversion
18279 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
18280 anything else. This is the compiler version used in filesystem paths and
18281 specs. Depending on how the compiler has been configured it can be just
18282 a single number (major version), two numbers separated by a dot (major and
18283 minor version) or three numbers separated by dots (major, minor and patchlevel
18286 @item -dumpfullversion
18287 @opindex dumpfullversion
18288 Print the full compiler version---and don't do anything else. The output is
18289 always three numbers separated by dots, major, minor and patchlevel version.
18293 Print the compiler's built-in specs---and don't do anything else. (This
18294 is used when GCC itself is being built.) @xref{Spec Files}.
18297 @node Submodel Options
18298 @section Machine-Dependent Options
18299 @cindex submodel options
18300 @cindex specifying hardware config
18301 @cindex hardware models and configurations, specifying
18302 @cindex target-dependent options
18303 @cindex machine-dependent options
18305 Each target machine supported by GCC can have its own options---for
18306 example, to allow you to compile for a particular processor variant or
18307 ABI, or to control optimizations specific to that machine. By
18308 convention, the names of machine-specific options start with
18311 Some configurations of the compiler also support additional target-specific
18312 options, usually for compatibility with other compilers on the same
18315 @c This list is ordered alphanumerically by subsection name.
18316 @c It should be the same order and spelling as these options are listed
18317 @c in Machine Dependent Options
18320 * AArch64 Options::
18321 * Adapteva Epiphany Options::
18322 * AMD GCN Options::
18326 * Blackfin Options::
18332 * DEC Alpha Options::
18337 * GNU/Linux Options::
18347 * MicroBlaze Options::
18350 * MN10300 Options::
18354 * Nios II Options::
18355 * Nvidia PTX Options::
18356 * OpenRISC Options::
18358 * picoChip Options::
18359 * PowerPC Options::
18363 * RS/6000 and PowerPC Options::
18365 * S/390 and zSeries Options::
18368 * Solaris 2 Options::
18370 * System V Options::
18371 * TILE-Gx Options::
18372 * TILEPro Options::
18377 * VxWorks Options::
18379 * x86 Windows Options::
18380 * Xstormy16 Options::
18382 * zSeries Options::
18385 @node AArch64 Options
18386 @subsection AArch64 Options
18387 @cindex AArch64 Options
18389 These options are defined for AArch64 implementations:
18393 @item -mabi=@var{name}
18395 Generate code for the specified data model. Permissible values
18396 are @samp{ilp32} for SysV-like data model where int, long int and pointers
18397 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
18398 but long int and pointers are 64 bits.
18400 The default depends on the specific target configuration. Note that
18401 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
18402 entire program with the same ABI, and link with a compatible set of libraries.
18405 @opindex mbig-endian
18406 Generate big-endian code. This is the default when GCC is configured for an
18407 @samp{aarch64_be-*-*} target.
18409 @item -mgeneral-regs-only
18410 @opindex mgeneral-regs-only
18411 Generate code which uses only the general-purpose registers. This will prevent
18412 the compiler from using floating-point and Advanced SIMD registers but will not
18413 impose any restrictions on the assembler.
18415 @item -mlittle-endian
18416 @opindex mlittle-endian
18417 Generate little-endian code. This is the default when GCC is configured for an
18418 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
18420 @item -mcmodel=tiny
18421 @opindex mcmodel=tiny
18422 Generate code for the tiny code model. The program and its statically defined
18423 symbols must be within 1MB of each other. Programs can be statically or
18424 dynamically linked.
18426 @item -mcmodel=small
18427 @opindex mcmodel=small
18428 Generate code for the small code model. The program and its statically defined
18429 symbols must be within 4GB of each other. Programs can be statically or
18430 dynamically linked. This is the default code model.
18432 @item -mcmodel=large
18433 @opindex mcmodel=large
18434 Generate code for the large code model. This makes no assumptions about
18435 addresses and sizes of sections. Programs can be statically linked only. The
18436 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
18437 @option{-fpic} and @option{-fPIC}.
18439 @item -mstrict-align
18440 @itemx -mno-strict-align
18441 @opindex mstrict-align
18442 @opindex mno-strict-align
18443 Avoid or allow generating memory accesses that may not be aligned on a natural
18444 object boundary as described in the architecture specification.
18446 @item -momit-leaf-frame-pointer
18447 @itemx -mno-omit-leaf-frame-pointer
18448 @opindex momit-leaf-frame-pointer
18449 @opindex mno-omit-leaf-frame-pointer
18450 Omit or keep the frame pointer in leaf functions. The former behavior is the
18453 @item -mstack-protector-guard=@var{guard}
18454 @itemx -mstack-protector-guard-reg=@var{reg}
18455 @itemx -mstack-protector-guard-offset=@var{offset}
18456 @opindex mstack-protector-guard
18457 @opindex mstack-protector-guard-reg
18458 @opindex mstack-protector-guard-offset
18459 Generate stack protection code using canary at @var{guard}. Supported
18460 locations are @samp{global} for a global canary or @samp{sysreg} for a
18461 canary in an appropriate system register.
18463 With the latter choice the options
18464 @option{-mstack-protector-guard-reg=@var{reg}} and
18465 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
18466 which system register to use as base register for reading the canary,
18467 and from what offset from that base register. There is no default
18468 register or offset as this is entirely for use within the Linux
18471 @item -mtls-dialect=desc
18472 @opindex mtls-dialect=desc
18473 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
18474 of TLS variables. This is the default.
18476 @item -mtls-dialect=traditional
18477 @opindex mtls-dialect=traditional
18478 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
18481 @item -mtls-size=@var{size}
18483 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
18484 This option requires binutils 2.26 or newer.
18486 @item -mfix-cortex-a53-835769
18487 @itemx -mno-fix-cortex-a53-835769
18488 @opindex mfix-cortex-a53-835769
18489 @opindex mno-fix-cortex-a53-835769
18490 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
18491 This involves inserting a NOP instruction between memory instructions and
18492 64-bit integer multiply-accumulate instructions.
18494 @item -mfix-cortex-a53-843419
18495 @itemx -mno-fix-cortex-a53-843419
18496 @opindex mfix-cortex-a53-843419
18497 @opindex mno-fix-cortex-a53-843419
18498 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
18499 This erratum workaround is made at link time and this will only pass the
18500 corresponding flag to the linker.
18502 @item -mlow-precision-recip-sqrt
18503 @itemx -mno-low-precision-recip-sqrt
18504 @opindex mlow-precision-recip-sqrt
18505 @opindex mno-low-precision-recip-sqrt
18506 Enable or disable the reciprocal square root approximation.
18507 This option only has an effect if @option{-ffast-math} or
18508 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18509 precision of reciprocal square root results to about 16 bits for
18510 single precision and to 32 bits for double precision.
18512 @item -mlow-precision-sqrt
18513 @itemx -mno-low-precision-sqrt
18514 @opindex mlow-precision-sqrt
18515 @opindex mno-low-precision-sqrt
18516 Enable or disable the square root approximation.
18517 This option only has an effect if @option{-ffast-math} or
18518 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18519 precision of square root results to about 16 bits for
18520 single precision and to 32 bits for double precision.
18521 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
18523 @item -mlow-precision-div
18524 @itemx -mno-low-precision-div
18525 @opindex mlow-precision-div
18526 @opindex mno-low-precision-div
18527 Enable or disable the division approximation.
18528 This option only has an effect if @option{-ffast-math} or
18529 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18530 precision of division results to about 16 bits for
18531 single precision and to 32 bits for double precision.
18533 @item -mtrack-speculation
18534 @itemx -mno-track-speculation
18535 Enable or disable generation of additional code to track speculative
18536 execution through conditional branches. The tracking state can then
18537 be used by the compiler when expanding calls to
18538 @code{__builtin_speculation_safe_copy} to permit a more efficient code
18539 sequence to be generated.
18541 @item -moutline-atomics
18542 @itemx -mno-outline-atomics
18543 Enable or disable calls to out-of-line helpers to implement atomic operations.
18544 These helpers will, at runtime, determine if the LSE instructions from
18545 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
18546 instructions that are present in the base ARMv8.0 ISA.
18548 This option is only applicable when compiling for the base ARMv8.0
18549 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
18550 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
18551 used directly. The same applies when using @option{-mcpu=} when the
18552 selected cpu supports the @samp{lse} feature.
18553 This option is on by default.
18555 @item -march=@var{name}
18557 Specify the name of the target architecture and, optionally, one or
18558 more feature modifiers. This option has the form
18559 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
18561 The table below summarizes the permissible values for @var{arch}
18562 and the features that they enable by default:
18564 @multitable @columnfractions 0.20 0.20 0.60
18565 @headitem @var{arch} value @tab Architecture @tab Includes by default
18566 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
18567 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
18568 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
18569 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
18570 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
18571 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
18572 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
18573 @item @samp{armv8.7-a} @tab Armv8.7-a @tab @samp{armv8.6-a}, @samp{+ls64}
18574 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
18577 The value @samp{native} is available on native AArch64 GNU/Linux and
18578 causes the compiler to pick the architecture of the host system. This
18579 option has no effect if the compiler is unable to recognize the
18580 architecture of the host system,
18582 The permissible values for @var{feature} are listed in the sub-section
18583 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18584 Feature Modifiers}. Where conflicting feature modifiers are
18585 specified, the right-most feature is used.
18587 GCC uses @var{name} to determine what kind of instructions it can emit
18588 when generating assembly code. If @option{-march} is specified
18589 without either of @option{-mtune} or @option{-mcpu} also being
18590 specified, the code is tuned to perform well across a range of target
18591 processors implementing the target architecture.
18593 @item -mtune=@var{name}
18595 Specify the name of the target processor for which GCC should tune the
18596 performance of the code. Permissible values for this option are:
18597 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18598 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18599 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18600 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
18601 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
18602 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
18603 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
18604 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{qdf24xx},
18605 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
18606 @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83},
18607 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
18608 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
18609 @samp{octeontx2f95mm},
18611 @samp{thunderx}, @samp{thunderxt88},
18612 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
18613 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
18614 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18615 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18616 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
18617 @samp{cortex-r82}, @samp{cortex-x1}, @samp{native}.
18619 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18620 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18621 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
18622 should tune for a big.LITTLE system.
18624 The value @samp{neoverse-512tvb} specifies that GCC should tune
18625 for Neoverse cores that (a) implement SVE and (b) have a total vector
18626 bandwidth of 512 bits per cycle. In other words, the option tells GCC to
18627 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
18628 instructions a cycle and that can execute an equivalent number of SVE
18629 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
18630 This is more general than tuning for a specific core like Neoverse V1
18631 but is more specific than the default tuning described below.
18633 Additionally on native AArch64 GNU/Linux systems the value
18634 @samp{native} tunes performance to the host system. This option has no effect
18635 if the compiler is unable to recognize the processor of the host system.
18637 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
18638 are specified, the code is tuned to perform well across a range
18639 of target processors.
18641 This option cannot be suffixed by feature modifiers.
18643 @item -mcpu=@var{name}
18645 Specify the name of the target processor, optionally suffixed by one
18646 or more feature modifiers. This option has the form
18647 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
18648 the permissible values for @var{cpu} are the same as those available
18649 for @option{-mtune}. The permissible values for @var{feature} are
18650 documented in the sub-section on
18651 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18652 Feature Modifiers}. Where conflicting feature modifiers are
18653 specified, the right-most feature is used.
18655 GCC uses @var{name} to determine what kind of instructions it can emit when
18656 generating assembly code (as if by @option{-march}) and to determine
18657 the target processor for which to tune for performance (as if
18658 by @option{-mtune}). Where this option is used in conjunction
18659 with @option{-march} or @option{-mtune}, those options take precedence
18660 over the appropriate part of this option.
18662 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
18663 to a specific core, but instead refers to all Neoverse cores that
18664 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
18665 a cycle. Unless overridden by @option{-march},
18666 @option{-mcpu=neoverse-512tvb} generates code that can run on a
18667 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
18668 these properties. Unless overridden by @option{-mtune},
18669 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
18670 @option{-mtune=neoverse-512tvb}.
18672 @item -moverride=@var{string}
18674 Override tuning decisions made by the back-end in response to a
18675 @option{-mtune=} switch. The syntax, semantics, and accepted values
18676 for @var{string} in this option are not guaranteed to be consistent
18679 This option is only intended to be useful when developing GCC.
18681 @item -mverbose-cost-dump
18682 @opindex mverbose-cost-dump
18683 Enable verbose cost model dumping in the debug dump files. This option is
18684 provided for use in debugging the compiler.
18686 @item -mpc-relative-literal-loads
18687 @itemx -mno-pc-relative-literal-loads
18688 @opindex mpc-relative-literal-loads
18689 @opindex mno-pc-relative-literal-loads
18690 Enable or disable PC-relative literal loads. With this option literal pools are
18691 accessed using a single instruction and emitted after each function. This
18692 limits the maximum size of functions to 1MB. This is enabled by default for
18693 @option{-mcmodel=tiny}.
18695 @item -msign-return-address=@var{scope}
18696 @opindex msign-return-address
18697 Select the function scope on which return address signing will be applied.
18698 Permissible values are @samp{none}, which disables return address signing,
18699 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
18700 functions, and @samp{all}, which enables pointer signing for all functions. The
18701 default value is @samp{none}. This option has been deprecated by
18702 -mbranch-protection.
18704 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
18705 @opindex mbranch-protection
18706 Select the branch protection features to use.
18707 @samp{none} is the default and turns off all types of branch protection.
18708 @samp{standard} turns on all types of branch protection features. If a feature
18709 has additional tuning options, then @samp{standard} sets it to its standard
18711 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
18712 level: signing functions that save the return address to memory (non-leaf
18713 functions will practically always do this) using the a-key. The optional
18714 argument @samp{leaf} can be used to extend the signing to include leaf
18715 functions. The optional argument @samp{b-key} can be used to sign the functions
18716 with the B-key instead of the A-key.
18717 @samp{bti} turns on branch target identification mechanism.
18719 @item -mharden-sls=@var{opts}
18720 @opindex mharden-sls
18721 Enable compiler hardening against straight line speculation (SLS).
18722 @var{opts} is a comma-separated list of the following options:
18727 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
18728 @samp{-mharden-sls=none} disables all SLS hardening.
18730 @item -msve-vector-bits=@var{bits}
18731 @opindex msve-vector-bits
18732 Specify the number of bits in an SVE vector register. This option only has
18733 an effect when SVE is enabled.
18735 GCC supports two forms of SVE code generation: ``vector-length
18736 agnostic'' output that works with any size of vector register and
18737 ``vector-length specific'' output that allows GCC to make assumptions
18738 about the vector length when it is useful for optimization reasons.
18739 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
18740 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
18741 Specifying @samp{scalable} selects vector-length agnostic
18742 output. At present @samp{-msve-vector-bits=128} also generates vector-length
18743 agnostic output for big-endian targets. All other values generate
18744 vector-length specific code. The behavior of these values may change
18745 in future releases and no value except @samp{scalable} should be
18746 relied on for producing code that is portable across different
18747 hardware SVE vector lengths.
18749 The default is @samp{-msve-vector-bits=scalable}, which produces
18750 vector-length agnostic code.
18753 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
18754 @anchor{aarch64-feature-modifiers}
18755 @cindex @option{-march} feature modifiers
18756 @cindex @option{-mcpu} feature modifiers
18757 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
18758 the following and their inverses @option{no@var{feature}}:
18762 Enable CRC extension. This is on by default for
18763 @option{-march=armv8.1-a}.
18765 Enable Crypto extension. This also enables Advanced SIMD and floating-point
18768 Enable floating-point instructions. This is on by default for all possible
18769 values for options @option{-march} and @option{-mcpu}.
18771 Enable Advanced SIMD instructions. This also enables floating-point
18772 instructions. This is on by default for all possible values for options
18773 @option{-march} and @option{-mcpu}.
18775 Enable Scalable Vector Extension instructions. This also enables Advanced
18776 SIMD and floating-point instructions.
18778 Enable Large System Extension instructions. This is on by default for
18779 @option{-march=armv8.1-a}.
18781 Enable Round Double Multiply Accumulate instructions. This is on by default
18782 for @option{-march=armv8.1-a}.
18784 Enable FP16 extension. This also enables floating-point instructions.
18786 Enable FP16 fmla extension. This also enables FP16 extensions and
18787 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.
18790 Enable the RcPc extension. This does not change code generation from GCC,
18791 but is passed on to the assembler, enabling inline asm statements to use
18792 instructions from the RcPc extension.
18794 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
18796 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
18799 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
18801 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
18802 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
18804 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
18805 Use of this option with architectures prior to Armv8.2-A is not supported.
18807 Enable the Statistical Profiling extension. This option is only to enable the
18808 extension at the assembler level and does not affect code generation.
18810 Enable the Armv8.5-a Random Number instructions. This option is only to
18811 enable the extension at the assembler level and does not affect code
18814 Enable the Armv8.5-a Memory Tagging Extensions.
18815 Use of this option with architectures prior to Armv8.5-A is not supported.
18817 Enable the Armv8-a Speculation Barrier instruction. This option is only to
18818 enable the extension at the assembler level and does not affect code
18819 generation. This option is enabled by default for @option{-march=armv8.5-a}.
18821 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
18822 is only to enable the extension at the assembler level and does not affect code
18823 generation. This option is enabled by default for @option{-march=armv8.5-a}.
18825 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
18826 This option is only to enable the extension at the assembler level and does
18827 not affect code generation. This option is enabled by default for
18828 @option{-march=armv8.5-a}.
18830 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
18833 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
18835 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
18837 Enable SVE2 aes instructions. This also enables SVE2 instructions.
18839 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
18841 Enable the Transactional Memory Extension.
18843 Enable 8-bit Integer Matrix Multiply instructions. This also enables
18844 Advanced SIMD and floating-point instructions. This option is enabled by
18845 default for @option{-march=armv8.6-a}. Use of this option with architectures
18846 prior to Armv8.2-A is not supported.
18848 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
18849 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
18852 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
18853 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
18856 Enable brain half-precision floating-point instructions. This also enables
18857 Advanced SIMD and floating-point instructions. This option is enabled by
18858 default for @option{-march=armv8.6-a}. Use of this option with architectures
18859 prior to Armv8.2-A is not supported.
18861 Enable the 64-byte atomic load and store instructions for accelerators.
18862 This option is enabled by default for @option{-march=armv8.7-a}.
18864 Enable the Flag Manipulation instructions Extension.
18866 Enable the Pointer Authentication Extension.
18870 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
18871 which implies @option{fp}.
18872 Conversely, @option{nofp} implies @option{nosimd}, which implies
18873 @option{nocrypto}, @option{noaes} and @option{nosha2}.
18875 @node Adapteva Epiphany Options
18876 @subsection Adapteva Epiphany Options
18878 These @samp{-m} options are defined for Adapteva Epiphany:
18881 @item -mhalf-reg-file
18882 @opindex mhalf-reg-file
18883 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
18884 That allows code to run on hardware variants that lack these registers.
18886 @item -mprefer-short-insn-regs
18887 @opindex mprefer-short-insn-regs
18888 Preferentially allocate registers that allow short instruction generation.
18889 This can result in increased instruction count, so this may either reduce or
18890 increase overall code size.
18892 @item -mbranch-cost=@var{num}
18893 @opindex mbranch-cost
18894 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18895 This cost is only a heuristic and is not guaranteed to produce
18896 consistent results across releases.
18900 Enable the generation of conditional moves.
18902 @item -mnops=@var{num}
18904 Emit @var{num} NOPs before every other generated instruction.
18906 @item -mno-soft-cmpsf
18907 @opindex mno-soft-cmpsf
18908 @opindex msoft-cmpsf
18909 For single-precision floating-point comparisons, emit an @code{fsub} instruction
18910 and test the flags. This is faster than a software comparison, but can
18911 get incorrect results in the presence of NaNs, or when two different small
18912 numbers are compared such that their difference is calculated as zero.
18913 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
18914 software comparisons.
18916 @item -mstack-offset=@var{num}
18917 @opindex mstack-offset
18918 Set the offset between the top of the stack and the stack pointer.
18919 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
18920 can be used by leaf functions without stack allocation.
18921 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
18922 Note also that this option changes the ABI; compiling a program with a
18923 different stack offset than the libraries have been compiled with
18924 generally does not work.
18925 This option can be useful if you want to evaluate if a different stack
18926 offset would give you better code, but to actually use a different stack
18927 offset to build working programs, it is recommended to configure the
18928 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
18930 @item -mno-round-nearest
18931 @opindex mno-round-nearest
18932 @opindex mround-nearest
18933 Make the scheduler assume that the rounding mode has been set to
18934 truncating. The default is @option{-mround-nearest}.
18937 @opindex mlong-calls
18938 If not otherwise specified by an attribute, assume all calls might be beyond
18939 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
18940 function address into a register before performing a (otherwise direct) call.
18941 This is the default.
18943 @item -mshort-calls
18944 @opindex short-calls
18945 If not otherwise specified by an attribute, assume all direct calls are
18946 in the range of the @code{b} / @code{bl} instructions, so use these instructions
18947 for direct calls. The default is @option{-mlong-calls}.
18951 Assume addresses can be loaded as 16-bit unsigned values. This does not
18952 apply to function addresses for which @option{-mlong-calls} semantics
18955 @item -mfp-mode=@var{mode}
18957 Set the prevailing mode of the floating-point unit.
18958 This determines the floating-point mode that is provided and expected
18959 at function call and return time. Making this mode match the mode you
18960 predominantly need at function start can make your programs smaller and
18961 faster by avoiding unnecessary mode switches.
18963 @var{mode} can be set to one the following values:
18967 Any mode at function entry is valid, and retained or restored when
18968 the function returns, and when it calls other functions.
18969 This mode is useful for compiling libraries or other compilation units
18970 you might want to incorporate into different programs with different
18971 prevailing FPU modes, and the convenience of being able to use a single
18972 object file outweighs the size and speed overhead for any extra
18973 mode switching that might be needed, compared with what would be needed
18974 with a more specific choice of prevailing FPU mode.
18977 This is the mode used for floating-point calculations with
18978 truncating (i.e.@: round towards zero) rounding mode. That includes
18979 conversion from floating point to integer.
18981 @item round-nearest
18982 This is the mode used for floating-point calculations with
18983 round-to-nearest-or-even rounding mode.
18986 This is the mode used to perform integer calculations in the FPU, e.g.@:
18987 integer multiply, or integer multiply-and-accumulate.
18990 The default is @option{-mfp-mode=caller}
18992 @item -mno-split-lohi
18993 @itemx -mno-postinc
18994 @itemx -mno-postmodify
18995 @opindex mno-split-lohi
18996 @opindex msplit-lohi
18997 @opindex mno-postinc
18999 @opindex mno-postmodify
19000 @opindex mpostmodify
19001 Code generation tweaks that disable, respectively, splitting of 32-bit
19002 loads, generation of post-increment addresses, and generation of
19003 post-modify addresses. The defaults are @option{msplit-lohi},
19004 @option{-mpost-inc}, and @option{-mpost-modify}.
19006 @item -mnovect-double
19007 @opindex mno-vect-double
19008 @opindex mvect-double
19009 Change the preferred SIMD mode to SImode. The default is
19010 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
19012 @item -max-vect-align=@var{num}
19013 @opindex max-vect-align
19014 The maximum alignment for SIMD vector mode types.
19015 @var{num} may be 4 or 8. The default is 8.
19016 Note that this is an ABI change, even though many library function
19017 interfaces are unaffected if they don't use SIMD vector modes
19018 in places that affect size and/or alignment of relevant types.
19020 @item -msplit-vecmove-early
19021 @opindex msplit-vecmove-early
19022 Split vector moves into single word moves before reload. In theory this
19023 can give better register allocation, but so far the reverse seems to be
19024 generally the case.
19026 @item -m1reg-@var{reg}
19028 Specify a register to hold the constant @minus{}1, which makes loading small negative
19029 constants and certain bitmasks faster.
19030 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
19031 which specify use of that register as a fixed register,
19032 and @samp{none}, which means that no register is used for this
19033 purpose. The default is @option{-m1reg-none}.
19037 @node AMD GCN Options
19038 @subsection AMD GCN Options
19039 @cindex AMD GCN Options
19041 These options are defined specifically for the AMD GCN port.
19045 @item -march=@var{gpu}
19047 @itemx -mtune=@var{gpu}
19049 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
19055 Compile for GCN3 Fiji devices (gfx803).
19058 Compile for GCN5 Vega 10 devices (gfx900).
19061 Compile for GCN5 Vega 20 devices (gfx906).
19065 @item -msram-ecc=on
19066 @itemx -msram-ecc=off
19067 @itemx -msram-ecc=any
19069 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
19070 disabled, or either mode. This feature can be enabled per-process on some
19071 devices. The compiled code must match the device mode. The default is
19072 @samp{any}, for devices that support it.
19074 @item -mstack-size=@var{bytes}
19075 @opindex mstack-size
19076 Specify how many @var{bytes} of stack space will be requested for each GPU
19077 thread (wave-front). Beware that there may be many threads and limited memory
19078 available. The size of the stack allocation may also have an impact on
19079 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
19084 Compile binaries suitable for devices with the XNACK feature enabled. Some
19085 devices always require XNACK and some allow the user to configure XNACK. The
19086 compiled code must match the device mode. The default is @samp{-mno-xnack}.
19087 At present this option is a placeholder for support that is not yet
19093 @subsection ARC Options
19094 @cindex ARC options
19096 The following options control the architecture variant for which code
19099 @c architecture variants
19102 @item -mbarrel-shifter
19103 @opindex mbarrel-shifter
19104 Generate instructions supported by barrel shifter. This is the default
19105 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
19108 @opindex mjli-alawys
19109 Force to call a function using jli_s instruction. This option is
19110 valid only for ARCv2 architecture.
19112 @item -mcpu=@var{cpu}
19114 Set architecture type, register usage, and instruction scheduling
19115 parameters for @var{cpu}. There are also shortcut alias options
19116 available for backward compatibility and convenience. Supported
19117 values for @var{cpu} are
19123 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
19127 Compile for ARC601. Alias: @option{-mARC601}.
19132 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
19133 This is the default when configured with @option{--with-cpu=arc700}@.
19136 Compile for ARC EM.
19139 Compile for ARC HS.
19142 Compile for ARC EM CPU with no hardware extensions.
19145 Compile for ARC EM4 CPU.
19148 Compile for ARC EM4 DMIPS CPU.
19151 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
19155 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
19156 double assist instructions.
19159 Compile for ARC HS CPU with no hardware extensions except the atomic
19163 Compile for ARC HS34 CPU.
19166 Compile for ARC HS38 CPU.
19169 Compile for ARC HS38 CPU with all hardware extensions on.
19172 Compile for ARC 600 CPU with @code{norm} instructions enabled.
19174 @item arc600_mul32x16
19175 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
19176 instructions enabled.
19179 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
19180 instructions enabled.
19183 Compile for ARC 601 CPU with @code{norm} instructions enabled.
19185 @item arc601_mul32x16
19186 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
19187 instructions enabled.
19190 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
19191 instructions enabled.
19194 Compile for ARC 700 on NPS400 chip.
19197 Compile for ARC EM minimalist configuration featuring reduced register
19204 @itemx -mdpfp-compact
19205 @opindex mdpfp-compact
19206 Generate double-precision FPX instructions, tuned for the compact
19210 @opindex mdpfp-fast
19211 Generate double-precision FPX instructions, tuned for the fast
19214 @item -mno-dpfp-lrsr
19215 @opindex mno-dpfp-lrsr
19216 Disable @code{lr} and @code{sr} instructions from using FPX extension
19221 Generate extended arithmetic instructions. Currently only
19222 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
19223 supported. Only valid for @option{-mcpu=ARC700}.
19228 Do not generate @code{mpy}-family instructions for ARC700. This option is
19233 Generate 32x16-bit multiply and multiply-accumulate instructions.
19237 Generate @code{mul64} and @code{mulu64} instructions.
19238 Only valid for @option{-mcpu=ARC600}.
19242 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
19247 @itemx -mspfp-compact
19248 @opindex mspfp-compact
19249 Generate single-precision FPX instructions, tuned for the compact
19253 @opindex mspfp-fast
19254 Generate single-precision FPX instructions, tuned for the fast
19259 Enable generation of ARC SIMD instructions via target-specific
19260 builtins. Only valid for @option{-mcpu=ARC700}.
19263 @opindex msoft-float
19264 This option ignored; it is provided for compatibility purposes only.
19265 Software floating-point code is emitted by default, and this default
19266 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
19267 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
19268 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
19272 Generate @code{swap} instructions.
19276 This enables use of the locked load/store conditional extension to implement
19277 atomic memory built-in functions. Not available for ARC 6xx or ARC
19282 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
19284 @item -mcode-density
19285 @opindex mcode-density
19286 Enable code density instructions for ARC EM.
19287 This option is on by default for ARC HS.
19291 Enable double load/store operations for ARC HS cores.
19293 @item -mtp-regno=@var{regno}
19295 Specify thread pointer register number.
19297 @item -mmpy-option=@var{multo}
19298 @opindex mmpy-option
19299 Compile ARCv2 code with a multiplier design option. You can specify
19300 the option using either a string or numeric value for @var{multo}.
19301 @samp{wlh1} is the default value. The recognized values are:
19306 No multiplier available.
19310 16x16 multiplier, fully pipelined.
19311 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
19315 32x32 multiplier, fully
19316 pipelined (1 stage). The following instructions are additionally
19317 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19321 32x32 multiplier, fully pipelined
19322 (2 stages). The following instructions are additionally enabled: @code{mpy},
19323 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19327 Two 16x16 multipliers, blocking,
19328 sequential. The following instructions are additionally enabled: @code{mpy},
19329 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19333 One 16x16 multiplier, blocking,
19334 sequential. The following instructions are additionally enabled: @code{mpy},
19335 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19339 One 32x4 multiplier, blocking,
19340 sequential. The following instructions are additionally enabled: @code{mpy},
19341 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19345 ARC HS SIMD support.
19349 ARC HS SIMD support.
19353 ARC HS SIMD support.
19357 This option is only available for ARCv2 cores@.
19359 @item -mfpu=@var{fpu}
19361 Enables support for specific floating-point hardware extensions for ARCv2
19362 cores. Supported values for @var{fpu} are:
19367 Enables support for single-precision floating-point hardware
19371 Enables support for double-precision floating-point hardware
19372 extensions. The single-precision floating-point extension is also
19373 enabled. Not available for ARC EM@.
19376 Enables support for double-precision floating-point hardware
19377 extensions using double-precision assist instructions. The single-precision
19378 floating-point extension is also enabled. This option is
19379 only available for ARC EM@.
19382 Enables support for double-precision floating-point hardware
19383 extensions using double-precision assist instructions.
19384 The single-precision floating-point, square-root, and divide
19385 extensions are also enabled. This option is
19386 only available for ARC EM@.
19389 Enables support for double-precision floating-point hardware
19390 extensions using double-precision assist instructions.
19391 The single-precision floating-point and fused multiply and add
19392 hardware extensions are also enabled. This option is
19393 only available for ARC EM@.
19396 Enables support for double-precision floating-point hardware
19397 extensions using double-precision assist instructions.
19398 All single-precision floating-point hardware extensions are also
19399 enabled. This option is only available for ARC EM@.
19402 Enables support for single-precision floating-point, square-root and divide
19403 hardware extensions@.
19406 Enables support for double-precision floating-point, square-root and divide
19407 hardware extensions. This option
19408 includes option @samp{fpus_div}. Not available for ARC EM@.
19411 Enables support for single-precision floating-point and
19412 fused multiply and add hardware extensions@.
19415 Enables support for double-precision floating-point and
19416 fused multiply and add hardware extensions. This option
19417 includes option @samp{fpus_fma}. Not available for ARC EM@.
19420 Enables support for all single-precision floating-point hardware
19424 Enables support for all single- and double-precision floating-point
19425 hardware extensions. Not available for ARC EM@.
19429 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
19430 @opindex mirq-ctrl-saved
19431 Specifies general-purposes registers that the processor automatically
19432 saves/restores on interrupt entry and exit. @var{register-range} is
19433 specified as two registers separated by a dash. The register range
19434 always starts with @code{r0}, the upper limit is @code{fp} register.
19435 @var{blink} and @var{lp_count} are optional. This option is only
19436 valid for ARC EM and ARC HS cores.
19438 @item -mrgf-banked-regs=@var{number}
19439 @opindex mrgf-banked-regs
19440 Specifies the number of registers replicated in second register bank
19441 on entry to fast interrupt. Fast interrupts are interrupts with the
19442 highest priority level P0. These interrupts save only PC and STATUS32
19443 registers to avoid memory transactions during interrupt entry and exit
19444 sequences. Use this option when you are using fast interrupts in an
19445 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
19447 @item -mlpc-width=@var{width}
19448 @opindex mlpc-width
19449 Specify the width of the @code{lp_count} register. Valid values for
19450 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
19451 fixed to 32 bits. If the width is less than 32, the compiler does not
19452 attempt to transform loops in your program to use the zero-delay loop
19453 mechanism unless it is known that the @code{lp_count} register can
19454 hold the required loop-counter value. Depending on the width
19455 specified, the compiler and run-time library might continue to use the
19456 loop mechanism for various needs. This option defines macro
19457 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
19461 This option instructs the compiler to generate code for a 16-entry
19462 register file. This option defines the @code{__ARC_RF16__}
19463 preprocessor macro.
19465 @item -mbranch-index
19466 @opindex mbranch-index
19467 Enable use of @code{bi} or @code{bih} instructions to implement jump
19472 The following options are passed through to the assembler, and also
19473 define preprocessor macro symbols.
19475 @c Flags used by the assembler, but for which we define preprocessor
19476 @c macro symbols as well.
19479 @opindex mdsp-packa
19480 Passed down to the assembler to enable the DSP Pack A extensions.
19481 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
19486 Passed down to the assembler to enable the dual Viterbi butterfly
19487 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
19488 option is deprecated.
19490 @c ARC700 4.10 extension instruction
19493 Passed down to the assembler to enable the locked load/store
19494 conditional extension. Also sets the preprocessor symbol
19499 Passed down to the assembler. Also sets the preprocessor symbol
19500 @code{__Xxmac_d16}. This option is deprecated.
19504 Passed down to the assembler. Also sets the preprocessor symbol
19505 @code{__Xxmac_24}. This option is deprecated.
19507 @c ARC700 4.10 extension instruction
19510 Passed down to the assembler to enable the 64-bit time-stamp counter
19511 extension instruction. Also sets the preprocessor symbol
19512 @code{__Xrtsc}. This option is deprecated.
19514 @c ARC700 4.10 extension instruction
19517 Passed down to the assembler to enable the swap byte ordering
19518 extension instruction. Also sets the preprocessor symbol
19522 @opindex mtelephony
19523 Passed down to the assembler to enable dual- and single-operand
19524 instructions for telephony. Also sets the preprocessor symbol
19525 @code{__Xtelephony}. This option is deprecated.
19529 Passed down to the assembler to enable the XY memory extension. Also
19530 sets the preprocessor symbol @code{__Xxy}.
19534 The following options control how the assembly code is annotated:
19536 @c Assembly annotation options
19540 Annotate assembler instructions with estimated addresses.
19542 @item -mannotate-align
19543 @opindex mannotate-align
19544 Explain what alignment considerations lead to the decision to make an
19545 instruction short or long.
19549 The following options are passed through to the linker:
19551 @c options passed through to the linker
19555 Passed through to the linker, to specify use of the @code{arclinux} emulation.
19556 This option is enabled by default in tool chains built for
19557 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
19558 when profiling is not requested.
19560 @item -marclinux_prof
19561 @opindex marclinux_prof
19562 Passed through to the linker, to specify use of the
19563 @code{arclinux_prof} emulation. This option is enabled by default in
19564 tool chains built for @w{@code{arc-linux-uclibc}} and
19565 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
19569 The following options control the semantics of generated code:
19571 @c semantically relevant code generation options
19574 @opindex mlong-calls
19575 Generate calls as register indirect calls, thus providing access
19576 to the full 32-bit address range.
19578 @item -mmedium-calls
19579 @opindex mmedium-calls
19580 Don't use less than 25-bit addressing range for calls, which is the
19581 offset available for an unconditional branch-and-link
19582 instruction. Conditional execution of function calls is suppressed, to
19583 allow use of the 25-bit range, rather than the 21-bit range with
19584 conditional branch-and-link. This is the default for tool chains built
19585 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
19589 Put definitions of externally-visible data in a small data section if
19590 that data is no bigger than @var{num} bytes. The default value of
19591 @var{num} is 4 for any ARC configuration, or 8 when we have double
19592 load/store operations.
19597 Do not generate sdata references. This is the default for tool chains
19598 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
19601 @item -mvolatile-cache
19602 @opindex mvolatile-cache
19603 Use ordinarily cached memory accesses for volatile references. This is the
19606 @item -mno-volatile-cache
19607 @opindex mno-volatile-cache
19608 @opindex mvolatile-cache
19609 Enable cache bypass for volatile references.
19613 The following options fine tune code generation:
19614 @c code generation tuning options
19617 @opindex malign-call
19618 Does nothing. Preserved for backward compatibility.
19620 @item -mauto-modify-reg
19621 @opindex mauto-modify-reg
19622 Enable the use of pre/post modify with register displacement.
19624 @item -mbbit-peephole
19625 @opindex mbbit-peephole
19626 Enable bbit peephole2.
19630 This option disables a target-specific pass in @file{arc_reorg} to
19631 generate compare-and-branch (@code{br@var{cc}}) instructions.
19632 It has no effect on
19633 generation of these instructions driven by the combiner pass.
19635 @item -mcase-vector-pcrel
19636 @opindex mcase-vector-pcrel
19637 Use PC-relative switch case tables to enable case table shortening.
19638 This is the default for @option{-Os}.
19640 @item -mcompact-casesi
19641 @opindex mcompact-casesi
19642 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
19643 and only available for ARCv1 cores. This option is deprecated.
19645 @item -mno-cond-exec
19646 @opindex mno-cond-exec
19647 Disable the ARCompact-specific pass to generate conditional
19648 execution instructions.
19650 Due to delay slot scheduling and interactions between operand numbers,
19651 literal sizes, instruction lengths, and the support for conditional execution,
19652 the target-independent pass to generate conditional execution is often lacking,
19653 so the ARC port has kept a special pass around that tries to find more
19654 conditional execution generation opportunities after register allocation,
19655 branch shortening, and delay slot scheduling have been done. This pass
19656 generally, but not always, improves performance and code size, at the cost of
19657 extra compilation time, which is why there is an option to switch it off.
19658 If you have a problem with call instructions exceeding their allowable
19659 offset range because they are conditionalized, you should consider using
19660 @option{-mmedium-calls} instead.
19662 @item -mearly-cbranchsi
19663 @opindex mearly-cbranchsi
19664 Enable pre-reload use of the @code{cbranchsi} pattern.
19666 @item -mexpand-adddi
19667 @opindex mexpand-adddi
19668 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
19669 @code{add.f}, @code{adc} etc. This option is deprecated.
19671 @item -mindexed-loads
19672 @opindex mindexed-loads
19673 Enable the use of indexed loads. This can be problematic because some
19674 optimizers then assume that indexed stores exist, which is not
19679 Enable Local Register Allocation. This is still experimental for ARC,
19680 so by default the compiler uses standard reload
19681 (i.e.@: @option{-mno-lra}).
19683 @item -mlra-priority-none
19684 @opindex mlra-priority-none
19685 Don't indicate any priority for target registers.
19687 @item -mlra-priority-compact
19688 @opindex mlra-priority-compact
19689 Indicate target register priority for r0..r3 / r12..r15.
19691 @item -mlra-priority-noncompact
19692 @opindex mlra-priority-noncompact
19693 Reduce target register priority for r0..r3 / r12..r15.
19696 @opindex mmillicode
19697 When optimizing for size (using @option{-Os}), prologues and epilogues
19698 that have to save or restore a large number of registers are often
19699 shortened by using call to a special function in libgcc; this is
19700 referred to as a @emph{millicode} call. As these calls can pose
19701 performance issues, and/or cause linking issues when linking in a
19702 nonstandard way, this option is provided to turn on or off millicode
19705 @item -mcode-density-frame
19706 @opindex mcode-density-frame
19707 This option enable the compiler to emit @code{enter} and @code{leave}
19708 instructions. These instructions are only valid for CPUs with
19709 code-density feature.
19712 @opindex mmixed-code
19713 Does nothing. Preserved for backward compatibility.
19717 Ths option is deprecated. Enable @samp{q} instruction alternatives.
19718 This is the default for @option{-Os}.
19722 Enable @samp{Rcq} constraint handling.
19723 Most short code generation depends on this.
19724 This is the default.
19728 Enable @samp{Rcw} constraint handling.
19729 Most ccfsm condexec mostly depends on this.
19730 This is the default.
19732 @item -msize-level=@var{level}
19733 @opindex msize-level
19734 Fine-tune size optimization with regards to instruction lengths and alignment.
19735 The recognized values for @var{level} are:
19738 No size optimization. This level is deprecated and treated like @samp{1}.
19741 Short instructions are used opportunistically.
19744 In addition, alignment of loops and of code after barriers are dropped.
19747 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
19751 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
19752 the behavior when this is not set is equivalent to level @samp{1}.
19754 @item -mtune=@var{cpu}
19756 Set instruction scheduling parameters for @var{cpu}, overriding any implied
19757 by @option{-mcpu=}.
19759 Supported values for @var{cpu} are
19763 Tune for ARC600 CPU.
19766 Tune for ARC601 CPU.
19769 Tune for ARC700 CPU with standard multiplier block.
19772 Tune for ARC700 CPU with XMAC block.
19775 Tune for ARC725D CPU.
19778 Tune for ARC750D CPU.
19782 @item -mmultcost=@var{num}
19784 Cost to assume for a multiply instruction, with @samp{4} being equal to a
19785 normal instruction.
19787 @item -munalign-prob-threshold=@var{probability}
19788 @opindex munalign-prob-threshold
19789 Does nothing. Preserved for backward compatibility.
19793 The following options are maintained for backward compatibility, but
19794 are now deprecated and will be removed in a future release:
19796 @c Deprecated options
19804 @opindex mbig-endian
19807 Compile code for big-endian targets. Use of these options is now
19808 deprecated. Big-endian code is supported by configuring GCC to build
19809 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
19810 for which big endian is the default.
19812 @item -mlittle-endian
19813 @opindex mlittle-endian
19816 Compile code for little-endian targets. Use of these options is now
19817 deprecated. Little-endian code is supported by configuring GCC to build
19818 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
19819 for which little endian is the default.
19821 @item -mbarrel_shifter
19822 @opindex mbarrel_shifter
19823 Replaced by @option{-mbarrel-shifter}.
19825 @item -mdpfp_compact
19826 @opindex mdpfp_compact
19827 Replaced by @option{-mdpfp-compact}.
19830 @opindex mdpfp_fast
19831 Replaced by @option{-mdpfp-fast}.
19834 @opindex mdsp_packa
19835 Replaced by @option{-mdsp-packa}.
19839 Replaced by @option{-mea}.
19843 Replaced by @option{-mmac-24}.
19847 Replaced by @option{-mmac-d16}.
19849 @item -mspfp_compact
19850 @opindex mspfp_compact
19851 Replaced by @option{-mspfp-compact}.
19854 @opindex mspfp_fast
19855 Replaced by @option{-mspfp-fast}.
19857 @item -mtune=@var{cpu}
19859 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
19860 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
19861 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
19863 @item -multcost=@var{num}
19865 Replaced by @option{-mmultcost}.
19870 @subsection ARM Options
19871 @cindex ARM options
19873 These @samp{-m} options are defined for the ARM port:
19876 @item -mabi=@var{name}
19878 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
19879 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
19882 @opindex mapcs-frame
19883 Generate a stack frame that is compliant with the ARM Procedure Call
19884 Standard for all functions, even if this is not strictly necessary for
19885 correct execution of the code. Specifying @option{-fomit-frame-pointer}
19886 with this option causes the stack frames not to be generated for
19887 leaf functions. The default is @option{-mno-apcs-frame}.
19888 This option is deprecated.
19892 This is a synonym for @option{-mapcs-frame} and is deprecated.
19895 @c not currently implemented
19896 @item -mapcs-stack-check
19897 @opindex mapcs-stack-check
19898 Generate code to check the amount of stack space available upon entry to
19899 every function (that actually uses some stack space). If there is
19900 insufficient space available then either the function
19901 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
19902 called, depending upon the amount of stack space required. The runtime
19903 system is required to provide these functions. The default is
19904 @option{-mno-apcs-stack-check}, since this produces smaller code.
19906 @c not currently implemented
19907 @item -mapcs-reentrant
19908 @opindex mapcs-reentrant
19909 Generate reentrant, position-independent code. The default is
19910 @option{-mno-apcs-reentrant}.
19913 @item -mthumb-interwork
19914 @opindex mthumb-interwork
19915 Generate code that supports calling between the ARM and Thumb
19916 instruction sets. Without this option, on pre-v5 architectures, the
19917 two instruction sets cannot be reliably used inside one program. The
19918 default is @option{-mno-thumb-interwork}, since slightly larger code
19919 is generated when @option{-mthumb-interwork} is specified. In AAPCS
19920 configurations this option is meaningless.
19922 @item -mno-sched-prolog
19923 @opindex mno-sched-prolog
19924 @opindex msched-prolog
19925 Prevent the reordering of instructions in the function prologue, or the
19926 merging of those instruction with the instructions in the function's
19927 body. This means that all functions start with a recognizable set
19928 of instructions (or in fact one of a choice from a small set of
19929 different function prologues), and this information can be used to
19930 locate the start of functions inside an executable piece of code. The
19931 default is @option{-msched-prolog}.
19933 @item -mfloat-abi=@var{name}
19934 @opindex mfloat-abi
19935 Specifies which floating-point ABI to use. Permissible values
19936 are: @samp{soft}, @samp{softfp} and @samp{hard}.
19938 Specifying @samp{soft} causes GCC to generate output containing
19939 library calls for floating-point operations.
19940 @samp{softfp} allows the generation of code using hardware floating-point
19941 instructions, but still uses the soft-float calling conventions.
19942 @samp{hard} allows generation of floating-point instructions
19943 and uses FPU-specific calling conventions.
19945 The default depends on the specific target configuration. Note that
19946 the hard-float and soft-float ABIs are not link-compatible; you must
19947 compile your entire program with the same ABI, and link with a
19948 compatible set of libraries.
19950 @item -mgeneral-regs-only
19951 @opindex mgeneral-regs-only
19952 Generate code which uses only the general-purpose registers. This will prevent
19953 the compiler from using floating-point and Advanced SIMD registers but will not
19954 impose any restrictions on the assembler.
19956 @item -mlittle-endian
19957 @opindex mlittle-endian
19958 Generate code for a processor running in little-endian mode. This is
19959 the default for all standard configurations.
19962 @opindex mbig-endian
19963 Generate code for a processor running in big-endian mode; the default is
19964 to compile code for a little-endian processor.
19969 When linking a big-endian image select between BE8 and BE32 formats.
19970 The option has no effect for little-endian images and is ignored. The
19971 default is dependent on the selected target architecture. For ARMv6
19972 and later architectures the default is BE8, for older architectures
19973 the default is BE32. BE32 format has been deprecated by ARM.
19975 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
19977 This specifies the name of the target ARM architecture. GCC uses this
19978 name to determine what kind of instructions it can emit when generating
19979 assembly code. This option can be used in conjunction with or instead
19980 of the @option{-mcpu=} option.
19982 Permissible names are:
19984 @samp{armv5t}, @samp{armv5te},
19985 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
19986 @samp{armv6z}, @samp{armv6zk},
19987 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
19988 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
19994 @samp{armv6-m}, @samp{armv6s-m},
19995 @samp{armv7-m}, @samp{armv7e-m},
19996 @samp{armv8-m.base}, @samp{armv8-m.main},
19997 @samp{armv8.1-m.main},
19998 @samp{iwmmxt} and @samp{iwmmxt2}.
20000 Additionally, the following architectures, which lack support for the
20001 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
20003 Many of the architectures support extensions. These can be added by
20004 appending @samp{+@var{extension}} to the architecture name. Extension
20005 options are processed in order and capabilities accumulate. An extension
20006 will also enable any necessary base extensions
20007 upon which it depends. For example, the @samp{+crypto} extension
20008 will always enable the @samp{+simd} extension. The exception to the
20009 additive construction is for extensions that are prefixed with
20010 @samp{+no@dots{}}: these extensions disable the specified option and
20011 any other extensions that may depend on the presence of that
20014 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
20015 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
20016 entirely disabled by the @samp{+nofp} option that follows it.
20018 Most extension names are generically named, but have an effect that is
20019 dependent upon the architecture to which it is applied. For example,
20020 the @samp{+simd} option can be applied to both @samp{armv7-a} and
20021 @samp{armv8-a} architectures, but will enable the original ARMv7-A
20022 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
20023 variant for @samp{armv8-a}.
20025 The table below lists the supported extensions for each architecture.
20026 Architectures not mentioned do not support any extensions.
20039 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
20040 used as an alias for this extension.
20043 Disable the floating-point instructions.
20047 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
20050 The VFPv3 floating-point instructions, with 16 double-precision
20051 registers. The extension @samp{+vfpv3-d16} can be used as an alias
20052 for this extension. Note that floating-point is not supported by the
20053 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
20054 ARMv7-R architectures.
20057 Disable the floating-point instructions.
20063 The multiprocessing extension.
20066 The security extension.
20069 The VFPv3 floating-point instructions, with 16 double-precision
20070 registers. The extension @samp{+vfpv3-d16} can be used as an alias
20071 for this extension.
20074 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
20075 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
20076 for this extension.
20079 The VFPv3 floating-point instructions, with 32 double-precision
20082 @item +vfpv3-d16-fp16
20083 The VFPv3 floating-point instructions, with 16 double-precision
20084 registers and the half-precision floating-point conversion operations.
20087 The VFPv3 floating-point instructions, with 32 double-precision
20088 registers and the half-precision floating-point conversion operations.
20091 The VFPv4 floating-point instructions, with 16 double-precision
20095 The VFPv4 floating-point instructions, with 32 double-precision
20099 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
20100 the half-precision floating-point conversion operations.
20103 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
20106 Disable the Advanced SIMD instructions (does not disable floating point).
20109 Disable the floating-point and Advanced SIMD instructions.
20113 The extended version of the ARMv7-A architecture with support for
20117 The VFPv4 floating-point instructions, with 16 double-precision registers.
20118 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
20121 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
20122 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
20125 The VFPv3 floating-point instructions, with 16 double-precision
20129 The VFPv3 floating-point instructions, with 32 double-precision
20132 @item +vfpv3-d16-fp16
20133 The VFPv3 floating-point instructions, with 16 double-precision
20134 registers and the half-precision floating-point conversion operations.
20137 The VFPv3 floating-point instructions, with 32 double-precision
20138 registers and the half-precision floating-point conversion operations.
20141 The VFPv4 floating-point instructions, with 16 double-precision
20145 The VFPv4 floating-point instructions, with 32 double-precision
20149 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
20150 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
20153 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
20154 the half-precision floating-point conversion operations.
20157 Disable the Advanced SIMD instructions (does not disable floating point).
20160 Disable the floating-point and Advanced SIMD instructions.
20166 The Cyclic Redundancy Check (CRC) instructions.
20168 The ARMv8-A Advanced SIMD and floating-point instructions.
20170 The cryptographic instructions.
20172 Disable the cryptographic instructions.
20174 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20176 Speculation Barrier Instruction.
20178 Execution and Data Prediction Restriction Instructions.
20184 The ARMv8.1-A Advanced SIMD and floating-point instructions.
20187 The cryptographic instructions. This also enables the Advanced SIMD and
20188 floating-point instructions.
20191 Disable the cryptographic instructions.
20194 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20197 Speculation Barrier Instruction.
20200 Execution and Data Prediction Restriction Instructions.
20207 The half-precision floating-point data processing instructions.
20208 This also enables the Advanced SIMD and floating-point instructions.
20211 The half-precision floating-point fmla extension. This also enables
20212 the half-precision floating-point extension and Advanced SIMD and
20213 floating-point instructions.
20216 The ARMv8.1-A Advanced SIMD and floating-point instructions.
20219 The cryptographic instructions. This also enables the Advanced SIMD and
20220 floating-point instructions.
20223 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
20226 Disable the cryptographic extension.
20229 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20232 Speculation Barrier Instruction.
20235 Execution and Data Prediction Restriction Instructions.
20238 8-bit Integer Matrix Multiply instructions.
20239 This also enables Advanced SIMD and floating-point instructions.
20242 Brain half-precision floating-point instructions.
20243 This also enables Advanced SIMD and floating-point instructions.
20249 The half-precision floating-point data processing instructions.
20250 This also enables the Advanced SIMD and floating-point instructions as well
20251 as the Dot Product extension and the half-precision floating-point fmla
20255 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20256 Dot Product extension.
20259 The cryptographic instructions. This also enables the Advanced SIMD and
20260 floating-point instructions as well as the Dot Product extension.
20263 Disable the cryptographic extension.
20266 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20269 Speculation Barrier Instruction.
20272 Execution and Data Prediction Restriction Instructions.
20275 8-bit Integer Matrix Multiply instructions.
20276 This also enables Advanced SIMD and floating-point instructions.
20279 Brain half-precision floating-point instructions.
20280 This also enables Advanced SIMD and floating-point instructions.
20286 The half-precision floating-point data processing instructions.
20287 This also enables the Advanced SIMD and floating-point instructions as well
20288 as the Dot Product extension and the half-precision floating-point fmla
20292 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20293 Dot Product extension.
20296 The cryptographic instructions. This also enables the Advanced SIMD and
20297 floating-point instructions as well as the Dot Product extension.
20300 Disable the cryptographic extension.
20303 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20306 8-bit Integer Matrix Multiply instructions.
20307 This also enables Advanced SIMD and floating-point instructions.
20310 Brain half-precision floating-point instructions.
20311 This also enables Advanced SIMD and floating-point instructions.
20317 The half-precision floating-point data processing instructions.
20318 This also enables the Advanced SIMD and floating-point instructions as well
20319 as the Dot Product extension and the half-precision floating-point fmla
20323 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20324 Dot Product extension.
20327 The cryptographic instructions. This also enables the Advanced SIMD and
20328 floating-point instructions as well as the Dot Product extension.
20331 Disable the cryptographic extension.
20334 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20337 8-bit Integer Matrix Multiply instructions.
20338 This also enables Advanced SIMD and floating-point instructions.
20341 Brain half-precision floating-point instructions.
20342 This also enables Advanced SIMD and floating-point instructions.
20348 The single-precision VFPv3 floating-point instructions. The extension
20349 @samp{+vfpv3xd} can be used as an alias for this extension.
20352 The VFPv3 floating-point instructions with 16 double-precision registers.
20353 The extension +vfpv3-d16 can be used as an alias for this extension.
20355 @item +vfpv3xd-d16-fp16
20356 The single-precision VFPv3 floating-point instructions with 16 double-precision
20357 registers and the half-precision floating-point conversion operations.
20359 @item +vfpv3-d16-fp16
20360 The VFPv3 floating-point instructions with 16 double-precision
20361 registers and the half-precision floating-point conversion operations.
20364 Disable the floating-point extension.
20367 The ARM-state integer division instructions.
20370 Disable the ARM-state integer division extension.
20376 The single-precision VFPv4 floating-point instructions.
20379 The single-precision FPv5 floating-point instructions.
20382 The single- and double-precision FPv5 floating-point instructions.
20385 Disable the floating-point extensions.
20388 @item armv8.1-m.main
20392 The DSP instructions.
20395 The M-Profile Vector Extension (MVE) integer instructions.
20398 The M-Profile Vector Extension (MVE) integer and single precision
20399 floating-point instructions.
20402 The single-precision floating-point instructions.
20405 The single- and double-precision floating-point instructions.
20408 Disable the floating-point extension.
20410 @item +cdecp0, +cdecp1, ... , +cdecp7
20411 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20412 to the numbers given in the options in the range 0 to 7.
20418 The DSP instructions.
20421 Disable the DSP extension.
20424 The single-precision floating-point instructions.
20427 The single- and double-precision floating-point instructions.
20430 Disable the floating-point extension.
20432 @item +cdecp0, +cdecp1, ... , +cdecp7
20433 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20434 to the numbers given in the options in the range 0 to 7.
20440 The Cyclic Redundancy Check (CRC) instructions.
20442 The single-precision FPv5 floating-point instructions.
20444 The ARMv8-A Advanced SIMD and floating-point instructions.
20446 The cryptographic instructions.
20448 Disable the cryptographic instructions.
20450 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20455 @option{-march=native} causes the compiler to auto-detect the architecture
20456 of the build computer. At present, this feature is only supported on
20457 GNU/Linux, and not all architectures are recognized. If the auto-detect
20458 is unsuccessful the option has no effect.
20460 @item -mtune=@var{name}
20462 This option specifies the name of the target ARM processor for
20463 which GCC should tune the performance of the code.
20464 For some ARM implementations better performance can be obtained by using
20466 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
20467 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
20468 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
20469 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
20470 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
20471 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
20472 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
20473 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
20474 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
20475 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
20476 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
20477 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20478 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20479 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20480 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20481 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
20482 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
20483 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
20484 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
20485 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1},
20486 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
20487 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
20488 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
20489 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
20490 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
20492 Additionally, this option can specify that GCC should tune the performance
20493 of the code for a big.LITTLE system. Permissible names are:
20494 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
20495 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20496 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
20497 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
20499 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
20500 performance for a blend of processors within architecture @var{arch}.
20501 The aim is to generate code that run well on the current most popular
20502 processors, balancing between optimizations that benefit some CPUs in the
20503 range, and avoiding performance pitfalls of other CPUs. The effects of
20504 this option may change in future GCC versions as CPU models come and go.
20506 @option{-mtune} permits the same extension options as @option{-mcpu}, but
20507 the extension options do not affect the tuning of the generated code.
20509 @option{-mtune=native} causes the compiler to auto-detect the CPU
20510 of the build computer. At present, this feature is only supported on
20511 GNU/Linux, and not all architectures are recognized. If the auto-detect is
20512 unsuccessful the option has no effect.
20514 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
20516 This specifies the name of the target ARM processor. GCC uses this name
20517 to derive the name of the target ARM architecture (as if specified
20518 by @option{-march}) and the ARM processor type for which to tune for
20519 performance (as if specified by @option{-mtune}). Where this option
20520 is used in conjunction with @option{-march} or @option{-mtune},
20521 those options take precedence over the appropriate part of this option.
20523 Many of the supported CPUs implement optional architectural
20524 extensions. Where this is so the architectural extensions are
20525 normally enabled by default. If implementations that lack the
20526 extension exist, then the extension syntax can be used to disable
20527 those extensions that have been omitted. For floating-point and
20528 Advanced SIMD (Neon) instructions, the settings of the options
20529 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
20530 floating-point and Advanced SIMD instructions will only be used if
20531 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
20532 @option{-mfpu} other than @samp{auto} will override the available
20533 floating-point and SIMD extension instructions.
20535 For example, @samp{cortex-a9} can be found in three major
20536 configurations: integer only, with just a floating-point unit or with
20537 floating-point and Advanced SIMD. The default is to enable all the
20538 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
20539 be used to disable just the SIMD or both the SIMD and floating-point
20540 instructions respectively.
20542 Permissible names for this option are the same as those for
20545 The following extension options are common to the listed CPUs:
20549 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
20552 Disables the floating-point instructions on @samp{arm9e},
20553 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
20554 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
20555 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
20556 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
20557 Disables the floating-point and SIMD instructions on
20558 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
20559 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
20560 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
20561 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
20562 @samp{cortex-a53} and @samp{cortex-a55}.
20565 Disables the double-precision component of the floating-point instructions
20566 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
20567 @samp{cortex-r52plus} and @samp{cortex-m7}.
20570 Disables the SIMD (but not floating-point) instructions on
20571 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
20572 and @samp{cortex-a9}.
20575 Enables the cryptographic instructions on @samp{cortex-a32},
20576 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
20577 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
20578 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20579 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
20580 @samp{cortex-a75.cortex-a55}.
20583 Additionally the @samp{generic-armv7-a} pseudo target defaults to
20584 VFPv3 with 16 double-precision registers. It supports the following
20585 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
20586 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
20587 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
20588 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
20589 the extensions to @option{-march=armv7-a}.
20591 @option{-mcpu=generic-@var{arch}} is also permissible, and is
20592 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
20593 See @option{-mtune} for more information.
20595 @option{-mcpu=native} causes the compiler to auto-detect the CPU
20596 of the build computer. At present, this feature is only supported on
20597 GNU/Linux, and not all architectures are recognized. If the auto-detect
20598 is unsuccessful the option has no effect.
20600 @item -mfpu=@var{name}
20602 This specifies what floating-point hardware (or hardware emulation) is
20603 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
20605 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
20606 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
20607 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
20608 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
20609 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
20610 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
20611 is an alias for @samp{vfpv2}.
20613 The setting @samp{auto} is the default and is special. It causes the
20614 compiler to select the floating-point and Advanced SIMD instructions
20615 based on the settings of @option{-mcpu} and @option{-march}.
20617 If the selected floating-point hardware includes the NEON extension
20618 (e.g.@: @option{-mfpu=neon}), note that floating-point
20619 operations are not generated by GCC's auto-vectorization pass unless
20620 @option{-funsafe-math-optimizations} is also specified. This is
20621 because NEON hardware does not fully implement the IEEE 754 standard for
20622 floating-point arithmetic (in particular denormal values are treated as
20623 zero), so the use of NEON instructions may lead to a loss of precision.
20625 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}).
20627 @item -mfp16-format=@var{name}
20628 @opindex mfp16-format
20629 Specify the format of the @code{__fp16} half-precision floating-point type.
20630 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
20631 the default is @samp{none}, in which case the @code{__fp16} type is not
20632 defined. @xref{Half-Precision}, for more information.
20634 @item -mstructure-size-boundary=@var{n}
20635 @opindex mstructure-size-boundary
20636 The sizes of all structures and unions are rounded up to a multiple
20637 of the number of bits set by this option. Permissible values are 8, 32
20638 and 64. The default value varies for different toolchains. For the COFF
20639 targeted toolchain the default value is 8. A value of 64 is only allowed
20640 if the underlying ABI supports it.
20642 Specifying a larger number can produce faster, more efficient code, but
20643 can also increase the size of the program. Different values are potentially
20644 incompatible. Code compiled with one value cannot necessarily expect to
20645 work with code or libraries compiled with another value, if they exchange
20646 information using structures or unions.
20648 This option is deprecated.
20650 @item -mabort-on-noreturn
20651 @opindex mabort-on-noreturn
20652 Generate a call to the function @code{abort} at the end of a
20653 @code{noreturn} function. It is executed if the function tries to
20657 @itemx -mno-long-calls
20658 @opindex mlong-calls
20659 @opindex mno-long-calls
20660 Tells the compiler to perform function calls by first loading the
20661 address of the function into a register and then performing a subroutine
20662 call on this register. This switch is needed if the target function
20663 lies outside of the 64-megabyte addressing range of the offset-based
20664 version of subroutine call instruction.
20666 Even if this switch is enabled, not all function calls are turned
20667 into long calls. The heuristic is that static functions, functions
20668 that have the @code{short_call} attribute, functions that are inside
20669 the scope of a @code{#pragma no_long_calls} directive, and functions whose
20670 definitions have already been compiled within the current compilation
20671 unit are not turned into long calls. The exceptions to this rule are
20672 that weak function definitions, functions with the @code{long_call}
20673 attribute or the @code{section} attribute, and functions that are within
20674 the scope of a @code{#pragma long_calls} directive are always
20675 turned into long calls.
20677 This feature is not enabled by default. Specifying
20678 @option{-mno-long-calls} restores the default behavior, as does
20679 placing the function calls within the scope of a @code{#pragma
20680 long_calls_off} directive. Note these switches have no effect on how
20681 the compiler generates code to handle function calls via function
20684 @item -msingle-pic-base
20685 @opindex msingle-pic-base
20686 Treat the register used for PIC addressing as read-only, rather than
20687 loading it in the prologue for each function. The runtime system is
20688 responsible for initializing this register with an appropriate value
20689 before execution begins.
20691 @item -mpic-register=@var{reg}
20692 @opindex mpic-register
20693 Specify the register to be used for PIC addressing.
20694 For standard PIC base case, the default is any suitable register
20695 determined by compiler. For single PIC base case, the default is
20696 @samp{R9} if target is EABI based or stack-checking is enabled,
20697 otherwise the default is @samp{R10}.
20699 @item -mpic-data-is-text-relative
20700 @opindex mpic-data-is-text-relative
20701 Assume that the displacement between the text and data segments is fixed
20702 at static link time. This permits using PC-relative addressing
20703 operations to access data known to be in the data segment. For
20704 non-VxWorks RTP targets, this option is enabled by default. When
20705 disabled on such targets, it will enable @option{-msingle-pic-base} by
20708 @item -mpoke-function-name
20709 @opindex mpoke-function-name
20710 Write the name of each function into the text section, directly
20711 preceding the function prologue. The generated code is similar to this:
20715 .ascii "arm_poke_function_name", 0
20718 .word 0xff000000 + (t1 - t0)
20719 arm_poke_function_name
20721 stmfd sp!, @{fp, ip, lr, pc@}
20725 When performing a stack backtrace, code can inspect the value of
20726 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
20727 location @code{pc - 12} and the top 8 bits are set, then we know that
20728 there is a function name embedded immediately preceding this location
20729 and has length @code{((pc[-3]) & 0xff000000)}.
20736 Select between generating code that executes in ARM and Thumb
20737 states. The default for most configurations is to generate code
20738 that executes in ARM state, but the default can be changed by
20739 configuring GCC with the @option{--with-mode=}@var{state}
20742 You can also override the ARM and Thumb mode for each function
20743 by using the @code{target("thumb")} and @code{target("arm")} function attributes
20744 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
20747 @opindex mflip-thumb
20748 Switch ARM/Thumb modes on alternating functions.
20749 This option is provided for regression testing of mixed Thumb/ARM code
20750 generation, and is not intended for ordinary use in compiling code.
20753 @opindex mtpcs-frame
20754 Generate a stack frame that is compliant with the Thumb Procedure Call
20755 Standard for all non-leaf functions. (A leaf function is one that does
20756 not call any other functions.) The default is @option{-mno-tpcs-frame}.
20758 @item -mtpcs-leaf-frame
20759 @opindex mtpcs-leaf-frame
20760 Generate a stack frame that is compliant with the Thumb Procedure Call
20761 Standard for all leaf functions. (A leaf function is one that does
20762 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
20764 @item -mcallee-super-interworking
20765 @opindex mcallee-super-interworking
20766 Gives all externally visible functions in the file being compiled an ARM
20767 instruction set header which switches to Thumb mode before executing the
20768 rest of the function. This allows these functions to be called from
20769 non-interworking code. This option is not valid in AAPCS configurations
20770 because interworking is enabled by default.
20772 @item -mcaller-super-interworking
20773 @opindex mcaller-super-interworking
20774 Allows calls via function pointers (including virtual functions) to
20775 execute correctly regardless of whether the target code has been
20776 compiled for interworking or not. There is a small overhead in the cost
20777 of executing a function pointer if this option is enabled. This option
20778 is not valid in AAPCS configurations because interworking is enabled
20781 @item -mtp=@var{name}
20783 Specify the access model for the thread local storage pointer. The valid
20784 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
20785 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
20786 (supported in the arm6k architecture), and @samp{auto}, which uses the
20787 best available method for the selected processor. The default setting is
20790 @item -mtls-dialect=@var{dialect}
20791 @opindex mtls-dialect
20792 Specify the dialect to use for accessing thread local storage. Two
20793 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
20794 @samp{gnu} dialect selects the original GNU scheme for supporting
20795 local and global dynamic TLS models. The @samp{gnu2} dialect
20796 selects the GNU descriptor scheme, which provides better performance
20797 for shared libraries. The GNU descriptor scheme is compatible with
20798 the original scheme, but does require new assembler, linker and
20799 library support. Initial and local exec TLS models are unaffected by
20800 this option and always use the original scheme.
20802 @item -mword-relocations
20803 @opindex mword-relocations
20804 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
20805 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
20806 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
20807 is specified. This option conflicts with @option{-mslow-flash-data}.
20809 @item -mfix-cortex-m3-ldrd
20810 @opindex mfix-cortex-m3-ldrd
20811 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
20812 with overlapping destination and base registers are used. This option avoids
20813 generating these instructions. This option is enabled by default when
20814 @option{-mcpu=cortex-m3} is specified.
20816 @item -munaligned-access
20817 @itemx -mno-unaligned-access
20818 @opindex munaligned-access
20819 @opindex mno-unaligned-access
20820 Enables (or disables) reading and writing of 16- and 32- bit values
20821 from addresses that are not 16- or 32- bit aligned. By default
20822 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
20823 ARMv8-M Baseline architectures, and enabled for all other
20824 architectures. If unaligned access is not enabled then words in packed
20825 data structures are accessed a byte at a time.
20827 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
20828 generated object file to either true or false, depending upon the
20829 setting of this option. If unaligned access is enabled then the
20830 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
20833 @item -mneon-for-64bits
20834 @opindex mneon-for-64bits
20835 This option is deprecated and has no effect.
20837 @item -mslow-flash-data
20838 @opindex mslow-flash-data
20839 Assume loading data from flash is slower than fetching instruction.
20840 Therefore literal load is minimized for better performance.
20841 This option is only supported when compiling for ARMv7 M-profile and
20842 off by default. It conflicts with @option{-mword-relocations}.
20844 @item -masm-syntax-unified
20845 @opindex masm-syntax-unified
20846 Assume inline assembler is using unified asm syntax. The default is
20847 currently off which implies divided syntax. This option has no impact
20848 on Thumb2. However, this may change in future releases of GCC.
20849 Divided syntax should be considered deprecated.
20851 @item -mrestrict-it
20852 @opindex mrestrict-it
20853 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
20854 IT blocks can only contain a single 16-bit instruction from a select
20855 set of instructions. This option is on by default for ARMv8-A Thumb mode.
20857 @item -mprint-tune-info
20858 @opindex mprint-tune-info
20859 Print CPU tuning information as comment in assembler file. This is
20860 an option used only for regression testing of the compiler and not
20861 intended for ordinary use in compiling code. This option is disabled
20864 @item -mverbose-cost-dump
20865 @opindex mverbose-cost-dump
20866 Enable verbose cost model dumping in the debug dump files. This option is
20867 provided for use in debugging the compiler.
20870 @opindex mpure-code
20871 Do not allow constant data to be placed in code sections.
20872 Additionally, when compiling for ELF object format give all text sections the
20873 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
20874 is only available when generating non-pic code for M-profile targets.
20878 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
20879 Development Tools Engineering Specification", which can be found on
20880 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
20882 @item -mfix-cmse-cve-2021-35465
20883 @opindex mfix-cmse-cve-2021-35465
20884 Mitigate against a potential security issue with the @code{VLLDM} instruction
20885 in some M-profile devices when using CMSE (CVE-2021-365465). This option is
20886 enabled by default when the option @option{-mcpu=} is used with
20887 @code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option
20888 @option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
20894 Select the FDPIC ABI, which uses 64-bit function descriptors to
20895 represent pointers to functions. When the compiler is configured for
20896 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
20897 and implies @option{-fPIE} if none of the PIC/PIE-related options is
20898 provided. On other targets, it only enables the FDPIC-specific code
20899 generation features, and the user should explicitly provide the
20900 PIC/PIE-related options as needed.
20902 Note that static linking is not supported because it would still
20903 involve the dynamic linker when the program self-relocates. If such
20904 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
20906 The opposite @option{-mno-fdpic} option is useful (and required) to
20907 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
20908 toolchain as the one used to build the userland programs.
20913 @subsection AVR Options
20914 @cindex AVR Options
20916 These options are defined for AVR implementations:
20919 @item -mmcu=@var{mcu}
20921 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
20923 The default for this option is@tie{}@samp{avr2}.
20925 GCC supports the following AVR devices and ISAs:
20927 @include avr-mmcu.texi
20932 Assume that all data in static storage can be accessed by LDS / STS
20933 instructions. This option has only an effect on reduced Tiny devices like
20934 ATtiny40. See also the @code{absdata}
20935 @ref{AVR Variable Attributes,variable attribute}.
20937 @item -maccumulate-args
20938 @opindex maccumulate-args
20939 Accumulate outgoing function arguments and acquire/release the needed
20940 stack space for outgoing function arguments once in function
20941 prologue/epilogue. Without this option, outgoing arguments are pushed
20942 before calling a function and popped afterwards.
20944 Popping the arguments after the function call can be expensive on
20945 AVR so that accumulating the stack space might lead to smaller
20946 executables because arguments need not be removed from the
20947 stack after such a function call.
20949 This option can lead to reduced code size for functions that perform
20950 several calls to functions that get their arguments on the stack like
20951 calls to printf-like functions.
20953 @item -mbranch-cost=@var{cost}
20954 @opindex mbranch-cost
20955 Set the branch costs for conditional branch instructions to
20956 @var{cost}. Reasonable values for @var{cost} are small, non-negative
20957 integers. The default branch cost is 0.
20959 @item -mcall-prologues
20960 @opindex mcall-prologues
20961 Functions prologues/epilogues are expanded as calls to appropriate
20962 subroutines. Code size is smaller.
20964 @item -mdouble=@var{bits}
20965 @itemx -mlong-double=@var{bits}
20967 @opindex mlong-double
20968 Set the size (in bits) of the @code{double} or @code{long double} type,
20969 respectively. Possible values for @var{bits} are 32 and 64.
20970 Whether or not a specific value for @var{bits} is allowed depends on
20971 the @code{--with-double=} and @code{--with-long-double=}
20972 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
20973 and the same applies for the default values of the options.
20975 @item -mgas-isr-prologues
20976 @opindex mgas-isr-prologues
20977 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
20978 instruction supported by GNU Binutils.
20979 If this option is on, the feature can still be disabled for individual
20980 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
20981 function attribute. This feature is activated per default
20982 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
20983 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
20987 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
20988 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
20989 and @code{long long} is 4 bytes. Please note that this option does not
20990 conform to the C standards, but it results in smaller code
20993 @item -mmain-is-OS_task
20994 @opindex mmain-is-OS_task
20995 Do not save registers in @code{main}. The effect is the same like
20996 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
20997 to @code{main}. It is activated per default if optimization is on.
20999 @item -mn-flash=@var{num}
21001 Assume that the flash memory has a size of
21002 @var{num} times 64@tie{}KiB.
21004 @item -mno-interrupts
21005 @opindex mno-interrupts
21006 Generated code is not compatible with hardware interrupts.
21007 Code size is smaller.
21011 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
21012 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
21013 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
21014 the assembler's command line and the @option{--relax} option to the
21015 linker's command line.
21017 Jump relaxing is performed by the linker because jump offsets are not
21018 known before code is located. Therefore, the assembler code generated by the
21019 compiler is the same, but the instructions in the executable may
21020 differ from instructions in the assembler code.
21022 Relaxing must be turned on if linker stubs are needed, see the
21023 section on @code{EIND} and linker stubs below.
21027 Assume that the device supports the Read-Modify-Write
21028 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
21030 @item -mshort-calls
21031 @opindex mshort-calls
21033 Assume that @code{RJMP} and @code{RCALL} can target the whole
21036 This option is used internally for multilib selection. It is
21037 not an optimization option, and you don't need to set it by hand.
21041 Treat the stack pointer register as an 8-bit register,
21042 i.e.@: assume the high byte of the stack pointer is zero.
21043 In general, you don't need to set this option by hand.
21045 This option is used internally by the compiler to select and
21046 build multilibs for architectures @code{avr2} and @code{avr25}.
21047 These architectures mix devices with and without @code{SPH}.
21048 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
21049 the compiler driver adds or removes this option from the compiler
21050 proper's command line, because the compiler then knows if the device
21051 or architecture has an 8-bit stack pointer and thus no @code{SPH}
21056 Use address register @code{X} in a way proposed by the hardware. This means
21057 that @code{X} is only used in indirect, post-increment or
21058 pre-decrement addressing.
21060 Without this option, the @code{X} register may be used in the same way
21061 as @code{Y} or @code{Z} which then is emulated by additional
21063 For example, loading a value with @code{X+const} addressing with a
21064 small non-negative @code{const < 64} to a register @var{Rn} is
21068 adiw r26, const ; X += const
21069 ld @var{Rn}, X ; @var{Rn} = *X
21070 sbiw r26, const ; X -= const
21074 @opindex mtiny-stack
21075 Only change the lower 8@tie{}bits of the stack pointer.
21077 @item -mfract-convert-truncate
21078 @opindex mfract-convert-truncate
21079 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
21082 @opindex nodevicelib
21083 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
21085 @item -nodevicespecs
21086 @opindex nodevicespecs
21087 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
21088 command line. The user takes responsibility for supplying the sub-processes
21089 like compiler proper, assembler and linker with appropriate command line
21090 options. This means that the user has to supply her private device specs
21091 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
21092 more need for option @option{-mmcu=@var{mcu}}.
21094 This option can also serve as a replacement for the older way of
21095 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
21096 which contains a folder named @code{device-specs} which contains a specs file named
21097 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
21099 @item -Waddr-space-convert
21100 @opindex Waddr-space-convert
21101 @opindex Wno-addr-space-convert
21102 Warn about conversions between address spaces in the case where the
21103 resulting address space is not contained in the incoming address space.
21105 @item -Wmisspelled-isr
21106 @opindex Wmisspelled-isr
21107 @opindex Wno-misspelled-isr
21108 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
21109 Enabled by default.
21112 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
21113 @cindex @code{EIND}
21114 Pointers in the implementation are 16@tie{}bits wide.
21115 The address of a function or label is represented as word address so
21116 that indirect jumps and calls can target any code address in the
21117 range of 64@tie{}Ki words.
21119 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
21120 bytes of program memory space, there is a special function register called
21121 @code{EIND} that serves as most significant part of the target address
21122 when @code{EICALL} or @code{EIJMP} instructions are used.
21124 Indirect jumps and calls on these devices are handled as follows by
21125 the compiler and are subject to some limitations:
21130 The compiler never sets @code{EIND}.
21133 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
21134 instructions or might read @code{EIND} directly in order to emulate an
21135 indirect call/jump by means of a @code{RET} instruction.
21138 The compiler assumes that @code{EIND} never changes during the startup
21139 code or during the application. In particular, @code{EIND} is not
21140 saved/restored in function or interrupt service routine
21144 For indirect calls to functions and computed goto, the linker
21145 generates @emph{stubs}. Stubs are jump pads sometimes also called
21146 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
21147 The stub contains a direct jump to the desired address.
21150 Linker relaxation must be turned on so that the linker generates
21151 the stubs correctly in all situations. See the compiler option
21152 @option{-mrelax} and the linker option @option{--relax}.
21153 There are corner cases where the linker is supposed to generate stubs
21154 but aborts without relaxation and without a helpful error message.
21157 The default linker script is arranged for code with @code{EIND = 0}.
21158 If code is supposed to work for a setup with @code{EIND != 0}, a custom
21159 linker script has to be used in order to place the sections whose
21160 name start with @code{.trampolines} into the segment where @code{EIND}
21164 The startup code from libgcc never sets @code{EIND}.
21165 Notice that startup code is a blend of code from libgcc and AVR-LibC.
21166 For the impact of AVR-LibC on @code{EIND}, see the
21167 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
21170 It is legitimate for user-specific startup code to set up @code{EIND}
21171 early, for example by means of initialization code located in
21172 section @code{.init3}. Such code runs prior to general startup code
21173 that initializes RAM and calls constructors, but after the bit
21174 of startup code from AVR-LibC that sets @code{EIND} to the segment
21175 where the vector table is located.
21177 #include <avr/io.h>
21180 __attribute__((section(".init3"),naked,used,no_instrument_function))
21181 init3_set_eind (void)
21183 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
21184 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
21189 The @code{__trampolines_start} symbol is defined in the linker script.
21192 Stubs are generated automatically by the linker if
21193 the following two conditions are met:
21196 @item The address of a label is taken by means of the @code{gs} modifier
21197 (short for @emph{generate stubs}) like so:
21199 LDI r24, lo8(gs(@var{func}))
21200 LDI r25, hi8(gs(@var{func}))
21202 @item The final location of that label is in a code segment
21203 @emph{outside} the segment where the stubs are located.
21207 The compiler emits such @code{gs} modifiers for code labels in the
21208 following situations:
21210 @item Taking address of a function or code label.
21211 @item Computed goto.
21212 @item If prologue-save function is used, see @option{-mcall-prologues}
21213 command-line option.
21214 @item Switch/case dispatch tables. If you do not want such dispatch
21215 tables you can specify the @option{-fno-jump-tables} command-line option.
21216 @item C and C++ constructors/destructors called during startup/shutdown.
21217 @item If the tools hit a @code{gs()} modifier explained above.
21221 Jumping to non-symbolic addresses like so is @emph{not} supported:
21226 /* Call function at word address 0x2 */
21227 return ((int(*)(void)) 0x2)();
21231 Instead, a stub has to be set up, i.e.@: the function has to be called
21232 through a symbol (@code{func_4} in the example):
21237 extern int func_4 (void);
21239 /* Call function at byte address 0x4 */
21244 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
21245 Alternatively, @code{func_4} can be defined in the linker script.
21248 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
21249 @cindex @code{RAMPD}
21250 @cindex @code{RAMPX}
21251 @cindex @code{RAMPY}
21252 @cindex @code{RAMPZ}
21253 Some AVR devices support memories larger than the 64@tie{}KiB range
21254 that can be accessed with 16-bit pointers. To access memory locations
21255 outside this 64@tie{}KiB range, the content of a @code{RAMP}
21256 register is used as high part of the address:
21257 The @code{X}, @code{Y}, @code{Z} address register is concatenated
21258 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
21259 register, respectively, to get a wide address. Similarly,
21260 @code{RAMPD} is used together with direct addressing.
21264 The startup code initializes the @code{RAMP} special function
21265 registers with zero.
21268 If a @ref{AVR Named Address Spaces,named address space} other than
21269 generic or @code{__flash} is used, then @code{RAMPZ} is set
21270 as needed before the operation.
21273 If the device supports RAM larger than 64@tie{}KiB and the compiler
21274 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
21275 is reset to zero after the operation.
21278 If the device comes with a specific @code{RAMP} register, the ISR
21279 prologue/epilogue saves/restores that SFR and initializes it with
21280 zero in case the ISR code might (implicitly) use it.
21283 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
21284 If you use inline assembler to read from locations outside the
21285 16-bit address range and change one of the @code{RAMP} registers,
21286 you must reset it to zero after the access.
21290 @subsubsection AVR Built-in Macros
21292 GCC defines several built-in macros so that the user code can test
21293 for the presence or absence of features. Almost any of the following
21294 built-in macros are deduced from device capabilities and thus
21295 triggered by the @option{-mmcu=} command-line option.
21297 For even more AVR-specific built-in macros see
21298 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
21303 Build-in macro that resolves to a decimal number that identifies the
21304 architecture and depends on the @option{-mmcu=@var{mcu}} option.
21305 Possible values are:
21307 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
21308 @code{4}, @code{5}, @code{51}, @code{6}
21310 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
21311 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
21316 @code{102}, @code{103}, @code{104},
21317 @code{105}, @code{106}, @code{107}
21319 for @var{mcu}=@code{avrtiny},
21320 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
21321 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
21322 If @var{mcu} specifies a device, this built-in macro is set
21323 accordingly. For example, with @option{-mmcu=atmega8} the macro is
21324 defined to @code{4}.
21326 @item __AVR_@var{Device}__
21327 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
21328 the device's name. For example, @option{-mmcu=atmega8} defines the
21329 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
21330 @code{__AVR_ATtiny261A__}, etc.
21332 The built-in macros' names follow
21333 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
21334 the device name as from the AVR user manual. The difference between
21335 @var{Device} in the built-in macro and @var{device} in
21336 @option{-mmcu=@var{device}} is that the latter is always lowercase.
21338 If @var{device} is not a device but only a core architecture like
21339 @samp{avr51}, this macro is not defined.
21341 @item __AVR_DEVICE_NAME__
21342 Setting @option{-mmcu=@var{device}} defines this built-in macro to
21343 the device's name. For example, with @option{-mmcu=atmega8} the macro
21344 is defined to @code{atmega8}.
21346 If @var{device} is not a device but only a core architecture like
21347 @samp{avr51}, this macro is not defined.
21349 @item __AVR_XMEGA__
21350 The device / architecture belongs to the XMEGA family of devices.
21352 @item __AVR_HAVE_ELPM__
21353 The device has the @code{ELPM} instruction.
21355 @item __AVR_HAVE_ELPMX__
21356 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
21357 R@var{n},Z+} instructions.
21359 @item __AVR_HAVE_MOVW__
21360 The device has the @code{MOVW} instruction to perform 16-bit
21361 register-register moves.
21363 @item __AVR_HAVE_LPMX__
21364 The device has the @code{LPM R@var{n},Z} and
21365 @code{LPM R@var{n},Z+} instructions.
21367 @item __AVR_HAVE_MUL__
21368 The device has a hardware multiplier.
21370 @item __AVR_HAVE_JMP_CALL__
21371 The device has the @code{JMP} and @code{CALL} instructions.
21372 This is the case for devices with more than 8@tie{}KiB of program
21375 @item __AVR_HAVE_EIJMP_EICALL__
21376 @itemx __AVR_3_BYTE_PC__
21377 The device has the @code{EIJMP} and @code{EICALL} instructions.
21378 This is the case for devices with more than 128@tie{}KiB of program memory.
21379 This also means that the program counter
21380 (PC) is 3@tie{}bytes wide.
21382 @item __AVR_2_BYTE_PC__
21383 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
21384 with up to 128@tie{}KiB of program memory.
21386 @item __AVR_HAVE_8BIT_SP__
21387 @itemx __AVR_HAVE_16BIT_SP__
21388 The stack pointer (SP) register is treated as 8-bit respectively
21389 16-bit register by the compiler.
21390 The definition of these macros is affected by @option{-mtiny-stack}.
21392 @item __AVR_HAVE_SPH__
21394 The device has the SPH (high part of stack pointer) special function
21395 register or has an 8-bit stack pointer, respectively.
21396 The definition of these macros is affected by @option{-mmcu=} and
21397 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
21400 @item __AVR_HAVE_RAMPD__
21401 @itemx __AVR_HAVE_RAMPX__
21402 @itemx __AVR_HAVE_RAMPY__
21403 @itemx __AVR_HAVE_RAMPZ__
21404 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
21405 @code{RAMPZ} special function register, respectively.
21407 @item __NO_INTERRUPTS__
21408 This macro reflects the @option{-mno-interrupts} command-line option.
21410 @item __AVR_ERRATA_SKIP__
21411 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
21412 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
21413 instructions because of a hardware erratum. Skip instructions are
21414 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
21415 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
21418 @item __AVR_ISA_RMW__
21419 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
21421 @item __AVR_SFR_OFFSET__=@var{offset}
21422 Instructions that can address I/O special function registers directly
21423 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
21424 address as if addressed by an instruction to access RAM like @code{LD}
21425 or @code{STS}. This offset depends on the device architecture and has
21426 to be subtracted from the RAM address in order to get the
21427 respective I/O@tie{}address.
21429 @item __AVR_SHORT_CALLS__
21430 The @option{-mshort-calls} command line option is set.
21432 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
21433 Some devices support reading from flash memory by means of @code{LD*}
21434 instructions. The flash memory is seen in the data address space
21435 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
21436 is not defined, this feature is not available. If defined,
21437 the address space is linear and there is no need to put
21438 @code{.rodata} into RAM. This is handled by the default linker
21439 description file, and is currently available for
21440 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
21441 there is no need to use address spaces like @code{__flash} or
21442 features like attribute @code{progmem} and @code{pgm_read_*}.
21444 @item __WITH_AVRLIBC__
21445 The compiler is configured to be used together with AVR-Libc.
21446 See the @option{--with-avrlibc} configure option.
21448 @item __HAVE_DOUBLE_MULTILIB__
21449 Defined if @option{-mdouble=} acts as a multilib option.
21451 @item __HAVE_DOUBLE32__
21452 @itemx __HAVE_DOUBLE64__
21453 Defined if the compiler supports 32-bit double resp. 64-bit double.
21454 The actual layout is specified by option @option{-mdouble=}.
21456 @item __DEFAULT_DOUBLE__
21457 The size in bits of @code{double} if @option{-mdouble=} is not set.
21458 To test the layout of @code{double} in a program, use the built-in
21459 macro @code{__SIZEOF_DOUBLE__}.
21461 @item __HAVE_LONG_DOUBLE32__
21462 @itemx __HAVE_LONG_DOUBLE64__
21463 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
21464 @itemx __DEFAULT_LONG_DOUBLE__
21465 Same as above, but for @code{long double} instead of @code{double}.
21467 @item __WITH_DOUBLE_COMPARISON__
21468 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
21469 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
21470 and is defined to @code{2} or @code{3}.
21472 @item __WITH_LIBF7_LIBGCC__
21473 @itemx __WITH_LIBF7_MATH__
21474 @itemx __WITH_LIBF7_MATH_SYMBOLS__
21475 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
21476 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
21480 @node Blackfin Options
21481 @subsection Blackfin Options
21482 @cindex Blackfin Options
21485 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
21487 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
21488 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
21489 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
21490 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
21491 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
21492 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
21493 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
21494 @samp{bf561}, @samp{bf592}.
21496 The optional @var{sirevision} specifies the silicon revision of the target
21497 Blackfin processor. Any workarounds available for the targeted silicon revision
21498 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
21499 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
21500 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
21501 hexadecimal digits representing the major and minor numbers in the silicon
21502 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
21503 is not defined. If @var{sirevision} is @samp{any}, the
21504 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
21505 If this optional @var{sirevision} is not used, GCC assumes the latest known
21506 silicon revision of the targeted Blackfin processor.
21508 GCC defines a preprocessor macro for the specified @var{cpu}.
21509 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
21510 provided by libgloss to be linked in if @option{-msim} is not given.
21512 Without this option, @samp{bf532} is used as the processor by default.
21514 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
21515 only the preprocessor macro is defined.
21519 Specifies that the program will be run on the simulator. This causes
21520 the simulator BSP provided by libgloss to be linked in. This option
21521 has effect only for @samp{bfin-elf} toolchain.
21522 Certain other options, such as @option{-mid-shared-library} and
21523 @option{-mfdpic}, imply @option{-msim}.
21525 @item -momit-leaf-frame-pointer
21526 @opindex momit-leaf-frame-pointer
21527 Don't keep the frame pointer in a register for leaf functions. This
21528 avoids the instructions to save, set up and restore frame pointers and
21529 makes an extra register available in leaf functions.
21531 @item -mspecld-anomaly
21532 @opindex mspecld-anomaly
21533 When enabled, the compiler ensures that the generated code does not
21534 contain speculative loads after jump instructions. If this option is used,
21535 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
21537 @item -mno-specld-anomaly
21538 @opindex mno-specld-anomaly
21539 @opindex mspecld-anomaly
21540 Don't generate extra code to prevent speculative loads from occurring.
21542 @item -mcsync-anomaly
21543 @opindex mcsync-anomaly
21544 When enabled, the compiler ensures that the generated code does not
21545 contain CSYNC or SSYNC instructions too soon after conditional branches.
21546 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
21548 @item -mno-csync-anomaly
21549 @opindex mno-csync-anomaly
21550 @opindex mcsync-anomaly
21551 Don't generate extra code to prevent CSYNC or SSYNC instructions from
21552 occurring too soon after a conditional branch.
21556 When enabled, the compiler is free to take advantage of the knowledge that
21557 the entire program fits into the low 64k of memory.
21560 @opindex mno-low64k
21561 Assume that the program is arbitrarily large. This is the default.
21563 @item -mstack-check-l1
21564 @opindex mstack-check-l1
21565 Do stack checking using information placed into L1 scratchpad memory by the
21568 @item -mid-shared-library
21569 @opindex mid-shared-library
21570 Generate code that supports shared libraries via the library ID method.
21571 This allows for execute in place and shared libraries in an environment
21572 without virtual memory management. This option implies @option{-fPIC}.
21573 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21575 @item -mno-id-shared-library
21576 @opindex mno-id-shared-library
21577 @opindex mid-shared-library
21578 Generate code that doesn't assume ID-based shared libraries are being used.
21579 This is the default.
21581 @item -mleaf-id-shared-library
21582 @opindex mleaf-id-shared-library
21583 Generate code that supports shared libraries via the library ID method,
21584 but assumes that this library or executable won't link against any other
21585 ID shared libraries. That allows the compiler to use faster code for jumps
21588 @item -mno-leaf-id-shared-library
21589 @opindex mno-leaf-id-shared-library
21590 @opindex mleaf-id-shared-library
21591 Do not assume that the code being compiled won't link against any ID shared
21592 libraries. Slower code is generated for jump and call insns.
21594 @item -mshared-library-id=n
21595 @opindex mshared-library-id
21596 Specifies the identification number of the ID-based shared library being
21597 compiled. Specifying a value of 0 generates more compact code; specifying
21598 other values forces the allocation of that number to the current
21599 library but is no more space- or time-efficient than omitting this option.
21603 Generate code that allows the data segment to be located in a different
21604 area of memory from the text segment. This allows for execute in place in
21605 an environment without virtual memory management by eliminating relocations
21606 against the text section.
21608 @item -mno-sep-data
21609 @opindex mno-sep-data
21611 Generate code that assumes that the data segment follows the text segment.
21612 This is the default.
21615 @itemx -mno-long-calls
21616 @opindex mlong-calls
21617 @opindex mno-long-calls
21618 Tells the compiler to perform function calls by first loading the
21619 address of the function into a register and then performing a subroutine
21620 call on this register. This switch is needed if the target function
21621 lies outside of the 24-bit addressing range of the offset-based
21622 version of subroutine call instruction.
21624 This feature is not enabled by default. Specifying
21625 @option{-mno-long-calls} restores the default behavior. Note these
21626 switches have no effect on how the compiler generates code to handle
21627 function calls via function pointers.
21631 Link with the fast floating-point library. This library relaxes some of
21632 the IEEE floating-point standard's rules for checking inputs against
21633 Not-a-Number (NAN), in the interest of performance.
21636 @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}.
21641 @opindex mmulticore
21642 Build a standalone application for multicore Blackfin processors.
21643 This option causes proper start files and link scripts supporting
21644 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
21645 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
21647 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
21648 selects the one-application-per-core programming model. Without
21649 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
21650 programming model is used. In this model, the main function of Core B
21651 should be named as @code{coreb_main}.
21653 If this option is not used, the single-core application programming
21658 Build a standalone application for Core A of BF561 when using
21659 the one-application-per-core programming model. Proper start files
21660 and link scripts are used to support Core A, and the macro
21661 @code{__BFIN_COREA} is defined.
21662 This option can only be used in conjunction with @option{-mmulticore}.
21666 Build a standalone application for Core B of BF561 when using
21667 the one-application-per-core programming model. Proper start files
21668 and link scripts are used to support Core B, and the macro
21669 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
21670 should be used instead of @code{main}.
21671 This option can only be used in conjunction with @option{-mmulticore}.
21675 Build a standalone application for SDRAM. Proper start files and
21676 link scripts are used to put the application into SDRAM, and the macro
21677 @code{__BFIN_SDRAM} is defined.
21678 The loader should initialize SDRAM before loading the application.
21682 Assume that ICPLBs are enabled at run time. This has an effect on certain
21683 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
21684 are enabled; for standalone applications the default is off.
21688 @subsection C6X Options
21689 @cindex C6X Options
21692 @item -march=@var{name}
21694 This specifies the name of the target architecture. GCC uses this
21695 name to determine what kind of instructions it can emit when generating
21696 assembly code. Permissible names are: @samp{c62x},
21697 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
21700 @opindex mbig-endian
21701 Generate code for a big-endian target.
21703 @item -mlittle-endian
21704 @opindex mlittle-endian
21705 Generate code for a little-endian target. This is the default.
21709 Choose startup files and linker script suitable for the simulator.
21711 @item -msdata=default
21712 @opindex msdata=default
21713 Put small global and static data in the @code{.neardata} section,
21714 which is pointed to by register @code{B14}. Put small uninitialized
21715 global and static data in the @code{.bss} section, which is adjacent
21716 to the @code{.neardata} section. Put small read-only data into the
21717 @code{.rodata} section. The corresponding sections used for large
21718 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
21721 @opindex msdata=all
21722 Put all data, not just small objects, into the sections reserved for
21723 small data, and use addressing relative to the @code{B14} register to
21727 @opindex msdata=none
21728 Make no use of the sections reserved for small data, and use absolute
21729 addresses to access all data. Put all initialized global and static
21730 data in the @code{.fardata} section, and all uninitialized data in the
21731 @code{.far} section. Put all constant data into the @code{.const}
21736 @subsection CRIS Options
21737 @cindex CRIS Options
21739 These options are defined specifically for the CRIS ports.
21742 @item -march=@var{architecture-type}
21743 @itemx -mcpu=@var{architecture-type}
21746 Generate code for the specified architecture. The choices for
21747 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
21748 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
21749 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
21752 @item -mtune=@var{architecture-type}
21754 Tune to @var{architecture-type} everything applicable about the generated
21755 code, except for the ABI and the set of available instructions. The
21756 choices for @var{architecture-type} are the same as for
21757 @option{-march=@var{architecture-type}}.
21759 @item -mmax-stack-frame=@var{n}
21760 @opindex mmax-stack-frame
21761 Warn when the stack frame of a function exceeds @var{n} bytes.
21767 The options @option{-metrax4} and @option{-metrax100} are synonyms for
21768 @option{-march=v3} and @option{-march=v8} respectively.
21770 @item -mmul-bug-workaround
21771 @itemx -mno-mul-bug-workaround
21772 @opindex mmul-bug-workaround
21773 @opindex mno-mul-bug-workaround
21774 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
21775 models where it applies. This option is active by default.
21779 Enable CRIS-specific verbose debug-related information in the assembly
21780 code. This option also has the effect of turning off the @samp{#NO_APP}
21781 formatted-code indicator to the assembler at the beginning of the
21786 Do not use condition-code results from previous instruction; always emit
21787 compare and test instructions before use of condition codes.
21789 @item -mno-side-effects
21790 @opindex mno-side-effects
21791 @opindex mside-effects
21792 Do not emit instructions with side effects in addressing modes other than
21795 @item -mstack-align
21796 @itemx -mno-stack-align
21797 @itemx -mdata-align
21798 @itemx -mno-data-align
21799 @itemx -mconst-align
21800 @itemx -mno-const-align
21801 @opindex mstack-align
21802 @opindex mno-stack-align
21803 @opindex mdata-align
21804 @opindex mno-data-align
21805 @opindex mconst-align
21806 @opindex mno-const-align
21807 These options (@samp{no-} options) arrange (eliminate arrangements) for the
21808 stack frame, individual data and constants to be aligned for the maximum
21809 single data access size for the chosen CPU model. The default is to
21810 arrange for 32-bit alignment. ABI details such as structure layout are
21811 not affected by these options.
21819 Similar to the stack- data- and const-align options above, these options
21820 arrange for stack frame, writable data and constants to all be 32-bit,
21821 16-bit or 8-bit aligned. The default is 32-bit alignment.
21823 @item -mno-prologue-epilogue
21824 @itemx -mprologue-epilogue
21825 @opindex mno-prologue-epilogue
21826 @opindex mprologue-epilogue
21827 With @option{-mno-prologue-epilogue}, the normal function prologue and
21828 epilogue which set up the stack frame are omitted and no return
21829 instructions or return sequences are generated in the code. Use this
21830 option only together with visual inspection of the compiled code: no
21831 warnings or errors are generated when call-saved registers must be saved,
21832 or storage for local variables needs to be allocated.
21836 @opindex mno-gotplt
21838 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
21839 instruction sequences that load addresses for functions from the PLT part
21840 of the GOT rather than (traditional on other architectures) calls to the
21841 PLT@. The default is @option{-mgotplt}.
21845 Legacy no-op option only recognized with the cris-axis-elf and
21846 cris-axis-linux-gnu targets.
21850 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
21854 This option, recognized for the cris-axis-elf, arranges
21855 to link with input-output functions from a simulator library. Code,
21856 initialized data and zero-initialized data are allocated consecutively.
21860 Like @option{-sim}, but pass linker options to locate initialized data at
21861 0x40000000 and zero-initialized data at 0x80000000.
21865 @subsection CR16 Options
21866 @cindex CR16 Options
21868 These options are defined specifically for the CR16 ports.
21874 Enable the use of multiply-accumulate instructions. Disabled by default.
21878 @opindex mcr16cplus
21880 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
21885 Links the library libsim.a which is in compatible with simulator. Applicable
21886 to ELF compiler only.
21890 Choose integer type as 32-bit wide.
21894 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
21896 @item -mdata-model=@var{model}
21897 @opindex mdata-model
21898 Choose a data model. The choices for @var{model} are @samp{near},
21899 @samp{far} or @samp{medium}. @samp{medium} is default.
21900 However, @samp{far} is not valid with @option{-mcr16c}, as the
21901 CR16C architecture does not support the far data model.
21904 @node C-SKY Options
21905 @subsection C-SKY Options
21906 @cindex C-SKY Options
21908 GCC supports these options when compiling for C-SKY V2 processors.
21912 @item -march=@var{arch}
21914 Specify the C-SKY target architecture. Valid values for @var{arch} are:
21915 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
21916 The default is @samp{ck810}.
21918 @item -mcpu=@var{cpu}
21920 Specify the C-SKY target processor. Valid values for @var{cpu} are:
21921 @samp{ck801}, @samp{ck801t},
21922 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
21923 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
21924 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
21925 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
21926 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
21927 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
21928 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
21929 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
21930 @samp{ck803eftr1}, @samp{ck803efhtr1},
21931 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
21932 @samp{ck803sef}, @samp{ck803seft},
21933 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
21934 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
21935 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
21936 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
21939 @opindex mbig-endian
21942 @itemx -mlittle-endian
21943 @opindex mlittle-endian
21947 Select big- or little-endian code. The default is little-endian.
21949 @item -mfloat-abi=@var{name}
21950 @opindex mfloat-abi
21951 Specifies which floating-point ABI to use. Permissible values
21952 are: @samp{soft}, @samp{softfp} and @samp{hard}.
21954 Specifying @samp{soft} causes GCC to generate output containing
21955 library calls for floating-point operations.
21956 @samp{softfp} allows the generation of code using hardware floating-point
21957 instructions, but still uses the soft-float calling conventions.
21958 @samp{hard} allows generation of floating-point instructions
21959 and uses FPU-specific calling conventions.
21961 The default depends on the specific target configuration. Note that
21962 the hard-float and soft-float ABIs are not link-compatible; you must
21963 compile your entire program with the same ABI, and link with a
21964 compatible set of libraries.
21967 @opindex mhard-float
21968 @itemx -msoft-float
21969 @opindex msoft-float
21971 Select hardware or software floating-point implementations.
21972 The default is soft float.
21974 @item -mdouble-float
21975 @itemx -mno-double-float
21976 @opindex mdouble-float
21977 When @option{-mhard-float} is in effect, enable generation of
21978 double-precision float instructions. This is the default except
21979 when compiling for CK803.
21984 When @option{-mhard-float} is in effect, enable generation of
21985 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
21986 This is the default except when compiling for CK803.
21988 @item -mfpu=@var{fpu}
21990 Select the floating-point processor. This option can only be used with
21991 @option{-mhard-float}.
21992 Values for @var{fpu} are
21993 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
21994 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
21995 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
22000 Enable the extended @code{lrw} instruction. This option defaults to on
22001 for CK801 and off otherwise.
22006 Enable interrupt stack instructions; the default is off.
22008 The @option{-mistack} option is required to handle the
22009 @code{interrupt} and @code{isr} function attributes
22010 (@pxref{C-SKY Function Attributes}).
22014 Enable multiprocessor instructions; the default is off.
22018 Enable coprocessor instructions; the default is off.
22022 Enable coprocessor instructions; the default is off.
22026 Enable C-SKY security instructions; the default is off.
22030 Enable C-SKY trust instructions; the default is off.
22038 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
22039 All of these options default to off.
22044 Generate divide instructions. Default is off.
22049 Generate code for Smart Mode, using only registers numbered 0-7 to allow
22050 use of 16-bit instructions. This option is ignored for CK801 where this
22051 is the required behavior, and it defaults to on for CK802.
22052 For other targets, the default is off.
22054 @item -mhigh-registers
22055 @itemx -mno-high-registers
22056 @opindex mhigh-registers
22057 Generate code using the high registers numbered 16-31. This option
22058 is not supported on CK801, CK802, or CK803, and is enabled by default
22059 for other processors.
22064 Generate code using global anchor symbol addresses.
22067 @itemx -mno-pushpop
22069 Generate code using @code{push} and @code{pop} instructions. This option
22072 @item -mmultiple-stld
22074 @itemx -mno-multiple-stld
22076 @opindex mmultiple-stld
22077 Generate code using @code{stm} and @code{ldm} instructions. This option
22078 isn't supported on CK801 but is enabled by default on other processors.
22081 @itemx -mno-constpool
22082 @opindex mconstpool
22083 Create constant pools in the compiler instead of deferring it to the
22084 assembler. This option is the default and required for correct code
22085 generation on CK801 and CK802, and is optional on other processors.
22088 @item -mno-stack-size
22089 @opindex mstack-size
22090 Emit @code{.stack_size} directives for each function in the assembly
22091 output. This option defaults to off.
22096 Generate code for the C-SKY compiler runtime instead of libgcc. This
22097 option defaults to off.
22099 @item -mbranch-cost=@var{n}
22100 @opindex mbranch-cost=
22101 Set the branch costs to roughly @code{n} instructions. The default is 1.
22103 @item -msched-prolog
22104 @itemx -mno-sched-prolog
22105 @opindex msched-prolog
22106 Permit scheduling of function prologue and epilogue sequences. Using
22107 this option can result in code that is not compliant with the C-SKY V2 ABI
22108 prologue requirements and that cannot be debugged or backtraced.
22109 It is disabled by default.
22113 Links the library libsemi.a which is in compatible with simulator. Applicable
22114 to ELF compiler only.
22118 @node Darwin Options
22119 @subsection Darwin Options
22120 @cindex Darwin options
22122 These options are defined for all architectures running the Darwin operating
22125 FSF GCC on Darwin does not create ``fat'' object files; it creates
22126 an object file for the single architecture that GCC was built to
22127 target. Apple's GCC on Darwin does create ``fat'' files if multiple
22128 @option{-arch} options are used; it does so by running the compiler or
22129 linker multiple times and joining the results together with
22132 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
22133 @samp{i686}) is determined by the flags that specify the ISA
22134 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
22135 @option{-force_cpusubtype_ALL} option can be used to override this.
22137 The Darwin tools vary in their behavior when presented with an ISA
22138 mismatch. The assembler, @file{as}, only permits instructions to
22139 be used that are valid for the subtype of the file it is generating,
22140 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
22141 The linker for shared libraries, @file{/usr/bin/libtool}, fails
22142 and prints an error if asked to create a shared library with a less
22143 restrictive subtype than its input files (for instance, trying to put
22144 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
22145 for executables, @command{ld}, quietly gives the executable the most
22146 restrictive subtype of any of its input files.
22151 Add the framework directory @var{dir} to the head of the list of
22152 directories to be searched for header files. These directories are
22153 interleaved with those specified by @option{-I} options and are
22154 scanned in a left-to-right order.
22156 A framework directory is a directory with frameworks in it. A
22157 framework is a directory with a @file{Headers} and/or
22158 @file{PrivateHeaders} directory contained directly in it that ends
22159 in @file{.framework}. The name of a framework is the name of this
22160 directory excluding the @file{.framework}. Headers associated with
22161 the framework are found in one of those two directories, with
22162 @file{Headers} being searched first. A subframework is a framework
22163 directory that is in a framework's @file{Frameworks} directory.
22164 Includes of subframework headers can only appear in a header of a
22165 framework that contains the subframework, or in a sibling subframework
22166 header. Two subframeworks are siblings if they occur in the same
22167 framework. A subframework should not have the same name as a
22168 framework; a warning is issued if this is violated. Currently a
22169 subframework cannot have subframeworks; in the future, the mechanism
22170 may be extended to support this. The standard frameworks can be found
22171 in @file{/System/Library/Frameworks} and
22172 @file{/Library/Frameworks}. An example include looks like
22173 @code{#include <Framework/header.h>}, where @file{Framework} denotes
22174 the name of the framework and @file{header.h} is found in the
22175 @file{PrivateHeaders} or @file{Headers} directory.
22177 @item -iframework@var{dir}
22178 @opindex iframework
22179 Like @option{-F} except the directory is a treated as a system
22180 directory. The main difference between this @option{-iframework} and
22181 @option{-F} is that with @option{-iframework} the compiler does not
22182 warn about constructs contained within header files found via
22183 @var{dir}. This option is valid only for the C family of languages.
22187 Emit debugging information for symbols that are used. For stabs
22188 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
22189 This is by default ON@.
22193 Emit debugging information for all symbols and types.
22195 @item -mmacosx-version-min=@var{version}
22196 The earliest version of MacOS X that this executable will run on
22197 is @var{version}. Typical values of @var{version} include @code{10.1},
22198 @code{10.2}, and @code{10.3.9}.
22200 If the compiler was built to use the system's headers by default,
22201 then the default for this option is the system version on which the
22202 compiler is running, otherwise the default is to make choices that
22203 are compatible with as many systems and code bases as possible.
22207 Enable kernel development mode. The @option{-mkernel} option sets
22208 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
22209 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
22210 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
22211 applicable. This mode also sets @option{-mno-altivec},
22212 @option{-msoft-float}, @option{-fno-builtin} and
22213 @option{-mlong-branch} for PowerPC targets.
22215 @item -mone-byte-bool
22216 @opindex mone-byte-bool
22217 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
22218 By default @code{sizeof(bool)} is @code{4} when compiling for
22219 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
22220 option has no effect on x86.
22222 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
22223 to generate code that is not binary compatible with code generated
22224 without that switch. Using this switch may require recompiling all
22225 other modules in a program, including system libraries. Use this
22226 switch to conform to a non-default data model.
22228 @item -mfix-and-continue
22229 @itemx -ffix-and-continue
22230 @itemx -findirect-data
22231 @opindex mfix-and-continue
22232 @opindex ffix-and-continue
22233 @opindex findirect-data
22234 Generate code suitable for fast turnaround development, such as to
22235 allow GDB to dynamically load @file{.o} files into already-running
22236 programs. @option{-findirect-data} and @option{-ffix-and-continue}
22237 are provided for backwards compatibility.
22241 Loads all members of static archive libraries.
22242 See man ld(1) for more information.
22244 @item -arch_errors_fatal
22245 @opindex arch_errors_fatal
22246 Cause the errors having to do with files that have the wrong architecture
22249 @item -bind_at_load
22250 @opindex bind_at_load
22251 Causes the output file to be marked such that the dynamic linker will
22252 bind all undefined references when the file is loaded or launched.
22256 Produce a Mach-o bundle format file.
22257 See man ld(1) for more information.
22259 @item -bundle_loader @var{executable}
22260 @opindex bundle_loader
22261 This option specifies the @var{executable} that will load the build
22262 output file being linked. See man ld(1) for more information.
22265 @opindex dynamiclib
22266 When passed this option, GCC produces a dynamic library instead of
22267 an executable when linking, using the Darwin @file{libtool} command.
22269 @item -force_cpusubtype_ALL
22270 @opindex force_cpusubtype_ALL
22271 This causes GCC's output file to have the @samp{ALL} subtype, instead of
22272 one controlled by the @option{-mcpu} or @option{-march} option.
22274 @item -allowable_client @var{client_name}
22275 @itemx -client_name
22276 @itemx -compatibility_version
22277 @itemx -current_version
22279 @itemx -dependency-file
22281 @itemx -dylinker_install_name
22283 @itemx -exported_symbols_list
22286 @itemx -flat_namespace
22287 @itemx -force_flat_namespace
22288 @itemx -headerpad_max_install_names
22291 @itemx -install_name
22292 @itemx -keep_private_externs
22293 @itemx -multi_module
22294 @itemx -multiply_defined
22295 @itemx -multiply_defined_unused
22298 @itemx -no_dead_strip_inits_and_terms
22299 @itemx -nofixprebinding
22300 @itemx -nomultidefs
22302 @itemx -noseglinkedit
22303 @itemx -pagezero_size
22305 @itemx -prebind_all_twolevel_modules
22306 @itemx -private_bundle
22308 @itemx -read_only_relocs
22310 @itemx -sectobjectsymbols
22314 @itemx -sectobjectsymbols
22317 @itemx -segs_read_only_addr
22319 @itemx -segs_read_write_addr
22320 @itemx -seg_addr_table
22321 @itemx -seg_addr_table_filename
22322 @itemx -seglinkedit
22324 @itemx -segs_read_only_addr
22325 @itemx -segs_read_write_addr
22326 @itemx -single_module
22328 @itemx -sub_library
22330 @itemx -sub_umbrella
22331 @itemx -twolevel_namespace
22334 @itemx -unexported_symbols_list
22335 @itemx -weak_reference_mismatches
22336 @itemx -whatsloaded
22337 @opindex allowable_client
22338 @opindex client_name
22339 @opindex compatibility_version
22340 @opindex current_version
22341 @opindex dead_strip
22342 @opindex dependency-file
22343 @opindex dylib_file
22344 @opindex dylinker_install_name
22346 @opindex exported_symbols_list
22348 @opindex flat_namespace
22349 @opindex force_flat_namespace
22350 @opindex headerpad_max_install_names
22351 @opindex image_base
22353 @opindex install_name
22354 @opindex keep_private_externs
22355 @opindex multi_module
22356 @opindex multiply_defined
22357 @opindex multiply_defined_unused
22358 @opindex noall_load
22359 @opindex no_dead_strip_inits_and_terms
22360 @opindex nofixprebinding
22361 @opindex nomultidefs
22363 @opindex noseglinkedit
22364 @opindex pagezero_size
22366 @opindex prebind_all_twolevel_modules
22367 @opindex private_bundle
22368 @opindex read_only_relocs
22370 @opindex sectobjectsymbols
22373 @opindex sectcreate
22374 @opindex sectobjectsymbols
22377 @opindex segs_read_only_addr
22378 @opindex segs_read_write_addr
22379 @opindex seg_addr_table
22380 @opindex seg_addr_table_filename
22381 @opindex seglinkedit
22383 @opindex segs_read_only_addr
22384 @opindex segs_read_write_addr
22385 @opindex single_module
22387 @opindex sub_library
22388 @opindex sub_umbrella
22389 @opindex twolevel_namespace
22392 @opindex unexported_symbols_list
22393 @opindex weak_reference_mismatches
22394 @opindex whatsloaded
22395 These options are passed to the Darwin linker. The Darwin linker man page
22396 describes them in detail.
22399 @node DEC Alpha Options
22400 @subsection DEC Alpha Options
22402 These @samp{-m} options are defined for the DEC Alpha implementations:
22405 @item -mno-soft-float
22406 @itemx -msoft-float
22407 @opindex mno-soft-float
22408 @opindex msoft-float
22409 Use (do not use) the hardware floating-point instructions for
22410 floating-point operations. When @option{-msoft-float} is specified,
22411 functions in @file{libgcc.a} are used to perform floating-point
22412 operations. Unless they are replaced by routines that emulate the
22413 floating-point operations, or compiled in such a way as to call such
22414 emulations routines, these routines issue floating-point
22415 operations. If you are compiling for an Alpha without floating-point
22416 operations, you must ensure that the library is built so as not to call
22419 Note that Alpha implementations without floating-point operations are
22420 required to have floating-point registers.
22423 @itemx -mno-fp-regs
22425 @opindex mno-fp-regs
22426 Generate code that uses (does not use) the floating-point register set.
22427 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
22428 register set is not used, floating-point operands are passed in integer
22429 registers as if they were integers and floating-point results are passed
22430 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
22431 so any function with a floating-point argument or return value called by code
22432 compiled with @option{-mno-fp-regs} must also be compiled with that
22435 A typical use of this option is building a kernel that does not use,
22436 and hence need not save and restore, any floating-point registers.
22440 The Alpha architecture implements floating-point hardware optimized for
22441 maximum performance. It is mostly compliant with the IEEE floating-point
22442 standard. However, for full compliance, software assistance is
22443 required. This option generates code fully IEEE-compliant code
22444 @emph{except} that the @var{inexact-flag} is not maintained (see below).
22445 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
22446 defined during compilation. The resulting code is less efficient but is
22447 able to correctly support denormalized numbers and exceptional IEEE
22448 values such as not-a-number and plus/minus infinity. Other Alpha
22449 compilers call this option @option{-ieee_with_no_inexact}.
22451 @item -mieee-with-inexact
22452 @opindex mieee-with-inexact
22453 This is like @option{-mieee} except the generated code also maintains
22454 the IEEE @var{inexact-flag}. Turning on this option causes the
22455 generated code to implement fully-compliant IEEE math. In addition to
22456 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
22457 macro. On some Alpha implementations the resulting code may execute
22458 significantly slower than the code generated by default. Since there is
22459 very little code that depends on the @var{inexact-flag}, you should
22460 normally not specify this option. Other Alpha compilers call this
22461 option @option{-ieee_with_inexact}.
22463 @item -mfp-trap-mode=@var{trap-mode}
22464 @opindex mfp-trap-mode
22465 This option controls what floating-point related traps are enabled.
22466 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
22467 The trap mode can be set to one of four values:
22471 This is the default (normal) setting. The only traps that are enabled
22472 are the ones that cannot be disabled in software (e.g., division by zero
22476 In addition to the traps enabled by @samp{n}, underflow traps are enabled
22480 Like @samp{u}, but the instructions are marked to be safe for software
22481 completion (see Alpha architecture manual for details).
22484 Like @samp{su}, but inexact traps are enabled as well.
22487 @item -mfp-rounding-mode=@var{rounding-mode}
22488 @opindex mfp-rounding-mode
22489 Selects the IEEE rounding mode. Other Alpha compilers call this option
22490 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
22495 Normal IEEE rounding mode. Floating-point numbers are rounded towards
22496 the nearest machine number or towards the even machine number in case
22500 Round towards minus infinity.
22503 Chopped rounding mode. Floating-point numbers are rounded towards zero.
22506 Dynamic rounding mode. A field in the floating-point control register
22507 (@var{fpcr}, see Alpha architecture reference manual) controls the
22508 rounding mode in effect. The C library initializes this register for
22509 rounding towards plus infinity. Thus, unless your program modifies the
22510 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
22513 @item -mtrap-precision=@var{trap-precision}
22514 @opindex mtrap-precision
22515 In the Alpha architecture, floating-point traps are imprecise. This
22516 means without software assistance it is impossible to recover from a
22517 floating trap and program execution normally needs to be terminated.
22518 GCC can generate code that can assist operating system trap handlers
22519 in determining the exact location that caused a floating-point trap.
22520 Depending on the requirements of an application, different levels of
22521 precisions can be selected:
22525 Program precision. This option is the default and means a trap handler
22526 can only identify which program caused a floating-point exception.
22529 Function precision. The trap handler can determine the function that
22530 caused a floating-point exception.
22533 Instruction precision. The trap handler can determine the exact
22534 instruction that caused a floating-point exception.
22537 Other Alpha compilers provide the equivalent options called
22538 @option{-scope_safe} and @option{-resumption_safe}.
22540 @item -mieee-conformant
22541 @opindex mieee-conformant
22542 This option marks the generated code as IEEE conformant. You must not
22543 use this option unless you also specify @option{-mtrap-precision=i} and either
22544 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
22545 is to emit the line @samp{.eflag 48} in the function prologue of the
22546 generated assembly file.
22548 @item -mbuild-constants
22549 @opindex mbuild-constants
22550 Normally GCC examines a 32- or 64-bit integer constant to
22551 see if it can construct it from smaller constants in two or three
22552 instructions. If it cannot, it outputs the constant as a literal and
22553 generates code to load it from the data segment at run time.
22555 Use this option to require GCC to construct @emph{all} integer constants
22556 using code, even if it takes more instructions (the maximum is six).
22558 You typically use this option to build a shared library dynamic
22559 loader. Itself a shared library, it must relocate itself in memory
22560 before it can find the variables and constants in its own data segment.
22578 Indicate whether GCC should generate code to use the optional BWX,
22579 CIX, FIX and MAX instruction sets. The default is to use the instruction
22580 sets supported by the CPU type specified via @option{-mcpu=} option or that
22581 of the CPU on which GCC was built if none is specified.
22584 @itemx -mfloat-ieee
22585 @opindex mfloat-vax
22586 @opindex mfloat-ieee
22587 Generate code that uses (does not use) VAX F and G floating-point
22588 arithmetic instead of IEEE single and double precision.
22590 @item -mexplicit-relocs
22591 @itemx -mno-explicit-relocs
22592 @opindex mexplicit-relocs
22593 @opindex mno-explicit-relocs
22594 Older Alpha assemblers provided no way to generate symbol relocations
22595 except via assembler macros. Use of these macros does not allow
22596 optimal instruction scheduling. GNU binutils as of version 2.12
22597 supports a new syntax that allows the compiler to explicitly mark
22598 which relocations should apply to which instructions. This option
22599 is mostly useful for debugging, as GCC detects the capabilities of
22600 the assembler when it is built and sets the default accordingly.
22603 @itemx -mlarge-data
22604 @opindex msmall-data
22605 @opindex mlarge-data
22606 When @option{-mexplicit-relocs} is in effect, static data is
22607 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
22608 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
22609 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
22610 16-bit relocations off of the @code{$gp} register. This limits the
22611 size of the small data area to 64KB, but allows the variables to be
22612 directly accessed via a single instruction.
22614 The default is @option{-mlarge-data}. With this option the data area
22615 is limited to just below 2GB@. Programs that require more than 2GB of
22616 data must use @code{malloc} or @code{mmap} to allocate the data in the
22617 heap instead of in the program's data segment.
22619 When generating code for shared libraries, @option{-fpic} implies
22620 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
22623 @itemx -mlarge-text
22624 @opindex msmall-text
22625 @opindex mlarge-text
22626 When @option{-msmall-text} is used, the compiler assumes that the
22627 code of the entire program (or shared library) fits in 4MB, and is
22628 thus reachable with a branch instruction. When @option{-msmall-data}
22629 is used, the compiler can assume that all local symbols share the
22630 same @code{$gp} value, and thus reduce the number of instructions
22631 required for a function call from 4 to 1.
22633 The default is @option{-mlarge-text}.
22635 @item -mcpu=@var{cpu_type}
22637 Set the instruction set and instruction scheduling parameters for
22638 machine type @var{cpu_type}. You can specify either the @samp{EV}
22639 style name or the corresponding chip number. GCC supports scheduling
22640 parameters for the EV4, EV5 and EV6 family of processors and
22641 chooses the default values for the instruction set from the processor
22642 you specify. If you do not specify a processor type, GCC defaults
22643 to the processor on which the compiler was built.
22645 Supported values for @var{cpu_type} are
22651 Schedules as an EV4 and has no instruction set extensions.
22655 Schedules as an EV5 and has no instruction set extensions.
22659 Schedules as an EV5 and supports the BWX extension.
22664 Schedules as an EV5 and supports the BWX and MAX extensions.
22668 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
22672 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
22675 Native toolchains also support the value @samp{native},
22676 which selects the best architecture option for the host processor.
22677 @option{-mcpu=native} has no effect if GCC does not recognize
22680 @item -mtune=@var{cpu_type}
22682 Set only the instruction scheduling parameters for machine type
22683 @var{cpu_type}. The instruction set is not changed.
22685 Native toolchains also support the value @samp{native},
22686 which selects the best architecture option for the host processor.
22687 @option{-mtune=native} has no effect if GCC does not recognize
22690 @item -mmemory-latency=@var{time}
22691 @opindex mmemory-latency
22692 Sets the latency the scheduler should assume for typical memory
22693 references as seen by the application. This number is highly
22694 dependent on the memory access patterns used by the application
22695 and the size of the external cache on the machine.
22697 Valid options for @var{time} are
22701 A decimal number representing clock cycles.
22707 The compiler contains estimates of the number of clock cycles for
22708 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
22709 (also called Dcache, Scache, and Bcache), as well as to main memory.
22710 Note that L3 is only valid for EV5.
22716 @subsection eBPF Options
22717 @cindex eBPF Options
22720 @item -mframe-limit=@var{bytes}
22721 This specifies the hard limit for frame sizes, in bytes. Currently,
22722 the value that can be specified should be less than or equal to
22723 @samp{32767}. Defaults to whatever limit is imposed by the version of
22724 the Linux kernel targeted.
22726 @item -mkernel=@var{version}
22728 This specifies the minimum version of the kernel that will run the
22729 compiled program. GCC uses this version to determine which
22730 instructions to use, what kernel helpers to allow, etc. Currently,
22731 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
22732 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
22733 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
22734 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
22735 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
22736 @samp{5.2}, @samp{latest} and @samp{native}.
22739 @opindex mbig-endian
22740 Generate code for a big-endian target.
22742 @item -mlittle-endian
22743 @opindex mlittle-endian
22744 Generate code for a little-endian target. This is the default.
22748 Enable generation of extra conditional-branch instructions.
22749 Enabled for CPU v2 and above.
22753 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
22757 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
22759 @item -mcpu=@var{version}
22761 This specifies which version of the eBPF ISA to target. Newer versions
22762 may not be supported by all kernels. The default is @samp{v3}.
22764 Supported values for @var{version} are:
22768 The first stable eBPF ISA with no special features or extensions.
22771 Supports the jump extensions, as in @option{-mjmpext}.
22774 All features of v2, plus:
22776 @item 32-bit jump operations, as in @option{-mjmp32}
22777 @item 32-bit ALU operations, as in @option{-malu32}
22784 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
22785 is implied by @option{-gbtf}.
22789 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
22790 support is enabled by default when generating BTF debug information for
22794 Generate code for an expanded version of BPF, which relaxes some of
22795 the restrictions imposed by the BPF architecture:
22797 @item Save and restore callee-saved registers at function entry and
22798 exit, respectively.
22803 @subsection FR30 Options
22804 @cindex FR30 Options
22806 These options are defined specifically for the FR30 port.
22810 @item -msmall-model
22811 @opindex msmall-model
22812 Use the small address space model. This can produce smaller code, but
22813 it does assume that all symbolic values and addresses fit into a
22818 Assume that runtime support has been provided and so there is no need
22819 to include the simulator library (@file{libsim.a}) on the linker
22825 @subsection FT32 Options
22826 @cindex FT32 Options
22828 These options are defined specifically for the FT32 port.
22834 Specifies that the program will be run on the simulator. This causes
22835 an alternate runtime startup and library to be linked.
22836 You must not use this option when generating programs that will run on
22837 real hardware; you must provide your own runtime library for whatever
22838 I/O functions are needed.
22842 Enable Local Register Allocation. This is still experimental for FT32,
22843 so by default the compiler uses standard reload.
22847 Do not use div and mod instructions.
22851 Enable use of the extended instructions of the FT32B processor.
22855 Compress all code using the Ft32B code compression scheme.
22859 Do not generate code that reads program memory.
22864 @subsection FRV Options
22865 @cindex FRV Options
22871 Only use the first 32 general-purpose registers.
22876 Use all 64 general-purpose registers.
22881 Use only the first 32 floating-point registers.
22886 Use all 64 floating-point registers.
22889 @opindex mhard-float
22891 Use hardware instructions for floating-point operations.
22894 @opindex msoft-float
22896 Use library routines for floating-point operations.
22901 Dynamically allocate condition code registers.
22906 Do not try to dynamically allocate condition code registers, only
22907 use @code{icc0} and @code{fcc0}.
22912 Change ABI to use double word insns.
22918 Do not use double word instructions.
22923 Use floating-point double instructions.
22926 @opindex mno-double
22928 Do not use floating-point double instructions.
22933 Use media instructions.
22938 Do not use media instructions.
22943 Use multiply and add/subtract instructions.
22946 @opindex mno-muladd
22948 Do not use multiply and add/subtract instructions.
22953 Select the FDPIC ABI, which uses function descriptors to represent
22954 pointers to functions. Without any PIC/PIE-related options, it
22955 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
22956 assumes GOT entries and small data are within a 12-bit range from the
22957 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
22958 are computed with 32 bits.
22959 With a @samp{bfin-elf} target, this option implies @option{-msim}.
22962 @opindex minline-plt
22964 Enable inlining of PLT entries in function calls to functions that are
22965 not known to bind locally. It has no effect without @option{-mfdpic}.
22966 It's enabled by default if optimizing for speed and compiling for
22967 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
22968 optimization option such as @option{-O3} or above is present in the
22974 Assume a large TLS segment when generating thread-local code.
22979 Do not assume a large TLS segment when generating thread-local code.
22984 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
22985 that is known to be in read-only sections. It's enabled by default,
22986 except for @option{-fpic} or @option{-fpie}: even though it may help
22987 make the global offset table smaller, it trades 1 instruction for 4.
22988 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
22989 one of which may be shared by multiple symbols, and it avoids the need
22990 for a GOT entry for the referenced symbol, so it's more likely to be a
22991 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
22993 @item -multilib-library-pic
22994 @opindex multilib-library-pic
22996 Link with the (library, not FD) pic libraries. It's implied by
22997 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
22998 @option{-fpic} without @option{-mfdpic}. You should never have to use
23002 @opindex mlinked-fp
23004 Follow the EABI requirement of always creating a frame pointer whenever
23005 a stack frame is allocated. This option is enabled by default and can
23006 be disabled with @option{-mno-linked-fp}.
23009 @opindex mlong-calls
23011 Use indirect addressing to call functions outside the current
23012 compilation unit. This allows the functions to be placed anywhere
23013 within the 32-bit address space.
23015 @item -malign-labels
23016 @opindex malign-labels
23018 Try to align labels to an 8-byte boundary by inserting NOPs into the
23019 previous packet. This option only has an effect when VLIW packing
23020 is enabled. It doesn't create new packets; it merely adds NOPs to
23023 @item -mlibrary-pic
23024 @opindex mlibrary-pic
23026 Generate position-independent EABI code.
23031 Use only the first four media accumulator registers.
23036 Use all eight media accumulator registers.
23041 Pack VLIW instructions.
23046 Do not pack VLIW instructions.
23049 @opindex mno-eflags
23051 Do not mark ABI switches in e_flags.
23054 @opindex mcond-move
23056 Enable the use of conditional-move instructions (default).
23058 This switch is mainly for debugging the compiler and will likely be removed
23059 in a future version.
23061 @item -mno-cond-move
23062 @opindex mno-cond-move
23064 Disable the use of conditional-move instructions.
23066 This switch is mainly for debugging the compiler and will likely be removed
23067 in a future version.
23072 Enable the use of conditional set instructions (default).
23074 This switch is mainly for debugging the compiler and will likely be removed
23075 in a future version.
23080 Disable the use of conditional set instructions.
23082 This switch is mainly for debugging the compiler and will likely be removed
23083 in a future version.
23086 @opindex mcond-exec
23088 Enable the use of conditional execution (default).
23090 This switch is mainly for debugging the compiler and will likely be removed
23091 in a future version.
23093 @item -mno-cond-exec
23094 @opindex mno-cond-exec
23096 Disable the use of conditional execution.
23098 This switch is mainly for debugging the compiler and will likely be removed
23099 in a future version.
23101 @item -mvliw-branch
23102 @opindex mvliw-branch
23104 Run a pass to pack branches into VLIW instructions (default).
23106 This switch is mainly for debugging the compiler and will likely be removed
23107 in a future version.
23109 @item -mno-vliw-branch
23110 @opindex mno-vliw-branch
23112 Do not run a pass to pack branches into VLIW instructions.
23114 This switch is mainly for debugging the compiler and will likely be removed
23115 in a future version.
23117 @item -mmulti-cond-exec
23118 @opindex mmulti-cond-exec
23120 Enable optimization of @code{&&} and @code{||} in conditional execution
23123 This switch is mainly for debugging the compiler and will likely be removed
23124 in a future version.
23126 @item -mno-multi-cond-exec
23127 @opindex mno-multi-cond-exec
23129 Disable optimization of @code{&&} and @code{||} in conditional execution.
23131 This switch is mainly for debugging the compiler and will likely be removed
23132 in a future version.
23134 @item -mnested-cond-exec
23135 @opindex mnested-cond-exec
23137 Enable nested conditional execution optimizations (default).
23139 This switch is mainly for debugging the compiler and will likely be removed
23140 in a future version.
23142 @item -mno-nested-cond-exec
23143 @opindex mno-nested-cond-exec
23145 Disable nested conditional execution optimizations.
23147 This switch is mainly for debugging the compiler and will likely be removed
23148 in a future version.
23150 @item -moptimize-membar
23151 @opindex moptimize-membar
23153 This switch removes redundant @code{membar} instructions from the
23154 compiler-generated code. It is enabled by default.
23156 @item -mno-optimize-membar
23157 @opindex mno-optimize-membar
23158 @opindex moptimize-membar
23160 This switch disables the automatic removal of redundant @code{membar}
23161 instructions from the generated code.
23163 @item -mtomcat-stats
23164 @opindex mtomcat-stats
23166 Cause gas to print out tomcat statistics.
23168 @item -mcpu=@var{cpu}
23171 Select the processor type for which to generate code. Possible values are
23172 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
23173 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
23177 @node GNU/Linux Options
23178 @subsection GNU/Linux Options
23180 These @samp{-m} options are defined for GNU/Linux targets:
23185 Use the GNU C library. This is the default except
23186 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
23187 @samp{*-*-linux-*android*} targets.
23191 Use uClibc C library. This is the default on
23192 @samp{*-*-linux-*uclibc*} targets.
23196 Use the musl C library. This is the default on
23197 @samp{*-*-linux-*musl*} targets.
23201 Use Bionic C library. This is the default on
23202 @samp{*-*-linux-*android*} targets.
23206 Compile code compatible with Android platform. This is the default on
23207 @samp{*-*-linux-*android*} targets.
23209 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
23210 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
23211 this option makes the GCC driver pass Android-specific options to the linker.
23212 Finally, this option causes the preprocessor macro @code{__ANDROID__}
23215 @item -tno-android-cc
23216 @opindex tno-android-cc
23217 Disable compilation effects of @option{-mandroid}, i.e., do not enable
23218 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
23219 @option{-fno-rtti} by default.
23221 @item -tno-android-ld
23222 @opindex tno-android-ld
23223 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
23224 linking options to the linker.
23228 @node H8/300 Options
23229 @subsection H8/300 Options
23231 These @samp{-m} options are defined for the H8/300 implementations:
23236 Shorten some address references at link time, when possible; uses the
23237 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
23238 ld, Using ld}, for a fuller description.
23242 Generate code for the H8/300H@.
23246 Generate code for the H8S@.
23250 Generate code for the H8S and H8/300H in the normal mode. This switch
23251 must be used either with @option{-mh} or @option{-ms}.
23255 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
23259 Extended registers are stored on stack before execution of function
23260 with monitor attribute. Default option is @option{-mexr}.
23261 This option is valid only for H8S targets.
23266 Extended registers are not stored on stack before execution of function
23267 with monitor attribute. Default option is @option{-mno-exr}.
23268 This option is valid only for H8S targets.
23272 Make @code{int} data 32 bits by default.
23275 @opindex malign-300
23276 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
23277 The default for the H8/300H and H8S is to align longs and floats on
23279 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
23280 This option has no effect on the H8/300.
23284 @subsection HPPA Options
23285 @cindex HPPA Options
23287 These @samp{-m} options are defined for the HPPA family of computers:
23290 @item -march=@var{architecture-type}
23292 Generate code for the specified architecture. The choices for
23293 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
23294 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
23295 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
23296 architecture option for your machine. Code compiled for lower numbered
23297 architectures runs on higher numbered architectures, but not the
23300 @item -mpa-risc-1-0
23301 @itemx -mpa-risc-1-1
23302 @itemx -mpa-risc-2-0
23303 @opindex mpa-risc-1-0
23304 @opindex mpa-risc-1-1
23305 @opindex mpa-risc-2-0
23306 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
23308 @item -mcaller-copies
23309 @opindex mcaller-copies
23310 The caller copies function arguments passed by hidden reference. This
23311 option should be used with care as it is not compatible with the default
23312 32-bit runtime. However, only aggregates larger than eight bytes are
23313 passed by hidden reference and the option provides better compatibility
23316 @item -mjump-in-delay
23317 @opindex mjump-in-delay
23318 This option is ignored and provided for compatibility purposes only.
23320 @item -mdisable-fpregs
23321 @opindex mdisable-fpregs
23322 Prevent floating-point registers from being used in any manner. This is
23323 necessary for compiling kernels that perform lazy context switching of
23324 floating-point registers. If you use this option and attempt to perform
23325 floating-point operations, the compiler aborts.
23327 @item -mdisable-indexing
23328 @opindex mdisable-indexing
23329 Prevent the compiler from using indexing address modes. This avoids some
23330 rather obscure problems when compiling MIG generated code under MACH@.
23332 @item -mno-space-regs
23333 @opindex mno-space-regs
23334 @opindex mspace-regs
23335 Generate code that assumes the target has no space registers. This allows
23336 GCC to generate faster indirect calls and use unscaled index address modes.
23338 Such code is suitable for level 0 PA systems and kernels.
23340 @item -mfast-indirect-calls
23341 @opindex mfast-indirect-calls
23342 Generate code that assumes calls never cross space boundaries. This
23343 allows GCC to emit code that performs faster indirect calls.
23345 This option does not work in the presence of shared libraries or nested
23348 @item -mfixed-range=@var{register-range}
23349 @opindex mfixed-range
23350 Generate code treating the given register range as fixed registers.
23351 A fixed register is one that the register allocator cannot use. This is
23352 useful when compiling kernel code. A register range is specified as
23353 two registers separated by a dash. Multiple register ranges can be
23354 specified separated by a comma.
23356 @item -mlong-load-store
23357 @opindex mlong-load-store
23358 Generate 3-instruction load and store sequences as sometimes required by
23359 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
23362 @item -mportable-runtime
23363 @opindex mportable-runtime
23364 Use the portable calling conventions proposed by HP for ELF systems.
23368 Enable the use of assembler directives only GAS understands.
23370 @item -mschedule=@var{cpu-type}
23372 Schedule code according to the constraints for the machine type
23373 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
23374 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
23375 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
23376 proper scheduling option for your machine. The default scheduling is
23380 @opindex mlinker-opt
23381 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
23382 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
23383 linkers in which they give bogus error messages when linking some programs.
23386 @opindex msoft-float
23387 Generate output containing library calls for floating point.
23388 @strong{Warning:} the requisite libraries are not available for all HPPA
23389 targets. Normally the facilities of the machine's usual C compiler are
23390 used, but this cannot be done directly in cross-compilation. You must make
23391 your own arrangements to provide suitable library functions for
23394 @option{-msoft-float} changes the calling convention in the output file;
23395 therefore, it is only useful if you compile @emph{all} of a program with
23396 this option. In particular, you need to compile @file{libgcc.a}, the
23397 library that comes with GCC, with @option{-msoft-float} in order for
23402 Generate the predefine, @code{_SIO}, for server IO@. The default is
23403 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
23404 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
23405 options are available under HP-UX and HI-UX@.
23409 Use options specific to GNU @command{ld}.
23410 This passes @option{-shared} to @command{ld} when
23411 building a shared library. It is the default when GCC is configured,
23412 explicitly or implicitly, with the GNU linker. This option does not
23413 affect which @command{ld} is called; it only changes what parameters
23414 are passed to that @command{ld}.
23415 The @command{ld} that is called is determined by the
23416 @option{--with-ld} configure option, GCC's program search path, and
23417 finally by the user's @env{PATH}. The linker used by GCC can be printed
23418 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
23419 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23423 Use options specific to HP @command{ld}.
23424 This passes @option{-b} to @command{ld} when building
23425 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
23426 links. It is the default when GCC is configured, explicitly or
23427 implicitly, with the HP linker. This option does not affect
23428 which @command{ld} is called; it only changes what parameters are passed to that
23430 The @command{ld} that is called is determined by the @option{--with-ld}
23431 configure option, GCC's program search path, and finally by the user's
23432 @env{PATH}. The linker used by GCC can be printed using @samp{which
23433 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
23434 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23437 @opindex mno-long-calls
23438 @opindex mlong-calls
23439 Generate code that uses long call sequences. This ensures that a call
23440 is always able to reach linker generated stubs. The default is to generate
23441 long calls only when the distance from the call site to the beginning
23442 of the function or translation unit, as the case may be, exceeds a
23443 predefined limit set by the branch type being used. The limits for
23444 normal calls are 7,600,000 and 240,000 bytes, respectively for the
23445 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
23448 Distances are measured from the beginning of functions when using the
23449 @option{-ffunction-sections} option, or when using the @option{-mgas}
23450 and @option{-mno-portable-runtime} options together under HP-UX with
23453 It is normally not desirable to use this option as it degrades
23454 performance. However, it may be useful in large applications,
23455 particularly when partial linking is used to build the application.
23457 The types of long calls used depends on the capabilities of the
23458 assembler and linker, and the type of code being generated. The
23459 impact on systems that support long absolute calls, and long pic
23460 symbol-difference or pc-relative calls should be relatively small.
23461 However, an indirect call is used on 32-bit ELF systems in pic code
23462 and it is quite long.
23464 @item -munix=@var{unix-std}
23466 Generate compiler predefines and select a startfile for the specified
23467 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
23468 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
23469 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
23470 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
23471 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
23474 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
23475 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
23476 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
23477 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
23478 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
23479 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
23481 It is @emph{important} to note that this option changes the interfaces
23482 for various library routines. It also affects the operational behavior
23483 of the C library. Thus, @emph{extreme} care is needed in using this
23486 Library code that is intended to operate with more than one UNIX
23487 standard must test, set and restore the variable @code{__xpg4_extended_mask}
23488 as appropriate. Most GNU software doesn't provide this capability.
23492 Suppress the generation of link options to search libdld.sl when the
23493 @option{-static} option is specified on HP-UX 10 and later.
23497 The HP-UX implementation of setlocale in libc has a dependency on
23498 libdld.sl. There isn't an archive version of libdld.sl. Thus,
23499 when the @option{-static} option is specified, special link options
23500 are needed to resolve this dependency.
23502 On HP-UX 10 and later, the GCC driver adds the necessary options to
23503 link with libdld.sl when the @option{-static} option is specified.
23504 This causes the resulting binary to be dynamic. On the 64-bit port,
23505 the linkers generate dynamic binaries by default in any case. The
23506 @option{-nolibdld} option can be used to prevent the GCC driver from
23507 adding these link options.
23511 Add support for multithreading with the @dfn{dce thread} library
23512 under HP-UX@. This option sets flags for both the preprocessor and
23516 @node IA-64 Options
23517 @subsection IA-64 Options
23518 @cindex IA-64 Options
23520 These are the @samp{-m} options defined for the Intel IA-64 architecture.
23524 @opindex mbig-endian
23525 Generate code for a big-endian target. This is the default for HP-UX@.
23527 @item -mlittle-endian
23528 @opindex mlittle-endian
23529 Generate code for a little-endian target. This is the default for AIX5
23535 @opindex mno-gnu-as
23536 Generate (or don't) code for the GNU assembler. This is the default.
23537 @c Also, this is the default if the configure option @option{--with-gnu-as}
23543 @opindex mno-gnu-ld
23544 Generate (or don't) code for the GNU linker. This is the default.
23545 @c Also, this is the default if the configure option @option{--with-gnu-ld}
23550 Generate code that does not use a global pointer register. The result
23551 is not position independent code, and violates the IA-64 ABI@.
23553 @item -mvolatile-asm-stop
23554 @itemx -mno-volatile-asm-stop
23555 @opindex mvolatile-asm-stop
23556 @opindex mno-volatile-asm-stop
23557 Generate (or don't) a stop bit immediately before and after volatile asm
23560 @item -mregister-names
23561 @itemx -mno-register-names
23562 @opindex mregister-names
23563 @opindex mno-register-names
23564 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
23565 the stacked registers. This may make assembler output more readable.
23571 Disable (or enable) optimizations that use the small data section. This may
23572 be useful for working around optimizer bugs.
23574 @item -mconstant-gp
23575 @opindex mconstant-gp
23576 Generate code that uses a single constant global pointer value. This is
23577 useful when compiling kernel code.
23581 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
23582 This is useful when compiling firmware code.
23584 @item -minline-float-divide-min-latency
23585 @opindex minline-float-divide-min-latency
23586 Generate code for inline divides of floating-point values
23587 using the minimum latency algorithm.
23589 @item -minline-float-divide-max-throughput
23590 @opindex minline-float-divide-max-throughput
23591 Generate code for inline divides of floating-point values
23592 using the maximum throughput algorithm.
23594 @item -mno-inline-float-divide
23595 @opindex mno-inline-float-divide
23596 Do not generate inline code for divides of floating-point values.
23598 @item -minline-int-divide-min-latency
23599 @opindex minline-int-divide-min-latency
23600 Generate code for inline divides of integer values
23601 using the minimum latency algorithm.
23603 @item -minline-int-divide-max-throughput
23604 @opindex minline-int-divide-max-throughput
23605 Generate code for inline divides of integer values
23606 using the maximum throughput algorithm.
23608 @item -mno-inline-int-divide
23609 @opindex mno-inline-int-divide
23610 @opindex minline-int-divide
23611 Do not generate inline code for divides of integer values.
23613 @item -minline-sqrt-min-latency
23614 @opindex minline-sqrt-min-latency
23615 Generate code for inline square roots
23616 using the minimum latency algorithm.
23618 @item -minline-sqrt-max-throughput
23619 @opindex minline-sqrt-max-throughput
23620 Generate code for inline square roots
23621 using the maximum throughput algorithm.
23623 @item -mno-inline-sqrt
23624 @opindex mno-inline-sqrt
23625 Do not generate inline code for @code{sqrt}.
23628 @itemx -mno-fused-madd
23629 @opindex mfused-madd
23630 @opindex mno-fused-madd
23631 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
23632 instructions. The default is to use these instructions.
23634 @item -mno-dwarf2-asm
23635 @itemx -mdwarf2-asm
23636 @opindex mno-dwarf2-asm
23637 @opindex mdwarf2-asm
23638 Don't (or do) generate assembler code for the DWARF line number debugging
23639 info. This may be useful when not using the GNU assembler.
23641 @item -mearly-stop-bits
23642 @itemx -mno-early-stop-bits
23643 @opindex mearly-stop-bits
23644 @opindex mno-early-stop-bits
23645 Allow stop bits to be placed earlier than immediately preceding the
23646 instruction that triggered the stop bit. This can improve instruction
23647 scheduling, but does not always do so.
23649 @item -mfixed-range=@var{register-range}
23650 @opindex mfixed-range
23651 Generate code treating the given register range as fixed registers.
23652 A fixed register is one that the register allocator cannot use. This is
23653 useful when compiling kernel code. A register range is specified as
23654 two registers separated by a dash. Multiple register ranges can be
23655 specified separated by a comma.
23657 @item -mtls-size=@var{tls-size}
23659 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
23662 @item -mtune=@var{cpu-type}
23664 Tune the instruction scheduling for a particular CPU, Valid values are
23665 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
23666 and @samp{mckinley}.
23672 Generate code for a 32-bit or 64-bit environment.
23673 The 32-bit environment sets int, long and pointer to 32 bits.
23674 The 64-bit environment sets int to 32 bits and long and pointer
23675 to 64 bits. These are HP-UX specific flags.
23677 @item -mno-sched-br-data-spec
23678 @itemx -msched-br-data-spec
23679 @opindex mno-sched-br-data-spec
23680 @opindex msched-br-data-spec
23681 (Dis/En)able data speculative scheduling before reload.
23682 This results in generation of @code{ld.a} instructions and
23683 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23684 The default setting is disabled.
23686 @item -msched-ar-data-spec
23687 @itemx -mno-sched-ar-data-spec
23688 @opindex msched-ar-data-spec
23689 @opindex mno-sched-ar-data-spec
23690 (En/Dis)able data speculative scheduling after reload.
23691 This results in generation of @code{ld.a} instructions and
23692 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23693 The default setting is enabled.
23695 @item -mno-sched-control-spec
23696 @itemx -msched-control-spec
23697 @opindex mno-sched-control-spec
23698 @opindex msched-control-spec
23699 (Dis/En)able control speculative scheduling. This feature is
23700 available only during region scheduling (i.e.@: before reload).
23701 This results in generation of the @code{ld.s} instructions and
23702 the corresponding check instructions @code{chk.s}.
23703 The default setting is disabled.
23705 @item -msched-br-in-data-spec
23706 @itemx -mno-sched-br-in-data-spec
23707 @opindex msched-br-in-data-spec
23708 @opindex mno-sched-br-in-data-spec
23709 (En/Dis)able speculative scheduling of the instructions that
23710 are dependent on the data speculative loads before reload.
23711 This is effective only with @option{-msched-br-data-spec} enabled.
23712 The default setting is enabled.
23714 @item -msched-ar-in-data-spec
23715 @itemx -mno-sched-ar-in-data-spec
23716 @opindex msched-ar-in-data-spec
23717 @opindex mno-sched-ar-in-data-spec
23718 (En/Dis)able speculative scheduling of the instructions that
23719 are dependent on the data speculative loads after reload.
23720 This is effective only with @option{-msched-ar-data-spec} enabled.
23721 The default setting is enabled.
23723 @item -msched-in-control-spec
23724 @itemx -mno-sched-in-control-spec
23725 @opindex msched-in-control-spec
23726 @opindex mno-sched-in-control-spec
23727 (En/Dis)able speculative scheduling of the instructions that
23728 are dependent on the control speculative loads.
23729 This is effective only with @option{-msched-control-spec} enabled.
23730 The default setting is enabled.
23732 @item -mno-sched-prefer-non-data-spec-insns
23733 @itemx -msched-prefer-non-data-spec-insns
23734 @opindex mno-sched-prefer-non-data-spec-insns
23735 @opindex msched-prefer-non-data-spec-insns
23736 If enabled, data-speculative instructions are chosen for schedule
23737 only if there are no other choices at the moment. This makes
23738 the use of the data speculation much more conservative.
23739 The default setting is disabled.
23741 @item -mno-sched-prefer-non-control-spec-insns
23742 @itemx -msched-prefer-non-control-spec-insns
23743 @opindex mno-sched-prefer-non-control-spec-insns
23744 @opindex msched-prefer-non-control-spec-insns
23745 If enabled, control-speculative instructions are chosen for schedule
23746 only if there are no other choices at the moment. This makes
23747 the use of the control speculation much more conservative.
23748 The default setting is disabled.
23750 @item -mno-sched-count-spec-in-critical-path
23751 @itemx -msched-count-spec-in-critical-path
23752 @opindex mno-sched-count-spec-in-critical-path
23753 @opindex msched-count-spec-in-critical-path
23754 If enabled, speculative dependencies are considered during
23755 computation of the instructions priorities. This makes the use of the
23756 speculation a bit more conservative.
23757 The default setting is disabled.
23759 @item -msched-spec-ldc
23760 @opindex msched-spec-ldc
23761 Use a simple data speculation check. This option is on by default.
23763 @item -msched-control-spec-ldc
23764 @opindex msched-spec-ldc
23765 Use a simple check for control speculation. This option is on by default.
23767 @item -msched-stop-bits-after-every-cycle
23768 @opindex msched-stop-bits-after-every-cycle
23769 Place a stop bit after every cycle when scheduling. This option is on
23772 @item -msched-fp-mem-deps-zero-cost
23773 @opindex msched-fp-mem-deps-zero-cost
23774 Assume that floating-point stores and loads are not likely to cause a conflict
23775 when placed into the same instruction group. This option is disabled by
23778 @item -msel-sched-dont-check-control-spec
23779 @opindex msel-sched-dont-check-control-spec
23780 Generate checks for control speculation in selective scheduling.
23781 This flag is disabled by default.
23783 @item -msched-max-memory-insns=@var{max-insns}
23784 @opindex msched-max-memory-insns
23785 Limit on the number of memory insns per instruction group, giving lower
23786 priority to subsequent memory insns attempting to schedule in the same
23787 instruction group. Frequently useful to prevent cache bank conflicts.
23788 The default value is 1.
23790 @item -msched-max-memory-insns-hard-limit
23791 @opindex msched-max-memory-insns-hard-limit
23792 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
23793 disallowing more than that number in an instruction group.
23794 Otherwise, the limit is ``soft'', meaning that non-memory operations
23795 are preferred when the limit is reached, but memory operations may still
23801 @subsection LM32 Options
23802 @cindex LM32 options
23804 These @option{-m} options are defined for the LatticeMico32 architecture:
23807 @item -mbarrel-shift-enabled
23808 @opindex mbarrel-shift-enabled
23809 Enable barrel-shift instructions.
23811 @item -mdivide-enabled
23812 @opindex mdivide-enabled
23813 Enable divide and modulus instructions.
23815 @item -mmultiply-enabled
23816 @opindex multiply-enabled
23817 Enable multiply instructions.
23819 @item -msign-extend-enabled
23820 @opindex msign-extend-enabled
23821 Enable sign extend instructions.
23823 @item -muser-enabled
23824 @opindex muser-enabled
23825 Enable user-defined instructions.
23830 @subsection M32C Options
23831 @cindex M32C options
23834 @item -mcpu=@var{name}
23836 Select the CPU for which code is generated. @var{name} may be one of
23837 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
23838 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
23839 the M32C/80 series.
23843 Specifies that the program will be run on the simulator. This causes
23844 an alternate runtime library to be linked in which supports, for
23845 example, file I/O@. You must not use this option when generating
23846 programs that will run on real hardware; you must provide your own
23847 runtime library for whatever I/O functions are needed.
23849 @item -memregs=@var{number}
23851 Specifies the number of memory-based pseudo-registers GCC uses
23852 during code generation. These pseudo-registers are used like real
23853 registers, so there is a tradeoff between GCC's ability to fit the
23854 code into available registers, and the performance penalty of using
23855 memory instead of registers. Note that all modules in a program must
23856 be compiled with the same value for this option. Because of that, you
23857 must not use this option with GCC's default runtime libraries.
23861 @node M32R/D Options
23862 @subsection M32R/D Options
23863 @cindex M32R/D options
23865 These @option{-m} options are defined for Renesas M32R/D architectures:
23870 Generate code for the M32R/2@.
23874 Generate code for the M32R/X@.
23878 Generate code for the M32R@. This is the default.
23880 @item -mmodel=small
23881 @opindex mmodel=small
23882 Assume all objects live in the lower 16MB of memory (so that their addresses
23883 can be loaded with the @code{ld24} instruction), and assume all subroutines
23884 are reachable with the @code{bl} instruction.
23885 This is the default.
23887 The addressability of a particular object can be set with the
23888 @code{model} attribute.
23890 @item -mmodel=medium
23891 @opindex mmodel=medium
23892 Assume objects may be anywhere in the 32-bit address space (the compiler
23893 generates @code{seth/add3} instructions to load their addresses), and
23894 assume all subroutines are reachable with the @code{bl} instruction.
23896 @item -mmodel=large
23897 @opindex mmodel=large
23898 Assume objects may be anywhere in the 32-bit address space (the compiler
23899 generates @code{seth/add3} instructions to load their addresses), and
23900 assume subroutines may not be reachable with the @code{bl} instruction
23901 (the compiler generates the much slower @code{seth/add3/jl}
23902 instruction sequence).
23905 @opindex msdata=none
23906 Disable use of the small data area. Variables are put into
23907 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
23908 @code{section} attribute has been specified).
23909 This is the default.
23911 The small data area consists of sections @code{.sdata} and @code{.sbss}.
23912 Objects may be explicitly put in the small data area with the
23913 @code{section} attribute using one of these sections.
23915 @item -msdata=sdata
23916 @opindex msdata=sdata
23917 Put small global and static data in the small data area, but do not
23918 generate special code to reference them.
23921 @opindex msdata=use
23922 Put small global and static data in the small data area, and generate
23923 special instructions to reference them.
23927 @cindex smaller data references
23928 Put global and static objects less than or equal to @var{num} bytes
23929 into the small data or BSS sections instead of the normal data or BSS
23930 sections. The default value of @var{num} is 8.
23931 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
23932 for this option to have any effect.
23934 All modules should be compiled with the same @option{-G @var{num}} value.
23935 Compiling with different values of @var{num} may or may not work; if it
23936 doesn't the linker gives an error message---incorrect code is not
23941 Makes the M32R-specific code in the compiler display some statistics
23942 that might help in debugging programs.
23944 @item -malign-loops
23945 @opindex malign-loops
23946 Align all loops to a 32-byte boundary.
23948 @item -mno-align-loops
23949 @opindex mno-align-loops
23950 Do not enforce a 32-byte alignment for loops. This is the default.
23952 @item -missue-rate=@var{number}
23953 @opindex missue-rate=@var{number}
23954 Issue @var{number} instructions per cycle. @var{number} can only be 1
23957 @item -mbranch-cost=@var{number}
23958 @opindex mbranch-cost=@var{number}
23959 @var{number} can only be 1 or 2. If it is 1 then branches are
23960 preferred over conditional code, if it is 2, then the opposite applies.
23962 @item -mflush-trap=@var{number}
23963 @opindex mflush-trap=@var{number}
23964 Specifies the trap number to use to flush the cache. The default is
23965 12. Valid numbers are between 0 and 15 inclusive.
23967 @item -mno-flush-trap
23968 @opindex mno-flush-trap
23969 Specifies that the cache cannot be flushed by using a trap.
23971 @item -mflush-func=@var{name}
23972 @opindex mflush-func=@var{name}
23973 Specifies the name of the operating system function to call to flush
23974 the cache. The default is @samp{_flush_cache}, but a function call
23975 is only used if a trap is not available.
23977 @item -mno-flush-func
23978 @opindex mno-flush-func
23979 Indicates that there is no OS function for flushing the cache.
23983 @node M680x0 Options
23984 @subsection M680x0 Options
23985 @cindex M680x0 options
23987 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
23988 The default settings depend on which architecture was selected when
23989 the compiler was configured; the defaults for the most common choices
23993 @item -march=@var{arch}
23995 Generate code for a specific M680x0 or ColdFire instruction set
23996 architecture. Permissible values of @var{arch} for M680x0
23997 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
23998 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
23999 architectures are selected according to Freescale's ISA classification
24000 and the permissible values are: @samp{isaa}, @samp{isaaplus},
24001 @samp{isab} and @samp{isac}.
24003 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
24004 code for a ColdFire target. The @var{arch} in this macro is one of the
24005 @option{-march} arguments given above.
24007 When used together, @option{-march} and @option{-mtune} select code
24008 that runs on a family of similar processors but that is optimized
24009 for a particular microarchitecture.
24011 @item -mcpu=@var{cpu}
24013 Generate code for a specific M680x0 or ColdFire processor.
24014 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
24015 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
24016 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
24017 below, which also classifies the CPUs into families:
24019 @multitable @columnfractions 0.20 0.80
24020 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
24021 @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}
24022 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
24023 @item @samp{5206e} @tab @samp{5206e}
24024 @item @samp{5208} @tab @samp{5207} @samp{5208}
24025 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
24026 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
24027 @item @samp{5216} @tab @samp{5214} @samp{5216}
24028 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
24029 @item @samp{5225} @tab @samp{5224} @samp{5225}
24030 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
24031 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
24032 @item @samp{5249} @tab @samp{5249}
24033 @item @samp{5250} @tab @samp{5250}
24034 @item @samp{5271} @tab @samp{5270} @samp{5271}
24035 @item @samp{5272} @tab @samp{5272}
24036 @item @samp{5275} @tab @samp{5274} @samp{5275}
24037 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
24038 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
24039 @item @samp{5307} @tab @samp{5307}
24040 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
24041 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
24042 @item @samp{5407} @tab @samp{5407}
24043 @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}
24046 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
24047 @var{arch} is compatible with @var{cpu}. Other combinations of
24048 @option{-mcpu} and @option{-march} are rejected.
24050 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
24051 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
24052 where the value of @var{family} is given by the table above.
24054 @item -mtune=@var{tune}
24056 Tune the code for a particular microarchitecture within the
24057 constraints set by @option{-march} and @option{-mcpu}.
24058 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
24059 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
24060 and @samp{cpu32}. The ColdFire microarchitectures
24061 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
24063 You can also use @option{-mtune=68020-40} for code that needs
24064 to run relatively well on 68020, 68030 and 68040 targets.
24065 @option{-mtune=68020-60} is similar but includes 68060 targets
24066 as well. These two options select the same tuning decisions as
24067 @option{-m68020-40} and @option{-m68020-60} respectively.
24069 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
24070 when tuning for 680x0 architecture @var{arch}. It also defines
24071 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
24072 option is used. If GCC is tuning for a range of architectures,
24073 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
24074 it defines the macros for every architecture in the range.
24076 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
24077 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
24078 of the arguments given above.
24084 Generate output for a 68000. This is the default
24085 when the compiler is configured for 68000-based systems.
24086 It is equivalent to @option{-march=68000}.
24088 Use this option for microcontrollers with a 68000 or EC000 core,
24089 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
24093 Generate output for a 68010. This is the default
24094 when the compiler is configured for 68010-based systems.
24095 It is equivalent to @option{-march=68010}.
24101 Generate output for a 68020. This is the default
24102 when the compiler is configured for 68020-based systems.
24103 It is equivalent to @option{-march=68020}.
24107 Generate output for a 68030. This is the default when the compiler is
24108 configured for 68030-based systems. It is equivalent to
24109 @option{-march=68030}.
24113 Generate output for a 68040. This is the default when the compiler is
24114 configured for 68040-based systems. It is equivalent to
24115 @option{-march=68040}.
24117 This option inhibits the use of 68881/68882 instructions that have to be
24118 emulated by software on the 68040. Use this option if your 68040 does not
24119 have code to emulate those instructions.
24123 Generate output for a 68060. This is the default when the compiler is
24124 configured for 68060-based systems. It is equivalent to
24125 @option{-march=68060}.
24127 This option inhibits the use of 68020 and 68881/68882 instructions that
24128 have to be emulated by software on the 68060. Use this option if your 68060
24129 does not have code to emulate those instructions.
24133 Generate output for a CPU32. This is the default
24134 when the compiler is configured for CPU32-based systems.
24135 It is equivalent to @option{-march=cpu32}.
24137 Use this option for microcontrollers with a
24138 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
24139 68336, 68340, 68341, 68349 and 68360.
24143 Generate output for a 520X ColdFire CPU@. This is the default
24144 when the compiler is configured for 520X-based systems.
24145 It is equivalent to @option{-mcpu=5206}, and is now deprecated
24146 in favor of that option.
24148 Use this option for microcontroller with a 5200 core, including
24149 the MCF5202, MCF5203, MCF5204 and MCF5206.
24153 Generate output for a 5206e ColdFire CPU@. The option is now
24154 deprecated in favor of the equivalent @option{-mcpu=5206e}.
24158 Generate output for a member of the ColdFire 528X family.
24159 The option is now deprecated in favor of the equivalent
24160 @option{-mcpu=528x}.
24164 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
24165 in favor of the equivalent @option{-mcpu=5307}.
24169 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
24170 in favor of the equivalent @option{-mcpu=5407}.
24174 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
24175 This includes use of hardware floating-point instructions.
24176 The option is equivalent to @option{-mcpu=547x}, and is now
24177 deprecated in favor of that option.
24181 Generate output for a 68040, without using any of the new instructions.
24182 This results in code that can run relatively efficiently on either a
24183 68020/68881 or a 68030 or a 68040. The generated code does use the
24184 68881 instructions that are emulated on the 68040.
24186 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
24190 Generate output for a 68060, without using any of the new instructions.
24191 This results in code that can run relatively efficiently on either a
24192 68020/68881 or a 68030 or a 68040. The generated code does use the
24193 68881 instructions that are emulated on the 68060.
24195 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
24199 @opindex mhard-float
24201 Generate floating-point instructions. This is the default for 68020
24202 and above, and for ColdFire devices that have an FPU@. It defines the
24203 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
24204 on ColdFire targets.
24207 @opindex msoft-float
24208 Do not generate floating-point instructions; use library calls instead.
24209 This is the default for 68000, 68010, and 68832 targets. It is also
24210 the default for ColdFire devices that have no FPU.
24216 Generate (do not generate) ColdFire hardware divide and remainder
24217 instructions. If @option{-march} is used without @option{-mcpu},
24218 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
24219 architectures. Otherwise, the default is taken from the target CPU
24220 (either the default CPU, or the one specified by @option{-mcpu}). For
24221 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
24222 @option{-mcpu=5206e}.
24224 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
24228 Consider type @code{int} to be 16 bits wide, like @code{short int}.
24229 Additionally, parameters passed on the stack are also aligned to a
24230 16-bit boundary even on targets whose API mandates promotion to 32-bit.
24234 Do not consider type @code{int} to be 16 bits wide. This is the default.
24237 @itemx -mno-bitfield
24238 @opindex mnobitfield
24239 @opindex mno-bitfield
24240 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
24241 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
24245 Do use the bit-field instructions. The @option{-m68020} option implies
24246 @option{-mbitfield}. This is the default if you use a configuration
24247 designed for a 68020.
24251 Use a different function-calling convention, in which functions
24252 that take a fixed number of arguments return with the @code{rtd}
24253 instruction, which pops their arguments while returning. This
24254 saves one instruction in the caller since there is no need to pop
24255 the arguments there.
24257 This calling convention is incompatible with the one normally
24258 used on Unix, so you cannot use it if you need to call libraries
24259 compiled with the Unix compiler.
24261 Also, you must provide function prototypes for all functions that
24262 take variable numbers of arguments (including @code{printf});
24263 otherwise incorrect code is generated for calls to those
24266 In addition, seriously incorrect code results if you call a
24267 function with too many arguments. (Normally, extra arguments are
24268 harmlessly ignored.)
24270 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
24271 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
24273 The default is @option{-mno-rtd}.
24276 @itemx -mno-align-int
24277 @opindex malign-int
24278 @opindex mno-align-int
24279 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
24280 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
24281 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
24282 Aligning variables on 32-bit boundaries produces code that runs somewhat
24283 faster on processors with 32-bit busses at the expense of more memory.
24285 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
24286 aligns structures containing the above types differently than
24287 most published application binary interface specifications for the m68k.
24290 Use the pc-relative addressing mode of the 68000 directly, instead of
24291 using a global offset table. At present, this option implies @option{-fpic},
24292 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
24293 not presently supported with @option{-mpcrel}, though this could be supported for
24294 68020 and higher processors.
24296 @item -mno-strict-align
24297 @itemx -mstrict-align
24298 @opindex mno-strict-align
24299 @opindex mstrict-align
24300 Do not (do) assume that unaligned memory references are handled by
24304 Generate code that allows the data segment to be located in a different
24305 area of memory from the text segment. This allows for execute-in-place in
24306 an environment without virtual memory management. This option implies
24309 @item -mno-sep-data
24310 Generate code that assumes that the data segment follows the text segment.
24311 This is the default.
24313 @item -mid-shared-library
24314 Generate code that supports shared libraries via the library ID method.
24315 This allows for execute-in-place and shared libraries in an environment
24316 without virtual memory management. This option implies @option{-fPIC}.
24318 @item -mno-id-shared-library
24319 Generate code that doesn't assume ID-based shared libraries are being used.
24320 This is the default.
24322 @item -mshared-library-id=n
24323 Specifies the identification number of the ID-based shared library being
24324 compiled. Specifying a value of 0 generates more compact code; specifying
24325 other values forces the allocation of that number to the current
24326 library, but is no more space- or time-efficient than omitting this option.
24332 When generating position-independent code for ColdFire, generate code
24333 that works if the GOT has more than 8192 entries. This code is
24334 larger and slower than code generated without this option. On M680x0
24335 processors, this option is not needed; @option{-fPIC} suffices.
24337 GCC normally uses a single instruction to load values from the GOT@.
24338 While this is relatively efficient, it only works if the GOT
24339 is smaller than about 64k. Anything larger causes the linker
24340 to report an error such as:
24342 @cindex relocation truncated to fit (ColdFire)
24344 relocation truncated to fit: R_68K_GOT16O foobar
24347 If this happens, you should recompile your code with @option{-mxgot}.
24348 It should then work with very large GOTs. However, code generated with
24349 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
24350 the value of a global symbol.
24352 Note that some linkers, including newer versions of the GNU linker,
24353 can create multiple GOTs and sort GOT entries. If you have such a linker,
24354 you should only need to use @option{-mxgot} when compiling a single
24355 object file that accesses more than 8192 GOT entries. Very few do.
24357 These options have no effect unless GCC is generating
24358 position-independent code.
24360 @item -mlong-jump-table-offsets
24361 @opindex mlong-jump-table-offsets
24362 Use 32-bit offsets in @code{switch} tables. The default is to use
24367 @node MCore Options
24368 @subsection MCore Options
24369 @cindex MCore options
24371 These are the @samp{-m} options defined for the Motorola M*Core
24377 @itemx -mno-hardlit
24379 @opindex mno-hardlit
24380 Inline constants into the code stream if it can be done in two
24381 instructions or less.
24387 Use the divide instruction. (Enabled by default).
24389 @item -mrelax-immediate
24390 @itemx -mno-relax-immediate
24391 @opindex mrelax-immediate
24392 @opindex mno-relax-immediate
24393 Allow arbitrary-sized immediates in bit operations.
24395 @item -mwide-bitfields
24396 @itemx -mno-wide-bitfields
24397 @opindex mwide-bitfields
24398 @opindex mno-wide-bitfields
24399 Always treat bit-fields as @code{int}-sized.
24401 @item -m4byte-functions
24402 @itemx -mno-4byte-functions
24403 @opindex m4byte-functions
24404 @opindex mno-4byte-functions
24405 Force all functions to be aligned to a 4-byte boundary.
24407 @item -mcallgraph-data
24408 @itemx -mno-callgraph-data
24409 @opindex mcallgraph-data
24410 @opindex mno-callgraph-data
24411 Emit callgraph information.
24414 @itemx -mno-slow-bytes
24415 @opindex mslow-bytes
24416 @opindex mno-slow-bytes
24417 Prefer word access when reading byte quantities.
24419 @item -mlittle-endian
24420 @itemx -mbig-endian
24421 @opindex mlittle-endian
24422 @opindex mbig-endian
24423 Generate code for a little-endian target.
24429 Generate code for the 210 processor.
24433 Assume that runtime support has been provided and so omit the
24434 simulator library (@file{libsim.a)} from the linker command line.
24436 @item -mstack-increment=@var{size}
24437 @opindex mstack-increment
24438 Set the maximum amount for a single stack increment operation. Large
24439 values can increase the speed of programs that contain functions
24440 that need a large amount of stack space, but they can also trigger a
24441 segmentation fault if the stack is extended too much. The default
24447 @subsection MeP Options
24448 @cindex MeP options
24454 Enables the @code{abs} instruction, which is the absolute difference
24455 between two registers.
24459 Enables all the optional instructions---average, multiply, divide, bit
24460 operations, leading zero, absolute difference, min/max, clip, and
24466 Enables the @code{ave} instruction, which computes the average of two
24469 @item -mbased=@var{n}
24471 Variables of size @var{n} bytes or smaller are placed in the
24472 @code{.based} section by default. Based variables use the @code{$tp}
24473 register as a base register, and there is a 128-byte limit to the
24474 @code{.based} section.
24478 Enables the bit operation instructions---bit test (@code{btstm}), set
24479 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
24480 test-and-set (@code{tas}).
24482 @item -mc=@var{name}
24484 Selects which section constant data is placed in. @var{name} may
24485 be @samp{tiny}, @samp{near}, or @samp{far}.
24489 Enables the @code{clip} instruction. Note that @option{-mclip} is not
24490 useful unless you also provide @option{-mminmax}.
24492 @item -mconfig=@var{name}
24494 Selects one of the built-in core configurations. Each MeP chip has
24495 one or more modules in it; each module has a core CPU and a variety of
24496 coprocessors, optional instructions, and peripherals. The
24497 @code{MeP-Integrator} tool, not part of GCC, provides these
24498 configurations through this option; using this option is the same as
24499 using all the corresponding command-line options. The default
24500 configuration is @samp{default}.
24504 Enables the coprocessor instructions. By default, this is a 32-bit
24505 coprocessor. Note that the coprocessor is normally enabled via the
24506 @option{-mconfig=} option.
24510 Enables the 32-bit coprocessor's instructions.
24514 Enables the 64-bit coprocessor's instructions.
24518 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
24522 Causes constant variables to be placed in the @code{.near} section.
24526 Enables the @code{div} and @code{divu} instructions.
24530 Generate big-endian code.
24534 Generate little-endian code.
24536 @item -mio-volatile
24537 @opindex mio-volatile
24538 Tells the compiler that any variable marked with the @code{io}
24539 attribute is to be considered volatile.
24543 Causes variables to be assigned to the @code{.far} section by default.
24547 Enables the @code{leadz} (leading zero) instruction.
24551 Causes variables to be assigned to the @code{.near} section by default.
24555 Enables the @code{min} and @code{max} instructions.
24559 Enables the multiplication and multiply-accumulate instructions.
24563 Disables all the optional instructions enabled by @option{-mall-opts}.
24567 Enables the @code{repeat} and @code{erepeat} instructions, used for
24568 low-overhead looping.
24572 Causes all variables to default to the @code{.tiny} section. Note
24573 that there is a 65536-byte limit to this section. Accesses to these
24574 variables use the @code{%gp} base register.
24578 Enables the saturation instructions. Note that the compiler does not
24579 currently generate these itself, but this option is included for
24580 compatibility with other tools, like @code{as}.
24584 Link the SDRAM-based runtime instead of the default ROM-based runtime.
24588 Link the simulator run-time libraries.
24592 Link the simulator runtime libraries, excluding built-in support
24593 for reset and exception vectors and tables.
24597 Causes all functions to default to the @code{.far} section. Without
24598 this option, functions default to the @code{.near} section.
24600 @item -mtiny=@var{n}
24602 Variables that are @var{n} bytes or smaller are allocated to the
24603 @code{.tiny} section. These variables use the @code{$gp} base
24604 register. The default for this option is 4, but note that there's a
24605 65536-byte limit to the @code{.tiny} section.
24609 @node MicroBlaze Options
24610 @subsection MicroBlaze Options
24611 @cindex MicroBlaze Options
24616 @opindex msoft-float
24617 Use software emulation for floating point (default).
24620 @opindex mhard-float
24621 Use hardware floating-point instructions.
24625 Do not optimize block moves, use @code{memcpy}.
24627 @item -mno-clearbss
24628 @opindex mno-clearbss
24629 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
24631 @item -mcpu=@var{cpu-type}
24633 Use features of, and schedule code for, the given CPU.
24634 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
24635 where @var{X} is a major version, @var{YY} is the minor version, and
24636 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
24637 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
24639 @item -mxl-soft-mul
24640 @opindex mxl-soft-mul
24641 Use software multiply emulation (default).
24643 @item -mxl-soft-div
24644 @opindex mxl-soft-div
24645 Use software emulation for divides (default).
24647 @item -mxl-barrel-shift
24648 @opindex mxl-barrel-shift
24649 Use the hardware barrel shifter.
24651 @item -mxl-pattern-compare
24652 @opindex mxl-pattern-compare
24653 Use pattern compare instructions.
24655 @item -msmall-divides
24656 @opindex msmall-divides
24657 Use table lookup optimization for small signed integer divisions.
24659 @item -mxl-stack-check
24660 @opindex mxl-stack-check
24661 This option is deprecated. Use @option{-fstack-check} instead.
24664 @opindex mxl-gp-opt
24665 Use GP-relative @code{.sdata}/@code{.sbss} sections.
24667 @item -mxl-multiply-high
24668 @opindex mxl-multiply-high
24669 Use multiply high instructions for high part of 32x32 multiply.
24671 @item -mxl-float-convert
24672 @opindex mxl-float-convert
24673 Use hardware floating-point conversion instructions.
24675 @item -mxl-float-sqrt
24676 @opindex mxl-float-sqrt
24677 Use hardware floating-point square root instruction.
24680 @opindex mbig-endian
24681 Generate code for a big-endian target.
24683 @item -mlittle-endian
24684 @opindex mlittle-endian
24685 Generate code for a little-endian target.
24688 @opindex mxl-reorder
24689 Use reorder instructions (swap and byte reversed load/store).
24691 @item -mxl-mode-@var{app-model}
24692 Select application model @var{app-model}. Valid models are
24695 normal executable (default), uses startup code @file{crt0.o}.
24698 for use with Xilinx Microprocessor Debugger (XMD) based
24699 software intrusive debug agent called xmdstub. This uses startup file
24700 @file{crt1.o} and sets the start address of the program to 0x800.
24703 for applications that are loaded using a bootloader.
24704 This model uses startup file @file{crt2.o} which does not contain a processor
24705 reset vector handler. This is suitable for transferring control on a
24706 processor reset to the bootloader rather than the application.
24709 for applications that do not require any of the
24710 MicroBlaze vectors. This option may be useful for applications running
24711 within a monitoring application. This model uses @file{crt3.o} as a startup file.
24714 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
24715 @option{-mxl-mode-@var{app-model}}.
24717 @item -mpic-data-is-text-relative
24718 @opindex mpic-data-is-text-relative
24719 Assume that the displacement between the text and data segments is fixed
24720 at static link time. This allows data to be referenced by offset from start of
24721 text address instead of GOT since PC-relative addressing is not supported.
24726 @subsection MIPS Options
24727 @cindex MIPS options
24733 Generate big-endian code.
24737 Generate little-endian code. This is the default for @samp{mips*el-*-*}
24740 @item -march=@var{arch}
24742 Generate code that runs on @var{arch}, which can be the name of a
24743 generic MIPS ISA, or the name of a particular processor.
24745 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
24746 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
24747 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
24748 @samp{mips64r5} and @samp{mips64r6}.
24749 The processor names are:
24750 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
24751 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
24752 @samp{5kc}, @samp{5kf},
24754 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
24755 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
24756 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
24757 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
24758 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
24759 @samp{i6400}, @samp{i6500},
24761 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
24762 @samp{gs464e}, @samp{gs264e},
24764 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
24765 @samp{m5100}, @samp{m5101},
24766 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
24768 @samp{p5600}, @samp{p6600},
24769 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
24770 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
24771 @samp{r6000}, @samp{r8000},
24772 @samp{rm7000}, @samp{rm9000},
24773 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
24776 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
24777 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
24778 @samp{xlr} and @samp{xlp}.
24779 The special value @samp{from-abi} selects the
24780 most compatible architecture for the selected ABI (that is,
24781 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
24783 The native Linux/GNU toolchain also supports the value @samp{native},
24784 which selects the best architecture option for the host processor.
24785 @option{-march=native} has no effect if GCC does not recognize
24788 In processor names, a final @samp{000} can be abbreviated as @samp{k}
24789 (for example, @option{-march=r2k}). Prefixes are optional, and
24790 @samp{vr} may be written @samp{r}.
24792 Names of the form @samp{@var{n}f2_1} refer to processors with
24793 FPUs clocked at half the rate of the core, names of the form
24794 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
24795 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
24796 processors with FPUs clocked a ratio of 3:2 with respect to the core.
24797 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
24798 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
24799 accepted as synonyms for @samp{@var{n}f1_1}.
24801 GCC defines two macros based on the value of this option. The first
24802 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
24803 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
24804 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
24805 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
24806 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
24808 Note that the @code{_MIPS_ARCH} macro uses the processor names given
24809 above. In other words, it has the full prefix and does not
24810 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
24811 the macro names the resolved architecture (either @code{"mips1"} or
24812 @code{"mips3"}). It names the default architecture when no
24813 @option{-march} option is given.
24815 @item -mtune=@var{arch}
24817 Optimize for @var{arch}. Among other things, this option controls
24818 the way instructions are scheduled, and the perceived cost of arithmetic
24819 operations. The list of @var{arch} values is the same as for
24822 When this option is not used, GCC optimizes for the processor
24823 specified by @option{-march}. By using @option{-march} and
24824 @option{-mtune} together, it is possible to generate code that
24825 runs on a family of processors, but optimize the code for one
24826 particular member of that family.
24828 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
24829 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
24830 @option{-march} ones described above.
24834 Equivalent to @option{-march=mips1}.
24838 Equivalent to @option{-march=mips2}.
24842 Equivalent to @option{-march=mips3}.
24846 Equivalent to @option{-march=mips4}.
24850 Equivalent to @option{-march=mips32}.
24854 Equivalent to @option{-march=mips32r3}.
24858 Equivalent to @option{-march=mips32r5}.
24862 Equivalent to @option{-march=mips32r6}.
24866 Equivalent to @option{-march=mips64}.
24870 Equivalent to @option{-march=mips64r2}.
24874 Equivalent to @option{-march=mips64r3}.
24878 Equivalent to @option{-march=mips64r5}.
24882 Equivalent to @option{-march=mips64r6}.
24887 @opindex mno-mips16
24888 Generate (do not generate) MIPS16 code. If GCC is targeting a
24889 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
24891 MIPS16 code generation can also be controlled on a per-function basis
24892 by means of @code{mips16} and @code{nomips16} attributes.
24893 @xref{Function Attributes}, for more information.
24895 @item -mflip-mips16
24896 @opindex mflip-mips16
24897 Generate MIPS16 code on alternating functions. This option is provided
24898 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
24899 not intended for ordinary use in compiling user code.
24901 @item -minterlink-compressed
24902 @itemx -mno-interlink-compressed
24903 @opindex minterlink-compressed
24904 @opindex mno-interlink-compressed
24905 Require (do not require) that code using the standard (uncompressed) MIPS ISA
24906 be link-compatible with MIPS16 and microMIPS code, and vice versa.
24908 For example, code using the standard ISA encoding cannot jump directly
24909 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
24910 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
24911 knows that the target of the jump is not compressed.
24913 @item -minterlink-mips16
24914 @itemx -mno-interlink-mips16
24915 @opindex minterlink-mips16
24916 @opindex mno-interlink-mips16
24917 Aliases of @option{-minterlink-compressed} and
24918 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
24919 and are retained for backwards compatibility.
24931 Generate code for the given ABI@.
24933 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
24934 generates 64-bit code when you select a 64-bit architecture, but you
24935 can use @option{-mgp32} to get 32-bit code instead.
24937 For information about the O64 ABI, see
24938 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
24940 GCC supports a variant of the o32 ABI in which floating-point registers
24941 are 64 rather than 32 bits wide. You can select this combination with
24942 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
24943 and @code{mfhc1} instructions and is therefore only supported for
24944 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
24946 The register assignments for arguments and return values remain the
24947 same, but each scalar value is passed in a single 64-bit register
24948 rather than a pair of 32-bit registers. For example, scalar
24949 floating-point values are returned in @samp{$f0} only, not a
24950 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
24951 remains the same in that the even-numbered double-precision registers
24954 Two additional variants of the o32 ABI are supported to enable
24955 a transition from 32-bit to 64-bit registers. These are FPXX
24956 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
24957 The FPXX extension mandates that all code must execute correctly
24958 when run using 32-bit or 64-bit registers. The code can be interlinked
24959 with either FP32 or FP64, but not both.
24960 The FP64A extension is similar to the FP64 extension but forbids the
24961 use of odd-numbered single-precision registers. This can be used
24962 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
24963 processors and allows both FP32 and FP64A code to interlink and
24964 run in the same process without changing FPU modes.
24967 @itemx -mno-abicalls
24969 @opindex mno-abicalls
24970 Generate (do not generate) code that is suitable for SVR4-style
24971 dynamic objects. @option{-mabicalls} is the default for SVR4-based
24976 Generate (do not generate) code that is fully position-independent,
24977 and that can therefore be linked into shared libraries. This option
24978 only affects @option{-mabicalls}.
24980 All @option{-mabicalls} code has traditionally been position-independent,
24981 regardless of options like @option{-fPIC} and @option{-fpic}. However,
24982 as an extension, the GNU toolchain allows executables to use absolute
24983 accesses for locally-binding symbols. It can also use shorter GP
24984 initialization sequences and generate direct calls to locally-defined
24985 functions. This mode is selected by @option{-mno-shared}.
24987 @option{-mno-shared} depends on binutils 2.16 or higher and generates
24988 objects that can only be linked by the GNU linker. However, the option
24989 does not affect the ABI of the final executable; it only affects the ABI
24990 of relocatable objects. Using @option{-mno-shared} generally makes
24991 executables both smaller and quicker.
24993 @option{-mshared} is the default.
24999 Assume (do not assume) that the static and dynamic linkers
25000 support PLTs and copy relocations. This option only affects
25001 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
25002 has no effect without @option{-msym32}.
25004 You can make @option{-mplt} the default by configuring
25005 GCC with @option{--with-mips-plt}. The default is
25006 @option{-mno-plt} otherwise.
25012 Lift (do not lift) the usual restrictions on the size of the global
25015 GCC normally uses a single instruction to load values from the GOT@.
25016 While this is relatively efficient, it only works if the GOT
25017 is smaller than about 64k. Anything larger causes the linker
25018 to report an error such as:
25020 @cindex relocation truncated to fit (MIPS)
25022 relocation truncated to fit: R_MIPS_GOT16 foobar
25025 If this happens, you should recompile your code with @option{-mxgot}.
25026 This works with very large GOTs, although the code is also
25027 less efficient, since it takes three instructions to fetch the
25028 value of a global symbol.
25030 Note that some linkers can create multiple GOTs. If you have such a
25031 linker, you should only need to use @option{-mxgot} when a single object
25032 file accesses more than 64k's worth of GOT entries. Very few do.
25034 These options have no effect unless GCC is generating position
25039 Assume that general-purpose registers are 32 bits wide.
25043 Assume that general-purpose registers are 64 bits wide.
25047 Assume that floating-point registers are 32 bits wide.
25051 Assume that floating-point registers are 64 bits wide.
25055 Do not assume the width of floating-point registers.
25058 @opindex mhard-float
25059 Use floating-point coprocessor instructions.
25062 @opindex msoft-float
25063 Do not use floating-point coprocessor instructions. Implement
25064 floating-point calculations using library calls instead.
25068 Equivalent to @option{-msoft-float}, but additionally asserts that the
25069 program being compiled does not perform any floating-point operations.
25070 This option is presently supported only by some bare-metal MIPS
25071 configurations, where it may select a special set of libraries
25072 that lack all floating-point support (including, for example, the
25073 floating-point @code{printf} formats).
25074 If code compiled with @option{-mno-float} accidentally contains
25075 floating-point operations, it is likely to suffer a link-time
25076 or run-time failure.
25078 @item -msingle-float
25079 @opindex msingle-float
25080 Assume that the floating-point coprocessor only supports single-precision
25083 @item -mdouble-float
25084 @opindex mdouble-float
25085 Assume that the floating-point coprocessor supports double-precision
25086 operations. This is the default.
25089 @itemx -mno-odd-spreg
25090 @opindex modd-spreg
25091 @opindex mno-odd-spreg
25092 Enable the use of odd-numbered single-precision floating-point registers
25093 for the o32 ABI. This is the default for processors that are known to
25094 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
25098 @itemx -mabs=legacy
25100 @opindex mabs=legacy
25101 These options control the treatment of the special not-a-number (NaN)
25102 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
25103 @code{neg.@i{fmt}} machine instructions.
25105 By default or when @option{-mabs=legacy} is used the legacy
25106 treatment is selected. In this case these instructions are considered
25107 arithmetic and avoided where correct operation is required and the
25108 input operand might be a NaN. A longer sequence of instructions that
25109 manipulate the sign bit of floating-point datum manually is used
25110 instead unless the @option{-ffinite-math-only} option has also been
25113 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
25114 this case these instructions are considered non-arithmetic and therefore
25115 operating correctly in all cases, including in particular where the
25116 input operand is a NaN. These instructions are therefore always used
25117 for the respective operations.
25120 @itemx -mnan=legacy
25122 @opindex mnan=legacy
25123 These options control the encoding of the special not-a-number (NaN)
25124 IEEE 754 floating-point data.
25126 The @option{-mnan=legacy} option selects the legacy encoding. In this
25127 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
25128 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
25129 by the first bit of their trailing significand field being 1.
25131 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
25132 this case qNaNs are denoted by the first bit of their trailing
25133 significand field being 1, whereas sNaNs are denoted by the first bit of
25134 their trailing significand field being 0.
25136 The default is @option{-mnan=legacy} unless GCC has been configured with
25137 @option{--with-nan=2008}.
25143 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
25144 implement atomic memory built-in functions. When neither option is
25145 specified, GCC uses the instructions if the target architecture
25148 @option{-mllsc} is useful if the runtime environment can emulate the
25149 instructions and @option{-mno-llsc} can be useful when compiling for
25150 nonstandard ISAs. You can make either option the default by
25151 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
25152 respectively. @option{--with-llsc} is the default for some
25153 configurations; see the installation documentation for details.
25159 Use (do not use) revision 1 of the MIPS DSP ASE@.
25160 @xref{MIPS DSP Built-in Functions}. This option defines the
25161 preprocessor macro @code{__mips_dsp}. It also defines
25162 @code{__mips_dsp_rev} to 1.
25168 Use (do not use) revision 2 of the MIPS DSP ASE@.
25169 @xref{MIPS DSP Built-in Functions}. This option defines the
25170 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
25171 It also defines @code{__mips_dsp_rev} to 2.
25174 @itemx -mno-smartmips
25175 @opindex msmartmips
25176 @opindex mno-smartmips
25177 Use (do not use) the MIPS SmartMIPS ASE.
25179 @item -mpaired-single
25180 @itemx -mno-paired-single
25181 @opindex mpaired-single
25182 @opindex mno-paired-single
25183 Use (do not use) paired-single floating-point instructions.
25184 @xref{MIPS Paired-Single Support}. This option requires
25185 hardware floating-point support to be enabled.
25191 Use (do not use) MIPS Digital Media Extension instructions.
25192 This option can only be used when generating 64-bit code and requires
25193 hardware floating-point support to be enabled.
25198 @opindex mno-mips3d
25199 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
25200 The option @option{-mips3d} implies @option{-mpaired-single}.
25203 @itemx -mno-micromips
25204 @opindex mmicromips
25205 @opindex mno-mmicromips
25206 Generate (do not generate) microMIPS code.
25208 MicroMIPS code generation can also be controlled on a per-function basis
25209 by means of @code{micromips} and @code{nomicromips} attributes.
25210 @xref{Function Attributes}, for more information.
25216 Use (do not use) MT Multithreading instructions.
25222 Use (do not use) the MIPS MCU ASE instructions.
25228 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
25234 Use (do not use) the MIPS Virtualization (VZ) instructions.
25240 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
25246 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
25252 Use (do not use) the MIPS Global INValidate (GINV) instructions.
25254 @item -mloongson-mmi
25255 @itemx -mno-loongson-mmi
25256 @opindex mloongson-mmi
25257 @opindex mno-loongson-mmi
25258 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
25260 @item -mloongson-ext
25261 @itemx -mno-loongson-ext
25262 @opindex mloongson-ext
25263 @opindex mno-loongson-ext
25264 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
25266 @item -mloongson-ext2
25267 @itemx -mno-loongson-ext2
25268 @opindex mloongson-ext2
25269 @opindex mno-loongson-ext2
25270 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
25274 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
25275 an explanation of the default and the way that the pointer size is
25280 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
25282 The default size of @code{int}s, @code{long}s and pointers depends on
25283 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
25284 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
25285 32-bit @code{long}s. Pointers are the same size as @code{long}s,
25286 or the same size as integer registers, whichever is smaller.
25292 Assume (do not assume) that all symbols have 32-bit values, regardless
25293 of the selected ABI@. This option is useful in combination with
25294 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
25295 to generate shorter and faster references to symbolic addresses.
25299 Put definitions of externally-visible data in a small data section
25300 if that data is no bigger than @var{num} bytes. GCC can then generate
25301 more efficient accesses to the data; see @option{-mgpopt} for details.
25303 The default @option{-G} option depends on the configuration.
25305 @item -mlocal-sdata
25306 @itemx -mno-local-sdata
25307 @opindex mlocal-sdata
25308 @opindex mno-local-sdata
25309 Extend (do not extend) the @option{-G} behavior to local data too,
25310 such as to static variables in C@. @option{-mlocal-sdata} is the
25311 default for all configurations.
25313 If the linker complains that an application is using too much small data,
25314 you might want to try rebuilding the less performance-critical parts with
25315 @option{-mno-local-sdata}. You might also want to build large
25316 libraries with @option{-mno-local-sdata}, so that the libraries leave
25317 more room for the main program.
25319 @item -mextern-sdata
25320 @itemx -mno-extern-sdata
25321 @opindex mextern-sdata
25322 @opindex mno-extern-sdata
25323 Assume (do not assume) that externally-defined data is in
25324 a small data section if the size of that data is within the @option{-G} limit.
25325 @option{-mextern-sdata} is the default for all configurations.
25327 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
25328 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
25329 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
25330 is placed in a small data section. If @var{Var} is defined by another
25331 module, you must either compile that module with a high-enough
25332 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
25333 definition. If @var{Var} is common, you must link the application
25334 with a high-enough @option{-G} setting.
25336 The easiest way of satisfying these restrictions is to compile
25337 and link every module with the same @option{-G} option. However,
25338 you may wish to build a library that supports several different
25339 small data limits. You can do this by compiling the library with
25340 the highest supported @option{-G} setting and additionally using
25341 @option{-mno-extern-sdata} to stop the library from making assumptions
25342 about externally-defined data.
25348 Use (do not use) GP-relative accesses for symbols that are known to be
25349 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
25350 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
25353 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
25354 might not hold the value of @code{_gp}. For example, if the code is
25355 part of a library that might be used in a boot monitor, programs that
25356 call boot monitor routines pass an unknown value in @code{$gp}.
25357 (In such situations, the boot monitor itself is usually compiled
25358 with @option{-G0}.)
25360 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
25361 @option{-mno-extern-sdata}.
25363 @item -membedded-data
25364 @itemx -mno-embedded-data
25365 @opindex membedded-data
25366 @opindex mno-embedded-data
25367 Allocate variables to the read-only data section first if possible, then
25368 next in the small data section if possible, otherwise in data. This gives
25369 slightly slower code than the default, but reduces the amount of RAM required
25370 when executing, and thus may be preferred for some embedded systems.
25372 @item -muninit-const-in-rodata
25373 @itemx -mno-uninit-const-in-rodata
25374 @opindex muninit-const-in-rodata
25375 @opindex mno-uninit-const-in-rodata
25376 Put uninitialized @code{const} variables in the read-only data section.
25377 This option is only meaningful in conjunction with @option{-membedded-data}.
25379 @item -mcode-readable=@var{setting}
25380 @opindex mcode-readable
25381 Specify whether GCC may generate code that reads from executable sections.
25382 There are three possible settings:
25385 @item -mcode-readable=yes
25386 Instructions may freely access executable sections. This is the
25389 @item -mcode-readable=pcrel
25390 MIPS16 PC-relative load instructions can access executable sections,
25391 but other instructions must not do so. This option is useful on 4KSc
25392 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
25393 It is also useful on processors that can be configured to have a dual
25394 instruction/data SRAM interface and that, like the M4K, automatically
25395 redirect PC-relative loads to the instruction RAM.
25397 @item -mcode-readable=no
25398 Instructions must not access executable sections. This option can be
25399 useful on targets that are configured to have a dual instruction/data
25400 SRAM interface but that (unlike the M4K) do not automatically redirect
25401 PC-relative loads to the instruction RAM.
25404 @item -msplit-addresses
25405 @itemx -mno-split-addresses
25406 @opindex msplit-addresses
25407 @opindex mno-split-addresses
25408 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
25409 relocation operators. This option has been superseded by
25410 @option{-mexplicit-relocs} but is retained for backwards compatibility.
25412 @item -mexplicit-relocs
25413 @itemx -mno-explicit-relocs
25414 @opindex mexplicit-relocs
25415 @opindex mno-explicit-relocs
25416 Use (do not use) assembler relocation operators when dealing with symbolic
25417 addresses. The alternative, selected by @option{-mno-explicit-relocs},
25418 is to use assembler macros instead.
25420 @option{-mexplicit-relocs} is the default if GCC was configured
25421 to use an assembler that supports relocation operators.
25423 @item -mcheck-zero-division
25424 @itemx -mno-check-zero-division
25425 @opindex mcheck-zero-division
25426 @opindex mno-check-zero-division
25427 Trap (do not trap) on integer division by zero.
25429 The default is @option{-mcheck-zero-division}.
25431 @item -mdivide-traps
25432 @itemx -mdivide-breaks
25433 @opindex mdivide-traps
25434 @opindex mdivide-breaks
25435 MIPS systems check for division by zero by generating either a
25436 conditional trap or a break instruction. Using traps results in
25437 smaller code, but is only supported on MIPS II and later. Also, some
25438 versions of the Linux kernel have a bug that prevents trap from
25439 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
25440 allow conditional traps on architectures that support them and
25441 @option{-mdivide-breaks} to force the use of breaks.
25443 The default is usually @option{-mdivide-traps}, but this can be
25444 overridden at configure time using @option{--with-divide=breaks}.
25445 Divide-by-zero checks can be completely disabled using
25446 @option{-mno-check-zero-division}.
25448 @item -mload-store-pairs
25449 @itemx -mno-load-store-pairs
25450 @opindex mload-store-pairs
25451 @opindex mno-load-store-pairs
25452 Enable (disable) an optimization that pairs consecutive load or store
25453 instructions to enable load/store bonding. This option is enabled by
25454 default but only takes effect when the selected architecture is known
25455 to support bonding.
25460 @opindex mno-memcpy
25461 Force (do not force) the use of @code{memcpy} for non-trivial block
25462 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
25463 most constant-sized copies.
25466 @itemx -mno-long-calls
25467 @opindex mlong-calls
25468 @opindex mno-long-calls
25469 Disable (do not disable) use of the @code{jal} instruction. Calling
25470 functions using @code{jal} is more efficient but requires the caller
25471 and callee to be in the same 256 megabyte segment.
25473 This option has no effect on abicalls code. The default is
25474 @option{-mno-long-calls}.
25480 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
25481 instructions, as provided by the R4650 ISA@.
25487 Enable (disable) use of the @code{madd} and @code{msub} integer
25488 instructions. The default is @option{-mimadd} on architectures
25489 that support @code{madd} and @code{msub} except for the 74k
25490 architecture where it was found to generate slower code.
25493 @itemx -mno-fused-madd
25494 @opindex mfused-madd
25495 @opindex mno-fused-madd
25496 Enable (disable) use of the floating-point multiply-accumulate
25497 instructions, when they are available. The default is
25498 @option{-mfused-madd}.
25500 On the R8000 CPU when multiply-accumulate instructions are used,
25501 the intermediate product is calculated to infinite precision
25502 and is not subject to the FCSR Flush to Zero bit. This may be
25503 undesirable in some circumstances. On other processors the result
25504 is numerically identical to the equivalent computation using
25505 separate multiply, add, subtract and negate instructions.
25509 Tell the MIPS assembler to not run its preprocessor over user
25510 assembler files (with a @samp{.s} suffix) when assembling them.
25513 @itemx -mno-fix-24k
25515 @opindex mno-fix-24k
25516 Work around the 24K E48 (lost data on stores during refill) errata.
25517 The workarounds are implemented by the assembler rather than by GCC@.
25520 @itemx -mno-fix-r4000
25521 @opindex mfix-r4000
25522 @opindex mno-fix-r4000
25523 Work around certain R4000 CPU errata:
25526 A double-word or a variable shift may give an incorrect result if executed
25527 immediately after starting an integer division.
25529 A double-word or a variable shift may give an incorrect result if executed
25530 while an integer multiplication is in progress.
25532 An integer division may give an incorrect result if started in a delay slot
25533 of a taken branch or a jump.
25537 @itemx -mno-fix-r4400
25538 @opindex mfix-r4400
25539 @opindex mno-fix-r4400
25540 Work around certain R4400 CPU errata:
25543 A double-word or a variable shift may give an incorrect result if executed
25544 immediately after starting an integer division.
25548 @itemx -mno-fix-r10000
25549 @opindex mfix-r10000
25550 @opindex mno-fix-r10000
25551 Work around certain R10000 errata:
25554 @code{ll}/@code{sc} sequences may not behave atomically on revisions
25555 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
25558 This option can only be used if the target architecture supports
25559 branch-likely instructions. @option{-mfix-r10000} is the default when
25560 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
25564 @itemx -mno-fix-r5900
25565 @opindex mfix-r5900
25566 Do not attempt to schedule the preceding instruction into the delay slot
25567 of a branch instruction placed at the end of a short loop of six
25568 instructions or fewer and always schedule a @code{nop} instruction there
25569 instead. The short loop bug under certain conditions causes loops to
25570 execute only once or twice, due to a hardware bug in the R5900 chip. The
25571 workaround is implemented by the assembler rather than by GCC@.
25574 @itemx -mno-fix-rm7000
25575 @opindex mfix-rm7000
25576 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
25577 workarounds are implemented by the assembler rather than by GCC@.
25580 @itemx -mno-fix-vr4120
25581 @opindex mfix-vr4120
25582 Work around certain VR4120 errata:
25585 @code{dmultu} does not always produce the correct result.
25587 @code{div} and @code{ddiv} do not always produce the correct result if one
25588 of the operands is negative.
25590 The workarounds for the division errata rely on special functions in
25591 @file{libgcc.a}. At present, these functions are only provided by
25592 the @code{mips64vr*-elf} configurations.
25594 Other VR4120 errata require a NOP to be inserted between certain pairs of
25595 instructions. These errata are handled by the assembler, not by GCC itself.
25598 @opindex mfix-vr4130
25599 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
25600 workarounds are implemented by the assembler rather than by GCC,
25601 although GCC avoids using @code{mflo} and @code{mfhi} if the
25602 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
25603 instructions are available instead.
25606 @itemx -mno-fix-sb1
25608 Work around certain SB-1 CPU core errata.
25609 (This flag currently works around the SB-1 revision 2
25610 ``F1'' and ``F2'' floating-point errata.)
25612 @item -mr10k-cache-barrier=@var{setting}
25613 @opindex mr10k-cache-barrier
25614 Specify whether GCC should insert cache barriers to avoid the
25615 side effects of speculation on R10K processors.
25617 In common with many processors, the R10K tries to predict the outcome
25618 of a conditional branch and speculatively executes instructions from
25619 the ``taken'' branch. It later aborts these instructions if the
25620 predicted outcome is wrong. However, on the R10K, even aborted
25621 instructions can have side effects.
25623 This problem only affects kernel stores and, depending on the system,
25624 kernel loads. As an example, a speculatively-executed store may load
25625 the target memory into cache and mark the cache line as dirty, even if
25626 the store itself is later aborted. If a DMA operation writes to the
25627 same area of memory before the ``dirty'' line is flushed, the cached
25628 data overwrites the DMA-ed data. See the R10K processor manual
25629 for a full description, including other potential problems.
25631 One workaround is to insert cache barrier instructions before every memory
25632 access that might be speculatively executed and that might have side
25633 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
25634 controls GCC's implementation of this workaround. It assumes that
25635 aborted accesses to any byte in the following regions does not have
25640 the memory occupied by the current function's stack frame;
25643 the memory occupied by an incoming stack argument;
25646 the memory occupied by an object with a link-time-constant address.
25649 It is the kernel's responsibility to ensure that speculative
25650 accesses to these regions are indeed safe.
25652 If the input program contains a function declaration such as:
25658 then the implementation of @code{foo} must allow @code{j foo} and
25659 @code{jal foo} to be executed speculatively. GCC honors this
25660 restriction for functions it compiles itself. It expects non-GCC
25661 functions (such as hand-written assembly code) to do the same.
25663 The option has three forms:
25666 @item -mr10k-cache-barrier=load-store
25667 Insert a cache barrier before a load or store that might be
25668 speculatively executed and that might have side effects even
25671 @item -mr10k-cache-barrier=store
25672 Insert a cache barrier before a store that might be speculatively
25673 executed and that might have side effects even if aborted.
25675 @item -mr10k-cache-barrier=none
25676 Disable the insertion of cache barriers. This is the default setting.
25679 @item -mflush-func=@var{func}
25680 @itemx -mno-flush-func
25681 @opindex mflush-func
25682 Specifies the function to call to flush the I and D caches, or to not
25683 call any such function. If called, the function must take the same
25684 arguments as the common @code{_flush_func}, that is, the address of the
25685 memory range for which the cache is being flushed, the size of the
25686 memory range, and the number 3 (to flush both caches). The default
25687 depends on the target GCC was configured for, but commonly is either
25688 @code{_flush_func} or @code{__cpu_flush}.
25690 @item mbranch-cost=@var{num}
25691 @opindex mbranch-cost
25692 Set the cost of branches to roughly @var{num} ``simple'' instructions.
25693 This cost is only a heuristic and is not guaranteed to produce
25694 consistent results across releases. A zero cost redundantly selects
25695 the default, which is based on the @option{-mtune} setting.
25697 @item -mbranch-likely
25698 @itemx -mno-branch-likely
25699 @opindex mbranch-likely
25700 @opindex mno-branch-likely
25701 Enable or disable use of Branch Likely instructions, regardless of the
25702 default for the selected architecture. By default, Branch Likely
25703 instructions may be generated if they are supported by the selected
25704 architecture. An exception is for the MIPS32 and MIPS64 architectures
25705 and processors that implement those architectures; for those, Branch
25706 Likely instructions are not be generated by default because the MIPS32
25707 and MIPS64 architectures specifically deprecate their use.
25709 @item -mcompact-branches=never
25710 @itemx -mcompact-branches=optimal
25711 @itemx -mcompact-branches=always
25712 @opindex mcompact-branches=never
25713 @opindex mcompact-branches=optimal
25714 @opindex mcompact-branches=always
25715 These options control which form of branches will be generated. The
25716 default is @option{-mcompact-branches=optimal}.
25718 The @option{-mcompact-branches=never} option ensures that compact branch
25719 instructions will never be generated.
25721 The @option{-mcompact-branches=always} option ensures that a compact
25722 branch instruction will be generated if available. If a compact branch
25723 instruction is not available, a delay slot form of the branch will be
25726 This option is supported from MIPS Release 6 onwards.
25728 The @option{-mcompact-branches=optimal} option will cause a delay slot
25729 branch to be used if one is available in the current ISA and the delay
25730 slot is successfully filled. If the delay slot is not filled, a compact
25731 branch will be chosen if one is available.
25733 @item -mfp-exceptions
25734 @itemx -mno-fp-exceptions
25735 @opindex mfp-exceptions
25736 Specifies whether FP exceptions are enabled. This affects how
25737 FP instructions are scheduled for some processors.
25738 The default is that FP exceptions are
25741 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
25742 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
25745 @item -mvr4130-align
25746 @itemx -mno-vr4130-align
25747 @opindex mvr4130-align
25748 The VR4130 pipeline is two-way superscalar, but can only issue two
25749 instructions together if the first one is 8-byte aligned. When this
25750 option is enabled, GCC aligns pairs of instructions that it
25751 thinks should execute in parallel.
25753 This option only has an effect when optimizing for the VR4130.
25754 It normally makes code faster, but at the expense of making it bigger.
25755 It is enabled by default at optimization level @option{-O3}.
25760 Enable (disable) generation of @code{synci} instructions on
25761 architectures that support it. The @code{synci} instructions (if
25762 enabled) are generated when @code{__builtin___clear_cache} is
25765 This option defaults to @option{-mno-synci}, but the default can be
25766 overridden by configuring GCC with @option{--with-synci}.
25768 When compiling code for single processor systems, it is generally safe
25769 to use @code{synci}. However, on many multi-core (SMP) systems, it
25770 does not invalidate the instruction caches on all cores and may lead
25771 to undefined behavior.
25773 @item -mrelax-pic-calls
25774 @itemx -mno-relax-pic-calls
25775 @opindex mrelax-pic-calls
25776 Try to turn PIC calls that are normally dispatched via register
25777 @code{$25} into direct calls. This is only possible if the linker can
25778 resolve the destination at link time and if the destination is within
25779 range for a direct call.
25781 @option{-mrelax-pic-calls} is the default if GCC was configured to use
25782 an assembler and a linker that support the @code{.reloc} assembly
25783 directive and @option{-mexplicit-relocs} is in effect. With
25784 @option{-mno-explicit-relocs}, this optimization can be performed by the
25785 assembler and the linker alone without help from the compiler.
25787 @item -mmcount-ra-address
25788 @itemx -mno-mcount-ra-address
25789 @opindex mmcount-ra-address
25790 @opindex mno-mcount-ra-address
25791 Emit (do not emit) code that allows @code{_mcount} to modify the
25792 calling function's return address. When enabled, this option extends
25793 the usual @code{_mcount} interface with a new @var{ra-address}
25794 parameter, which has type @code{intptr_t *} and is passed in register
25795 @code{$12}. @code{_mcount} can then modify the return address by
25796 doing both of the following:
25799 Returning the new address in register @code{$31}.
25801 Storing the new address in @code{*@var{ra-address}},
25802 if @var{ra-address} is nonnull.
25805 The default is @option{-mno-mcount-ra-address}.
25807 @item -mframe-header-opt
25808 @itemx -mno-frame-header-opt
25809 @opindex mframe-header-opt
25810 Enable (disable) frame header optimization in the o32 ABI. When using the
25811 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
25812 function to write out register arguments. When enabled, this optimization
25813 will suppress the allocation of the frame header if it can be determined that
25816 This optimization is off by default at all optimization levels.
25819 @itemx -mno-lxc1-sxc1
25820 @opindex mlxc1-sxc1
25821 When applicable, enable (disable) the generation of @code{lwxc1},
25822 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
25827 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
25828 @code{madd.d} and related instructions. Enabled by default.
25833 @subsection MMIX Options
25834 @cindex MMIX Options
25836 These options are defined for the MMIX:
25840 @itemx -mno-libfuncs
25842 @opindex mno-libfuncs
25843 Specify that intrinsic library functions are being compiled, passing all
25844 values in registers, no matter the size.
25847 @itemx -mno-epsilon
25849 @opindex mno-epsilon
25850 Generate floating-point comparison instructions that compare with respect
25851 to the @code{rE} epsilon register.
25853 @item -mabi=mmixware
25855 @opindex mabi=mmixware
25857 Generate code that passes function parameters and return values that (in
25858 the called function) are seen as registers @code{$0} and up, as opposed to
25859 the GNU ABI which uses global registers @code{$231} and up.
25861 @item -mzero-extend
25862 @itemx -mno-zero-extend
25863 @opindex mzero-extend
25864 @opindex mno-zero-extend
25865 When reading data from memory in sizes shorter than 64 bits, use (do not
25866 use) zero-extending load instructions by default, rather than
25867 sign-extending ones.
25870 @itemx -mno-knuthdiv
25872 @opindex mno-knuthdiv
25873 Make the result of a division yielding a remainder have the same sign as
25874 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
25875 remainder follows the sign of the dividend. Both methods are
25876 arithmetically valid, the latter being almost exclusively used.
25878 @item -mtoplevel-symbols
25879 @itemx -mno-toplevel-symbols
25880 @opindex mtoplevel-symbols
25881 @opindex mno-toplevel-symbols
25882 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
25883 code can be used with the @code{PREFIX} assembly directive.
25887 Generate an executable in the ELF format, rather than the default
25888 @samp{mmo} format used by the @command{mmix} simulator.
25890 @item -mbranch-predict
25891 @itemx -mno-branch-predict
25892 @opindex mbranch-predict
25893 @opindex mno-branch-predict
25894 Use (do not use) the probable-branch instructions, when static branch
25895 prediction indicates a probable branch.
25897 @item -mbase-addresses
25898 @itemx -mno-base-addresses
25899 @opindex mbase-addresses
25900 @opindex mno-base-addresses
25901 Generate (do not generate) code that uses @emph{base addresses}. Using a
25902 base address automatically generates a request (handled by the assembler
25903 and the linker) for a constant to be set up in a global register. The
25904 register is used for one or more base address requests within the range 0
25905 to 255 from the value held in the register. The generally leads to short
25906 and fast code, but the number of different data items that can be
25907 addressed is limited. This means that a program that uses lots of static
25908 data may require @option{-mno-base-addresses}.
25910 @item -msingle-exit
25911 @itemx -mno-single-exit
25912 @opindex msingle-exit
25913 @opindex mno-single-exit
25914 Force (do not force) generated code to have a single exit point in each
25918 @node MN10300 Options
25919 @subsection MN10300 Options
25920 @cindex MN10300 options
25922 These @option{-m} options are defined for Matsushita MN10300 architectures:
25927 Generate code to avoid bugs in the multiply instructions for the MN10300
25928 processors. This is the default.
25930 @item -mno-mult-bug
25931 @opindex mno-mult-bug
25932 Do not generate code to avoid bugs in the multiply instructions for the
25933 MN10300 processors.
25937 Generate code using features specific to the AM33 processor.
25941 Do not generate code using features specific to the AM33 processor. This
25946 Generate code using features specific to the AM33/2.0 processor.
25950 Generate code using features specific to the AM34 processor.
25952 @item -mtune=@var{cpu-type}
25954 Use the timing characteristics of the indicated CPU type when
25955 scheduling instructions. This does not change the targeted processor
25956 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
25957 @samp{am33-2} or @samp{am34}.
25959 @item -mreturn-pointer-on-d0
25960 @opindex mreturn-pointer-on-d0
25961 When generating a function that returns a pointer, return the pointer
25962 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
25963 only in @code{a0}, and attempts to call such functions without a prototype
25964 result in errors. Note that this option is on by default; use
25965 @option{-mno-return-pointer-on-d0} to disable it.
25969 Do not link in the C run-time initialization object file.
25973 Indicate to the linker that it should perform a relaxation optimization pass
25974 to shorten branches, calls and absolute memory addresses. This option only
25975 has an effect when used on the command line for the final link step.
25977 This option makes symbolic debugging impossible.
25981 Allow the compiler to generate @emph{Long Instruction Word}
25982 instructions if the target is the @samp{AM33} or later. This is the
25983 default. This option defines the preprocessor macro @code{__LIW__}.
25987 Do not allow the compiler to generate @emph{Long Instruction Word}
25988 instructions. This option defines the preprocessor macro
25993 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
25994 instructions if the target is the @samp{AM33} or later. This is the
25995 default. This option defines the preprocessor macro @code{__SETLB__}.
25999 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
26000 instructions. This option defines the preprocessor macro
26001 @code{__NO_SETLB__}.
26005 @node Moxie Options
26006 @subsection Moxie Options
26007 @cindex Moxie Options
26013 Generate big-endian code. This is the default for @samp{moxie-*-*}
26018 Generate little-endian code.
26022 Generate mul.x and umul.x instructions. This is the default for
26023 @samp{moxiebox-*-*} configurations.
26027 Do not link in the C run-time initialization object file.
26031 @node MSP430 Options
26032 @subsection MSP430 Options
26033 @cindex MSP430 Options
26035 These options are defined for the MSP430:
26041 Force assembly output to always use hex constants. Normally such
26042 constants are signed decimals, but this option is available for
26043 testsuite and/or aesthetic purposes.
26047 Select the MCU to target. This is used to create a C preprocessor
26048 symbol based upon the MCU name, converted to upper case and pre- and
26049 post-fixed with @samp{__}. This in turn is used by the
26050 @file{msp430.h} header file to select an MCU-specific supplementary
26053 The option also sets the ISA to use. If the MCU name is one that is
26054 known to only support the 430 ISA then that is selected, otherwise the
26055 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
26056 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
26057 name selects the 430X ISA.
26059 In addition an MCU-specific linker script is added to the linker
26060 command line. The script's name is the name of the MCU with
26061 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
26062 command line defines the C preprocessor symbol @code{__XXX__} and
26063 cause the linker to search for a script called @file{xxx.ld}.
26065 The ISA and hardware multiply supported for the different MCUs is hard-coded
26066 into GCC. However, an external @samp{devices.csv} file can be used to
26067 extend device support beyond those that have been hard-coded.
26069 GCC searches for the @samp{devices.csv} file using the following methods in the
26070 given precedence order, where the first method takes precendence over the
26071 second which takes precedence over the third.
26074 @item Include path specified with @code{-I} and @code{-L}
26075 @samp{devices.csv} will be searched for in each of the directories specified by
26076 include paths and linker library search paths.
26077 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
26078 Define the value of the global environment variable
26079 @samp{MSP430_GCC_INCLUDE_DIR}
26080 to the full path to the directory containing devices.csv, and GCC will search
26081 this directory for devices.csv. If devices.csv is found, this directory will
26082 also be registered as an include path, and linker library path. Header files
26083 and linker scripts in this directory can therefore be used without manually
26084 specifying @code{-I} and @code{-L} on the command line.
26085 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
26086 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
26087 toolchain root directory. This directory does not exist in a default
26088 installation, but if the user has created it and copied @samp{devices.csv}
26089 there, then the MCU data will be read. As above, this directory will
26090 also be registered as an include path, and linker library path.
26093 If none of the above search methods find @samp{devices.csv}, then the
26094 hard-coded MCU data is used.
26098 @itemx -mno-warn-mcu
26100 @opindex mno-warn-mcu
26101 This option enables or disables warnings about conflicts between the
26102 MCU name specified by the @option{-mmcu} option and the ISA set by the
26103 @option{-mcpu} option and/or the hardware multiply support set by the
26104 @option{-mhwmult} option. It also toggles warnings about unrecognized
26105 MCU names. This option is on by default.
26109 Specifies the ISA to use. Accepted values are @samp{msp430},
26110 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
26111 @option{-mmcu=} option should be used to select the ISA.
26115 Link to the simulator runtime libraries and linker script. Overrides
26116 any scripts that would be selected by the @option{-mmcu=} option.
26120 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
26124 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
26128 This option is passed to the assembler and linker, and allows the
26129 linker to perform certain optimizations that cannot be done until
26134 Describes the type of hardware multiply supported by the target.
26135 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
26136 for the original 16-bit-only multiply supported by early MCUs.
26137 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
26138 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
26139 A value of @samp{auto} can also be given. This tells GCC to deduce
26140 the hardware multiply support based upon the MCU name provided by the
26141 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
26142 the MCU name is not recognized then no hardware multiply support is
26143 assumed. @code{auto} is the default setting.
26145 Hardware multiplies are normally performed by calling a library
26146 routine. This saves space in the generated code. When compiling at
26147 @option{-O3} or higher however the hardware multiplier is invoked
26148 inline. This makes for bigger, but faster code.
26150 The hardware multiply routines disable interrupts whilst running and
26151 restore the previous interrupt state when they finish. This makes
26152 them safe to use inside interrupt handlers as well as in normal code.
26156 Enable the use of a minimum runtime environment - no static
26157 initializers or constructors. This is intended for memory-constrained
26158 devices. The compiler includes special symbols in some objects
26159 that tell the linker and runtime which code fragments are required.
26161 @item -mtiny-printf
26162 @opindex mtiny-printf
26163 Enable reduced code size @code{printf} and @code{puts} library functions.
26164 The @samp{tiny} implementations of these functions are not reentrant, so
26165 must be used with caution in multi-threaded applications.
26167 Support for streams has been removed and the string to be printed will
26168 always be sent to stdout via the @code{write} syscall. The string is not
26169 buffered before it is sent to write.
26171 This option requires Newlib Nano IO, so GCC must be configured with
26172 @samp{--enable-newlib-nano-formatted-io}.
26174 @item -mmax-inline-shift=
26175 @opindex mmax-inline-shift=
26176 This option takes an integer between 0 and 64 inclusive, and sets
26177 the maximum number of inline shift instructions which should be emitted to
26178 perform a shift operation by a constant amount. When this value needs to be
26179 exceeded, an mspabi helper function is used instead. The default value is 4.
26181 This only affects cases where a shift by multiple positions cannot be
26182 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
26184 Shifts of a 32-bit value are at least twice as costly, so the value passed for
26185 this option is divided by 2 and the resulting value used instead.
26187 @item -mcode-region=
26188 @itemx -mdata-region=
26189 @opindex mcode-region
26190 @opindex mdata-region
26191 These options tell the compiler where to place functions and data that
26192 do not have one of the @code{lower}, @code{upper}, @code{either} or
26193 @code{section} attributes. Possible values are @code{lower},
26194 @code{upper}, @code{either} or @code{any}. The first three behave
26195 like the corresponding attribute. The fourth possible value -
26196 @code{any} - is the default. It leaves placement entirely up to the
26197 linker script and how it assigns the standard sections
26198 (@code{.text}, @code{.data}, etc) to the memory regions.
26200 @item -msilicon-errata=
26201 @opindex msilicon-errata
26202 This option passes on a request to assembler to enable the fixes for
26203 the named silicon errata.
26205 @item -msilicon-errata-warn=
26206 @opindex msilicon-errata-warn
26207 This option passes on a request to the assembler to enable warning
26208 messages when a silicon errata might need to be applied.
26210 @item -mwarn-devices-csv
26211 @itemx -mno-warn-devices-csv
26212 @opindex mwarn-devices-csv
26213 @opindex mno-warn-devices-csv
26214 Warn if @samp{devices.csv} is not found or there are problem parsing it
26219 @node NDS32 Options
26220 @subsection NDS32 Options
26221 @cindex NDS32 Options
26223 These options are defined for NDS32 implementations:
26228 @opindex mbig-endian
26229 Generate code in big-endian mode.
26231 @item -mlittle-endian
26232 @opindex mlittle-endian
26233 Generate code in little-endian mode.
26235 @item -mreduced-regs
26236 @opindex mreduced-regs
26237 Use reduced-set registers for register allocation.
26240 @opindex mfull-regs
26241 Use full-set registers for register allocation.
26245 Generate conditional move instructions.
26249 Do not generate conditional move instructions.
26253 Generate performance extension instructions.
26255 @item -mno-ext-perf
26256 @opindex mno-ext-perf
26257 Do not generate performance extension instructions.
26260 @opindex mext-perf2
26261 Generate performance extension 2 instructions.
26263 @item -mno-ext-perf2
26264 @opindex mno-ext-perf2
26265 Do not generate performance extension 2 instructions.
26268 @opindex mext-string
26269 Generate string extension instructions.
26271 @item -mno-ext-string
26272 @opindex mno-ext-string
26273 Do not generate string extension instructions.
26277 Generate v3 push25/pop25 instructions.
26280 @opindex mno-v3push
26281 Do not generate v3 push25/pop25 instructions.
26285 Generate 16-bit instructions.
26288 @opindex mno-16-bit
26289 Do not generate 16-bit instructions.
26291 @item -misr-vector-size=@var{num}
26292 @opindex misr-vector-size
26293 Specify the size of each interrupt vector, which must be 4 or 16.
26295 @item -mcache-block-size=@var{num}
26296 @opindex mcache-block-size
26297 Specify the size of each cache block,
26298 which must be a power of 2 between 4 and 512.
26300 @item -march=@var{arch}
26302 Specify the name of the target architecture.
26304 @item -mcmodel=@var{code-model}
26306 Set the code model to one of
26309 All the data and read-only data segments must be within 512KB addressing space.
26310 The text segment must be within 16MB addressing space.
26311 @item @samp{medium}
26312 The data segment must be within 512KB while the read-only data segment can be
26313 within 4GB addressing space. The text segment should be still within 16MB
26316 All the text and data segments can be within 4GB addressing space.
26320 @opindex mctor-dtor
26321 Enable constructor/destructor feature.
26325 Guide linker to relax instructions.
26329 @node Nios II Options
26330 @subsection Nios II Options
26331 @cindex Nios II options
26332 @cindex Altera Nios II options
26334 These are the options defined for the Altera Nios II processor.
26340 @cindex smaller data references
26341 Put global and static objects less than or equal to @var{num} bytes
26342 into the small data or BSS sections instead of the normal data or BSS
26343 sections. The default value of @var{num} is 8.
26345 @item -mgpopt=@var{option}
26350 Generate (do not generate) GP-relative accesses. The following
26351 @var{option} names are recognized:
26356 Do not generate GP-relative accesses.
26359 Generate GP-relative accesses for small data objects that are not
26360 external, weak, or uninitialized common symbols.
26361 Also use GP-relative addressing for objects that
26362 have been explicitly placed in a small data section via a @code{section}
26366 As for @samp{local}, but also generate GP-relative accesses for
26367 small data objects that are external, weak, or common. If you use this option,
26368 you must ensure that all parts of your program (including libraries) are
26369 compiled with the same @option{-G} setting.
26372 Generate GP-relative accesses for all data objects in the program. If you
26373 use this option, the entire data and BSS segments
26374 of your program must fit in 64K of memory and you must use an appropriate
26375 linker script to allocate them within the addressable range of the
26379 Generate GP-relative addresses for function pointers as well as data
26380 pointers. If you use this option, the entire text, data, and BSS segments
26381 of your program must fit in 64K of memory and you must use an appropriate
26382 linker script to allocate them within the addressable range of the
26387 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
26388 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
26390 The default is @option{-mgpopt} except when @option{-fpic} or
26391 @option{-fPIC} is specified to generate position-independent code.
26392 Note that the Nios II ABI does not permit GP-relative accesses from
26395 You may need to specify @option{-mno-gpopt} explicitly when building
26396 programs that include large amounts of small data, including large
26397 GOT data sections. In this case, the 16-bit offset for GP-relative
26398 addressing may not be large enough to allow access to the entire
26399 small data section.
26401 @item -mgprel-sec=@var{regexp}
26402 @opindex mgprel-sec
26403 This option specifies additional section names that can be accessed via
26404 GP-relative addressing. It is most useful in conjunction with
26405 @code{section} attributes on variable declarations
26406 (@pxref{Common Variable Attributes}) and a custom linker script.
26407 The @var{regexp} is a POSIX Extended Regular Expression.
26409 This option does not affect the behavior of the @option{-G} option, and
26410 the specified sections are in addition to the standard @code{.sdata}
26411 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
26413 @item -mr0rel-sec=@var{regexp}
26414 @opindex mr0rel-sec
26415 This option specifies names of sections that can be accessed via a
26416 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
26417 of the 32-bit address space. It is most useful in conjunction with
26418 @code{section} attributes on variable declarations
26419 (@pxref{Common Variable Attributes}) and a custom linker script.
26420 The @var{regexp} is a POSIX Extended Regular Expression.
26422 In contrast to the use of GP-relative addressing for small data,
26423 zero-based addressing is never generated by default and there are no
26424 conventional section names used in standard linker scripts for sections
26425 in the low or high areas of memory.
26431 Generate little-endian (default) or big-endian (experimental) code,
26434 @item -march=@var{arch}
26436 This specifies the name of the target Nios II architecture. GCC uses this
26437 name to determine what kind of instructions it can emit when generating
26438 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
26440 The preprocessor macro @code{__nios2_arch__} is available to programs,
26441 with value 1 or 2, indicating the targeted ISA level.
26443 @item -mbypass-cache
26444 @itemx -mno-bypass-cache
26445 @opindex mno-bypass-cache
26446 @opindex mbypass-cache
26447 Force all load and store instructions to always bypass cache by
26448 using I/O variants of the instructions. The default is not to
26451 @item -mno-cache-volatile
26452 @itemx -mcache-volatile
26453 @opindex mcache-volatile
26454 @opindex mno-cache-volatile
26455 Volatile memory access bypass the cache using the I/O variants of
26456 the load and store instructions. The default is not to bypass the cache.
26458 @item -mno-fast-sw-div
26459 @itemx -mfast-sw-div
26460 @opindex mno-fast-sw-div
26461 @opindex mfast-sw-div
26462 Do not use table-based fast divide for small numbers. The default
26463 is to use the fast divide at @option{-O3} and above.
26467 @itemx -mno-hw-mulx
26471 @opindex mno-hw-mul
26473 @opindex mno-hw-mulx
26475 @opindex mno-hw-div
26477 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
26478 instructions by the compiler. The default is to emit @code{mul}
26479 and not emit @code{div} and @code{mulx}.
26485 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
26486 CDX (code density) instructions. Enabling these instructions also
26487 requires @option{-march=r2}. Since these instructions are optional
26488 extensions to the R2 architecture, the default is not to emit them.
26490 @item -mcustom-@var{insn}=@var{N}
26491 @itemx -mno-custom-@var{insn}
26492 @opindex mcustom-@var{insn}
26493 @opindex mno-custom-@var{insn}
26494 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
26495 custom instruction with encoding @var{N} when generating code that uses
26496 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
26497 instruction 253 for single-precision floating-point add operations instead
26498 of the default behavior of using a library call.
26500 The following values of @var{insn} are supported. Except as otherwise
26501 noted, floating-point operations are expected to be implemented with
26502 normal IEEE 754 semantics and correspond directly to the C operators or the
26503 equivalent GCC built-in functions (@pxref{Other Builtins}).
26505 Single-precision floating point:
26508 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
26509 Binary arithmetic operations.
26515 Unary absolute value.
26517 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
26518 Comparison operations.
26520 @item @samp{fmins}, @samp{fmaxs}
26521 Floating-point minimum and maximum. These instructions are only
26522 generated if @option{-ffinite-math-only} is specified.
26524 @item @samp{fsqrts}
26525 Unary square root operation.
26527 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
26528 Floating-point trigonometric and exponential functions. These instructions
26529 are only generated if @option{-funsafe-math-optimizations} is also specified.
26533 Double-precision floating point:
26536 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
26537 Binary arithmetic operations.
26543 Unary absolute value.
26545 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
26546 Comparison operations.
26548 @item @samp{fmind}, @samp{fmaxd}
26549 Double-precision minimum and maximum. These instructions are only
26550 generated if @option{-ffinite-math-only} is specified.
26552 @item @samp{fsqrtd}
26553 Unary square root operation.
26555 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
26556 Double-precision trigonometric and exponential functions. These instructions
26557 are only generated if @option{-funsafe-math-optimizations} is also specified.
26563 @item @samp{fextsd}
26564 Conversion from single precision to double precision.
26566 @item @samp{ftruncds}
26567 Conversion from double precision to single precision.
26569 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
26570 Conversion from floating point to signed or unsigned integer types, with
26571 truncation towards zero.
26574 Conversion from single-precision floating point to signed integer,
26575 rounding to the nearest integer and ties away from zero.
26576 This corresponds to the @code{__builtin_lroundf} function when
26577 @option{-fno-math-errno} is used.
26579 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
26580 Conversion from signed or unsigned integer types to floating-point types.
26584 In addition, all of the following transfer instructions for internal
26585 registers X and Y must be provided to use any of the double-precision
26586 floating-point instructions. Custom instructions taking two
26587 double-precision source operands expect the first operand in the
26588 64-bit register X. The other operand (or only operand of a unary
26589 operation) is given to the custom arithmetic instruction with the
26590 least significant half in source register @var{src1} and the most
26591 significant half in @var{src2}. A custom instruction that returns a
26592 double-precision result returns the most significant 32 bits in the
26593 destination register and the other half in 32-bit register Y.
26594 GCC automatically generates the necessary code sequences to write
26595 register X and/or read register Y when double-precision floating-point
26596 instructions are used.
26601 Write @var{src1} into the least significant half of X and @var{src2} into
26602 the most significant half of X.
26605 Write @var{src1} into Y.
26607 @item @samp{frdxhi}, @samp{frdxlo}
26608 Read the most or least (respectively) significant half of X and store it in
26612 Read the value of Y and store it into @var{dest}.
26615 Note that you can gain more local control over generation of Nios II custom
26616 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
26617 and @code{target("no-custom-@var{insn}")} function attributes
26618 (@pxref{Function Attributes})
26619 or pragmas (@pxref{Function Specific Option Pragmas}).
26621 @item -mcustom-fpu-cfg=@var{name}
26622 @opindex mcustom-fpu-cfg
26624 This option enables a predefined, named set of custom instruction encodings
26625 (see @option{-mcustom-@var{insn}} above).
26626 Currently, the following sets are defined:
26628 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
26629 @gccoptlist{-mcustom-fmuls=252 @gol
26630 -mcustom-fadds=253 @gol
26631 -mcustom-fsubs=254 @gol
26632 -fsingle-precision-constant}
26634 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
26635 @gccoptlist{-mcustom-fmuls=252 @gol
26636 -mcustom-fadds=253 @gol
26637 -mcustom-fsubs=254 @gol
26638 -mcustom-fdivs=255 @gol
26639 -fsingle-precision-constant}
26641 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
26642 @gccoptlist{-mcustom-floatus=243 @gol
26643 -mcustom-fixsi=244 @gol
26644 -mcustom-floatis=245 @gol
26645 -mcustom-fcmpgts=246 @gol
26646 -mcustom-fcmples=249 @gol
26647 -mcustom-fcmpeqs=250 @gol
26648 -mcustom-fcmpnes=251 @gol
26649 -mcustom-fmuls=252 @gol
26650 -mcustom-fadds=253 @gol
26651 -mcustom-fsubs=254 @gol
26652 -mcustom-fdivs=255 @gol
26653 -fsingle-precision-constant}
26655 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
26656 @gccoptlist{-mcustom-fabss=224 @gol
26657 -mcustom-fnegs=225 @gol
26658 -mcustom-fcmpnes=226 @gol
26659 -mcustom-fcmpeqs=227 @gol
26660 -mcustom-fcmpges=228 @gol
26661 -mcustom-fcmpgts=229 @gol
26662 -mcustom-fcmples=230 @gol
26663 -mcustom-fcmplts=231 @gol
26664 -mcustom-fmaxs=232 @gol
26665 -mcustom-fmins=233 @gol
26666 -mcustom-round=248 @gol
26667 -mcustom-fixsi=249 @gol
26668 -mcustom-floatis=250 @gol
26669 -mcustom-fsqrts=251 @gol
26670 -mcustom-fmuls=252 @gol
26671 -mcustom-fadds=253 @gol
26672 -mcustom-fsubs=254 @gol
26673 -mcustom-fdivs=255 @gol}
26675 Custom instruction assignments given by individual
26676 @option{-mcustom-@var{insn}=} options override those given by
26677 @option{-mcustom-fpu-cfg=}, regardless of the
26678 order of the options on the command line.
26680 Note that you can gain more local control over selection of a FPU
26681 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
26682 function attribute (@pxref{Function Attributes})
26683 or pragma (@pxref{Function Specific Option Pragmas}).
26685 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
26686 Hardware 2 Component}. Please note that the custom instructions enabled by
26687 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
26688 if @option{-ffinite-math-only} is specified. The custom instruction enabled by
26689 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
26690 specified. In contrast to the other configurations,
26691 @option{-fsingle-precision-constant} is not set.
26695 These additional @samp{-m} options are available for the Altera Nios II
26696 ELF (bare-metal) target:
26702 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
26703 startup and termination code, and is typically used in conjunction with
26704 @option{-msys-crt0=} to specify the location of the alternate startup code
26705 provided by the HAL BSP.
26709 Link with a limited version of the C library, @option{-lsmallc}, rather than
26712 @item -msys-crt0=@var{startfile}
26714 @var{startfile} is the file name of the startfile (crt0) to use
26715 when linking. This option is only useful in conjunction with @option{-mhal}.
26717 @item -msys-lib=@var{systemlib}
26719 @var{systemlib} is the library name of the library that provides
26720 low-level system calls required by the C library,
26721 e.g.@: @code{read} and @code{write}.
26722 This option is typically used to link with a library provided by a HAL BSP.
26726 @node Nvidia PTX Options
26727 @subsection Nvidia PTX Options
26728 @cindex Nvidia PTX options
26729 @cindex nvptx options
26731 These options are defined for Nvidia PTX:
26737 Ignored, but preserved for backward compatibility. Only 64-bit ABI is
26740 @item -misa=@var{ISA-string}
26742 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
26743 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
26744 @samp{sm_35}. The default ISA is sm_35.
26746 @item -mptx=@var{version-string}
26748 Generate code for given the specified PTX version (e.g.@: @samp{6.3}).
26749 Valid version strings include @samp{3.1} and @samp{6.3}. The default PTX
26753 @opindex mmainkernel
26754 Link in code for a __main kernel. This is for stand-alone instead of
26755 offloading execution.
26759 Apply partitioned execution optimizations. This is the default when any
26760 level of optimization is selected.
26763 @opindex msoft-stack
26764 Generate code that does not use @code{.local} memory
26765 directly for stack storage. Instead, a per-warp stack pointer is
26766 maintained explicitly. This enables variable-length stack allocation (with
26767 variable-length arrays or @code{alloca}), and when global memory is used for
26768 underlying storage, makes it possible to access automatic variables from other
26769 threads, or with atomic instructions. This code generation variant is used
26770 for OpenMP offloading, but the option is exposed on its own for the purpose
26771 of testing the compiler; to generate code suitable for linking into programs
26772 using OpenMP offloading, use option @option{-mgomp}.
26774 @item -muniform-simt
26775 @opindex muniform-simt
26776 Switch to code generation variant that allows to execute all threads in each
26777 warp, while maintaining memory state and side effects as if only one thread
26778 in each warp was active outside of OpenMP SIMD regions. All atomic operations
26779 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
26780 current lane index equals the master lane index), and the register being
26781 assigned is copied via a shuffle instruction from the master lane. Outside of
26782 SIMD regions lane 0 is the master; inside, each thread sees itself as the
26783 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
26784 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
26785 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
26786 with current lane index to compute the master lane index.
26790 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
26791 @option{-muniform-simt} options, and selects corresponding multilib variant.
26795 @node OpenRISC Options
26796 @subsection OpenRISC Options
26797 @cindex OpenRISC Options
26799 These options are defined for OpenRISC:
26803 @item -mboard=@var{name}
26805 Configure a board specific runtime. This will be passed to the linker for
26806 newlib board library linking. The default is @code{or1ksim}.
26810 This option is ignored; it is for compatibility purposes only. This used to
26811 select linker and preprocessor options for use with newlib.
26817 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
26818 This default is hardware divide.
26824 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
26825 This default is hardware multiply.
26828 @itemx -mhard-float
26829 @opindex msoft-float
26830 @opindex mhard-float
26831 Select software or hardware for floating point operations.
26832 The default is software.
26834 @item -mdouble-float
26835 @opindex mdouble-float
26836 When @option{-mhard-float} is selected, enables generation of double-precision
26837 floating point instructions. By default functions from @file{libgcc} are used
26838 to perform double-precision floating point operations.
26840 @item -munordered-float
26841 @opindex munordered-float
26842 When @option{-mhard-float} is selected, enables generation of unordered
26843 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
26844 functions from @file{libgcc} are used to perform unordered floating point
26845 compare and set flag operations.
26849 Enable generation of conditional move (@code{l.cmov}) instructions. By
26850 default the equivalent will be generated using set and branch.
26854 Enable generation of rotate right (@code{l.ror}) instructions. By default
26855 functions from @file{libgcc} are used to perform rotate right operations.
26859 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
26860 By default functions from @file{libgcc} are used to perform rotate right with
26861 immediate operations.
26865 Enable generation of sign extension (@code{l.ext*}) instructions. By default
26866 memory loads are used to perform sign extension.
26870 Enable generation of compare and set flag with immediate (@code{l.sf*i})
26871 instructions. By default extra instructions will be generated to store the
26872 immediate to a register first.
26876 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
26877 @code{l.slli}) instructions. By default extra instructions will be generated
26878 to store the immediate to a register first.
26880 @item -mcmodel=small
26881 @opindex mcmodel=small
26882 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
26885 @item -mcmodel=large
26886 @opindex mcmodel=large
26887 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
26892 @node PDP-11 Options
26893 @subsection PDP-11 Options
26894 @cindex PDP-11 Options
26896 These options are defined for the PDP-11:
26901 Use hardware FPP floating point. This is the default. (FIS floating
26902 point on the PDP-11/40 is not supported.) Implies -m45.
26905 @opindex msoft-float
26906 Do not use hardware floating point.
26910 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
26914 Return floating-point results in memory. This is the default.
26918 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
26922 Generate code for a PDP-11/45. This is the default.
26926 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
26932 Use 16-bit @code{int}. This is the default.
26938 Use 32-bit @code{int}.
26942 Target has split instruction and data space. Implies -m45.
26946 Use Unix assembler syntax.
26950 Use DEC assembler syntax.
26954 Use GNU assembler syntax. This is the default.
26958 Use the new LRA register allocator. By default, the old ``reload''
26962 @node picoChip Options
26963 @subsection picoChip Options
26964 @cindex picoChip options
26966 These @samp{-m} options are defined for picoChip implementations:
26970 @item -mae=@var{ae_type}
26972 Set the instruction set, register set, and instruction scheduling
26973 parameters for array element type @var{ae_type}. Supported values
26974 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
26976 @option{-mae=ANY} selects a completely generic AE type. Code
26977 generated with this option runs on any of the other AE types. The
26978 code is not as efficient as it would be if compiled for a specific
26979 AE type, and some types of operation (e.g., multiplication) do not
26980 work properly on all types of AE.
26982 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
26983 for compiled code, and is the default.
26985 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
26986 option may suffer from poor performance of byte (char) manipulation,
26987 since the DSP AE does not provide hardware support for byte load/stores.
26989 @item -msymbol-as-address
26990 Enable the compiler to directly use a symbol name as an address in a
26991 load/store instruction, without first loading it into a
26992 register. Typically, the use of this option generates larger
26993 programs, which run faster than when the option isn't used. However, the
26994 results vary from program to program, so it is left as a user option,
26995 rather than being permanently enabled.
26997 @item -mno-inefficient-warnings
26998 Disables warnings about the generation of inefficient code. These
26999 warnings can be generated, for example, when compiling code that
27000 performs byte-level memory operations on the MAC AE type. The MAC AE has
27001 no hardware support for byte-level memory operations, so all byte
27002 load/stores must be synthesized from word load/store operations. This is
27003 inefficient and a warning is generated to indicate
27004 that you should rewrite the code to avoid byte operations, or to target
27005 an AE type that has the necessary hardware support. This option disables
27010 @node PowerPC Options
27011 @subsection PowerPC Options
27012 @cindex PowerPC options
27014 These are listed under @xref{RS/6000 and PowerPC Options}.
27017 @subsection PRU Options
27018 @cindex PRU Options
27020 These command-line options are defined for PRU target:
27025 Link with a minimum runtime environment, with no support for static
27026 initializers and constructors. Using this option can significantly reduce
27027 the size of the final ELF binary. Beware that the compiler could still
27028 generate code with static initializers and constructors. It is up to the
27029 programmer to ensure that the source program will not use those features.
27031 @item -mmcu=@var{mcu}
27033 Specify the PRU MCU variant to use. Check Newlib for the exact list of
27038 Make GCC pass the @option{--no-relax} command-line option to the linker
27039 instead of the @option{--relax} option.
27043 Allow (or do not allow) GCC to use the LOOP instruction.
27045 @item -mabi=@var{variant}
27047 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
27048 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
27049 more naturally with certain GCC assumptions. These are the differences:
27052 @item Function Pointer Size
27053 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
27054 supports only 32-bit data and code pointers.
27056 @item Optional Return Value Pointer
27057 Function return values larger than 64 bits are passed by using a hidden
27058 pointer as the first argument of the function. TI ABI, though, mandates that
27059 the pointer can be NULL in case the caller is not using the returned value.
27060 GNU always passes and expects a valid return value pointer.
27064 The current @option{-mabi=ti} implementation simply raises a compile error
27065 when any of the above code constructs is detected. As a consequence
27066 the standard C library cannot be built and it is omitted when linking with
27069 Relaxation is a GNU feature and for safety reasons is disabled when using
27070 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
27071 instructions, so the GNU linker cannot adjust them when shortening adjacent
27072 LDI32 pseudo instructions.
27076 @node RISC-V Options
27077 @subsection RISC-V Options
27078 @cindex RISC-V Options
27080 These command-line options are defined for RISC-V targets:
27083 @item -mbranch-cost=@var{n}
27084 @opindex mbranch-cost
27085 Set the cost of branches to roughly @var{n} instructions.
27090 When generating PIC code, do or don't allow the use of PLTs. Ignored for
27091 non-PIC. The default is @option{-mplt}.
27093 @item -mabi=@var{ABI-string}
27095 Specify integer and floating-point calling convention. @var{ABI-string}
27096 contains two parts: the size of integer types and the registers used for
27097 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
27098 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
27099 32-bit), and that floating-point values up to 64 bits wide are passed in F
27100 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
27101 allows the compiler to generate code that uses the F and D extensions but only
27102 allows floating-point values up to 32 bits long to be passed in registers; or
27103 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
27104 passed in registers.
27106 The default for this argument is system dependent, users who want a specific
27107 calling convention should specify one explicitly. The valid calling
27108 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
27109 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
27110 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
27111 invalid because the ABI requires 64-bit values be passed in F registers, but F
27112 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
27113 only be used with the @samp{rv32e} architecture. This ABI is not well
27114 specified at present, and is subject to change.
27119 Do or don't use hardware floating-point divide and square root instructions.
27120 This requires the F or D extensions for floating-point registers. The default
27121 is to use them if the specified architecture has these instructions.
27126 Do or don't use hardware instructions for integer division. This requires the
27127 M extension. The default is to use them if the specified architecture has
27128 these instructions.
27130 @item -march=@var{ISA-string}
27132 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
27133 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
27136 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
27138 If both @option{-march} and @option{-mcpu=} are not specified, the default for
27139 this argument is system dependent, users who want a specific architecture
27140 extensions should specify one explicitly.
27142 @item -mcpu=@var{processor-string}
27144 Use architecture of and optimize the output for the given processor, specified
27145 by particular CPU name.
27146 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
27147 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
27148 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
27149 @samp{sifive-u54}, and @samp{sifive-u74}.
27151 @item -mtune=@var{processor-string}
27153 Optimize the output for the given processor, specified by microarchitecture or
27154 particular CPU name. Permissible values for this option are: @samp{rocket},
27155 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
27156 @samp{size}, and all valid options for @option{-mcpu=}.
27158 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
27159 the default is @samp{rocket} if both are not specified.
27161 The @samp{size} choice is not intended for use by end-users. This is used
27162 when @option{-Os} is specified. It overrides the instruction cost info
27163 provided by @option{-mtune=}, but does not override the pipeline info. This
27164 helps reduce code size while still giving good performance.
27166 @item -mpreferred-stack-boundary=@var{num}
27167 @opindex mpreferred-stack-boundary
27168 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27169 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27170 the default is 4 (16 bytes or 128-bits).
27172 @strong{Warning:} If you use this switch, then you must build all modules with
27173 the same value, including any libraries. This includes the system libraries
27174 and startup modules.
27176 @item -msmall-data-limit=@var{n}
27177 @opindex msmall-data-limit
27178 Put global and static data smaller than @var{n} bytes into a special section
27181 @item -msave-restore
27182 @itemx -mno-save-restore
27183 @opindex msave-restore
27184 Do or don't use smaller but slower prologue and epilogue code that uses
27185 library function calls. The default is to use fast inline prologues and
27188 @item -mshorten-memrefs
27189 @itemx -mno-shorten-memrefs
27190 @opindex mshorten-memrefs
27191 Do or do not attempt to make more use of compressed load/store instructions by
27192 replacing a load/store of 'base register + large offset' with a new load/store
27193 of 'new base + small offset'. If the new base gets stored in a compressed
27194 register, then the new load/store can be compressed. Currently targets 32-bit
27195 integer load/stores only.
27197 @item -mstrict-align
27198 @itemx -mno-strict-align
27199 @opindex mstrict-align
27200 Do not or do generate unaligned memory accesses. The default is set depending
27201 on whether the processor we are optimizing for supports fast unaligned access
27204 @item -mcmodel=medlow
27205 @opindex mcmodel=medlow
27206 Generate code for the medium-low code model. The program and its statically
27207 defined symbols must lie within a single 2 GiB address range and must lie
27208 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
27209 statically or dynamically linked. This is the default code model.
27211 @item -mcmodel=medany
27212 @opindex mcmodel=medany
27213 Generate code for the medium-any code model. The program and its statically
27214 defined symbols must be within any single 2 GiB address range. Programs can be
27215 statically or dynamically linked.
27217 @item -mexplicit-relocs
27218 @itemx -mno-exlicit-relocs
27219 Use or do not use assembler relocation operators when dealing with symbolic
27220 addresses. The alternative is to use assembler macros instead, which may
27221 limit optimization.
27225 Take advantage of linker relaxations to reduce the number of instructions
27226 required to materialize symbol addresses. The default is to take advantage of
27227 linker relaxations.
27229 @item -memit-attribute
27230 @itemx -mno-emit-attribute
27231 Emit (do not emit) RISC-V attribute to record extra information into ELF
27232 objects. This feature requires at least binutils 2.32.
27234 @item -malign-data=@var{type}
27235 @opindex malign-data
27236 Control how GCC aligns variables and constants of array, structure, or union
27237 types. Supported values for @var{type} are @samp{xlen} which uses x register
27238 width as the alignment value, and @samp{natural} which uses natural alignment.
27239 @samp{xlen} is the default.
27242 @opindex mbig-endian
27243 Generate big-endian code. This is the default when GCC is configured for a
27244 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
27246 @item -mlittle-endian
27247 @opindex mlittle-endian
27248 Generate little-endian code. This is the default when GCC is configured for a
27249 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
27250 @samp{riscv32be-*-*} target.
27252 @item -mstack-protector-guard=@var{guard}
27253 @itemx -mstack-protector-guard-reg=@var{reg}
27254 @itemx -mstack-protector-guard-offset=@var{offset}
27255 @opindex mstack-protector-guard
27256 @opindex mstack-protector-guard-reg
27257 @opindex mstack-protector-guard-offset
27258 Generate stack protection code using canary at @var{guard}. Supported
27259 locations are @samp{global} for a global canary or @samp{tls} for per-thread
27260 canary in the TLS block.
27262 With the latter choice the options
27263 @option{-mstack-protector-guard-reg=@var{reg}} and
27264 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27265 which register to use as base register for reading the canary,
27266 and from what offset from that base register. There is no default
27267 register or offset as this is entirely for use within the Linux
27272 @subsection RL78 Options
27273 @cindex RL78 Options
27279 Links in additional target libraries to support operation within a
27288 Specifies the type of hardware multiplication and division support to
27289 be used. The simplest is @code{none}, which uses software for both
27290 multiplication and division. This is the default. The @code{g13}
27291 value is for the hardware multiply/divide peripheral found on the
27292 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
27293 the multiplication and division instructions supported by the RL78/G14
27294 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
27295 the value @code{mg10} is an alias for @code{none}.
27297 In addition a C preprocessor macro is defined, based upon the setting
27298 of this option. Possible values are: @code{__RL78_MUL_NONE__},
27299 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
27306 Specifies the RL78 core to target. The default is the G14 core, also
27307 known as an S3 core or just RL78. The G13 or S2 core does not have
27308 multiply or divide instructions, instead it uses a hardware peripheral
27309 for these operations. The G10 or S1 core does not have register
27310 banks, so it uses a different calling convention.
27312 If this option is set it also selects the type of hardware multiply
27313 support to use, unless this is overridden by an explicit
27314 @option{-mmul=none} option on the command line. Thus specifying
27315 @option{-mcpu=g13} enables the use of the G13 hardware multiply
27316 peripheral and specifying @option{-mcpu=g10} disables the use of
27317 hardware multiplications altogether.
27319 Note, although the RL78/G14 core is the default target, specifying
27320 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
27321 change the behavior of the toolchain since it also enables G14
27322 hardware multiply support. If these options are not specified on the
27323 command line then software multiplication routines will be used even
27324 though the code targets the RL78 core. This is for backwards
27325 compatibility with older toolchains which did not have hardware
27326 multiply and divide support.
27328 In addition a C preprocessor macro is defined, based upon the setting
27329 of this option. Possible values are: @code{__RL78_G10__},
27330 @code{__RL78_G13__} or @code{__RL78_G14__}.
27340 These are aliases for the corresponding @option{-mcpu=} option. They
27341 are provided for backwards compatibility.
27345 Allow the compiler to use all of the available registers. By default
27346 registers @code{r24..r31} are reserved for use in interrupt handlers.
27347 With this option enabled these registers can be used in ordinary
27350 @item -m64bit-doubles
27351 @itemx -m32bit-doubles
27352 @opindex m64bit-doubles
27353 @opindex m32bit-doubles
27354 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
27355 or 32 bits (@option{-m32bit-doubles}) in size. The default is
27356 @option{-m32bit-doubles}.
27358 @item -msave-mduc-in-interrupts
27359 @itemx -mno-save-mduc-in-interrupts
27360 @opindex msave-mduc-in-interrupts
27361 @opindex mno-save-mduc-in-interrupts
27362 Specifies that interrupt handler functions should preserve the
27363 MDUC registers. This is only necessary if normal code might use
27364 the MDUC registers, for example because it performs multiplication
27365 and division operations. The default is to ignore the MDUC registers
27366 as this makes the interrupt handlers faster. The target option -mg13
27367 needs to be passed for this to work as this feature is only available
27368 on the G13 target (S2 core). The MDUC registers will only be saved
27369 if the interrupt handler performs a multiplication or division
27370 operation or it calls another function.
27374 @node RS/6000 and PowerPC Options
27375 @subsection IBM RS/6000 and PowerPC Options
27376 @cindex RS/6000 and PowerPC Options
27377 @cindex IBM RS/6000 and PowerPC Options
27379 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
27381 @item -mpowerpc-gpopt
27382 @itemx -mno-powerpc-gpopt
27383 @itemx -mpowerpc-gfxopt
27384 @itemx -mno-powerpc-gfxopt
27387 @itemx -mno-powerpc64
27391 @itemx -mno-popcntb
27393 @itemx -mno-popcntd
27400 @itemx -mno-hard-dfp
27401 @opindex mpowerpc-gpopt
27402 @opindex mno-powerpc-gpopt
27403 @opindex mpowerpc-gfxopt
27404 @opindex mno-powerpc-gfxopt
27405 @opindex mpowerpc64
27406 @opindex mno-powerpc64
27410 @opindex mno-popcntb
27412 @opindex mno-popcntd
27418 @opindex mno-hard-dfp
27419 You use these options to specify which instructions are available on the
27420 processor you are using. The default value of these options is
27421 determined when configuring GCC@. Specifying the
27422 @option{-mcpu=@var{cpu_type}} overrides the specification of these
27423 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
27424 rather than the options listed above.
27426 Specifying @option{-mpowerpc-gpopt} allows
27427 GCC to use the optional PowerPC architecture instructions in the
27428 General Purpose group, including floating-point square root. Specifying
27429 @option{-mpowerpc-gfxopt} allows GCC to
27430 use the optional PowerPC architecture instructions in the Graphics
27431 group, including floating-point select.
27433 The @option{-mmfcrf} option allows GCC to generate the move from
27434 condition register field instruction implemented on the POWER4
27435 processor and other processors that support the PowerPC V2.01
27437 The @option{-mpopcntb} option allows GCC to generate the popcount and
27438 double-precision FP reciprocal estimate instruction implemented on the
27439 POWER5 processor and other processors that support the PowerPC V2.02
27441 The @option{-mpopcntd} option allows GCC to generate the popcount
27442 instruction implemented on the POWER7 processor and other processors
27443 that support the PowerPC V2.06 architecture.
27444 The @option{-mfprnd} option allows GCC to generate the FP round to
27445 integer instructions implemented on the POWER5+ processor and other
27446 processors that support the PowerPC V2.03 architecture.
27447 The @option{-mcmpb} option allows GCC to generate the compare bytes
27448 instruction implemented on the POWER6 processor and other processors
27449 that support the PowerPC V2.05 architecture.
27450 The @option{-mhard-dfp} option allows GCC to generate the decimal
27451 floating-point instructions implemented on some POWER processors.
27453 The @option{-mpowerpc64} option allows GCC to generate the additional
27454 64-bit instructions that are found in the full PowerPC64 architecture
27455 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
27456 @option{-mno-powerpc64}.
27458 @item -mcpu=@var{cpu_type}
27460 Set architecture type, register usage, and
27461 instruction scheduling parameters for machine type @var{cpu_type}.
27462 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
27463 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
27464 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
27465 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
27466 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
27467 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
27468 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
27469 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
27470 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
27471 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
27472 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
27473 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
27475 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
27476 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
27477 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
27478 architecture machine types, with an appropriate, generic processor
27479 model assumed for scheduling purposes.
27481 Specifying @samp{native} as cpu type detects and selects the
27482 architecture option that corresponds to the host processor of the
27483 system performing the compilation.
27484 @option{-mcpu=native} has no effect if GCC does not recognize the
27487 The other options specify a specific processor. Code generated under
27488 those options runs best on that processor, and may not run at all on
27491 The @option{-mcpu} options automatically enable or disable the
27494 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
27495 -mpopcntb -mpopcntd -mpowerpc64 @gol
27496 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
27497 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
27498 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
27499 -mquad-memory -mquad-memory-atomic -mfloat128 @gol
27500 -mfloat128-hardware -mprefixed -mpcrel -mmma @gol
27503 The particular options set for any particular CPU varies between
27504 compiler versions, depending on what setting seems to produce optimal
27505 code for that CPU; it doesn't necessarily reflect the actual hardware's
27506 capabilities. If you wish to set an individual option to a particular
27507 value, you may specify it after the @option{-mcpu} option, like
27508 @option{-mcpu=970 -mno-altivec}.
27510 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
27511 not enabled or disabled by the @option{-mcpu} option at present because
27512 AIX does not have full support for these options. You may still
27513 enable or disable them individually if you're sure it'll work in your
27516 @item -mtune=@var{cpu_type}
27518 Set the instruction scheduling parameters for machine type
27519 @var{cpu_type}, but do not set the architecture type or register usage,
27520 as @option{-mcpu=@var{cpu_type}} does. The same
27521 values for @var{cpu_type} are used for @option{-mtune} as for
27522 @option{-mcpu}. If both are specified, the code generated uses the
27523 architecture and registers set by @option{-mcpu}, but the
27524 scheduling parameters set by @option{-mtune}.
27526 @item -mcmodel=small
27527 @opindex mcmodel=small
27528 Generate PowerPC64 code for the small model: The TOC is limited to
27531 @item -mcmodel=medium
27532 @opindex mcmodel=medium
27533 Generate PowerPC64 code for the medium model: The TOC and other static
27534 data may be up to a total of 4G in size. This is the default for 64-bit
27537 @item -mcmodel=large
27538 @opindex mcmodel=large
27539 Generate PowerPC64 code for the large model: The TOC may be up to 4G
27540 in size. Other data and code is only limited by the 64-bit address
27544 @itemx -mno-altivec
27546 @opindex mno-altivec
27547 Generate code that uses (does not use) AltiVec instructions, and also
27548 enable the use of built-in functions that allow more direct access to
27549 the AltiVec instruction set. You may also need to set
27550 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
27553 When @option{-maltivec} is used, the element order for AltiVec intrinsics
27554 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
27555 match array element order corresponding to the endianness of the
27556 target. That is, element zero identifies the leftmost element in a
27557 vector register when targeting a big-endian platform, and identifies
27558 the rightmost element in a vector register when targeting a
27559 little-endian platform.
27564 @opindex mno-vrsave
27565 Generate VRSAVE instructions when generating AltiVec code.
27568 @opindex msecure-plt
27569 Generate code that allows @command{ld} and @command{ld.so}
27570 to build executables and shared
27571 libraries with non-executable @code{.plt} and @code{.got} sections.
27573 32-bit SYSV ABI option.
27577 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
27579 requires @code{.plt} and @code{.got}
27580 sections that are both writable and executable.
27581 This is a PowerPC 32-bit SYSV ABI option.
27587 This switch enables or disables the generation of ISEL instructions.
27593 Generate code that uses (does not use) vector/scalar (VSX)
27594 instructions, and also enable the use of built-in functions that allow
27595 more direct access to the VSX instruction set.
27600 @opindex mno-crypto
27601 Enable the use (disable) of the built-in functions that allow direct
27602 access to the cryptographic instructions that were added in version
27603 2.07 of the PowerPC ISA.
27609 Enable (disable) the use of the built-in functions that allow direct
27610 access to the Hardware Transactional Memory (HTM) instructions that
27611 were added in version 2.07 of the PowerPC ISA.
27613 @item -mpower8-fusion
27614 @itemx -mno-power8-fusion
27615 @opindex mpower8-fusion
27616 @opindex mno-power8-fusion
27617 Generate code that keeps (does not keeps) some integer operations
27618 adjacent so that the instructions can be fused together on power8 and
27621 @item -mpower8-vector
27622 @itemx -mno-power8-vector
27623 @opindex mpower8-vector
27624 @opindex mno-power8-vector
27625 Generate code that uses (does not use) the vector and scalar
27626 instructions that were added in version 2.07 of the PowerPC ISA. Also
27627 enable the use of built-in functions that allow more direct access to
27628 the vector instructions.
27630 @item -mquad-memory
27631 @itemx -mno-quad-memory
27632 @opindex mquad-memory
27633 @opindex mno-quad-memory
27634 Generate code that uses (does not use) the non-atomic quad word memory
27635 instructions. The @option{-mquad-memory} option requires use of
27638 @item -mquad-memory-atomic
27639 @itemx -mno-quad-memory-atomic
27640 @opindex mquad-memory-atomic
27641 @opindex mno-quad-memory-atomic
27642 Generate code that uses (does not use) the atomic quad word memory
27643 instructions. The @option{-mquad-memory-atomic} option requires use of
27647 @itemx -mno-float128
27649 @opindex mno-float128
27650 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
27651 and use either software emulation for IEEE 128-bit floating point or
27652 hardware instructions.
27654 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
27655 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
27656 use the IEEE 128-bit floating point support. The IEEE 128-bit
27657 floating point support only works on PowerPC Linux systems.
27659 The default for @option{-mfloat128} is enabled on PowerPC Linux
27660 systems using the VSX instruction set, and disabled on other systems.
27662 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
27663 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
27664 point support will also enable the generation of ISA 3.0 IEEE 128-bit
27665 floating point instructions. Otherwise, if you do not specify to
27666 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
27667 system, IEEE 128-bit floating point will be done with software
27670 @item -mfloat128-hardware
27671 @itemx -mno-float128-hardware
27672 @opindex mfloat128-hardware
27673 @opindex mno-float128-hardware
27674 Enable/disable using ISA 3.0 hardware instructions to support the
27675 @var{__float128} data type.
27677 The default for @option{-mfloat128-hardware} is enabled on PowerPC
27678 Linux systems using the ISA 3.0 instruction set, and disabled on other
27685 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
27686 targets (including GNU/Linux). The 32-bit environment sets int, long
27687 and pointer to 32 bits and generates code that runs on any PowerPC
27688 variant. The 64-bit environment sets int to 32 bits and long and
27689 pointer to 64 bits, and generates code for PowerPC64, as for
27690 @option{-mpowerpc64}.
27693 @itemx -mno-fp-in-toc
27694 @itemx -mno-sum-in-toc
27695 @itemx -mminimal-toc
27697 @opindex mno-fp-in-toc
27698 @opindex mno-sum-in-toc
27699 @opindex mminimal-toc
27700 Modify generation of the TOC (Table Of Contents), which is created for
27701 every executable file. The @option{-mfull-toc} option is selected by
27702 default. In that case, GCC allocates at least one TOC entry for
27703 each unique non-automatic variable reference in your program. GCC
27704 also places floating-point constants in the TOC@. However, only
27705 16,384 entries are available in the TOC@.
27707 If you receive a linker error message that saying you have overflowed
27708 the available TOC space, you can reduce the amount of TOC space used
27709 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
27710 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
27711 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
27712 generate code to calculate the sum of an address and a constant at
27713 run time instead of putting that sum into the TOC@. You may specify one
27714 or both of these options. Each causes GCC to produce very slightly
27715 slower and larger code at the expense of conserving TOC space.
27717 If you still run out of space in the TOC even when you specify both of
27718 these options, specify @option{-mminimal-toc} instead. This option causes
27719 GCC to make only one TOC entry for every file. When you specify this
27720 option, GCC produces code that is slower and larger but which
27721 uses extremely little TOC space. You may wish to use this option
27722 only on files that contain less frequently-executed code.
27728 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
27729 @code{long} type, and the infrastructure needed to support them.
27730 Specifying @option{-maix64} implies @option{-mpowerpc64},
27731 while @option{-maix32} disables the 64-bit ABI and
27732 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
27735 @itemx -mno-xl-compat
27736 @opindex mxl-compat
27737 @opindex mno-xl-compat
27738 Produce code that conforms more closely to IBM XL compiler semantics
27739 when using AIX-compatible ABI@. Pass floating-point arguments to
27740 prototyped functions beyond the register save area (RSA) on the stack
27741 in addition to argument FPRs. Do not assume that most significant
27742 double in 128-bit long double value is properly rounded when comparing
27743 values and converting to double. Use XL symbol names for long double
27746 The AIX calling convention was extended but not initially documented to
27747 handle an obscure K&R C case of calling a function that takes the
27748 address of its arguments with fewer arguments than declared. IBM XL
27749 compilers access floating-point arguments that do not fit in the
27750 RSA from the stack when a subroutine is compiled without
27751 optimization. Because always storing floating-point arguments on the
27752 stack is inefficient and rarely needed, this option is not enabled by
27753 default and only is necessary when calling subroutines compiled by IBM
27754 XL compilers without optimization.
27758 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
27759 application written to use message passing with special startup code to
27760 enable the application to run. The system must have PE installed in the
27761 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
27762 must be overridden with the @option{-specs=} option to specify the
27763 appropriate directory location. The Parallel Environment does not
27764 support threads, so the @option{-mpe} option and the @option{-pthread}
27765 option are incompatible.
27767 @item -malign-natural
27768 @itemx -malign-power
27769 @opindex malign-natural
27770 @opindex malign-power
27771 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
27772 @option{-malign-natural} overrides the ABI-defined alignment of larger
27773 types, such as floating-point doubles, on their natural size-based boundary.
27774 The option @option{-malign-power} instructs GCC to follow the ABI-specified
27775 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
27777 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
27781 @itemx -mhard-float
27782 @opindex msoft-float
27783 @opindex mhard-float
27784 Generate code that does not use (uses) the floating-point register set.
27785 Software floating-point emulation is provided if you use the
27786 @option{-msoft-float} option, and pass the option to GCC when linking.
27789 @itemx -mno-multiple
27791 @opindex mno-multiple
27792 Generate code that uses (does not use) the load multiple word
27793 instructions and the store multiple word instructions. These
27794 instructions are generated by default on POWER systems, and not
27795 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
27796 PowerPC systems, since those instructions do not work when the
27797 processor is in little-endian mode. The exceptions are PPC740 and
27798 PPC750 which permit these instructions in little-endian mode.
27803 @opindex mno-update
27804 Generate code that uses (does not use) the load or store instructions
27805 that update the base register to the address of the calculated memory
27806 location. These instructions are generated by default. If you use
27807 @option{-mno-update}, there is a small window between the time that the
27808 stack pointer is updated and the address of the previous frame is
27809 stored, which means code that walks the stack frame across interrupts or
27810 signals may get corrupted data.
27812 @item -mavoid-indexed-addresses
27813 @itemx -mno-avoid-indexed-addresses
27814 @opindex mavoid-indexed-addresses
27815 @opindex mno-avoid-indexed-addresses
27816 Generate code that tries to avoid (not avoid) the use of indexed load
27817 or store instructions. These instructions can incur a performance
27818 penalty on Power6 processors in certain situations, such as when
27819 stepping through large arrays that cross a 16M boundary. This option
27820 is enabled by default when targeting Power6 and disabled otherwise.
27823 @itemx -mno-fused-madd
27824 @opindex mfused-madd
27825 @opindex mno-fused-madd
27826 Generate code that uses (does not use) the floating-point multiply and
27827 accumulate instructions. These instructions are generated by default
27828 if hardware floating point is used. The machine-dependent
27829 @option{-mfused-madd} option is now mapped to the machine-independent
27830 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27831 mapped to @option{-ffp-contract=off}.
27837 Generate code that uses (does not use) the half-word multiply and
27838 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
27839 These instructions are generated by default when targeting those
27846 Generate code that uses (does not use) the string-search @samp{dlmzb}
27847 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
27848 generated by default when targeting those processors.
27850 @item -mno-bit-align
27852 @opindex mno-bit-align
27853 @opindex mbit-align
27854 On System V.4 and embedded PowerPC systems do not (do) force structures
27855 and unions that contain bit-fields to be aligned to the base type of the
27858 For example, by default a structure containing nothing but 8
27859 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
27860 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
27861 the structure is aligned to a 1-byte boundary and is 1 byte in
27864 @item -mno-strict-align
27865 @itemx -mstrict-align
27866 @opindex mno-strict-align
27867 @opindex mstrict-align
27868 On System V.4 and embedded PowerPC systems do not (do) assume that
27869 unaligned memory references are handled by the system.
27871 @item -mrelocatable
27872 @itemx -mno-relocatable
27873 @opindex mrelocatable
27874 @opindex mno-relocatable
27875 Generate code that allows (does not allow) a static executable to be
27876 relocated to a different address at run time. A simple embedded
27877 PowerPC system loader should relocate the entire contents of
27878 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
27879 a table of 32-bit addresses generated by this option. For this to
27880 work, all objects linked together must be compiled with
27881 @option{-mrelocatable} or @option{-mrelocatable-lib}.
27882 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
27884 @item -mrelocatable-lib
27885 @itemx -mno-relocatable-lib
27886 @opindex mrelocatable-lib
27887 @opindex mno-relocatable-lib
27888 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
27889 @code{.fixup} section to allow static executables to be relocated at
27890 run time, but @option{-mrelocatable-lib} does not use the smaller stack
27891 alignment of @option{-mrelocatable}. Objects compiled with
27892 @option{-mrelocatable-lib} may be linked with objects compiled with
27893 any combination of the @option{-mrelocatable} options.
27899 On System V.4 and embedded PowerPC systems do not (do) assume that
27900 register 2 contains a pointer to a global area pointing to the addresses
27901 used in the program.
27904 @itemx -mlittle-endian
27906 @opindex mlittle-endian
27907 On System V.4 and embedded PowerPC systems compile code for the
27908 processor in little-endian mode. The @option{-mlittle-endian} option is
27909 the same as @option{-mlittle}.
27912 @itemx -mbig-endian
27914 @opindex mbig-endian
27915 On System V.4 and embedded PowerPC systems compile code for the
27916 processor in big-endian mode. The @option{-mbig-endian} option is
27917 the same as @option{-mbig}.
27919 @item -mdynamic-no-pic
27920 @opindex mdynamic-no-pic
27921 On Darwin and Mac OS X systems, compile code so that it is not
27922 relocatable, but that its external references are relocatable. The
27923 resulting code is suitable for applications, but not shared
27926 @item -msingle-pic-base
27927 @opindex msingle-pic-base
27928 Treat the register used for PIC addressing as read-only, rather than
27929 loading it in the prologue for each function. The runtime system is
27930 responsible for initializing this register with an appropriate value
27931 before execution begins.
27933 @item -mprioritize-restricted-insns=@var{priority}
27934 @opindex mprioritize-restricted-insns
27935 This option controls the priority that is assigned to
27936 dispatch-slot restricted instructions during the second scheduling
27937 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
27938 or @samp{2} to assign no, highest, or second-highest (respectively)
27939 priority to dispatch-slot restricted
27942 @item -msched-costly-dep=@var{dependence_type}
27943 @opindex msched-costly-dep
27944 This option controls which dependences are considered costly
27945 by the target during instruction scheduling. The argument
27946 @var{dependence_type} takes one of the following values:
27950 No dependence is costly.
27953 All dependences are costly.
27955 @item @samp{true_store_to_load}
27956 A true dependence from store to load is costly.
27958 @item @samp{store_to_load}
27959 Any dependence from store to load is costly.
27962 Any dependence for which the latency is greater than or equal to
27963 @var{number} is costly.
27966 @item -minsert-sched-nops=@var{scheme}
27967 @opindex minsert-sched-nops
27968 This option controls which NOP insertion scheme is used during
27969 the second scheduling pass. The argument @var{scheme} takes one of the
27977 Pad with NOPs any dispatch group that has vacant issue slots,
27978 according to the scheduler's grouping.
27980 @item @samp{regroup_exact}
27981 Insert NOPs to force costly dependent insns into
27982 separate groups. Insert exactly as many NOPs as needed to force an insn
27983 to a new group, according to the estimated processor grouping.
27986 Insert NOPs to force costly dependent insns into
27987 separate groups. Insert @var{number} NOPs to force an insn to a new group.
27991 @opindex mcall-sysv
27992 On System V.4 and embedded PowerPC systems compile code using calling
27993 conventions that adhere to the March 1995 draft of the System V
27994 Application Binary Interface, PowerPC processor supplement. This is the
27995 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
27997 @item -mcall-sysv-eabi
27999 @opindex mcall-sysv-eabi
28000 @opindex mcall-eabi
28001 Specify both @option{-mcall-sysv} and @option{-meabi} options.
28003 @item -mcall-sysv-noeabi
28004 @opindex mcall-sysv-noeabi
28005 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
28007 @item -mcall-aixdesc
28009 On System V.4 and embedded PowerPC systems compile code for the AIX
28013 @opindex mcall-linux
28014 On System V.4 and embedded PowerPC systems compile code for the
28015 Linux-based GNU system.
28017 @item -mcall-freebsd
28018 @opindex mcall-freebsd
28019 On System V.4 and embedded PowerPC systems compile code for the
28020 FreeBSD operating system.
28022 @item -mcall-netbsd
28023 @opindex mcall-netbsd
28024 On System V.4 and embedded PowerPC systems compile code for the
28025 NetBSD operating system.
28027 @item -mcall-openbsd
28028 @opindex mcall-netbsd
28029 On System V.4 and embedded PowerPC systems compile code for the
28030 OpenBSD operating system.
28032 @item -mtraceback=@var{traceback_type}
28033 @opindex mtraceback
28034 Select the type of traceback table. Valid values for @var{traceback_type}
28035 are @samp{full}, @samp{part}, and @samp{no}.
28037 @item -maix-struct-return
28038 @opindex maix-struct-return
28039 Return all structures in memory (as specified by the AIX ABI)@.
28041 @item -msvr4-struct-return
28042 @opindex msvr4-struct-return
28043 Return structures smaller than 8 bytes in registers (as specified by the
28046 @item -mabi=@var{abi-type}
28048 Extend the current ABI with a particular extension, or remove such extension.
28049 Valid values are: @samp{altivec}, @samp{no-altivec},
28050 @samp{ibmlongdouble}, @samp{ieeelongdouble},
28051 @samp{elfv1}, @samp{elfv2},
28052 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
28054 @item -mabi=ibmlongdouble
28055 @opindex mabi=ibmlongdouble
28056 Change the current ABI to use IBM extended-precision long double.
28057 This is not likely to work if your system defaults to using IEEE
28058 extended-precision long double. If you change the long double type
28059 from IEEE extended-precision, the compiler will issue a warning unless
28060 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
28063 @item -mabi=ieeelongdouble
28064 @opindex mabi=ieeelongdouble
28065 Change the current ABI to use IEEE extended-precision long double.
28066 This is not likely to work if your system defaults to using IBM
28067 extended-precision long double. If you change the long double type
28068 from IBM extended-precision, the compiler will issue a warning unless
28069 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
28073 @opindex mabi=elfv1
28074 Change the current ABI to use the ELFv1 ABI.
28075 This is the default ABI for big-endian PowerPC 64-bit Linux.
28076 Overriding the default ABI requires special system support and is
28077 likely to fail in spectacular ways.
28080 @opindex mabi=elfv2
28081 Change the current ABI to use the ELFv2 ABI.
28082 This is the default ABI for little-endian PowerPC 64-bit Linux.
28083 Overriding the default ABI requires special system support and is
28084 likely to fail in spectacular ways.
28086 @item -mgnu-attribute
28087 @itemx -mno-gnu-attribute
28088 @opindex mgnu-attribute
28089 @opindex mno-gnu-attribute
28090 Emit .gnu_attribute assembly directives to set tag/value pairs in a
28091 .gnu.attributes section that specify ABI variations in function
28092 parameters or return values.
28095 @itemx -mno-prototype
28096 @opindex mprototype
28097 @opindex mno-prototype
28098 On System V.4 and embedded PowerPC systems assume that all calls to
28099 variable argument functions are properly prototyped. Otherwise, the
28100 compiler must insert an instruction before every non-prototyped call to
28101 set or clear bit 6 of the condition code register (@code{CR}) to
28102 indicate whether floating-point values are passed in the floating-point
28103 registers in case the function takes variable arguments. With
28104 @option{-mprototype}, only calls to prototyped variable argument functions
28105 set or clear the bit.
28109 On embedded PowerPC systems, assume that the startup module is called
28110 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
28111 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
28116 On embedded PowerPC systems, assume that the startup module is called
28117 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
28122 On embedded PowerPC systems, assume that the startup module is called
28123 @file{crt0.o} and the standard C libraries are @file{libads.a} and
28126 @item -myellowknife
28127 @opindex myellowknife
28128 On embedded PowerPC systems, assume that the startup module is called
28129 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
28134 On System V.4 and embedded PowerPC systems, specify that you are
28135 compiling for a VxWorks system.
28139 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
28140 header to indicate that @samp{eabi} extended relocations are used.
28146 On System V.4 and embedded PowerPC systems do (do not) adhere to the
28147 Embedded Applications Binary Interface (EABI), which is a set of
28148 modifications to the System V.4 specifications. Selecting @option{-meabi}
28149 means that the stack is aligned to an 8-byte boundary, a function
28150 @code{__eabi} is called from @code{main} to set up the EABI
28151 environment, and the @option{-msdata} option can use both @code{r2} and
28152 @code{r13} to point to two separate small data areas. Selecting
28153 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
28154 no EABI initialization function is called from @code{main}, and the
28155 @option{-msdata} option only uses @code{r13} to point to a single
28156 small data area. The @option{-meabi} option is on by default if you
28157 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
28160 @opindex msdata=eabi
28161 On System V.4 and embedded PowerPC systems, put small initialized
28162 @code{const} global and static data in the @code{.sdata2} section, which
28163 is pointed to by register @code{r2}. Put small initialized
28164 non-@code{const} global and static data in the @code{.sdata} section,
28165 which is pointed to by register @code{r13}. Put small uninitialized
28166 global and static data in the @code{.sbss} section, which is adjacent to
28167 the @code{.sdata} section. The @option{-msdata=eabi} option is
28168 incompatible with the @option{-mrelocatable} option. The
28169 @option{-msdata=eabi} option also sets the @option{-memb} option.
28172 @opindex msdata=sysv
28173 On System V.4 and embedded PowerPC systems, put small global and static
28174 data in the @code{.sdata} section, which is pointed to by register
28175 @code{r13}. Put small uninitialized global and static data in the
28176 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
28177 The @option{-msdata=sysv} option is incompatible with the
28178 @option{-mrelocatable} option.
28180 @item -msdata=default
28182 @opindex msdata=default
28184 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
28185 compile code the same as @option{-msdata=eabi}, otherwise compile code the
28186 same as @option{-msdata=sysv}.
28189 @opindex msdata=data
28190 On System V.4 and embedded PowerPC systems, put small global
28191 data in the @code{.sdata} section. Put small uninitialized global
28192 data in the @code{.sbss} section. Do not use register @code{r13}
28193 to address small data however. This is the default behavior unless
28194 other @option{-msdata} options are used.
28198 @opindex msdata=none
28200 On embedded PowerPC systems, put all initialized global and static data
28201 in the @code{.data} section, and all uninitialized data in the
28202 @code{.bss} section.
28204 @item -mreadonly-in-sdata
28205 @opindex mreadonly-in-sdata
28206 @opindex mno-readonly-in-sdata
28207 Put read-only objects in the @code{.sdata} section as well. This is the
28210 @item -mblock-move-inline-limit=@var{num}
28211 @opindex mblock-move-inline-limit
28212 Inline all block moves (such as calls to @code{memcpy} or structure
28213 copies) less than or equal to @var{num} bytes. The minimum value for
28214 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
28215 targets. The default value is target-specific.
28217 @item -mblock-compare-inline-limit=@var{num}
28218 @opindex mblock-compare-inline-limit
28219 Generate non-looping inline code for all block compares (such as calls
28220 to @code{memcmp} or structure compares) less than or equal to @var{num}
28221 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
28222 block compare is disabled. The default value is target-specific.
28224 @item -mblock-compare-inline-loop-limit=@var{num}
28225 @opindex mblock-compare-inline-loop-limit
28226 Generate an inline expansion using loop code for all block compares that
28227 are less than or equal to @var{num} bytes, but greater than the limit
28228 for non-loop inline block compare expansion. If the block length is not
28229 constant, at most @var{num} bytes will be compared before @code{memcmp}
28230 is called to compare the remainder of the block. The default value is
28233 @item -mstring-compare-inline-limit=@var{num}
28234 @opindex mstring-compare-inline-limit
28235 Compare at most @var{num} string bytes with inline code.
28236 If the difference or end of string is not found at the
28237 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
28238 take care of the rest of the comparison. The default is 64 bytes.
28242 @cindex smaller data references (PowerPC)
28243 @cindex .sdata/.sdata2 references (PowerPC)
28244 On embedded PowerPC systems, put global and static items less than or
28245 equal to @var{num} bytes into the small data or BSS sections instead of
28246 the normal data or BSS section. By default, @var{num} is 8. The
28247 @option{-G @var{num}} switch is also passed to the linker.
28248 All modules should be compiled with the same @option{-G @var{num}} value.
28251 @itemx -mno-regnames
28253 @opindex mno-regnames
28254 On System V.4 and embedded PowerPC systems do (do not) emit register
28255 names in the assembly language output using symbolic forms.
28258 @itemx -mno-longcall
28260 @opindex mno-longcall
28261 By default assume that all calls are far away so that a longer and more
28262 expensive calling sequence is required. This is required for calls
28263 farther than 32 megabytes (33,554,432 bytes) from the current location.
28264 A short call is generated if the compiler knows
28265 the call cannot be that far away. This setting can be overridden by
28266 the @code{shortcall} function attribute, or by @code{#pragma
28269 Some linkers are capable of detecting out-of-range calls and generating
28270 glue code on the fly. On these systems, long calls are unnecessary and
28271 generate slower code. As of this writing, the AIX linker can do this,
28272 as can the GNU linker for PowerPC/64. It is planned to add this feature
28273 to the GNU linker for 32-bit PowerPC systems as well.
28275 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
28276 GCC can generate long calls using an inline PLT call sequence (see
28277 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
28278 ELFv1 (big-endian) do not support inline PLT calls.
28280 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
28281 callee, L42}, plus a @dfn{branch island} (glue code). The two target
28282 addresses represent the callee and the branch island. The
28283 Darwin/PPC linker prefers the first address and generates a @code{bl
28284 callee} if the PPC @code{bl} instruction reaches the callee directly;
28285 otherwise, the linker generates @code{bl L42} to call the branch
28286 island. The branch island is appended to the body of the
28287 calling function; it computes the full 32-bit address of the callee
28290 On Mach-O (Darwin) systems, this option directs the compiler emit to
28291 the glue for every direct call, and the Darwin linker decides whether
28292 to use or discard it.
28294 In the future, GCC may ignore all longcall specifications
28295 when the linker is known to generate glue.
28300 @opindex mno-pltseq
28301 Implement (do not implement) -fno-plt and long calls using an inline
28302 PLT call sequence that supports lazy linking and long calls to
28303 functions in dlopen'd shared libraries. Inline PLT calls are only
28304 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
28305 linkers, and are enabled by default if the support is detected when
28306 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
28307 configured with @option{--enable-secureplt}. @option{-mpltseq} code
28308 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
28311 @item -mtls-markers
28312 @itemx -mno-tls-markers
28313 @opindex mtls-markers
28314 @opindex mno-tls-markers
28315 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
28316 specifying the function argument. The relocation allows the linker to
28317 reliably associate function call with argument setup instructions for
28318 TLS optimization, which in turn allows GCC to better schedule the
28324 This option enables use of the reciprocal estimate and
28325 reciprocal square root estimate instructions with additional
28326 Newton-Raphson steps to increase precision instead of doing a divide or
28327 square root and divide for floating-point arguments. You should use
28328 the @option{-ffast-math} option when using @option{-mrecip} (or at
28329 least @option{-funsafe-math-optimizations},
28330 @option{-ffinite-math-only}, @option{-freciprocal-math} and
28331 @option{-fno-trapping-math}). Note that while the throughput of the
28332 sequence is generally higher than the throughput of the non-reciprocal
28333 instruction, the precision of the sequence can be decreased by up to 2
28334 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
28337 @item -mrecip=@var{opt}
28338 @opindex mrecip=opt
28339 This option controls which reciprocal estimate instructions
28340 may be used. @var{opt} is a comma-separated list of options, which may
28341 be preceded by a @code{!} to invert the option:
28346 Enable all estimate instructions.
28349 Enable the default instructions, equivalent to @option{-mrecip}.
28352 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28355 Enable the reciprocal approximation instructions for both
28356 single and double precision.
28359 Enable the single-precision reciprocal approximation instructions.
28362 Enable the double-precision reciprocal approximation instructions.
28365 Enable the reciprocal square root approximation instructions for both
28366 single and double precision.
28369 Enable the single-precision reciprocal square root approximation instructions.
28372 Enable the double-precision reciprocal square root approximation instructions.
28376 So, for example, @option{-mrecip=all,!rsqrtd} enables
28377 all of the reciprocal estimate instructions, except for the
28378 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
28379 which handle the double-precision reciprocal square root calculations.
28381 @item -mrecip-precision
28382 @itemx -mno-recip-precision
28383 @opindex mrecip-precision
28384 Assume (do not assume) that the reciprocal estimate instructions
28385 provide higher-precision estimates than is mandated by the PowerPC
28386 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
28387 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
28388 The double-precision square root estimate instructions are not generated by
28389 default on low-precision machines, since they do not provide an
28390 estimate that converges after three steps.
28392 @item -mveclibabi=@var{type}
28393 @opindex mveclibabi
28394 Specifies the ABI type to use for vectorizing intrinsics using an
28395 external library. The only type supported at present is @samp{mass},
28396 which specifies to use IBM's Mathematical Acceleration Subsystem
28397 (MASS) libraries for vectorizing intrinsics using external libraries.
28398 GCC currently emits calls to @code{acosd2}, @code{acosf4},
28399 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
28400 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
28401 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
28402 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
28403 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
28404 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
28405 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
28406 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
28407 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
28408 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
28409 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
28410 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
28411 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
28412 for power7. Both @option{-ftree-vectorize} and
28413 @option{-funsafe-math-optimizations} must also be enabled. The MASS
28414 libraries must be specified at link time.
28419 Generate (do not generate) the @code{friz} instruction when the
28420 @option{-funsafe-math-optimizations} option is used to optimize
28421 rounding of floating-point values to 64-bit integer and back to floating
28422 point. The @code{friz} instruction does not return the same value if
28423 the floating-point number is too large to fit in an integer.
28425 @item -mpointers-to-nested-functions
28426 @itemx -mno-pointers-to-nested-functions
28427 @opindex mpointers-to-nested-functions
28428 Generate (do not generate) code to load up the static chain register
28429 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
28430 systems where a function pointer points to a 3-word descriptor giving
28431 the function address, TOC value to be loaded in register @code{r2}, and
28432 static chain value to be loaded in register @code{r11}. The
28433 @option{-mpointers-to-nested-functions} is on by default. You cannot
28434 call through pointers to nested functions or pointers
28435 to functions compiled in other languages that use the static chain if
28436 you use @option{-mno-pointers-to-nested-functions}.
28438 @item -msave-toc-indirect
28439 @itemx -mno-save-toc-indirect
28440 @opindex msave-toc-indirect
28441 Generate (do not generate) code to save the TOC value in the reserved
28442 stack location in the function prologue if the function calls through
28443 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
28444 saved in the prologue, it is saved just before the call through the
28445 pointer. The @option{-mno-save-toc-indirect} option is the default.
28447 @item -mcompat-align-parm
28448 @itemx -mno-compat-align-parm
28449 @opindex mcompat-align-parm
28450 Generate (do not generate) code to pass structure parameters with a
28451 maximum alignment of 64 bits, for compatibility with older versions
28454 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
28455 structure parameter on a 128-bit boundary when that structure contained
28456 a member requiring 128-bit alignment. This is corrected in more
28457 recent versions of GCC. This option may be used to generate code
28458 that is compatible with functions compiled with older versions of
28461 The @option{-mno-compat-align-parm} option is the default.
28463 @item -mstack-protector-guard=@var{guard}
28464 @itemx -mstack-protector-guard-reg=@var{reg}
28465 @itemx -mstack-protector-guard-offset=@var{offset}
28466 @itemx -mstack-protector-guard-symbol=@var{symbol}
28467 @opindex mstack-protector-guard
28468 @opindex mstack-protector-guard-reg
28469 @opindex mstack-protector-guard-offset
28470 @opindex mstack-protector-guard-symbol
28471 Generate stack protection code using canary at @var{guard}. Supported
28472 locations are @samp{global} for global canary or @samp{tls} for per-thread
28473 canary in the TLS block (the default with GNU libc version 2.4 or later).
28475 With the latter choice the options
28476 @option{-mstack-protector-guard-reg=@var{reg}} and
28477 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28478 which register to use as base register for reading the canary, and from what
28479 offset from that base register. The default for those is as specified in the
28480 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
28481 the offset with a symbol reference to a canary in the TLS block.
28487 Generate (do not generate) pc-relative addressing when the option
28488 @option{-mcpu=future} is used. The @option{-mpcrel} option requires
28489 that the medium code model (@option{-mcmodel=medium}) and prefixed
28490 addressing (@option{-mprefixed}) options are enabled.
28493 @itemx -mno-prefixed
28495 @opindex mno-prefixed
28496 Generate (do not generate) addressing modes using prefixed load and
28497 store instructions when the option @option{-mcpu=future} is used.
28503 Generate (do not generate) the MMA instructions when the option
28504 @option{-mcpu=future} is used.
28506 @item -mrop-protect
28507 @itemx -mno-rop-protect
28508 @opindex mrop-protect
28509 @opindex mno-rop-protect
28510 Generate (do not generate) ROP protection instructions when the target
28511 processor supports them. Currently this option disables the shrink-wrap
28512 optimization (@option{-fshrink-wrap}).
28515 @itemx -mno-privileged
28516 @opindex mprivileged
28517 @opindex mno-privileged
28518 Generate (do not generate) code that will run in privileged state.
28520 @item -mblock-ops-unaligned-vsx
28521 @itemx -mno-block-ops-unaligned-vsx
28522 @opindex block-ops-unaligned-vsx
28523 @opindex no-block-ops-unaligned-vsx
28524 Generate (do not generate) unaligned vsx loads and stores for
28525 inline expansion of @code{memcpy} and @code{memmove}.
28529 @subsection RX Options
28532 These command-line options are defined for RX targets:
28535 @item -m64bit-doubles
28536 @itemx -m32bit-doubles
28537 @opindex m64bit-doubles
28538 @opindex m32bit-doubles
28539 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
28540 or 32 bits (@option{-m32bit-doubles}) in size. The default is
28541 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
28542 works on 32-bit values, which is why the default is
28543 @option{-m32bit-doubles}.
28549 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
28550 floating-point hardware. The default is enabled for the RX600
28551 series and disabled for the RX200 series.
28553 Floating-point instructions are only generated for 32-bit floating-point
28554 values, however, so the FPU hardware is not used for doubles if the
28555 @option{-m64bit-doubles} option is used.
28557 @emph{Note} If the @option{-fpu} option is enabled then
28558 @option{-funsafe-math-optimizations} is also enabled automatically.
28559 This is because the RX FPU instructions are themselves unsafe.
28561 @item -mcpu=@var{name}
28563 Selects the type of RX CPU to be targeted. Currently three types are
28564 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
28565 the specific @samp{RX610} CPU. The default is @samp{RX600}.
28567 The only difference between @samp{RX600} and @samp{RX610} is that the
28568 @samp{RX610} does not support the @code{MVTIPL} instruction.
28570 The @samp{RX200} series does not have a hardware floating-point unit
28571 and so @option{-nofpu} is enabled by default when this type is
28574 @item -mbig-endian-data
28575 @itemx -mlittle-endian-data
28576 @opindex mbig-endian-data
28577 @opindex mlittle-endian-data
28578 Store data (but not code) in the big-endian format. The default is
28579 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
28582 @item -msmall-data-limit=@var{N}
28583 @opindex msmall-data-limit
28584 Specifies the maximum size in bytes of global and static variables
28585 which can be placed into the small data area. Using the small data
28586 area can lead to smaller and faster code, but the size of area is
28587 limited and it is up to the programmer to ensure that the area does
28588 not overflow. Also when the small data area is used one of the RX's
28589 registers (usually @code{r13}) is reserved for use pointing to this
28590 area, so it is no longer available for use by the compiler. This
28591 could result in slower and/or larger code if variables are pushed onto
28592 the stack instead of being held in this register.
28594 Note, common variables (variables that have not been initialized) and
28595 constants are not placed into the small data area as they are assigned
28596 to other sections in the output executable.
28598 The default value is zero, which disables this feature. Note, this
28599 feature is not enabled by default with higher optimization levels
28600 (@option{-O2} etc) because of the potentially detrimental effects of
28601 reserving a register. It is up to the programmer to experiment and
28602 discover whether this feature is of benefit to their program. See the
28603 description of the @option{-mpid} option for a description of how the
28604 actual register to hold the small data area pointer is chosen.
28610 Use the simulator runtime. The default is to use the libgloss
28611 board-specific runtime.
28613 @item -mas100-syntax
28614 @itemx -mno-as100-syntax
28615 @opindex mas100-syntax
28616 @opindex mno-as100-syntax
28617 When generating assembler output use a syntax that is compatible with
28618 Renesas's AS100 assembler. This syntax can also be handled by the GAS
28619 assembler, but it has some restrictions so it is not generated by default.
28621 @item -mmax-constant-size=@var{N}
28622 @opindex mmax-constant-size
28623 Specifies the maximum size, in bytes, of a constant that can be used as
28624 an operand in a RX instruction. Although the RX instruction set does
28625 allow constants of up to 4 bytes in length to be used in instructions,
28626 a longer value equates to a longer instruction. Thus in some
28627 circumstances it can be beneficial to restrict the size of constants
28628 that are used in instructions. Constants that are too big are instead
28629 placed into a constant pool and referenced via register indirection.
28631 The value @var{N} can be between 0 and 4. A value of 0 (the default)
28632 or 4 means that constants of any size are allowed.
28636 Enable linker relaxation. Linker relaxation is a process whereby the
28637 linker attempts to reduce the size of a program by finding shorter
28638 versions of various instructions. Disabled by default.
28640 @item -mint-register=@var{N}
28641 @opindex mint-register
28642 Specify the number of registers to reserve for fast interrupt handler
28643 functions. The value @var{N} can be between 0 and 4. A value of 1
28644 means that register @code{r13} is reserved for the exclusive use
28645 of fast interrupt handlers. A value of 2 reserves @code{r13} and
28646 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
28647 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
28648 A value of 0, the default, does not reserve any registers.
28650 @item -msave-acc-in-interrupts
28651 @opindex msave-acc-in-interrupts
28652 Specifies that interrupt handler functions should preserve the
28653 accumulator register. This is only necessary if normal code might use
28654 the accumulator register, for example because it performs 64-bit
28655 multiplications. The default is to ignore the accumulator as this
28656 makes the interrupt handlers faster.
28662 Enables the generation of position independent data. When enabled any
28663 access to constant data is done via an offset from a base address
28664 held in a register. This allows the location of constant data to be
28665 determined at run time without requiring the executable to be
28666 relocated, which is a benefit to embedded applications with tight
28667 memory constraints. Data that can be modified is not affected by this
28670 Note, using this feature reserves a register, usually @code{r13}, for
28671 the constant data base address. This can result in slower and/or
28672 larger code, especially in complicated functions.
28674 The actual register chosen to hold the constant data base address
28675 depends upon whether the @option{-msmall-data-limit} and/or the
28676 @option{-mint-register} command-line options are enabled. Starting
28677 with register @code{r13} and proceeding downwards, registers are
28678 allocated first to satisfy the requirements of @option{-mint-register},
28679 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
28680 is possible for the small data area register to be @code{r8} if both
28681 @option{-mint-register=4} and @option{-mpid} are specified on the
28684 By default this feature is not enabled. The default can be restored
28685 via the @option{-mno-pid} command-line option.
28687 @item -mno-warn-multiple-fast-interrupts
28688 @itemx -mwarn-multiple-fast-interrupts
28689 @opindex mno-warn-multiple-fast-interrupts
28690 @opindex mwarn-multiple-fast-interrupts
28691 Prevents GCC from issuing a warning message if it finds more than one
28692 fast interrupt handler when it is compiling a file. The default is to
28693 issue a warning for each extra fast interrupt handler found, as the RX
28694 only supports one such interrupt.
28696 @item -mallow-string-insns
28697 @itemx -mno-allow-string-insns
28698 @opindex mallow-string-insns
28699 @opindex mno-allow-string-insns
28700 Enables or disables the use of the string manipulation instructions
28701 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
28702 @code{SWHILE} and also the @code{RMPA} instruction. These
28703 instructions may prefetch data, which is not safe to do if accessing
28704 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
28705 for more information).
28707 The default is to allow these instructions, but it is not possible for
28708 GCC to reliably detect all circumstances where a string instruction
28709 might be used to access an I/O register, so their use cannot be
28710 disabled automatically. Instead it is reliant upon the programmer to
28711 use the @option{-mno-allow-string-insns} option if their program
28712 accesses I/O space.
28714 When the instructions are enabled GCC defines the C preprocessor
28715 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
28716 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
28722 Use only (or not only) @code{JSR} instructions to access functions.
28723 This option can be used when code size exceeds the range of @code{BSR}
28724 instructions. Note that @option{-mno-jsr} does not mean to not use
28725 @code{JSR} but instead means that any type of branch may be used.
28728 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
28729 has special significance to the RX port when used with the
28730 @code{interrupt} function attribute. This attribute indicates a
28731 function intended to process fast interrupts. GCC ensures
28732 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
28733 and/or @code{r13} and only provided that the normal use of the
28734 corresponding registers have been restricted via the
28735 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
28738 @node S/390 and zSeries Options
28739 @subsection S/390 and zSeries Options
28740 @cindex S/390 and zSeries Options
28742 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
28746 @itemx -msoft-float
28747 @opindex mhard-float
28748 @opindex msoft-float
28749 Use (do not use) the hardware floating-point instructions and registers
28750 for floating-point operations. When @option{-msoft-float} is specified,
28751 functions in @file{libgcc.a} are used to perform floating-point
28752 operations. When @option{-mhard-float} is specified, the compiler
28753 generates IEEE floating-point instructions. This is the default.
28756 @itemx -mno-hard-dfp
28758 @opindex mno-hard-dfp
28759 Use (do not use) the hardware decimal-floating-point instructions for
28760 decimal-floating-point operations. When @option{-mno-hard-dfp} is
28761 specified, functions in @file{libgcc.a} are used to perform
28762 decimal-floating-point operations. When @option{-mhard-dfp} is
28763 specified, the compiler generates decimal-floating-point hardware
28764 instructions. This is the default for @option{-march=z9-ec} or higher.
28766 @item -mlong-double-64
28767 @itemx -mlong-double-128
28768 @opindex mlong-double-64
28769 @opindex mlong-double-128
28770 These switches control the size of @code{long double} type. A size
28771 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28772 type. This is the default.
28775 @itemx -mno-backchain
28776 @opindex mbackchain
28777 @opindex mno-backchain
28778 Store (do not store) the address of the caller's frame as backchain pointer
28779 into the callee's stack frame.
28780 A backchain may be needed to allow debugging using tools that do not understand
28781 DWARF call frame information.
28782 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
28783 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
28784 the backchain is placed into the topmost word of the 96/160 byte register
28787 In general, code compiled with @option{-mbackchain} is call-compatible with
28788 code compiled with @option{-mno-backchain}; however, use of the backchain
28789 for debugging purposes usually requires that the whole binary is built with
28790 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
28791 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
28792 to build a linux kernel use @option{-msoft-float}.
28794 The default is to not maintain the backchain.
28796 @item -mpacked-stack
28797 @itemx -mno-packed-stack
28798 @opindex mpacked-stack
28799 @opindex mno-packed-stack
28800 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
28801 specified, the compiler uses the all fields of the 96/160 byte register save
28802 area only for their default purpose; unused fields still take up stack space.
28803 When @option{-mpacked-stack} is specified, register save slots are densely
28804 packed at the top of the register save area; unused space is reused for other
28805 purposes, allowing for more efficient use of the available stack space.
28806 However, when @option{-mbackchain} is also in effect, the topmost word of
28807 the save area is always used to store the backchain, and the return address
28808 register is always saved two words below the backchain.
28810 As long as the stack frame backchain is not used, code generated with
28811 @option{-mpacked-stack} is call-compatible with code generated with
28812 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
28813 S/390 or zSeries generated code that uses the stack frame backchain at run
28814 time, not just for debugging purposes. Such code is not call-compatible
28815 with code compiled with @option{-mpacked-stack}. Also, note that the
28816 combination of @option{-mbackchain},
28817 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
28818 to build a linux kernel use @option{-msoft-float}.
28820 The default is to not use the packed stack layout.
28823 @itemx -mno-small-exec
28824 @opindex msmall-exec
28825 @opindex mno-small-exec
28826 Generate (or do not generate) code using the @code{bras} instruction
28827 to do subroutine calls.
28828 This only works reliably if the total executable size does not
28829 exceed 64k. The default is to use the @code{basr} instruction instead,
28830 which does not have this limitation.
28836 When @option{-m31} is specified, generate code compliant to the
28837 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
28838 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
28839 particular to generate 64-bit instructions. For the @samp{s390}
28840 targets, the default is @option{-m31}, while the @samp{s390x}
28841 targets default to @option{-m64}.
28847 When @option{-mzarch} is specified, generate code using the
28848 instructions available on z/Architecture.
28849 When @option{-mesa} is specified, generate code using the
28850 instructions available on ESA/390. Note that @option{-mesa} is
28851 not possible with @option{-m64}.
28852 When generating code compliant to the GNU/Linux for S/390 ABI,
28853 the default is @option{-mesa}. When generating code compliant
28854 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
28860 The @option{-mhtm} option enables a set of builtins making use of
28861 instructions available with the transactional execution facility
28862 introduced with the IBM zEnterprise EC12 machine generation
28863 @ref{S/390 System z Built-in Functions}.
28864 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
28870 When @option{-mvx} is specified, generate code using the instructions
28871 available with the vector extension facility introduced with the IBM
28872 z13 machine generation.
28873 This option changes the ABI for some vector type values with regard to
28874 alignment and calling conventions. In case vector type values are
28875 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
28876 command will be added to mark the resulting binary with the ABI used.
28877 @option{-mvx} is enabled by default when using @option{-march=z13}.
28880 @itemx -mno-zvector
28882 @opindex mno-zvector
28883 The @option{-mzvector} option enables vector language extensions and
28884 builtins using instructions available with the vector extension
28885 facility introduced with the IBM z13 machine generation.
28886 This option adds support for @samp{vector} to be used as a keyword to
28887 define vector type variables and arguments. @samp{vector} is only
28888 available when GNU extensions are enabled. It will not be expanded
28889 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
28890 In addition to the GCC low-level builtins @option{-mzvector} enables
28891 a set of builtins added for compatibility with AltiVec-style
28892 implementations like Power and Cell. In order to make use of these
28893 builtins the header file @file{vecintrin.h} needs to be included.
28894 @option{-mzvector} is disabled by default.
28900 Generate (or do not generate) code using the @code{mvcle} instruction
28901 to perform block moves. When @option{-mno-mvcle} is specified,
28902 use a @code{mvc} loop instead. This is the default unless optimizing for
28909 Print (or do not print) additional debug information when compiling.
28910 The default is to not print debug information.
28912 @item -march=@var{cpu-type}
28914 Generate code that runs on @var{cpu-type}, which is the name of a
28915 system representing a certain processor type. Possible values for
28916 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
28917 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
28918 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
28919 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}.
28921 The default is @option{-march=z900}.
28923 Specifying @samp{native} as cpu type can be used to select the best
28924 architecture option for the host processor.
28925 @option{-march=native} has no effect if GCC does not recognize the
28928 @item -mtune=@var{cpu-type}
28930 Tune to @var{cpu-type} everything applicable about the generated code,
28931 except for the ABI and the set of available instructions.
28932 The list of @var{cpu-type} values is the same as for @option{-march}.
28933 The default is the value used for @option{-march}.
28936 @itemx -mno-tpf-trace
28937 @opindex mtpf-trace
28938 @opindex mno-tpf-trace
28939 Generate code that adds (does not add) in TPF OS specific branches to trace
28940 routines in the operating system. This option is off by default, even
28941 when compiling for the TPF OS@.
28943 @item -mtpf-trace-skip
28944 @itemx -mno-tpf-trace-skip
28945 @opindex mtpf-trace-skip
28946 @opindex mno-tpf-trace-skip
28947 Generate code that changes (does not change) the default branch
28948 targets enabled by @option{-mtpf-trace} to point to specialized trace
28949 routines providing the ability of selectively skipping function trace
28950 entries for the TPF OS. This option is off by default, even when
28951 compiling for the TPF OS and specifying @option{-mtpf-trace}.
28954 @itemx -mno-fused-madd
28955 @opindex mfused-madd
28956 @opindex mno-fused-madd
28957 Generate code that uses (does not use) the floating-point multiply and
28958 accumulate instructions. These instructions are generated by default if
28959 hardware floating point is used.
28961 @item -mwarn-framesize=@var{framesize}
28962 @opindex mwarn-framesize
28963 Emit a warning if the current function exceeds the given frame size. Because
28964 this is a compile-time check it doesn't need to be a real problem when the program
28965 runs. It is intended to identify functions that most probably cause
28966 a stack overflow. It is useful to be used in an environment with limited stack
28967 size e.g.@: the linux kernel.
28969 @item -mwarn-dynamicstack
28970 @opindex mwarn-dynamicstack
28971 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
28972 arrays. This is generally a bad idea with a limited stack size.
28974 @item -mstack-guard=@var{stack-guard}
28975 @itemx -mstack-size=@var{stack-size}
28976 @opindex mstack-guard
28977 @opindex mstack-size
28978 If these options are provided the S/390 back end emits additional instructions in
28979 the function prologue that trigger a trap if the stack size is @var{stack-guard}
28980 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
28981 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
28982 the frame size of the compiled function is chosen.
28983 These options are intended to be used to help debugging stack overflow problems.
28984 The additionally emitted code causes only little overhead and hence can also be
28985 used in production-like systems without greater performance degradation. The given
28986 values have to be exact powers of 2 and @var{stack-size} has to be greater than
28987 @var{stack-guard} without exceeding 64k.
28988 In order to be efficient the extra code makes the assumption that the stack starts
28989 at an address aligned to the value given by @var{stack-size}.
28990 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
28992 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
28994 If the hotpatch option is enabled, a ``hot-patching'' function
28995 prologue is generated for all functions in the compilation unit.
28996 The funtion label is prepended with the given number of two-byte
28997 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
28998 the label, 2 * @var{post-halfwords} bytes are appended, using the
28999 largest NOP like instructions the architecture allows (maximum
29002 If both arguments are zero, hotpatching is disabled.
29004 This option can be overridden for individual functions with the
29005 @code{hotpatch} attribute.
29008 @node Score Options
29009 @subsection Score Options
29010 @cindex Score Options
29012 These options are defined for Score implementations:
29017 Compile code for big-endian mode. This is the default.
29021 Compile code for little-endian mode.
29025 Disable generation of @code{bcnz} instructions.
29029 Enable generation of unaligned load and store instructions.
29033 Enable the use of multiply-accumulate instructions. Disabled by default.
29037 Specify the SCORE5 as the target architecture.
29041 Specify the SCORE5U of the target architecture.
29045 Specify the SCORE7 as the target architecture. This is the default.
29049 Specify the SCORE7D as the target architecture.
29053 @subsection SH Options
29055 These @samp{-m} options are defined for the SH implementations:
29060 Generate code for the SH1.
29064 Generate code for the SH2.
29067 Generate code for the SH2e.
29071 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
29072 that the floating-point unit is not used.
29074 @item -m2a-single-only
29075 @opindex m2a-single-only
29076 Generate code for the SH2a-FPU, in such a way that no double-precision
29077 floating-point operations are used.
29080 @opindex m2a-single
29081 Generate code for the SH2a-FPU assuming the floating-point unit is in
29082 single-precision mode by default.
29086 Generate code for the SH2a-FPU assuming the floating-point unit is in
29087 double-precision mode by default.
29091 Generate code for the SH3.
29095 Generate code for the SH3e.
29099 Generate code for the SH4 without a floating-point unit.
29101 @item -m4-single-only
29102 @opindex m4-single-only
29103 Generate code for the SH4 with a floating-point unit that only
29104 supports single-precision arithmetic.
29108 Generate code for the SH4 assuming the floating-point unit is in
29109 single-precision mode by default.
29113 Generate code for the SH4.
29117 Generate code for SH4-100.
29119 @item -m4-100-nofpu
29120 @opindex m4-100-nofpu
29121 Generate code for SH4-100 in such a way that the
29122 floating-point unit is not used.
29124 @item -m4-100-single
29125 @opindex m4-100-single
29126 Generate code for SH4-100 assuming the floating-point unit is in
29127 single-precision mode by default.
29129 @item -m4-100-single-only
29130 @opindex m4-100-single-only
29131 Generate code for SH4-100 in such a way that no double-precision
29132 floating-point operations are used.
29136 Generate code for SH4-200.
29138 @item -m4-200-nofpu
29139 @opindex m4-200-nofpu
29140 Generate code for SH4-200 without in such a way that the
29141 floating-point unit is not used.
29143 @item -m4-200-single
29144 @opindex m4-200-single
29145 Generate code for SH4-200 assuming the floating-point unit is in
29146 single-precision mode by default.
29148 @item -m4-200-single-only
29149 @opindex m4-200-single-only
29150 Generate code for SH4-200 in such a way that no double-precision
29151 floating-point operations are used.
29155 Generate code for SH4-300.
29157 @item -m4-300-nofpu
29158 @opindex m4-300-nofpu
29159 Generate code for SH4-300 without in such a way that the
29160 floating-point unit is not used.
29162 @item -m4-300-single
29163 @opindex m4-300-single
29164 Generate code for SH4-300 in such a way that no double-precision
29165 floating-point operations are used.
29167 @item -m4-300-single-only
29168 @opindex m4-300-single-only
29169 Generate code for SH4-300 in such a way that no double-precision
29170 floating-point operations are used.
29174 Generate code for SH4-340 (no MMU, no FPU).
29178 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
29183 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
29184 floating-point unit is not used.
29186 @item -m4a-single-only
29187 @opindex m4a-single-only
29188 Generate code for the SH4a, in such a way that no double-precision
29189 floating-point operations are used.
29192 @opindex m4a-single
29193 Generate code for the SH4a assuming the floating-point unit is in
29194 single-precision mode by default.
29198 Generate code for the SH4a.
29202 Same as @option{-m4a-nofpu}, except that it implicitly passes
29203 @option{-dsp} to the assembler. GCC doesn't generate any DSP
29204 instructions at the moment.
29208 Compile code for the processor in big-endian mode.
29212 Compile code for the processor in little-endian mode.
29216 Align doubles at 64-bit boundaries. Note that this changes the calling
29217 conventions, and thus some functions from the standard C library do
29218 not work unless you recompile it first with @option{-mdalign}.
29222 Shorten some address references at link time, when possible; uses the
29223 linker option @option{-relax}.
29227 Use 32-bit offsets in @code{switch} tables. The default is to use
29232 Enable the use of bit manipulation instructions on SH2A.
29236 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
29237 alignment constraints.
29241 Comply with the calling conventions defined by Renesas.
29244 @opindex mno-renesas
29245 Comply with the calling conventions defined for GCC before the Renesas
29246 conventions were available. This option is the default for all
29247 targets of the SH toolchain.
29250 @opindex mnomacsave
29251 Mark the @code{MAC} register as call-clobbered, even if
29252 @option{-mrenesas} is given.
29258 Control the IEEE compliance of floating-point comparisons, which affects the
29259 handling of cases where the result of a comparison is unordered. By default
29260 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
29261 enabled @option{-mno-ieee} is implicitly set, which results in faster
29262 floating-point greater-equal and less-equal comparisons. The implicit settings
29263 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
29265 @item -minline-ic_invalidate
29266 @opindex minline-ic_invalidate
29267 Inline code to invalidate instruction cache entries after setting up
29268 nested function trampolines.
29269 This option has no effect if @option{-musermode} is in effect and the selected
29270 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
29272 If the selected code generation option does not allow the use of the @code{icbi}
29273 instruction, and @option{-musermode} is not in effect, the inlined code
29274 manipulates the instruction cache address array directly with an associative
29275 write. This not only requires privileged mode at run time, but it also
29276 fails if the cache line had been mapped via the TLB and has become unmapped.
29280 Dump instruction size and location in the assembly code.
29283 @opindex mpadstruct
29284 This option is deprecated. It pads structures to multiple of 4 bytes,
29285 which is incompatible with the SH ABI@.
29287 @item -matomic-model=@var{model}
29288 @opindex matomic-model=@var{model}
29289 Sets the model of atomic operations and additional parameters as a comma
29290 separated list. For details on the atomic built-in functions see
29291 @ref{__atomic Builtins}. The following models and parameters are supported:
29296 Disable compiler generated atomic sequences and emit library calls for atomic
29297 operations. This is the default if the target is not @code{sh*-*-linux*}.
29300 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
29301 built-in functions. The generated atomic sequences require additional support
29302 from the interrupt/exception handling code of the system and are only suitable
29303 for SH3* and SH4* single-core systems. This option is enabled by default when
29304 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
29305 this option also partially utilizes the hardware atomic instructions
29306 @code{movli.l} and @code{movco.l} to create more efficient code, unless
29307 @samp{strict} is specified.
29310 Generate software atomic sequences that use a variable in the thread control
29311 block. This is a variation of the gUSA sequences which can also be used on
29312 SH1* and SH2* targets. The generated atomic sequences require additional
29313 support from the interrupt/exception handling code of the system and are only
29314 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
29315 parameter has to be specified as well.
29318 Generate software atomic sequences that temporarily disable interrupts by
29319 setting @code{SR.IMASK = 1111}. This model works only when the program runs
29320 in privileged mode and is only suitable for single-core systems. Additional
29321 support from the interrupt/exception handling code of the system is not
29322 required. This model is enabled by default when the target is
29323 @code{sh*-*-linux*} and SH1* or SH2*.
29326 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
29327 instructions only. This is only available on SH4A and is suitable for
29328 multi-core systems. Since the hardware instructions support only 32 bit atomic
29329 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
29330 Code compiled with this option is also compatible with other software
29331 atomic model interrupt/exception handling systems if executed on an SH4A
29332 system. Additional support from the interrupt/exception handling code of the
29333 system is not required for this model.
29336 This parameter specifies the offset in bytes of the variable in the thread
29337 control block structure that should be used by the generated atomic sequences
29338 when the @samp{soft-tcb} model has been selected. For other models this
29339 parameter is ignored. The specified value must be an integer multiple of four
29340 and in the range 0-1020.
29343 This parameter prevents mixed usage of multiple atomic models, even if they
29344 are compatible, and makes the compiler generate atomic sequences of the
29345 specified model only.
29351 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
29352 Notice that depending on the particular hardware and software configuration
29353 this can degrade overall performance due to the operand cache line flushes
29354 that are implied by the @code{tas.b} instruction. On multi-core SH4A
29355 processors the @code{tas.b} instruction must be used with caution since it
29356 can result in data corruption for certain cache configurations.
29359 @opindex mprefergot
29360 When generating position-independent code, emit function calls using
29361 the Global Offset Table instead of the Procedure Linkage Table.
29364 @itemx -mno-usermode
29366 @opindex mno-usermode
29367 Don't allow (allow) the compiler generating privileged mode code. Specifying
29368 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
29369 inlined code would not work in user mode. @option{-musermode} is the default
29370 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
29371 @option{-musermode} has no effect, since there is no user mode.
29373 @item -multcost=@var{number}
29374 @opindex multcost=@var{number}
29375 Set the cost to assume for a multiply insn.
29377 @item -mdiv=@var{strategy}
29378 @opindex mdiv=@var{strategy}
29379 Set the division strategy to be used for integer division operations.
29380 @var{strategy} can be one of:
29385 Calls a library function that uses the single-step division instruction
29386 @code{div1} to perform the operation. Division by zero calculates an
29387 unspecified result and does not trap. This is the default except for SH4,
29388 SH2A and SHcompact.
29391 Calls a library function that performs the operation in double precision
29392 floating point. Division by zero causes a floating-point exception. This is
29393 the default for SHcompact with FPU. Specifying this for targets that do not
29394 have a double precision FPU defaults to @code{call-div1}.
29397 Calls a library function that uses a lookup table for small divisors and
29398 the @code{div1} instruction with case distinction for larger divisors. Division
29399 by zero calculates an unspecified result and does not trap. This is the default
29400 for SH4. Specifying this for targets that do not have dynamic shift
29401 instructions defaults to @code{call-div1}.
29405 When a division strategy has not been specified the default strategy is
29406 selected based on the current target. For SH2A the default strategy is to
29407 use the @code{divs} and @code{divu} instructions instead of library function
29410 @item -maccumulate-outgoing-args
29411 @opindex maccumulate-outgoing-args
29412 Reserve space once for outgoing arguments in the function prologue rather
29413 than around each call. Generally beneficial for performance and size. Also
29414 needed for unwinding to avoid changing the stack frame around conditional code.
29416 @item -mdivsi3_libfunc=@var{name}
29417 @opindex mdivsi3_libfunc=@var{name}
29418 Set the name of the library function used for 32-bit signed division to
29420 This only affects the name used in the @samp{call} division strategies, and
29421 the compiler still expects the same sets of input/output/clobbered registers as
29422 if this option were not present.
29424 @item -mfixed-range=@var{register-range}
29425 @opindex mfixed-range
29426 Generate code treating the given register range as fixed registers.
29427 A fixed register is one that the register allocator cannot use. This is
29428 useful when compiling kernel code. A register range is specified as
29429 two registers separated by a dash. Multiple register ranges can be
29430 specified separated by a comma.
29432 @item -mbranch-cost=@var{num}
29433 @opindex mbranch-cost=@var{num}
29434 Assume @var{num} to be the cost for a branch instruction. Higher numbers
29435 make the compiler try to generate more branch-free code if possible.
29436 If not specified the value is selected depending on the processor type that
29437 is being compiled for.
29440 @itemx -mno-zdcbranch
29441 @opindex mzdcbranch
29442 @opindex mno-zdcbranch
29443 Assume (do not assume) that zero displacement conditional branch instructions
29444 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
29445 compiler prefers zero displacement branch code sequences. This is
29446 enabled by default when generating code for SH4 and SH4A. It can be explicitly
29447 disabled by specifying @option{-mno-zdcbranch}.
29449 @item -mcbranch-force-delay-slot
29450 @opindex mcbranch-force-delay-slot
29451 Force the usage of delay slots for conditional branches, which stuffs the delay
29452 slot with a @code{nop} if a suitable instruction cannot be found. By default
29453 this option is disabled. It can be enabled to work around hardware bugs as
29454 found in the original SH7055.
29457 @itemx -mno-fused-madd
29458 @opindex mfused-madd
29459 @opindex mno-fused-madd
29460 Generate code that uses (does not use) the floating-point multiply and
29461 accumulate instructions. These instructions are generated by default
29462 if hardware floating point is used. The machine-dependent
29463 @option{-mfused-madd} option is now mapped to the machine-independent
29464 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29465 mapped to @option{-ffp-contract=off}.
29471 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
29472 and cosine approximations. The option @option{-mfsca} must be used in
29473 combination with @option{-funsafe-math-optimizations}. It is enabled by default
29474 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
29475 approximations even if @option{-funsafe-math-optimizations} is in effect.
29481 Allow or disallow the compiler to emit the @code{fsrra} instruction for
29482 reciprocal square root approximations. The option @option{-mfsrra} must be used
29483 in combination with @option{-funsafe-math-optimizations} and
29484 @option{-ffinite-math-only}. It is enabled by default when generating code for
29485 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
29486 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
29489 @item -mpretend-cmove
29490 @opindex mpretend-cmove
29491 Prefer zero-displacement conditional branches for conditional move instruction
29492 patterns. This can result in faster code on the SH4 processor.
29496 Generate code using the FDPIC ABI.
29500 @node Solaris 2 Options
29501 @subsection Solaris 2 Options
29502 @cindex Solaris 2 options
29504 These @samp{-m} options are supported on Solaris 2:
29507 @item -mclear-hwcap
29508 @opindex mclear-hwcap
29509 @option{-mclear-hwcap} tells the compiler to remove the hardware
29510 capabilities generated by the Solaris assembler. This is only necessary
29511 when object files use ISA extensions not supported by the current
29512 machine, but check at runtime whether or not to use them.
29514 @item -mimpure-text
29515 @opindex mimpure-text
29516 @option{-mimpure-text}, used in addition to @option{-shared}, tells
29517 the compiler to not pass @option{-z text} to the linker when linking a
29518 shared object. Using this option, you can link position-dependent
29519 code into a shared object.
29521 @option{-mimpure-text} suppresses the ``relocations remain against
29522 allocatable but non-writable sections'' linker error message.
29523 However, the necessary relocations trigger copy-on-write, and the
29524 shared object is not actually shared across processes. Instead of
29525 using @option{-mimpure-text}, you should compile all source code with
29526 @option{-fpic} or @option{-fPIC}.
29530 These switches are supported in addition to the above on Solaris 2:
29535 This is a synonym for @option{-pthread}.
29538 @node SPARC Options
29539 @subsection SPARC Options
29540 @cindex SPARC options
29542 These @samp{-m} options are supported on the SPARC:
29545 @item -mno-app-regs
29547 @opindex mno-app-regs
29549 Specify @option{-mapp-regs} to generate output using the global registers
29550 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
29551 global register 1, each global register 2 through 4 is then treated as an
29552 allocable register that is clobbered by function calls. This is the default.
29554 To be fully SVR4 ABI-compliant at the cost of some performance loss,
29555 specify @option{-mno-app-regs}. You should compile libraries and system
29556 software with this option.
29562 With @option{-mflat}, the compiler does not generate save/restore instructions
29563 and uses a ``flat'' or single register window model. This model is compatible
29564 with the regular register window model. The local registers and the input
29565 registers (0--5) are still treated as ``call-saved'' registers and are
29566 saved on the stack as needed.
29568 With @option{-mno-flat} (the default), the compiler generates save/restore
29569 instructions (except for leaf functions). This is the normal operating mode.
29572 @itemx -mhard-float
29574 @opindex mhard-float
29575 Generate output containing floating-point instructions. This is the
29579 @itemx -msoft-float
29581 @opindex msoft-float
29582 Generate output containing library calls for floating point.
29583 @strong{Warning:} the requisite libraries are not available for all SPARC
29584 targets. Normally the facilities of the machine's usual C compiler are
29585 used, but this cannot be done directly in cross-compilation. You must make
29586 your own arrangements to provide suitable library functions for
29587 cross-compilation. The embedded targets @samp{sparc-*-aout} and
29588 @samp{sparclite-*-*} do provide software floating-point support.
29590 @option{-msoft-float} changes the calling convention in the output file;
29591 therefore, it is only useful if you compile @emph{all} of a program with
29592 this option. In particular, you need to compile @file{libgcc.a}, the
29593 library that comes with GCC, with @option{-msoft-float} in order for
29596 @item -mhard-quad-float
29597 @opindex mhard-quad-float
29598 Generate output containing quad-word (long double) floating-point
29601 @item -msoft-quad-float
29602 @opindex msoft-quad-float
29603 Generate output containing library calls for quad-word (long double)
29604 floating-point instructions. The functions called are those specified
29605 in the SPARC ABI@. This is the default.
29607 As of this writing, there are no SPARC implementations that have hardware
29608 support for the quad-word floating-point instructions. They all invoke
29609 a trap handler for one of these instructions, and then the trap handler
29610 emulates the effect of the instruction. Because of the trap handler overhead,
29611 this is much slower than calling the ABI library routines. Thus the
29612 @option{-msoft-quad-float} option is the default.
29614 @item -mno-unaligned-doubles
29615 @itemx -munaligned-doubles
29616 @opindex mno-unaligned-doubles
29617 @opindex munaligned-doubles
29618 Assume that doubles have 8-byte alignment. This is the default.
29620 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
29621 alignment only if they are contained in another type, or if they have an
29622 absolute address. Otherwise, it assumes they have 4-byte alignment.
29623 Specifying this option avoids some rare compatibility problems with code
29624 generated by other compilers. It is not the default because it results
29625 in a performance loss, especially for floating-point code.
29628 @itemx -mno-user-mode
29629 @opindex muser-mode
29630 @opindex mno-user-mode
29631 Do not generate code that can only run in supervisor mode. This is relevant
29632 only for the @code{casa} instruction emitted for the LEON3 processor. This
29635 @item -mfaster-structs
29636 @itemx -mno-faster-structs
29637 @opindex mfaster-structs
29638 @opindex mno-faster-structs
29639 With @option{-mfaster-structs}, the compiler assumes that structures
29640 should have 8-byte alignment. This enables the use of pairs of
29641 @code{ldd} and @code{std} instructions for copies in structure
29642 assignment, in place of twice as many @code{ld} and @code{st} pairs.
29643 However, the use of this changed alignment directly violates the SPARC
29644 ABI@. Thus, it's intended only for use on targets where the developer
29645 acknowledges that their resulting code is not directly in line with
29646 the rules of the ABI@.
29648 @item -mstd-struct-return
29649 @itemx -mno-std-struct-return
29650 @opindex mstd-struct-return
29651 @opindex mno-std-struct-return
29652 With @option{-mstd-struct-return}, the compiler generates checking code
29653 in functions returning structures or unions to detect size mismatches
29654 between the two sides of function calls, as per the 32-bit ABI@.
29656 The default is @option{-mno-std-struct-return}. This option has no effect
29663 Enable Local Register Allocation. This is the default for SPARC since GCC 7
29664 so @option{-mno-lra} needs to be passed to get old Reload.
29666 @item -mcpu=@var{cpu_type}
29668 Set the instruction set, register set, and instruction scheduling parameters
29669 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
29670 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
29671 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
29672 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
29673 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
29674 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
29677 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
29678 which selects the best architecture option for the host processor.
29679 @option{-mcpu=native} has no effect if GCC does not recognize
29682 Default instruction scheduling parameters are used for values that select
29683 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
29684 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
29686 Here is a list of each supported architecture and their supported
29694 supersparc, hypersparc, leon, leon3, leon5
29697 f930, f934, sparclite86x
29703 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
29707 By default (unless configured otherwise), GCC generates code for the V7
29708 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
29709 additionally optimizes it for the Cypress CY7C602 chip, as used in the
29710 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
29711 SPARCStation 1, 2, IPX etc.
29713 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
29714 architecture. The only difference from V7 code is that the compiler emits
29715 the integer multiply and integer divide instructions which exist in SPARC-V8
29716 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
29717 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
29720 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
29721 the SPARC architecture. This adds the integer multiply, integer divide step
29722 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
29723 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
29724 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
29725 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
29726 MB86934 chip, which is the more recent SPARClite with FPU@.
29728 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
29729 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
29730 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
29731 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
29732 optimizes it for the TEMIC SPARClet chip.
29734 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
29735 architecture. This adds 64-bit integer and floating-point move instructions,
29736 3 additional floating-point condition code registers and conditional move
29737 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
29738 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
29739 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
29740 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
29741 @option{-mcpu=niagara}, the compiler additionally optimizes it for
29742 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
29743 additionally optimizes it for Sun UltraSPARC T2 chips. With
29744 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
29745 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
29746 additionally optimizes it for Sun UltraSPARC T4 chips. With
29747 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
29748 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
29749 additionally optimizes it for Oracle M8 chips.
29751 @item -mtune=@var{cpu_type}
29753 Set the instruction scheduling parameters for machine type
29754 @var{cpu_type}, but do not set the instruction set or register set that the
29755 option @option{-mcpu=@var{cpu_type}} does.
29757 The same values for @option{-mcpu=@var{cpu_type}} can be used for
29758 @option{-mtune=@var{cpu_type}}, but the only useful values are those
29759 that select a particular CPU implementation. Those are
29760 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
29761 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
29762 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
29763 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
29764 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
29765 and GNU/Linux toolchains, @samp{native} can also be used.
29770 @opindex mno-v8plus
29771 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
29772 difference from the V8 ABI is that the global and out registers are
29773 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
29774 mode for all SPARC-V9 processors.
29780 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
29781 Visual Instruction Set extensions. The default is @option{-mno-vis}.
29787 With @option{-mvis2}, GCC generates code that takes advantage of
29788 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
29789 default is @option{-mvis2} when targeting a cpu that supports such
29790 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
29791 also sets @option{-mvis}.
29797 With @option{-mvis3}, GCC generates code that takes advantage of
29798 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
29799 default is @option{-mvis3} when targeting a cpu that supports such
29800 instructions, such as niagara-3 and later. Setting @option{-mvis3}
29801 also sets @option{-mvis2} and @option{-mvis}.
29807 With @option{-mvis4}, GCC generates code that takes advantage of
29808 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
29809 default is @option{-mvis4} when targeting a cpu that supports such
29810 instructions, such as niagara-7 and later. Setting @option{-mvis4}
29811 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
29817 With @option{-mvis4b}, GCC generates code that takes advantage of
29818 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
29819 the additional VIS instructions introduced in the Oracle SPARC
29820 Architecture 2017. The default is @option{-mvis4b} when targeting a
29821 cpu that supports such instructions, such as m8 and later. Setting
29822 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
29823 @option{-mvis2} and @option{-mvis}.
29828 @opindex mno-cbcond
29829 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
29830 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
29831 when targeting a CPU that supports such instructions, such as Niagara-4 and
29838 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
29839 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
29840 when targeting a CPU that supports such instructions, such as Niagara-3 and
29846 @opindex mno-fsmuld
29847 With @option{-mfsmuld}, GCC generates code that takes advantage of the
29848 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
29849 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
29850 or V9 with FPU except @option{-mcpu=leon}.
29856 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
29857 Population Count instruction. The default is @option{-mpopc}
29858 when targeting a CPU that supports such an instruction, such as Niagara-2 and
29865 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
29866 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
29867 when targeting a CPU that supports such an instruction, such as Niagara-7 and
29871 @opindex mfix-at697f
29872 Enable the documented workaround for the single erratum of the Atmel AT697F
29873 processor (which corresponds to erratum #13 of the AT697E processor).
29876 @opindex mfix-ut699
29877 Enable the documented workarounds for the floating-point errata and the data
29878 cache nullify errata of the UT699 processor.
29881 @opindex mfix-ut700
29882 Enable the documented workaround for the back-to-back store errata of
29883 the UT699E/UT700 processor.
29885 @item -mfix-gr712rc
29886 @opindex mfix-gr712rc
29887 Enable the documented workaround for the back-to-back store errata of
29888 the GR712RC processor.
29891 These @samp{-m} options are supported in addition to the above
29892 on SPARC-V9 processors in 64-bit environments:
29899 Generate code for a 32-bit or 64-bit environment.
29900 The 32-bit environment sets int, long and pointer to 32 bits.
29901 The 64-bit environment sets int to 32 bits and long and pointer
29904 @item -mcmodel=@var{which}
29906 Set the code model to one of
29910 The Medium/Low code model: 64-bit addresses, programs
29911 must be linked in the low 32 bits of memory. Programs can be statically
29912 or dynamically linked.
29915 The Medium/Middle code model: 64-bit addresses, programs
29916 must be linked in the low 44 bits of memory, the text and data segments must
29917 be less than 2GB in size and the data segment must be located within 2GB of
29921 The Medium/Anywhere code model: 64-bit addresses, programs
29922 may be linked anywhere in memory, the text and data segments must be less
29923 than 2GB in size and the data segment must be located within 2GB of the
29927 The Medium/Anywhere code model for embedded systems:
29928 64-bit addresses, the text and data segments must be less than 2GB in
29929 size, both starting anywhere in memory (determined at link time). The
29930 global register %g4 points to the base of the data segment. Programs
29931 are statically linked and PIC is not supported.
29934 @item -mmemory-model=@var{mem-model}
29935 @opindex mmemory-model
29936 Set the memory model in force on the processor to one of
29940 The default memory model for the processor and operating system.
29943 Relaxed Memory Order
29946 Partial Store Order
29952 Sequential Consistency
29955 These memory models are formally defined in Appendix D of the SPARC-V9
29956 architecture manual, as set in the processor's @code{PSTATE.MM} field.
29959 @itemx -mno-stack-bias
29960 @opindex mstack-bias
29961 @opindex mno-stack-bias
29962 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
29963 frame pointer if present, are offset by @minus{}2047 which must be added back
29964 when making stack frame references. This is the default in 64-bit mode.
29965 Otherwise, assume no such offset is present.
29968 @node System V Options
29969 @subsection Options for System V
29971 These additional options are available on System V Release 4 for
29972 compatibility with other compilers on those systems:
29977 Create a shared object.
29978 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
29982 Identify the versions of each tool used by the compiler, in a
29983 @code{.ident} assembler directive in the output.
29987 Refrain from adding @code{.ident} directives to the output file (this is
29990 @item -YP,@var{dirs}
29992 Search the directories @var{dirs}, and no others, for libraries
29993 specified with @option{-l}.
29995 @item -Ym,@var{dir}
29997 Look in the directory @var{dir} to find the M4 preprocessor.
29998 The assembler uses this option.
29999 @c This is supposed to go with a -Yd for predefined M4 macro files, but
30000 @c the generic assembler that comes with Solaris takes just -Ym.
30003 @node TILE-Gx Options
30004 @subsection TILE-Gx Options
30005 @cindex TILE-Gx options
30007 These @samp{-m} options are supported on the TILE-Gx:
30010 @item -mcmodel=small
30011 @opindex mcmodel=small
30012 Generate code for the small model. The distance for direct calls is
30013 limited to 500M in either direction. PC-relative addresses are 32
30014 bits. Absolute addresses support the full address range.
30016 @item -mcmodel=large
30017 @opindex mcmodel=large
30018 Generate code for the large model. There is no limitation on call
30019 distance, pc-relative addresses, or absolute addresses.
30021 @item -mcpu=@var{name}
30023 Selects the type of CPU to be targeted. Currently the only supported
30024 type is @samp{tilegx}.
30030 Generate code for a 32-bit or 64-bit environment. The 32-bit
30031 environment sets int, long, and pointer to 32 bits. The 64-bit
30032 environment sets int to 32 bits and long and pointer to 64 bits.
30035 @itemx -mlittle-endian
30036 @opindex mbig-endian
30037 @opindex mlittle-endian
30038 Generate code in big/little endian mode, respectively.
30041 @node TILEPro Options
30042 @subsection TILEPro Options
30043 @cindex TILEPro options
30045 These @samp{-m} options are supported on the TILEPro:
30048 @item -mcpu=@var{name}
30050 Selects the type of CPU to be targeted. Currently the only supported
30051 type is @samp{tilepro}.
30055 Generate code for a 32-bit environment, which sets int, long, and
30056 pointer to 32 bits. This is the only supported behavior so the flag
30057 is essentially ignored.
30061 @subsection V850 Options
30062 @cindex V850 Options
30064 These @samp{-m} options are defined for V850 implementations:
30068 @itemx -mno-long-calls
30069 @opindex mlong-calls
30070 @opindex mno-long-calls
30071 Treat all calls as being far away (near). If calls are assumed to be
30072 far away, the compiler always loads the function's address into a
30073 register, and calls indirect through the pointer.
30079 Do not optimize (do optimize) basic blocks that use the same index
30080 pointer 4 or more times to copy pointer into the @code{ep} register, and
30081 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
30082 option is on by default if you optimize.
30084 @item -mno-prolog-function
30085 @itemx -mprolog-function
30086 @opindex mno-prolog-function
30087 @opindex mprolog-function
30088 Do not use (do use) external functions to save and restore registers
30089 at the prologue and epilogue of a function. The external functions
30090 are slower, but use less code space if more than one function saves
30091 the same number of registers. The @option{-mprolog-function} option
30092 is on by default if you optimize.
30096 Try to make the code as small as possible. At present, this just turns
30097 on the @option{-mep} and @option{-mprolog-function} options.
30099 @item -mtda=@var{n}
30101 Put static or global variables whose size is @var{n} bytes or less into
30102 the tiny data area that register @code{ep} points to. The tiny data
30103 area can hold up to 256 bytes in total (128 bytes for byte references).
30105 @item -msda=@var{n}
30107 Put static or global variables whose size is @var{n} bytes or less into
30108 the small data area that register @code{gp} points to. The small data
30109 area can hold up to 64 kilobytes.
30111 @item -mzda=@var{n}
30113 Put static or global variables whose size is @var{n} bytes or less into
30114 the first 32 kilobytes of memory.
30118 Specify that the target processor is the V850.
30122 Specify that the target processor is the V850E3V5. The preprocessor
30123 constant @code{__v850e3v5__} is defined if this option is used.
30127 Specify that the target processor is the V850E3V5. This is an alias for
30128 the @option{-mv850e3v5} option.
30132 Specify that the target processor is the V850E2V3. The preprocessor
30133 constant @code{__v850e2v3__} is defined if this option is used.
30137 Specify that the target processor is the V850E2. The preprocessor
30138 constant @code{__v850e2__} is defined if this option is used.
30142 Specify that the target processor is the V850E1. The preprocessor
30143 constants @code{__v850e1__} and @code{__v850e__} are defined if
30144 this option is used.
30148 Specify that the target processor is the V850ES. This is an alias for
30149 the @option{-mv850e1} option.
30153 Specify that the target processor is the V850E@. The preprocessor
30154 constant @code{__v850e__} is defined if this option is used.
30156 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
30157 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
30158 are defined then a default target processor is chosen and the
30159 relevant @samp{__v850*__} preprocessor constant is defined.
30161 The preprocessor constants @code{__v850} and @code{__v851__} are always
30162 defined, regardless of which processor variant is the target.
30164 @item -mdisable-callt
30165 @itemx -mno-disable-callt
30166 @opindex mdisable-callt
30167 @opindex mno-disable-callt
30168 This option suppresses generation of the @code{CALLT} instruction for the
30169 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
30172 This option is enabled by default when the RH850 ABI is
30173 in use (see @option{-mrh850-abi}), and disabled by default when the
30174 GCC ABI is in use. If @code{CALLT} instructions are being generated
30175 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
30181 Pass on (or do not pass on) the @option{-mrelax} command-line option
30185 @itemx -mno-long-jumps
30186 @opindex mlong-jumps
30187 @opindex mno-long-jumps
30188 Disable (or re-enable) the generation of PC-relative jump instructions.
30191 @itemx -mhard-float
30192 @opindex msoft-float
30193 @opindex mhard-float
30194 Disable (or re-enable) the generation of hardware floating point
30195 instructions. This option is only significant when the target
30196 architecture is @samp{V850E2V3} or higher. If hardware floating point
30197 instructions are being generated then the C preprocessor symbol
30198 @code{__FPU_OK__} is defined, otherwise the symbol
30199 @code{__NO_FPU__} is defined.
30203 Enables the use of the e3v5 LOOP instruction. The use of this
30204 instruction is not enabled by default when the e3v5 architecture is
30205 selected because its use is still experimental.
30209 @opindex mrh850-abi
30211 Enables support for the RH850 version of the V850 ABI. This is the
30212 default. With this version of the ABI the following rules apply:
30216 Integer sized structures and unions are returned via a memory pointer
30217 rather than a register.
30220 Large structures and unions (more than 8 bytes in size) are passed by
30224 Functions are aligned to 16-bit boundaries.
30227 The @option{-m8byte-align} command-line option is supported.
30230 The @option{-mdisable-callt} command-line option is enabled by
30231 default. The @option{-mno-disable-callt} command-line option is not
30235 When this version of the ABI is enabled the C preprocessor symbol
30236 @code{__V850_RH850_ABI__} is defined.
30240 Enables support for the old GCC version of the V850 ABI. With this
30241 version of the ABI the following rules apply:
30245 Integer sized structures and unions are returned in register @code{r10}.
30248 Large structures and unions (more than 8 bytes in size) are passed by
30252 Functions are aligned to 32-bit boundaries, unless optimizing for
30256 The @option{-m8byte-align} command-line option is not supported.
30259 The @option{-mdisable-callt} command-line option is supported but not
30260 enabled by default.
30263 When this version of the ABI is enabled the C preprocessor symbol
30264 @code{__V850_GCC_ABI__} is defined.
30266 @item -m8byte-align
30267 @itemx -mno-8byte-align
30268 @opindex m8byte-align
30269 @opindex mno-8byte-align
30270 Enables support for @code{double} and @code{long long} types to be
30271 aligned on 8-byte boundaries. The default is to restrict the
30272 alignment of all objects to at most 4-bytes. When
30273 @option{-m8byte-align} is in effect the C preprocessor symbol
30274 @code{__V850_8BYTE_ALIGN__} is defined.
30277 @opindex mbig-switch
30278 Generate code suitable for big switch tables. Use this option only if
30279 the assembler/linker complain about out of range branches within a switch
30284 This option causes r2 and r5 to be used in the code generated by
30285 the compiler. This setting is the default.
30287 @item -mno-app-regs
30288 @opindex mno-app-regs
30289 This option causes r2 and r5 to be treated as fixed registers.
30294 @subsection VAX Options
30295 @cindex VAX options
30297 These @samp{-m} options are defined for the VAX:
30302 Do not output certain jump instructions (@code{aobleq} and so on)
30303 that the Unix assembler for the VAX cannot handle across long
30308 Do output those jump instructions, on the assumption that the
30309 GNU assembler is being used.
30313 Output code for G-format floating-point numbers instead of D-format.
30316 @node Visium Options
30317 @subsection Visium Options
30318 @cindex Visium options
30324 A program which performs file I/O and is destined to run on an MCM target
30325 should be linked with this option. It causes the libraries libc.a and
30326 libdebug.a to be linked. The program should be run on the target under
30327 the control of the GDB remote debugging stub.
30331 A program which performs file I/O and is destined to run on the simulator
30332 should be linked with option. This causes libraries libc.a and libsim.a to
30336 @itemx -mhard-float
30338 @opindex mhard-float
30339 Generate code containing floating-point instructions. This is the
30343 @itemx -msoft-float
30345 @opindex msoft-float
30346 Generate code containing library calls for floating-point.
30348 @option{-msoft-float} changes the calling convention in the output file;
30349 therefore, it is only useful if you compile @emph{all} of a program with
30350 this option. In particular, you need to compile @file{libgcc.a}, the
30351 library that comes with GCC, with @option{-msoft-float} in order for
30354 @item -mcpu=@var{cpu_type}
30356 Set the instruction set, register set, and instruction scheduling parameters
30357 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
30358 @samp{mcm}, @samp{gr5} and @samp{gr6}.
30360 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
30362 By default (unless configured otherwise), GCC generates code for the GR5
30363 variant of the Visium architecture.
30365 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
30366 architecture. The only difference from GR5 code is that the compiler will
30367 generate block move instructions.
30369 @item -mtune=@var{cpu_type}
30371 Set the instruction scheduling parameters for machine type @var{cpu_type},
30372 but do not set the instruction set or register set that the option
30373 @option{-mcpu=@var{cpu_type}} would.
30377 Generate code for the supervisor mode, where there are no restrictions on
30378 the access to general registers. This is the default.
30381 @opindex muser-mode
30382 Generate code for the user mode, where the access to some general registers
30383 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
30384 mode; on the GR6, only registers r29 to r31 are affected.
30388 @subsection VMS Options
30390 These @samp{-m} options are defined for the VMS implementations:
30393 @item -mvms-return-codes
30394 @opindex mvms-return-codes
30395 Return VMS condition codes from @code{main}. The default is to return POSIX-style
30396 condition (e.g.@: error) codes.
30398 @item -mdebug-main=@var{prefix}
30399 @opindex mdebug-main=@var{prefix}
30400 Flag the first routine whose name starts with @var{prefix} as the main
30401 routine for the debugger.
30405 Default to 64-bit memory allocation routines.
30407 @item -mpointer-size=@var{size}
30408 @opindex mpointer-size=@var{size}
30409 Set the default size of pointers. Possible options for @var{size} are
30410 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
30411 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
30412 The later option disables @code{pragma pointer_size}.
30415 @node VxWorks Options
30416 @subsection VxWorks Options
30417 @cindex VxWorks Options
30419 The options in this section are defined for all VxWorks targets.
30420 Options specific to the target hardware are listed with the other
30421 options for that target.
30426 GCC can generate code for both VxWorks kernels and real time processes
30427 (RTPs). This option switches from the former to the latter. It also
30428 defines the preprocessor macro @code{__RTP__}.
30431 @opindex non-static
30432 Link an RTP executable against shared libraries rather than static
30433 libraries. The options @option{-static} and @option{-shared} can
30434 also be used for RTPs (@pxref{Link Options}); @option{-static}
30441 These options are passed down to the linker. They are defined for
30442 compatibility with Diab.
30445 @opindex Xbind-lazy
30446 Enable lazy binding of function calls. This option is equivalent to
30447 @option{-Wl,-z,now} and is defined for compatibility with Diab.
30451 Disable lazy binding of function calls. This option is the default and
30452 is defined for compatibility with Diab.
30456 @subsection x86 Options
30457 @cindex x86 Options
30459 These @samp{-m} options are defined for the x86 family of computers.
30463 @item -march=@var{cpu-type}
30465 Generate instructions for the machine type @var{cpu-type}. In contrast to
30466 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
30467 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
30468 to generate code that may not run at all on processors other than the one
30469 indicated. Specifying @option{-march=@var{cpu-type}} implies
30470 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
30472 The choices for @var{cpu-type} are:
30476 This selects the CPU to generate code for at compilation time by determining
30477 the processor type of the compiling machine. Using @option{-march=native}
30478 enables all instruction subsets supported by the local machine (hence
30479 the result might not run on different machines). Using @option{-mtune=native}
30480 produces code optimized for the local machine under the constraints
30481 of the selected instruction set.
30484 A generic CPU with 64-bit extensions.
30489 These choices for @var{cpu-type} select the corresponding
30490 micro-architecture level from the x86-64 psABI. On ABIs other than
30491 the x86-64 psABI they select the same CPU features as the x86-64 psABI
30492 documents for the particular micro-architecture level.
30494 Since these @var{cpu-type} values do not have a corresponding
30495 @option{-mtune} setting, using @option{-march} with these values enables
30496 generic tuning. Specific tuning can be enabled using the
30497 @option{-mtune=@var{other-cpu-type}} option with an appropriate
30498 @var{other-cpu-type} value.
30501 Original Intel i386 CPU@.
30504 Intel i486 CPU@. (No scheduling is implemented for this chip.)
30508 Intel Pentium CPU with no MMX support.
30511 Intel Lakemont MCU, based on Intel Pentium CPU.
30514 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
30517 Intel Pentium Pro CPU@.
30520 When used with @option{-march}, the Pentium Pro
30521 instruction set is used, so the code runs on all i686 family chips.
30522 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
30525 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
30530 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
30534 Intel Pentium M; low-power version of Intel Pentium III CPU
30535 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
30539 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
30542 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
30546 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
30547 SSE2 and SSE3 instruction set support.
30550 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
30551 instruction set support.
30554 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30555 SSE4.1, SSE4.2 and POPCNT instruction set support.
30558 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30559 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
30562 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30563 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
30566 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30567 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
30568 instruction set support.
30571 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30572 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30573 BMI, BMI2 and F16C instruction set support.
30576 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30577 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
30578 F16C, RDSEED ADCX and PREFETCHW instruction set support.
30581 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30582 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30583 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES
30584 instruction set support.
30587 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
30588 instruction set support.
30591 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30592 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
30595 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30596 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30597 XSAVEOPT and FSGSBASE instruction set support.
30599 @item goldmont-plus
30600 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30601 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
30602 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
30605 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30606 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30607 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30608 MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
30611 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30612 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30613 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30614 AVX512ER and AVX512CD instruction set support.
30617 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30618 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30619 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30620 AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction
30623 @item skylake-avx512
30624 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30625 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30626 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30627 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
30630 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30631 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30632 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30633 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30634 AVX512IFMA, SHA and UMIP instruction set support.
30636 @item icelake-client
30637 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30638 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30639 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30640 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30641 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30642 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30644 @item icelake-server
30645 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30646 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30647 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30648 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30649 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30650 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
30654 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30655 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30656 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30657 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
30660 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30661 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30662 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30663 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
30667 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30668 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30669 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30670 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
30671 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
30672 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
30673 instruction set support.
30675 @item sapphirerapids
30676 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30677 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND,
30678 FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES,
30679 AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
30680 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
30681 SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8 and AVX-VNNI
30682 instruction set support.
30685 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30686 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30687 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30688 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
30689 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI
30690 instruction set support.
30693 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30694 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30695 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30696 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30697 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30698 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30701 AMD K6 CPU with MMX instruction set support.
30705 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
30708 @itemx athlon-tbird
30709 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
30715 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
30716 instruction set support.
30722 Processors based on the AMD K8 core with x86-64 instruction set support,
30723 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
30724 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
30725 instruction set extensions.)
30728 @itemx opteron-sse3
30729 @itemx athlon64-sse3
30730 Improved versions of AMD K8 cores with SSE3 instruction set support.
30734 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
30735 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
30736 instruction set extensions.)
30739 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
30740 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
30741 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
30744 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
30745 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
30746 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
30750 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
30751 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
30752 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
30753 64-bit instruction set extensions.)
30756 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
30757 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
30758 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
30759 SSE4.2, ABM and 64-bit instruction set extensions.)
30762 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
30763 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
30764 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
30765 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
30766 instruction set extensions.)
30769 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
30770 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
30771 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
30772 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
30773 WBNOINVD, and 64-bit instruction set extensions.)
30776 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
30777 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
30778 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
30779 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
30780 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
30783 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
30784 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
30785 instruction set extensions.)
30788 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
30789 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
30790 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
30793 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
30797 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
30798 instruction set support.
30801 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
30802 (No scheduling is implemented for this chip.)
30805 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
30806 (No scheduling is implemented for this chip.)
30809 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
30810 (No scheduling is implemented for this chip.)
30813 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
30814 (No scheduling is implemented for this chip.)
30817 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
30818 (No scheduling is implemented for this chip.)
30821 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
30822 (No scheduling is implemented for this chip.)
30825 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
30826 (No scheduling is implemented for this chip.)
30829 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
30830 AVX and AVX2 instruction set support.
30831 (No scheduling is implemented for this chip.)
30834 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30835 instruction set support.
30836 (No scheduling is implemented for this chip.)
30839 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30840 instruction set support.
30841 (No scheduling is implemented for this chip.)
30844 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30845 instruction set support.
30846 (No scheduling is implemented for this chip.)
30849 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30850 instruction set support.
30851 (No scheduling is implemented for this chip.)
30854 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30855 instruction set support.
30856 (No scheduling is implemented for this chip.)
30859 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30860 instruction set support.
30861 (No scheduling is implemented for this chip.)
30864 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
30867 @item -mtune=@var{cpu-type}
30869 Tune to @var{cpu-type} everything applicable about the generated code, except
30870 for the ABI and the set of available instructions.
30871 While picking a specific @var{cpu-type} schedules things appropriately
30872 for that particular chip, the compiler does not generate any code that
30873 cannot run on the default machine type unless you use a
30874 @option{-march=@var{cpu-type}} option.
30875 For example, if GCC is configured for i686-pc-linux-gnu
30876 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
30877 but still runs on i686 machines.
30879 The choices for @var{cpu-type} are the same as for @option{-march}.
30880 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
30884 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
30885 If you know the CPU on which your code will run, then you should use
30886 the corresponding @option{-mtune} or @option{-march} option instead of
30887 @option{-mtune=generic}. But, if you do not know exactly what CPU users
30888 of your application will have, then you should use this option.
30890 As new processors are deployed in the marketplace, the behavior of this
30891 option will change. Therefore, if you upgrade to a newer version of
30892 GCC, code generation controlled by this option will change to reflect
30894 that are most common at the time that version of GCC is released.
30896 There is no @option{-march=generic} option because @option{-march}
30897 indicates the instruction set the compiler can use, and there is no
30898 generic instruction set applicable to all processors. In contrast,
30899 @option{-mtune} indicates the processor (or, in this case, collection of
30900 processors) for which the code is optimized.
30903 Produce code optimized for the most current Intel processors, which are
30904 Haswell and Silvermont for this version of GCC. If you know the CPU
30905 on which your code will run, then you should use the corresponding
30906 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
30907 But, if you want your application performs better on both Haswell and
30908 Silvermont, then you should use this option.
30910 As new Intel processors are deployed in the marketplace, the behavior of
30911 this option will change. Therefore, if you upgrade to a newer version of
30912 GCC, code generation controlled by this option will change to reflect
30913 the most current Intel processors at the time that version of GCC is
30916 There is no @option{-march=intel} option because @option{-march} indicates
30917 the instruction set the compiler can use, and there is no common
30918 instruction set applicable to all processors. In contrast,
30919 @option{-mtune} indicates the processor (or, in this case, collection of
30920 processors) for which the code is optimized.
30923 @item -mcpu=@var{cpu-type}
30925 A deprecated synonym for @option{-mtune}.
30927 @item -mfpmath=@var{unit}
30929 Generate floating-point arithmetic for selected unit @var{unit}. The choices
30930 for @var{unit} are:
30934 Use the standard 387 floating-point coprocessor present on the majority of chips and
30935 emulated otherwise. Code compiled with this option runs almost everywhere.
30936 The temporary results are computed in 80-bit precision instead of the precision
30937 specified by the type, resulting in slightly different results compared to most
30938 of other chips. See @option{-ffloat-store} for more detailed description.
30940 This is the default choice for non-Darwin x86-32 targets.
30943 Use scalar floating-point instructions present in the SSE instruction set.
30944 This instruction set is supported by Pentium III and newer chips,
30945 and in the AMD line
30946 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
30947 instruction set supports only single-precision arithmetic, thus the double and
30948 extended-precision arithmetic are still done using 387. A later version, present
30949 only in Pentium 4 and AMD x86-64 chips, supports double-precision
30952 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
30953 or @option{-msse2} switches to enable SSE extensions and make this option
30954 effective. For the x86-64 compiler, these extensions are enabled by default.
30956 The resulting code should be considerably faster in the majority of cases and avoid
30957 the numerical instability problems of 387 code, but may break some existing
30958 code that expects temporaries to be 80 bits.
30960 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
30961 and the default choice for x86-32 targets with the SSE2 instruction set
30962 when @option{-ffast-math} is enabled.
30967 Attempt to utilize both instruction sets at once. This effectively doubles the
30968 amount of available registers, and on chips with separate execution units for
30969 387 and SSE the execution resources too. Use this option with care, as it is
30970 still experimental, because the GCC register allocator does not model separate
30971 functional units well, resulting in unstable performance.
30974 @item -masm=@var{dialect}
30975 @opindex masm=@var{dialect}
30976 Output assembly instructions using selected @var{dialect}. Also affects
30977 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
30978 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
30979 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
30980 not support @samp{intel}.
30983 @itemx -mno-ieee-fp
30985 @opindex mno-ieee-fp
30986 Control whether or not the compiler uses IEEE floating-point
30987 comparisons. These correctly handle the case where the result of a
30988 comparison is unordered.
30991 @itemx -mhard-float
30993 @opindex mhard-float
30994 Generate output containing 80387 instructions for floating point.
30997 @itemx -msoft-float
30999 @opindex msoft-float
31000 Generate output containing library calls for floating point.
31002 @strong{Warning:} the requisite libraries are not part of GCC@.
31003 Normally the facilities of the machine's usual C compiler are used, but
31004 this cannot be done directly in cross-compilation. You must make your
31005 own arrangements to provide suitable library functions for
31008 On machines where a function returns floating-point results in the 80387
31009 register stack, some floating-point opcodes may be emitted even if
31010 @option{-msoft-float} is used.
31012 @item -mno-fp-ret-in-387
31013 @opindex mno-fp-ret-in-387
31014 @opindex mfp-ret-in-387
31015 Do not use the FPU registers for return values of functions.
31017 The usual calling convention has functions return values of types
31018 @code{float} and @code{double} in an FPU register, even if there
31019 is no FPU@. The idea is that the operating system should emulate
31022 The option @option{-mno-fp-ret-in-387} causes such values to be returned
31023 in ordinary CPU registers instead.
31025 @item -mno-fancy-math-387
31026 @opindex mno-fancy-math-387
31027 @opindex mfancy-math-387
31028 Some 387 emulators do not support the @code{sin}, @code{cos} and
31029 @code{sqrt} instructions for the 387. Specify this option to avoid
31030 generating those instructions.
31031 This option is overridden when @option{-march}
31032 indicates that the target CPU always has an FPU and so the
31033 instruction does not need emulation. These
31034 instructions are not generated unless you also use the
31035 @option{-funsafe-math-optimizations} switch.
31037 @item -malign-double
31038 @itemx -mno-align-double
31039 @opindex malign-double
31040 @opindex mno-align-double
31041 Control whether GCC aligns @code{double}, @code{long double}, and
31042 @code{long long} variables on a two-word boundary or a one-word
31043 boundary. Aligning @code{double} variables on a two-word boundary
31044 produces code that runs somewhat faster on a Pentium at the
31045 expense of more memory.
31047 On x86-64, @option{-malign-double} is enabled by default.
31049 @strong{Warning:} if you use the @option{-malign-double} switch,
31050 structures containing the above types are aligned differently than
31051 the published application binary interface specifications for the x86-32
31052 and are not binary compatible with structures in code compiled
31053 without that switch.
31055 @item -m96bit-long-double
31056 @itemx -m128bit-long-double
31057 @opindex m96bit-long-double
31058 @opindex m128bit-long-double
31059 These switches control the size of @code{long double} type. The x86-32
31060 application binary interface specifies the size to be 96 bits,
31061 so @option{-m96bit-long-double} is the default in 32-bit mode.
31063 Modern architectures (Pentium and newer) prefer @code{long double}
31064 to be aligned to an 8- or 16-byte boundary. In arrays or structures
31065 conforming to the ABI, this is not possible. So specifying
31066 @option{-m128bit-long-double} aligns @code{long double}
31067 to a 16-byte boundary by padding the @code{long double} with an additional
31070 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
31071 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
31073 Notice that neither of these options enable any extra precision over the x87
31074 standard of 80 bits for a @code{long double}.
31076 @strong{Warning:} if you override the default value for your target ABI, this
31077 changes the size of
31078 structures and arrays containing @code{long double} variables,
31079 as well as modifying the function calling convention for functions taking
31080 @code{long double}. Hence they are not binary-compatible
31081 with code compiled without that switch.
31083 @item -mlong-double-64
31084 @itemx -mlong-double-80
31085 @itemx -mlong-double-128
31086 @opindex mlong-double-64
31087 @opindex mlong-double-80
31088 @opindex mlong-double-128
31089 These switches control the size of @code{long double} type. A size
31090 of 64 bits makes the @code{long double} type equivalent to the @code{double}
31091 type. This is the default for 32-bit Bionic C library. A size
31092 of 128 bits makes the @code{long double} type equivalent to the
31093 @code{__float128} type. This is the default for 64-bit Bionic C library.
31095 @strong{Warning:} if you override the default value for your target ABI, this
31096 changes the size of
31097 structures and arrays containing @code{long double} variables,
31098 as well as modifying the function calling convention for functions taking
31099 @code{long double}. Hence they are not binary-compatible
31100 with code compiled without that switch.
31102 @item -malign-data=@var{type}
31103 @opindex malign-data
31104 Control how GCC aligns variables. Supported values for @var{type} are
31105 @samp{compat} uses increased alignment value compatible uses GCC 4.8
31106 and earlier, @samp{abi} uses alignment value as specified by the
31107 psABI, and @samp{cacheline} uses increased alignment value to match
31108 the cache line size. @samp{compat} is the default.
31110 @item -mlarge-data-threshold=@var{threshold}
31111 @opindex mlarge-data-threshold
31112 When @option{-mcmodel=medium} is specified, data objects larger than
31113 @var{threshold} are placed in the large data section. This value must be the
31114 same across all objects linked into the binary, and defaults to 65535.
31118 Use a different function-calling convention, in which functions that
31119 take a fixed number of arguments return with the @code{ret @var{num}}
31120 instruction, which pops their arguments while returning. This saves one
31121 instruction in the caller since there is no need to pop the arguments
31124 You can specify that an individual function is called with this calling
31125 sequence with the function attribute @code{stdcall}. You can also
31126 override the @option{-mrtd} option by using the function attribute
31127 @code{cdecl}. @xref{Function Attributes}.
31129 @strong{Warning:} this calling convention is incompatible with the one
31130 normally used on Unix, so you cannot use it if you need to call
31131 libraries compiled with the Unix compiler.
31133 Also, you must provide function prototypes for all functions that
31134 take variable numbers of arguments (including @code{printf});
31135 otherwise incorrect code is generated for calls to those
31138 In addition, seriously incorrect code results if you call a
31139 function with too many arguments. (Normally, extra arguments are
31140 harmlessly ignored.)
31142 @item -mregparm=@var{num}
31144 Control how many registers are used to pass integer arguments. By
31145 default, no registers are used to pass arguments, and at most 3
31146 registers can be used. You can control this behavior for a specific
31147 function by using the function attribute @code{regparm}.
31148 @xref{Function Attributes}.
31150 @strong{Warning:} if you use this switch, and
31151 @var{num} is nonzero, then you must build all modules with the same
31152 value, including any libraries. This includes the system libraries and
31156 @opindex msseregparm
31157 Use SSE register passing conventions for float and double arguments
31158 and return values. You can control this behavior for a specific
31159 function by using the function attribute @code{sseregparm}.
31160 @xref{Function Attributes}.
31162 @strong{Warning:} if you use this switch then you must build all
31163 modules with the same value, including any libraries. This includes
31164 the system libraries and startup modules.
31166 @item -mvect8-ret-in-mem
31167 @opindex mvect8-ret-in-mem
31168 Return 8-byte vectors in memory instead of MMX registers. This is the
31169 default on VxWorks to match the ABI of the Sun Studio compilers until
31170 version 12. @emph{Only} use this option if you need to remain
31171 compatible with existing code produced by those previous compiler
31172 versions or older versions of GCC@.
31181 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
31182 is specified, the significands of results of floating-point operations are
31183 rounded to 24 bits (single precision); @option{-mpc64} rounds the
31184 significands of results of floating-point operations to 53 bits (double
31185 precision) and @option{-mpc80} rounds the significands of results of
31186 floating-point operations to 64 bits (extended double precision), which is
31187 the default. When this option is used, floating-point operations in higher
31188 precisions are not available to the programmer without setting the FPU
31189 control word explicitly.
31191 Setting the rounding of floating-point operations to less than the default
31192 80 bits can speed some programs by 2% or more. Note that some mathematical
31193 libraries assume that extended-precision (80-bit) floating-point operations
31194 are enabled by default; routines in such libraries could suffer significant
31195 loss of accuracy, typically through so-called ``catastrophic cancellation'',
31196 when this option is used to set the precision to less than extended precision.
31198 @item -mstackrealign
31199 @opindex mstackrealign
31200 Realign the stack at entry. On the x86, the @option{-mstackrealign}
31201 option generates an alternate prologue and epilogue that realigns the
31202 run-time stack if necessary. This supports mixing legacy codes that keep
31203 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
31204 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
31205 applicable to individual functions.
31207 @item -mpreferred-stack-boundary=@var{num}
31208 @opindex mpreferred-stack-boundary
31209 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
31210 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
31211 the default is 4 (16 bytes or 128 bits).
31213 @strong{Warning:} When generating code for the x86-64 architecture with
31214 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
31215 used to keep the stack boundary aligned to 8 byte boundary. Since
31216 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
31217 intended to be used in controlled environment where stack space is
31218 important limitation. This option leads to wrong code when functions
31219 compiled with 16 byte stack alignment (such as functions from a standard
31220 library) are called with misaligned stack. In this case, SSE
31221 instructions may lead to misaligned memory access traps. In addition,
31222 variable arguments are handled incorrectly for 16 byte aligned
31223 objects (including x87 long double and __int128), leading to wrong
31224 results. You must build all modules with
31225 @option{-mpreferred-stack-boundary=3}, including any libraries. This
31226 includes the system libraries and startup modules.
31228 @item -mincoming-stack-boundary=@var{num}
31229 @opindex mincoming-stack-boundary
31230 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
31231 boundary. If @option{-mincoming-stack-boundary} is not specified,
31232 the one specified by @option{-mpreferred-stack-boundary} is used.
31234 On Pentium and Pentium Pro, @code{double} and @code{long double} values
31235 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
31236 suffer significant run time performance penalties. On Pentium III, the
31237 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
31238 properly if it is not 16-byte aligned.
31240 To ensure proper alignment of this values on the stack, the stack boundary
31241 must be as aligned as that required by any value stored on the stack.
31242 Further, every function must be generated such that it keeps the stack
31243 aligned. Thus calling a function compiled with a higher preferred
31244 stack boundary from a function compiled with a lower preferred stack
31245 boundary most likely misaligns the stack. It is recommended that
31246 libraries that use callbacks always use the default setting.
31248 This extra alignment does consume extra stack space, and generally
31249 increases code size. Code that is sensitive to stack space usage, such
31250 as embedded systems and operating system kernels, may want to reduce the
31251 preferred alignment to @option{-mpreferred-stack-boundary=2}.
31308 @itemx -mavx512ifma
31309 @opindex mavx512ifma
31311 @itemx -mavx512vbmi
31312 @opindex mavx512vbmi
31323 @itemx -mclflushopt
31324 @opindex mclflushopt
31359 @itemx -mprefetchwt1
31360 @opindex mprefetchwt1
31431 @itemx -mavx512vbmi2
31432 @opindex mavx512vbmi2
31434 @itemx -mavx512bf16
31435 @opindex mavx512bf16
31437 @itemx -mavx512fp16
31438 @opindex mavx512fp16
31449 @itemx -mvpclmulqdq
31450 @opindex mvpclmulqdq
31452 @itemx -mavx512bitalg
31453 @opindex mavx512bitalg
31459 @opindex mmovdir64b
31469 @itemx -mavx512vpopcntdq
31470 @opindex mavx512vpopcntdq
31472 @itemx -mavx512vp2intersect
31473 @opindex mavx512vp2intersect
31475 @itemx -mavx5124fmaps
31476 @opindex mavx5124fmaps
31478 @itemx -mavx512vnni
31479 @opindex mavx512vnni
31484 @itemx -mavx5124vnniw
31485 @opindex mavx5124vnniw
31491 @opindex mserialize
31509 These switches enable the use of instructions in the MMX, SSE,
31510 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
31511 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
31512 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
31513 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
31514 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
31515 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
31516 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
31517 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
31518 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16
31519 or CLDEMOTE extended instruction sets. Each has a corresponding
31520 @option{-mno-} option to disable use of these instructions.
31522 These extensions are also available as built-in functions: see
31523 @ref{x86 Built-in Functions}, for details of the functions enabled and
31524 disabled by these switches.
31526 To generate SSE/SSE2 instructions automatically from floating-point
31527 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
31529 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
31530 generates new AVX instructions or AVX equivalence for all SSEx instructions
31533 These options enable GCC to use these extended instructions in
31534 generated code, even without @option{-mfpmath=sse}. Applications that
31535 perform run-time CPU detection must compile separate files for each
31536 supported architecture, using the appropriate flags. In particular,
31537 the file containing the CPU detection code should be compiled without
31540 @item -mdump-tune-features
31541 @opindex mdump-tune-features
31542 This option instructs GCC to dump the names of the x86 performance
31543 tuning features and default settings. The names can be used in
31544 @option{-mtune-ctrl=@var{feature-list}}.
31546 @item -mtune-ctrl=@var{feature-list}
31547 @opindex mtune-ctrl=@var{feature-list}
31548 This option is used to do fine grain control of x86 code generation features.
31549 @var{feature-list} is a comma separated list of @var{feature} names. See also
31550 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
31551 on if it is not preceded with @samp{^}, otherwise, it is turned off.
31552 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
31553 developers. Using it may lead to code paths not covered by testing and can
31554 potentially result in compiler ICEs or runtime errors.
31557 @opindex mno-default
31558 This option instructs GCC to turn off all tunable features. See also
31559 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
31563 This option instructs GCC to emit a @code{cld} instruction in the prologue
31564 of functions that use string instructions. String instructions depend on
31565 the DF flag to select between autoincrement or autodecrement mode. While the
31566 ABI specifies the DF flag to be cleared on function entry, some operating
31567 systems violate this specification by not clearing the DF flag in their
31568 exception dispatchers. The exception handler can be invoked with the DF flag
31569 set, which leads to wrong direction mode when string instructions are used.
31570 This option can be enabled by default on 32-bit x86 targets by configuring
31571 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
31572 instructions can be suppressed with the @option{-mno-cld} compiler option
31576 @opindex mvzeroupper
31577 This option instructs GCC to emit a @code{vzeroupper} instruction
31578 before a transfer of control flow out of the function to minimize
31579 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
31582 @item -mprefer-avx128
31583 @opindex mprefer-avx128
31584 This option instructs GCC to use 128-bit AVX instructions instead of
31585 256-bit AVX instructions in the auto-vectorizer.
31587 @item -mprefer-vector-width=@var{opt}
31588 @opindex mprefer-vector-width
31589 This option instructs GCC to use @var{opt}-bit vector width in instructions
31590 instead of default on the selected platform.
31594 No extra limitations applied to GCC other than defined by the selected platform.
31597 Prefer 128-bit vector width for instructions.
31600 Prefer 256-bit vector width for instructions.
31603 Prefer 512-bit vector width for instructions.
31608 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
31609 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
31610 objects. This is useful for atomic updates of data structures exceeding one
31611 machine word in size. The compiler uses this instruction to implement
31612 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
31613 128-bit integers, a library call is always used.
31617 This option enables generation of @code{SAHF} instructions in 64-bit code.
31618 Early Intel Pentium 4 CPUs with Intel 64 support,
31619 prior to the introduction of Pentium 4 G1 step in December 2005,
31620 lacked the @code{LAHF} and @code{SAHF} instructions
31621 which are supported by AMD64.
31622 These are load and store instructions, respectively, for certain status flags.
31623 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
31624 @code{drem}, and @code{remainder} built-in functions;
31625 see @ref{Other Builtins} for details.
31629 This option enables use of the @code{movbe} instruction to implement
31630 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
31634 The @option{-mshstk} option enables shadow stack built-in functions
31635 from x86 Control-flow Enforcement Technology (CET).
31639 This option enables built-in functions @code{__builtin_ia32_crc32qi},
31640 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
31641 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
31645 This option enables built-in functions @code{__builtin_ia32_monitor},
31646 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
31647 @code{mwait} machine instructions.
31651 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
31652 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
31653 with an additional Newton-Raphson step
31654 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
31655 (and their vectorized
31656 variants) for single-precision floating-point arguments. These instructions
31657 are generated only when @option{-funsafe-math-optimizations} is enabled
31658 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
31659 Note that while the throughput of the sequence is higher than the throughput
31660 of the non-reciprocal instruction, the precision of the sequence can be
31661 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
31663 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
31664 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
31665 combination), and doesn't need @option{-mrecip}.
31667 Also note that GCC emits the above sequence with additional Newton-Raphson step
31668 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
31669 already with @option{-ffast-math} (or the above option combination), and
31670 doesn't need @option{-mrecip}.
31672 @item -mrecip=@var{opt}
31673 @opindex mrecip=opt
31674 This option controls which reciprocal estimate instructions
31675 may be used. @var{opt} is a comma-separated list of options, which may
31676 be preceded by a @samp{!} to invert the option:
31680 Enable all estimate instructions.
31683 Enable the default instructions, equivalent to @option{-mrecip}.
31686 Disable all estimate instructions, equivalent to @option{-mno-recip}.
31689 Enable the approximation for scalar division.
31692 Enable the approximation for vectorized division.
31695 Enable the approximation for scalar square root.
31698 Enable the approximation for vectorized square root.
31701 So, for example, @option{-mrecip=all,!sqrt} enables
31702 all of the reciprocal approximations, except for square root.
31704 @item -mveclibabi=@var{type}
31705 @opindex mveclibabi
31706 Specifies the ABI type to use for vectorizing intrinsics using an
31707 external library. Supported values for @var{type} are @samp{svml}
31708 for the Intel short
31709 vector math library and @samp{acml} for the AMD math core library.
31710 To use this option, both @option{-ftree-vectorize} and
31711 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
31712 ABI-compatible library must be specified at link time.
31714 GCC currently emits calls to @code{vmldExp2},
31715 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
31716 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
31717 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
31718 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
31719 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
31720 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
31721 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
31722 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
31723 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
31724 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
31725 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
31726 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
31727 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
31728 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
31729 when @option{-mveclibabi=acml} is used.
31731 @item -mabi=@var{name}
31733 Generate code for the specified calling convention. Permissible values
31734 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
31735 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
31736 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
31737 You can control this behavior for specific functions by
31738 using the function attributes @code{ms_abi} and @code{sysv_abi}.
31739 @xref{Function Attributes}.
31741 @item -mforce-indirect-call
31742 @opindex mforce-indirect-call
31743 Force all calls to functions to be indirect. This is useful
31744 when using Intel Processor Trace where it generates more precise timing
31745 information for function calls.
31747 @item -mmanual-endbr
31748 @opindex mmanual-endbr
31749 Insert ENDBR instruction at function entry only via the @code{cf_check}
31750 function attribute. This is useful when used with the option
31751 @option{-fcf-protection=branch} to control ENDBR insertion at the
31754 @item -mcall-ms2sysv-xlogues
31755 @opindex mcall-ms2sysv-xlogues
31756 @opindex mno-call-ms2sysv-xlogues
31757 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
31758 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
31759 default, the code for saving and restoring these registers is emitted inline,
31760 resulting in fairly lengthy prologues and epilogues. Using
31761 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
31762 use stubs in the static portion of libgcc to perform these saves and restores,
31763 thus reducing function size at the cost of a few extra instructions.
31765 @item -mtls-dialect=@var{type}
31766 @opindex mtls-dialect
31767 Generate code to access thread-local storage using the @samp{gnu} or
31768 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
31769 @samp{gnu2} is more efficient, but it may add compile- and run-time
31770 requirements that cannot be satisfied on all systems.
31773 @itemx -mno-push-args
31774 @opindex mpush-args
31775 @opindex mno-push-args
31776 Use PUSH operations to store outgoing parameters. This method is shorter
31777 and usually equally fast as method using SUB/MOV operations and is enabled
31778 by default. In some cases disabling it may improve performance because of
31779 improved scheduling and reduced dependencies.
31781 @item -maccumulate-outgoing-args
31782 @opindex maccumulate-outgoing-args
31783 If enabled, the maximum amount of space required for outgoing arguments is
31784 computed in the function prologue. This is faster on most modern CPUs
31785 because of reduced dependencies, improved scheduling and reduced stack usage
31786 when the preferred stack boundary is not equal to 2. The drawback is a notable
31787 increase in code size. This switch implies @option{-mno-push-args}.
31791 Support thread-safe exception handling on MinGW. Programs that rely
31792 on thread-safe exception handling must compile and link all code with the
31793 @option{-mthreads} option. When compiling, @option{-mthreads} defines
31794 @option{-D_MT}; when linking, it links in a special thread helper library
31795 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
31797 @item -mms-bitfields
31798 @itemx -mno-ms-bitfields
31799 @opindex mms-bitfields
31800 @opindex mno-ms-bitfields
31802 Enable/disable bit-field layout compatible with the native Microsoft
31805 If @code{packed} is used on a structure, or if bit-fields are used,
31806 it may be that the Microsoft ABI lays out the structure differently
31807 than the way GCC normally does. Particularly when moving packed
31808 data between functions compiled with GCC and the native Microsoft compiler
31809 (either via function call or as data in a file), it may be necessary to access
31812 This option is enabled by default for Microsoft Windows
31813 targets. This behavior can also be controlled locally by use of variable
31814 or type attributes. For more information, see @ref{x86 Variable Attributes}
31815 and @ref{x86 Type Attributes}.
31817 The Microsoft structure layout algorithm is fairly simple with the exception
31818 of the bit-field packing.
31819 The padding and alignment of members of structures and whether a bit-field
31820 can straddle a storage-unit boundary are determine by these rules:
31823 @item Structure members are stored sequentially in the order in which they are
31824 declared: the first member has the lowest memory address and the last member
31827 @item Every data object has an alignment requirement. The alignment requirement
31828 for all data except structures, unions, and arrays is either the size of the
31829 object or the current packing size (specified with either the
31830 @code{aligned} attribute or the @code{pack} pragma),
31831 whichever is less. For structures, unions, and arrays,
31832 the alignment requirement is the largest alignment requirement of its members.
31833 Every object is allocated an offset so that:
31836 offset % alignment_requirement == 0
31839 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
31840 unit if the integral types are the same size and if the next bit-field fits
31841 into the current allocation unit without crossing the boundary imposed by the
31842 common alignment requirements of the bit-fields.
31845 MSVC interprets zero-length bit-fields in the following ways:
31848 @item If a zero-length bit-field is inserted between two bit-fields that
31849 are normally coalesced, the bit-fields are not coalesced.
31856 unsigned long bf_1 : 12;
31858 unsigned long bf_2 : 12;
31863 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
31864 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
31866 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
31867 alignment of the zero-length bit-field is greater than the member that follows it,
31868 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
31889 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
31890 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
31891 bit-field does not affect the alignment of @code{bar} or, as a result, the size
31894 Taking this into account, it is important to note the following:
31897 @item If a zero-length bit-field follows a normal bit-field, the type of the
31898 zero-length bit-field may affect the alignment of the structure as whole. For
31899 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
31900 normal bit-field, and is of type short.
31902 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
31903 still affect the alignment of the structure:
31914 Here, @code{t4} takes up 4 bytes.
31917 @item Zero-length bit-fields following non-bit-field members are ignored:
31929 Here, @code{t5} takes up 2 bytes.
31933 @item -mno-align-stringops
31934 @opindex mno-align-stringops
31935 @opindex malign-stringops
31936 Do not align the destination of inlined string operations. This switch reduces
31937 code size and improves performance in case the destination is already aligned,
31938 but GCC doesn't know about it.
31940 @item -minline-all-stringops
31941 @opindex minline-all-stringops
31942 By default GCC inlines string operations only when the destination is
31943 known to be aligned to least a 4-byte boundary.
31944 This enables more inlining and increases code
31945 size, but may improve performance of code that depends on fast
31946 @code{memcpy} and @code{memset} for short lengths.
31947 The option enables inline expansion of @code{strlen} for all
31948 pointer alignments.
31950 @item -minline-stringops-dynamically
31951 @opindex minline-stringops-dynamically
31952 For string operations of unknown size, use run-time checks with
31953 inline code for small blocks and a library call for large blocks.
31955 @item -mstringop-strategy=@var{alg}
31956 @opindex mstringop-strategy=@var{alg}
31957 Override the internal decision heuristic for the particular algorithm to use
31958 for inlining string operations. The allowed values for @var{alg} are:
31964 Expand using i386 @code{rep} prefix of the specified size.
31968 @itemx unrolled_loop
31969 Expand into an inline loop.
31972 Always use a library call.
31975 @item -mmemcpy-strategy=@var{strategy}
31976 @opindex mmemcpy-strategy=@var{strategy}
31977 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
31978 should be inlined and what inline algorithm to use when the expected size
31979 of the copy operation is known. @var{strategy}
31980 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
31981 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
31982 the max byte size with which inline algorithm @var{alg} is allowed. For the last
31983 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
31984 in the list must be specified in increasing order. The minimal byte size for
31985 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
31988 @item -mmemset-strategy=@var{strategy}
31989 @opindex mmemset-strategy=@var{strategy}
31990 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
31991 @code{__builtin_memset} expansion.
31993 @item -momit-leaf-frame-pointer
31994 @opindex momit-leaf-frame-pointer
31995 Don't keep the frame pointer in a register for leaf functions. This
31996 avoids the instructions to save, set up, and restore frame pointers and
31997 makes an extra register available in leaf functions. The option
31998 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
31999 which might make debugging harder.
32001 @item -mtls-direct-seg-refs
32002 @itemx -mno-tls-direct-seg-refs
32003 @opindex mtls-direct-seg-refs
32004 Controls whether TLS variables may be accessed with offsets from the
32005 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
32006 or whether the thread base pointer must be added. Whether or not this
32007 is valid depends on the operating system, and whether it maps the
32008 segment to cover the entire TLS area.
32010 For systems that use the GNU C Library, the default is on.
32013 @itemx -mno-sse2avx
32015 Specify that the assembler should encode SSE instructions with VEX
32016 prefix. The option @option{-mavx} turns this on by default.
32021 If profiling is active (@option{-pg}), put the profiling
32022 counter call before the prologue.
32023 Note: On x86 architectures the attribute @code{ms_hook_prologue}
32024 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
32026 @item -mrecord-mcount
32027 @itemx -mno-record-mcount
32028 @opindex mrecord-mcount
32029 If profiling is active (@option{-pg}), generate a __mcount_loc section
32030 that contains pointers to each profiling call. This is useful for
32031 automatically patching and out calls.
32034 @itemx -mno-nop-mcount
32035 @opindex mnop-mcount
32036 If profiling is active (@option{-pg}), generate the calls to
32037 the profiling functions as NOPs. This is useful when they
32038 should be patched in later dynamically. This is likely only
32039 useful together with @option{-mrecord-mcount}.
32041 @item -minstrument-return=@var{type}
32042 @opindex minstrument-return
32043 Instrument function exit in -pg -mfentry instrumented functions with
32044 call to specified function. This only instruments true returns ending
32045 with ret, but not sibling calls ending with jump. Valid types
32046 are @var{none} to not instrument, @var{call} to generate a call to __return__,
32047 or @var{nop5} to generate a 5 byte nop.
32049 @item -mrecord-return
32050 @itemx -mno-record-return
32051 @opindex mrecord-return
32052 Generate a __return_loc section pointing to all return instrumentation code.
32054 @item -mfentry-name=@var{name}
32055 @opindex mfentry-name
32056 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
32058 @item -mfentry-section=@var{name}
32059 @opindex mfentry-section
32060 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
32062 @item -mskip-rax-setup
32063 @itemx -mno-skip-rax-setup
32064 @opindex mskip-rax-setup
32065 When generating code for the x86-64 architecture with SSE extensions
32066 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
32067 register when there are no variable arguments passed in vector registers.
32069 @strong{Warning:} Since RAX register is used to avoid unnecessarily
32070 saving vector registers on stack when passing variable arguments, the
32071 impacts of this option are callees may waste some stack space,
32072 misbehave or jump to a random location. GCC 4.4 or newer don't have
32073 those issues, regardless the RAX register value.
32076 @itemx -mno-8bit-idiv
32077 @opindex m8bit-idiv
32078 On some processors, like Intel Atom, 8-bit unsigned integer divide is
32079 much faster than 32-bit/64-bit integer divide. This option generates a
32080 run-time check. If both dividend and divisor are within range of 0
32081 to 255, 8-bit unsigned integer divide is used instead of
32082 32-bit/64-bit integer divide.
32084 @item -mavx256-split-unaligned-load
32085 @itemx -mavx256-split-unaligned-store
32086 @opindex mavx256-split-unaligned-load
32087 @opindex mavx256-split-unaligned-store
32088 Split 32-byte AVX unaligned load and store.
32090 @item -mstack-protector-guard=@var{guard}
32091 @itemx -mstack-protector-guard-reg=@var{reg}
32092 @itemx -mstack-protector-guard-offset=@var{offset}
32093 @opindex mstack-protector-guard
32094 @opindex mstack-protector-guard-reg
32095 @opindex mstack-protector-guard-offset
32096 Generate stack protection code using canary at @var{guard}. Supported
32097 locations are @samp{global} for global canary or @samp{tls} for per-thread
32098 canary in the TLS block (the default). This option has effect only when
32099 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
32101 With the latter choice the options
32102 @option{-mstack-protector-guard-reg=@var{reg}} and
32103 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
32104 which segment register (@code{%fs} or @code{%gs}) to use as base register
32105 for reading the canary, and from what offset from that base register.
32106 The default for those is as specified in the relevant ABI.
32108 @item -mgeneral-regs-only
32109 @opindex mgeneral-regs-only
32110 Generate code that uses only the general-purpose registers. This
32111 prevents the compiler from using floating-point, vector, mask and bound
32114 @item -mindirect-branch=@var{choice}
32115 @opindex mindirect-branch
32116 Convert indirect call and jump with @var{choice}. The default is
32117 @samp{keep}, which keeps indirect call and jump unmodified.
32118 @samp{thunk} converts indirect call and jump to call and return thunk.
32119 @samp{thunk-inline} converts indirect call and jump to inlined call
32120 and return thunk. @samp{thunk-extern} converts indirect call and jump
32121 to external call and return thunk provided in a separate object file.
32122 You can control this behavior for a specific function by using the
32123 function attribute @code{indirect_branch}. @xref{Function Attributes}.
32125 Note that @option{-mcmodel=large} is incompatible with
32126 @option{-mindirect-branch=thunk} and
32127 @option{-mindirect-branch=thunk-extern} since the thunk function may
32128 not be reachable in the large code model.
32130 Note that @option{-mindirect-branch=thunk-extern} is compatible with
32131 @option{-fcf-protection=branch} since the external thunk can be made
32132 to enable control-flow check.
32134 @item -mfunction-return=@var{choice}
32135 @opindex mfunction-return
32136 Convert function return with @var{choice}. The default is @samp{keep},
32137 which keeps function return unmodified. @samp{thunk} converts function
32138 return to call and return thunk. @samp{thunk-inline} converts function
32139 return to inlined call and return thunk. @samp{thunk-extern} converts
32140 function return to external call and return thunk provided in a separate
32141 object file. You can control this behavior for a specific function by
32142 using the function attribute @code{function_return}.
32143 @xref{Function Attributes}.
32145 Note that @option{-mindirect-return=thunk-extern} is compatible with
32146 @option{-fcf-protection=branch} since the external thunk can be made
32147 to enable control-flow check.
32149 Note that @option{-mcmodel=large} is incompatible with
32150 @option{-mfunction-return=thunk} and
32151 @option{-mfunction-return=thunk-extern} since the thunk function may
32152 not be reachable in the large code model.
32155 @item -mindirect-branch-register
32156 @opindex mindirect-branch-register
32157 Force indirect call and jump via register.
32161 These @samp{-m} switches are supported in addition to the above
32162 on x86-64 processors in 64-bit environments.
32175 Generate code for a 16-bit, 32-bit or 64-bit environment.
32176 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
32178 generates code that runs on any i386 system.
32180 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
32181 types to 64 bits, and generates code for the x86-64 architecture.
32182 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
32183 and @option{-mdynamic-no-pic} options.
32185 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
32187 generates code for the x86-64 architecture.
32189 The @option{-m16} option is the same as @option{-m32}, except for that
32190 it outputs the @code{.code16gcc} assembly directive at the beginning of
32191 the assembly output so that the binary can run in 16-bit mode.
32193 The @option{-miamcu} option generates code which conforms to Intel MCU
32194 psABI. It requires the @option{-m32} option to be turned on.
32196 @item -mno-red-zone
32197 @opindex mno-red-zone
32199 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
32200 by the x86-64 ABI; it is a 128-byte area beyond the location of the
32201 stack pointer that is not modified by signal or interrupt handlers
32202 and therefore can be used for temporary data without adjusting the stack
32203 pointer. The flag @option{-mno-red-zone} disables this red zone.
32205 @item -mcmodel=small
32206 @opindex mcmodel=small
32207 Generate code for the small code model: the program and its symbols must
32208 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
32209 Programs can be statically or dynamically linked. This is the default
32212 @item -mcmodel=kernel
32213 @opindex mcmodel=kernel
32214 Generate code for the kernel code model. The kernel runs in the
32215 negative 2 GB of the address space.
32216 This model has to be used for Linux kernel code.
32218 @item -mcmodel=medium
32219 @opindex mcmodel=medium
32220 Generate code for the medium model: the program is linked in the lower 2
32221 GB of the address space. Small symbols are also placed there. Symbols
32222 with sizes larger than @option{-mlarge-data-threshold} are put into
32223 large data or BSS sections and can be located above 2GB. Programs can
32224 be statically or dynamically linked.
32226 @item -mcmodel=large
32227 @opindex mcmodel=large
32228 Generate code for the large model. This model makes no assumptions
32229 about addresses and sizes of sections.
32231 @item -maddress-mode=long
32232 @opindex maddress-mode=long
32233 Generate code for long address mode. This is only supported for 64-bit
32234 and x32 environments. It is the default address mode for 64-bit
32237 @item -maddress-mode=short
32238 @opindex maddress-mode=short
32239 Generate code for short address mode. This is only supported for 32-bit
32240 and x32 environments. It is the default address mode for 32-bit and
32246 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
32247 indicate the micro-architecture ISA level required to execute the binary.
32250 @node x86 Windows Options
32251 @subsection x86 Windows Options
32252 @cindex x86 Windows Options
32253 @cindex Windows Options for x86
32255 These additional options are available for Microsoft Windows targets:
32261 specifies that a console application is to be generated, by
32262 instructing the linker to set the PE header subsystem type
32263 required for console applications.
32264 This option is available for Cygwin and MinGW targets and is
32265 enabled by default on those targets.
32269 This option is available for Cygwin and MinGW targets. It
32270 specifies that a DLL---a dynamic link library---is to be
32271 generated, enabling the selection of the required runtime
32272 startup object and entry point.
32274 @item -mnop-fun-dllimport
32275 @opindex mnop-fun-dllimport
32276 This option is available for Cygwin and MinGW targets. It
32277 specifies that the @code{dllimport} attribute should be ignored.
32281 This option is available for MinGW targets. It specifies
32282 that MinGW-specific thread support is to be used.
32286 This option is available for MinGW-w64 targets. It causes
32287 the @code{UNICODE} preprocessor macro to be predefined, and
32288 chooses Unicode-capable runtime startup code.
32292 This option is available for Cygwin and MinGW targets. It
32293 specifies that the typical Microsoft Windows predefined macros are to
32294 be set in the pre-processor, but does not influence the choice
32295 of runtime library/startup code.
32299 This option is available for Cygwin and MinGW targets. It
32300 specifies that a GUI application is to be generated by
32301 instructing the linker to set the PE header subsystem type
32304 @item -fno-set-stack-executable
32305 @opindex fno-set-stack-executable
32306 @opindex fset-stack-executable
32307 This option is available for MinGW targets. It specifies that
32308 the executable flag for the stack used by nested functions isn't
32309 set. This is necessary for binaries running in kernel mode of
32310 Microsoft Windows, as there the User32 API, which is used to set executable
32311 privileges, isn't available.
32313 @item -fwritable-relocated-rdata
32314 @opindex fno-writable-relocated-rdata
32315 @opindex fwritable-relocated-rdata
32316 This option is available for MinGW and Cygwin targets. It specifies
32317 that relocated-data in read-only section is put into the @code{.data}
32318 section. This is a necessary for older runtimes not supporting
32319 modification of @code{.rdata} sections for pseudo-relocation.
32321 @item -mpe-aligned-commons
32322 @opindex mpe-aligned-commons
32323 This option is available for Cygwin and MinGW targets. It
32324 specifies that the GNU extension to the PE file format that
32325 permits the correct alignment of COMMON variables should be
32326 used when generating code. It is enabled by default if
32327 GCC detects that the target assembler found during configuration
32328 supports the feature.
32331 See also under @ref{x86 Options} for standard options.
32333 @node Xstormy16 Options
32334 @subsection Xstormy16 Options
32335 @cindex Xstormy16 Options
32337 These options are defined for Xstormy16:
32342 Choose startup files and linker script suitable for the simulator.
32345 @node Xtensa Options
32346 @subsection Xtensa Options
32347 @cindex Xtensa Options
32349 These options are supported for Xtensa targets:
32353 @itemx -mno-const16
32355 @opindex mno-const16
32356 Enable or disable use of @code{CONST16} instructions for loading
32357 constant values. The @code{CONST16} instruction is currently not a
32358 standard option from Tensilica. When enabled, @code{CONST16}
32359 instructions are always used in place of the standard @code{L32R}
32360 instructions. The use of @code{CONST16} is enabled by default only if
32361 the @code{L32R} instruction is not available.
32364 @itemx -mno-fused-madd
32365 @opindex mfused-madd
32366 @opindex mno-fused-madd
32367 Enable or disable use of fused multiply/add and multiply/subtract
32368 instructions in the floating-point option. This has no effect if the
32369 floating-point option is not also enabled. Disabling fused multiply/add
32370 and multiply/subtract instructions forces the compiler to use separate
32371 instructions for the multiply and add/subtract operations. This may be
32372 desirable in some cases where strict IEEE 754-compliant results are
32373 required: the fused multiply add/subtract instructions do not round the
32374 intermediate result, thereby producing results with @emph{more} bits of
32375 precision than specified by the IEEE standard. Disabling fused multiply
32376 add/subtract instructions also ensures that the program output is not
32377 sensitive to the compiler's ability to combine multiply and add/subtract
32380 @item -mserialize-volatile
32381 @itemx -mno-serialize-volatile
32382 @opindex mserialize-volatile
32383 @opindex mno-serialize-volatile
32384 When this option is enabled, GCC inserts @code{MEMW} instructions before
32385 @code{volatile} memory references to guarantee sequential consistency.
32386 The default is @option{-mserialize-volatile}. Use
32387 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
32389 @item -mforce-no-pic
32390 @opindex mforce-no-pic
32391 For targets, like GNU/Linux, where all user-mode Xtensa code must be
32392 position-independent code (PIC), this option disables PIC for compiling
32395 @item -mtext-section-literals
32396 @itemx -mno-text-section-literals
32397 @opindex mtext-section-literals
32398 @opindex mno-text-section-literals
32399 These options control the treatment of literal pools. The default is
32400 @option{-mno-text-section-literals}, which places literals in a separate
32401 section in the output file. This allows the literal pool to be placed
32402 in a data RAM/ROM, and it also allows the linker to combine literal
32403 pools from separate object files to remove redundant literals and
32404 improve code size. With @option{-mtext-section-literals}, the literals
32405 are interspersed in the text section in order to keep them as close as
32406 possible to their references. This may be necessary for large assembly
32407 files. Literals for each function are placed right before that function.
32409 @item -mauto-litpools
32410 @itemx -mno-auto-litpools
32411 @opindex mauto-litpools
32412 @opindex mno-auto-litpools
32413 These options control the treatment of literal pools. The default is
32414 @option{-mno-auto-litpools}, which places literals in a separate
32415 section in the output file unless @option{-mtext-section-literals} is
32416 used. With @option{-mauto-litpools} the literals are interspersed in
32417 the text section by the assembler. Compiler does not produce explicit
32418 @code{.literal} directives and loads literals into registers with
32419 @code{MOVI} instructions instead of @code{L32R} to let the assembler
32420 do relaxation and place literals as necessary. This option allows
32421 assembler to create several literal pools per function and assemble
32422 very big functions, which may not be possible with
32423 @option{-mtext-section-literals}.
32425 @item -mtarget-align
32426 @itemx -mno-target-align
32427 @opindex mtarget-align
32428 @opindex mno-target-align
32429 When this option is enabled, GCC instructs the assembler to
32430 automatically align instructions to reduce branch penalties at the
32431 expense of some code density. The assembler attempts to widen density
32432 instructions to align branch targets and the instructions following call
32433 instructions. If there are not enough preceding safe density
32434 instructions to align a target, no widening is performed. The
32435 default is @option{-mtarget-align}. These options do not affect the
32436 treatment of auto-aligned instructions like @code{LOOP}, which the
32437 assembler always aligns, either by widening density instructions or
32438 by inserting NOP instructions.
32441 @itemx -mno-longcalls
32442 @opindex mlongcalls
32443 @opindex mno-longcalls
32444 When this option is enabled, GCC instructs the assembler to translate
32445 direct calls to indirect calls unless it can determine that the target
32446 of a direct call is in the range allowed by the call instruction. This
32447 translation typically occurs for calls to functions in other source
32448 files. Specifically, the assembler translates a direct @code{CALL}
32449 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
32450 The default is @option{-mno-longcalls}. This option should be used in
32451 programs where the call target can potentially be out of range. This
32452 option is implemented in the assembler, not the compiler, so the
32453 assembly code generated by GCC still shows direct call
32454 instructions---look at the disassembled object code to see the actual
32455 instructions. Note that the assembler uses an indirect call for
32456 every cross-file call, not just those that really are out of range.
32458 @item -mabi=@var{name}
32460 Generate code for the specified ABI@. Permissible values are: @samp{call0},
32461 @samp{windowed}. Default ABI is chosen by the Xtensa core configuration.
32464 @opindex mabi=call0
32465 When this option is enabled function parameters are passed in registers
32466 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
32467 caller-saved, and register @code{a15} may be used as a frame pointer.
32468 When this version of the ABI is enabled the C preprocessor symbol
32469 @code{__XTENSA_CALL0_ABI__} is defined.
32471 @item -mabi=windowed
32472 @opindex mabi=windowed
32473 When this option is enabled function parameters are passed in registers
32474 @code{a10} through @code{a15}, and called function rotates register window
32475 by 8 registers on entry so that its arguments are found in registers
32476 @code{a2} through @code{a7}. Register @code{a7} may be used as a frame
32477 pointer. Register window is rotated 8 registers back upon return.
32478 When this version of the ABI is enabled the C preprocessor symbol
32479 @code{__XTENSA_WINDOWED_ABI__} is defined.
32482 @node zSeries Options
32483 @subsection zSeries Options
32484 @cindex zSeries options
32486 These are listed under @xref{S/390 and zSeries Options}.
32492 @section Specifying Subprocesses and the Switches to Pass to Them
32495 @command{gcc} is a driver program. It performs its job by invoking a
32496 sequence of other programs to do the work of compiling, assembling and
32497 linking. GCC interprets its command-line parameters and uses these to
32498 deduce which programs it should invoke, and which command-line options
32499 it ought to place on their command lines. This behavior is controlled
32500 by @dfn{spec strings}. In most cases there is one spec string for each
32501 program that GCC can invoke, but a few programs have multiple spec
32502 strings to control their behavior. The spec strings built into GCC can
32503 be overridden by using the @option{-specs=} command-line switch to specify
32506 @dfn{Spec files} are plain-text files that are used to construct spec
32507 strings. They consist of a sequence of directives separated by blank
32508 lines. The type of directive is determined by the first non-whitespace
32509 character on the line, which can be one of the following:
32512 @item %@var{command}
32513 Issues a @var{command} to the spec file processor. The commands that can
32517 @item %include <@var{file}>
32518 @cindex @code{%include}
32519 Search for @var{file} and insert its text at the current point in the
32522 @item %include_noerr <@var{file}>
32523 @cindex @code{%include_noerr}
32524 Just like @samp{%include}, but do not generate an error message if the include
32525 file cannot be found.
32527 @item %rename @var{old_name} @var{new_name}
32528 @cindex @code{%rename}
32529 Rename the spec string @var{old_name} to @var{new_name}.
32533 @item *[@var{spec_name}]:
32534 This tells the compiler to create, override or delete the named spec
32535 string. All lines after this directive up to the next directive or
32536 blank line are considered to be the text for the spec string. If this
32537 results in an empty string then the spec is deleted. (Or, if the
32538 spec did not exist, then nothing happens.) Otherwise, if the spec
32539 does not currently exist a new spec is created. If the spec does
32540 exist then its contents are overridden by the text of this
32541 directive, unless the first character of that text is the @samp{+}
32542 character, in which case the text is appended to the spec.
32544 @item [@var{suffix}]:
32545 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
32546 and up to the next directive or blank line are considered to make up the
32547 spec string for the indicated suffix. When the compiler encounters an
32548 input file with the named suffix, it processes the spec string in
32549 order to work out how to compile that file. For example:
32553 z-compile -input %i
32556 This says that any input file whose name ends in @samp{.ZZ} should be
32557 passed to the program @samp{z-compile}, which should be invoked with the
32558 command-line switch @option{-input} and with the result of performing the
32559 @samp{%i} substitution. (See below.)
32561 As an alternative to providing a spec string, the text following a
32562 suffix directive can be one of the following:
32565 @item @@@var{language}
32566 This says that the suffix is an alias for a known @var{language}. This is
32567 similar to using the @option{-x} command-line switch to GCC to specify a
32568 language explicitly. For example:
32575 Says that .ZZ files are, in fact, C++ source files.
32578 This causes an error messages saying:
32581 @var{name} compiler not installed on this system.
32585 GCC already has an extensive list of suffixes built into it.
32586 This directive adds an entry to the end of the list of suffixes, but
32587 since the list is searched from the end backwards, it is effectively
32588 possible to override earlier entries using this technique.
32592 GCC has the following spec strings built into it. Spec files can
32593 override these strings or create their own. Note that individual
32594 targets can also add their own spec strings to this list.
32597 asm Options to pass to the assembler
32598 asm_final Options to pass to the assembler post-processor
32599 cpp Options to pass to the C preprocessor
32600 cc1 Options to pass to the C compiler
32601 cc1plus Options to pass to the C++ compiler
32602 endfile Object files to include at the end of the link
32603 link Options to pass to the linker
32604 lib Libraries to include on the command line to the linker
32605 libgcc Decides which GCC support library to pass to the linker
32606 linker Sets the name of the linker
32607 predefines Defines to be passed to the C preprocessor
32608 signed_char Defines to pass to CPP to say whether @code{char} is signed
32610 startfile Object files to include at the start of the link
32613 Here is a small example of a spec file:
32616 %rename lib old_lib
32619 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
32622 This example renames the spec called @samp{lib} to @samp{old_lib} and
32623 then overrides the previous definition of @samp{lib} with a new one.
32624 The new definition adds in some extra command-line options before
32625 including the text of the old definition.
32627 @dfn{Spec strings} are a list of command-line options to be passed to their
32628 corresponding program. In addition, the spec strings can contain
32629 @samp{%}-prefixed sequences to substitute variable text or to
32630 conditionally insert text into the command line. Using these constructs
32631 it is possible to generate quite complex command lines.
32633 Here is a table of all defined @samp{%}-sequences for spec
32634 strings. Note that spaces are not generated automatically around the
32635 results of expanding these sequences. Therefore you can concatenate them
32636 together or combine them with constant text in a single argument.
32640 Substitute one @samp{%} into the program name or argument.
32643 Substitute an empty argument.
32646 Substitute the name of the input file being processed.
32649 Substitute the basename for outputs related with the input file being
32650 processed. This is often the substring up to (and not including) the
32651 last period and not including the directory but, unless %w is active, it
32652 expands to the basename for auxiliary outputs, which may be influenced
32653 by an explicit output name, and by various other options that control
32654 how auxiliary outputs are named.
32657 This is the same as @samp{%b}, but include the file suffix (text after
32658 the last period). Without %w, it expands to the basename for dump
32662 Marks the argument containing or following the @samp{%d} as a
32663 temporary file name, so that that file is deleted if GCC exits
32664 successfully. Unlike @samp{%g}, this contributes no text to the
32667 @item %g@var{suffix}
32668 Substitute a file name that has suffix @var{suffix} and is chosen
32669 once per compilation, and mark the argument in the same way as
32670 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
32671 name is now chosen in a way that is hard to predict even when previously
32672 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
32673 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
32674 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
32675 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
32676 was simply substituted with a file name chosen once per compilation,
32677 without regard to any appended suffix (which was therefore treated
32678 just like ordinary text), making such attacks more likely to succeed.
32680 @item %u@var{suffix}
32681 Like @samp{%g}, but generates a new temporary file name
32682 each time it appears instead of once per compilation.
32684 @item %U@var{suffix}
32685 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
32686 new one if there is no such last file name. In the absence of any
32687 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
32688 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
32689 involves the generation of two distinct file names, one
32690 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
32691 simply substituted with a file name chosen for the previous @samp{%u},
32692 without regard to any appended suffix.
32694 @item %j@var{suffix}
32695 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
32696 writable, and if @option{-save-temps} is not used;
32697 otherwise, substitute the name
32698 of a temporary file, just like @samp{%u}. This temporary file is not
32699 meant for communication between processes, but rather as a junk
32700 disposal mechanism.
32702 @item %|@var{suffix}
32703 @itemx %m@var{suffix}
32704 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
32705 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
32706 all. These are the two most common ways to instruct a program that it
32707 should read from standard input or write to standard output. If you
32708 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
32709 construct: see for example @file{gcc/fortran/lang-specs.h}.
32711 @item %.@var{SUFFIX}
32712 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
32713 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
32714 terminated by the next space or %.
32717 Marks the argument containing or following the @samp{%w} as the
32718 designated output file of this compilation. This puts the argument
32719 into the sequence of arguments that @samp{%o} substitutes.
32722 Indicates that this compilation produces no output file.
32725 Substitutes the names of all the output files, with spaces
32726 automatically placed around them. You should write spaces
32727 around the @samp{%o} as well or the results are undefined.
32728 @samp{%o} is for use in the specs for running the linker.
32729 Input files whose names have no recognized suffix are not compiled
32730 at all, but they are included among the output files, so they are
32734 Substitutes the suffix for object files. Note that this is
32735 handled specially when it immediately follows @samp{%g, %u, or %U},
32736 because of the need for those to form complete file names. The
32737 handling is such that @samp{%O} is treated exactly as if it had already
32738 been substituted, except that @samp{%g, %u, and %U} do not currently
32739 support additional @var{suffix} characters following @samp{%O} as they do
32740 following, for example, @samp{.o}.
32743 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
32744 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
32745 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
32746 and @option{-imultilib} as necessary.
32749 Current argument is the name of a library or startup file of some sort.
32750 Search for that file in a standard list of directories and substitute
32751 the full name found. The current working directory is included in the
32752 list of directories scanned.
32755 Current argument is the name of a linker script. Search for that file
32756 in the current list of directories to scan for libraries. If the file
32757 is located insert a @option{--script} option into the command line
32758 followed by the full path name found. If the file is not found then
32759 generate an error message. Note: the current working directory is not
32763 Print @var{str} as an error message. @var{str} is terminated by a newline.
32764 Use this when inconsistent options are detected.
32767 Print @var{str} as a notice. @var{str} is terminated by a newline.
32769 @item %(@var{name})
32770 Substitute the contents of spec string @var{name} at this point.
32772 @item %x@{@var{option}@}
32773 Accumulate an option for @samp{%X}.
32776 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
32780 Output the accumulated assembler options specified by @option{-Wa}.
32783 Output the accumulated preprocessor options specified by @option{-Wp}.
32786 Output @code{multilib_os_dir}.
32789 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
32792 Process the @code{asm} spec. This is used to compute the
32793 switches to be passed to the assembler.
32796 Process the @code{asm_final} spec. This is a spec string for
32797 passing switches to an assembler post-processor, if such a program is
32801 Process the @code{link} spec. This is the spec for computing the
32802 command line passed to the linker. Typically it makes use of the
32803 @samp{%L %G %S %D and %E} sequences.
32806 Dump out a @option{-L} option for each directory that GCC believes might
32807 contain startup files. If the target supports multilibs then the
32808 current multilib directory is prepended to each of these paths.
32811 Process the @code{lib} spec. This is a spec string for deciding which
32812 libraries are included on the command line to the linker.
32815 Process the @code{libgcc} spec. This is a spec string for deciding
32816 which GCC support library is included on the command line to the linker.
32819 Process the @code{startfile} spec. This is a spec for deciding which
32820 object files are the first ones passed to the linker. Typically
32821 this might be a file named @file{crt0.o}.
32824 Process the @code{endfile} spec. This is a spec string that specifies
32825 the last object files that are passed to the linker.
32828 Process the @code{cpp} spec. This is used to construct the arguments
32829 to be passed to the C preprocessor.
32832 Process the @code{cc1} spec. This is used to construct the options to be
32833 passed to the actual C compiler (@command{cc1}).
32836 Process the @code{cc1plus} spec. This is used to construct the options to be
32837 passed to the actual C++ compiler (@command{cc1plus}).
32840 Substitute the variable part of a matched option. See below.
32841 Note that each comma in the substituted string is replaced by
32845 Remove all occurrences of @code{-S} from the command line. Note---this
32846 command is position dependent. @samp{%} commands in the spec string
32847 before this one see @code{-S}, @samp{%} commands in the spec string
32848 after this one do not.
32851 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
32854 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
32856 @item %:@var{function}(@var{args})
32857 Call the named function @var{function}, passing it @var{args}.
32858 @var{args} is first processed as a nested spec string, then split
32859 into an argument vector in the usual fashion. The function returns
32860 a string which is processed as if it had appeared literally as part
32861 of the current spec.
32863 The following built-in spec functions are provided:
32866 @item @code{getenv}
32867 The @code{getenv} spec function takes two arguments: an environment
32868 variable name and a string. If the environment variable is not
32869 defined, a fatal error is issued. Otherwise, the return value is the
32870 value of the environment variable concatenated with the string. For
32871 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
32874 %:getenv(TOPDIR /include)
32877 expands to @file{/path/to/top/include}.
32879 @item @code{if-exists}
32880 The @code{if-exists} spec function takes one argument, an absolute
32881 pathname to a file. If the file exists, @code{if-exists} returns the
32882 pathname. Here is a small example of its usage:
32886 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
32889 @item @code{if-exists-else}
32890 The @code{if-exists-else} spec function is similar to the @code{if-exists}
32891 spec function, except that it takes two arguments. The first argument is
32892 an absolute pathname to a file. If the file exists, @code{if-exists-else}
32893 returns the pathname. If it does not exist, it returns the second argument.
32894 This way, @code{if-exists-else} can be used to select one file or another,
32895 based on the existence of the first. Here is a small example of its usage:
32899 crt0%O%s %:if-exists(crti%O%s) \
32900 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
32903 @item @code{if-exists-then-else}
32904 The @code{if-exists-then-else} spec function takes at least two arguments
32905 and an optional third one. The first argument is an absolute pathname to a
32906 file. If the file exists, the function returns the second argument.
32907 If the file does not exist, the function returns the third argument if there
32908 is one, or NULL otherwise. This can be used to expand one text, or optionally
32909 another, based on the existence of a file. Here is a small example of its
32913 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
32916 @item @code{sanitize}
32917 The @code{sanitize} spec function takes no arguments. It returns non-NULL if
32918 any address, thread or undefined behavior sanitizers are active.
32921 %@{%:sanitize(address):-funwind-tables@}
32924 @item @code{replace-outfile}
32925 The @code{replace-outfile} spec function takes two arguments. It looks for the
32926 first argument in the outfiles array and replaces it with the second argument. Here
32927 is a small example of its usage:
32930 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
32933 @item @code{remove-outfile}
32934 The @code{remove-outfile} spec function takes one argument. It looks for the
32935 first argument in the outfiles array and removes it. Here is a small example
32939 %:remove-outfile(-lm)
32942 @item @code{version-compare}
32943 The @code{version-compare} spec function takes four or five arguments of the following
32947 <comparison-op> <arg1> [<arg2>] <switch> <result>
32950 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
32951 The supported @code{comparison-op} values are:
32955 True if @code{switch} is a later (or same) version than @code{arg1}
32958 Opposite of @code{>=}
32961 True if @code{switch} is an earlier version than @code{arg1}
32964 Opposite of @code{<}
32967 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
32970 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
32973 If the @code{switch} is not present at all, the condition is false unless the first character
32974 of the @code{comparison-op} is @code{!}.
32977 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
32980 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
32983 @item @code{include}
32984 The @code{include} spec function behaves much like @code{%include}, with the advantage
32985 that it can be nested inside a spec and thus be conditionalized. It takes one argument,
32986 the filename, and looks for it in the startfile path. It always returns NULL.
32989 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
32992 @item @code{pass-through-libs}
32993 The @code{pass-through-libs} spec function takes any number of arguments. It
32994 finds any @option{-l} options and any non-options ending in @file{.a} (which it
32995 assumes are the names of linker input library archive files) and returns a
32996 result containing all the found arguments each prepended by
32997 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
32998 intended to be passed to the LTO linker plugin.
33001 %:pass-through-libs(%G %L %G)
33004 @item @code{print-asm-header}
33005 The @code{print-asm-header} function takes no arguments and simply
33006 prints a banner like:
33012 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
33015 It is used to separate compiler options from assembler options
33016 in the @option{--target-help} output.
33019 The @code{gt} spec function takes two or more arguments. It returns @code{""} (the
33020 empty string) if the second-to-last argument is greater than the last argument, and NULL
33021 otherwise. The following example inserts the @code{link_gomp} spec if the last
33022 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
33025 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
33028 @item @code{debug-level-gt}
33029 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
33030 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
33034 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
33039 Substitutes the @code{-S} switch, if that switch is given to GCC@.
33040 If that switch is not specified, this substitutes nothing. Note that
33041 the leading dash is omitted when specifying this option, and it is
33042 automatically inserted if the substitution is performed. Thus the spec
33043 string @samp{%@{foo@}} matches the command-line option @option{-foo}
33044 and outputs the command-line option @option{-foo}.
33047 Like %@{@code{S}@} but mark last argument supplied within as a file to be
33048 deleted on failure.
33051 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
33052 @code{@@FILE} if an @code{@@file} argument has been supplied.
33055 Substitutes all the switches specified to GCC whose names start
33056 with @code{-S}, but which also take an argument. This is used for
33057 switches like @option{-o}, @option{-D}, @option{-I}, etc.
33058 GCC considers @option{-o foo} as being
33059 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
33060 text, including the space. Thus two arguments are generated.
33063 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
33064 (the order of @code{S} and @code{T} in the spec is not significant).
33065 There can be any number of ampersand-separated variables; for each the
33066 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
33069 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
33072 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
33075 Substitutes @code{X} if one or more switches whose names start with
33076 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
33077 once, no matter how many such switches appeared. However, if @code{%*}
33078 appears somewhere in @code{X}, then @code{X} is substituted once
33079 for each matching switch, with the @code{%*} replaced by the part of
33080 that switch matching the @code{*}.
33082 If @code{%*} appears as the last part of a spec sequence then a space
33083 is added after the end of the last substitution. If there is more
33084 text in the sequence, however, then a space is not generated. This
33085 allows the @code{%*} substitution to be used as part of a larger
33086 string. For example, a spec string like this:
33089 %@{mcu=*:--script=%*/memory.ld@}
33093 when matching an option like @option{-mcu=newchip} produces:
33096 --script=newchip/memory.ld
33100 Substitutes @code{X}, if processing a file with suffix @code{S}.
33103 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
33106 Substitutes @code{X}, if processing a file for language @code{S}.
33109 Substitutes @code{X}, if not processing a file for language @code{S}.
33112 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
33113 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
33114 @code{*} sequences as well, although they have a stronger binding than
33115 the @samp{|}. If @code{%*} appears in @code{X}, all of the
33116 alternatives must be starred, and only the first matching alternative
33119 For example, a spec string like this:
33122 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
33126 outputs the following command-line options from the following input
33127 command-line options:
33132 -d fred.c -foo -baz -boggle
33133 -d jim.d -bar -baz -boggle
33136 @item %@{%:@var{function}(@var{args}):X@}
33138 Call function named @var{function} with args @var{args}. If the
33139 function returns non-NULL, then @code{X} is substituted, if it returns
33140 NULL, it isn't substituted.
33142 @item %@{S:X; T:Y; :D@}
33144 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
33145 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
33146 be as many clauses as you need. This may be combined with @code{.},
33147 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
33152 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
33153 or similar construct can use a backslash to ignore the special meaning
33154 of the character following it, thus allowing literal matching of a
33155 character that is otherwise specially treated. For example,
33156 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
33157 @option{-std=iso9899:1999} option is given.
33159 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
33160 construct may contain other nested @samp{%} constructs or spaces, or
33161 even newlines. They are processed as usual, as described above.
33162 Trailing white space in @code{X} is ignored. White space may also
33163 appear anywhere on the left side of the colon in these constructs,
33164 except between @code{.} or @code{*} and the corresponding word.
33166 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
33167 handled specifically in these constructs. If another value of
33168 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
33169 @option{-W} switch is found later in the command line, the earlier
33170 switch value is ignored, except with @{@code{S}*@} where @code{S} is
33171 just one letter, which passes all matching options.
33173 The character @samp{|} at the beginning of the predicate text is used to
33174 indicate that a command should be piped to the following command, but
33175 only if @option{-pipe} is specified.
33177 It is built into GCC which switches take arguments and which do not.
33178 (You might think it would be useful to generalize this to allow each
33179 compiler's spec to say which switches take arguments. But this cannot
33180 be done in a consistent fashion. GCC cannot even decide which input
33181 files have been specified without knowing which switches take arguments,
33182 and it must know which input files to compile in order to tell which
33185 GCC also knows implicitly that arguments starting in @option{-l} are to be
33186 treated as compiler output files, and passed to the linker in their
33187 proper position among the other output files.
33189 @node Environment Variables
33190 @section Environment Variables Affecting GCC
33191 @cindex environment variables
33193 @c man begin ENVIRONMENT
33194 This section describes several environment variables that affect how GCC
33195 operates. Some of them work by specifying directories or prefixes to use
33196 when searching for various kinds of files. Some are used to specify other
33197 aspects of the compilation environment.
33199 Note that you can also specify places to search using options such as
33200 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
33201 take precedence over places specified using environment variables, which
33202 in turn take precedence over those specified by the configuration of GCC@.
33203 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
33204 GNU Compiler Collection (GCC) Internals}.
33209 @c @itemx LC_COLLATE
33211 @c @itemx LC_MONETARY
33212 @c @itemx LC_NUMERIC
33217 @c @findex LC_COLLATE
33218 @findex LC_MESSAGES
33219 @c @findex LC_MONETARY
33220 @c @findex LC_NUMERIC
33224 These environment variables control the way that GCC uses
33225 localization information which allows GCC to work with different
33226 national conventions. GCC inspects the locale categories
33227 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
33228 so. These locale categories can be set to any value supported by your
33229 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
33230 Kingdom encoded in UTF-8.
33232 The @env{LC_CTYPE} environment variable specifies character
33233 classification. GCC uses it to determine the character boundaries in
33234 a string; this is needed for some multibyte encodings that contain quote
33235 and escape characters that are otherwise interpreted as a string
33238 The @env{LC_MESSAGES} environment variable specifies the language to
33239 use in diagnostic messages.
33241 If the @env{LC_ALL} environment variable is set, it overrides the value
33242 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
33243 and @env{LC_MESSAGES} default to the value of the @env{LANG}
33244 environment variable. If none of these variables are set, GCC
33245 defaults to traditional C English behavior.
33249 If @env{TMPDIR} is set, it specifies the directory to use for temporary
33250 files. GCC uses temporary files to hold the output of one stage of
33251 compilation which is to be used as input to the next stage: for example,
33252 the output of the preprocessor, which is the input to the compiler
33255 @item GCC_COMPARE_DEBUG
33256 @findex GCC_COMPARE_DEBUG
33257 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
33258 @option{-fcompare-debug} to the compiler driver. See the documentation
33259 of this option for more details.
33261 @item GCC_EXEC_PREFIX
33262 @findex GCC_EXEC_PREFIX
33263 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
33264 names of the subprograms executed by the compiler. No slash is added
33265 when this prefix is combined with the name of a subprogram, but you can
33266 specify a prefix that ends with a slash if you wish.
33268 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
33269 an appropriate prefix to use based on the pathname it is invoked with.
33271 If GCC cannot find the subprogram using the specified prefix, it
33272 tries looking in the usual places for the subprogram.
33274 The default value of @env{GCC_EXEC_PREFIX} is
33275 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
33276 the installed compiler. In many cases @var{prefix} is the value
33277 of @code{prefix} when you ran the @file{configure} script.
33279 Other prefixes specified with @option{-B} take precedence over this prefix.
33281 This prefix is also used for finding files such as @file{crt0.o} that are
33284 In addition, the prefix is used in an unusual way in finding the
33285 directories to search for header files. For each of the standard
33286 directories whose name normally begins with @samp{/usr/local/lib/gcc}
33287 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
33288 replacing that beginning with the specified prefix to produce an
33289 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
33290 @file{foo/bar} just before it searches the standard directory
33291 @file{/usr/local/lib/bar}.
33292 If a standard directory begins with the configured
33293 @var{prefix} then the value of @var{prefix} is replaced by
33294 @env{GCC_EXEC_PREFIX} when looking for header files.
33296 @item COMPILER_PATH
33297 @findex COMPILER_PATH
33298 The value of @env{COMPILER_PATH} is a colon-separated list of
33299 directories, much like @env{PATH}. GCC tries the directories thus
33300 specified when searching for subprograms, if it cannot find the
33301 subprograms using @env{GCC_EXEC_PREFIX}.
33304 @findex LIBRARY_PATH
33305 The value of @env{LIBRARY_PATH} is a colon-separated list of
33306 directories, much like @env{PATH}. When configured as a native compiler,
33307 GCC tries the directories thus specified when searching for special
33308 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
33309 using GCC also uses these directories when searching for ordinary
33310 libraries for the @option{-l} option (but directories specified with
33311 @option{-L} come first).
33315 @cindex locale definition
33316 This variable is used to pass locale information to the compiler. One way in
33317 which this information is used is to determine the character set to be used
33318 when character literals, string literals and comments are parsed in C and C++.
33319 When the compiler is configured to allow multibyte characters,
33320 the following values for @env{LANG} are recognized:
33324 Recognize JIS characters.
33326 Recognize SJIS characters.
33328 Recognize EUCJP characters.
33331 If @env{LANG} is not defined, or if it has some other value, then the
33332 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
33333 recognize and translate multibyte characters.
33335 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
33336 @findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
33337 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
33338 then additional text will be emitted to stderr when fix-it hints are
33339 emitted. @option{-fdiagnostics-parseable-fixits} and
33340 @option{-fno-diagnostics-parseable-fixits} take precedence over this
33341 environment variable.
33345 Emit parseable fix-it hints, equivalent to
33346 @option{-fdiagnostics-parseable-fixits}. In particular, columns are
33347 expressed as a count of bytes, starting at byte 1 for the initial column.
33350 As @code{fixits-v1}, but columns are expressed as display columns,
33351 as per @option{-fdiagnostics-column-unit=display}.
33357 Some additional environment variables affect the behavior of the
33360 @include cppenv.texi
33364 @node Precompiled Headers
33365 @section Using Precompiled Headers
33366 @cindex precompiled headers
33367 @cindex speed of compilation
33369 Often large projects have many header files that are included in every
33370 source file. The time the compiler takes to process these header files
33371 over and over again can account for nearly all of the time required to
33372 build the project. To make builds faster, GCC allows you to
33373 @dfn{precompile} a header file.
33375 To create a precompiled header file, simply compile it as you would any
33376 other file, if necessary using the @option{-x} option to make the driver
33377 treat it as a C or C++ header file. You may want to use a
33378 tool like @command{make} to keep the precompiled header up-to-date when
33379 the headers it contains change.
33381 A precompiled header file is searched for when @code{#include} is
33382 seen in the compilation. As it searches for the included file
33383 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
33384 compiler looks for a precompiled header in each directory just before it
33385 looks for the include file in that directory. The name searched for is
33386 the name specified in the @code{#include} with @samp{.gch} appended. If
33387 the precompiled header file cannot be used, it is ignored.
33389 For instance, if you have @code{#include "all.h"}, and you have
33390 @file{all.h.gch} in the same directory as @file{all.h}, then the
33391 precompiled header file is used if possible, and the original
33392 header is used otherwise.
33394 Alternatively, you might decide to put the precompiled header file in a
33395 directory and use @option{-I} to ensure that directory is searched
33396 before (or instead of) the directory containing the original header.
33397 Then, if you want to check that the precompiled header file is always
33398 used, you can put a file of the same name as the original header in this
33399 directory containing an @code{#error} command.
33401 This also works with @option{-include}. So yet another way to use
33402 precompiled headers, good for projects not designed with precompiled
33403 header files in mind, is to simply take most of the header files used by
33404 a project, include them from another header file, precompile that header
33405 file, and @option{-include} the precompiled header. If the header files
33406 have guards against multiple inclusion, they are skipped because
33407 they've already been included (in the precompiled header).
33409 If you need to precompile the same header file for different
33410 languages, targets, or compiler options, you can instead make a
33411 @emph{directory} named like @file{all.h.gch}, and put each precompiled
33412 header in the directory, perhaps using @option{-o}. It doesn't matter
33413 what you call the files in the directory; every precompiled header in
33414 the directory is considered. The first precompiled header
33415 encountered in the directory that is valid for this compilation is
33416 used; they're searched in no particular order.
33418 There are many other possibilities, limited only by your imagination,
33419 good sense, and the constraints of your build system.
33421 A precompiled header file can be used only when these conditions apply:
33425 Only one precompiled header can be used in a particular compilation.
33428 A precompiled header cannot be used once the first C token is seen. You
33429 can have preprocessor directives before a precompiled header; you cannot
33430 include a precompiled header from inside another header.
33433 The precompiled header file must be produced for the same language as
33434 the current compilation. You cannot use a C precompiled header for a C++
33438 The precompiled header file must have been produced by the same compiler
33439 binary as the current compilation is using.
33442 Any macros defined before the precompiled header is included must
33443 either be defined in the same way as when the precompiled header was
33444 generated, or must not affect the precompiled header, which usually
33445 means that they don't appear in the precompiled header at all.
33447 The @option{-D} option is one way to define a macro before a
33448 precompiled header is included; using a @code{#define} can also do it.
33449 There are also some options that define macros implicitly, like
33450 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
33453 @item If debugging information is output when using the precompiled
33454 header, using @option{-g} or similar, the same kind of debugging information
33455 must have been output when building the precompiled header. However,
33456 a precompiled header built using @option{-g} can be used in a compilation
33457 when no debugging information is being output.
33459 @item The same @option{-m} options must generally be used when building
33460 and using the precompiled header. @xref{Submodel Options},
33461 for any cases where this rule is relaxed.
33463 @item Each of the following options must be the same when building and using
33464 the precompiled header:
33466 @gccoptlist{-fexceptions}
33469 Some other command-line options starting with @option{-f},
33470 @option{-p}, or @option{-O} must be defined in the same way as when
33471 the precompiled header was generated. At present, it's not clear
33472 which options are safe to change and which are not; the safest choice
33473 is to use exactly the same options when generating and using the
33474 precompiled header. The following are known to be safe:
33476 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
33477 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
33478 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
33481 @item Address space layout randomization (ASLR) can lead to not binary identical
33482 PCH files. If you rely on stable PCH file contents disable ASLR when generating
33487 For all of these except the last, the compiler automatically
33488 ignores the precompiled header if the conditions aren't met. If you
33489 find an option combination that doesn't work and doesn't cause the
33490 precompiled header to be ignored, please consider filing a bug report,
33493 If you do use differing options when generating and using the
33494 precompiled header, the actual behavior is a mixture of the
33495 behavior for the options. For instance, if you use @option{-g} to
33496 generate the precompiled header but not when using it, you may or may
33497 not get debugging information for routines in the precompiled header.
33500 @section C++ Modules
33501 @cindex speed of compilation
33503 Modules are a C++20 language feature. As the name suggests, they
33504 provides a modular compilation system, intending to provide both
33505 faster builds and better library isolation. The ``Merging Modules''
33506 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
33507 of changes to the standard, although it does not capture later
33508 changes. That specification is now part of C++20,
33509 @uref{git@@github.com:cplusplus/draft.git}, it is considered complete
33510 (there may be defect reports to come).
33512 @emph{G++'s modules support is not complete.} Other than bugs, the
33513 known missing pieces are:
33517 @item Private Module Fragment
33518 The Private Module Fragment is recognized, but an error is emitted.
33520 @item Partition definition visibility rules
33521 Entities may be defined in implementation partitions, and those
33522 definitions are not available outside of the module. This is not
33523 implemented, and the definitions are available to extra-module use.
33525 @item Textual merging of reachable GM entities
33526 Entities may be multiply defined across different header-units.
33527 These must be de-duplicated, and this is implemented across imports,
33528 or when an import redefines a textually-defined entity. However the
33529 reverse is not implemented---textually redefining an entity that has
33530 been defined in an imported header-unit. A redefinition error is
33533 @item Translation-Unit local referencing rules
33534 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
33535 (@uref{https://wg21.link/p2003}) add limitations on which entities an
33536 exported region may reference (for instance, the entities an exported
33537 template definition may reference). These are not fully implemented.
33539 @item Language-linkage module attachment
33540 Declarations with explicit language linkage (@code{extern "C"} or
33541 @code{extern "C++"}) are attached to the global module, even when in
33542 the purview of a named module. This is not implemented. Such
33543 declarations will be attached to the module, if any, in which they are
33546 @item Standard Library Header Units
33547 The Standard Library is not provided as importable header units. If
33548 you want to import such units, you must explicitly build them first.
33549 If you do not do this with care, you may have multiple declarations,
33550 which the module machinery must merge---compiler resource usage can be
33551 affected by how you partition header files into header units.
33555 Modular compilation is @emph{not} enabled with just the
33556 @option{-std=c++20} option. You must explicitly enable it with the
33557 @option{-fmodules-ts} option. It is independent of the language
33558 version selected, although in pre-C++20 versions, it is of course an
33561 No new source file suffixes are required or supported. If you wish to
33562 use a non-standard suffix (@xref{Overall Options}), you also need
33563 to provide a @option{-x c++} option too.@footnote{Some users like to
33564 distinguish module interface files with a new suffix, such as naming
33565 the source @code{module.cppm}, which involves
33566 teaching all tools about the new suffix. A different scheme, such as
33567 naming @code{module-m.cpp} would be less invasive.}
33569 Compiling a module interface unit produces an additional output (to
33570 the assembly or object file), called a Compiled Module Interface
33571 (CMI). This encodes the exported declarations of the module.
33572 Importing a module reads in the CMI. The import graph is a Directed
33573 Acyclic Graph (DAG). You must build imports before the importer.
33575 Header files may themselves be compiled to header units, which are a
33576 transitional ability aiming at faster compilation. The
33577 @option{-fmodule-header} option is used to enable this, and implies
33578 the @option{-fmodules-ts} option. These CMIs are named by the fully
33579 resolved underlying header file, and thus may be a complete pathname
33580 containing subdirectories. If the header file is found at an absolute
33581 pathname, the CMI location is still relative to a CMI root directory.
33583 As header files often have no suffix, you commonly have to specify a
33584 @option{-x} option to tell the compiler the source is a header file.
33585 You may use @option{-x c++-header}, @option{-x c++-user-header} or
33586 @option{-x c++-system-header}. When used in conjunction with
33587 @option{-fmodules-ts}, these all imply an appropriate
33588 @option{-fmodule-header} option. The latter two variants use the
33589 user or system include path to search for the file specified. This
33590 allows you to, for instance, compile standard library header files as
33591 header units, without needing to know exactly where they are
33592 installed. Specifying the language as one of these variants also
33593 inhibits output of the object file, as header files have no associated
33596 The @option{-fmodule-only} option disables generation of the
33597 associated object file for compiling a module interface. Only the CMI
33598 is generated. This option is implied when using the
33599 @option{-fmodule-header} option.
33601 The @option{-flang-info-include-translate} and
33602 @option{-flang-info-include-translate-not} options notes whether
33603 include translation occurs or not. With no argument, the first will
33604 note all include translation. The second will note all
33605 non-translations of include files not known to intentionally be
33606 textual. With an argument, queries about include translation of a
33607 header files with that particular trailing pathname are noted. You
33608 may repeat this form to cover several different header files. This
33609 option may be helpful in determining whether include translation is
33610 happening---if it is working correctly, it behaves as if it isn't
33613 The @option{-flang-info-module-cmi} option can be used to determine
33614 where the compiler is reading a CMI from. Without the option, the
33615 compiler is silent when such a read is successful. This option has an
33616 optional argument, which will restrict the notification to just the
33617 set of named modules or header units specified.
33619 The @option{-Winvalid-imported-macros} option causes all imported macros
33620 to be resolved at the end of compilation. Without this, imported
33621 macros are only resolved when expanded or (re)defined. This option
33622 detects conflicting import definitions for all macros.
33624 @xref{C++ Module Mapper} for details of the @option{-fmodule-mapper}
33628 * C++ Module Mapper:: Module Mapper
33629 * C++ Module Preprocessing:: Module Preprocessing
33630 * C++ Compiled Module Interface:: Compiled Module Interface
33633 @node C++ Module Mapper
33634 @subsection Module Mapper
33635 @cindex C++ Module Mapper
33637 A module mapper provides a server or file that the compiler queries to
33638 determine the mapping between module names and CMI files. It is also
33639 used to build CMIs on demand. @emph{Mapper functionality is in its
33640 infancy and is intended for experimentation with build system
33643 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
33644 option or @env{CXX_MODULE_MAPPER} environment variable. The value may
33645 have one of the following forms:
33649 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
33650 An optional hostname and a numeric port number to connect to. If the
33651 hostname is omitted, the loopback address is used. If the hostname
33652 corresponds to multiple IPV6 addresses, these are tried in turn, until
33653 one is successful. If your host lacks IPv6, this form is
33654 non-functional. If you must use IPv4 use
33655 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
33657 @item =@var{socket}@r{[}?@var{ident}@r{]}
33658 A local domain socket. If your host lacks local domain sockets, this
33659 form is non-functional.
33661 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
33662 A program to spawn, and communicate with on its stdin/stdout streams.
33663 Your @var{PATH} environment variable is searched for the program.
33664 Arguments are separated by space characters, (it is not possible for
33665 one of the arguments delivered to the program to contain a space). An
33666 exception is if @var{program} begins with @@. In that case
33667 @var{program} (sans @@) is looked for in the compiler's internal
33668 binary directory. Thus the sample mapper-server can be specified
33669 with @code{@@g++-mapper-server}.
33671 @item <>@r{[}?@var{ident}@r{]}
33672 @item <>@var{inout}@r{[}?@var{ident}@r{]}
33673 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
33674 Named pipes or file descriptors to communicate over. The first form,
33675 @option{<>}, communicates over stdin and stdout. The other forms
33676 allow you to specify a file descriptor or name a pipe. A numeric value
33677 is interpreted as a file descriptor, otherwise named pipe is opened.
33678 The second form specifies a bidirectional pipe and the last form
33679 allows specifying two independent pipes. Using file descriptors
33680 directly in this manner is fragile in general, as it can require the
33681 cooperation of intermediate processes. In particular using stdin &
33682 stdout is fraught with danger as other compiler options might also
33683 cause the compiler to read stdin or write stdout, and it can have
33684 unfortunate interactions with signal delivery from the terminal.
33686 @item @var{file}@r{[}?@var{ident}@r{]}
33687 A mapping file consisting of space-separated module-name, filename
33688 pairs, one per line. Only the mappings for the direct imports and any
33689 module export name need be provided. If other mappings are provided,
33690 they override those stored in any imported CMI files. A repository
33691 root may be specified in the mapping file by using @samp{$root} as the
33692 module name in the first active line. Use of this option will disable
33693 any default module->CMI name mapping.
33697 As shown, an optional @var{ident} may suffix the first word of the
33698 option, indicated by a @samp{?} prefix. The value is used in the
33699 initial handshake with the module server, or to specify a prefix on
33700 mapping file lines. In the server case, the main source file name is
33701 used if no @var{ident} is specified. In the file case, all non-blank
33702 lines are significant, unless a value is specified, in which case only
33703 lines beginning with @var{ident} are significant. The @var{ident}
33704 must be separated by whitespace from the module name. Be aware that
33705 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
33706 significant to the shell, and therefore may need quoting.
33708 The mapper is connected to or loaded lazily, when the first module
33709 mapping is required. The networking protocols are only supported on
33710 hosts that provide networking. If no mapper is specified a default is
33713 A project-specific mapper is expected to be provided by the build
33714 system that invokes the compiler. It is not expected that a
33715 general-purpose server is provided for all compilations. As such, the
33716 server will know the build configuration, the compiler it invoked, and
33717 the environment (such as working directory) in which that is
33718 operating. As it may parallelize builds, several compilations may
33719 connect to the same socket.
33721 The default mapper generates CMI files in a @samp{gcm.cache}
33722 directory. CMI files have a @samp{.gcm} suffix. The module unit name
33723 is used directly to provide the basename. Header units construct a
33724 relative path using the underlying header file name. If the path is
33725 already relative, a @samp{,} directory is prepended. Internal
33726 @samp{..} components are translated to @samp{,,}. No attempt is made
33727 to canonicalize these filenames beyond that done by the preprocessor's
33728 include search algorithm, as in general it is ambiguous when symbolic
33731 The mapper protocol was published as ``A Module Mapper''
33732 @uref{https://wg21.link/p1184}. The implementation is provided by
33733 @command{libcody}, @uref{https://github.com/urnathan/libcody},
33734 which specifies the canonical protocol definition. A proof of concept
33735 server implementation embedded in @command{make} was described in
33736 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
33738 @node C++ Module Preprocessing
33739 @subsection Module Preprocessing
33740 @cindex C++ Module Preprocessing
33742 Modules affect preprocessing because of header units and include
33743 translation. Some uses of the preprocessor as a separate step either
33744 do not produce a correct output, or require CMIs to be available.
33746 Header units import macros. These macros can affect later conditional
33747 inclusion, which therefore can cascade to differing import sets. When
33748 preprocessing, it is necessary to load the CMI. If a header unit is
33749 unavailable, the preprocessor issues a warning and continue (when
33750 not just preprocessing, an error is emitted). Detecting such imports
33751 requires preprocessor tokenization of the input stream to phase 4
33754 Include translation converts @code{#include}, @code{#include_next} and
33755 @code{#import} directives to internal @code{import} declarations.
33756 Whether a particular directive is translated is controlled by the
33757 module mapper. Header unit names are canonicalized during
33760 Dependency information can be emitted for macro import, extending the
33761 functionality of @option{-MD} and @option{-MMD} options. Detection of
33762 import declarations also requires phase 4 preprocessing, and thus
33763 requires full preprocessing (or compilation).
33765 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
33766 preprocessing before phase 4.
33768 The @option{-save-temps} option uses @option{-fdirectives-only} for
33769 preprocessing, and preserve the macro definitions in the preprocessed
33770 output. Usually you also want to use this option when explicitly
33771 preprocessing a header-unit, or consuming such preprocessed output:
33774 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
33775 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
33778 @node C++ Compiled Module Interface
33779 @subsection Compiled Module Interface
33780 @cindex C++ Compiled Module Interface
33782 CMIs are an additional artifact when compiling named module
33783 interfaces, partitions or header units. These are read when
33784 importing. CMI contents are implementation-specific, and in GCC's
33785 case tied to the compiler version. Consider them a rebuildable cache
33786 artifact, not a distributable object.
33788 When creating an output CMI, any missing directory components are
33789 created in a manner that is safe for concurrent builds creating
33790 multiple, different, CMIs within a common subdirectory tree.
33792 CMI contents are written to a temporary file, which is then atomically
33793 renamed. Observers either see old contents (if there is an
33794 existing file), or complete new contents. They do not observe the
33795 CMI during its creation. This is unlike object file writing, which
33796 may be observed by an external process.
33798 CMIs are read in lazily, if the host OS provides @code{mmap}
33799 functionality. Generally blocks are read when name lookup or template
33800 instantiation occurs. To inhibit this, the @option{-fno-module-lazy}
33801 option may be used.
33803 The @option{--param lazy-modules=@var{n}} parameter controls the limit
33804 on the number of concurrently open module files during lazy loading.
33805 Should more modules be imported, an LRU algorithm is used to determine
33806 which files to close---until that file is needed again. This limit
33807 may be exceeded with deep module dependency hierarchies. With large
33808 code bases there may be more imports than the process limit of file
33809 descriptors. By default, the limit is a few less than the per-process
33810 file descriptor hard limit, if that is determinable.@footnote{Where
33811 applicable the soft limit is incremented as needed towards the hard limit.}
33813 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
33814 You may use @command{readelf} to inspect them, although section
33815 contents are largely undecipherable. There is a section named
33816 @code{.gnu.c++.README}, which contains human-readable text. Other
33817 than the first line, each line consists of @code{@var{tag}: @code{value}}
33821 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
33823 String dump of section '.gnu.c++.README':
33824 [ 0] GNU C++ primary module interface
33825 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
33826 [ 6f] version: 2020/11/16-04:54
33828 [ 95] source: c_b.ii
33829 [ a4] dialect: C++20/coroutines
33830 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc
33831 [ ee] repository: gcm.cache
33832 [ 104] buildtime: 2020/11/16 15:03:21 UTC
33833 [ 127] localtime: 2020/11/16 07:03:21 PST
33834 [ 14a] export: foo:part1 foo-part1.gcm
33837 Amongst other things, this lists the source that was built, C++
33838 dialect used and imports of the module.@footnote{The precise contents
33839 of this output may change.} The timestamp is the same value as that
33840 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
33841 explicitly specified with the environment variable
33842 @code{SOURCE_DATE_EPOCH}. @xref{Environment Variables} for further
33845 A set of related CMIs may be copied, provided the relative pathnames
33848 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
33849 it may be removed or altered. The section numbering of the sections
33850 whose names do not begin with @code{.gnu.c++.}, or are not the string
33851 section is significant and must not be altered.