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 -Wno-deprecated-array-compare @gol
253 -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
254 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol
255 -Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base @gol
256 -Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
257 -Winvalid-imported-macros @gol
258 -Wno-invalid-offsetof -Wno-literal-suffix @gol
259 -Wmismatched-new-delete -Wmismatched-tags @gol
260 -Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
261 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol
262 -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol
263 -Wrange-loop-construct -Wredundant-move -Wredundant-tags @gol
264 -Wreorder -Wregister @gol
265 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol
266 -Wno-non-template-friend -Wold-style-cast @gol
267 -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol
268 -Wsized-deallocation -Wsuggest-final-methods @gol
269 -Wsuggest-final-types -Wsuggest-override @gol
270 -Wno-terminate -Wuseless-cast -Wno-vexing-parse @gol
271 -Wvirtual-inheritance @gol
272 -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
274 @item Objective-C and Objective-C++ Language Options
275 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
276 Objective-C and Objective-C++ Dialects}.
277 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
278 -fgnu-runtime -fnext-runtime @gol
279 -fno-nil-receivers @gol
280 -fobjc-abi-version=@var{n} @gol
281 -fobjc-call-cxx-cdtors @gol
282 -fobjc-direct-dispatch @gol
283 -fobjc-exceptions @gol
286 -fobjc-std=objc1 @gol
287 -fno-local-ivars @gol
288 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
289 -freplace-objc-classes @gol
292 -Wassign-intercept -Wno-property-assign-default @gol
293 -Wno-protocol -Wobjc-root-class -Wselector @gol
294 -Wstrict-selector-match @gol
295 -Wundeclared-selector}
297 @item Diagnostic Message Formatting Options
298 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
299 @gccoptlist{-fmessage-length=@var{n} @gol
300 -fdiagnostics-plain-output @gol
301 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
302 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
303 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
304 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
305 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
306 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
307 -fno-diagnostics-show-cwe @gol
308 -fdiagnostics-minimum-margin-width=@var{width} @gol
309 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
310 -fdiagnostics-show-template-tree -fno-elide-type @gol
311 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
312 -fdiagnostics-show-path-depths @gol
313 -fno-show-column @gol
314 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol
315 -fdiagnostics-column-origin=@var{origin} @gol
316 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}}
318 @item Warning Options
319 @xref{Warning Options,,Options to Request or Suppress Warnings}.
320 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
321 -pedantic-errors @gol
322 -w -Wextra -Wall -Wabi=@var{n} @gol
323 -Waddress -Wno-address-of-packed-member -Waggregate-return @gol
324 -Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol
325 -Walloca -Walloca-larger-than=@var{byte-size} @gol
326 -Wno-aggressive-loop-optimizations @gol
327 -Warith-conversion @gol
328 -Warray-bounds -Warray-bounds=@var{n} -Warray-compare @gol
329 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
330 -Wno-attribute-warning @gol
331 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]} @gol
332 -Wbool-compare -Wbool-operation @gol
333 -Wno-builtin-declaration-mismatch @gol
334 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
335 -Wc11-c2x-compat @gol
336 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
338 -Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions @gol
339 -Wno-c++20-extensions -Wno-c++23-extensions @gol
340 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
341 -Wchar-subscripts @gol
342 -Wclobbered -Wcomment @gol
343 -Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
344 -Wdangling-else -Wdate-time @gol
345 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
346 -Wdisabled-optimization @gol
347 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
348 -Wno-div-by-zero -Wdouble-promotion @gol
349 -Wduplicated-branches -Wduplicated-cond @gol
350 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol
351 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol
352 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol
353 -Wno-format-contains-nul -Wno-format-extra-args @gol
354 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
355 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
356 -Wformat-y2k -Wframe-address @gol
357 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
358 -Wno-if-not-aligned -Wno-ignored-attributes @gol
359 -Wignored-qualifiers -Wno-incompatible-pointer-types @gol
360 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
361 -Wno-implicit-function-declaration -Wno-implicit-int @gol
362 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
363 -Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol
364 -Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol
365 -Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol
366 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol
367 -Wmemset-elt-size -Wmemset-transposed-args @gol
368 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
369 -Wmissing-field-initializers -Wmissing-format-attribute @gol
370 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol
371 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
372 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
373 -Wnull-dereference -Wno-odr @gol
374 -Wopenacc-parallelism @gol
376 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol
377 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
378 -Wparentheses -Wno-pedantic-ms-format @gol
379 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
380 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
381 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
382 -Wno-scalar-storage-order -Wsequence-point @gol
383 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
384 -Wno-shadow-ivar @gol
385 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol
386 -Wno-shift-overflow -Wshift-overflow=@var{n} @gol
387 -Wsign-compare -Wsign-conversion @gol
388 -Wno-sizeof-array-argument @gol
389 -Wsizeof-array-div @gol
390 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
391 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
392 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
393 -Wstring-compare @gol
394 -Wno-stringop-overflow -Wno-stringop-overread @gol
395 -Wno-stringop-truncation @gol
396 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
397 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol
398 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol
399 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
400 -Wtsan -Wtype-limits -Wundef @gol
401 -Wuninitialized -Wunknown-pragmas @gol
402 -Wunsuffixed-float-constants -Wunused @gol
403 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
404 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
405 -Wunused-function -Wunused-label -Wunused-local-typedefs @gol
407 -Wunused-parameter -Wno-unused-result @gol
408 -Wunused-value -Wunused-variable @gol
409 -Wno-varargs -Wvariadic-macros @gol
410 -Wvector-operation-performance @gol
411 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol
412 -Wvolatile-register-var -Wwrite-strings @gol
413 -Wzero-length-bounds}
415 @item Static Analyzer Options
418 -fanalyzer-call-summaries @gol
419 -fanalyzer-checker=@var{name} @gol
420 -fno-analyzer-feasibility @gol
421 -fanalyzer-fine-grained @gol
422 -fanalyzer-state-merge @gol
423 -fanalyzer-state-purge @gol
424 -fanalyzer-transitivity @gol
425 -fanalyzer-verbose-edges @gol
426 -fanalyzer-verbose-state-changes @gol
427 -fanalyzer-verbosity=@var{level} @gol
429 -fdump-analyzer-stderr @gol
430 -fdump-analyzer-callgraph @gol
431 -fdump-analyzer-exploded-graph @gol
432 -fdump-analyzer-exploded-nodes @gol
433 -fdump-analyzer-exploded-nodes-2 @gol
434 -fdump-analyzer-exploded-nodes-3 @gol
435 -fdump-analyzer-exploded-paths @gol
436 -fdump-analyzer-feasibility @gol
437 -fdump-analyzer-json @gol
438 -fdump-analyzer-state-purge @gol
439 -fdump-analyzer-supergraph @gol
440 -Wno-analyzer-double-fclose @gol
441 -Wno-analyzer-double-free @gol
442 -Wno-analyzer-exposure-through-output-file @gol
443 -Wno-analyzer-file-leak @gol
444 -Wno-analyzer-free-of-non-heap @gol
445 -Wno-analyzer-malloc-leak @gol
446 -Wno-analyzer-mismatching-deallocation @gol
447 -Wno-analyzer-null-argument @gol
448 -Wno-analyzer-null-dereference @gol
449 -Wno-analyzer-possible-null-argument @gol
450 -Wno-analyzer-possible-null-dereference @gol
451 -Wno-analyzer-shift-count-negative @gol
452 -Wno-analyzer-shift-count-overflow @gol
453 -Wno-analyzer-stale-setjmp-buffer @gol
454 -Wno-analyzer-tainted-allocation-size @gol
455 -Wno-analyzer-tainted-array-index @gol
456 -Wno-analyzer-tainted-divisor @gol
457 -Wno-analyzer-tainted-offset @gol
458 -Wno-analyzer-tainted-size @gol
459 -Wanalyzer-too-complex @gol
460 -Wno-analyzer-unsafe-call-within-signal-handler @gol
461 -Wno-analyzer-use-after-free @gol
462 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
463 -Wno-analyzer-use-of-uninitialized-value @gol
464 -Wno-analyzer-write-to-const @gol
465 -Wno-analyzer-write-to-string-literal @gol
468 @item C and Objective-C-only Warning Options
469 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
470 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
471 -Wold-style-declaration -Wold-style-definition @gol
472 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
473 -Wdeclaration-after-statement -Wpointer-sign}
475 @item Debugging Options
476 @xref{Debugging Options,,Options for Debugging Your Program}.
477 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
478 -gbtf -gctf -gctf@var{level} @gol
479 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
480 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
481 -gas-loc-support -gno-as-loc-support @gol
482 -gas-locview-support -gno-as-locview-support @gol
483 -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64 @gol
484 -gstatement-frontiers -gno-statement-frontiers @gol
485 -gvariable-location-views -gno-variable-location-views @gol
486 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
487 -ginline-points -gno-inline-points @gol
488 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
489 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
490 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
491 -fno-eliminate-unused-debug-types @gol
492 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
493 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
494 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
495 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
496 -fvar-tracking -fvar-tracking-assignments}
498 @item Optimization Options
499 @xref{Optimize Options,,Options that Control Optimization}.
500 @gccoptlist{-faggressive-loop-optimizations @gol
501 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
502 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
503 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
504 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
505 -fno-allocation-dce -fallow-store-data-races @gol
506 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
507 -fauto-inc-dec -fbranch-probabilities @gol
509 -fcombine-stack-adjustments -fconserve-stack @gol
510 -fcompare-elim -fcprop-registers -fcrossjumping @gol
511 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
512 -fcx-limited-range @gol
513 -fdata-sections -fdce -fdelayed-branch @gol
514 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
515 -fdevirtualize-at-ltrans -fdse @gol
516 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
517 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
519 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
520 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
521 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
522 -fif-conversion2 -findirect-inlining @gol
523 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
524 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone @gol
525 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
526 -fipa-reference -fipa-reference-addressable @gol
527 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
528 -flive-patching=@var{level} @gol
529 -fira-region=@var{region} -fira-hoist-pressure @gol
530 -fira-loop-pressure -fno-ira-share-save-slots @gol
531 -fno-ira-share-spill-slots @gol
532 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
533 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
534 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
535 -floop-block -floop-interchange -floop-strip-mine @gol
536 -floop-unroll-and-jam -floop-nest-optimize @gol
537 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
538 -flto-partition=@var{alg} -fmerge-all-constants @gol
539 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
540 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg @gol
541 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
542 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
543 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
544 -fno-sched-spec -fno-signed-zeros @gol
545 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
546 -fomit-frame-pointer -foptimize-sibling-calls @gol
547 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
548 -fprefetch-loop-arrays @gol
549 -fprofile-correction @gol
550 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol
551 -fprofile-values -fprofile-reorder-functions @gol
552 -freciprocal-math -free -frename-registers -freorder-blocks @gol
553 -freorder-blocks-algorithm=@var{algorithm} @gol
554 -freorder-blocks-and-partition -freorder-functions @gol
555 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
556 -frounding-math -fsave-optimization-record @gol
557 -fsched2-use-superblocks -fsched-pressure @gol
558 -fsched-spec-load -fsched-spec-load-dangerous @gol
559 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
560 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
561 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
562 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
563 -fschedule-fusion @gol
564 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
565 -fselective-scheduling -fselective-scheduling2 @gol
566 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
567 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
568 -fsignaling-nans @gol
569 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
571 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
572 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
573 -fthread-jumps -ftracer -ftree-bit-ccp @gol
574 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
575 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
576 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
577 -ftree-loop-if-convert -ftree-loop-im @gol
578 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
579 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
580 -ftree-loop-vectorize @gol
581 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
582 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
583 -ftree-switch-conversion -ftree-tail-merge @gol
584 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init @gol
585 -funconstrained-commons -funit-at-a-time -funroll-all-loops @gol
586 -funroll-loops -funsafe-math-optimizations -funswitch-loops @gol
587 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
588 -fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs @gol
589 --param @var{name}=@var{value}
590 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
592 @item Program Instrumentation Options
593 @xref{Instrumentation Options,,Program Instrumentation Options}.
594 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
595 -fprofile-abs-path @gol
596 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
597 -fprofile-info-section -fprofile-info-section=@var{name} @gol
598 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
599 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
600 -fprofile-exclude-files=@var{regex} @gol
601 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol
602 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
603 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
604 -fsanitize-undefined-trap-on-error -fbounds-check @gol
605 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
606 -fharden-compares -fharden-conditional-branches @gol
607 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
608 -fstack-protector-explicit -fstack-check @gol
609 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
610 -fno-stack-limit -fsplit-stack @gol
611 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
612 -fvtv-counts -fvtv-debug @gol
613 -finstrument-functions @gol
614 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
615 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
617 @item Preprocessor Options
618 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
619 @gccoptlist{-A@var{question}=@var{answer} @gol
620 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
621 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
622 -dD -dI -dM -dN -dU @gol
623 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
624 -fexec-charset=@var{charset} -fextended-identifiers @gol
625 -finput-charset=@var{charset} -flarge-source-files @gol
626 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
627 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
628 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
629 -fwide-exec-charset=@var{charset} -fworking-directory @gol
630 -H -imacros @var{file} -include @var{file} @gol
631 -M -MD -MF -MG -MM -MMD -MP -MQ -MT -Mno-modules @gol
632 -no-integrated-cpp -P -pthread -remap @gol
633 -traditional -traditional-cpp -trigraphs @gol
634 -U@var{macro} -undef @gol
635 -Wp,@var{option} -Xpreprocessor @var{option}}
637 @item Assembler Options
638 @xref{Assembler Options,,Passing Options to the Assembler}.
639 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
642 @xref{Link Options,,Options for Linking}.
643 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
644 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
645 -e @var{entry} --entry=@var{entry} @gol
646 -pie -pthread -r -rdynamic @gol
647 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
648 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
649 -shared -shared-libgcc -symbolic @gol
650 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
651 -u @var{symbol} -z @var{keyword}}
653 @item Directory Options
654 @xref{Directory Options,,Options for Directory Search}.
655 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
656 -idirafter @var{dir} @gol
657 -imacros @var{file} -imultilib @var{dir} @gol
658 -iplugindir=@var{dir} -iprefix @var{file} @gol
659 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
660 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
661 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
662 -nostdinc -nostdinc++ --sysroot=@var{dir}}
664 @item Code Generation Options
665 @xref{Code Gen Options,,Options for Code Generation Conventions}.
666 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
667 -ffixed-@var{reg} -fexceptions @gol
668 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
669 -fasynchronous-unwind-tables @gol
671 -finhibit-size-directive -fcommon -fno-ident @gol
672 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
673 -fno-jump-tables -fno-bit-tests @gol
674 -frecord-gcc-switches @gol
675 -freg-struct-return -fshort-enums -fshort-wchar @gol
676 -fverbose-asm -fpack-struct[=@var{n}] @gol
677 -fleading-underscore -ftls-model=@var{model} @gol
678 -fstack-reuse=@var{reuse_level} @gol
679 -ftrampolines -ftrapv -fwrapv @gol
680 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
681 -fstrict-volatile-bitfields -fsync-libcalls}
683 @item Developer Options
684 @xref{Developer Options,,GCC Developer Options}.
685 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
686 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
687 -fchecking -fchecking=@var{n}
688 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
689 -fdisable-ipa-@var{pass_name} @gol
690 -fdisable-rtl-@var{pass_name} @gol
691 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
692 -fdisable-tree-@var{pass_name} @gol
693 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
694 -fdump-debug -fdump-earlydebug @gol
695 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
696 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
697 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
699 -fdump-lang-@var{switch} @gol
700 -fdump-lang-@var{switch}-@var{options} @gol
701 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
703 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
704 -fdump-statistics @gol
706 -fdump-tree-@var{switch} @gol
707 -fdump-tree-@var{switch}-@var{options} @gol
708 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
709 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
710 -fenable-@var{kind}-@var{pass} @gol
711 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
712 -fira-verbose=@var{n} @gol
713 -flto-report -flto-report-wpa -fmem-report-wpa @gol
714 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
715 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
716 -fprofile-report @gol
717 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
718 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
719 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
720 -fvar-tracking-assignments-toggle -gtoggle @gol
721 -print-file-name=@var{library} -print-libgcc-file-name @gol
722 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
723 -print-prog-name=@var{program} -print-search-dirs -Q @gol
724 -print-sysroot -print-sysroot-headers-suffix @gol
725 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
727 @item Machine-Dependent Options
728 @xref{Submodel Options,,Machine-Dependent Options}.
729 @c This list is ordered alphanumerically by subsection name.
730 @c Try and put the significant identifier (CPU or system) first,
731 @c so users have a clue at guessing where the ones they want will be.
733 @emph{AArch64 Options}
734 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
735 -mgeneral-regs-only @gol
736 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
737 -mstrict-align -mno-strict-align @gol
738 -momit-leaf-frame-pointer @gol
739 -mtls-dialect=desc -mtls-dialect=traditional @gol
740 -mtls-size=@var{size} @gol
741 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
742 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
743 -mpc-relative-literal-loads @gol
744 -msign-return-address=@var{scope} @gol
745 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
746 +@var{b-key}]|@var{bti} @gol
747 -mharden-sls=@var{opts} @gol
748 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
749 -moverride=@var{string} -mverbose-cost-dump @gol
750 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
751 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
754 @emph{Adapteva Epiphany Options}
755 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
756 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
757 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
758 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
759 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
760 -msplit-vecmove-early -m1reg-@var{reg}}
762 @emph{AMD GCN Options}
763 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
766 @gccoptlist{-mbarrel-shifter -mjli-always @gol
767 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
768 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
769 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
770 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
771 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
772 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
773 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
774 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
775 -mvolatile-cache -mtp-regno=@var{regno} @gol
776 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
777 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
778 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
779 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
780 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
781 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
782 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
783 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
786 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
787 -mabi=@var{name} @gol
788 -mapcs-stack-check -mno-apcs-stack-check @gol
789 -mapcs-reentrant -mno-apcs-reentrant @gol
790 -mgeneral-regs-only @gol
791 -msched-prolog -mno-sched-prolog @gol
792 -mlittle-endian -mbig-endian @gol
794 -mfloat-abi=@var{name} @gol
795 -mfp16-format=@var{name}
796 -mthumb-interwork -mno-thumb-interwork @gol
797 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
798 -mtune=@var{name} -mprint-tune-info @gol
799 -mstructure-size-boundary=@var{n} @gol
800 -mabort-on-noreturn @gol
801 -mlong-calls -mno-long-calls @gol
802 -msingle-pic-base -mno-single-pic-base @gol
803 -mpic-register=@var{reg} @gol
804 -mnop-fun-dllimport @gol
805 -mpoke-function-name @gol
806 -mthumb -marm -mflip-thumb @gol
807 -mtpcs-frame -mtpcs-leaf-frame @gol
808 -mcaller-super-interworking -mcallee-super-interworking @gol
809 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
810 -mword-relocations @gol
811 -mfix-cortex-m3-ldrd @gol
812 -munaligned-access @gol
813 -mneon-for-64bits @gol
814 -mslow-flash-data @gol
815 -masm-syntax-unified @gol
817 -mverbose-cost-dump @gol
820 -mfix-cmse-cve-2021-35465 @gol
824 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
825 -mbranch-cost=@var{cost} @gol
826 -mcall-prologues -mgas-isr-prologues -mint8 @gol
827 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
828 -mn_flash=@var{size} -mno-interrupts @gol
829 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
830 -mfract-convert-truncate @gol
831 -mshort-calls -nodevicelib -nodevicespecs @gol
832 -Waddr-space-convert -Wmisspelled-isr}
834 @emph{Blackfin Options}
835 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
836 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
837 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
838 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
839 -mno-id-shared-library -mshared-library-id=@var{n} @gol
840 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
841 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
842 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
846 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
847 -msim -msdata=@var{sdata-type}}
850 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
851 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
852 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
853 -mstack-align -mdata-align -mconst-align @gol
854 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
855 -melf -maout -melinux -mlinux -sim -sim2 @gol
856 -mmul-bug-workaround -mno-mul-bug-workaround}
859 @gccoptlist{-mmac @gol
860 -mcr16cplus -mcr16c @gol
861 -msim -mint32 -mbit-ops
862 -mdata-model=@var{model}}
865 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
866 -mbig-endian -EB -mlittle-endian -EL @gol
867 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
868 -mfloat-abi=@var{name} @gol
869 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
870 -mdsp -medsp -mvdsp @gol
871 -mdiv -msmart -mhigh-registers -manchor @gol
872 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
873 -mbranch-cost=@var{n} -mcse-cc -msched-prolog -msim}
875 @emph{Darwin Options}
876 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
877 -arch_only -bind_at_load -bundle -bundle_loader @gol
878 -client_name -compatibility_version -current_version @gol
880 -dependency-file -dylib_file -dylinker_install_name @gol
881 -dynamic -dynamiclib -exported_symbols_list @gol
882 -filelist -flat_namespace -force_cpusubtype_ALL @gol
883 -force_flat_namespace -headerpad_max_install_names @gol
885 -image_base -init -install_name -keep_private_externs @gol
886 -multi_module -multiply_defined -multiply_defined_unused @gol
887 -noall_load -no_dead_strip_inits_and_terms @gol
888 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
889 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
890 -private_bundle -read_only_relocs -sectalign @gol
891 -sectobjectsymbols -whyload -seg1addr @gol
892 -sectcreate -sectobjectsymbols -sectorder @gol
893 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
894 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
895 -segprot -segs_read_only_addr -segs_read_write_addr @gol
896 -single_module -static -sub_library -sub_umbrella @gol
897 -twolevel_namespace -umbrella -undefined @gol
898 -unexported_symbols_list -weak_reference_mismatches @gol
899 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
900 -mkernel -mone-byte-bool}
902 @emph{DEC Alpha Options}
903 @gccoptlist{-mno-fp-regs -msoft-float @gol
904 -mieee -mieee-with-inexact -mieee-conformant @gol
905 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
906 -mtrap-precision=@var{mode} -mbuild-constants @gol
907 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
908 -mbwx -mmax -mfix -mcix @gol
909 -mfloat-vax -mfloat-ieee @gol
910 -mexplicit-relocs -msmall-data -mlarge-data @gol
911 -msmall-text -mlarge-text @gol
912 -mmemory-latency=@var{time}}
915 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
916 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re
917 -mjmpext -mjmp32 -malu32 -mcpu=@var{version}}
920 @gccoptlist{-msmall-model -mno-lsim}
923 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
926 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
927 -mhard-float -msoft-float @gol
928 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
929 -mdouble -mno-double @gol
930 -mmedia -mno-media -mmuladd -mno-muladd @gol
931 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
932 -mlinked-fp -mlong-calls -malign-labels @gol
933 -mlibrary-pic -macc-4 -macc-8 @gol
934 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
935 -moptimize-membar -mno-optimize-membar @gol
936 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
937 -mvliw-branch -mno-vliw-branch @gol
938 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
939 -mno-nested-cond-exec -mtomcat-stats @gol
943 @emph{GNU/Linux Options}
944 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
945 -tno-android-cc -tno-android-ld}
947 @emph{H8/300 Options}
948 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
951 @gccoptlist{-march=@var{architecture-type} @gol
952 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
953 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
954 -mfixed-range=@var{register-range} @gol
955 -mjump-in-delay -mlinker-opt -mlong-calls @gol
956 -mlong-load-store -mno-disable-fpregs @gol
957 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
958 -mno-jump-in-delay -mno-long-load-store @gol
959 -mno-portable-runtime -mno-soft-float @gol
960 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
961 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
962 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
963 -munix=@var{unix-std} -nolibdld -static -threads}
966 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
967 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
968 -mconstant-gp -mauto-pic -mfused-madd @gol
969 -minline-float-divide-min-latency @gol
970 -minline-float-divide-max-throughput @gol
971 -mno-inline-float-divide @gol
972 -minline-int-divide-min-latency @gol
973 -minline-int-divide-max-throughput @gol
974 -mno-inline-int-divide @gol
975 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
976 -mno-inline-sqrt @gol
977 -mdwarf2-asm -mearly-stop-bits @gol
978 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
979 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
980 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
981 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
982 -msched-spec-ldc -msched-spec-control-ldc @gol
983 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
984 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
985 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
986 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
989 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
990 -msign-extend-enabled -muser-enabled}
992 @emph{M32R/D Options}
993 @gccoptlist{-m32r2 -m32rx -m32r @gol
995 -malign-loops -mno-align-loops @gol
996 -missue-rate=@var{number} @gol
997 -mbranch-cost=@var{number} @gol
998 -mmodel=@var{code-size-model-type} @gol
999 -msdata=@var{sdata-type} @gol
1000 -mno-flush-func -mflush-func=@var{name} @gol
1001 -mno-flush-trap -mflush-trap=@var{number} @gol
1005 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
1007 @emph{M680x0 Options}
1008 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
1009 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
1010 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
1011 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
1012 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
1013 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
1014 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
1015 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
1016 -mxgot -mno-xgot -mlong-jump-table-offsets}
1018 @emph{MCore Options}
1019 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
1020 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
1021 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
1022 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
1023 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
1026 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
1027 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
1028 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
1029 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
1032 @emph{MicroBlaze Options}
1033 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
1034 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
1035 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
1036 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
1037 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
1038 -mpic-data-is-text-relative}
1041 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
1042 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
1043 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
1044 -mips16 -mno-mips16 -mflip-mips16 @gol
1045 -minterlink-compressed -mno-interlink-compressed @gol
1046 -minterlink-mips16 -mno-interlink-mips16 @gol
1047 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
1048 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
1049 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
1050 -mno-float -msingle-float -mdouble-float @gol
1051 -modd-spreg -mno-odd-spreg @gol
1052 -mabs=@var{mode} -mnan=@var{encoding} @gol
1053 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1054 -mmcu -mmno-mcu @gol
1056 -mvirt -mno-virt @gol
1059 -mginv -mno-ginv @gol
1060 -mmicromips -mno-micromips @gol
1062 -mloongson-mmi -mno-loongson-mmi @gol
1063 -mloongson-ext -mno-loongson-ext @gol
1064 -mloongson-ext2 -mno-loongson-ext2 @gol
1065 -mfpu=@var{fpu-type} @gol
1066 -msmartmips -mno-smartmips @gol
1067 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1068 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1069 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1070 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1071 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1072 -membedded-data -mno-embedded-data @gol
1073 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1074 -mcode-readable=@var{setting} @gol
1075 -msplit-addresses -mno-split-addresses @gol
1076 -mexplicit-relocs -mno-explicit-relocs @gol
1077 -mcheck-zero-division -mno-check-zero-division @gol
1078 -mdivide-traps -mdivide-breaks @gol
1079 -mload-store-pairs -mno-load-store-pairs @gol
1080 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1081 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1082 -mfix-24k -mno-fix-24k @gol
1083 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1084 -mfix-r5900 -mno-fix-r5900 @gol
1085 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1086 -mfix-vr4120 -mno-fix-vr4120 @gol
1087 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1088 -mflush-func=@var{func} -mno-flush-func @gol
1089 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1090 -mcompact-branches=@var{policy} @gol
1091 -mfp-exceptions -mno-fp-exceptions @gol
1092 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1093 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1094 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1095 -mframe-header-opt -mno-frame-header-opt}
1098 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1099 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1100 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1101 -mno-base-addresses -msingle-exit -mno-single-exit}
1103 @emph{MN10300 Options}
1104 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1105 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1106 -mtune=@var{cpu-type} @gol
1107 -mreturn-pointer-on-d0 @gol
1108 -mno-crt0 -mrelax -mliw -msetlb}
1110 @emph{Moxie Options}
1111 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1113 @emph{MSP430 Options}
1114 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1116 -mcode-region= -mdata-region= @gol
1117 -msilicon-errata= -msilicon-errata-warn= @gol
1118 -mhwmult= -minrt -mtiny-printf -mmax-inline-shift=}
1120 @emph{NDS32 Options}
1121 @gccoptlist{-mbig-endian -mlittle-endian @gol
1122 -mreduced-regs -mfull-regs @gol
1123 -mcmov -mno-cmov @gol
1124 -mext-perf -mno-ext-perf @gol
1125 -mext-perf2 -mno-ext-perf2 @gol
1126 -mext-string -mno-ext-string @gol
1127 -mv3push -mno-v3push @gol
1128 -m16bit -mno-16bit @gol
1129 -misr-vector-size=@var{num} @gol
1130 -mcache-block-size=@var{num} @gol
1131 -march=@var{arch} @gol
1132 -mcmodel=@var{code-model} @gol
1133 -mctor-dtor -mrelax}
1135 @emph{Nios II Options}
1136 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1137 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1139 -mno-bypass-cache -mbypass-cache @gol
1140 -mno-cache-volatile -mcache-volatile @gol
1141 -mno-fast-sw-div -mfast-sw-div @gol
1142 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1143 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1144 -mcustom-fpu-cfg=@var{name} @gol
1145 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1146 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1148 @emph{Nvidia PTX Options}
1149 @gccoptlist{-m64 -mmainkernel -moptimize}
1151 @emph{OpenRISC Options}
1152 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1153 -msoft-mul -msoft-div @gol
1154 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1155 -mcmov -mror -mrori -msext -msfimm -mshftimm @gol
1156 -mcmodel=@var{code-model}}
1158 @emph{PDP-11 Options}
1159 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1160 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1161 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1163 @emph{picoChip Options}
1164 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1165 -msymbol-as-address -mno-inefficient-warnings}
1167 @emph{PowerPC Options}
1168 See RS/6000 and PowerPC Options.
1171 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1172 -mabi=@var{variant} @gol}
1174 @emph{RISC-V Options}
1175 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1177 -mabi=@var{ABI-string} @gol
1178 -mfdiv -mno-fdiv @gol
1180 -march=@var{ISA-string} @gol
1181 -mtune=@var{processor-string} @gol
1182 -mpreferred-stack-boundary=@var{num} @gol
1183 -msmall-data-limit=@var{N-bytes} @gol
1184 -msave-restore -mno-save-restore @gol
1185 -mshorten-memrefs -mno-shorten-memrefs @gol
1186 -mstrict-align -mno-strict-align @gol
1187 -mcmodel=medlow -mcmodel=medany @gol
1188 -mexplicit-relocs -mno-explicit-relocs @gol
1189 -mrelax -mno-relax @gol
1190 -mriscv-attribute -mmo-riscv-attribute @gol
1191 -malign-data=@var{type} @gol
1192 -mbig-endian -mlittle-endian @gol
1193 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1194 -mstack-protector-guard-offset=@var{offset}}
1197 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1198 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1199 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1201 @emph{RS/6000 and PowerPC Options}
1202 @gccoptlist{-mcpu=@var{cpu-type} @gol
1203 -mtune=@var{cpu-type} @gol
1204 -mcmodel=@var{code-model} @gol
1206 -maltivec -mno-altivec @gol
1207 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1208 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1209 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1210 -mfprnd -mno-fprnd @gol
1211 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1212 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1213 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1214 -malign-power -malign-natural @gol
1215 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1216 -mupdate -mno-update @gol
1217 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1218 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1219 -mstrict-align -mno-strict-align -mrelocatable @gol
1220 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1221 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1222 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1223 -mprioritize-restricted-insns=@var{priority} @gol
1224 -msched-costly-dep=@var{dependence_type} @gol
1225 -minsert-sched-nops=@var{scheme} @gol
1226 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1227 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1228 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1229 -mtraceback=@var{traceback_type} @gol
1230 -maix-struct-return -msvr4-struct-return @gol
1231 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1232 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1233 -mblock-move-inline-limit=@var{num} @gol
1234 -mblock-compare-inline-limit=@var{num} @gol
1235 -mblock-compare-inline-loop-limit=@var{num} @gol
1236 -mno-block-ops-unaligned-vsx @gol
1237 -mstring-compare-inline-limit=@var{num} @gol
1238 -misel -mno-isel @gol
1239 -mvrsave -mno-vrsave @gol
1240 -mmulhw -mno-mulhw @gol
1241 -mdlmzb -mno-dlmzb @gol
1242 -mprototype -mno-prototype @gol
1243 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1244 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1245 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1246 -mno-recip-precision @gol
1247 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1248 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1249 -msave-toc-indirect -mno-save-toc-indirect @gol
1250 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1251 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1252 -mquad-memory -mno-quad-memory @gol
1253 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1254 -mcompat-align-parm -mno-compat-align-parm @gol
1255 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1256 -mgnu-attribute -mno-gnu-attribute @gol
1257 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1258 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1259 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol
1260 -mprivileged -mno-privileged}
1263 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1265 -mbig-endian-data -mlittle-endian-data @gol
1268 -mas100-syntax -mno-as100-syntax@gol
1270 -mmax-constant-size=@gol
1273 -mallow-string-insns -mno-allow-string-insns@gol
1275 -mno-warn-multiple-fast-interrupts@gol
1276 -msave-acc-in-interrupts}
1278 @emph{S/390 and zSeries Options}
1279 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1280 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1281 -mlong-double-64 -mlong-double-128 @gol
1282 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1283 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1284 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1285 -mhtm -mvx -mzvector @gol
1286 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1287 -mfused-madd -mno-fused-madd @gol
1288 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1289 -mhotpatch=@var{halfwords},@var{halfwords}}
1291 @emph{Score Options}
1292 @gccoptlist{-meb -mel @gol
1296 -mscore5 -mscore5u -mscore7 -mscore7d}
1299 @gccoptlist{-m1 -m2 -m2e @gol
1300 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1302 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1303 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1304 -mb -ml -mdalign -mrelax @gol
1305 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1306 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1307 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1308 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1309 -maccumulate-outgoing-args @gol
1310 -matomic-model=@var{atomic-model} @gol
1311 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1312 -mcbranch-force-delay-slot @gol
1313 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1314 -mpretend-cmove -mtas}
1316 @emph{Solaris 2 Options}
1317 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1320 @emph{SPARC Options}
1321 @gccoptlist{-mcpu=@var{cpu-type} @gol
1322 -mtune=@var{cpu-type} @gol
1323 -mcmodel=@var{code-model} @gol
1324 -mmemory-model=@var{mem-model} @gol
1325 -m32 -m64 -mapp-regs -mno-app-regs @gol
1326 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1327 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1328 -mhard-quad-float -msoft-quad-float @gol
1329 -mstack-bias -mno-stack-bias @gol
1330 -mstd-struct-return -mno-std-struct-return @gol
1331 -munaligned-doubles -mno-unaligned-doubles @gol
1332 -muser-mode -mno-user-mode @gol
1333 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1334 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1335 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1336 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1337 -mpopc -mno-popc -msubxc -mno-subxc @gol
1338 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1341 @emph{System V Options}
1342 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1344 @emph{TILE-Gx Options}
1345 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1346 -mcmodel=@var{code-model}}
1348 @emph{TILEPro Options}
1349 @gccoptlist{-mcpu=@var{cpu} -m32}
1352 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1353 -mprolog-function -mno-prolog-function -mspace @gol
1354 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1355 -mapp-regs -mno-app-regs @gol
1356 -mdisable-callt -mno-disable-callt @gol
1357 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1358 -mv850e -mv850 -mv850e3v5 @gol
1369 @gccoptlist{-mg -mgnu -munix -mlra}
1371 @emph{Visium Options}
1372 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1373 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1376 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1377 -mpointer-size=@var{size}}
1379 @emph{VxWorks Options}
1380 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1381 -Xbind-lazy -Xbind-now}
1384 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1385 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1386 -mfpmath=@var{unit} @gol
1387 -masm=@var{dialect} -mno-fancy-math-387 @gol
1388 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1389 -mno-wide-multiply -mrtd -malign-double @gol
1390 -mpreferred-stack-boundary=@var{num} @gol
1391 -mincoming-stack-boundary=@var{num} @gol
1392 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mmwait @gol
1393 -mrecip -mrecip=@var{opt} @gol
1394 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1395 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1396 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1397 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1398 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1399 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1400 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1401 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1402 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1403 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1404 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1405 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1406 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1407 -mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni@gol
1409 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1410 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1412 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1413 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1414 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1415 -mregparm=@var{num} -msseregparm @gol
1416 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1417 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1418 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1419 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1420 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1421 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1422 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1423 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1424 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1425 -mstack-protector-guard-reg=@var{reg} @gol
1426 -mstack-protector-guard-offset=@var{offset} @gol
1427 -mstack-protector-guard-symbol=@var{symbol} @gol
1428 -mgeneral-regs-only -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop @gol
1429 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1430 -mindirect-branch-register -mharden-sls=@var{choice} @gol
1431 -mindirect-branch-cs-prefix -mneeded}
1433 @emph{x86 Windows Options}
1434 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1435 -mnop-fun-dllimport -mthread @gol
1436 -municode -mwin32 -mwindows -fno-set-stack-executable}
1438 @emph{Xstormy16 Options}
1441 @emph{Xtensa Options}
1442 @gccoptlist{-mconst16 -mno-const16 @gol
1443 -mfused-madd -mno-fused-madd @gol
1445 -mserialize-volatile -mno-serialize-volatile @gol
1446 -mtext-section-literals -mno-text-section-literals @gol
1447 -mauto-litpools -mno-auto-litpools @gol
1448 -mtarget-align -mno-target-align @gol
1449 -mlongcalls -mno-longcalls @gol
1450 -mabi=@var{abi-type}}
1452 @emph{zSeries Options}
1453 See S/390 and zSeries Options.
1457 @node Overall Options
1458 @section Options Controlling the Kind of Output
1460 Compilation can involve up to four stages: preprocessing, compilation
1461 proper, assembly and linking, always in that order. GCC is capable of
1462 preprocessing and compiling several files either into several
1463 assembler input files, or into one assembler input file; then each
1464 assembler input file produces an object file, and linking combines all
1465 the object files (those newly compiled, and those specified as input)
1466 into an executable file.
1468 @cindex file name suffix
1469 For any given input file, the file name suffix determines what kind of
1470 compilation is done:
1474 C source code that must be preprocessed.
1477 C source code that should not be preprocessed.
1480 C++ source code that should not be preprocessed.
1483 Objective-C source code. Note that you must link with the @file{libobjc}
1484 library to make an Objective-C program work.
1487 Objective-C source code that should not be preprocessed.
1491 Objective-C++ source code. Note that you must link with the @file{libobjc}
1492 library to make an Objective-C++ program work. Note that @samp{.M} refers
1493 to a literal capital M@.
1495 @item @var{file}.mii
1496 Objective-C++ source code that should not be preprocessed.
1499 C, C++, Objective-C or Objective-C++ header file to be turned into a
1500 precompiled header (default), or C, C++ header file to be turned into an
1501 Ada spec (via the @option{-fdump-ada-spec} switch).
1504 @itemx @var{file}.cp
1505 @itemx @var{file}.cxx
1506 @itemx @var{file}.cpp
1507 @itemx @var{file}.CPP
1508 @itemx @var{file}.c++
1510 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1511 the last two letters must both be literally @samp{x}. Likewise,
1512 @samp{.C} refers to a literal capital C@.
1516 Objective-C++ source code that must be preprocessed.
1518 @item @var{file}.mii
1519 Objective-C++ source code that should not be preprocessed.
1523 @itemx @var{file}.hp
1524 @itemx @var{file}.hxx
1525 @itemx @var{file}.hpp
1526 @itemx @var{file}.HPP
1527 @itemx @var{file}.h++
1528 @itemx @var{file}.tcc
1529 C++ header file to be turned into a precompiled header or Ada spec.
1532 @itemx @var{file}.for
1533 @itemx @var{file}.ftn
1534 Fixed form Fortran source code that should not be preprocessed.
1537 @itemx @var{file}.FOR
1538 @itemx @var{file}.fpp
1539 @itemx @var{file}.FPP
1540 @itemx @var{file}.FTN
1541 Fixed form Fortran source code that must be preprocessed (with the traditional
1544 @item @var{file}.f90
1545 @itemx @var{file}.f95
1546 @itemx @var{file}.f03
1547 @itemx @var{file}.f08
1548 Free form Fortran source code that should not be preprocessed.
1550 @item @var{file}.F90
1551 @itemx @var{file}.F95
1552 @itemx @var{file}.F03
1553 @itemx @var{file}.F08
1554 Free form Fortran source code that must be preprocessed (with the
1555 traditional preprocessor).
1567 D documentation code (Ddoc).
1569 @item @var{file}.ads
1570 Ada source code file that contains a library unit declaration (a
1571 declaration of a package, subprogram, or generic, or a generic
1572 instantiation), or a library unit renaming declaration (a package,
1573 generic, or subprogram renaming declaration). Such files are also
1576 @item @var{file}.adb
1577 Ada source code file containing a library unit body (a subprogram or
1578 package body). Such files are also called @dfn{bodies}.
1580 @c GCC also knows about some suffixes for languages not yet included:
1588 @itemx @var{file}.sx
1589 Assembler code that must be preprocessed.
1592 An object file to be fed straight into linking.
1593 Any file name with no recognized suffix is treated this way.
1597 You can specify the input language explicitly with the @option{-x} option:
1600 @item -x @var{language}
1601 Specify explicitly the @var{language} for the following input files
1602 (rather than letting the compiler choose a default based on the file
1603 name suffix). This option applies to all following input files until
1604 the next @option{-x} option. Possible values for @var{language} are:
1606 c c-header cpp-output
1607 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1608 objective-c objective-c-header objective-c-cpp-output
1609 objective-c++ objective-c++-header objective-c++-cpp-output
1610 assembler assembler-with-cpp
1613 f77 f77-cpp-input f95 f95-cpp-input
1618 Turn off any specification of a language, so that subsequent files are
1619 handled according to their file name suffixes (as they are if @option{-x}
1620 has not been used at all).
1623 If you only want some of the stages of compilation, you can use
1624 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1625 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1626 @command{gcc} is to stop. Note that some combinations (for example,
1627 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1632 Compile or assemble the source files, but do not link. The linking
1633 stage simply is not done. The ultimate output is in the form of an
1634 object file for each source file.
1636 By default, the object file name for a source file is made by replacing
1637 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1639 Unrecognized input files, not requiring compilation or assembly, are
1644 Stop after the stage of compilation proper; do not assemble. The output
1645 is in the form of an assembler code file for each non-assembler input
1648 By default, the assembler file name for a source file is made by
1649 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1651 Input files that don't require compilation are ignored.
1655 Stop after the preprocessing stage; do not run the compiler proper. The
1656 output is in the form of preprocessed source code, which is sent to the
1659 Input files that don't require preprocessing are ignored.
1661 @cindex output file option
1664 Place the primary output in file @var{file}. This applies to whatever
1665 sort of output is being produced, whether it be an executable file, an
1666 object file, an assembler file or preprocessed C code.
1668 If @option{-o} is not specified, the default is to put an executable
1669 file in @file{a.out}, the object file for
1670 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1671 assembler file in @file{@var{source}.s}, a precompiled header file in
1672 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1675 Though @option{-o} names only the primary output, it also affects the
1676 naming of auxiliary and dump outputs. See the examples below. Unless
1677 overridden, both auxiliary outputs and dump outputs are placed in the
1678 same directory as the primary output. In auxiliary outputs, the suffix
1679 of the input file is replaced with that of the auxiliary output file
1680 type; in dump outputs, the suffix of the dump file is appended to the
1681 input file suffix. In compilation commands, the base name of both
1682 auxiliary and dump outputs is that of the primary output; in compile and
1683 link commands, the primary output name, minus the executable suffix, is
1684 combined with the input file name. If both share the same base name,
1685 disregarding the suffix, the result of the combination is that base
1686 name, otherwise, they are concatenated, separated by a dash.
1692 will use @file{foo.o} as the primary output, and place aux outputs and
1693 dumps next to it, e.g., aux file @file{foo.dwo} for
1694 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1695 @option{-fdump-rtl-final}.
1697 If a non-linker output file is explicitly specified, aux and dump files
1698 by default take the same base name:
1701 gcc -c foo.c -o dir/foobar.o ...
1704 will name aux outputs @file{dir/foobar.*} and dump outputs
1705 @file{dir/foobar.c.*}.
1707 A linker output will instead prefix aux and dump outputs:
1710 gcc foo.c bar.c -o dir/foobar ...
1713 will generally name aux outputs @file{dir/foobar-foo.*} and
1714 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1715 @file{dir/foobar-bar.c.*}.
1717 The one exception to the above is when the executable shares the base
1718 name with the single input:
1721 gcc foo.c -o dir/foo ...
1724 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1725 named @file{dir/foo.c.*}.
1727 The location and the names of auxiliary and dump outputs can be adjusted
1728 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1729 @option{-dumpdir}, @option{-save-temps=cwd}, and
1730 @option{-save-temps=obj}.
1733 @item -dumpbase @var{dumpbase}
1735 This option sets the base name for auxiliary and dump output files. It
1736 does not affect the name of the primary output file. Intermediate
1737 outputs, when preserved, are not regarded as primary outputs, but as
1741 gcc -save-temps -S foo.c
1744 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1745 then compiles to the (implied) output file @file{foo.s}, whereas:
1748 gcc -save-temps -dumpbase save-foo -c foo.c
1751 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1752 an intermediate, thus auxiliary output), and then assembles to the
1753 (implied) output file @file{foo.o}.
1755 Absent this option, dump and aux files take their names from the input
1756 file, or from the (non-linker) output file, if one is explicitly
1757 specified: dump output files (e.g. those requested by @option{-fdump-*}
1758 options) with the input name suffix, and aux output files (those
1759 requested by other non-dump options, e.g. @code{-save-temps},
1760 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1762 Similar suffix differentiation of dump and aux outputs can be attained
1763 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1764 @option{-dumpbase-ext .suf}.
1766 If @var{dumpbase} is explicitly specified with any directory component,
1767 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1768 @option{-save-temps=*}) is ignored, and instead of appending to it,
1769 @var{dumpbase} fully overrides it:
1772 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1773 -dumpdir pfx- -save-temps=cwd ...
1776 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1777 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1778 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1780 When @option{-dumpbase} is specified in a command that compiles multiple
1781 inputs, or that compiles and then links, it may be combined with
1782 @var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
1783 file is compiled using the combined @var{dumppfx}, and default values
1784 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1788 gcc foo.c bar.c -c -dumpbase main ...
1791 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1792 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1793 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1794 and @file{main-bar.*}.
1796 An empty string specified as @var{dumpbase} avoids the influence of the
1797 output basename in the naming of auxiliary and dump outputs during
1798 compilation, computing default values :
1801 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1804 will name aux outputs @file{dir/foo.*} and dump outputs
1805 @file{dir/foo.c.*}. Note how their basenames are taken from the input
1806 name, but the directory still defaults to that of the output.
1808 The empty-string dumpbase does not prevent the use of the output
1809 basename for outputs during linking:
1812 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1815 The compilation of the source files will name auxiliary outputs
1816 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1817 @file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
1818 linking will use @file{dir/foobar.} as the prefix for dumps and
1822 @item -dumpbase-ext @var{auxdropsuf}
1823 @opindex dumpbase-ext
1824 When forming the name of an auxiliary (but not a dump) output file, drop
1825 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1826 suffixes. If not specified, this option defaults to the suffix of a
1827 default @var{dumpbase}, i.e., the suffix of the input file when
1828 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1829 is combined with @var{dumppfx}.
1832 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1835 creates @file{dir/foo.o} as the main output, and generates auxiliary
1836 outputs in @file{dir/x-foo.*}, taking the location of the primary
1837 output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
1838 outputs retain the suffix: @file{dir/x-foo.c.*}.
1840 This option is disregarded if it does not match the suffix of a
1841 specified @var{dumpbase}, except as an alternative to the executable
1842 suffix when appending the linker output base name to @var{dumppfx}, as
1846 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1849 creates @file{main.out} as the primary output, and avoids overwriting
1850 the auxiliary and dump outputs by using the executable name minus
1851 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1852 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1853 @file{main-foo.c.*} and @file{main-bar.c.*}.
1856 @item -dumpdir @var{dumppfx}
1858 When forming the name of an auxiliary or dump output file, use
1859 @var{dumppfx} as a prefix:
1862 gcc -dumpdir pfx- -c foo.c ...
1865 creates @file{foo.o} as the primary output, and auxiliary outputs named
1866 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1867 @var{dumpbase} derived from the default primary output, derived in turn
1868 from the input name. Dump outputs also take the input name suffix:
1871 If @var{dumppfx} is to be used as a directory name, it must end with a
1872 directory separator:
1875 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1878 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1879 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1880 default @var{dumpbase} derived from the primary output name. Dump
1881 outputs also take the input name suffix: @file{dir/bar.c.*}.
1883 It defaults to the location of the output file, unless the output
1884 file is a special file like @code{/dev/null}. Options
1885 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1886 default, just like an explicit @option{-dumpdir} option. In case
1887 multiple such options are given, the last one prevails:
1890 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1893 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1894 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1895 @option{-dumpdir} option. It does not matter that @option{=obj} is the
1896 default for @option{-save-temps}, nor that the output directory is
1897 implicitly the current directory. Dump outputs are named
1900 When compiling from multiple input files, if @option{-dumpbase} is
1901 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1902 are appended to (or override, if containing any directory components) an
1903 explicit or defaulted @var{dumppfx}, so that each of the multiple
1904 compilations gets differently-named aux and dump outputs.
1907 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1910 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1911 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1912 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1913 and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
1914 single-input compilation:
1917 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1920 that, applying @option{-dumpbase} to a single source, does not compute
1921 and append a separate @var{dumpbase} per input file. Its auxiliary and
1922 dump outputs go in @file{dir/pfx-main.*}.
1924 When compiling and then linking from multiple input files, a defaulted
1925 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1926 transformation above (e.g. the compilation of @file{foo.c} and
1927 @file{bar.c} above, but without @option{-c}). If neither
1928 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1929 base name, minus @var{auxdropsuf}, if specified, or the executable
1930 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1931 instead. Note, however, that unlike earlier cases of linking:
1934 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1937 does not append the output name @file{main} to @var{dumppfx}, because
1938 @option{-dumpdir} is explicitly specified. The goal is that the
1939 explicitly-specified @var{dumppfx} may contain the specified output name
1940 as part of the prefix, if desired; only an explicitly-specified
1941 @option{-dumpbase} would be combined with it, in order to avoid simply
1942 discarding a meaningful option.
1944 When compiling and then linking from a single input file, the linker
1945 output base name will only be appended to the default @var{dumppfx} as
1946 above if it does not share the base name with the single input file
1947 name. This has been covered in single-input linking cases above, but
1948 not with an explicit @option{-dumpdir} that inhibits the combination,
1949 even if overridden by @option{-save-temps=*}:
1952 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1955 Auxiliary outputs are named @file{foo.*}, and dump outputs
1956 @file{foo.c.*}, in the current working directory as ultimately requested
1957 by @option{-save-temps=cwd}.
1959 Summing it all up for an intuitive though slightly imprecise data flow:
1960 the primary output name is broken into a directory part and a basename
1961 part; @var{dumppfx} is set to the former, unless overridden by
1962 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1963 to the latter, unless overriden by @option{-dumpbase}. If there are
1964 multiple inputs or linking, this @var{dumpbase} may be combined with
1965 @var{dumppfx} and taken from each input file. Auxiliary output names
1966 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1967 minus suffix, and the auxiliary output suffix; dump output names are
1968 only different in that the suffix from @var{dumpbase} is retained.
1970 When it comes to auxiliary and dump outputs created during LTO
1971 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1972 given or as derived from the linker output name but not from inputs,
1973 even in cases in which this combination would not otherwise be used as
1974 such, is passed down with a trailing period replacing the compiler-added
1975 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1976 being involved in linking, this program does not normally get any
1977 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
1979 When running sub-compilers, @command{lto-wrapper} appends LTO stage
1980 names to the received @var{dumppfx}, ensures it contains a directory
1981 component so that it overrides any @option{-dumpdir}, and passes that as
1982 @option{-dumpbase} to sub-compilers.
1986 Print (on standard error output) the commands executed to run the stages
1987 of compilation. Also print the version number of the compiler driver
1988 program and of the preprocessor and the compiler proper.
1992 Like @option{-v} except the commands are not executed and arguments
1993 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1994 This is useful for shell scripts to capture the driver-generated command lines.
1998 Print (on the standard output) a description of the command-line options
1999 understood by @command{gcc}. If the @option{-v} option is also specified
2000 then @option{--help} is also passed on to the various processes
2001 invoked by @command{gcc}, so that they can display the command-line options
2002 they accept. If the @option{-Wextra} option has also been specified
2003 (prior to the @option{--help} option), then command-line options that
2004 have no documentation associated with them are also displayed.
2007 @opindex target-help
2008 Print (on the standard output) a description of target-specific command-line
2009 options for each tool. For some targets extra target-specific
2010 information may also be printed.
2012 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2013 Print (on the standard output) a description of the command-line
2014 options understood by the compiler that fit into all specified classes
2015 and qualifiers. These are the supported classes:
2018 @item @samp{optimizers}
2019 Display all of the optimization options supported by the
2022 @item @samp{warnings}
2023 Display all of the options controlling warning messages
2024 produced by the compiler.
2027 Display target-specific options. Unlike the
2028 @option{--target-help} option however, target-specific options of the
2029 linker and assembler are not displayed. This is because those
2030 tools do not currently support the extended @option{--help=} syntax.
2033 Display the values recognized by the @option{--param}
2036 @item @var{language}
2037 Display the options supported for @var{language}, where
2038 @var{language} is the name of one of the languages supported in this
2039 version of GCC@. If an option is supported by all languages, one needs
2040 to select @samp{common} class.
2043 Display the options that are common to all languages.
2046 These are the supported qualifiers:
2049 @item @samp{undocumented}
2050 Display only those options that are undocumented.
2053 Display options taking an argument that appears after an equal
2054 sign in the same continuous piece of text, such as:
2055 @samp{--help=target}.
2057 @item @samp{separate}
2058 Display options taking an argument that appears as a separate word
2059 following the original option, such as: @samp{-o output-file}.
2062 Thus for example to display all the undocumented target-specific
2063 switches supported by the compiler, use:
2066 --help=target,undocumented
2069 The sense of a qualifier can be inverted by prefixing it with the
2070 @samp{^} character, so for example to display all binary warning
2071 options (i.e., ones that are either on or off and that do not take an
2072 argument) that have a description, use:
2075 --help=warnings,^joined,^undocumented
2078 The argument to @option{--help=} should not consist solely of inverted
2081 Combining several classes is possible, although this usually
2082 restricts the output so much that there is nothing to display. One
2083 case where it does work, however, is when one of the classes is
2084 @var{target}. For example, to display all the target-specific
2085 optimization options, use:
2088 --help=target,optimizers
2091 The @option{--help=} option can be repeated on the command line. Each
2092 successive use displays its requested class of options, skipping
2093 those that have already been displayed. If @option{--help} is also
2094 specified anywhere on the command line then this takes precedence
2095 over any @option{--help=} option.
2097 If the @option{-Q} option appears on the command line before the
2098 @option{--help=} option, then the descriptive text displayed by
2099 @option{--help=} is changed. Instead of describing the displayed
2100 options, an indication is given as to whether the option is enabled,
2101 disabled or set to a specific value (assuming that the compiler
2102 knows this at the point where the @option{--help=} option is used).
2104 Here is a truncated example from the ARM port of @command{gcc}:
2107 % gcc -Q -mabi=2 --help=target -c
2108 The following options are target specific:
2110 -mabort-on-noreturn [disabled]
2114 The output is sensitive to the effects of previous command-line
2115 options, so for example it is possible to find out which optimizations
2116 are enabled at @option{-O2} by using:
2119 -Q -O2 --help=optimizers
2122 Alternatively you can discover which binary optimizations are enabled
2123 by @option{-O3} by using:
2126 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2127 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2128 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2133 Display the version number and copyrights of the invoked GCC@.
2135 @item -pass-exit-codes
2136 @opindex pass-exit-codes
2137 Normally the @command{gcc} program exits with the code of 1 if any
2138 phase of the compiler returns a non-success return code. If you specify
2139 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2140 the numerically highest error produced by any phase returning an error
2141 indication. The C, C++, and Fortran front ends return 4 if an internal
2142 compiler error is encountered.
2146 Use pipes rather than temporary files for communication between the
2147 various stages of compilation. This fails to work on some systems where
2148 the assembler is unable to read from a pipe; but the GNU assembler has
2151 @item -specs=@var{file}
2153 Process @var{file} after the compiler reads in the standard @file{specs}
2154 file, in order to override the defaults which the @command{gcc} driver
2155 program uses when determining what switches to pass to @command{cc1},
2156 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
2157 @option{-specs=@var{file}} can be specified on the command line, and they
2158 are processed in order, from left to right. @xref{Spec Files}, for
2159 information about the format of the @var{file}.
2163 Invoke all subcommands under a wrapper program. The name of the
2164 wrapper program and its parameters are passed as a comma separated
2168 gcc -c t.c -wrapper gdb,--args
2172 This invokes all subprograms of @command{gcc} under
2173 @samp{gdb --args}, thus the invocation of @command{cc1} is
2174 @samp{gdb --args cc1 @dots{}}.
2176 @item -ffile-prefix-map=@var{old}=@var{new}
2177 @opindex ffile-prefix-map
2178 When compiling files residing in directory @file{@var{old}}, record
2179 any references to them in the result of the compilation as if the
2180 files resided in directory @file{@var{new}} instead. Specifying this
2181 option is equivalent to specifying all the individual
2182 @option{-f*-prefix-map} options. This can be used to make reproducible
2183 builds that are location independent. See also
2184 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
2186 @item -fplugin=@var{name}.so
2188 Load the plugin code in file @var{name}.so, assumed to be a
2189 shared object to be dlopen'd by the compiler. The base name of
2190 the shared object file is used to identify the plugin for the
2191 purposes of argument parsing (See
2192 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2193 Each plugin should define the callback functions specified in the
2196 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2197 @opindex fplugin-arg
2198 Define an argument called @var{key} with a value of @var{value}
2199 for the plugin called @var{name}.
2201 @item -fdump-ada-spec@r{[}-slim@r{]}
2202 @opindex fdump-ada-spec
2203 For C and C++ source and include files, generate corresponding Ada specs.
2204 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2205 GNAT User's Guide}, which provides detailed documentation on this feature.
2207 @item -fada-spec-parent=@var{unit}
2208 @opindex fada-spec-parent
2209 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2210 Ada specs as child units of parent @var{unit}.
2212 @item -fdump-go-spec=@var{file}
2213 @opindex fdump-go-spec
2214 For input files in any language, generate corresponding Go
2215 declarations in @var{file}. This generates Go @code{const},
2216 @code{type}, @code{var}, and @code{func} declarations which may be a
2217 useful way to start writing a Go interface to code written in some
2220 @include @value{srcdir}/../libiberty/at-file.texi
2224 @section Compiling C++ Programs
2226 @cindex suffixes for C++ source
2227 @cindex C++ source file suffixes
2228 C++ source files conventionally use one of the suffixes @samp{.C},
2229 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2230 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2231 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2232 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
2233 files with these names and compiles them as C++ programs even if you
2234 call the compiler the same way as for compiling C programs (usually
2235 with the name @command{gcc}).
2239 However, the use of @command{gcc} does not add the C++ library.
2240 @command{g++} is a program that calls GCC and automatically specifies linking
2241 against the C++ library. It treats @samp{.c},
2242 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2243 files unless @option{-x} is used. This program is also useful when
2244 precompiling a C header file with a @samp{.h} extension for use in C++
2245 compilations. On many systems, @command{g++} is also installed with
2246 the name @command{c++}.
2248 @cindex invoking @command{g++}
2249 When you compile C++ programs, you may specify many of the same
2250 command-line options that you use for compiling programs in any
2251 language; or command-line options meaningful for C and related
2252 languages; or options that are meaningful only for C++ programs.
2253 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2254 explanations of options for languages related to C@.
2255 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2256 explanations of options that are meaningful only for C++ programs.
2258 @node C Dialect Options
2259 @section Options Controlling C Dialect
2260 @cindex dialect options
2261 @cindex language dialect options
2262 @cindex options, dialect
2264 The following options control the dialect of C (or languages derived
2265 from C, such as C++, Objective-C and Objective-C++) that the compiler
2269 @cindex ANSI support
2273 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2274 equivalent to @option{-std=c++98}.
2276 This turns off certain features of GCC that are incompatible with ISO
2277 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2278 such as the @code{asm} and @code{typeof} keywords, and
2279 predefined macros such as @code{unix} and @code{vax} that identify the
2280 type of system you are using. It also enables the undesirable and
2281 rarely used ISO trigraph feature. For the C compiler,
2282 it disables recognition of C++ style @samp{//} comments as well as
2283 the @code{inline} keyword.
2285 The alternate keywords @code{__asm__}, @code{__extension__},
2286 @code{__inline__} and @code{__typeof__} continue to work despite
2287 @option{-ansi}. You would not want to use them in an ISO C program, of
2288 course, but it is useful to put them in header files that might be included
2289 in compilations done with @option{-ansi}. Alternate predefined macros
2290 such as @code{__unix__} and @code{__vax__} are also available, with or
2291 without @option{-ansi}.
2293 The @option{-ansi} option does not cause non-ISO programs to be
2294 rejected gratuitously. For that, @option{-Wpedantic} is required in
2295 addition to @option{-ansi}. @xref{Warning Options}.
2297 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2298 option is used. Some header files may notice this macro and refrain
2299 from declaring certain functions or defining certain macros that the
2300 ISO standard doesn't call for; this is to avoid interfering with any
2301 programs that might use these names for other things.
2303 Functions that are normally built in but do not have semantics
2304 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2305 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2306 built-in functions provided by GCC}, for details of the functions
2311 Determine the language standard. @xref{Standards,,Language Standards
2312 Supported by GCC}, for details of these standard versions. This option
2313 is currently only supported when compiling C or C++.
2315 The compiler can accept several base standards, such as @samp{c90} or
2316 @samp{c++98}, and GNU dialects of those standards, such as
2317 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
2318 compiler accepts all programs following that standard plus those
2319 using GNU extensions that do not contradict it. For example,
2320 @option{-std=c90} turns off certain features of GCC that are
2321 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2322 keywords, but not other GNU extensions that do not have a meaning in
2323 ISO C90, such as omitting the middle term of a @code{?:}
2324 expression. On the other hand, when a GNU dialect of a standard is
2325 specified, all features supported by the compiler are enabled, even when
2326 those features change the meaning of the base standard. As a result, some
2327 strict-conforming programs may be rejected. The particular standard
2328 is used by @option{-Wpedantic} to identify which features are GNU
2329 extensions given that version of the standard. For example
2330 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2331 comments, while @option{-std=gnu99 -Wpedantic} does not.
2333 A value for this option must be provided; possible values are
2339 Support all ISO C90 programs (certain GNU extensions that conflict
2340 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2342 @item iso9899:199409
2343 ISO C90 as modified in amendment 1.
2349 ISO C99. This standard is substantially completely supported, modulo
2350 bugs and floating-point issues
2351 (mainly but not entirely relating to optional C99 features from
2352 Annexes F and G). See
2353 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
2354 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2359 ISO C11, the 2011 revision of the ISO C standard. This standard is
2360 substantially completely supported, modulo bugs, floating-point issues
2361 (mainly but not entirely relating to optional C11 features from
2362 Annexes F and G) and the optional Annexes K (Bounds-checking
2363 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
2369 ISO C17, the 2017 revision of the ISO C standard
2370 (published in 2018). This standard is
2371 same as C11 except for corrections of defects (all of which are also
2372 applied with @option{-std=c11}) and a new value of
2373 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2376 The next version of the ISO C standard, still under development. The
2377 support for this version is experimental and incomplete.
2381 GNU dialect of ISO C90 (including some C99 features).
2385 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2389 GNU dialect of ISO C11.
2390 The name @samp{gnu1x} is deprecated.
2394 GNU dialect of ISO C17. This is the default for C code.
2397 The next version of the ISO C standard, still under development, plus
2398 GNU extensions. The support for this version is experimental and
2403 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2404 additional defect reports. Same as @option{-ansi} for C++ code.
2408 GNU dialect of @option{-std=c++98}.
2412 The 2011 ISO C++ standard plus amendments.
2413 The name @samp{c++0x} is deprecated.
2417 GNU dialect of @option{-std=c++11}.
2418 The name @samp{gnu++0x} is deprecated.
2422 The 2014 ISO C++ standard plus amendments.
2423 The name @samp{c++1y} is deprecated.
2427 GNU dialect of @option{-std=c++14}.
2428 The name @samp{gnu++1y} is deprecated.
2432 The 2017 ISO C++ standard plus amendments.
2433 The name @samp{c++1z} is deprecated.
2437 GNU dialect of @option{-std=c++17}.
2438 This is the default for C++ code.
2439 The name @samp{gnu++1z} is deprecated.
2443 The 2020 ISO C++ standard plus amendments.
2444 Support is experimental, and could change in incompatible ways in
2446 The name @samp{c++2a} is deprecated.
2450 GNU dialect of @option{-std=c++20}.
2451 Support is experimental, and could change in incompatible ways in
2453 The name @samp{gnu++2a} is deprecated.
2457 The next revision of the ISO C++ standard, planned for
2458 2023. Support is highly experimental, and will almost certainly
2459 change in incompatible ways in future releases.
2463 GNU dialect of @option{-std=c++2b}. Support is highly experimental,
2464 and will almost certainly change in incompatible ways in future
2468 @item -aux-info @var{filename}
2470 Output to the given filename prototyped declarations for all functions
2471 declared and/or defined in a translation unit, including those in header
2472 files. This option is silently ignored in any language other than C@.
2474 Besides declarations, the file indicates, in comments, the origin of
2475 each declaration (source file and line), whether the declaration was
2476 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2477 @samp{O} for old, respectively, in the first character after the line
2478 number and the colon), and whether it came from a declaration or a
2479 definition (@samp{C} or @samp{F}, respectively, in the following
2480 character). In the case of function definitions, a K&R-style list of
2481 arguments followed by their declarations is also provided, inside
2482 comments, after the declaration.
2484 @item -fallow-parameterless-variadic-functions
2485 @opindex fallow-parameterless-variadic-functions
2486 Accept variadic functions without named parameters.
2488 Although it is possible to define such a function, this is not very
2489 useful as it is not possible to read the arguments. This is only
2490 supported for C as this construct is allowed by C++.
2495 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2496 keyword, so that code can use these words as identifiers. You can use
2497 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2498 instead. In C, @option{-ansi} implies @option{-fno-asm}.
2500 In C++, @code{inline} is a standard keyword and is not affected by
2501 this switch. You may want to use the @option{-fno-gnu-keywords} flag
2502 instead, which disables @code{typeof} but not @code{asm} and
2503 @code{inline}. In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2504 this switch only affects the @code{asm} and @code{typeof} keywords,
2505 since @code{inline} is a standard keyword in ISO C99.
2508 @itemx -fno-builtin-@var{function}
2509 @opindex fno-builtin
2511 @cindex built-in functions
2512 Don't recognize built-in functions that do not begin with
2513 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2514 functions provided by GCC}, for details of the functions affected,
2515 including those which are not built-in functions when @option{-ansi} or
2516 @option{-std} options for strict ISO C conformance are used because they
2517 do not have an ISO standard meaning.
2519 GCC normally generates special code to handle certain built-in functions
2520 more efficiently; for instance, calls to @code{alloca} may become single
2521 instructions which adjust the stack directly, and calls to @code{memcpy}
2522 may become inline copy loops. The resulting code is often both smaller
2523 and faster, but since the function calls no longer appear as such, you
2524 cannot set a breakpoint on those calls, nor can you change the behavior
2525 of the functions by linking with a different library. In addition,
2526 when a function is recognized as a built-in function, GCC may use
2527 information about that function to warn about problems with calls to
2528 that function, or to generate more efficient code, even if the
2529 resulting code still contains calls to that function. For example,
2530 warnings are given with @option{-Wformat} for bad calls to
2531 @code{printf} when @code{printf} is built in and @code{strlen} is
2532 known not to modify global memory.
2534 With the @option{-fno-builtin-@var{function}} option
2535 only the built-in function @var{function} is
2536 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2537 function is named that is not built-in in this version of GCC, this
2538 option is ignored. There is no corresponding
2539 @option{-fbuiltin-@var{function}} option; if you wish to enable
2540 built-in functions selectively when using @option{-fno-builtin} or
2541 @option{-ffreestanding}, you may define macros such as:
2544 #define abs(n) __builtin_abs ((n))
2545 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2548 @item -fcond-mismatch
2549 @opindex fcond-mismatch
2550 Allow conditional expressions with mismatched types in the second and
2551 third arguments. The value of such an expression is void. This option
2552 is not supported for C++.
2554 @item -ffreestanding
2555 @opindex ffreestanding
2556 @cindex hosted environment
2558 Assert that compilation targets a freestanding environment. This
2559 implies @option{-fno-builtin}. A freestanding environment
2560 is one in which the standard library may not exist, and program startup may
2561 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2562 This is equivalent to @option{-fno-hosted}.
2564 @xref{Standards,,Language Standards Supported by GCC}, for details of
2565 freestanding and hosted environments.
2570 Enable parsing of function definitions marked with @code{__GIMPLE}.
2571 This is an experimental feature that allows unit testing of GIMPLE
2576 When the option @option{-fgnu-tm} is specified, the compiler
2577 generates code for the Linux variant of Intel's current Transactional
2578 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2579 an experimental feature whose interface may change in future versions
2580 of GCC, as the official specification changes. Please note that not
2581 all architectures are supported for this feature.
2583 For more information on GCC's support for transactional memory,
2584 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2585 Transactional Memory Library}.
2587 Note that the transactional memory feature is not supported with
2588 non-call exceptions (@option{-fnon-call-exceptions}).
2590 @item -fgnu89-inline
2591 @opindex fgnu89-inline
2592 The option @option{-fgnu89-inline} tells GCC to use the traditional
2593 GNU semantics for @code{inline} functions when in C99 mode.
2594 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2595 Using this option is roughly equivalent to adding the
2596 @code{gnu_inline} function attribute to all inline functions
2597 (@pxref{Function Attributes}).
2599 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2600 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2601 specifies the default behavior).
2602 This option is not supported in @option{-std=c90} or
2603 @option{-std=gnu90} mode.
2605 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2606 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2607 in effect for @code{inline} functions. @xref{Common Predefined
2608 Macros,,,cpp,The C Preprocessor}.
2612 @cindex hosted environment
2614 Assert that compilation targets a hosted environment. This implies
2615 @option{-fbuiltin}. A hosted environment is one in which the
2616 entire standard library is available, and in which @code{main} has a return
2617 type of @code{int}. Examples are nearly everything except a kernel.
2618 This is equivalent to @option{-fno-freestanding}.
2620 @item -flax-vector-conversions
2621 @opindex flax-vector-conversions
2622 Allow implicit conversions between vectors with differing numbers of
2623 elements and/or incompatible element types. This option should not be
2626 @item -fms-extensions
2627 @opindex fms-extensions
2628 Accept some non-standard constructs used in Microsoft header files.
2630 In C++ code, this allows member names in structures to be similar
2631 to previous types declarations.
2640 Some cases of unnamed fields in structures and unions are only
2641 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2642 fields within structs/unions}, for details.
2644 Note that this option is off for all targets except for x86
2645 targets using ms-abi.
2647 @item -foffload=disable
2648 @itemx -foffload=default
2649 @itemx -foffload=@var{target-list}
2651 @cindex Offloading targets
2652 @cindex OpenACC offloading targets
2653 @cindex OpenMP offloading targets
2654 Specify for which OpenMP and OpenACC offload targets code should be generated.
2655 The default behavior, equivalent to @option{-foffload=default}, is to generate
2656 code for all supported offload targets. The @option{-foffload=disable} form
2657 generates code only for the host fallback, while
2658 @option{-foffload=@var{target-list}} generates code only for the specified
2659 comma-separated list of offload targets.
2661 Offload targets are specified in GCC's internal target-triplet format. You can
2662 run the compiler with @option{-v} to show the list of configured offload targets
2663 under @code{OFFLOAD_TARGET_NAMES}.
2665 @item -foffload-options=@var{options}
2666 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2667 @opindex foffload-options
2668 @cindex Offloading options
2669 @cindex OpenACC offloading options
2670 @cindex OpenMP offloading options
2672 With @option{-foffload-options=@var{options}}, GCC passes the specified
2673 @var{options} to the compilers for all enabled offloading targets. You can
2674 specify options that apply only to a specific target or targets by using
2675 the @option{-foffload-options=@var{target-list}=@var{options}} form. The
2676 @var{target-list} is a comma-separated list in the same format as for the
2677 @option{-foffload=} option.
2679 Typical command lines are
2682 -foffload-options=-lgfortran -foffload-options=-lm
2683 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2684 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2689 @cindex OpenACC accelerator programming
2690 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2691 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2692 compiler generates accelerated code according to the OpenACC Application
2693 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2694 implies @option{-pthread}, and thus is only supported on targets that
2695 have support for @option{-pthread}.
2697 @item -fopenacc-dim=@var{geom}
2698 @opindex fopenacc-dim
2699 @cindex OpenACC accelerator programming
2700 Specify default compute dimensions for parallel offload regions that do
2701 not explicitly specify. The @var{geom} value is a triple of
2702 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2703 can be omitted, to use a target-specific default value.
2707 @cindex OpenMP parallel
2708 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2709 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2710 compiler generates parallel code according to the OpenMP Application
2711 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2712 implies @option{-pthread}, and thus is only supported on targets that
2713 have support for @option{-pthread}. @option{-fopenmp} implies
2714 @option{-fopenmp-simd}.
2717 @opindex fopenmp-simd
2720 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2721 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2724 @item -fpermitted-flt-eval-methods=@var{style}
2725 @opindex fpermitted-flt-eval-methods
2726 @opindex fpermitted-flt-eval-methods=c11
2727 @opindex fpermitted-flt-eval-methods=ts-18661-3
2728 ISO/IEC TS 18661-3 defines new permissible values for
2729 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2730 a semantic type that is an interchange or extended format should be
2731 evaluated to the precision and range of that type. These new values are
2732 a superset of those permitted under C99/C11, which does not specify the
2733 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2734 conforming to C11 may not have been written expecting the possibility of
2737 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2738 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2739 or the extended set of values specified in ISO/IEC TS 18661-3.
2741 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2743 The default when in a standards compliant mode (@option{-std=c11} or similar)
2744 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2745 dialect (@option{-std=gnu11} or similar) is
2746 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2748 @item -fplan9-extensions
2749 @opindex fplan9-extensions
2750 Accept some non-standard constructs used in Plan 9 code.
2752 This enables @option{-fms-extensions}, permits passing pointers to
2753 structures with anonymous fields to functions that expect pointers to
2754 elements of the type of the field, and permits referring to anonymous
2755 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2756 struct/union fields within structs/unions}, for details. This is only
2757 supported for C, not C++.
2759 @item -fsigned-bitfields
2760 @itemx -funsigned-bitfields
2761 @itemx -fno-signed-bitfields
2762 @itemx -fno-unsigned-bitfields
2763 @opindex fsigned-bitfields
2764 @opindex funsigned-bitfields
2765 @opindex fno-signed-bitfields
2766 @opindex fno-unsigned-bitfields
2767 These options control whether a bit-field is signed or unsigned, when the
2768 declaration does not use either @code{signed} or @code{unsigned}. By
2769 default, such a bit-field is signed, because this is consistent: the
2770 basic integer types such as @code{int} are signed types.
2773 @opindex fsigned-char
2774 Let the type @code{char} be signed, like @code{signed char}.
2776 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2777 the negative form of @option{-funsigned-char}. Likewise, the option
2778 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2780 @item -funsigned-char
2781 @opindex funsigned-char
2782 Let the type @code{char} be unsigned, like @code{unsigned char}.
2784 Each kind of machine has a default for what @code{char} should
2785 be. It is either like @code{unsigned char} by default or like
2786 @code{signed char} by default.
2788 Ideally, a portable program should always use @code{signed char} or
2789 @code{unsigned char} when it depends on the signedness of an object.
2790 But many programs have been written to use plain @code{char} and
2791 expect it to be signed, or expect it to be unsigned, depending on the
2792 machines they were written for. This option, and its inverse, let you
2793 make such a program work with the opposite default.
2795 The type @code{char} is always a distinct type from each of
2796 @code{signed char} or @code{unsigned char}, even though its behavior
2797 is always just like one of those two.
2799 @item -fsso-struct=@var{endianness}
2800 @opindex fsso-struct
2801 Set the default scalar storage order of structures and unions to the
2802 specified endianness. The accepted values are @samp{big-endian},
2803 @samp{little-endian} and @samp{native} for the native endianness of
2804 the target (the default). This option is not supported for C++.
2806 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2807 code that is not binary compatible with code generated without it if the
2808 specified endianness is not the native endianness of the target.
2811 @node C++ Dialect Options
2812 @section Options Controlling C++ Dialect
2814 @cindex compiler options, C++
2815 @cindex C++ options, command-line
2816 @cindex options, C++
2817 This section describes the command-line options that are only meaningful
2818 for C++ programs. You can also use most of the GNU compiler options
2819 regardless of what language your program is in. For example, you
2820 might compile a file @file{firstClass.C} like this:
2823 g++ -g -fstrict-enums -O -c firstClass.C
2827 In this example, only @option{-fstrict-enums} is an option meant
2828 only for C++ programs; you can use the other options with any
2829 language supported by GCC@.
2831 Some options for compiling C programs, such as @option{-std}, are also
2832 relevant for C++ programs.
2833 @xref{C Dialect Options,,Options Controlling C Dialect}.
2835 Here is a list of options that are @emph{only} for compiling C++ programs:
2839 @item -fabi-version=@var{n}
2840 @opindex fabi-version
2841 Use version @var{n} of the C++ ABI@. The default is version 0.
2843 Version 0 refers to the version conforming most closely to
2844 the C++ ABI specification. Therefore, the ABI obtained using version 0
2845 will change in different versions of G++ as ABI bugs are fixed.
2847 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2849 Version 2 is the version of the C++ ABI that first appeared in G++
2850 3.4, and was the default through G++ 4.9.
2852 Version 3 corrects an error in mangling a constant address as a
2855 Version 4, which first appeared in G++ 4.5, implements a standard
2856 mangling for vector types.
2858 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2859 attribute const/volatile on function pointer types, decltype of a
2860 plain decl, and use of a function parameter in the declaration of
2863 Version 6, which first appeared in G++ 4.7, corrects the promotion
2864 behavior of C++11 scoped enums and the mangling of template argument
2865 packs, const/static_cast, prefix ++ and --, and a class scope function
2866 used as a template argument.
2868 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2869 builtin type and corrects the mangling of lambdas in default argument
2872 Version 8, which first appeared in G++ 4.9, corrects the substitution
2873 behavior of function types with function-cv-qualifiers.
2875 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2878 Version 10, which first appeared in G++ 6.1, adds mangling of
2879 attributes that affect type identity, such as ia32 calling convention
2880 attributes (e.g.@: @samp{stdcall}).
2882 Version 11, which first appeared in G++ 7, corrects the mangling of
2883 sizeof... expressions and operator names. For multiple entities with
2884 the same name within a function, that are declared in different scopes,
2885 the mangling now changes starting with the twelfth occurrence. It also
2886 implies @option{-fnew-inheriting-ctors}.
2888 Version 12, which first appeared in G++ 8, corrects the calling
2889 conventions for empty classes on the x86_64 target and for classes
2890 with only deleted copy/move constructors. It accidentally changes the
2891 calling convention for classes with a deleted copy constructor and a
2892 trivial move constructor.
2894 Version 13, which first appeared in G++ 8.2, fixes the accidental
2895 change in version 12.
2897 Version 14, which first appeared in G++ 10, corrects the mangling of
2898 the nullptr expression.
2900 Version 15, which first appeared in G++ 11, changes the mangling of
2901 @code{__alignof__} to be distinct from that of @code{alignof}, and
2902 dependent operator names.
2904 See also @option{-Wabi}.
2906 @item -fabi-compat-version=@var{n}
2907 @opindex fabi-compat-version
2908 On targets that support strong aliases, G++
2909 works around mangling changes by creating an alias with the correct
2910 mangled name when defining a symbol with an incorrect mangled name.
2911 This switch specifies which ABI version to use for the alias.
2913 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2914 compatibility). If another ABI version is explicitly selected, this
2915 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2916 use @option{-fabi-compat-version=2}.
2918 If this option is not provided but @option{-Wabi=@var{n}} is, that
2919 version is used for compatibility aliases. If this option is provided
2920 along with @option{-Wabi} (without the version), the version from this
2921 option is used for the warning.
2923 @item -fno-access-control
2924 @opindex fno-access-control
2925 @opindex faccess-control
2926 Turn off all access checking. This switch is mainly useful for working
2927 around bugs in the access control code.
2930 @opindex faligned-new
2931 Enable support for C++17 @code{new} of types that require more
2932 alignment than @code{void* ::operator new(std::size_t)} provides. A
2933 numeric argument such as @code{-faligned-new=32} can be used to
2934 specify how much alignment (in bytes) is provided by that function,
2935 but few users will need to override the default of
2936 @code{alignof(std::max_align_t)}.
2938 This flag is enabled by default for @option{-std=c++17}.
2943 @opindex fno-char8_t
2944 Enable support for @code{char8_t} as adopted for C++20. This includes
2945 the addition of a new @code{char8_t} fundamental type, changes to the
2946 types of UTF-8 string and character literals, new signatures for
2947 user-defined literals, associated standard library updates, and new
2948 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2950 This option enables functions to be overloaded for ordinary and UTF-8
2954 int f(const char *); // #1
2955 int f(const char8_t *); // #2
2956 int v1 = f("text"); // Calls #1
2957 int v2 = f(u8"text"); // Calls #2
2961 and introduces new signatures for user-defined literals:
2964 int operator""_udl1(char8_t);
2965 int v3 = u8'x'_udl1;
2966 int operator""_udl2(const char8_t*, std::size_t);
2967 int v4 = u8"text"_udl2;
2968 template<typename T, T...> int operator""_udl3();
2969 int v5 = u8"text"_udl3;
2973 The change to the types of UTF-8 string and character literals introduces
2974 incompatibilities with ISO C++11 and later standards. For example, the
2975 following code is well-formed under ISO C++11, but is ill-formed when
2976 @option{-fchar8_t} is specified.
2979 char ca[] = u8"xx"; // error: char-array initialized from wide
2981 const char *cp = u8"xx";// error: invalid conversion from
2982 // `const char8_t*' to `const char*'
2984 auto v = f(u8"xx"); // error: invalid conversion from
2985 // `const char8_t*' to `const char*'
2986 std::string s@{u8"xx"@}; // error: no matching function for call to
2987 // `std::basic_string<char>::basic_string()'
2988 using namespace std::literals;
2989 s = u8"xx"s; // error: conversion from
2990 // `basic_string<char8_t>' to non-scalar
2991 // type `basic_string<char>' requested
2996 Check that the pointer returned by @code{operator new} is non-null
2997 before attempting to modify the storage allocated. This check is
2998 normally unnecessary because the C++ standard specifies that
2999 @code{operator new} only returns @code{0} if it is declared
3000 @code{throw()}, in which case the compiler always checks the
3001 return value even without this option. In all other cases, when
3002 @code{operator new} has a non-empty exception specification, memory
3003 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
3004 @samp{new (nothrow)}.
3007 @itemx -fconcepts-ts
3009 @opindex fconcepts-ts
3010 Below @option{-std=c++20}, @option{-fconcepts} enables support for the
3011 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
3013 With @option{-std=c++20} and above, Concepts are part of the language
3014 standard, so @option{-fconcepts} defaults to on. But the standard
3015 specification of Concepts differs significantly from the TS, so some
3016 constructs that were allowed in the TS but didn't make it into the
3017 standard can still be enabled by @option{-fconcepts-ts}.
3019 @item -fconstexpr-depth=@var{n}
3020 @opindex fconstexpr-depth
3021 Set the maximum nested evaluation depth for C++11 constexpr functions
3022 to @var{n}. A limit is needed to detect endless recursion during
3023 constant expression evaluation. The minimum specified by the standard
3026 @item -fconstexpr-cache-depth=@var{n}
3027 @opindex fconstexpr-cache-depth
3028 Set the maximum level of nested evaluation depth for C++11 constexpr
3029 functions that will be cached to @var{n}. This is a heuristic that
3030 trades off compilation speed (when the cache avoids repeated
3031 calculations) against memory consumption (when the cache grows very
3032 large from highly recursive evaluations). The default is 8. Very few
3033 users are likely to want to adjust it, but if your code does heavy
3034 constexpr calculations you might want to experiment to find which
3035 value works best for you.
3037 @item -fconstexpr-loop-limit=@var{n}
3038 @opindex fconstexpr-loop-limit
3039 Set the maximum number of iterations for a loop in C++14 constexpr functions
3040 to @var{n}. A limit is needed to detect infinite loops during
3041 constant expression evaluation. The default is 262144 (1<<18).
3043 @item -fconstexpr-ops-limit=@var{n}
3044 @opindex fconstexpr-ops-limit
3045 Set the maximum number of operations during a single constexpr evaluation.
3046 Even when number of iterations of a single loop is limited with the above limit,
3047 if there are several nested loops and each of them has many iterations but still
3048 smaller than the above limit, or if in a body of some loop or even outside
3049 of a loop too many expressions need to be evaluated, the resulting constexpr
3050 evaluation might take too long.
3051 The default is 33554432 (1<<25).
3054 @opindex fcoroutines
3055 Enable support for the C++ coroutines extension (experimental).
3057 @item -fno-elide-constructors
3058 @opindex fno-elide-constructors
3059 @opindex felide-constructors
3060 The C++ standard allows an implementation to omit creating a temporary
3061 that is only used to initialize another object of the same type.
3062 Specifying this option disables that optimization, and forces G++ to
3063 call the copy constructor in all cases. This option also causes G++
3064 to call trivial member functions which otherwise would be expanded inline.
3066 In C++17, the compiler is required to omit these temporaries, but this
3067 option still affects trivial member functions.
3069 @item -fno-enforce-eh-specs
3070 @opindex fno-enforce-eh-specs
3071 @opindex fenforce-eh-specs
3072 Don't generate code to check for violation of exception specifications
3073 at run time. This option violates the C++ standard, but may be useful
3074 for reducing code size in production builds, much like defining
3075 @code{NDEBUG}. This does not give user code permission to throw
3076 exceptions in violation of the exception specifications; the compiler
3077 still optimizes based on the specifications, so throwing an
3078 unexpected exception results in undefined behavior at run time.
3080 @item -fextern-tls-init
3081 @itemx -fno-extern-tls-init
3082 @opindex fextern-tls-init
3083 @opindex fno-extern-tls-init
3084 The C++11 and OpenMP standards allow @code{thread_local} and
3085 @code{threadprivate} variables to have dynamic (runtime)
3086 initialization. To support this, any use of such a variable goes
3087 through a wrapper function that performs any necessary initialization.
3088 When the use and definition of the variable are in the same
3089 translation unit, this overhead can be optimized away, but when the
3090 use is in a different translation unit there is significant overhead
3091 even if the variable doesn't actually need dynamic initialization. If
3092 the programmer can be sure that no use of the variable in a
3093 non-defining TU needs to trigger dynamic initialization (either
3094 because the variable is statically initialized, or a use of the
3095 variable in the defining TU will be executed before any uses in
3096 another TU), they can avoid this overhead with the
3097 @option{-fno-extern-tls-init} option.
3099 On targets that support symbol aliases, the default is
3100 @option{-fextern-tls-init}. On targets that do not support symbol
3101 aliases, the default is @option{-fno-extern-tls-init}.
3103 @item -fno-gnu-keywords
3104 @opindex fno-gnu-keywords
3105 @opindex fgnu-keywords
3106 Do not recognize @code{typeof} as a keyword, so that code can use this
3107 word as an identifier. You can use the keyword @code{__typeof__} instead.
3108 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3109 @option{-std=c++98}, @option{-std=c++11}, etc.
3111 @item -fimplicit-constexpr
3112 @opindex fimplicit-constexpr
3113 Make inline functions implicitly constexpr, if they satisfy the
3114 requirements for a constexpr function. This option can be used in
3115 C++14 mode or later. This can result in initialization changing from
3116 dynamic to static and other optimizations.
3118 @item -fno-implicit-templates
3119 @opindex fno-implicit-templates
3120 @opindex fimplicit-templates
3121 Never emit code for non-inline templates that are instantiated
3122 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3123 If you use this option, you must take care to structure your code to
3124 include all the necessary explicit instantiations to avoid getting
3125 undefined symbols at link time.
3126 @xref{Template Instantiation}, for more information.
3128 @item -fno-implicit-inline-templates
3129 @opindex fno-implicit-inline-templates
3130 @opindex fimplicit-inline-templates
3131 Don't emit code for implicit instantiations of inline templates, either.
3132 The default is to handle inlines differently so that compiles with and
3133 without optimization need the same set of explicit instantiations.
3135 @item -fno-implement-inlines
3136 @opindex fno-implement-inlines
3137 @opindex fimplement-inlines
3138 To save space, do not emit out-of-line copies of inline functions
3139 controlled by @code{#pragma implementation}. This causes linker
3140 errors if these functions are not inlined everywhere they are called.
3143 @itemx -fno-modules-ts
3144 @opindex fmodules-ts
3145 @opindex fno-modules-ts
3146 Enable support for C++20 modules (@pxref{C++ Modules}). The
3147 @option{-fno-modules-ts} is usually not needed, as that is the
3148 default. Even though this is a C++20 feature, it is not currently
3149 implicitly enabled by selecting that standard version.
3151 @item -fmodule-header
3152 @itemx -fmodule-header=user
3153 @itemx -fmodule-header=system
3154 @opindex fmodule-header
3155 Compile a header file to create an importable header unit.
3157 @item -fmodule-implicit-inline
3158 @opindex fmodule-implicit-inline
3159 Member functions defined in their class definitions are not implicitly
3160 inline for modular code. This is different to traditional C++
3161 behavior, for good reasons. However, it may result in a difficulty
3162 during code porting. This option makes such function definitions
3163 implicitly inline. It does however generate an ABI incompatibility,
3164 so you must use it everywhere or nowhere. (Such definitions outside
3165 of a named module remain implicitly inline, regardless.)
3167 @item -fno-module-lazy
3168 @opindex fno-module-lazy
3169 @opindex fmodule-lazy
3170 Disable lazy module importing and module mapper creation.
3172 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3173 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3174 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3175 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3176 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3177 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3178 @vindex CXX_MODULE_MAPPER @r{environment variable}
3179 @opindex fmodule-mapper
3180 An oracle to query for module name to filename mappings. If
3181 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3182 and if that is unset, an in-process default is provided.
3185 @opindex fmodule-only
3186 Only emit the Compiled Module Interface, inhibiting any object file.
3188 @item -fms-extensions
3189 @opindex fms-extensions
3190 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3191 int and getting a pointer to member function via non-standard syntax.
3193 @item -fnew-inheriting-ctors
3194 @opindex fnew-inheriting-ctors
3195 Enable the P0136 adjustment to the semantics of C++11 constructor
3196 inheritance. This is part of C++17 but also considered to be a Defect
3197 Report against C++11 and C++14. This flag is enabled by default
3198 unless @option{-fabi-version=10} or lower is specified.
3200 @item -fnew-ttp-matching
3201 @opindex fnew-ttp-matching
3202 Enable the P0522 resolution to Core issue 150, template template
3203 parameters and default arguments: this allows a template with default
3204 template arguments as an argument for a template template parameter
3205 with fewer template parameters. This flag is enabled by default for
3206 @option{-std=c++17}.
3208 @item -fno-nonansi-builtins
3209 @opindex fno-nonansi-builtins
3210 @opindex fnonansi-builtins
3211 Disable built-in declarations of functions that are not mandated by
3212 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
3213 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3216 @opindex fnothrow-opt
3217 Treat a @code{throw()} exception specification as if it were a
3218 @code{noexcept} specification to reduce or eliminate the text size
3219 overhead relative to a function with no exception specification. If
3220 the function has local variables of types with non-trivial
3221 destructors, the exception specification actually makes the
3222 function smaller because the EH cleanups for those variables can be
3223 optimized away. The semantic effect is that an exception thrown out of
3224 a function with such an exception specification results in a call
3225 to @code{terminate} rather than @code{unexpected}.
3227 @item -fno-operator-names
3228 @opindex fno-operator-names
3229 @opindex foperator-names
3230 Do not treat the operator name keywords @code{and}, @code{bitand},
3231 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3232 synonyms as keywords.
3234 @item -fno-optional-diags
3235 @opindex fno-optional-diags
3236 @opindex foptional-diags
3237 Disable diagnostics that the standard says a compiler does not need to
3238 issue. Currently, the only such diagnostic issued by G++ is the one for
3239 a name having multiple meanings within a class.
3242 @opindex fpermissive
3243 Downgrade some diagnostics about nonconformant code from errors to
3244 warnings. Thus, using @option{-fpermissive} allows some
3245 nonconforming code to compile.
3247 @item -fno-pretty-templates
3248 @opindex fno-pretty-templates
3249 @opindex fpretty-templates
3250 When an error message refers to a specialization of a function
3251 template, the compiler normally prints the signature of the
3252 template followed by the template arguments and any typedefs or
3253 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3254 rather than @code{void f(int)}) so that it's clear which template is
3255 involved. When an error message refers to a specialization of a class
3256 template, the compiler omits any template arguments that match
3257 the default template arguments for that template. If either of these
3258 behaviors make it harder to understand the error message rather than
3259 easier, you can use @option{-fno-pretty-templates} to disable them.
3264 Disable generation of information about every class with virtual
3265 functions for use by the C++ run-time type identification features
3266 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
3267 of the language, you can save some space by using this flag. Note that
3268 exception handling uses the same information, but G++ generates it as
3269 needed. The @code{dynamic_cast} operator can still be used for casts that
3270 do not require run-time type information, i.e.@: casts to @code{void *} or to
3271 unambiguous base classes.
3273 Mixing code compiled with @option{-frtti} with that compiled with
3274 @option{-fno-rtti} may not work. For example, programs may
3275 fail to link if a class compiled with @option{-fno-rtti} is used as a base
3276 for a class compiled with @option{-frtti}.
3278 @item -fsized-deallocation
3279 @opindex fsized-deallocation
3280 Enable the built-in global declarations
3282 void operator delete (void *, std::size_t) noexcept;
3283 void operator delete[] (void *, std::size_t) noexcept;
3285 as introduced in C++14. This is useful for user-defined replacement
3286 deallocation functions that, for example, use the size of the object
3287 to make deallocation faster. Enabled by default under
3288 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
3289 warns about places that might want to add a definition.
3291 @item -fstrict-enums
3292 @opindex fstrict-enums
3293 Allow the compiler to optimize using the assumption that a value of
3294 enumerated type can only be one of the values of the enumeration (as
3295 defined in the C++ standard; basically, a value that can be
3296 represented in the minimum number of bits needed to represent all the
3297 enumerators). This assumption may not be valid if the program uses a
3298 cast to convert an arbitrary integer value to the enumerated type.
3300 @item -fstrong-eval-order
3301 @opindex fstrong-eval-order
3302 Evaluate member access, array subscripting, and shift expressions in
3303 left-to-right order, and evaluate assignment in right-to-left order,
3304 as adopted for C++17. Enabled by default with @option{-std=c++17}.
3305 @option{-fstrong-eval-order=some} enables just the ordering of member
3306 access and shift expressions, and is the default without
3307 @option{-std=c++17}.
3309 @item -ftemplate-backtrace-limit=@var{n}
3310 @opindex ftemplate-backtrace-limit
3311 Set the maximum number of template instantiation notes for a single
3312 warning or error to @var{n}. The default value is 10.
3314 @item -ftemplate-depth=@var{n}
3315 @opindex ftemplate-depth
3316 Set the maximum instantiation depth for template classes to @var{n}.
3317 A limit on the template instantiation depth is needed to detect
3318 endless recursions during template class instantiation. ANSI/ISO C++
3319 conforming programs must not rely on a maximum depth greater than 17
3320 (changed to 1024 in C++11). The default value is 900, as the compiler
3321 can run out of stack space before hitting 1024 in some situations.
3323 @item -fno-threadsafe-statics
3324 @opindex fno-threadsafe-statics
3325 @opindex fthreadsafe-statics
3326 Do not emit the extra code to use the routines specified in the C++
3327 ABI for thread-safe initialization of local statics. You can use this
3328 option to reduce code size slightly in code that doesn't need to be
3331 @item -fuse-cxa-atexit
3332 @opindex fuse-cxa-atexit
3333 Register destructors for objects with static storage duration with the
3334 @code{__cxa_atexit} function rather than the @code{atexit} function.
3335 This option is required for fully standards-compliant handling of static
3336 destructors, but only works if your C library supports
3337 @code{__cxa_atexit}.
3339 @item -fno-use-cxa-get-exception-ptr
3340 @opindex fno-use-cxa-get-exception-ptr
3341 @opindex fuse-cxa-get-exception-ptr
3342 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
3343 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3344 if the runtime routine is not available.
3346 @item -fvisibility-inlines-hidden
3347 @opindex fvisibility-inlines-hidden
3348 This switch declares that the user does not attempt to compare
3349 pointers to inline functions or methods where the addresses of the two functions
3350 are taken in different shared objects.
3352 The effect of this is that GCC may, effectively, mark inline methods with
3353 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3354 appear in the export table of a DSO and do not require a PLT indirection
3355 when used within the DSO@. Enabling this option can have a dramatic effect
3356 on load and link times of a DSO as it massively reduces the size of the
3357 dynamic export table when the library makes heavy use of templates.
3359 The behavior of this switch is not quite the same as marking the
3360 methods as hidden directly, because it does not affect static variables
3361 local to the function or cause the compiler to deduce that
3362 the function is defined in only one shared object.
3364 You may mark a method as having a visibility explicitly to negate the
3365 effect of the switch for that method. For example, if you do want to
3366 compare pointers to a particular inline method, you might mark it as
3367 having default visibility. Marking the enclosing class with explicit
3368 visibility has no effect.
3370 Explicitly instantiated inline methods are unaffected by this option
3371 as their linkage might otherwise cross a shared library boundary.
3372 @xref{Template Instantiation}.
3374 @item -fvisibility-ms-compat
3375 @opindex fvisibility-ms-compat
3376 This flag attempts to use visibility settings to make GCC's C++
3377 linkage model compatible with that of Microsoft Visual Studio.
3379 The flag makes these changes to GCC's linkage model:
3383 It sets the default visibility to @code{hidden}, like
3384 @option{-fvisibility=hidden}.
3387 Types, but not their members, are not hidden by default.
3390 The One Definition Rule is relaxed for types without explicit
3391 visibility specifications that are defined in more than one
3392 shared object: those declarations are permitted if they are
3393 permitted when this option is not used.
3396 In new code it is better to use @option{-fvisibility=hidden} and
3397 export those classes that are intended to be externally visible.
3398 Unfortunately it is possible for code to rely, perhaps accidentally,
3399 on the Visual Studio behavior.
3401 Among the consequences of these changes are that static data members
3402 of the same type with the same name but defined in different shared
3403 objects are different, so changing one does not change the other;
3404 and that pointers to function members defined in different shared
3405 objects may not compare equal. When this flag is given, it is a
3406 violation of the ODR to define types with the same name differently.
3411 Do not use weak symbol support, even if it is provided by the linker.
3412 By default, G++ uses weak symbols if they are available. This
3413 option exists only for testing, and should not be used by end-users;
3414 it results in inferior code and has no benefits. This option may
3415 be removed in a future release of G++.
3417 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3418 @opindex fext-numeric-literals
3419 @opindex fno-ext-numeric-literals
3420 Accept imaginary, fixed-point, or machine-defined
3421 literal number suffixes as GNU extensions.
3422 When this option is turned off these suffixes are treated
3423 as C++11 user-defined literal numeric suffixes.
3424 This is on by default for all pre-C++11 dialects and all GNU dialects:
3425 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3426 @option{-std=gnu++14}.
3427 This option is off by default
3428 for ISO C++11 onwards (@option{-std=c++11}, ...).
3432 Do not search for header files in the standard directories specific to
3433 C++, but do still search the other standard directories. (This option
3434 is used when building the C++ library.)
3436 @item -flang-info-include-translate
3437 @itemx -flang-info-include-translate-not
3438 @itemx -flang-info-include-translate=@var{header}
3439 @opindex flang-info-include-translate
3440 @opindex flang-info-include-translate-not
3441 Inform of include translation events. The first will note accepted
3442 include translations, the second will note declined include
3443 translations. The @var{header} form will inform of include
3444 translations relating to that specific header. If @var{header} is of
3445 the form @code{"user"} or @code{<system>} it will be resolved to a
3446 specific user or system header using the include path.
3448 @item -flang-info-module-cmi
3449 @itemx -flang-info-module-cmi=@var{module}
3450 @opindex flang-info-module-cmi
3451 Inform of Compiled Module Interface pathnames. The first will note
3452 all read CMI pathnames. The @var{module} form will not reading a
3453 specific module's CMI. @var{module} may be a named module or a
3454 header-unit (the latter indicated by either being a pathname containing
3455 directory separators or enclosed in @code{<>} or @code{""}).
3457 @item -stdlib=@var{libstdc++,libc++}
3459 When G++ is configured to support this option, it allows specification of
3460 alternate C++ runtime libraries. Two options are available: @var{libstdc++}
3461 (the default, native C++ runtime for G++) and @var{libc++} which is the
3462 C++ runtime installed on some operating systems (e.g. Darwin versions from
3463 Darwin11 onwards). The option switches G++ to use the headers from the
3464 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3465 when a C++ runtime is required for linking.
3468 In addition, these warning options have meanings only for C++ programs:
3471 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3473 Warn when a type with an ABI tag is used in a context that does not
3474 have that ABI tag. See @ref{C++ Attributes} for more information
3477 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3478 @opindex Wcomma-subscript
3479 @opindex Wno-comma-subscript
3480 Warn about uses of a comma expression within a subscripting expression.
3481 This usage was deprecated in C++20. However, a comma expression wrapped
3482 in @code{( )} is not deprecated. Example:
3486 void f(int *a, int b, int c) @{
3487 a[b,c]; // deprecated
3493 Enabled by default with @option{-std=c++20}.
3495 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3496 @opindex Wctad-maybe-unsupported
3497 @opindex Wno-ctad-maybe-unsupported
3498 Warn when performing class template argument deduction (CTAD) on a type with
3499 no explicitly written deduction guides. This warning will point out cases
3500 where CTAD succeeded only because the compiler synthesized the implicit
3501 deduction guides, which might not be what the programmer intended. Certain
3502 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3503 types that are designed to support CTAD. This warning can be suppressed with
3504 the following pattern:
3507 struct allow_ctad_t; // any name works
3508 template <typename T> struct S @{
3511 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
3514 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3515 @opindex Wctor-dtor-privacy
3516 @opindex Wno-ctor-dtor-privacy
3517 Warn when a class seems unusable because all the constructors or
3518 destructors in that class are private, and it has neither friends nor
3519 public static member functions. Also warn if there are no non-private
3520 methods, and there's at least one private member function that isn't
3521 a constructor or destructor.
3523 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3524 @opindex Wdelete-non-virtual-dtor
3525 @opindex Wno-delete-non-virtual-dtor
3526 Warn when @code{delete} is used to destroy an instance of a class that
3527 has virtual functions and non-virtual destructor. It is unsafe to delete
3528 an instance of a derived class through a pointer to a base class if the
3529 base class does not have a virtual destructor. This warning is enabled
3532 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3533 @opindex Wdeprecated-copy
3534 @opindex Wno-deprecated-copy
3535 Warn that the implicit declaration of a copy constructor or copy
3536 assignment operator is deprecated if the class has a user-provided
3537 copy constructor or copy assignment operator, in C++11 and up. This
3538 warning is enabled by @option{-Wextra}. With
3539 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3540 user-provided destructor.
3542 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3543 @opindex Wdeprecated-enum-enum-conversion
3544 @opindex Wno-deprecated-enum-enum-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 different enumeration type. This conversion was deprecated in C++20.
3556 @option{-Wdeprecated-enum-enum-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-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3561 @opindex Wdeprecated-enum-float-conversion
3562 @opindex Wno-deprecated-enum-float-conversion
3563 Disable the warning about the case when the usual arithmetic conversions
3564 are applied on operands where one is of enumeration type and the other is
3565 of a floating-point type. This conversion was deprecated in C++20. For
3574 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3575 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3576 by @option{-Wenum-conversion}.
3578 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3579 @opindex Winit-list-lifetime
3580 @opindex Wno-init-list-lifetime
3581 Do not warn about uses of @code{std::initializer_list} that are likely
3582 to result in dangling pointers. Since the underlying array for an
3583 @code{initializer_list} is handled like a normal C++ temporary object,
3584 it is easy to inadvertently keep a pointer to the array past the end
3585 of the array's lifetime. For example:
3589 If a function returns a temporary @code{initializer_list}, or a local
3590 @code{initializer_list} variable, the array's lifetime ends at the end
3591 of the return statement, so the value returned has a dangling pointer.
3594 If a new-expression creates an @code{initializer_list}, the array only
3595 lives until the end of the enclosing full-expression, so the
3596 @code{initializer_list} in the heap has a dangling pointer.
3599 When an @code{initializer_list} variable is assigned from a
3600 brace-enclosed initializer list, the temporary array created for the
3601 right side of the assignment only lives until the end of the
3602 full-expression, so at the next statement the @code{initializer_list}
3603 variable has a dangling pointer.
3606 // li's initial underlying array lives as long as li
3607 std::initializer_list<int> li = @{ 1,2,3 @};
3608 // assignment changes li to point to a temporary array
3610 // now the temporary is gone and li has a dangling pointer
3611 int i = li.begin()[0] // undefined behavior
3615 When a list constructor stores the @code{begin} pointer from the
3616 @code{initializer_list} argument, this doesn't extend the lifetime of
3617 the array, so if a class variable is constructed from a temporary
3618 @code{initializer_list}, the pointer is left dangling by the end of
3619 the variable declaration statement.
3623 @item -Winvalid-imported-macros
3624 @opindex Winvalid-imported-macros
3625 @opindex Wno-invalid-imported-macros
3626 Verify all imported macro definitions are valid at the end of
3627 compilation. This is not enabled by default, as it requires
3628 additional processing to determine. It may be useful when preparing
3629 sets of header-units to ensure consistent macros.
3631 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3632 @opindex Wliteral-suffix
3633 @opindex Wno-literal-suffix
3634 Do not warn when a string or character literal is followed by a
3635 ud-suffix which does not begin with an underscore. As a conforming
3636 extension, GCC treats such suffixes as separate preprocessing tokens
3637 in order to maintain backwards compatibility with code that uses
3638 formatting macros from @code{<inttypes.h>}. For example:
3641 #define __STDC_FORMAT_MACROS
3642 #include <inttypes.h>
3647 printf("My int64: %" PRId64"\n", i64);
3651 In this case, @code{PRId64} is treated as a separate preprocessing token.
3653 This option also controls warnings when a user-defined literal
3654 operator is declared with a literal suffix identifier that doesn't
3655 begin with an underscore. Literal suffix identifiers that don't begin
3656 with an underscore are reserved for future standardization.
3658 These warnings are enabled by default.
3660 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3662 @opindex Wno-narrowing
3663 For C++11 and later standards, narrowing conversions are diagnosed by default,
3664 as required by the standard. A narrowing conversion from a constant produces
3665 an error, and a narrowing conversion from a non-constant produces a warning,
3666 but @option{-Wno-narrowing} suppresses the diagnostic.
3667 Note that this does not affect the meaning of well-formed code;
3668 narrowing conversions are still considered ill-formed in SFINAE contexts.
3670 With @option{-Wnarrowing} in C++98, warn when a narrowing
3671 conversion prohibited by C++11 occurs within
3675 int i = @{ 2.2 @}; // error: narrowing from double to int
3678 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3680 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3682 @opindex Wno-noexcept
3683 Warn when a noexcept-expression evaluates to false because of a call
3684 to a function that does not have a non-throwing exception
3685 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3686 the compiler to never throw an exception.
3688 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3689 @opindex Wnoexcept-type
3690 @opindex Wno-noexcept-type
3691 Warn if the C++17 feature making @code{noexcept} part of a function
3692 type changes the mangled name of a symbol relative to C++14. Enabled
3693 by @option{-Wabi} and @option{-Wc++17-compat}.
3698 template <class T> void f(T t) @{ t(); @};
3700 void h() @{ f(g); @}
3704 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3705 C++17 it calls @code{f<void(*)()noexcept>}.
3707 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3708 @opindex Wclass-memaccess
3709 @opindex Wno-class-memaccess
3710 Warn when the destination of a call to a raw memory function such as
3711 @code{memset} or @code{memcpy} is an object of class type, and when writing
3712 into such an object might bypass the class non-trivial or deleted constructor
3713 or copy assignment, violate const-correctness or encapsulation, or corrupt
3714 virtual table pointers. Modifying the representation of such objects may
3715 violate invariants maintained by member functions of the class. For example,
3716 the call to @code{memset} below is undefined because it modifies a non-trivial
3717 class object and is, therefore, diagnosed. The safe way to either initialize
3718 or clear the storage of objects of such types is by using the appropriate
3719 constructor or assignment operator, if one is available.
3721 std::string str = "abc";
3722 memset (&str, 0, sizeof str);
3724 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3725 Explicitly casting the pointer to the class object to @code{void *} or
3726 to a type that can be safely accessed by the raw memory function suppresses
3729 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3730 @opindex Wnon-virtual-dtor
3731 @opindex Wno-non-virtual-dtor
3732 Warn when a class has virtual functions and an accessible non-virtual
3733 destructor itself or in an accessible polymorphic base class, in which
3734 case it is possible but unsafe to delete an instance of a derived
3735 class through a pointer to the class itself or base class. This
3736 warning is automatically enabled if @option{-Weffc++} is specified.
3738 @item -Wregister @r{(C++ and Objective-C++ only)}
3740 @opindex Wno-register
3741 Warn on uses of the @code{register} storage class specifier, except
3742 when it is part of the GNU @ref{Explicit Register Variables} extension.
3743 The use of the @code{register} keyword as storage class specifier has
3744 been deprecated in C++11 and removed in C++17.
3745 Enabled by default with @option{-std=c++17}.
3747 @item -Wreorder @r{(C++ and Objective-C++ only)}
3749 @opindex Wno-reorder
3750 @cindex reordering, warning
3751 @cindex warning for reordering of member initializers
3752 Warn when the order of member initializers given in the code does not
3753 match the order in which they must be executed. For instance:
3759 A(): j (0), i (1) @{ @}
3764 The compiler rearranges the member initializers for @code{i}
3765 and @code{j} to match the declaration order of the members, emitting
3766 a warning to that effect. This warning is enabled by @option{-Wall}.
3768 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3769 @opindex Wpessimizing-move
3770 @opindex Wno-pessimizing-move
3771 This warning warns when a call to @code{std::move} prevents copy
3772 elision. A typical scenario when copy elision can occur is when returning in
3773 a function with a class return type, when the expression being returned is the
3774 name of a non-volatile automatic object, and is not a function parameter, and
3775 has the same type as the function return type.
3785 return std::move (t);
3789 But in this example, the @code{std::move} call prevents copy elision.
3791 This warning is enabled by @option{-Wall}.
3793 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3794 @opindex Wredundant-move
3795 @opindex Wno-redundant-move
3796 This warning warns about redundant calls to @code{std::move}; that is, when
3797 a move operation would have been performed even without the @code{std::move}
3798 call. This happens because the compiler is forced to treat the object as if
3799 it were an rvalue in certain situations such as returning a local variable,
3800 where copy elision isn't applicable. Consider:
3809 return std::move (t);
3813 Here, the @code{std::move} call is redundant. Because G++ implements Core
3814 Issue 1579, another example is:
3817 struct T @{ // convertible to U
3827 return std::move (t);
3830 In this example, copy elision isn't applicable because the type of the
3831 expression being returned and the function return type differ, yet G++
3832 treats the return value as if it were designated by an rvalue.
3834 This warning is enabled by @option{-Wextra}.
3836 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
3837 @opindex Wrange-loop-construct
3838 @opindex Wno-range-loop-construct
3839 This warning warns when a C++ range-based for-loop is creating an unnecessary
3840 copy. This can happen when the range declaration is not a reference, but
3841 probably should be. For example:
3844 struct S @{ char arr[128]; @};
3847 for (const auto x : arr) @{ @dots{} @}
3851 It does not warn when the type being copied is a trivially-copyable type whose
3852 size is less than 64 bytes.
3854 This warning also warns when a loop variable in a range-based for-loop is
3855 initialized with a value of a different type resulting in a copy. For example:
3860 for (const double &x : arr) @{ @dots{} @}
3864 In the example above, in every iteration of the loop a temporary value of
3865 type @code{double} is created and destroyed, to which the reference
3866 @code{const double &} is bound.
3868 This warning is enabled by @option{-Wall}.
3870 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3871 @opindex Wredundant-tags
3872 @opindex Wno-redundant-tags
3873 Warn about redundant class-key and enum-key in references to class types
3874 and enumerated types in contexts where the key can be eliminated without
3875 causing an ambiguity. For example:
3879 struct foo *p; // warn that keyword struct can be eliminated
3883 On the other hand, in this example there is no warning:
3887 void foo (); // "hides" struct foo
3888 void bar (struct foo&); // no warning, keyword struct is necessary
3891 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3892 @opindex Wsubobject-linkage
3893 @opindex Wno-subobject-linkage
3895 if a class type has a base or a field whose type uses the anonymous
3896 namespace or depends on a type with no linkage. If a type A depends on
3897 a type B with no or internal linkage, defining it in multiple
3898 translation units would be an ODR violation because the meaning of B
3899 is different in each translation unit. If A only appears in a single
3900 translation unit, the best way to silence the warning is to give it
3901 internal linkage by putting it in an anonymous namespace as well. The
3902 compiler doesn't give this warning for types defined in the main .C
3903 file, as those are unlikely to have multiple definitions.
3904 @option{-Wsubobject-linkage} is enabled by default.
3906 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3909 Warn about violations of the following style guidelines from Scott Meyers'
3910 @cite{Effective C++} series of books:
3914 Define a copy constructor and an assignment operator for classes
3915 with dynamically-allocated memory.
3918 Prefer initialization to assignment in constructors.
3921 Have @code{operator=} return a reference to @code{*this}.
3924 Don't try to return a reference when you must return an object.
3927 Distinguish between prefix and postfix forms of increment and
3928 decrement operators.
3931 Never overload @code{&&}, @code{||}, or @code{,}.
3935 This option also enables @option{-Wnon-virtual-dtor}, which is also
3936 one of the effective C++ recommendations. However, the check is
3937 extended to warn about the lack of virtual destructor in accessible
3938 non-polymorphic bases classes too.
3940 When selecting this option, be aware that the standard library
3941 headers do not obey all of these guidelines; use @samp{grep -v}
3942 to filter out those warnings.
3944 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
3945 @opindex Wexceptions
3946 @opindex Wno-exceptions
3947 Disable the warning about the case when an exception handler is shadowed by
3948 another handler, which can point out a wrong ordering of exception handlers.
3950 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3951 @opindex Wstrict-null-sentinel
3952 @opindex Wno-strict-null-sentinel
3953 Warn about the use of an uncasted @code{NULL} as sentinel. When
3954 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3955 to @code{__null}. Although it is a null pointer constant rather than a
3956 null pointer, it is guaranteed to be of the same size as a pointer.
3957 But this use is not portable across different compilers.
3959 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3960 @opindex Wno-non-template-friend
3961 @opindex Wnon-template-friend
3962 Disable warnings when non-template friend functions are declared
3963 within a template. In very old versions of GCC that predate implementation
3964 of the ISO standard, declarations such as
3965 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3966 could be interpreted as a particular specialization of a template
3967 function; the warning exists to diagnose compatibility problems,
3968 and is enabled by default.
3970 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3971 @opindex Wold-style-cast
3972 @opindex Wno-old-style-cast
3973 Warn if an old-style (C-style) cast to a non-void type is used within
3974 a C++ program. The new-style casts (@code{dynamic_cast},
3975 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3976 less vulnerable to unintended effects and much easier to search for.
3978 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3979 @opindex Woverloaded-virtual
3980 @opindex Wno-overloaded-virtual
3981 @cindex overloaded virtual function, warning
3982 @cindex warning for overloaded virtual function
3983 Warn when a function declaration hides virtual functions from a
3984 base class. For example, in:
3991 struct B: public A @{
3996 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4007 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4008 @opindex Wno-pmf-conversions
4009 @opindex Wpmf-conversions
4010 Disable the diagnostic for converting a bound pointer to member function
4013 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4014 @opindex Wsign-promo
4015 @opindex Wno-sign-promo
4016 Warn when overload resolution chooses a promotion from unsigned or
4017 enumerated type to a signed type, over a conversion to an unsigned type of
4018 the same size. Previous versions of G++ tried to preserve
4019 unsignedness, but the standard mandates the current behavior.
4021 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4023 @opindex Wno-templates
4024 Warn when a primary template declaration is encountered. Some coding
4025 rules disallow templates, and this may be used to enforce that rule.
4026 The warning is inactive inside a system header file, such as the STL, so
4027 one can still use the STL. One may also instantiate or specialize
4030 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4031 @opindex Wmismatched-new-delete
4032 @opindex Wno-mismatched-new-delete
4033 Warn for mismatches between calls to @code{operator new} or @code{operator
4034 delete} and the corresponding call to the allocation or deallocation function.
4035 This includes invocations of C++ @code{operator delete} with pointers
4036 returned from either mismatched forms of @code{operator new}, or from other
4037 functions that allocate objects for which the @code{operator delete} isn't
4038 a suitable deallocator, as well as calls to other deallocation functions
4039 with pointers returned from @code{operator new} for which the deallocation
4040 function isn't suitable.
4042 For example, the @code{delete} expression in the function below is diagnosed
4043 because it doesn't match the array form of the @code{new} expression
4044 the pointer argument was returned from. Similarly, the call to @code{free}
4050 int *a = new int[n];
4051 delete a; // warning: mismatch in array forms of expressions
4053 char *p = new char[n];
4054 free (p); // warning: mismatch between new and free
4058 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4059 involving allocation and deallocation functions other than @code{operator
4060 new} and @code{operator delete}.
4062 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4064 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4065 @opindex Wmismatched-tags
4066 @opindex Wno-mismatched-tags
4067 Warn for declarations of structs, classes, and class templates and their
4068 specializations with a class-key that does not match either the definition
4069 or the first declaration if no definition is provided.
4071 For example, the declaration of @code{struct Object} in the argument list
4072 of @code{draw} triggers the warning. To avoid it, either remove the redundant
4073 class-key @code{struct} or replace it with @code{class} to match its definition.
4077 virtual ~Object () = 0;
4079 void draw (struct Object*);
4082 It is not wrong to declare a class with the class-key @code{struct} as
4083 the example above shows. The @option{-Wmismatched-tags} option is intended
4084 to help achieve a consistent style of class declarations. In code that is
4085 intended to be portable to Windows-based compilers the warning helps prevent
4086 unresolved references due to the difference in the mangling of symbols
4087 declared with different class-keys. The option can be used either on its
4088 own or in conjunction with @option{-Wredundant-tags}.
4090 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4091 @opindex Wmultiple-inheritance
4092 @opindex Wno-multiple-inheritance
4093 Warn when a class is defined with multiple direct base classes. Some
4094 coding rules disallow multiple inheritance, and this may be used to
4095 enforce that rule. The warning is inactive inside a system header file,
4096 such as the STL, so one can still use the STL. One may also define
4097 classes that indirectly use multiple inheritance.
4099 @item -Wvirtual-inheritance
4100 @opindex Wvirtual-inheritance
4101 @opindex Wno-virtual-inheritance
4102 Warn when a class is defined with a virtual direct base class. Some
4103 coding rules disallow multiple inheritance, and this may be used to
4104 enforce that rule. The warning is inactive inside a system header file,
4105 such as the STL, so one can still use the STL. One may also define
4106 classes that indirectly use virtual inheritance.
4108 @item -Wno-virtual-move-assign
4109 @opindex Wvirtual-move-assign
4110 @opindex Wno-virtual-move-assign
4111 Suppress warnings about inheriting from a virtual base with a
4112 non-trivial C++11 move assignment operator. This is dangerous because
4113 if the virtual base is reachable along more than one path, it is
4114 moved multiple times, which can mean both objects end up in the
4115 moved-from state. If the move assignment operator is written to avoid
4116 moving from a moved-from object, this warning can be disabled.
4119 @opindex Wnamespaces
4120 @opindex Wno-namespaces
4121 Warn when a namespace definition is opened. Some coding rules disallow
4122 namespaces, and this may be used to enforce that rule. The warning is
4123 inactive inside a system header file, such as the STL, so one can still
4124 use the STL. One may also use using directives and qualified names.
4126 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4128 @opindex Wno-terminate
4129 Disable the warning about a throw-expression that will immediately
4130 result in a call to @code{terminate}.
4132 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4133 @opindex Wvexing-parse
4134 @opindex Wno-vexing-parse
4135 Warn about the most vexing parse syntactic ambiguity. This warns about
4136 the cases when a declaration looks like a variable definition, but the
4137 C++ language requires it to be interpreted as a function declaration.
4142 int i(); // extern int i (void);
4143 int n(int(a)); // extern int n (int);
4150 struct S @{ S(int); @};
4152 S x(int(a)); // extern struct S x (int);
4153 S y(int()); // extern struct S y (int (*) (void));
4154 S z(); // extern struct S z (void);
4158 The warning will suggest options how to deal with such an ambiguity; e.g.,
4159 it can suggest removing the parentheses or using braces instead.
4161 This warning is enabled by default.
4163 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4164 @opindex Wno-class-conversion
4165 @opindex Wclass-conversion
4166 Do not warn when a conversion function converts an
4167 object to the same type, to a base class of that type, or to void; such
4168 a conversion function will never be called.
4170 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4172 @opindex Wno-volatile
4173 Warn about deprecated uses of the @code{volatile} qualifier. This includes
4174 postfix and prefix @code{++} and @code{--} expressions of
4175 @code{volatile}-qualified types, using simple assignments where the left
4176 operand is a @code{volatile}-qualified non-class type for their value,
4177 compound assignments where the left operand is a @code{volatile}-qualified
4178 non-class type, @code{volatile}-qualified function return type,
4179 @code{volatile}-qualified parameter type, and structured bindings of a
4180 @code{volatile}-qualified type. This usage was deprecated in C++20.
4182 Enabled by default with @option{-std=c++20}.
4184 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4185 @opindex Wzero-as-null-pointer-constant
4186 @opindex Wno-zero-as-null-pointer-constant
4187 Warn when a literal @samp{0} is used as null pointer constant. This can
4188 be useful to facilitate the conversion to @code{nullptr} in C++11.
4191 @opindex Waligned-new
4192 @opindex Wno-aligned-new
4193 Warn about a new-expression of a type that requires greater alignment
4194 than the @code{alignof(std::max_align_t)} but uses an allocation
4195 function without an explicit alignment parameter. This option is
4196 enabled by @option{-Wall}.
4198 Normally this only warns about global allocation functions, but
4199 @option{-Waligned-new=all} also warns about class member allocation
4202 @item -Wno-placement-new
4203 @itemx -Wplacement-new=@var{n}
4204 @opindex Wplacement-new
4205 @opindex Wno-placement-new
4206 Warn about placement new expressions with undefined behavior, such as
4207 constructing an object in a buffer that is smaller than the type of
4208 the object. For example, the placement new expression below is diagnosed
4209 because it attempts to construct an array of 64 integers in a buffer only
4215 This warning is enabled by default.
4218 @item -Wplacement-new=1
4219 This is the default warning level of @option{-Wplacement-new}. At this
4220 level the warning is not issued for some strictly undefined constructs that
4221 GCC allows as extensions for compatibility with legacy code. For example,
4222 the following @code{new} expression is not diagnosed at this level even
4223 though it has undefined behavior according to the C++ standard because
4224 it writes past the end of the one-element array.
4226 struct S @{ int n, a[1]; @};
4227 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4228 new (s->a)int [32]();
4231 @item -Wplacement-new=2
4232 At this level, in addition to diagnosing all the same constructs as at level
4233 1, a diagnostic is also issued for placement new expressions that construct
4234 an object in the last member of structure whose type is an array of a single
4235 element and whose size is less than the size of the object being constructed.
4236 While the previous example would be diagnosed, the following construct makes
4237 use of the flexible member array extension to avoid the warning at level 2.
4239 struct S @{ int n, a[]; @};
4240 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4241 new (s->a)int [32]();
4247 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4248 @opindex Wcatch-value
4249 @opindex Wno-catch-value
4250 Warn about catch handlers that do not catch via reference.
4251 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4252 warn about polymorphic class types that are caught by value.
4253 With @option{-Wcatch-value=2} warn about all class types that are caught
4254 by value. With @option{-Wcatch-value=3} warn about all types that are
4255 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4257 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4258 @opindex Wconditionally-supported
4259 @opindex Wno-conditionally-supported
4260 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4262 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4263 @opindex Wdelete-incomplete
4264 @opindex Wno-delete-incomplete
4265 Do not warn when deleting a pointer to incomplete type, which may cause
4266 undefined behavior at runtime. This warning is enabled by default.
4268 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4269 @opindex Wextra-semi
4270 @opindex Wno-extra-semi
4271 Warn about redundant semicolons after in-class function definitions.
4273 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4274 @opindex Winaccessible-base
4275 @opindex Wno-inaccessible-base
4276 This option controls warnings
4277 when a base class is inaccessible in a class derived from it due to
4278 ambiguity. The warning is enabled by default.
4279 Note that the warning for ambiguous virtual
4280 bases is enabled by the @option{-Wextra} option.
4283 struct A @{ int a; @};
4287 struct C : B, A @{ @};
4291 @item -Wno-inherited-variadic-ctor
4292 @opindex Winherited-variadic-ctor
4293 @opindex Wno-inherited-variadic-ctor
4294 Suppress warnings about use of C++11 inheriting constructors when the
4295 base class inherited from has a C variadic constructor; the warning is
4296 on by default because the ellipsis is not inherited.
4298 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4299 @opindex Wno-invalid-offsetof
4300 @opindex Winvalid-offsetof
4301 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4302 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
4303 to a non-standard-layout type is undefined. In existing C++ implementations,
4304 however, @code{offsetof} typically gives meaningful results.
4305 This flag is for users who are aware that they are
4306 writing nonportable code and who have deliberately chosen to ignore the
4309 The restrictions on @code{offsetof} may be relaxed in a future version
4310 of the C++ standard.
4312 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4313 @opindex Wsized-deallocation
4314 @opindex Wno-sized-deallocation
4315 Warn about a definition of an unsized deallocation function
4317 void operator delete (void *) noexcept;
4318 void operator delete[] (void *) noexcept;
4320 without a definition of the corresponding sized deallocation function
4322 void operator delete (void *, std::size_t) noexcept;
4323 void operator delete[] (void *, std::size_t) noexcept;
4325 or vice versa. Enabled by @option{-Wextra} along with
4326 @option{-fsized-deallocation}.
4328 @item -Wsuggest-final-types
4329 @opindex Wno-suggest-final-types
4330 @opindex Wsuggest-final-types
4331 Warn about types with virtual methods where code quality would be improved
4332 if the type were declared with the C++11 @code{final} specifier,
4334 declared in an anonymous namespace. This allows GCC to more aggressively
4335 devirtualize the polymorphic calls. This warning is more effective with
4336 link-time optimization,
4337 where the information about the class hierarchy graph is
4340 @item -Wsuggest-final-methods
4341 @opindex Wno-suggest-final-methods
4342 @opindex Wsuggest-final-methods
4343 Warn about virtual methods where code quality would be improved if the method
4344 were declared with the C++11 @code{final} specifier,
4345 or, if possible, its type were
4346 declared in an anonymous namespace or with the @code{final} specifier.
4348 more effective with link-time optimization, where the information about the
4349 class hierarchy graph is more complete. It is recommended to first consider
4350 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4353 @item -Wsuggest-override
4354 @opindex Wsuggest-override
4355 @opindex Wno-suggest-override
4356 Warn about overriding virtual functions that are not marked with the
4357 @code{override} keyword.
4359 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4360 @opindex Wuseless-cast
4361 @opindex Wno-useless-cast
4362 Warn when an expression is casted to its own type.
4364 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4365 @opindex Wconversion-null
4366 @opindex Wno-conversion-null
4367 Do not warn for conversions between @code{NULL} and non-pointer
4368 types. @option{-Wconversion-null} is enabled by default.
4372 @node Objective-C and Objective-C++ Dialect Options
4373 @section Options Controlling Objective-C and Objective-C++ Dialects
4375 @cindex compiler options, Objective-C and Objective-C++
4376 @cindex Objective-C and Objective-C++ options, command-line
4377 @cindex options, Objective-C and Objective-C++
4378 (NOTE: This manual does not describe the Objective-C and Objective-C++
4379 languages themselves. @xref{Standards,,Language Standards
4380 Supported by GCC}, for references.)
4382 This section describes the command-line options that are only meaningful
4383 for Objective-C and Objective-C++ programs. You can also use most of
4384 the language-independent GNU compiler options.
4385 For example, you might compile a file @file{some_class.m} like this:
4388 gcc -g -fgnu-runtime -O -c some_class.m
4392 In this example, @option{-fgnu-runtime} is an option meant only for
4393 Objective-C and Objective-C++ programs; you can use the other options with
4394 any language supported by GCC@.
4396 Note that since Objective-C is an extension of the C language, Objective-C
4397 compilations may also use options specific to the C front-end (e.g.,
4398 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
4399 C++-specific options (e.g., @option{-Wabi}).
4401 Here is a list of options that are @emph{only} for compiling Objective-C
4402 and Objective-C++ programs:
4405 @item -fconstant-string-class=@var{class-name}
4406 @opindex fconstant-string-class
4407 Use @var{class-name} as the name of the class to instantiate for each
4408 literal string specified with the syntax @code{@@"@dots{}"}. The default
4409 class name is @code{NXConstantString} if the GNU runtime is being used, and
4410 @code{NSConstantString} if the NeXT runtime is being used (see below). The
4411 @option{-fconstant-cfstrings} option, if also present, overrides the
4412 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4413 to be laid out as constant CoreFoundation strings.
4416 @opindex fgnu-runtime
4417 Generate object code compatible with the standard GNU Objective-C
4418 runtime. This is the default for most types of systems.
4420 @item -fnext-runtime
4421 @opindex fnext-runtime
4422 Generate output compatible with the NeXT runtime. This is the default
4423 for NeXT-based systems, including Darwin and Mac OS X@. The macro
4424 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4427 @item -fno-nil-receivers
4428 @opindex fno-nil-receivers
4429 @opindex fnil-receivers
4430 Assume that all Objective-C message dispatches (@code{[receiver
4431 message:arg]}) in this translation unit ensure that the receiver is
4432 not @code{nil}. This allows for more efficient entry points in the
4433 runtime to be used. This option is only available in conjunction with
4434 the NeXT runtime and ABI version 0 or 1.
4436 @item -fobjc-abi-version=@var{n}
4437 @opindex fobjc-abi-version
4438 Use version @var{n} of the Objective-C ABI for the selected runtime.
4439 This option is currently supported only for the NeXT runtime. In that
4440 case, Version 0 is the traditional (32-bit) ABI without support for
4441 properties and other Objective-C 2.0 additions. Version 1 is the
4442 traditional (32-bit) ABI with support for properties and other
4443 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
4444 nothing is specified, the default is Version 0 on 32-bit target
4445 machines, and Version 2 on 64-bit target machines.
4447 @item -fobjc-call-cxx-cdtors
4448 @opindex fobjc-call-cxx-cdtors
4449 For each Objective-C class, check if any of its instance variables is a
4450 C++ object with a non-trivial default constructor. If so, synthesize a
4451 special @code{- (id) .cxx_construct} instance method which runs
4452 non-trivial default constructors on any such instance variables, in order,
4453 and then return @code{self}. Similarly, check if any instance variable
4454 is a C++ object with a non-trivial destructor, and if so, synthesize a
4455 special @code{- (void) .cxx_destruct} method which runs
4456 all such default destructors, in reverse order.
4458 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4459 methods thusly generated only operate on instance variables
4460 declared in the current Objective-C class, and not those inherited
4461 from superclasses. It is the responsibility of the Objective-C
4462 runtime to invoke all such methods in an object's inheritance
4463 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
4464 by the runtime immediately after a new object instance is allocated;
4465 the @code{- (void) .cxx_destruct} methods are invoked immediately
4466 before the runtime deallocates an object instance.
4468 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4469 support for invoking the @code{- (id) .cxx_construct} and
4470 @code{- (void) .cxx_destruct} methods.
4472 @item -fobjc-direct-dispatch
4473 @opindex fobjc-direct-dispatch
4474 Allow fast jumps to the message dispatcher. On Darwin this is
4475 accomplished via the comm page.
4477 @item -fobjc-exceptions
4478 @opindex fobjc-exceptions
4479 Enable syntactic support for structured exception handling in
4480 Objective-C, similar to what is offered by C++. This option
4481 is required to use the Objective-C keywords @code{@@try},
4482 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4483 @code{@@synchronized}. This option is available with both the GNU
4484 runtime and the NeXT runtime (but not available in conjunction with
4485 the NeXT runtime on Mac OS X 10.2 and earlier).
4489 Enable garbage collection (GC) in Objective-C and Objective-C++
4490 programs. This option is only available with the NeXT runtime; the
4491 GNU runtime has a different garbage collection implementation that
4492 does not require special compiler flags.
4494 @item -fobjc-nilcheck
4495 @opindex fobjc-nilcheck
4496 For the NeXT runtime with version 2 of the ABI, check for a nil
4497 receiver in method invocations before doing the actual method call.
4498 This is the default and can be disabled using
4499 @option{-fno-objc-nilcheck}. Class methods and super calls are never
4500 checked for nil in this way no matter what this flag is set to.
4501 Currently this flag does nothing when the GNU runtime, or an older
4502 version of the NeXT runtime ABI, is used.
4504 @item -fobjc-std=objc1
4506 Conform to the language syntax of Objective-C 1.0, the language
4507 recognized by GCC 4.0. This only affects the Objective-C additions to
4508 the C/C++ language; it does not affect conformance to C/C++ standards,
4509 which is controlled by the separate C/C++ dialect option flags. When
4510 this option is used with the Objective-C or Objective-C++ compiler,
4511 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4512 This is useful if you need to make sure that your Objective-C code can
4513 be compiled with older versions of GCC@.
4515 @item -freplace-objc-classes
4516 @opindex freplace-objc-classes
4517 Emit a special marker instructing @command{ld(1)} not to statically link in
4518 the resulting object file, and allow @command{dyld(1)} to load it in at
4519 run time instead. This is used in conjunction with the Fix-and-Continue
4520 debugging mode, where the object file in question may be recompiled and
4521 dynamically reloaded in the course of program execution, without the need
4522 to restart the program itself. Currently, Fix-and-Continue functionality
4523 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4528 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4529 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4530 compile time) with static class references that get initialized at load time,
4531 which improves run-time performance. Specifying the @option{-fzero-link} flag
4532 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4533 to be retained. This is useful in Zero-Link debugging mode, since it allows
4534 for individual class implementations to be modified during program execution.
4535 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4536 regardless of command-line options.
4538 @item -fno-local-ivars
4539 @opindex fno-local-ivars
4540 @opindex flocal-ivars
4541 By default instance variables in Objective-C can be accessed as if
4542 they were local variables from within the methods of the class they're
4543 declared in. This can lead to shadowing between instance variables
4544 and other variables declared either locally inside a class method or
4545 globally with the same name. Specifying the @option{-fno-local-ivars}
4546 flag disables this behavior thus avoiding variable shadowing issues.
4548 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4549 @opindex fivar-visibility
4550 Set the default instance variable visibility to the specified option
4551 so that instance variables declared outside the scope of any access
4552 modifier directives default to the specified visibility.
4556 Dump interface declarations for all classes seen in the source file to a
4557 file named @file{@var{sourcename}.decl}.
4559 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4560 @opindex Wassign-intercept
4561 @opindex Wno-assign-intercept
4562 Warn whenever an Objective-C assignment is being intercepted by the
4565 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4566 @opindex Wproperty-assign-default
4567 @opindex Wno-property-assign-default
4568 Do not warn if a property for an Objective-C object has no assign
4569 semantics specified.
4571 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4572 @opindex Wno-protocol
4574 If a class is declared to implement a protocol, a warning is issued for
4575 every method in the protocol that is not implemented by the class. The
4576 default behavior is to issue a warning for every method not explicitly
4577 implemented in the class, even if a method implementation is inherited
4578 from the superclass. If you use the @option{-Wno-protocol} option, then
4579 methods inherited from the superclass are considered to be implemented,
4580 and no warning is issued for them.
4582 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4583 @opindex Wobjc-root-class
4584 Warn if a class interface lacks a superclass. Most classes will inherit
4585 from @code{NSObject} (or @code{Object}) for example. When declaring
4586 classes intended to be root classes, the warning can be suppressed by
4587 marking their interfaces with @code{__attribute__((objc_root_class))}.
4589 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4591 @opindex Wno-selector
4592 Warn if multiple methods of different types for the same selector are
4593 found during compilation. The check is performed on the list of methods
4594 in the final stage of compilation. Additionally, a check is performed
4595 for each selector appearing in a @code{@@selector(@dots{})}
4596 expression, and a corresponding method for that selector has been found
4597 during compilation. Because these checks scan the method table only at
4598 the end of compilation, these warnings are not produced if the final
4599 stage of compilation is not reached, for example because an error is
4600 found during compilation, or because the @option{-fsyntax-only} option is
4603 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4604 @opindex Wstrict-selector-match
4605 @opindex Wno-strict-selector-match
4606 Warn if multiple methods with differing argument and/or return types are
4607 found for a given selector when attempting to send a message using this
4608 selector to a receiver of type @code{id} or @code{Class}. When this flag
4609 is off (which is the default behavior), the compiler omits such warnings
4610 if any differences found are confined to types that share the same size
4613 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4614 @opindex Wundeclared-selector
4615 @opindex Wno-undeclared-selector
4616 Warn if a @code{@@selector(@dots{})} expression referring to an
4617 undeclared selector is found. A selector is considered undeclared if no
4618 method with that name has been declared before the
4619 @code{@@selector(@dots{})} expression, either explicitly in an
4620 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4621 an @code{@@implementation} section. This option always performs its
4622 checks as soon as a @code{@@selector(@dots{})} expression is found,
4623 while @option{-Wselector} only performs its checks in the final stage of
4624 compilation. This also enforces the coding style convention
4625 that methods and selectors must be declared before being used.
4627 @item -print-objc-runtime-info
4628 @opindex print-objc-runtime-info
4629 Generate C header describing the largest structure that is passed by
4634 @node Diagnostic Message Formatting Options
4635 @section Options to Control Diagnostic Messages Formatting
4636 @cindex options to control diagnostics formatting
4637 @cindex diagnostic messages
4638 @cindex message formatting
4640 Traditionally, diagnostic messages have been formatted irrespective of
4641 the output device's aspect (e.g.@: its width, @dots{}). You can use the
4642 options described below
4643 to control the formatting algorithm for diagnostic messages,
4644 e.g.@: how many characters per line, how often source location
4645 information should be reported. Note that some language front ends may not
4646 honor these options.
4649 @item -fmessage-length=@var{n}
4650 @opindex fmessage-length
4651 Try to format error messages so that they fit on lines of about
4652 @var{n} characters. If @var{n} is zero, then no line-wrapping is
4653 done; each error message appears on a single line. This is the
4654 default for all front ends.
4656 Note - this option also affects the display of the @samp{#error} and
4657 @samp{#warning} pre-processor directives, and the @samp{deprecated}
4658 function/type/variable attribute. It does not however affect the
4659 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
4661 @item -fdiagnostics-plain-output
4662 This option requests that diagnostic output look as plain as possible, which
4663 may be useful when running @command{dejagnu} or other utilities that need to
4664 parse diagnostics output and prefer that it remain more stable over time.
4665 @option{-fdiagnostics-plain-output} is currently equivalent to the following
4667 @gccoptlist{-fno-diagnostics-show-caret @gol
4668 -fno-diagnostics-show-line-numbers @gol
4669 -fdiagnostics-color=never @gol
4670 -fdiagnostics-urls=never @gol
4671 -fdiagnostics-path-format=separate-events}
4672 In the future, if GCC changes the default appearance of its diagnostics, the
4673 corresponding option to disable the new behavior will be added to this list.
4675 @item -fdiagnostics-show-location=once
4676 @opindex fdiagnostics-show-location
4677 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
4678 reporter to emit source location information @emph{once}; that is, in
4679 case the message is too long to fit on a single physical line and has to
4680 be wrapped, the source location won't be emitted (as prefix) again,
4681 over and over, in subsequent continuation lines. This is the default
4684 @item -fdiagnostics-show-location=every-line
4685 Only meaningful in line-wrapping mode. Instructs the diagnostic
4686 messages reporter to emit the same source location information (as
4687 prefix) for physical lines that result from the process of breaking
4688 a message which is too long to fit on a single line.
4690 @item -fdiagnostics-color[=@var{WHEN}]
4691 @itemx -fno-diagnostics-color
4692 @opindex fdiagnostics-color
4693 @cindex highlight, color
4694 @vindex GCC_COLORS @r{environment variable}
4695 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
4696 or @samp{auto}. The default depends on how the compiler has been configured,
4697 it can be any of the above @var{WHEN} options or also @samp{never}
4698 if @env{GCC_COLORS} environment variable isn't present in the environment,
4699 and @samp{auto} otherwise.
4700 @samp{auto} makes GCC use color only when the standard error is a terminal,
4701 and when not executing in an emacs shell.
4702 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4703 aliases for @option{-fdiagnostics-color=always} and
4704 @option{-fdiagnostics-color=never}, respectively.
4706 The colors are defined by the environment variable @env{GCC_COLORS}.
4707 Its value is a colon-separated list of capabilities and Select Graphic
4708 Rendition (SGR) substrings. SGR commands are interpreted by the
4709 terminal or terminal emulator. (See the section in the documentation
4710 of your text terminal for permitted values and their meanings as
4711 character attributes.) These substring values are integers in decimal
4712 representation and can be concatenated with semicolons.
4713 Common values to concatenate include
4715 @samp{4} for underline,
4717 @samp{7} for inverse,
4718 @samp{39} for default foreground color,
4719 @samp{30} to @samp{37} for foreground colors,
4720 @samp{90} to @samp{97} for 16-color mode foreground colors,
4721 @samp{38;5;0} to @samp{38;5;255}
4722 for 88-color and 256-color modes foreground colors,
4723 @samp{49} for default background color,
4724 @samp{40} to @samp{47} for background colors,
4725 @samp{100} to @samp{107} for 16-color mode background colors,
4726 and @samp{48;5;0} to @samp{48;5;255}
4727 for 88-color and 256-color modes background colors.
4729 The default @env{GCC_COLORS} is
4731 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4732 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4733 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4737 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4738 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4739 @samp{01} is bold, and @samp{31} is red.
4740 Setting @env{GCC_COLORS} to the empty string disables colors.
4741 Supported capabilities are as follows.
4745 @vindex error GCC_COLORS @r{capability}
4746 SGR substring for error: markers.
4749 @vindex warning GCC_COLORS @r{capability}
4750 SGR substring for warning: markers.
4753 @vindex note GCC_COLORS @r{capability}
4754 SGR substring for note: markers.
4757 @vindex path GCC_COLORS @r{capability}
4758 SGR substring for colorizing paths of control-flow events as printed
4759 via @option{-fdiagnostics-path-format=}, such as the identifiers of
4760 individual events and lines indicating interprocedural calls and returns.
4763 @vindex range1 GCC_COLORS @r{capability}
4764 SGR substring for first additional range.
4767 @vindex range2 GCC_COLORS @r{capability}
4768 SGR substring for second additional range.
4771 @vindex locus GCC_COLORS @r{capability}
4772 SGR substring for location information, @samp{file:line} or
4773 @samp{file:line:column} etc.
4776 @vindex quote GCC_COLORS @r{capability}
4777 SGR substring for information printed within quotes.
4780 @vindex fixit-insert GCC_COLORS @r{capability}
4781 SGR substring for fix-it hints suggesting text to
4782 be inserted or replaced.
4785 @vindex fixit-delete GCC_COLORS @r{capability}
4786 SGR substring for fix-it hints suggesting text to
4789 @item diff-filename=
4790 @vindex diff-filename GCC_COLORS @r{capability}
4791 SGR substring for filename headers within generated patches.
4794 @vindex diff-hunk GCC_COLORS @r{capability}
4795 SGR substring for the starts of hunks within generated patches.
4798 @vindex diff-delete GCC_COLORS @r{capability}
4799 SGR substring for deleted lines within generated patches.
4802 @vindex diff-insert GCC_COLORS @r{capability}
4803 SGR substring for inserted lines within generated patches.
4806 @vindex type-diff GCC_COLORS @r{capability}
4807 SGR substring for highlighting mismatching types within template
4808 arguments in the C++ frontend.
4811 @item -fdiagnostics-urls[=@var{WHEN}]
4812 @opindex fdiagnostics-urls
4814 @vindex GCC_URLS @r{environment variable}
4815 @vindex TERM_URLS @r{environment variable}
4816 Use escape sequences to embed URLs in diagnostics. For example, when
4817 @option{-fdiagnostics-show-option} emits text showing the command-line
4818 option controlling a diagnostic, embed a URL for documentation of that
4821 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4822 @samp{auto} makes GCC use URL escape sequences only when the standard error
4823 is a terminal, and when not executing in an emacs shell or any graphical
4824 terminal which is known to be incompatible with this feature, see below.
4826 The default depends on how the compiler has been configured.
4827 It can be any of the above @var{WHEN} options.
4829 GCC can also be configured (via the
4830 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4831 so that the default is affected by environment variables.
4832 Under such a configuration, GCC defaults to using @samp{auto}
4833 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4834 present and non-empty in the environment of the compiler, or @samp{never}
4837 However, even with @option{-fdiagnostics-urls=always} the behavior is
4838 dependent on those environment variables:
4839 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4840 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
4841 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4842 Any other non-empty value enables the feature.
4843 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4844 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4845 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4847 At this time GCC tries to detect also a few terminals that are known to
4848 not implement the URL feature, and have bugs or at least had bugs in
4849 some versions that are still in use, where the URL escapes are likely
4850 to misbehave, i.e. print garbage on the screen.
4851 That list is currently xfce4-terminal, certain known to be buggy
4852 gnome-terminal versions, the linux console, and mingw.
4853 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4855 @item -fno-diagnostics-show-option
4856 @opindex fno-diagnostics-show-option
4857 @opindex fdiagnostics-show-option
4858 By default, each diagnostic emitted includes text indicating the
4859 command-line option that directly controls the diagnostic (if such an
4860 option is known to the diagnostic machinery). Specifying the
4861 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4863 @item -fno-diagnostics-show-caret
4864 @opindex fno-diagnostics-show-caret
4865 @opindex fdiagnostics-show-caret
4866 By default, each diagnostic emitted includes the original source line
4867 and a caret @samp{^} indicating the column. This option suppresses this
4868 information. The source line is truncated to @var{n} characters, if
4869 the @option{-fmessage-length=n} option is given. When the output is done
4870 to the terminal, the width is limited to the width given by the
4871 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4873 @item -fno-diagnostics-show-labels
4874 @opindex fno-diagnostics-show-labels
4875 @opindex fdiagnostics-show-labels
4876 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4877 diagnostics can label ranges of source code with pertinent information, such
4878 as the types of expressions:
4881 printf ("foo %s bar", long_i + long_j);
4887 This option suppresses the printing of these labels (in the example above,
4888 the vertical bars and the ``char *'' and ``long int'' text).
4890 @item -fno-diagnostics-show-cwe
4891 @opindex fno-diagnostics-show-cwe
4892 @opindex fdiagnostics-show-cwe
4893 Diagnostic messages can optionally have an associated
4894 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4895 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4896 diagnostics. GCC plugins may also provide diagnostics with such metadata.
4897 By default, if this information is present, it will be printed with
4898 the diagnostic. This option suppresses the printing of this metadata.
4900 @item -fno-diagnostics-show-line-numbers
4901 @opindex fno-diagnostics-show-line-numbers
4902 @opindex fdiagnostics-show-line-numbers
4903 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4904 a left margin is printed, showing line numbers. This option suppresses this
4907 @item -fdiagnostics-minimum-margin-width=@var{width}
4908 @opindex fdiagnostics-minimum-margin-width
4909 This option controls the minimum width of the left margin printed by
4910 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
4912 @item -fdiagnostics-parseable-fixits
4913 @opindex fdiagnostics-parseable-fixits
4914 Emit fix-it hints in a machine-parseable format, suitable for consumption
4915 by IDEs. For each fix-it, a line will be printed after the relevant
4916 diagnostic, starting with the string ``fix-it:''. For example:
4919 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4922 The location is expressed as a half-open range, expressed as a count of
4923 bytes, starting at byte 1 for the initial column. In the above example,
4924 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4928 00000000011111111112222222222
4929 12345678901234567890123456789
4930 gtk_widget_showall (dlg);
4935 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4936 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4937 (e.g. vertical tab as ``\013'').
4939 An empty replacement string indicates that the given range is to be removed.
4940 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4941 be inserted at the given position.
4943 @item -fdiagnostics-generate-patch
4944 @opindex fdiagnostics-generate-patch
4945 Print fix-it hints to stderr in unified diff format, after any diagnostics
4946 are printed. For example:
4953 void show_cb(GtkDialog *dlg)
4955 - gtk_widget_showall(dlg);
4956 + gtk_widget_show_all(dlg);
4961 The diff may or may not be colorized, following the same rules
4962 as for diagnostics (see @option{-fdiagnostics-color}).
4964 @item -fdiagnostics-show-template-tree
4965 @opindex fdiagnostics-show-template-tree
4967 In the C++ frontend, when printing diagnostics showing mismatching
4968 template types, such as:
4971 could not convert 'std::map<int, std::vector<double> >()'
4972 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4975 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4976 tree-like structure showing the common and differing parts of the types,
4986 The parts that differ are highlighted with color (``double'' and
4987 ``float'' in this case).
4989 @item -fno-elide-type
4990 @opindex fno-elide-type
4991 @opindex felide-type
4992 By default when the C++ frontend prints diagnostics showing mismatching
4993 template types, common parts of the types are printed as ``[...]'' to
4994 simplify the error message. For example:
4997 could not convert 'std::map<int, std::vector<double> >()'
4998 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5001 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5002 This flag also affects the output of the
5003 @option{-fdiagnostics-show-template-tree} flag.
5005 @item -fdiagnostics-path-format=@var{KIND}
5006 @opindex fdiagnostics-path-format
5007 Specify how to print paths of control-flow events for diagnostics that
5008 have such a path associated with them.
5010 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5013 @samp{none} means to not print diagnostic paths.
5015 @samp{separate-events} means to print a separate ``note'' diagnostic for
5016 each event within the diagnostic. For example:
5019 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5020 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5021 test.c:27:3: note: (2) when 'i < count'
5022 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5025 @samp{inline-events} means to print the events ``inline'' within the source
5026 code. This view attempts to consolidate the events into runs of
5027 sufficiently-close events, printing them as labelled ranges within the source.
5029 For example, the same events as above might be printed as:
5034 | 25 | list = PyList_New(0);
5037 | | (1) when 'PyList_New' fails, returning NULL
5039 | 27 | for (i = 0; i < count; i++) @{
5042 | | (2) when 'i < count'
5043 | 28 | item = PyLong_FromLong(random());
5044 | 29 | PyList_Append(list, item);
5045 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
5047 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5051 Interprocedural control flow is shown by grouping the events by stack frame,
5052 and using indentation to show how stack frames are nested, pushed, and popped.
5062 | | (1) entering 'test'
5063 | 134 | boxed_int *obj = make_boxed_int (i);
5064 | | ~~~~~~~~~~~~~~~~~~
5066 | | (2) calling 'make_boxed_int'
5068 +--> 'make_boxed_int': events 3-4
5073 | | (3) entering 'make_boxed_int'
5074 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5075 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5077 | | (4) calling 'wrapped_malloc'
5079 +--> 'wrapped_malloc': events 5-6
5084 | | (5) entering 'wrapped_malloc'
5085 | 8 | return malloc (size);
5088 | | (6) calling 'malloc'
5094 | 138 | free_boxed_int (obj);
5095 | | ^~~~~~~~~~~~~~~~~~~~
5097 | | (7) calling 'free_boxed_int'
5102 @item -fdiagnostics-show-path-depths
5103 @opindex fdiagnostics-show-path-depths
5104 This option provides additional information when printing control-flow paths
5105 associated with a diagnostic.
5107 If this is option is provided then the stack depth will be printed for
5108 each run of events within @option{-fdiagnostics-path-format=separate-events}.
5110 This is intended for use by GCC developers and plugin developers when
5111 debugging diagnostics that report interprocedural control flow.
5113 @item -fno-show-column
5114 @opindex fno-show-column
5115 @opindex fshow-column
5116 Do not print column numbers in diagnostics. This may be necessary if
5117 diagnostics are being scanned by a program that does not understand the
5118 column numbers, such as @command{dejagnu}.
5120 @item -fdiagnostics-column-unit=@var{UNIT}
5121 @opindex fdiagnostics-column-unit
5122 Select the units for the column number. This affects traditional diagnostics
5123 (in the absence of @option{-fno-show-column}), as well as JSON format
5124 diagnostics if requested.
5126 The default @var{UNIT}, @samp{display}, considers the number of display
5127 columns occupied by each character. This may be larger than the number
5128 of bytes required to encode the character, in the case of tab
5129 characters, or it may be smaller, in the case of multibyte characters.
5130 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5131 display column, and its UTF-8 encoding requires two bytes; the character
5132 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5133 its UTF-8 encoding requires four bytes.
5135 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5136 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5138 @item -fdiagnostics-column-origin=@var{ORIGIN}
5139 @opindex fdiagnostics-column-origin
5140 Select the origin for column numbers, i.e. the column number assigned to the
5141 first column. The default value of 1 corresponds to traditional GCC
5142 behavior and to the GNU style guide. Some utilities may perform better with an
5143 origin of 0; any non-negative value may be specified.
5145 @item -fdiagnostics-escape-format=@var{FORMAT}
5146 @opindex fdiagnostics-escape-format
5147 When GCC prints pertinent source lines for a diagnostic it normally attempts
5148 to print the source bytes directly. However, some diagnostics relate to encoding
5149 issues in the source file, such as malformed UTF-8, or issues with Unicode
5150 normalization. These diagnostics are flagged so that GCC will escape bytes
5151 that are not printable ASCII when printing their pertinent source lines.
5153 This option controls how such bytes should be escaped.
5155 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5156 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5157 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5158 displayed as hexadecimal in the form @samp{<XX>}.
5160 For example, a source line containing the string @samp{before} followed by the
5161 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5162 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5163 the string @samp{after} will be printed for such a diagnostic as:
5166 before<U+03C0><BF>after
5169 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5170 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5171 Unicode characters. For the example above, the following will be printed:
5174 before<CF><80><BF>after
5177 @item -fdiagnostics-format=@var{FORMAT}
5178 @opindex fdiagnostics-format
5179 Select a different format for printing diagnostics.
5180 @var{FORMAT} is @samp{text} or @samp{json}.
5181 The default is @samp{text}.
5183 The @samp{json} format consists of a top-level JSON array containing JSON
5184 objects representing the diagnostics.
5186 The JSON is emitted as one line, without formatting; the examples below
5187 have been formatted for clarity.
5189 Diagnostics can have child diagnostics. For example, this error and note:
5192 misleading-indentation.c:15:3: warning: this 'if' clause does not
5193 guard... [-Wmisleading-indentation]
5196 misleading-indentation.c:17:5: note: ...this statement, but the latter
5197 is misleadingly indented as if it were guarded by the 'if'
5203 might be printed in JSON form (after formatting) like this:
5212 "display-column": 3,
5215 "file": "misleading-indentation.c",
5219 "display-column": 4,
5222 "file": "misleading-indentation.c",
5227 "message": "this \u2018if\u2019 clause does not guard...",
5228 "option": "-Wmisleading-indentation",
5229 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5236 "display-column": 5,
5239 "file": "misleading-indentation.c",
5244 "escape-source": false,
5245 "message": "...this statement, but the latter is @dots{}"
5248 "escape-source": false,
5255 where the @code{note} is a child of the @code{warning}.
5257 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
5258 an @code{option} key describing the command-line option controlling the
5261 A diagnostic can contain zero or more locations. Each location has an
5262 optional @code{label} string and up to three positions within it: a
5263 @code{caret} position and optional @code{start} and @code{finish} positions.
5264 A position is described by a @code{file} name, a @code{line} number, and
5265 three numbers indicating a column position:
5269 @code{display-column} counts display columns, accounting for tabs and
5270 multibyte characters.
5273 @code{byte-column} counts raw bytes.
5276 @code{column} is equal to one of
5277 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5281 All three columns are relative to the origin specified by
5282 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5283 be set, for instance, to 0 for compatibility with other utilities that
5284 number columns from 0. The column origin is recorded in the JSON output in
5285 the @code{column-origin} tag. In the remaining examples below, the extra
5286 column number outputs have been omitted for brevity.
5288 For example, this error:
5291 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5292 'struct s'@} and 'T' @{aka 'struct t'@})
5293 64 | return callee_4a () + callee_4b ();
5294 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5296 | | T @{aka struct t@}
5297 | S @{aka struct s@}
5301 has three locations. Its primary location is at the ``+'' token at column
5302 23. It has two secondary locations, describing the left and right-hand sides
5303 of the expression, which have labels. It might be printed in JSON form as:
5312 "column": 23, "file": "bad-binary-ops.c", "line": 64
5317 "column": 10, "file": "bad-binary-ops.c", "line": 64
5320 "column": 21, "file": "bad-binary-ops.c", "line": 64
5322 "label": "S @{aka struct s@}"
5326 "column": 25, "file": "bad-binary-ops.c", "line": 64
5329 "column": 36, "file": "bad-binary-ops.c", "line": 64
5331 "label": "T @{aka struct t@}"
5334 "escape-source": false,
5335 "message": "invalid operands to binary + @dots{}"
5339 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5340 consisting of half-open intervals, similar to the output of
5341 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
5342 with a replacement fix-it hint:
5345 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5347 8 | return ptr->colour;
5353 might be printed in JSON form as:
5388 "escape-source": false,
5389 "message": "\u2018struct s\u2019 has no member named @dots{}"
5394 where the fix-it hint suggests replacing the text from @code{start} up
5395 to but not including @code{next} with @code{string}'s value. Deletions
5396 are expressed via an empty value for @code{string}, insertions by
5397 having @code{start} equal @code{next}.
5399 If the diagnostic has a path of control-flow events associated with it,
5400 it has a @code{path} array of objects representing the events. Each
5401 event object has a @code{description} string, a @code{location} object,
5402 along with a @code{function} string and a @code{depth} number for
5403 representing interprocedural paths. The @code{function} represents the
5404 current function at that event, and the @code{depth} represents the
5405 stack depth relative to some baseline: the higher, the more frames are
5408 For example, the intraprocedural example shown for
5409 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5415 "description": "when 'PyList_New' fails, returning NULL",
5425 "description": "when 'i < count'",
5435 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5446 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5447 non-ASCII bytes should be escaped when printing the pertinent lines of
5448 source code (@code{true} for diagnostics involving source encoding issues).
5452 @node Warning Options
5453 @section Options to Request or Suppress Warnings
5454 @cindex options to control warnings
5455 @cindex warning messages
5456 @cindex messages, warning
5457 @cindex suppressing warnings
5459 Warnings are diagnostic messages that report constructions that
5460 are not inherently erroneous but that are risky or suggest there
5461 may have been an error.
5463 The following language-independent options do not enable specific
5464 warnings but control the kinds of diagnostics produced by GCC@.
5467 @cindex syntax checking
5469 @opindex fsyntax-only
5470 Check the code for syntax errors, but don't do anything beyond that.
5472 @item -fmax-errors=@var{n}
5473 @opindex fmax-errors
5474 Limits the maximum number of error messages to @var{n}, at which point
5475 GCC bails out rather than attempting to continue processing the source
5476 code. If @var{n} is 0 (the default), there is no limit on the number
5477 of error messages produced. If @option{-Wfatal-errors} is also
5478 specified, then @option{-Wfatal-errors} takes precedence over this
5483 Inhibit all warning messages.
5488 Make all warnings into errors.
5493 Make the specified warning into an error. The specifier for a warning
5494 is appended; for example @option{-Werror=switch} turns the warnings
5495 controlled by @option{-Wswitch} into errors. This switch takes a
5496 negative form, to be used to negate @option{-Werror} for specific
5497 warnings; for example @option{-Wno-error=switch} makes
5498 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5501 The warning message for each controllable warning includes the
5502 option that controls the warning. That option can then be used with
5503 @option{-Werror=} and @option{-Wno-error=} as described above.
5504 (Printing of the option in the warning message can be disabled using the
5505 @option{-fno-diagnostics-show-option} flag.)
5507 Note that specifying @option{-Werror=}@var{foo} automatically implies
5508 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
5511 @item -Wfatal-errors
5512 @opindex Wfatal-errors
5513 @opindex Wno-fatal-errors
5514 This option causes the compiler to abort compilation on the first error
5515 occurred rather than trying to keep going and printing further error
5520 You can request many specific warnings with options beginning with
5521 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5522 implicit declarations. Each of these specific warning options also
5523 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5524 example, @option{-Wno-implicit}. This manual lists only one of the
5525 two forms, whichever is not the default. For further
5526 language-specific options also refer to @ref{C++ Dialect Options} and
5527 @ref{Objective-C and Objective-C++ Dialect Options}.
5528 Additional warnings can be produced by enabling the static analyzer;
5529 @xref{Static Analyzer Options}.
5531 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5532 options, such as @option{-Wunused}, which may turn on further options,
5533 such as @option{-Wunused-value}. The combined effect of positive and
5534 negative forms is that more specific options have priority over less
5535 specific ones, independently of their position in the command-line. For
5536 options of the same specificity, the last one takes effect. Options
5537 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5538 as if they appeared at the end of the command-line.
5540 When an unrecognized warning option is requested (e.g.,
5541 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5542 that the option is not recognized. However, if the @option{-Wno-} form
5543 is used, the behavior is slightly different: no diagnostic is
5544 produced for @option{-Wno-unknown-warning} unless other diagnostics
5545 are being produced. This allows the use of new @option{-Wno-} options
5546 with old compilers, but if something goes wrong, the compiler
5547 warns that an unrecognized option is present.
5549 The effectiveness of some warnings depends on optimizations also being
5550 enabled. For example @option{-Wsuggest-final-types} is more effective
5551 with link-time optimization and @option{-Wmaybe-uninitialized} does not
5552 warn at all unless optimization is enabled.
5559 @opindex Wno-pedantic
5560 Issue all the warnings demanded by strict ISO C and ISO C++;
5561 reject all programs that use forbidden extensions, and some other
5562 programs that do not follow ISO C and ISO C++. For ISO C, follows the
5563 version of the ISO C standard specified by any @option{-std} option used.
5565 Valid ISO C and ISO C++ programs should compile properly with or without
5566 this option (though a rare few require @option{-ansi} or a
5567 @option{-std} option specifying the required version of ISO C)@. However,
5568 without this option, certain GNU extensions and traditional C and C++
5569 features are supported as well. With this option, they are rejected.
5571 @option{-Wpedantic} does not cause warning messages for use of the
5572 alternate keywords whose names begin and end with @samp{__}. This alternate
5573 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5574 i.e. @samp{__intN__}.
5575 Pedantic warnings are also disabled in the expression that follows
5576 @code{__extension__}. However, only system header files should use
5577 these escape routes; application programs should avoid them.
5578 @xref{Alternate Keywords}.
5580 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5581 C conformance. They soon find that it does not do quite what they want:
5582 it finds some non-ISO practices, but not all---only those for which
5583 ISO C @emph{requires} a diagnostic, and some others for which
5584 diagnostics have been added.
5586 A feature to report any failure to conform to ISO C might be useful in
5587 some instances, but would require considerable additional work and would
5588 be quite different from @option{-Wpedantic}. We don't have plans to
5589 support such a feature in the near future.
5591 Where the standard specified with @option{-std} represents a GNU
5592 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5593 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5594 extended dialect is based. Warnings from @option{-Wpedantic} are given
5595 where they are required by the base standard. (It does not make sense
5596 for such warnings to be given only for features not in the specified GNU
5597 C dialect, since by definition the GNU dialects of C include all
5598 features the compiler supports with the given option, and there would be
5599 nothing to warn about.)
5601 @item -pedantic-errors
5602 @opindex pedantic-errors
5603 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
5604 requires a diagnostic, in some cases where there is undefined behavior
5605 at compile-time and in some other cases that do not prevent compilation
5606 of programs that are valid according to the standard. This is not
5607 equivalent to @option{-Werror=pedantic}, since there are errors enabled
5608 by this option and not enabled by the latter and vice versa.
5613 This enables all the warnings about constructions that some users
5614 consider questionable, and that are easy to avoid (or modify to
5615 prevent the warning), even in conjunction with macros. This also
5616 enables some language-specific warnings described in @ref{C++ Dialect
5617 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
5619 @option{-Wall} turns on the following warning flags:
5621 @gccoptlist{-Waddress @gol
5622 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
5623 -Warray-compare @gol
5624 -Warray-parameter=2 @r{(C and Objective-C only)} @gol
5626 -Wbool-operation @gol
5627 -Wc++11-compat -Wc++14-compat @gol
5628 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
5629 -Wchar-subscripts @gol
5631 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
5632 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
5634 -Wformat-overflow @gol
5635 -Wformat-truncation @gol
5636 -Wint-in-bool-context @gol
5637 -Wimplicit @r{(C and Objective-C only)} @gol
5638 -Wimplicit-int @r{(C and Objective-C only)} @gol
5639 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
5640 -Winit-self @r{(only for C++)} @gol
5641 -Wlogical-not-parentheses @gol
5642 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
5643 -Wmaybe-uninitialized @gol
5644 -Wmemset-elt-size @gol
5645 -Wmemset-transposed-args @gol
5646 -Wmisleading-indentation @r{(only for C/C++)} @gol
5647 -Wmismatched-dealloc @gol
5648 -Wmismatched-new-delete @r{(only for C/C++)} @gol
5649 -Wmissing-attributes @gol
5650 -Wmissing-braces @r{(only for C/ObjC)} @gol
5651 -Wmultistatement-macros @gol
5652 -Wnarrowing @r{(only for C++)} @gol
5654 -Wnonnull-compare @gol
5657 -Wpessimizing-move @r{(only for C++)} @gol
5659 -Wrange-loop-construct @r{(only for C++)} @gol
5663 -Wsequence-point @gol
5664 -Wsign-compare @r{(only in C++)} @gol
5665 -Wsizeof-array-div @gol
5666 -Wsizeof-pointer-div @gol
5667 -Wsizeof-pointer-memaccess @gol
5668 -Wstrict-aliasing @gol
5669 -Wstrict-overflow=1 @gol
5671 -Wtautological-compare @gol
5673 -Wuninitialized @gol
5674 -Wunknown-pragmas @gol
5675 -Wunused-function @gol
5678 -Wunused-variable @gol
5679 -Wvla-parameter @r{(C and Objective-C only)} @gol
5680 -Wvolatile-register-var @gol
5681 -Wzero-length-bounds}
5683 Note that some warning flags are not implied by @option{-Wall}. Some of
5684 them warn about constructions that users generally do not consider
5685 questionable, but which occasionally you might wish to check for;
5686 others warn about constructions that are necessary or hard to avoid in
5687 some cases, and there is no simple way to modify the code to suppress
5688 the warning. Some of them are enabled by @option{-Wextra} but many of
5689 them must be enabled individually.
5695 This enables some extra warning flags that are not enabled by
5696 @option{-Wall}. (This option used to be called @option{-W}. The older
5697 name is still supported, but the newer name is more descriptive.)
5699 @gccoptlist{-Wclobbered @gol
5700 -Wcast-function-type @gol
5701 -Wdeprecated-copy @r{(C++ only)} @gol
5703 -Wenum-conversion @r{(C only)} @gol
5704 -Wignored-qualifiers @gol
5705 -Wimplicit-fallthrough=3 @gol
5706 -Wmissing-field-initializers @gol
5707 -Wmissing-parameter-type @r{(C only)} @gol
5708 -Wold-style-declaration @r{(C only)} @gol
5709 -Woverride-init @gol
5710 -Wsign-compare @r{(C only)} @gol
5711 -Wstring-compare @gol
5712 -Wredundant-move @r{(only for C++)} @gol
5714 -Wuninitialized @gol
5715 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
5716 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
5717 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
5720 The option @option{-Wextra} also prints warning messages for the
5726 A pointer is compared against integer zero with @code{<}, @code{<=},
5727 @code{>}, or @code{>=}.
5730 (C++ only) An enumerator and a non-enumerator both appear in a
5731 conditional expression.
5734 (C++ only) Ambiguous virtual bases.
5737 (C++ only) Subscripting an array that has been declared @code{register}.
5740 (C++ only) Taking the address of a variable that has been declared
5744 (C++ only) A base class is not initialized in the copy constructor
5749 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
5753 Warn about code affected by ABI changes. This includes code that may
5754 not be compatible with the vendor-neutral C++ ABI as well as the psABI
5755 for the particular target.
5757 Since G++ now defaults to updating the ABI with each major release,
5758 normally @option{-Wabi} warns only about C++ ABI compatibility
5759 problems if there is a check added later in a release series for an
5760 ABI issue discovered since the initial release. @option{-Wabi} warns
5761 about more things if an older ABI version is selected (with
5762 @option{-fabi-version=@var{n}}).
5764 @option{-Wabi} can also be used with an explicit version number to
5765 warn about C++ ABI compatibility with a particular @option{-fabi-version}
5766 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
5767 @option{-fabi-version=2}.
5769 If an explicit version number is provided and
5770 @option{-fabi-compat-version} is not specified, the version number
5771 from this option is used for compatibility aliases. If no explicit
5772 version number is provided with this option, but
5773 @option{-fabi-compat-version} is specified, that version number is
5774 used for C++ ABI warnings.
5776 Although an effort has been made to warn about
5777 all such cases, there are probably some cases that are not warned about,
5778 even though G++ is generating incompatible code. There may also be
5779 cases where warnings are emitted even though the code that is generated
5782 You should rewrite your code to avoid these warnings if you are
5783 concerned about the fact that code generated by G++ may not be binary
5784 compatible with code generated by other compilers.
5786 Known incompatibilities in @option{-fabi-version=2} (which was the
5787 default from GCC 3.4 to 4.9) include:
5792 A template with a non-type template parameter of reference type was
5793 mangled incorrectly:
5796 template <int &> struct S @{@};
5800 This was fixed in @option{-fabi-version=3}.
5803 SIMD vector types declared using @code{__attribute ((vector_size))} were
5804 mangled in a non-standard way that does not allow for overloading of
5805 functions taking vectors of different sizes.
5807 The mangling was changed in @option{-fabi-version=4}.
5810 @code{__attribute ((const))} and @code{noreturn} were mangled as type
5811 qualifiers, and @code{decltype} of a plain declaration was folded away.
5813 These mangling issues were fixed in @option{-fabi-version=5}.
5816 Scoped enumerators passed as arguments to a variadic function are
5817 promoted like unscoped enumerators, causing @code{va_arg} to complain.
5818 On most targets this does not actually affect the parameter passing
5819 ABI, as there is no way to pass an argument smaller than @code{int}.
5821 Also, the ABI changed the mangling of template argument packs,
5822 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5823 a class scope function used as a template argument.
5825 These issues were corrected in @option{-fabi-version=6}.
5828 Lambdas in default argument scope were mangled incorrectly, and the
5829 ABI changed the mangling of @code{nullptr_t}.
5831 These issues were corrected in @option{-fabi-version=7}.
5834 When mangling a function type with function-cv-qualifiers, the
5835 un-qualified function type was incorrectly treated as a substitution
5838 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5841 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5842 unaligned accesses. Note that this did not affect the ABI of a
5843 function with a @code{nullptr_t} parameter, as parameters have a
5846 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5849 Target-specific attributes that affect the identity of a type, such as
5850 ia32 calling conventions on a function type (stdcall, regparm, etc.),
5851 did not affect the mangled name, leading to name collisions when
5852 function pointers were used as template arguments.
5854 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5858 This option also enables warnings about psABI-related changes.
5859 The known psABI changes at this point include:
5864 For SysV/x86-64, unions with @code{long double} members are
5865 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
5866 the case. For example:
5876 @code{union U} is now always passed in memory.
5880 @item -Wchar-subscripts
5881 @opindex Wchar-subscripts
5882 @opindex Wno-char-subscripts
5883 Warn if an array subscript has type @code{char}. This is a common cause
5884 of error, as programmers often forget that this type is signed on some
5886 This warning is enabled by @option{-Wall}.
5888 @item -Wno-coverage-mismatch
5889 @opindex Wno-coverage-mismatch
5890 @opindex Wcoverage-mismatch
5891 Warn if feedback profiles do not match when using the
5892 @option{-fprofile-use} option.
5893 If a source file is changed between compiling with @option{-fprofile-generate}
5894 and with @option{-fprofile-use}, the files with the profile feedback can fail
5895 to match the source file and GCC cannot use the profile feedback
5896 information. By default, this warning is enabled and is treated as an
5897 error. @option{-Wno-coverage-mismatch} can be used to disable the
5898 warning or @option{-Wno-error=coverage-mismatch} can be used to
5899 disable the error. Disabling the error for this warning can result in
5900 poorly optimized code and is useful only in the
5901 case of very minor changes such as bug fixes to an existing code-base.
5902 Completely disabling the warning is not recommended.
5904 @item -Wno-coverage-invalid-line-number
5905 @opindex Wno-coverage-invalid-line-number
5906 @opindex Wcoverage-invalid-line-number
5907 Warn in case a function ends earlier than it begins due
5908 to an invalid linenum macros. The warning is emitted only
5909 with @option{--coverage} enabled.
5911 By default, this warning is enabled and is treated as an
5912 error. @option{-Wno-coverage-invalid-line-number} can be used to disable the
5913 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
5916 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5919 Suppress warning messages emitted by @code{#warning} directives.
5921 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5922 @opindex Wdouble-promotion
5923 @opindex Wno-double-promotion
5924 Give a warning when a value of type @code{float} is implicitly
5925 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
5926 floating-point unit implement @code{float} in hardware, but emulate
5927 @code{double} in software. On such a machine, doing computations
5928 using @code{double} values is much more expensive because of the
5929 overhead required for software emulation.
5931 It is easy to accidentally do computations with @code{double} because
5932 floating-point literals are implicitly of type @code{double}. For
5936 float area(float radius)
5938 return 3.14159 * radius * radius;
5942 the compiler performs the entire computation with @code{double}
5943 because the floating-point literal is a @code{double}.
5945 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5946 @opindex Wduplicate-decl-specifier
5947 @opindex Wno-duplicate-decl-specifier
5948 Warn if a declaration has duplicate @code{const}, @code{volatile},
5949 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
5953 @itemx -Wformat=@var{n}
5956 @opindex ffreestanding
5957 @opindex fno-builtin
5959 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5960 the arguments supplied have types appropriate to the format string
5961 specified, and that the conversions specified in the format string make
5962 sense. This includes standard functions, and others specified by format
5963 attributes (@pxref{Function Attributes}), in the @code{printf},
5964 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5965 not in the C standard) families (or other target-specific families).
5966 Which functions are checked without format attributes having been
5967 specified depends on the standard version selected, and such checks of
5968 functions without the attribute specified are disabled by
5969 @option{-ffreestanding} or @option{-fno-builtin}.
5971 The formats are checked against the format features supported by GNU
5972 libc version 2.2. These include all ISO C90 and C99 features, as well
5973 as features from the Single Unix Specification and some BSD and GNU
5974 extensions. Other library implementations may not support all these
5975 features; GCC does not support warning about features that go beyond a
5976 particular library's limitations. However, if @option{-Wpedantic} is used
5977 with @option{-Wformat}, warnings are given about format features not
5978 in the selected standard version (but not for @code{strfmon} formats,
5979 since those are not in any version of the C standard). @xref{C Dialect
5980 Options,,Options Controlling C Dialect}.
5987 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5988 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
5989 @option{-Wformat} also checks for null format arguments for several
5990 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
5991 aspects of this level of format checking can be disabled by the
5992 options: @option{-Wno-format-contains-nul},
5993 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5994 @option{-Wformat} is enabled by @option{-Wall}.
5998 Enable @option{-Wformat} plus additional format checks. Currently
5999 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6003 @item -Wno-format-contains-nul
6004 @opindex Wno-format-contains-nul
6005 @opindex Wformat-contains-nul
6006 If @option{-Wformat} is specified, do not warn about format strings that
6009 @item -Wno-format-extra-args
6010 @opindex Wno-format-extra-args
6011 @opindex Wformat-extra-args
6012 If @option{-Wformat} is specified, do not warn about excess arguments to a
6013 @code{printf} or @code{scanf} format function. The C standard specifies
6014 that such arguments are ignored.
6016 Where the unused arguments lie between used arguments that are
6017 specified with @samp{$} operand number specifications, normally
6018 warnings are still given, since the implementation could not know what
6019 type to pass to @code{va_arg} to skip the unused arguments. However,
6020 in the case of @code{scanf} formats, this option suppresses the
6021 warning if the unused arguments are all pointers, since the Single
6022 Unix Specification says that such unused arguments are allowed.
6024 @item -Wformat-overflow
6025 @itemx -Wformat-overflow=@var{level}
6026 @opindex Wformat-overflow
6027 @opindex Wno-format-overflow
6028 Warn about calls to formatted input/output functions such as @code{sprintf}
6029 and @code{vsprintf} that might overflow the destination buffer. When the
6030 exact number of bytes written by a format directive cannot be determined
6031 at compile-time it is estimated based on heuristics that depend on the
6032 @var{level} argument and on optimization. While enabling optimization
6033 will in most cases improve the accuracy of the warning, it may also
6034 result in false positives.
6037 @item -Wformat-overflow
6038 @itemx -Wformat-overflow=1
6039 @opindex Wformat-overflow
6040 @opindex Wno-format-overflow
6041 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6042 employs a conservative approach that warns only about calls that most
6043 likely overflow the buffer. At this level, numeric arguments to format
6044 directives with unknown values are assumed to have the value of one, and
6045 strings of unknown length to be empty. Numeric arguments that are known
6046 to be bounded to a subrange of their type, or string arguments whose output
6047 is bounded either by their directive's precision or by a finite set of
6048 string literals, are assumed to take on the value within the range that
6049 results in the most bytes on output. For example, the call to @code{sprintf}
6050 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6051 the terminating NUL character (@code{'\0'}) appended by the function
6052 to the destination buffer will be written past its end. Increasing
6053 the size of the buffer by a single byte is sufficient to avoid the
6054 warning, though it may not be sufficient to avoid the overflow.
6057 void f (int a, int b)
6060 sprintf (buf, "a = %i, b = %i\n", a, b);
6064 @item -Wformat-overflow=2
6065 Level @var{2} warns also about calls that might overflow the destination
6066 buffer given an argument of sufficient length or magnitude. At level
6067 @var{2}, unknown numeric arguments are assumed to have the minimum
6068 representable value for signed types with a precision greater than 1, and
6069 the maximum representable value otherwise. Unknown string arguments whose
6070 length cannot be assumed to be bounded either by the directive's precision,
6071 or by a finite set of string literals they may evaluate to, or the character
6072 array they may point to, are assumed to be 1 character long.
6074 At level @var{2}, the call in the example above is again diagnosed, but
6075 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6076 @code{%i} directive will write some of its digits beyond the end of
6077 the destination buffer. To make the call safe regardless of the values
6078 of the two variables, the size of the destination buffer must be increased
6079 to at least 34 bytes. GCC includes the minimum size of the buffer in
6080 an informational note following the warning.
6082 An alternative to increasing the size of the destination buffer is to
6083 constrain the range of formatted values. The maximum length of string
6084 arguments can be bounded by specifying the precision in the format
6085 directive. When numeric arguments of format directives can be assumed
6086 to be bounded by less than the precision of their type, choosing
6087 an appropriate length modifier to the format specifier will reduce
6088 the required buffer size. For example, if @var{a} and @var{b} in the
6089 example above can be assumed to be within the precision of
6090 the @code{short int} type then using either the @code{%hi} format
6091 directive or casting the argument to @code{short} reduces the maximum
6092 required size of the buffer to 24 bytes.
6095 void f (int a, int b)
6098 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6103 @item -Wno-format-zero-length
6104 @opindex Wno-format-zero-length
6105 @opindex Wformat-zero-length
6106 If @option{-Wformat} is specified, do not warn about zero-length formats.
6107 The C standard specifies that zero-length formats are allowed.
6109 @item -Wformat-nonliteral
6110 @opindex Wformat-nonliteral
6111 @opindex Wno-format-nonliteral
6112 If @option{-Wformat} is specified, also warn if the format string is not a
6113 string literal and so cannot be checked, unless the format function
6114 takes its format arguments as a @code{va_list}.
6116 @item -Wformat-security
6117 @opindex Wformat-security
6118 @opindex Wno-format-security
6119 If @option{-Wformat} is specified, also warn about uses of format
6120 functions that represent possible security problems. At present, this
6121 warns about calls to @code{printf} and @code{scanf} functions where the
6122 format string is not a string literal and there are no format arguments,
6123 as in @code{printf (foo);}. This may be a security hole if the format
6124 string came from untrusted input and contains @samp{%n}. (This is
6125 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6126 in future warnings may be added to @option{-Wformat-security} that are not
6127 included in @option{-Wformat-nonliteral}.)
6129 @item -Wformat-signedness
6130 @opindex Wformat-signedness
6131 @opindex Wno-format-signedness
6132 If @option{-Wformat} is specified, also warn if the format string
6133 requires an unsigned argument and the argument is signed and vice versa.
6135 @item -Wformat-truncation
6136 @itemx -Wformat-truncation=@var{level}
6137 @opindex Wformat-truncation
6138 @opindex Wno-format-truncation
6139 Warn about calls to formatted input/output functions such as @code{snprintf}
6140 and @code{vsnprintf} that might result in output truncation. When the exact
6141 number of bytes written by a format directive cannot be determined at
6142 compile-time it is estimated based on heuristics that depend on
6143 the @var{level} argument and on optimization. While enabling optimization
6144 will in most cases improve the accuracy of the warning, it may also result
6145 in false positives. Except as noted otherwise, the option uses the same
6146 logic @option{-Wformat-overflow}.
6149 @item -Wformat-truncation
6150 @itemx -Wformat-truncation=1
6151 @opindex Wformat-truncation
6152 @opindex Wno-format-truncation
6153 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6154 employs a conservative approach that warns only about calls to bounded
6155 functions whose return value is unused and that will most likely result
6156 in output truncation.
6158 @item -Wformat-truncation=2
6159 Level @var{2} warns also about calls to bounded functions whose return
6160 value is used and that might result in truncation given an argument of
6161 sufficient length or magnitude.
6165 @opindex Wformat-y2k
6166 @opindex Wno-format-y2k
6167 If @option{-Wformat} is specified, also warn about @code{strftime}
6168 formats that may yield only a two-digit year.
6172 @opindex Wno-nonnull
6173 Warn about passing a null pointer for arguments marked as
6174 requiring a non-null value by the @code{nonnull} function attribute.
6176 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
6177 can be disabled with the @option{-Wno-nonnull} option.
6179 @item -Wnonnull-compare
6180 @opindex Wnonnull-compare
6181 @opindex Wno-nonnull-compare
6182 Warn when comparing an argument marked with the @code{nonnull}
6183 function attribute against null inside the function.
6185 @option{-Wnonnull-compare} is included in @option{-Wall}. It
6186 can be disabled with the @option{-Wno-nonnull-compare} option.
6188 @item -Wnull-dereference
6189 @opindex Wnull-dereference
6190 @opindex Wno-null-dereference
6191 Warn if the compiler detects paths that trigger erroneous or
6192 undefined behavior due to dereferencing a null pointer. This option
6193 is only active when @option{-fdelete-null-pointer-checks} is active,
6194 which is enabled by optimizations in most targets. The precision of
6195 the warnings depends on the optimization options used.
6197 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6199 @opindex Wno-init-self
6200 Warn about uninitialized variables that are initialized with themselves.
6201 Note this option can only be used with the @option{-Wuninitialized} option.
6203 For example, GCC warns about @code{i} being uninitialized in the
6204 following snippet only when @option{-Winit-self} has been specified:
6215 This warning is enabled by @option{-Wall} in C++.
6217 @item -Wno-implicit-int @r{(C and Objective-C only)}
6218 @opindex Wimplicit-int
6219 @opindex Wno-implicit-int
6220 This option controls warnings when a declaration does not specify a type.
6221 This warning is enabled by default in C99 and later dialects of C,
6222 and also by @option{-Wall}.
6224 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6225 @opindex Wimplicit-function-declaration
6226 @opindex Wno-implicit-function-declaration
6227 This option controls warnings when a function is used before being declared.
6228 This warning is enabled by default in C99 and later dialects of C,
6229 and also by @option{-Wall}.
6230 The warning is made into an error by @option{-pedantic-errors}.
6232 @item -Wimplicit @r{(C and Objective-C only)}
6234 @opindex Wno-implicit
6235 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6236 This warning is enabled by @option{-Wall}.
6238 @item -Wimplicit-fallthrough
6239 @opindex Wimplicit-fallthrough
6240 @opindex Wno-implicit-fallthrough
6241 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6242 and @option{-Wno-implicit-fallthrough} is the same as
6243 @option{-Wimplicit-fallthrough=0}.
6245 @item -Wimplicit-fallthrough=@var{n}
6246 @opindex Wimplicit-fallthrough=
6247 Warn when a switch case falls through. For example:
6265 This warning does not warn when the last statement of a case cannot
6266 fall through, e.g. when there is a return statement or a call to function
6267 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
6268 also takes into account control flow statements, such as ifs, and only
6269 warns when appropriate. E.g.@:
6279 @} else if (i < 1) @{
6289 Since there are occasions where a switch case fall through is desirable,
6290 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6291 to be used along with a null statement to suppress this warning that
6292 would normally occur:
6300 __attribute__ ((fallthrough));
6307 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6308 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
6309 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6310 Instead of these attributes, it is also possible to add a fallthrough comment
6311 to silence the warning. The whole body of the C or C++ style comment should
6312 match the given regular expressions listed below. The option argument @var{n}
6313 specifies what kind of comments are accepted:
6317 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6319 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6320 expression, any comment is used as fallthrough comment.
6322 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6323 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6325 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6326 following regular expressions:
6330 @item @code{-fallthrough}
6332 @item @code{@@fallthrough@@}
6334 @item @code{lint -fallthrough[ \t]*}
6336 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6338 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6340 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6344 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6345 following regular expressions:
6349 @item @code{-fallthrough}
6351 @item @code{@@fallthrough@@}
6353 @item @code{lint -fallthrough[ \t]*}
6355 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6359 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6360 fallthrough comments, only attributes disable the warning.
6364 The comment needs to be followed after optional whitespace and other comments
6365 by @code{case} or @code{default} keywords or by a user label that precedes some
6366 @code{case} or @code{default} label.
6381 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6383 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6384 @opindex Wif-not-aligned
6385 @opindex Wno-if-not-aligned
6386 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6387 should be issued. These warnings are enabled by default.
6389 @item -Wignored-qualifiers @r{(C and C++ only)}
6390 @opindex Wignored-qualifiers
6391 @opindex Wno-ignored-qualifiers
6392 Warn if the return type of a function has a type qualifier
6393 such as @code{const}. For ISO C such a type qualifier has no effect,
6394 since the value returned by a function is not an lvalue.
6395 For C++, the warning is only emitted for scalar types or @code{void}.
6396 ISO C prohibits qualified @code{void} return types on function
6397 definitions, so such return types always receive a warning
6398 even without this option.
6400 This warning is also enabled by @option{-Wextra}.
6402 @item -Wno-ignored-attributes @r{(C and C++ only)}
6403 @opindex Wignored-attributes
6404 @opindex Wno-ignored-attributes
6405 This option controls warnings when an attribute is ignored.
6406 This is different from the
6407 @option{-Wattributes} option in that it warns whenever the compiler decides
6408 to drop an attribute, not that the attribute is either unknown, used in a
6409 wrong place, etc. This warning is enabled by default.
6414 Warn if the type of @code{main} is suspicious. @code{main} should be
6415 a function with external linkage, returning int, taking either zero
6416 arguments, two, or three arguments of appropriate types. This warning
6417 is enabled by default in C++ and is enabled by either @option{-Wall}
6418 or @option{-Wpedantic}.
6420 @item -Wmisleading-indentation @r{(C and C++ only)}
6421 @opindex Wmisleading-indentation
6422 @opindex Wno-misleading-indentation
6423 Warn when the indentation of the code does not reflect the block structure.
6424 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6425 @code{for} clauses with a guarded statement that does not use braces,
6426 followed by an unguarded statement with the same indentation.
6428 In the following example, the call to ``bar'' is misleadingly indented as
6429 if it were guarded by the ``if'' conditional.
6432 if (some_condition ())
6434 bar (); /* Gotcha: this is not guarded by the "if". */
6437 In the case of mixed tabs and spaces, the warning uses the
6438 @option{-ftabstop=} option to determine if the statements line up
6441 The warning is not issued for code involving multiline preprocessor logic
6442 such as the following example.
6447 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6453 The warning is not issued after a @code{#line} directive, since this
6454 typically indicates autogenerated code, and no assumptions can be made
6455 about the layout of the file that the directive references.
6457 This warning is enabled by @option{-Wall} in C and C++.
6459 @item -Wmissing-attributes
6460 @opindex Wmissing-attributes
6461 @opindex Wno-missing-attributes
6462 Warn when a declaration of a function is missing one or more attributes
6463 that a related function is declared with and whose absence may adversely
6464 affect the correctness or efficiency of generated code. For example,
6465 the warning is issued for declarations of aliases that use attributes
6466 to specify less restrictive requirements than those of their targets.
6467 This typically represents a potential optimization opportunity.
6468 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6469 issued when the alias is more restrictive than the target, which could
6470 lead to incorrect code generation.
6471 Attributes considered include @code{alloc_align}, @code{alloc_size},
6472 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6473 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6474 @code{returns_nonnull}, and @code{returns_twice}.
6476 In C++, the warning is issued when an explicit specialization of a primary
6477 template declared with attribute @code{alloc_align}, @code{alloc_size},
6478 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6479 or @code{nonnull} is declared without it. Attributes @code{deprecated},
6480 @code{error}, and @code{warning} suppress the warning.
6481 (@pxref{Function Attributes}).
6483 You can use the @code{copy} attribute to apply the same
6484 set of attributes to a declaration as that on another declaration without
6485 explicitly enumerating the attributes. This attribute can be applied
6486 to declarations of functions (@pxref{Common Function Attributes}),
6487 variables (@pxref{Common Variable Attributes}), or types
6488 (@pxref{Common Type Attributes}).
6490 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6492 For example, since the declaration of the primary function template
6493 below makes use of both attribute @code{malloc} and @code{alloc_size}
6494 the declaration of the explicit specialization of the template is
6495 diagnosed because it is missing one of the attributes.
6499 T* __attribute__ ((malloc, alloc_size (1)))
6503 void* __attribute__ ((malloc)) // missing alloc_size
6504 allocate<void> (size_t);
6507 @item -Wmissing-braces
6508 @opindex Wmissing-braces
6509 @opindex Wno-missing-braces
6510 Warn if an aggregate or union initializer is not fully bracketed. In
6511 the following example, the initializer for @code{a} is not fully
6512 bracketed, but that for @code{b} is fully bracketed.
6515 int a[2][2] = @{ 0, 1, 2, 3 @};
6516 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6519 This warning is enabled by @option{-Wall}.
6521 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
6522 @opindex Wmissing-include-dirs
6523 @opindex Wno-missing-include-dirs
6524 Warn if a user-supplied include directory does not exist. This opions is disabled
6525 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
6526 enabled by default by warning for -I and -J, only.
6528 @item -Wno-missing-profile
6529 @opindex Wmissing-profile
6530 @opindex Wno-missing-profile
6531 This option controls warnings if feedback profiles are missing when using the
6532 @option{-fprofile-use} option.
6533 This option diagnoses those cases where a new function or a new file is added
6534 between compiling with @option{-fprofile-generate} and with
6535 @option{-fprofile-use}, without regenerating the profiles.
6536 In these cases, the profile feedback data files do not contain any
6537 profile feedback information for
6538 the newly added function or file respectively. Also, in the case when profile
6539 count data (.gcda) files are removed, GCC cannot use any profile feedback
6540 information. In all these cases, warnings are issued to inform you that a
6541 profile generation step is due.
6542 Ignoring the warning can result in poorly optimized code.
6543 @option{-Wno-missing-profile} can be used to
6544 disable the warning, but this is not recommended and should be done only
6545 when non-existent profile data is justified.
6547 @item -Wmismatched-dealloc
6548 @opindex Wmismatched-dealloc
6549 @opindex Wno-mismatched-dealloc
6551 Warn for calls to deallocation functions with pointer arguments returned
6552 from from allocations functions for which the former isn't a suitable
6553 deallocator. A pair of functions can be associated as matching allocators
6554 and deallocators by use of attribute @code{malloc}. Unless disabled by
6555 the @option{-fno-builtin} option the standard functions @code{calloc},
6556 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
6557 forms of C++ @code{operator new} and @code{operator delete} are implicitly
6558 associated as matching allocators and deallocators. In the following
6559 example @code{mydealloc} is the deallocator for pointers returned from
6563 void mydealloc (void*);
6565 __attribute__ ((malloc (mydealloc, 1))) void*
6570 void *p = myalloc (32);
6571 // @dots{}use p@dots{}
6572 free (p); // warning: not a matching deallocator for myalloc
6573 mydealloc (p); // ok
6577 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
6578 mismatches involving either @code{operator new} or @code{operator delete}.
6580 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
6582 @item -Wmultistatement-macros
6583 @opindex Wmultistatement-macros
6584 @opindex Wno-multistatement-macros
6585 Warn about unsafe multiple statement macros that appear to be guarded
6586 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
6587 @code{while}, in which only the first statement is actually guarded after
6588 the macro is expanded.
6593 #define DOIT x++; y++
6598 will increment @code{y} unconditionally, not just when @code{c} holds.
6599 The can usually be fixed by wrapping the macro in a do-while loop:
6601 #define DOIT do @{ x++; y++; @} while (0)
6606 This warning is enabled by @option{-Wall} in C and C++.
6609 @opindex Wparentheses
6610 @opindex Wno-parentheses
6611 Warn if parentheses are omitted in certain contexts, such
6612 as when there is an assignment in a context where a truth value
6613 is expected, or when operators are nested whose precedence people
6614 often get confused about.
6616 Also warn if a comparison like @code{x<=y<=z} appears; this is
6617 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
6618 interpretation from that of ordinary mathematical notation.
6620 Also warn for dangerous uses of the GNU extension to
6621 @code{?:} with omitted middle operand. When the condition
6622 in the @code{?}: operator is a boolean expression, the omitted value is
6623 always 1. Often programmers expect it to be a value computed
6624 inside the conditional expression instead.
6626 For C++ this also warns for some cases of unnecessary parentheses in
6627 declarations, which can indicate an attempt at a function call instead
6631 // Declares a local variable called mymutex.
6632 std::unique_lock<std::mutex> (mymutex);
6633 // User meant std::unique_lock<std::mutex> lock (mymutex);
6637 This warning is enabled by @option{-Wall}.
6639 @item -Wsequence-point
6640 @opindex Wsequence-point
6641 @opindex Wno-sequence-point
6642 Warn about code that may have undefined semantics because of violations
6643 of sequence point rules in the C and C++ standards.
6645 The C and C++ standards define the order in which expressions in a C/C++
6646 program are evaluated in terms of @dfn{sequence points}, which represent
6647 a partial ordering between the execution of parts of the program: those
6648 executed before the sequence point, and those executed after it. These
6649 occur after the evaluation of a full expression (one which is not part
6650 of a larger expression), after the evaluation of the first operand of a
6651 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
6652 function is called (but after the evaluation of its arguments and the
6653 expression denoting the called function), and in certain other places.
6654 Other than as expressed by the sequence point rules, the order of
6655 evaluation of subexpressions of an expression is not specified. All
6656 these rules describe only a partial order rather than a total order,
6657 since, for example, if two functions are called within one expression
6658 with no sequence point between them, the order in which the functions
6659 are called is not specified. However, the standards committee have
6660 ruled that function calls do not overlap.
6662 It is not specified when between sequence points modifications to the
6663 values of objects take effect. Programs whose behavior depends on this
6664 have undefined behavior; the C and C++ standards specify that ``Between
6665 the previous and next sequence point an object shall have its stored
6666 value modified at most once by the evaluation of an expression.
6667 Furthermore, the prior value shall be read only to determine the value
6668 to be stored.''. If a program breaks these rules, the results on any
6669 particular implementation are entirely unpredictable.
6671 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
6672 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
6673 diagnosed by this option, and it may give an occasional false positive
6674 result, but in general it has been found fairly effective at detecting
6675 this sort of problem in programs.
6677 The C++17 standard will define the order of evaluation of operands in
6678 more cases: in particular it requires that the right-hand side of an
6679 assignment be evaluated before the left-hand side, so the above
6680 examples are no longer undefined. But this option will still warn
6681 about them, to help people avoid writing code that is undefined in C
6682 and earlier revisions of C++.
6684 The standard is worded confusingly, therefore there is some debate
6685 over the precise meaning of the sequence point rules in subtle cases.
6686 Links to discussions of the problem, including proposed formal
6687 definitions, may be found on the GCC readings page, at
6688 @uref{http://gcc.gnu.org/@/readings.html}.
6690 This warning is enabled by @option{-Wall} for C and C++.
6692 @item -Wno-return-local-addr
6693 @opindex Wno-return-local-addr
6694 @opindex Wreturn-local-addr
6695 Do not warn about returning a pointer (or in C++, a reference) to a
6696 variable that goes out of scope after the function returns.
6699 @opindex Wreturn-type
6700 @opindex Wno-return-type
6701 Warn whenever a function is defined with a return type that defaults
6702 to @code{int}. Also warn about any @code{return} statement with no
6703 return value in a function whose return type is not @code{void}
6704 (falling off the end of the function body is considered returning
6707 For C only, warn about a @code{return} statement with an expression in a
6708 function whose return type is @code{void}, unless the expression type is
6709 also @code{void}. As a GNU extension, the latter case is accepted
6710 without a warning unless @option{-Wpedantic} is used. Attempting
6711 to use the return value of a non-@code{void} function other than @code{main}
6712 that flows off the end by reaching the closing curly brace that terminates
6713 the function is undefined.
6715 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
6716 than @code{main} results in undefined behavior even when the value of
6717 the function is not used.
6719 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
6721 @item -Wno-shift-count-negative
6722 @opindex Wshift-count-negative
6723 @opindex Wno-shift-count-negative
6724 Controls warnings if a shift count is negative.
6725 This warning is enabled by default.
6727 @item -Wno-shift-count-overflow
6728 @opindex Wshift-count-overflow
6729 @opindex Wno-shift-count-overflow
6730 Controls warnings if a shift count is greater than or equal to the bit width
6731 of the type. This warning is enabled by default.
6733 @item -Wshift-negative-value
6734 @opindex Wshift-negative-value
6735 @opindex Wno-shift-negative-value
6736 Warn if left shifting a negative value. This warning is enabled by
6737 @option{-Wextra} in C99 and C++11 modes (and newer).
6739 @item -Wno-shift-overflow
6740 @itemx -Wshift-overflow=@var{n}
6741 @opindex Wshift-overflow
6742 @opindex Wno-shift-overflow
6743 These options control warnings about left shift overflows.
6746 @item -Wshift-overflow=1
6747 This is the warning level of @option{-Wshift-overflow} and is enabled
6748 by default in C99 and C++11 modes (and newer). This warning level does
6749 not warn about left-shifting 1 into the sign bit. (However, in C, such
6750 an overflow is still rejected in contexts where an integer constant expression
6751 is required.) No warning is emitted in C++20 mode (and newer), as signed left
6754 @item -Wshift-overflow=2
6755 This warning level also warns about left-shifting 1 into the sign bit,
6756 unless C++14 mode (or newer) is active.
6762 Warn whenever a @code{switch} statement has an index of enumerated type
6763 and lacks a @code{case} for one or more of the named codes of that
6764 enumeration. (The presence of a @code{default} label prevents this
6765 warning.) @code{case} labels outside the enumeration range also
6766 provoke warnings when this option is used (even if there is a
6767 @code{default} label).
6768 This warning is enabled by @option{-Wall}.
6770 @item -Wswitch-default
6771 @opindex Wswitch-default
6772 @opindex Wno-switch-default
6773 Warn whenever a @code{switch} statement does not have a @code{default}
6777 @opindex Wswitch-enum
6778 @opindex Wno-switch-enum
6779 Warn whenever a @code{switch} statement has an index of enumerated type
6780 and lacks a @code{case} for one or more of the named codes of that
6781 enumeration. @code{case} labels outside the enumeration range also
6782 provoke warnings when this option is used. The only difference
6783 between @option{-Wswitch} and this option is that this option gives a
6784 warning about an omitted enumeration code even if there is a
6785 @code{default} label.
6787 @item -Wno-switch-bool
6788 @opindex Wswitch-bool
6789 @opindex Wno-switch-bool
6790 Do not warn when a @code{switch} statement has an index of boolean type
6791 and the case values are outside the range of a boolean type.
6792 It is possible to suppress this warning by casting the controlling
6793 expression to a type other than @code{bool}. For example:
6796 switch ((int) (a == 4))
6802 This warning is enabled by default for C and C++ programs.
6804 @item -Wno-switch-outside-range
6805 @opindex Wswitch-outside-range
6806 @opindex Wno-switch-outside-range
6807 This option controls warnings when a @code{switch} case has a value
6808 that is outside of its
6809 respective type range. This warning is enabled by default for
6812 @item -Wno-switch-unreachable
6813 @opindex Wswitch-unreachable
6814 @opindex Wno-switch-unreachable
6815 Do not warn when a @code{switch} statement contains statements between the
6816 controlling expression and the first case label, which will never be
6817 executed. For example:
6829 @option{-Wswitch-unreachable} does not warn if the statement between the
6830 controlling expression and the first case label is just a declaration:
6843 This warning is enabled by default for C and C++ programs.
6845 @item -Wsync-nand @r{(C and C++ only)}
6847 @opindex Wno-sync-nand
6848 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6849 built-in functions are used. These functions changed semantics in GCC 4.4.
6851 @item -Wunused-but-set-parameter
6852 @opindex Wunused-but-set-parameter
6853 @opindex Wno-unused-but-set-parameter
6854 Warn whenever a function parameter is assigned to, but otherwise unused
6855 (aside from its declaration).
6857 To suppress this warning use the @code{unused} attribute
6858 (@pxref{Variable Attributes}).
6860 This warning is also enabled by @option{-Wunused} together with
6863 @item -Wunused-but-set-variable
6864 @opindex Wunused-but-set-variable
6865 @opindex Wno-unused-but-set-variable
6866 Warn whenever a local variable is assigned to, but otherwise unused
6867 (aside from its declaration).
6868 This warning is enabled by @option{-Wall}.
6870 To suppress this warning use the @code{unused} attribute
6871 (@pxref{Variable Attributes}).
6873 This warning is also enabled by @option{-Wunused}, which is enabled
6876 @item -Wunused-function
6877 @opindex Wunused-function
6878 @opindex Wno-unused-function
6879 Warn whenever a static function is declared but not defined or a
6880 non-inline static function is unused.
6881 This warning is enabled by @option{-Wall}.
6883 @item -Wunused-label
6884 @opindex Wunused-label
6885 @opindex Wno-unused-label
6886 Warn whenever a label is declared but not used.
6887 This warning is enabled by @option{-Wall}.
6889 To suppress this warning use the @code{unused} attribute
6890 (@pxref{Variable Attributes}).
6892 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6893 @opindex Wunused-local-typedefs
6894 @opindex Wno-unused-local-typedefs
6895 Warn when a typedef locally defined in a function is not used.
6896 This warning is enabled by @option{-Wall}.
6898 @item -Wunused-parameter
6899 @opindex Wunused-parameter
6900 @opindex Wno-unused-parameter
6901 Warn whenever a function parameter is unused aside from its declaration.
6903 To suppress this warning use the @code{unused} attribute
6904 (@pxref{Variable Attributes}).
6906 @item -Wno-unused-result
6907 @opindex Wunused-result
6908 @opindex Wno-unused-result
6909 Do not warn if a caller of a function marked with attribute
6910 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
6911 its return value. The default is @option{-Wunused-result}.
6913 @item -Wunused-variable
6914 @opindex Wunused-variable
6915 @opindex Wno-unused-variable
6916 Warn whenever a local or static variable is unused aside from its
6917 declaration. This option implies @option{-Wunused-const-variable=1} for C,
6918 but not for C++. This warning is enabled by @option{-Wall}.
6920 To suppress this warning use the @code{unused} attribute
6921 (@pxref{Variable Attributes}).
6923 @item -Wunused-const-variable
6924 @itemx -Wunused-const-variable=@var{n}
6925 @opindex Wunused-const-variable
6926 @opindex Wno-unused-const-variable
6927 Warn whenever a constant static variable is unused aside from its declaration.
6928 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6929 for C, but not for C++. In C this declares variable storage, but in C++ this
6930 is not an error since const variables take the place of @code{#define}s.
6932 To suppress this warning use the @code{unused} attribute
6933 (@pxref{Variable Attributes}).
6936 @item -Wunused-const-variable=1
6937 This is the warning level that is enabled by @option{-Wunused-variable} for
6938 C. It warns only about unused static const variables defined in the main
6939 compilation unit, but not about static const variables declared in any
6942 @item -Wunused-const-variable=2
6943 This warning level also warns for unused constant static variables in
6944 headers (excluding system headers). This is the warning level of
6945 @option{-Wunused-const-variable} and must be explicitly requested since
6946 in C++ this isn't an error and in C it might be harder to clean up all
6950 @item -Wunused-value
6951 @opindex Wunused-value
6952 @opindex Wno-unused-value
6953 Warn whenever a statement computes a result that is explicitly not
6954 used. To suppress this warning cast the unused expression to
6955 @code{void}. This includes an expression-statement or the left-hand
6956 side of a comma expression that contains no side effects. For example,
6957 an expression such as @code{x[i,j]} causes a warning, while
6958 @code{x[(void)i,j]} does not.
6960 This warning is enabled by @option{-Wall}.
6965 All the above @option{-Wunused} options combined.
6967 In order to get a warning about an unused function parameter, you must
6968 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6969 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6971 @item -Wuninitialized
6972 @opindex Wuninitialized
6973 @opindex Wno-uninitialized
6974 Warn if an object with automatic or allocated storage duration is used
6975 without having been initialized. In C++, also warn if a non-static
6976 reference or non-static @code{const} member appears in a class without
6979 In addition, passing a pointer (or in C++, a reference) to an uninitialized
6980 object to a @code{const}-qualified argument of a built-in function known to
6981 read the object is also diagnosed by this warning.
6982 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
6984 If you want to warn about code that uses the uninitialized value of the
6985 variable in its own initializer, use the @option{-Winit-self} option.
6987 These warnings occur for individual uninitialized elements of
6988 structure, union or array variables as well as for variables that are
6989 uninitialized as a whole. They do not occur for variables or elements
6990 declared @code{volatile}. Because these warnings depend on
6991 optimization, the exact variables or elements for which there are
6992 warnings depend on the precise optimization options and version of GCC
6995 Note that there may be no warning about a variable that is used only
6996 to compute a value that itself is never used, because such
6997 computations may be deleted by data flow analysis before the warnings
7000 In C++, this warning also warns about using uninitialized objects in
7001 member-initializer-lists. For example, GCC warns about @code{b} being
7002 uninitialized in the following snippet:
7012 @item -Wno-invalid-memory-model
7013 @opindex Winvalid-memory-model
7014 @opindex Wno-invalid-memory-model
7015 This option controls warnings
7016 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7017 and the C11 atomic generic functions with a memory consistency argument
7018 that is either invalid for the operation or outside the range of values
7019 of the @code{memory_order} enumeration. For example, since the
7020 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7021 defined for the relaxed, release, and sequentially consistent memory
7022 orders the following code is diagnosed:
7027 __atomic_store_n (i, 0, memory_order_consume);
7031 @option{-Winvalid-memory-model} is enabled by default.
7033 @item -Wmaybe-uninitialized
7034 @opindex Wmaybe-uninitialized
7035 @opindex Wno-maybe-uninitialized
7036 For an object with automatic or allocated storage duration, if there exists
7037 a path from the function entry to a use of the object that is initialized,
7038 but there exist some other paths for which the object is not initialized,
7039 the compiler emits a warning if it cannot prove the uninitialized paths
7040 are not executed at run time.
7042 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7043 object to a @code{const}-qualified function argument is also diagnosed by
7044 this warning. (@option{-Wuninitialized} is issued for built-in functions
7045 known to read the object.) Annotating the function with attribute
7046 @code{access (none)} indicates that the argument isn't used to access
7047 the object and avoids the warning (@pxref{Common Function Attributes}).
7049 These warnings are only possible in optimizing compilation, because otherwise
7050 GCC does not keep track of the state of variables.
7052 These warnings are made optional because GCC may not be able to determine when
7053 the code is correct in spite of appearing to have an error. Here is one
7054 example of how this can happen:
7074 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7075 always initialized, but GCC doesn't know this. To suppress the
7076 warning, you need to provide a default case with assert(0) or
7079 @cindex @code{longjmp} warnings
7080 This option also warns when a non-volatile automatic variable might be
7081 changed by a call to @code{longjmp}.
7082 The compiler sees only the calls to @code{setjmp}. It cannot know
7083 where @code{longjmp} will be called; in fact, a signal handler could
7084 call it at any point in the code. As a result, you may get a warning
7085 even when there is in fact no problem because @code{longjmp} cannot
7086 in fact be called at the place that would cause a problem.
7088 Some spurious warnings can be avoided if you declare all the functions
7089 you use that never return as @code{noreturn}. @xref{Function
7092 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7094 @item -Wunknown-pragmas
7095 @opindex Wunknown-pragmas
7096 @opindex Wno-unknown-pragmas
7097 @cindex warning for unknown pragmas
7098 @cindex unknown pragmas, warning
7099 @cindex pragmas, warning of unknown
7100 Warn when a @code{#pragma} directive is encountered that is not understood by
7101 GCC@. If this command-line option is used, warnings are even issued
7102 for unknown pragmas in system header files. This is not the case if
7103 the warnings are only enabled by the @option{-Wall} command-line option.
7106 @opindex Wno-pragmas
7108 Do not warn about misuses of pragmas, such as incorrect parameters,
7109 invalid syntax, or conflicts between pragmas. See also
7110 @option{-Wunknown-pragmas}.
7112 @item -Wno-prio-ctor-dtor
7113 @opindex Wno-prio-ctor-dtor
7114 @opindex Wprio-ctor-dtor
7115 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7116 The use of constructor and destructor attributes allow you to assign a
7117 priority to the constructor/destructor to control its order of execution
7118 before @code{main} is called or after it returns. The priority values must be
7119 greater than 100 as the compiler reserves priority values between 0--100 for
7122 @item -Wstrict-aliasing
7123 @opindex Wstrict-aliasing
7124 @opindex Wno-strict-aliasing
7125 This option is only active when @option{-fstrict-aliasing} is active.
7126 It warns about code that might break the strict aliasing rules that the
7127 compiler is using for optimization. The warning does not catch all
7128 cases, but does attempt to catch the more common pitfalls. It is
7129 included in @option{-Wall}.
7130 It is equivalent to @option{-Wstrict-aliasing=3}
7132 @item -Wstrict-aliasing=n
7133 @opindex Wstrict-aliasing=n
7134 This option is only active when @option{-fstrict-aliasing} is active.
7135 It warns about code that might break the strict aliasing rules that the
7136 compiler is using for optimization.
7137 Higher levels correspond to higher accuracy (fewer false positives).
7138 Higher levels also correspond to more effort, similar to the way @option{-O}
7140 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7142 Level 1: Most aggressive, quick, least accurate.
7143 Possibly useful when higher levels
7144 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7145 false negatives. However, it has many false positives.
7146 Warns for all pointer conversions between possibly incompatible types,
7147 even if never dereferenced. Runs in the front end only.
7149 Level 2: Aggressive, quick, not too precise.
7150 May still have many false positives (not as many as level 1 though),
7151 and few false negatives (but possibly more than level 1).
7152 Unlike level 1, it only warns when an address is taken. Warns about
7153 incomplete types. Runs in the front end only.
7155 Level 3 (default for @option{-Wstrict-aliasing}):
7156 Should have very few false positives and few false
7157 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
7158 Takes care of the common pun+dereference pattern in the front end:
7159 @code{*(int*)&some_float}.
7160 If optimization is enabled, it also runs in the back end, where it deals
7161 with multiple statement cases using flow-sensitive points-to information.
7162 Only warns when the converted pointer is dereferenced.
7163 Does not warn about incomplete types.
7165 @item -Wstrict-overflow
7166 @itemx -Wstrict-overflow=@var{n}
7167 @opindex Wstrict-overflow
7168 @opindex Wno-strict-overflow
7169 This option is only active when signed overflow is undefined.
7170 It warns about cases where the compiler optimizes based on the
7171 assumption that signed overflow does not occur. Note that it does not
7172 warn about all cases where the code might overflow: it only warns
7173 about cases where the compiler implements some optimization. Thus
7174 this warning depends on the optimization level.
7176 An optimization that assumes that signed overflow does not occur is
7177 perfectly safe if the values of the variables involved are such that
7178 overflow never does, in fact, occur. Therefore this warning can
7179 easily give a false positive: a warning about code that is not
7180 actually a problem. To help focus on important issues, several
7181 warning levels are defined. No warnings are issued for the use of
7182 undefined signed overflow when estimating how many iterations a loop
7183 requires, in particular when determining whether a loop will be
7187 @item -Wstrict-overflow=1
7188 Warn about cases that are both questionable and easy to avoid. For
7189 example the compiler simplifies
7190 @code{x + 1 > x} to @code{1}. This level of
7191 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7192 are not, and must be explicitly requested.
7194 @item -Wstrict-overflow=2
7195 Also warn about other cases where a comparison is simplified to a
7196 constant. For example: @code{abs (x) >= 0}. This can only be
7197 simplified when signed integer overflow is undefined, because
7198 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7199 zero. @option{-Wstrict-overflow} (with no level) is the same as
7200 @option{-Wstrict-overflow=2}.
7202 @item -Wstrict-overflow=3
7203 Also warn about other cases where a comparison is simplified. For
7204 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7206 @item -Wstrict-overflow=4
7207 Also warn about other simplifications not covered by the above cases.
7208 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7210 @item -Wstrict-overflow=5
7211 Also warn about cases where the compiler reduces the magnitude of a
7212 constant involved in a comparison. For example: @code{x + 2 > y} is
7213 simplified to @code{x + 1 >= y}. This is reported only at the
7214 highest warning level because this simplification applies to many
7215 comparisons, so this warning level gives a very large number of
7219 @item -Wstring-compare
7220 @opindex Wstring-compare
7221 @opindex Wno-string-compare
7222 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7223 determined to be either zero or non-zero in tests for such equality
7224 owing to the length of one argument being greater than the size of
7225 the array the other argument is stored in (or the bound in the case
7226 of @code{strncmp}). Such calls could be mistakes. For example,
7227 the call to @code{strcmp} below is diagnosed because its result is
7228 necessarily non-zero irrespective of the contents of the array @code{a}.
7234 strcpy (d, "string");
7236 if (0 == strcmp (a, d)) // cannot be true
7237 puts ("a and d are the same");
7241 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7243 @item -Wno-stringop-overflow
7244 @item -Wstringop-overflow
7245 @itemx -Wstringop-overflow=@var{type}
7246 @opindex Wstringop-overflow
7247 @opindex Wno-stringop-overflow
7248 Warn for calls to string manipulation functions such as @code{memcpy} and
7249 @code{strcpy} that are determined to overflow the destination buffer. The
7250 optional argument is one greater than the type of Object Size Checking to
7251 perform to determine the size of the destination. @xref{Object Size Checking}.
7252 The argument is meaningful only for functions that operate on character arrays
7253 but not for raw memory functions like @code{memcpy} which always make use
7254 of Object Size type-0. The option also warns for calls that specify a size
7255 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7256 The option produces the best results with optimization enabled but can detect
7257 a small subset of simple buffer overflows even without optimization in
7258 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7259 correspond to the standard functions. In any case, the option warns about
7260 just a subset of buffer overflows detected by the corresponding overflow
7261 checking built-ins. For example, the option issues a warning for
7262 the @code{strcpy} call below because it copies at least 5 characters
7263 (the string @code{"blue"} including the terminating NUL) into the buffer
7267 enum Color @{ blue, purple, yellow @};
7268 const char* f (enum Color clr)
7270 static char buf [4];
7274 case blue: str = "blue"; break;
7275 case purple: str = "purple"; break;
7276 case yellow: str = "yellow"; break;
7279 return strcpy (buf, str); // warning here
7283 Option @option{-Wstringop-overflow=2} is enabled by default.
7286 @item -Wstringop-overflow
7287 @itemx -Wstringop-overflow=1
7288 @opindex Wstringop-overflow
7289 @opindex Wno-stringop-overflow
7290 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7291 to determine the sizes of destination objects. At this setting the option
7292 does not warn for writes past the end of subobjects of larger objects accessed
7293 by pointers unless the size of the largest surrounding object is known. When
7294 the destination may be one of several objects it is assumed to be the largest
7295 one of them. On Linux systems, when optimization is enabled at this setting
7296 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7297 is defined to a non-zero value.
7299 @item -Wstringop-overflow=2
7300 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7301 to determine the sizes of destination objects. At this setting the option
7302 warns about overflows when writing to members of the largest complete
7303 objects whose exact size is known. However, it does not warn for excessive
7304 writes to the same members of unknown objects referenced by pointers since
7305 they may point to arrays containing unknown numbers of elements. This is
7306 the default setting of the option.
7308 @item -Wstringop-overflow=3
7309 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7310 to determine the sizes of destination objects. At this setting the option
7311 warns about overflowing the smallest object or data member. This is the
7312 most restrictive setting of the option that may result in warnings for safe
7315 @item -Wstringop-overflow=4
7316 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7317 to determine the sizes of destination objects. At this setting the option
7318 warns about overflowing any data members, and when the destination is
7319 one of several objects it uses the size of the largest of them to decide
7320 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
7321 setting of the option may result in warnings for benign code.
7324 @item -Wno-stringop-overread
7325 @opindex Wstringop-overread
7326 @opindex Wno-stringop-overread
7327 Warn for calls to string manipulation functions such as @code{memchr}, or
7328 @code{strcpy} that are determined to read past the end of the source
7331 Option @option{-Wstringop-overread} is enabled by default.
7333 @item -Wno-stringop-truncation
7334 @opindex Wstringop-truncation
7335 @opindex Wno-stringop-truncation
7336 Do not warn for calls to bounded string manipulation functions
7337 such as @code{strncat},
7338 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7339 or leave the destination unchanged.
7341 In the following example, the call to @code{strncat} specifies a bound that
7342 is less than the length of the source string. As a result, the copy of
7343 the source will be truncated and so the call is diagnosed. To avoid the
7344 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7347 void append (char *buf, size_t bufsize)
7349 strncat (buf, ".txt", 3);
7353 As another example, the following call to @code{strncpy} results in copying
7354 to @code{d} just the characters preceding the terminating NUL, without
7355 appending the NUL to the end. Assuming the result of @code{strncpy} is
7356 necessarily a NUL-terminated string is a common mistake, and so the call
7357 is diagnosed. To avoid the warning when the result is not expected to be
7358 NUL-terminated, call @code{memcpy} instead.
7361 void copy (char *d, const char *s)
7363 strncpy (d, s, strlen (s));
7367 In the following example, the call to @code{strncpy} specifies the size
7368 of the destination buffer as the bound. If the length of the source
7369 string is equal to or greater than this size the result of the copy will
7370 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
7371 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7372 element of the buffer to @code{NUL}.
7375 void copy (const char *s)
7378 strncpy (buf, s, sizeof buf);
7383 In situations where a character array is intended to store a sequence
7384 of bytes with no terminating @code{NUL} such an array may be annotated
7385 with attribute @code{nonstring} to avoid this warning. Such arrays,
7386 however, are not suitable arguments to functions that expect
7387 @code{NUL}-terminated strings. To help detect accidental misuses of
7388 such arrays GCC issues warnings unless it can prove that the use is
7389 safe. @xref{Common Variable Attributes}.
7391 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7392 @opindex Wsuggest-attribute=
7393 @opindex Wno-suggest-attribute=
7394 Warn for cases where adding an attribute may be beneficial. The
7395 attributes currently supported are listed below.
7398 @item -Wsuggest-attribute=pure
7399 @itemx -Wsuggest-attribute=const
7400 @itemx -Wsuggest-attribute=noreturn
7401 @itemx -Wmissing-noreturn
7402 @itemx -Wsuggest-attribute=malloc
7403 @opindex Wsuggest-attribute=pure
7404 @opindex Wno-suggest-attribute=pure
7405 @opindex Wsuggest-attribute=const
7406 @opindex Wno-suggest-attribute=const
7407 @opindex Wsuggest-attribute=noreturn
7408 @opindex Wno-suggest-attribute=noreturn
7409 @opindex Wmissing-noreturn
7410 @opindex Wno-missing-noreturn
7411 @opindex Wsuggest-attribute=malloc
7412 @opindex Wno-suggest-attribute=malloc
7414 Warn about functions that might be candidates for attributes
7415 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7416 only warns for functions visible in other compilation units or (in the case of
7417 @code{pure} and @code{const}) if it cannot prove that the function returns
7418 normally. A function returns normally if it doesn't contain an infinite loop or
7419 return abnormally by throwing, calling @code{abort} or trapping. This analysis
7420 requires option @option{-fipa-pure-const}, which is enabled by default at
7421 @option{-O} and higher. Higher optimization levels improve the accuracy
7424 @item -Wsuggest-attribute=format
7425 @itemx -Wmissing-format-attribute
7426 @opindex Wsuggest-attribute=format
7427 @opindex Wmissing-format-attribute
7428 @opindex Wno-suggest-attribute=format
7429 @opindex Wno-missing-format-attribute
7433 Warn about function pointers that might be candidates for @code{format}
7434 attributes. Note these are only possible candidates, not absolute ones.
7435 GCC guesses that function pointers with @code{format} attributes that
7436 are used in assignment, initialization, parameter passing or return
7437 statements should have a corresponding @code{format} attribute in the
7438 resulting type. I.e.@: the left-hand side of the assignment or
7439 initialization, the type of the parameter variable, or the return type
7440 of the containing function respectively should also have a @code{format}
7441 attribute to avoid the warning.
7443 GCC also warns about function definitions that might be
7444 candidates for @code{format} attributes. Again, these are only
7445 possible candidates. GCC guesses that @code{format} attributes
7446 might be appropriate for any function that calls a function like
7447 @code{vprintf} or @code{vscanf}, but this might not always be the
7448 case, and some functions for which @code{format} attributes are
7449 appropriate may not be detected.
7451 @item -Wsuggest-attribute=cold
7452 @opindex Wsuggest-attribute=cold
7453 @opindex Wno-suggest-attribute=cold
7455 Warn about functions that might be candidates for @code{cold} attribute. This
7456 is based on static detection and generally only warns about functions which
7457 always leads to a call to another @code{cold} function such as wrappers of
7458 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7462 @opindex Wno-alloc-zero
7463 @opindex Walloc-zero
7464 Warn about calls to allocation functions decorated with attribute
7465 @code{alloc_size} that specify zero bytes, including those to the built-in
7466 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7467 @code{malloc}, and @code{realloc}. Because the behavior of these functions
7468 when called with a zero size differs among implementations (and in the case
7469 of @code{realloc} has been deprecated) relying on it may result in subtle
7470 portability bugs and should be avoided.
7472 @item -Walloc-size-larger-than=@var{byte-size}
7473 @opindex Walloc-size-larger-than=
7474 @opindex Wno-alloc-size-larger-than
7475 Warn about calls to functions decorated with attribute @code{alloc_size}
7476 that attempt to allocate objects larger than the specified number of bytes,
7477 or where the result of the size computation in an integer type with infinite
7478 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7479 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7480 Warnings controlled by the option can be disabled either by specifying
7481 @var{byte-size} of @samp{SIZE_MAX} or more or by
7482 @option{-Wno-alloc-size-larger-than}.
7483 @xref{Function Attributes}.
7485 @item -Wno-alloc-size-larger-than
7486 @opindex Wno-alloc-size-larger-than
7487 Disable @option{-Walloc-size-larger-than=} warnings. The option is
7488 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7494 This option warns on all uses of @code{alloca} in the source.
7496 @item -Walloca-larger-than=@var{byte-size}
7497 @opindex Walloca-larger-than=
7498 @opindex Wno-alloca-larger-than
7499 This option warns on calls to @code{alloca} with an integer argument whose
7500 value is either zero, or that is not bounded by a controlling predicate
7501 that limits its value to at most @var{byte-size}. It also warns for calls
7502 to @code{alloca} where the bound value is unknown. Arguments of non-integer
7503 types are considered unbounded even if they appear to be constrained to
7506 For example, a bounded case of @code{alloca} could be:
7509 void func (size_t n)
7520 In the above example, passing @code{-Walloca-larger-than=1000} would not
7521 issue a warning because the call to @code{alloca} is known to be at most
7522 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
7523 the compiler would emit a warning.
7525 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7526 controlling predicate constraining its integer argument. For example:
7531 void *p = alloca (n);
7536 If @code{-Walloca-larger-than=500} were passed, the above would trigger
7537 a warning, but this time because of the lack of bounds checking.
7539 Note, that even seemingly correct code involving signed integers could
7543 void func (signed int n)
7553 In the above example, @var{n} could be negative, causing a larger than
7554 expected argument to be implicitly cast into the @code{alloca} call.
7556 This option also warns when @code{alloca} is used in a loop.
7558 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
7559 but is usually only effective when @option{-ftree-vrp} is active (default
7560 for @option{-O2} and above).
7562 See also @option{-Wvla-larger-than=}@samp{byte-size}.
7564 @item -Wno-alloca-larger-than
7565 @opindex Wno-alloca-larger-than
7566 Disable @option{-Walloca-larger-than=} warnings. The option is
7567 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
7569 @item -Warith-conversion
7570 @opindex Warith-conversion
7571 @opindex Wno-arith-conversion
7572 Do warn about implicit conversions from arithmetic operations even
7573 when conversion of the operands to the same type cannot change their
7574 values. This affects warnings from @option{-Wconversion},
7575 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
7579 void f (char c, int i)
7581 c = c + i; // warns with @option{-Wconversion}
7582 c = c + 1; // only warns with @option{-Warith-conversion}
7587 @item -Warray-bounds
7588 @itemx -Warray-bounds=@var{n}
7589 @opindex Wno-array-bounds
7590 @opindex Warray-bounds
7591 This option is only active when @option{-ftree-vrp} is active
7592 (default for @option{-O2} and above). It warns about subscripts to arrays
7593 that are always out of bounds. This warning is enabled by @option{-Wall}.
7596 @item -Warray-bounds=1
7597 This is the warning level of @option{-Warray-bounds} and is enabled
7598 by @option{-Wall}; higher levels are not, and must be explicitly requested.
7600 @item -Warray-bounds=2
7601 This warning level also warns about out of bounds access for
7602 arrays at the end of a struct and for arrays accessed through
7603 pointers. This warning level may give a larger number of
7604 false positives and is deactivated by default.
7607 @item -Warray-compare
7608 @opindex Warray-compare
7609 @opindex Wno-array-compare
7610 Warn about equality and relational comparisons between two operands of array
7611 type. This comparison was deprecated in C++20. For example:
7616 bool same = arr1 == arr2;
7619 @option{-Warray-compare} is enabled by @option{-Wall}.
7621 @item -Warray-parameter
7622 @itemx -Warray-parameter=@var{n}
7623 @opindex Wno-array-parameter
7624 Warn about redeclarations of functions involving arguments of array or
7625 pointer types of inconsistent kinds or forms, and enable the detection
7626 of out-of-bounds accesses to such parameters by warnings such as
7627 @option{-Warray-bounds}.
7629 If the first function declaration uses the array form the bound specified
7630 in the array is assumed to be the minimum number of elements expected to
7631 be provided in calls to the function and the maximum number of elements
7632 accessed by it. Failing to provide arguments of sufficient size or accessing
7633 more than the maximum number of elements may be diagnosed by warnings such
7634 as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies
7635 involving array parameters declared using the @code{T[static N]} form.
7637 For example, the warning triggers for the following redeclarations because
7638 the first one allows an array of any size to be passed to @code{f} while
7639 the second one with the keyword @code{static} specifies that the array
7640 argument must have at least four elements.
7643 void f (int[static 4]);
7644 void f (int[]); // warning (inconsistent array form)
7648 int *p = (int *)malloc (4);
7649 f (p); // warning (array too small)
7654 At level 2 the warning also triggers for redeclarations involving any other
7655 inconsistency in array or pointer argument forms denoting array sizes.
7656 Pointers and arrays of unspecified bound are considered equivalent and do
7657 not trigger a warning.
7661 void g (int[]); // no warning
7662 void g (int[8]); // warning (inconsistent array bound)
7665 @option{-Warray-parameter=2} is included in @option{-Wall}. The
7666 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
7667 involving Variable Length Array arguments.
7669 @item -Wattribute-alias=@var{n}
7670 @itemx -Wno-attribute-alias
7671 @opindex Wattribute-alias
7672 @opindex Wno-attribute-alias
7673 Warn about declarations using the @code{alias} and similar attributes whose
7674 target is incompatible with the type of the alias.
7675 @xref{Function Attributes,,Declaring Attributes of Functions}.
7678 @item -Wattribute-alias=1
7679 The default warning level of the @option{-Wattribute-alias} option diagnoses
7680 incompatibilities between the type of the alias declaration and that of its
7681 target. Such incompatibilities are typically indicative of bugs.
7683 @item -Wattribute-alias=2
7685 At this level @option{-Wattribute-alias} also diagnoses cases where
7686 the attributes of the alias declaration are more restrictive than the
7687 attributes applied to its target. These mismatches can potentially
7688 result in incorrect code generation. In other cases they may be
7689 benign and could be resolved simply by adding the missing attribute to
7690 the target. For comparison, see the @option{-Wmissing-attributes}
7691 option, which controls diagnostics when the alias declaration is less
7692 restrictive than the target, rather than more restrictive.
7694 Attributes considered include @code{alloc_align}, @code{alloc_size},
7695 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7696 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7697 @code{returns_nonnull}, and @code{returns_twice}.
7700 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
7701 This is the default. You can disable these warnings with either
7702 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
7704 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]}
7705 @opindex Wbidi-chars=
7706 @opindex Wbidi-chars
7707 @opindex Wno-bidi-chars
7708 Warn about possibly misleading UTF-8 bidirectional control characters in
7709 comments, string literals, character constants, and identifiers. Such
7710 characters can change left-to-right writing direction into right-to-left
7711 (and vice versa), which can cause confusion between the logical order and
7712 visual order. This may be dangerous; for instance, it may seem that a piece
7713 of code is not commented out, whereas it in fact is.
7715 There are three levels of warning supported by GCC@. The default is
7716 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
7717 bidi contexts. @option{-Wbidi-chars=none} turns the warning off.
7718 @option{-Wbidi-chars=any} warns about any use of bidirectional control
7721 @item -Wbool-compare
7722 @opindex Wno-bool-compare
7723 @opindex Wbool-compare
7724 Warn about boolean expression compared with an integer value different from
7725 @code{true}/@code{false}. For instance, the following comparison is
7730 if ((n > 1) == 2) @{ @dots{} @}
7732 This warning is enabled by @option{-Wall}.
7734 @item -Wbool-operation
7735 @opindex Wno-bool-operation
7736 @opindex Wbool-operation
7737 Warn about suspicious operations on expressions of a boolean type. For
7738 instance, bitwise negation of a boolean is very likely a bug in the program.
7739 For C, this warning also warns about incrementing or decrementing a boolean,
7740 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
7741 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
7743 This warning is enabled by @option{-Wall}.
7745 @item -Wduplicated-branches
7746 @opindex Wno-duplicated-branches
7747 @opindex Wduplicated-branches
7748 Warn when an if-else has identical branches. This warning detects cases like
7755 It doesn't warn when both branches contain just a null statement. This warning
7756 also warn for conditional operators:
7758 int i = x ? *p : *p;
7761 @item -Wduplicated-cond
7762 @opindex Wno-duplicated-cond
7763 @opindex Wduplicated-cond
7764 Warn about duplicated conditions in an if-else-if chain. For instance,
7765 warn for the following code:
7767 if (p->q != NULL) @{ @dots{} @}
7768 else if (p->q != NULL) @{ @dots{} @}
7771 @item -Wframe-address
7772 @opindex Wno-frame-address
7773 @opindex Wframe-address
7774 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
7775 is called with an argument greater than 0. Such calls may return indeterminate
7776 values or crash the program. The warning is included in @option{-Wall}.
7778 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
7779 @opindex Wno-discarded-qualifiers
7780 @opindex Wdiscarded-qualifiers
7781 Do not warn if type qualifiers on pointers are being discarded.
7782 Typically, the compiler warns if a @code{const char *} variable is
7783 passed to a function that takes a @code{char *} parameter. This option
7784 can be used to suppress such a warning.
7786 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
7787 @opindex Wno-discarded-array-qualifiers
7788 @opindex Wdiscarded-array-qualifiers
7789 Do not warn if type qualifiers on arrays which are pointer targets
7790 are being discarded. Typically, the compiler warns if a
7791 @code{const int (*)[]} variable is passed to a function that
7792 takes a @code{int (*)[]} parameter. This option can be used to
7793 suppress such a warning.
7795 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
7796 @opindex Wno-incompatible-pointer-types
7797 @opindex Wincompatible-pointer-types
7798 Do not warn when there is a conversion between pointers that have incompatible
7799 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
7800 which warns for pointer argument passing or assignment with different
7803 @item -Wno-int-conversion @r{(C and Objective-C only)}
7804 @opindex Wno-int-conversion
7805 @opindex Wint-conversion
7806 Do not warn about incompatible integer to pointer and pointer to integer
7807 conversions. This warning is about implicit conversions; for explicit
7808 conversions the warnings @option{-Wno-int-to-pointer-cast} and
7809 @option{-Wno-pointer-to-int-cast} may be used.
7811 @item -Wzero-length-bounds
7812 @opindex Wzero-length-bounds
7813 @opindex Wzero-length-bounds
7814 Warn about accesses to elements of zero-length array members that might
7815 overlap other members of the same object. Declaring interior zero-length
7816 arrays is discouraged because accesses to them are undefined. See
7819 For example, the first two stores in function @code{bad} are diagnosed
7820 because the array elements overlap the subsequent members @code{b} and
7821 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
7822 because it is beyond the bounds of the enclosing object.
7825 struct X @{ int a[0]; int b, c; @};
7830 x.a[0] = 0; // -Wzero-length-bounds
7831 x.a[1] = 1; // -Wzero-length-bounds
7832 x.a[2] = 2; // -Warray-bounds
7836 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
7838 @item -Wno-div-by-zero
7839 @opindex Wno-div-by-zero
7840 @opindex Wdiv-by-zero
7841 Do not warn about compile-time integer division by zero. Floating-point
7842 division by zero is not warned about, as it can be a legitimate way of
7843 obtaining infinities and NaNs.
7845 @item -Wsystem-headers
7846 @opindex Wsystem-headers
7847 @opindex Wno-system-headers
7848 @cindex warnings from system headers
7849 @cindex system headers, warnings from
7850 Print warning messages for constructs found in system header files.
7851 Warnings from system headers are normally suppressed, on the assumption
7852 that they usually do not indicate real problems and would only make the
7853 compiler output harder to read. Using this command-line option tells
7854 GCC to emit warnings from system headers as if they occurred in user
7855 code. However, note that using @option{-Wall} in conjunction with this
7856 option does @emph{not} warn about unknown pragmas in system
7857 headers---for that, @option{-Wunknown-pragmas} must also be used.
7859 @item -Wtautological-compare
7860 @opindex Wtautological-compare
7861 @opindex Wno-tautological-compare
7862 Warn if a self-comparison always evaluates to true or false. This
7863 warning detects various mistakes such as:
7867 if (i > i) @{ @dots{} @}
7870 This warning also warns about bitwise comparisons that always evaluate
7871 to true or false, for instance:
7873 if ((a & 16) == 10) @{ @dots{} @}
7875 will always be false.
7877 This warning is enabled by @option{-Wall}.
7880 @opindex Wtrampolines
7881 @opindex Wno-trampolines
7882 Warn about trampolines generated for pointers to nested functions.
7883 A trampoline is a small piece of data or code that is created at run
7884 time on the stack when the address of a nested function is taken, and is
7885 used to call the nested function indirectly. For some targets, it is
7886 made up of data only and thus requires no special treatment. But, for
7887 most targets, it is made up of code and thus requires the stack to be
7888 made executable in order for the program to work properly.
7891 @opindex Wfloat-equal
7892 @opindex Wno-float-equal
7893 Warn if floating-point values are used in equality comparisons.
7895 The idea behind this is that sometimes it is convenient (for the
7896 programmer) to consider floating-point values as approximations to
7897 infinitely precise real numbers. If you are doing this, then you need
7898 to compute (by analyzing the code, or in some other way) the maximum or
7899 likely maximum error that the computation introduces, and allow for it
7900 when performing comparisons (and when producing output, but that's a
7901 different problem). In particular, instead of testing for equality, you
7902 should check to see whether the two values have ranges that overlap; and
7903 this is done with the relational operators, so equality comparisons are
7906 @item -Wtraditional @r{(C and Objective-C only)}
7907 @opindex Wtraditional
7908 @opindex Wno-traditional
7909 Warn about certain constructs that behave differently in traditional and
7910 ISO C@. Also warn about ISO C constructs that have no traditional C
7911 equivalent, and/or problematic constructs that should be avoided.
7915 Macro parameters that appear within string literals in the macro body.
7916 In traditional C macro replacement takes place within string literals,
7917 but in ISO C it does not.
7920 In traditional C, some preprocessor directives did not exist.
7921 Traditional preprocessors only considered a line to be a directive
7922 if the @samp{#} appeared in column 1 on the line. Therefore
7923 @option{-Wtraditional} warns about directives that traditional C
7924 understands but ignores because the @samp{#} does not appear as the
7925 first character on the line. It also suggests you hide directives like
7926 @code{#pragma} not understood by traditional C by indenting them. Some
7927 traditional implementations do not recognize @code{#elif}, so this option
7928 suggests avoiding it altogether.
7931 A function-like macro that appears without arguments.
7934 The unary plus operator.
7937 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
7938 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
7939 constants.) Note, these suffixes appear in macros defined in the system
7940 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
7941 Use of these macros in user code might normally lead to spurious
7942 warnings, however GCC's integrated preprocessor has enough context to
7943 avoid warning in these cases.
7946 A function declared external in one block and then used after the end of
7950 A @code{switch} statement has an operand of type @code{long}.
7953 A non-@code{static} function declaration follows a @code{static} one.
7954 This construct is not accepted by some traditional C compilers.
7957 The ISO type of an integer constant has a different width or
7958 signedness from its traditional type. This warning is only issued if
7959 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
7960 typically represent bit patterns, are not warned about.
7963 Usage of ISO string concatenation is detected.
7966 Initialization of automatic aggregates.
7969 Identifier conflicts with labels. Traditional C lacks a separate
7970 namespace for labels.
7973 Initialization of unions. If the initializer is zero, the warning is
7974 omitted. This is done under the assumption that the zero initializer in
7975 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7976 initializer warnings and relies on default initialization to zero in the
7980 Conversions by prototypes between fixed/floating-point values and vice
7981 versa. The absence of these prototypes when compiling with traditional
7982 C causes serious problems. This is a subset of the possible
7983 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7986 Use of ISO C style function definitions. This warning intentionally is
7987 @emph{not} issued for prototype declarations or variadic functions
7988 because these ISO C features appear in your code when using
7989 libiberty's traditional C compatibility macros, @code{PARAMS} and
7990 @code{VPARAMS}. This warning is also bypassed for nested functions
7991 because that feature is already a GCC extension and thus not relevant to
7992 traditional C compatibility.
7995 @item -Wtraditional-conversion @r{(C and Objective-C only)}
7996 @opindex Wtraditional-conversion
7997 @opindex Wno-traditional-conversion
7998 Warn if a prototype causes a type conversion that is different from what
7999 would happen to the same argument in the absence of a prototype. This
8000 includes conversions of fixed point to floating and vice versa, and
8001 conversions changing the width or signedness of a fixed-point argument
8002 except when the same as the default promotion.
8004 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8005 @opindex Wdeclaration-after-statement
8006 @opindex Wno-declaration-after-statement
8007 Warn when a declaration is found after a statement in a block. This
8008 construct, known from C++, was introduced with ISO C99 and is by default
8009 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}.
8014 Warn whenever a local variable or type declaration shadows another
8015 variable, parameter, type, class member (in C++), or instance variable
8016 (in Objective-C) or whenever a built-in function is shadowed. Note
8017 that in C++, the compiler warns if a local variable shadows an
8018 explicit typedef, but not if it shadows a struct/class/enum.
8019 If this warning is enabled, it includes also all instances of
8020 local shadowing. This means that @option{-Wno-shadow=local}
8021 and @option{-Wno-shadow=compatible-local} are ignored when
8022 @option{-Wshadow} is used.
8023 Same as @option{-Wshadow=global}.
8025 @item -Wno-shadow-ivar @r{(Objective-C only)}
8026 @opindex Wno-shadow-ivar
8027 @opindex Wshadow-ivar
8028 Do not warn whenever a local variable shadows an instance variable in an
8031 @item -Wshadow=global
8032 @opindex Wshadow=global
8033 Warn for any shadowing.
8034 Same as @option{-Wshadow}.
8036 @item -Wshadow=local
8037 @opindex Wshadow=local
8038 Warn when a local variable shadows another local variable or parameter.
8040 @item -Wshadow=compatible-local
8041 @opindex Wshadow=compatible-local
8042 Warn when a local variable shadows another local variable or parameter
8043 whose type is compatible with that of the shadowing variable. In C++,
8044 type compatibility here means the type of the shadowing variable can be
8045 converted to that of the shadowed variable. The creation of this flag
8046 (in addition to @option{-Wshadow=local}) is based on the idea that when
8047 a local variable shadows another one of incompatible type, it is most
8048 likely intentional, not a bug or typo, as shown in the following example:
8052 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8054 for (int i = 0; i < N; ++i)
8063 Since the two variable @code{i} in the example above have incompatible types,
8064 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8065 Because their types are incompatible, if a programmer accidentally uses one
8066 in place of the other, type checking is expected to catch that and emit an
8067 error or warning. Use of this flag instead of @option{-Wshadow=local} can
8068 possibly reduce the number of warnings triggered by intentional shadowing.
8069 Note that this also means that shadowing @code{const char *i} by
8070 @code{char *i} does not emit a warning.
8072 This warning is also enabled by @option{-Wshadow=local}.
8074 @item -Wlarger-than=@var{byte-size}
8075 @opindex Wlarger-than=
8076 @opindex Wlarger-than-@var{byte-size}
8077 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8078 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8079 Warnings controlled by the option can be disabled either by specifying
8080 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8082 Also warn for calls to bounded functions such as @code{memchr} or
8083 @code{strnlen} that specify a bound greater than the largest possible
8084 object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings
8085 can only be disabled by @option{-Wno-larger-than}.
8087 @item -Wno-larger-than
8088 @opindex Wno-larger-than
8089 Disable @option{-Wlarger-than=} warnings. The option is equivalent
8090 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8092 @item -Wframe-larger-than=@var{byte-size}
8093 @opindex Wframe-larger-than=
8094 @opindex Wno-frame-larger-than
8095 Warn if the size of a function frame exceeds @var{byte-size}.
8096 The computation done to determine the stack frame size is approximate
8097 and not conservative.
8098 The actual requirements may be somewhat greater than @var{byte-size}
8099 even if you do not get a warning. In addition, any space allocated
8100 via @code{alloca}, variable-length arrays, or related constructs
8101 is not included by the compiler when determining
8102 whether or not to issue a warning.
8103 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8104 Warnings controlled by the option can be disabled either by specifying
8105 @var{byte-size} of @samp{SIZE_MAX} or more or by
8106 @option{-Wno-frame-larger-than}.
8108 @item -Wno-frame-larger-than
8109 @opindex Wno-frame-larger-than
8110 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
8111 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8113 @item -Wfree-nonheap-object
8114 @opindex Wfree-nonheap-object
8115 @opindex Wno-free-nonheap-object
8116 Warn when attempting to deallocate an object that was either not allocated
8117 on the heap, or by using a pointer that was not returned from a prior call
8118 to the corresponding allocation function. For example, because the call
8119 to @code{stpcpy} returns a pointer to the terminating nul character and
8120 not to the begginning of the object, the call to @code{free} below is
8126 p = stpcpy (p, "abc");
8128 free (p); // warning
8132 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8134 @item -Wstack-usage=@var{byte-size}
8135 @opindex Wstack-usage
8136 @opindex Wno-stack-usage
8137 Warn if the stack usage of a function might exceed @var{byte-size}.
8138 The computation done to determine the stack usage is conservative.
8139 Any space allocated via @code{alloca}, variable-length arrays, or related
8140 constructs is included by the compiler when determining whether or not to
8143 The message is in keeping with the output of @option{-fstack-usage}.
8147 If the stack usage is fully static but exceeds the specified amount, it's:
8150 warning: stack usage is 1120 bytes
8153 If the stack usage is (partly) dynamic but bounded, it's:
8156 warning: stack usage might be 1648 bytes
8159 If the stack usage is (partly) dynamic and not bounded, it's:
8162 warning: stack usage might be unbounded
8166 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8167 Warnings controlled by the option can be disabled either by specifying
8168 @var{byte-size} of @samp{SIZE_MAX} or more or by
8169 @option{-Wno-stack-usage}.
8171 @item -Wno-stack-usage
8172 @opindex Wno-stack-usage
8173 Disable @option{-Wstack-usage=} warnings. The option is equivalent
8174 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8176 @item -Wunsafe-loop-optimizations
8177 @opindex Wunsafe-loop-optimizations
8178 @opindex Wno-unsafe-loop-optimizations
8179 Warn if the loop cannot be optimized because the compiler cannot
8180 assume anything on the bounds of the loop indices. With
8181 @option{-funsafe-loop-optimizations} warn if the compiler makes
8184 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8185 @opindex Wno-pedantic-ms-format
8186 @opindex Wpedantic-ms-format
8187 When used in combination with @option{-Wformat}
8188 and @option{-pedantic} without GNU extensions, this option
8189 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8190 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8191 which depend on the MS runtime.
8193 @item -Wpointer-arith
8194 @opindex Wpointer-arith
8195 @opindex Wno-pointer-arith
8196 Warn about anything that depends on the ``size of'' a function type or
8197 of @code{void}. GNU C assigns these types a size of 1, for
8198 convenience in calculations with @code{void *} pointers and pointers
8199 to functions. In C++, warn also when an arithmetic operation involves
8200 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
8202 @item -Wno-pointer-compare
8203 @opindex Wpointer-compare
8204 @opindex Wno-pointer-compare
8205 Do not warn if a pointer is compared with a zero character constant.
8207 means that the pointer was meant to be dereferenced. For example:
8210 const char *p = foo ();
8215 Note that the code above is invalid in C++11.
8217 This warning is enabled by default.
8222 Warn about unsupported features in ThreadSanitizer.
8224 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8225 can report false positives.
8227 This warning is enabled by default.
8230 @opindex Wtype-limits
8231 @opindex Wno-type-limits
8232 Warn if a comparison is always true or always false due to the limited
8233 range of the data type, but do not warn for constant expressions. For
8234 example, warn if an unsigned variable is compared against zero with
8235 @code{<} or @code{>=}. This warning is also enabled by
8238 @item -Wabsolute-value @r{(C and Objective-C only)}
8239 @opindex Wabsolute-value
8240 @opindex Wno-absolute-value
8241 Warn for calls to standard functions that compute the absolute value
8242 of an argument when a more appropriate standard function is available.
8243 For example, calling @code{abs(3.14)} triggers the warning because the
8244 appropriate function to call to compute the absolute value of a double
8245 argument is @code{fabs}. The option also triggers warnings when the
8246 argument in a call to such a function has an unsigned type. This
8247 warning can be suppressed with an explicit type cast and it is also
8248 enabled by @option{-Wextra}.
8250 @include cppwarnopts.texi
8252 @item -Wbad-function-cast @r{(C and Objective-C only)}
8253 @opindex Wbad-function-cast
8254 @opindex Wno-bad-function-cast
8255 Warn when a function call is cast to a non-matching type.
8256 For example, warn if a call to a function returning an integer type
8257 is cast to a pointer type.
8259 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8260 @opindex Wc90-c99-compat
8261 @opindex Wno-c90-c99-compat
8262 Warn about features not present in ISO C90, but present in ISO C99.
8263 For instance, warn about use of variable length arrays, @code{long long}
8264 type, @code{bool} type, compound literals, designated initializers, and so
8265 on. This option is independent of the standards mode. Warnings are disabled
8266 in the expression that follows @code{__extension__}.
8268 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8269 @opindex Wc99-c11-compat
8270 @opindex Wno-c99-c11-compat
8271 Warn about features not present in ISO C99, but present in ISO C11.
8272 For instance, warn about use of anonymous structures and unions,
8273 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8274 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8275 and so on. This option is independent of the standards mode. Warnings are
8276 disabled in the expression that follows @code{__extension__}.
8278 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8279 @opindex Wc11-c2x-compat
8280 @opindex Wno-c11-c2x-compat
8281 Warn about features not present in ISO C11, but present in ISO C2X.
8282 For instance, warn about omitting the string in @code{_Static_assert},
8283 use of @samp{[[]]} syntax for attributes, use of decimal
8284 floating-point types, and so on. This option is independent of the
8285 standards mode. Warnings are disabled in the expression that follows
8286 @code{__extension__}.
8288 @item -Wc++-compat @r{(C and Objective-C only)}
8289 @opindex Wc++-compat
8290 @opindex Wno-c++-compat
8291 Warn about ISO C constructs that are outside of the common subset of
8292 ISO C and ISO C++, e.g.@: request for implicit conversion from
8293 @code{void *} to a pointer to non-@code{void} type.
8295 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8296 @opindex Wc++11-compat
8297 @opindex Wno-c++11-compat
8298 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8299 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8300 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
8301 enabled by @option{-Wall}.
8303 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8304 @opindex Wc++14-compat
8305 @opindex Wno-c++14-compat
8306 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8307 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
8309 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8310 @opindex Wc++17-compat
8311 @opindex Wno-c++17-compat
8312 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8313 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
8315 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8316 @opindex Wc++20-compat
8317 @opindex Wno-c++20-compat
8318 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8319 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
8321 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8322 @opindex Wc++11-extensions
8323 @opindex Wno-c++11-extensions
8324 Do not warn about C++11 constructs in code being compiled using
8325 an older C++ standard. Even without this option, some C++11 constructs
8326 will only be diagnosed if @option{-Wpedantic} is used.
8328 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8329 @opindex Wc++14-extensions
8330 @opindex Wno-c++14-extensions
8331 Do not warn about C++14 constructs in code being compiled using
8332 an older C++ standard. Even without this option, some C++14 constructs
8333 will only be diagnosed if @option{-Wpedantic} is used.
8335 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8336 @opindex Wc++17-extensions
8337 @opindex Wno-c++17-extensions
8338 Do not warn about C++17 constructs in code being compiled using
8339 an older C++ standard. Even without this option, some C++17 constructs
8340 will only be diagnosed if @option{-Wpedantic} is used.
8342 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8343 @opindex Wc++20-extensions
8344 @opindex Wno-c++20-extensions
8345 Do not warn about C++20 constructs in code being compiled using
8346 an older C++ standard. Even without this option, some C++20 constructs
8347 will only be diagnosed if @option{-Wpedantic} is used.
8349 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8350 @opindex Wc++23-extensions
8351 @opindex Wno-c++23-extensions
8352 Do not warn about C++23 constructs in code being compiled using
8353 an older C++ standard. Even without this option, some C++23 constructs
8354 will only be diagnosed if @option{-Wpedantic} is used.
8358 @opindex Wno-cast-qual
8359 Warn whenever a pointer is cast so as to remove a type qualifier from
8360 the target type. For example, warn if a @code{const char *} is cast
8361 to an ordinary @code{char *}.
8363 Also warn when making a cast that introduces a type qualifier in an
8364 unsafe way. For example, casting @code{char **} to @code{const char **}
8365 is unsafe, as in this example:
8368 /* p is char ** value. */
8369 const char **q = (const char **) p;
8370 /* Assignment of readonly string to const char * is OK. */
8372 /* Now char** pointer points to read-only memory. */
8377 @opindex Wcast-align
8378 @opindex Wno-cast-align
8379 Warn whenever a pointer is cast such that the required alignment of the
8380 target is increased. For example, warn if a @code{char *} is cast to
8381 an @code{int *} on machines where integers can only be accessed at
8382 two- or four-byte boundaries.
8384 @item -Wcast-align=strict
8385 @opindex Wcast-align=strict
8386 Warn whenever a pointer is cast such that the required alignment of the
8387 target is increased. For example, warn if a @code{char *} is cast to
8388 an @code{int *} regardless of the target machine.
8390 @item -Wcast-function-type
8391 @opindex Wcast-function-type
8392 @opindex Wno-cast-function-type
8393 Warn when a function pointer is cast to an incompatible function pointer.
8394 In a cast involving function types with a variable argument list only
8395 the types of initial arguments that are provided are considered.
8396 Any parameter of pointer-type matches any other pointer-type. Any benign
8397 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8398 on ILP32 targets. Likewise type qualifiers are ignored. The function
8399 type @code{void (*) (void)} is special and matches everything, which can
8400 be used to suppress this warning.
8401 In a cast involving pointer to member types this warning warns whenever
8402 the type cast is changing the pointer to member type.
8403 This warning is enabled by @option{-Wextra}.
8405 @item -Wwrite-strings
8406 @opindex Wwrite-strings
8407 @opindex Wno-write-strings
8408 When compiling C, give string constants the type @code{const
8409 char[@var{length}]} so that copying the address of one into a
8410 non-@code{const} @code{char *} pointer produces a warning. These
8411 warnings help you find at compile time code that can try to write
8412 into a string constant, but only if you have been very careful about
8413 using @code{const} in declarations and prototypes. Otherwise, it is
8414 just a nuisance. This is why we did not make @option{-Wall} request
8417 When compiling C++, warn about the deprecated conversion from string
8418 literals to @code{char *}. This warning is enabled by default for C++
8423 @opindex Wno-clobbered
8424 Warn for variables that might be changed by @code{longjmp} or
8425 @code{vfork}. This warning is also enabled by @option{-Wextra}.
8428 @opindex Wconversion
8429 @opindex Wno-conversion
8430 Warn for implicit conversions that may alter a value. This includes
8431 conversions between real and integer, like @code{abs (x)} when
8432 @code{x} is @code{double}; conversions between signed and unsigned,
8433 like @code{unsigned ui = -1}; and conversions to smaller types, like
8434 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8435 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8436 changed by the conversion like in @code{abs (2.0)}. Warnings about
8437 conversions between signed and unsigned integers can be disabled by
8438 using @option{-Wno-sign-conversion}.
8440 For C++, also warn for confusing overload resolution for user-defined
8441 conversions; and conversions that never use a type conversion
8442 operator: conversions to @code{void}, the same type, a base class or a
8443 reference to them. Warnings about conversions between signed and
8444 unsigned integers are disabled by default in C++ unless
8445 @option{-Wsign-conversion} is explicitly enabled.
8447 Warnings about conversion from arithmetic on a small type back to that
8448 type are only given with @option{-Warith-conversion}.
8450 @item -Wdangling-else
8451 @opindex Wdangling-else
8452 @opindex Wno-dangling-else
8453 Warn about constructions where there may be confusion to which
8454 @code{if} statement an @code{else} branch belongs. Here is an example of
8469 In C/C++, every @code{else} branch belongs to the innermost possible
8470 @code{if} statement, which in this example is @code{if (b)}. This is
8471 often not what the programmer expected, as illustrated in the above
8472 example by indentation the programmer chose. When there is the
8473 potential for this confusion, GCC issues a warning when this flag
8474 is specified. To eliminate the warning, add explicit braces around
8475 the innermost @code{if} statement so there is no way the @code{else}
8476 can belong to the enclosing @code{if}. The resulting code
8493 This warning is enabled by @option{-Wparentheses}.
8497 @opindex Wno-date-time
8498 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
8499 are encountered as they might prevent bit-wise-identical reproducible
8503 @opindex Wempty-body
8504 @opindex Wno-empty-body
8505 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
8506 while} statement. This warning is also enabled by @option{-Wextra}.
8508 @item -Wno-endif-labels
8509 @opindex Wendif-labels
8510 @opindex Wno-endif-labels
8511 Do not warn about stray tokens after @code{#else} and @code{#endif}.
8513 @item -Wenum-compare
8514 @opindex Wenum-compare
8515 @opindex Wno-enum-compare
8516 Warn about a comparison between values of different enumerated types.
8517 In C++ enumerated type mismatches in conditional expressions are also
8518 diagnosed and the warning is enabled by default. In C this warning is
8519 enabled by @option{-Wall}.
8521 @item -Wenum-conversion
8522 @opindex Wenum-conversion
8523 @opindex Wno-enum-conversion
8524 Warn when a value of enumerated type is implicitly converted to a
8525 different enumerated type. This warning is enabled by @option{-Wextra}
8528 @item -Wjump-misses-init @r{(C, Objective-C only)}
8529 @opindex Wjump-misses-init
8530 @opindex Wno-jump-misses-init
8531 Warn if a @code{goto} statement or a @code{switch} statement jumps
8532 forward across the initialization of a variable, or jumps backward to a
8533 label after the variable has been initialized. This only warns about
8534 variables that are initialized when they are declared. This warning is
8535 only supported for C and Objective-C; in C++ this sort of branch is an
8538 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
8539 can be disabled with the @option{-Wno-jump-misses-init} option.
8541 @item -Wsign-compare
8542 @opindex Wsign-compare
8543 @opindex Wno-sign-compare
8544 @cindex warning for comparison of signed and unsigned values
8545 @cindex comparison of signed and unsigned values, warning
8546 @cindex signed and unsigned values, comparison warning
8547 Warn when a comparison between signed and unsigned values could produce
8548 an incorrect result when the signed value is converted to unsigned.
8549 In C++, this warning is also enabled by @option{-Wall}. In C, it is
8550 also enabled by @option{-Wextra}.
8552 @item -Wsign-conversion
8553 @opindex Wsign-conversion
8554 @opindex Wno-sign-conversion
8555 Warn for implicit conversions that may change the sign of an integer
8556 value, like assigning a signed integer expression to an unsigned
8557 integer variable. An explicit cast silences the warning. In C, this
8558 option is enabled also by @option{-Wconversion}.
8560 @item -Wfloat-conversion
8561 @opindex Wfloat-conversion
8562 @opindex Wno-float-conversion
8563 Warn for implicit conversions that reduce the precision of a real value.
8564 This includes conversions from real to integer, and from higher precision
8565 real to lower precision real values. This option is also enabled by
8566 @option{-Wconversion}.
8568 @item -Wno-scalar-storage-order
8569 @opindex Wno-scalar-storage-order
8570 @opindex Wscalar-storage-order
8571 Do not warn on suspicious constructs involving reverse scalar storage order.
8573 @item -Wsizeof-array-div
8574 @opindex Wsizeof-array-div
8575 @opindex Wno-sizeof-array-div
8576 Warn about divisions of two sizeof operators when the first one is applied
8577 to an array and the divisor does not equal the size of the array element.
8578 In such a case, the computation will not yield the number of elements in the
8579 array, which is likely what the user intended. This warning warns e.g. about
8584 return sizeof (arr) / sizeof (short);
8588 This warning is enabled by @option{-Wall}.
8590 @item -Wsizeof-pointer-div
8591 @opindex Wsizeof-pointer-div
8592 @opindex Wno-sizeof-pointer-div
8593 Warn for suspicious divisions of two sizeof expressions that divide
8594 the pointer size by the element size, which is the usual way to compute
8595 the array size but won't work out correctly with pointers. This warning
8596 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
8597 not an array, but a pointer. This warning is enabled by @option{-Wall}.
8599 @item -Wsizeof-pointer-memaccess
8600 @opindex Wsizeof-pointer-memaccess
8601 @opindex Wno-sizeof-pointer-memaccess
8602 Warn for suspicious length parameters to certain string and memory built-in
8603 functions if the argument uses @code{sizeof}. This warning triggers for
8604 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
8605 an array, but a pointer, and suggests a possible fix, or about
8606 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
8607 also warns about calls to bounded string copy functions like @code{strncat}
8608 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
8609 the source array. For example, in the following function the call to
8610 @code{strncat} specifies the size of the source string as the bound. That
8611 is almost certainly a mistake and so the call is diagnosed.
8613 void make_file (const char *name)
8615 char path[PATH_MAX];
8616 strncpy (path, name, sizeof path - 1);
8617 strncat (path, ".text", sizeof ".text");
8622 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
8624 @item -Wno-sizeof-array-argument
8625 @opindex Wsizeof-array-argument
8626 @opindex Wno-sizeof-array-argument
8627 Do not warn when the @code{sizeof} operator is applied to a parameter that is
8628 declared as an array in a function definition. This warning is enabled by
8629 default for C and C++ programs.
8631 @item -Wmemset-elt-size
8632 @opindex Wmemset-elt-size
8633 @opindex Wno-memset-elt-size
8634 Warn for suspicious calls to the @code{memset} built-in function, if the
8635 first argument references an array, and the third argument is a number
8636 equal to the number of elements, but not equal to the size of the array
8637 in memory. This indicates that the user has omitted a multiplication by
8638 the element size. This warning is enabled by @option{-Wall}.
8640 @item -Wmemset-transposed-args
8641 @opindex Wmemset-transposed-args
8642 @opindex Wno-memset-transposed-args
8643 Warn for suspicious calls to the @code{memset} built-in function where
8644 the second argument is not zero and the third argument is zero. For
8645 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
8646 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
8647 is only emitted if the third argument is a literal zero. Otherwise, if
8648 it is an expression that is folded to zero, or a cast of zero to some
8649 type, it is far less likely that the arguments have been mistakenly
8650 transposed and no warning is emitted. This warning is enabled
8655 @opindex Wno-address
8656 Warn about suspicious uses of address expressions. These include comparing
8657 the address of a function or a declared object to the null pointer constant
8663 if (!func) // warning: expression evaluates to false
8667 comparisons of a pointer to a string literal, such as in
8669 void f (const char *x)
8671 if (x == "abc") // warning: expression evaluates to false
8675 and tests of the results of pointer addition or subtraction for equality
8678 void f (const int *p, int i)
8680 return p + i == NULL;
8683 Such uses typically indicate a programmer error: the address of most
8684 functions and objects necessarily evaluates to true (the exception are
8685 weak symbols), so their use in a conditional might indicate missing
8686 parentheses in a function call or a missing dereference in an array
8687 expression. The subset of the warning for object pointers can be
8688 suppressed by casting the pointer operand to an integer type such
8689 as @code{inptr_t} or @code{uinptr_t}.
8690 Comparisons against string literals result in unspecified behavior
8691 and are not portable, and suggest the intent was to call @code{strcmp}.
8692 The warning is suppressed if the suspicious expression is the result
8694 @option{-Waddress} warning is enabled by @option{-Wall}.
8696 @item -Wno-address-of-packed-member
8697 @opindex Waddress-of-packed-member
8698 @opindex Wno-address-of-packed-member
8699 Do not warn when the address of packed member of struct or union is taken,
8700 which usually results in an unaligned pointer value. This is
8704 @opindex Wlogical-op
8705 @opindex Wno-logical-op
8706 Warn about suspicious uses of logical operators in expressions.
8707 This includes using logical operators in contexts where a
8708 bit-wise operator is likely to be expected. Also warns when
8709 the operands of a logical operator are the same:
8712 if (a < 0 && a < 0) @{ @dots{} @}
8715 @item -Wlogical-not-parentheses
8716 @opindex Wlogical-not-parentheses
8717 @opindex Wno-logical-not-parentheses
8718 Warn about logical not used on the left hand side operand of a comparison.
8719 This option does not warn if the right operand is considered to be a boolean
8720 expression. Its purpose is to detect suspicious code like the following:
8724 if (!a > 1) @{ @dots{} @}
8727 It is possible to suppress the warning by wrapping the LHS into
8730 if ((!a) > 1) @{ @dots{} @}
8733 This warning is enabled by @option{-Wall}.
8735 @item -Waggregate-return
8736 @opindex Waggregate-return
8737 @opindex Wno-aggregate-return
8738 Warn if any functions that return structures or unions are defined or
8739 called. (In languages where you can return an array, this also elicits
8742 @item -Wno-aggressive-loop-optimizations
8743 @opindex Wno-aggressive-loop-optimizations
8744 @opindex Waggressive-loop-optimizations
8745 Warn if in a loop with constant number of iterations the compiler detects
8746 undefined behavior in some statement during one or more of the iterations.
8748 @item -Wno-attributes
8749 @opindex Wno-attributes
8750 @opindex Wattributes
8751 Do not warn if an unexpected @code{__attribute__} is used, such as
8752 unrecognized attributes, function attributes applied to variables,
8753 etc. This does not stop errors for incorrect use of supported
8756 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
8757 warnings about unknown scoped attributes (in C++11 and C2X). For example,
8758 @option{-Wno-attributes=vendor::attr} disables warning about the following
8762 [[vendor::attr]] void f();
8765 It is also possible to disable warning about all attributes in a namespace
8766 using @option{-Wno-attributes=vendor::} which prevents warning about both
8767 of these declarations:
8770 [[vendor::safe]] void f();
8771 [[vendor::unsafe]] void f2();
8774 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
8776 @item -Wno-builtin-declaration-mismatch
8777 @opindex Wno-builtin-declaration-mismatch
8778 @opindex Wbuiltin-declaration-mismatch
8779 Warn if a built-in function is declared with an incompatible signature
8780 or as a non-function, or when a built-in function declared with a type
8781 that does not include a prototype is called with arguments whose promoted
8782 types do not match those expected by the function. When @option{-Wextra}
8783 is specified, also warn when a built-in function that takes arguments is
8784 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
8785 warning is enabled by default. To avoid the warning include the appropriate
8786 header to bring the prototypes of built-in functions into scope.
8788 For example, the call to @code{memset} below is diagnosed by the warning
8789 because the function expects a value of type @code{size_t} as its argument
8790 but the type of @code{32} is @code{int}. With @option{-Wextra},
8791 the declaration of the function is diagnosed as well.
8793 extern void* memset ();
8796 memset (d, '\0', 32);
8800 @item -Wno-builtin-macro-redefined
8801 @opindex Wno-builtin-macro-redefined
8802 @opindex Wbuiltin-macro-redefined
8803 Do not warn if certain built-in macros are redefined. This suppresses
8804 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
8805 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
8807 @item -Wstrict-prototypes @r{(C and Objective-C only)}
8808 @opindex Wstrict-prototypes
8809 @opindex Wno-strict-prototypes
8810 Warn if a function is declared or defined without specifying the
8811 argument types. (An old-style function definition is permitted without
8812 a warning if preceded by a declaration that specifies the argument
8815 @item -Wold-style-declaration @r{(C and Objective-C only)}
8816 @opindex Wold-style-declaration
8817 @opindex Wno-old-style-declaration
8818 Warn for obsolescent usages, according to the C Standard, in a
8819 declaration. For example, warn if storage-class specifiers like
8820 @code{static} are not the first things in a declaration. This warning
8821 is also enabled by @option{-Wextra}.
8823 @item -Wold-style-definition @r{(C and Objective-C only)}
8824 @opindex Wold-style-definition
8825 @opindex Wno-old-style-definition
8826 Warn if an old-style function definition is used. A warning is given
8827 even if there is a previous prototype. A definition using @samp{()}
8828 is not considered an old-style definition in C2X mode, because it is
8829 equivalent to @samp{(void)} in that case, but is considered an
8830 old-style definition for older standards.
8832 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
8833 @opindex Wmissing-parameter-type
8834 @opindex Wno-missing-parameter-type
8835 A function parameter is declared without a type specifier in K&R-style
8842 This warning is also enabled by @option{-Wextra}.
8844 @item -Wmissing-prototypes @r{(C and Objective-C only)}
8845 @opindex Wmissing-prototypes
8846 @opindex Wno-missing-prototypes
8847 Warn if a global function is defined without a previous prototype
8848 declaration. This warning is issued even if the definition itself
8849 provides a prototype. Use this option to detect global functions
8850 that do not have a matching prototype declaration in a header file.
8851 This option is not valid for C++ because all function declarations
8852 provide prototypes and a non-matching declaration declares an
8853 overload rather than conflict with an earlier declaration.
8854 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
8856 @item -Wmissing-declarations
8857 @opindex Wmissing-declarations
8858 @opindex Wno-missing-declarations
8859 Warn if a global function is defined without a previous declaration.
8860 Do so even if the definition itself provides a prototype.
8861 Use this option to detect global functions that are not declared in
8862 header files. In C, no warnings are issued for functions with previous
8863 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
8864 missing prototypes. In C++, no warnings are issued for function templates,
8865 or for inline functions, or for functions in anonymous namespaces.
8867 @item -Wmissing-field-initializers
8868 @opindex Wmissing-field-initializers
8869 @opindex Wno-missing-field-initializers
8873 Warn if a structure's initializer has some fields missing. For
8874 example, the following code causes such a warning, because
8875 @code{x.h} is implicitly zero:
8878 struct s @{ int f, g, h; @};
8879 struct s x = @{ 3, 4 @};
8882 This option does not warn about designated initializers, so the following
8883 modification does not trigger a warning:
8886 struct s @{ int f, g, h; @};
8887 struct s x = @{ .f = 3, .g = 4 @};
8890 In C this option does not warn about the universal zero initializer
8894 struct s @{ int f, g, h; @};
8895 struct s x = @{ 0 @};
8898 Likewise, in C++ this option does not warn about the empty @{ @}
8899 initializer, for example:
8902 struct s @{ int f, g, h; @};
8906 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
8907 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
8909 @item -Wno-missing-requires
8910 @opindex Wmissing-requires
8911 @opindex Wno-missing-requires
8913 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
8916 bool satisfied = requires @{ C<T> @};
8919 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
8920 expression, which it is for all T. Presumably the user meant to write
8923 bool satisfied = requires @{ requires C<T> @};
8926 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
8929 This warning can be disabled with @option{-Wno-missing-requires}.
8931 @item -Wno-multichar
8932 @opindex Wno-multichar
8934 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
8935 Usually they indicate a typo in the user's code, as they have
8936 implementation-defined values, and should not be used in portable code.
8938 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
8939 @opindex Wnormalized=
8940 @opindex Wnormalized
8941 @opindex Wno-normalized
8944 @cindex character set, input normalization
8945 In ISO C and ISO C++, two identifiers are different if they are
8946 different sequences of characters. However, sometimes when characters
8947 outside the basic ASCII character set are used, you can have two
8948 different character sequences that look the same. To avoid confusion,
8949 the ISO 10646 standard sets out some @dfn{normalization rules} which
8950 when applied ensure that two sequences that look the same are turned into
8951 the same sequence. GCC can warn you if you are using identifiers that
8952 have not been normalized; this option controls that warning.
8954 There are four levels of warning supported by GCC@. The default is
8955 @option{-Wnormalized=nfc}, which warns about any identifier that is
8956 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
8957 recommended form for most uses. It is equivalent to
8958 @option{-Wnormalized}.
8960 Unfortunately, there are some characters allowed in identifiers by
8961 ISO C and ISO C++ that, when turned into NFC, are not allowed in
8962 identifiers. That is, there's no way to use these symbols in portable
8963 ISO C or C++ and have all your identifiers in NFC@.
8964 @option{-Wnormalized=id} suppresses the warning for these characters.
8965 It is hoped that future versions of the standards involved will correct
8966 this, which is why this option is not the default.
8968 You can switch the warning off for all characters by writing
8969 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
8970 only do this if you are using some other normalization scheme (like
8971 ``D''), because otherwise you can easily create bugs that are
8972 literally impossible to see.
8974 Some characters in ISO 10646 have distinct meanings but look identical
8975 in some fonts or display methodologies, especially once formatting has
8976 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
8977 LETTER N'', displays just like a regular @code{n} that has been
8978 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
8979 normalization scheme to convert all these into a standard form as
8980 well, and GCC warns if your code is not in NFKC if you use
8981 @option{-Wnormalized=nfkc}. This warning is comparable to warning
8982 about every identifier that contains the letter O because it might be
8983 confused with the digit 0, and so is not the default, but may be
8984 useful as a local coding convention if the programming environment
8985 cannot be fixed to display these characters distinctly.
8987 @item -Wno-attribute-warning
8988 @opindex Wno-attribute-warning
8989 @opindex Wattribute-warning
8990 Do not warn about usage of functions (@pxref{Function Attributes})
8991 declared with @code{warning} attribute. By default, this warning is
8992 enabled. @option{-Wno-attribute-warning} can be used to disable the
8993 warning or @option{-Wno-error=attribute-warning} can be used to
8994 disable the error when compiled with @option{-Werror} flag.
8996 @item -Wno-deprecated
8997 @opindex Wno-deprecated
8998 @opindex Wdeprecated
8999 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
9001 @item -Wno-deprecated-declarations
9002 @opindex Wno-deprecated-declarations
9003 @opindex Wdeprecated-declarations
9004 Do not warn about uses of functions (@pxref{Function Attributes}),
9005 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9006 Attributes}) marked as deprecated by using the @code{deprecated}
9010 @opindex Wno-overflow
9012 Do not warn about compile-time overflow in constant expressions.
9017 Warn about One Definition Rule violations during link-time optimization.
9020 @item -Wopenacc-parallelism
9021 @opindex Wopenacc-parallelism
9022 @opindex Wno-openacc-parallelism
9023 @cindex OpenACC accelerator programming
9024 Warn about potentially suboptimal choices related to OpenACC parallelism.
9027 @opindex Wopenmp-simd
9028 @opindex Wno-openmp-simd
9029 Warn if the vectorizer cost model overrides the OpenMP
9030 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
9031 option can be used to relax the cost model.
9033 @item -Woverride-init @r{(C and Objective-C only)}
9034 @opindex Woverride-init
9035 @opindex Wno-override-init
9039 Warn if an initialized field without side effects is overridden when
9040 using designated initializers (@pxref{Designated Inits, , Designated
9043 This warning is included in @option{-Wextra}. To get other
9044 @option{-Wextra} warnings without this one, use @option{-Wextra
9045 -Wno-override-init}.
9047 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9048 @opindex Woverride-init-side-effects
9049 @opindex Wno-override-init-side-effects
9050 Do not warn if an initialized field with side effects is overridden when
9051 using designated initializers (@pxref{Designated Inits, , Designated
9052 Initializers}). This warning is enabled by default.
9057 Warn if a structure is given the packed attribute, but the packed
9058 attribute has no effect on the layout or size of the structure.
9059 Such structures may be mis-aligned for little benefit. For
9060 instance, in this code, the variable @code{f.x} in @code{struct bar}
9061 is misaligned even though @code{struct bar} does not itself
9062 have the packed attribute:
9069 @} __attribute__((packed));
9077 @item -Wnopacked-bitfield-compat
9078 @opindex Wpacked-bitfield-compat
9079 @opindex Wno-packed-bitfield-compat
9080 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9081 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
9082 the change can lead to differences in the structure layout. GCC
9083 informs you when the offset of such a field has changed in GCC 4.4.
9084 For example there is no longer a 4-bit padding between field @code{a}
9085 and @code{b} in this structure:
9092 @} __attribute__ ((packed));
9095 This warning is enabled by default. Use
9096 @option{-Wno-packed-bitfield-compat} to disable this warning.
9098 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9099 @opindex Wpacked-not-aligned
9100 @opindex Wno-packed-not-aligned
9101 Warn if a structure field with explicitly specified alignment in a
9102 packed struct or union is misaligned. For example, a warning will
9103 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9104 'struct S' is less than 8}, in this code:
9108 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9109 struct __attribute__ ((packed)) S @{
9115 This warning is enabled by @option{-Wall}.
9120 Warn if padding is included in a structure, either to align an element
9121 of the structure or to align the whole structure. Sometimes when this
9122 happens it is possible to rearrange the fields of the structure to
9123 reduce the padding and so make the structure smaller.
9125 @item -Wredundant-decls
9126 @opindex Wredundant-decls
9127 @opindex Wno-redundant-decls
9128 Warn if anything is declared more than once in the same scope, even in
9129 cases where multiple declaration is valid and changes nothing.
9133 @opindex Wno-restrict
9134 Warn when an object referenced by a @code{restrict}-qualified parameter
9135 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9136 argument, or when copies between such objects overlap. For example,
9137 the call to the @code{strcpy} function below attempts to truncate the string
9138 by replacing its initial characters with the last four. However, because
9139 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9140 the call is diagnosed.
9145 char a[] = "abcd1234";
9150 The @option{-Wrestrict} option detects some instances of simple overlap
9151 even without optimization but works best at @option{-O2} and above. It
9152 is included in @option{-Wall}.
9154 @item -Wnested-externs @r{(C and Objective-C only)}
9155 @opindex Wnested-externs
9156 @opindex Wno-nested-externs
9157 Warn if an @code{extern} declaration is encountered within a function.
9162 Warn if a function that is declared as inline cannot be inlined.
9163 Even with this option, the compiler does not warn about failures to
9164 inline functions declared in system headers.
9166 The compiler uses a variety of heuristics to determine whether or not
9167 to inline a function. For example, the compiler takes into account
9168 the size of the function being inlined and the amount of inlining
9169 that has already been done in the current function. Therefore,
9170 seemingly insignificant changes in the source program can cause the
9171 warnings produced by @option{-Winline} to appear or disappear.
9173 @item -Winterference-size
9174 @opindex Winterference-size
9175 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9176 without specifying its value with @option{--param destructive-interference-size}.
9177 Also warn about questionable values for that option.
9179 This variable is intended to be used for controlling class layout, to
9180 avoid false sharing in concurrent code:
9183 struct independent_fields @{
9184 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
9185 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
9189 Here @samp{one} and @samp{two} are intended to be far enough apart
9190 that stores to one won't require accesses to the other to reload the
9193 By default, @option{--param destructive-interference-size} and
9194 @option{--param constructive-interference-size} are set based on the
9195 current @option{-mtune} option, typically to the L1 cache line size
9196 for the particular target CPU, sometimes to a range if tuning for a
9197 generic target. So all translation units that depend on ABI
9198 compatibility for the use of these variables must be compiled with
9199 the same @option{-mtune} (or @option{-mcpu}).
9201 If ABI stability is important, such as if the use is in a header for a
9202 library, you should probably not use the hardware interference size
9203 variables at all. Alternatively, you can force a particular value
9204 with @option{--param}.
9206 If you are confident that your use of the variable does not affect ABI
9207 outside a single build of your project, you can turn off the warning
9208 with @option{-Wno-interference-size}.
9210 @item -Wint-in-bool-context
9211 @opindex Wint-in-bool-context
9212 @opindex Wno-int-in-bool-context
9213 Warn for suspicious use of integer values where boolean values are expected,
9214 such as conditional expressions (?:) using non-boolean integer constants in
9215 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
9216 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
9217 for all kinds of multiplications regardless of the data type.
9218 This warning is enabled by @option{-Wall}.
9220 @item -Wno-int-to-pointer-cast
9221 @opindex Wno-int-to-pointer-cast
9222 @opindex Wint-to-pointer-cast
9223 Suppress warnings from casts to pointer type of an integer of a
9224 different size. In C++, casting to a pointer type of smaller size is
9225 an error. @option{Wint-to-pointer-cast} is enabled by default.
9228 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9229 @opindex Wno-pointer-to-int-cast
9230 @opindex Wpointer-to-int-cast
9231 Suppress warnings from casts from a pointer to an integer type of a
9235 @opindex Winvalid-pch
9236 @opindex Wno-invalid-pch
9237 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9238 the search path but cannot be used.
9242 @opindex Wno-long-long
9243 Warn if @code{long long} type is used. This is enabled by either
9244 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9245 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
9247 @item -Wvariadic-macros
9248 @opindex Wvariadic-macros
9249 @opindex Wno-variadic-macros
9250 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9251 alternate syntax is used in ISO C99 mode. This is enabled by either
9252 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
9253 messages, use @option{-Wno-variadic-macros}.
9257 @opindex Wno-varargs
9258 Do not warn upon questionable usage of the macros used to handle variable
9259 arguments like @code{va_start}. These warnings are enabled by default.
9261 @item -Wvector-operation-performance
9262 @opindex Wvector-operation-performance
9263 @opindex Wno-vector-operation-performance
9264 Warn if vector operation is not implemented via SIMD capabilities of the
9265 architecture. Mainly useful for the performance tuning.
9266 Vector operation can be implemented @code{piecewise}, which means that the
9267 scalar operation is performed on every vector element;
9268 @code{in parallel}, which means that the vector operation is implemented
9269 using scalars of wider type, which normally is more performance efficient;
9270 and @code{as a single scalar}, which means that vector fits into a
9276 Warn if a variable-length array is used in the code.
9277 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9278 the variable-length array.
9280 @item -Wvla-larger-than=@var{byte-size}
9281 @opindex Wvla-larger-than=
9282 @opindex Wno-vla-larger-than
9283 If this option is used, the compiler warns for declarations of
9284 variable-length arrays whose size is either unbounded, or bounded
9285 by an argument that allows the array size to exceed @var{byte-size}
9286 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9287 works, but with variable-length arrays.
9289 Note that GCC may optimize small variable-length arrays of a known
9290 value into plain arrays, so this warning may not get triggered for
9293 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9294 is typically only effective when @option{-ftree-vrp} is active (default
9295 for @option{-O2} and above).
9297 See also @option{-Walloca-larger-than=@var{byte-size}}.
9299 @item -Wno-vla-larger-than
9300 @opindex Wno-vla-larger-than
9301 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
9302 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9304 @item -Wvla-parameter
9305 @opindex Wno-vla-parameter
9306 Warn about redeclarations of functions involving arguments of Variable
9307 Length Array types of inconsistent kinds or forms, and enable the detection
9308 of out-of-bounds accesses to such parameters by warnings such as
9309 @option{-Warray-bounds}.
9311 If the first function declaration uses the VLA form the bound specified
9312 in the array is assumed to be the minimum number of elements expected to
9313 be provided in calls to the function and the maximum number of elements
9314 accessed by it. Failing to provide arguments of sufficient size or
9315 accessing more than the maximum number of elements may be diagnosed.
9317 For example, the warning triggers for the following redeclarations because
9318 the first one allows an array of any size to be passed to @code{f} while
9319 the second one specifies that the array argument must have at least @code{n}
9320 elements. In addition, calling @code{f} with the assotiated VLA bound
9321 parameter in excess of the actual VLA bound triggers a warning as well.
9324 void f (int n, int[n]);
9325 void f (int, int[]); // warning: argument 2 previously declared as a VLA
9332 f (sizeof a, a); // warning: access to a by f may be out of bounds
9338 @option{-Wvla-parameter} is included in @option{-Wall}. The
9339 @option{-Warray-parameter} option triggers warnings for similar problems
9340 involving ordinary array arguments.
9342 @item -Wvolatile-register-var
9343 @opindex Wvolatile-register-var
9344 @opindex Wno-volatile-register-var
9345 Warn if a register variable is declared volatile. The volatile
9346 modifier does not inhibit all optimizations that may eliminate reads
9347 and/or writes to register variables. This warning is enabled by
9350 @item -Wdisabled-optimization
9351 @opindex Wdisabled-optimization
9352 @opindex Wno-disabled-optimization
9353 Warn if a requested optimization pass is disabled. This warning does
9354 not generally indicate that there is anything wrong with your code; it
9355 merely indicates that GCC's optimizers are unable to handle the code
9356 effectively. Often, the problem is that your code is too big or too
9357 complex; GCC refuses to optimize programs when the optimization
9358 itself is likely to take inordinate amounts of time.
9360 @item -Wpointer-sign @r{(C and Objective-C only)}
9361 @opindex Wpointer-sign
9362 @opindex Wno-pointer-sign
9363 Warn for pointer argument passing or assignment with different signedness.
9364 This option is only supported for C and Objective-C@. It is implied by
9365 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9366 @option{-Wno-pointer-sign}.
9368 @item -Wstack-protector
9369 @opindex Wstack-protector
9370 @opindex Wno-stack-protector
9371 This option is only active when @option{-fstack-protector} is active. It
9372 warns about functions that are not protected against stack smashing.
9374 @item -Woverlength-strings
9375 @opindex Woverlength-strings
9376 @opindex Wno-overlength-strings
9377 Warn about string constants that are longer than the ``minimum
9378 maximum'' length specified in the C standard. Modern compilers
9379 generally allow string constants that are much longer than the
9380 standard's minimum limit, but very portable programs should avoid
9381 using longer strings.
9383 The limit applies @emph{after} string constant concatenation, and does
9384 not count the trailing NUL@. In C90, the limit was 509 characters; in
9385 C99, it was raised to 4095. C++98 does not specify a normative
9386 minimum maximum, so we do not diagnose overlength strings in C++@.
9388 This option is implied by @option{-Wpedantic}, and can be disabled with
9389 @option{-Wno-overlength-strings}.
9391 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
9392 @opindex Wunsuffixed-float-constants
9393 @opindex Wno-unsuffixed-float-constants
9395 Issue a warning for any floating constant that does not have
9396 a suffix. When used together with @option{-Wsystem-headers} it
9397 warns about such constants in system header files. This can be useful
9398 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
9399 from the decimal floating-point extension to C99.
9401 @item -Wno-lto-type-mismatch
9402 @opindex Wlto-type-mismatch
9403 @opindex Wno-lto-type-mismatch
9405 During the link-time optimization, do not warn about type mismatches in
9406 global declarations from different compilation units.
9407 Requires @option{-flto} to be enabled. Enabled by default.
9409 @item -Wno-designated-init @r{(C and Objective-C only)}
9410 @opindex Wdesignated-init
9411 @opindex Wno-designated-init
9412 Suppress warnings when a positional initializer is used to initialize
9413 a structure that has been marked with the @code{designated_init}
9418 @node Static Analyzer Options
9419 @section Options That Control Static Analysis
9425 @opindex fno-analyzer
9426 This option enables an static analysis of program flow which looks
9427 for ``interesting'' interprocedural paths through the
9428 code, and issues warnings for problems found on them.
9430 This analysis is much more expensive than other GCC warnings.
9432 Enabling this option effectively enables the following warnings:
9435 -Wanalyzer-double-fclose @gol
9436 -Wanalyzer-double-free @gol
9437 -Wanalyzer-exposure-through-output-file @gol
9438 -Wanalyzer-file-leak @gol
9439 -Wanalyzer-free-of-non-heap @gol
9440 -Wanalyzer-malloc-leak @gol
9441 -Wanalyzer-mismatching-deallocation @gol
9442 -Wanalyzer-possible-null-argument @gol
9443 -Wanalyzer-possible-null-dereference @gol
9444 -Wanalyzer-null-argument @gol
9445 -Wanalyzer-null-dereference @gol
9446 -Wanalyzer-shift-count-negative @gol
9447 -Wanalyzer-shift-count-overflow @gol
9448 -Wanalyzer-stale-setjmp-buffer @gol
9449 -Wanalyzer-tainted-allocation-size @gol
9450 -Wanalyzer-tainted-array-index @gol
9451 -Wanalyzer-tainted-divisor @gol
9452 -Wanalyzer-tainted-offset @gol
9453 -Wanalyzer-tainted-size @gol
9454 -Wanalyzer-unsafe-call-within-signal-handler @gol
9455 -Wanalyzer-use-after-free @gol
9456 -Wanalyzer-use-of-uninitialized-value @gol
9457 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
9458 -Wanalyzer-write-to-const @gol
9459 -Wanalyzer-write-to-string-literal @gol
9462 This option is only available if GCC was configured with analyzer
9465 @item -Wanalyzer-too-complex
9466 @opindex Wanalyzer-too-complex
9467 @opindex Wno-analyzer-too-complex
9468 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
9469 to attempt to explore the control flow and data flow in the program,
9470 but these can be defeated by sufficiently complicated code.
9472 By default, the analysis silently stops if the code is too
9473 complicated for the analyzer to fully explore and it reaches an internal
9474 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
9476 @item -Wno-analyzer-double-fclose
9477 @opindex Wanalyzer-double-fclose
9478 @opindex Wno-analyzer-double-fclose
9479 This warning requires @option{-fanalyzer}, which enables it; use
9480 @option{-Wno-analyzer-double-fclose} to disable it.
9482 This diagnostic warns for paths through the code in which a @code{FILE *}
9483 can have @code{fclose} called on it more than once.
9485 @item -Wno-analyzer-double-free
9486 @opindex Wanalyzer-double-free
9487 @opindex Wno-analyzer-double-free
9488 This warning requires @option{-fanalyzer}, which enables it; use
9489 @option{-Wno-analyzer-double-free} to disable it.
9491 This diagnostic warns for paths through the code in which a pointer
9492 can have a deallocator called on it more than once, either @code{free},
9493 or a deallocator referenced by attribute @code{malloc}.
9495 @item -Wno-analyzer-exposure-through-output-file
9496 @opindex Wanalyzer-exposure-through-output-file
9497 @opindex Wno-analyzer-exposure-through-output-file
9498 This warning requires @option{-fanalyzer}, which enables it; use
9499 @option{-Wno-analyzer-exposure-through-output-file}
9502 This diagnostic warns for paths through the code in which a
9503 security-sensitive value is written to an output file
9504 (such as writing a password to a log file).
9506 @item -Wno-analyzer-file-leak
9507 @opindex Wanalyzer-file-leak
9508 @opindex Wno-analyzer-file-leak
9509 This warning requires @option{-fanalyzer}, which enables it; use
9510 @option{-Wno-analyzer-file-leak}
9513 This diagnostic warns for paths through the code in which a
9514 @code{<stdio.h>} @code{FILE *} stream object is leaked.
9516 @item -Wno-analyzer-free-of-non-heap
9517 @opindex Wanalyzer-free-of-non-heap
9518 @opindex Wno-analyzer-free-of-non-heap
9519 This warning requires @option{-fanalyzer}, which enables it; use
9520 @option{-Wno-analyzer-free-of-non-heap}
9523 This diagnostic warns for paths through the code in which @code{free}
9524 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
9526 @item -Wno-analyzer-malloc-leak
9527 @opindex Wanalyzer-malloc-leak
9528 @opindex Wno-analyzer-malloc-leak
9529 This warning requires @option{-fanalyzer}, which enables it; use
9530 @option{-Wno-analyzer-malloc-leak}
9533 This diagnostic warns for paths through the code in which a
9534 pointer allocated via an allocator is leaked: either @code{malloc},
9535 or a function marked with attribute @code{malloc}.
9537 @item -Wno-analyzer-mismatching-deallocation
9538 @opindex Wanalyzer-mismatching-deallocation
9539 @opindex Wno-analyzer-mismatching-deallocation
9540 This warning requires @option{-fanalyzer}, which enables it; use
9541 @option{-Wno-analyzer-mismatching-deallocation}
9544 This diagnostic warns for paths through the code in which the
9545 wrong deallocation function is called on a pointer value, based on
9546 which function was used to allocate the pointer value. The diagnostic
9547 will warn about mismatches between @code{free}, scalar @code{delete}
9548 and vector @code{delete[]}, and those marked as allocator/deallocator
9549 pairs using attribute @code{malloc}.
9551 @item -Wno-analyzer-possible-null-argument
9552 @opindex Wanalyzer-possible-null-argument
9553 @opindex Wno-analyzer-possible-null-argument
9554 This warning requires @option{-fanalyzer}, which enables it; use
9555 @option{-Wno-analyzer-possible-null-argument} to disable it.
9557 This diagnostic warns for paths through the code in which a
9558 possibly-NULL value is passed to a function argument marked
9559 with @code{__attribute__((nonnull))} as requiring a non-NULL
9562 @item -Wno-analyzer-possible-null-dereference
9563 @opindex Wanalyzer-possible-null-dereference
9564 @opindex Wno-analyzer-possible-null-dereference
9565 This warning requires @option{-fanalyzer}, which enables it; use
9566 @option{-Wno-analyzer-possible-null-dereference} to disable it.
9568 This diagnostic warns for paths through the code in which a
9569 possibly-NULL value is dereferenced.
9571 @item -Wno-analyzer-null-argument
9572 @opindex Wanalyzer-null-argument
9573 @opindex Wno-analyzer-null-argument
9574 This warning requires @option{-fanalyzer}, which enables it; use
9575 @option{-Wno-analyzer-null-argument} to disable it.
9577 This diagnostic warns for paths through the code in which a
9578 value known to be NULL is passed to a function argument marked
9579 with @code{__attribute__((nonnull))} as requiring a non-NULL
9582 @item -Wno-analyzer-null-dereference
9583 @opindex Wanalyzer-null-dereference
9584 @opindex Wno-analyzer-null-dereference
9585 This warning requires @option{-fanalyzer}, which enables it; use
9586 @option{-Wno-analyzer-null-dereference} to disable it.
9588 This diagnostic warns for paths through the code in which a
9589 value known to be NULL is dereferenced.
9591 @item -Wno-analyzer-shift-count-negative
9592 @opindex Wanalyzer-shift-count-negative
9593 @opindex Wno-analyzer-shift-count-negative
9594 This warning requires @option{-fanalyzer}, which enables it; use
9595 @option{-Wno-analyzer-shift-count-negative} to disable it.
9597 This diagnostic warns for paths through the code in which a
9598 shift is attempted with a negative count. It is analogous to
9599 the @option{-Wshift-count-negative} diagnostic implemented in
9600 the C/C++ front ends, but is implemented based on analyzing
9601 interprocedural paths, rather than merely parsing the syntax tree.
9602 However, the analyzer does not prioritize detection of such paths, so
9603 false negatives are more likely relative to other warnings.
9605 @item -Wno-analyzer-shift-count-overflow
9606 @opindex Wanalyzer-shift-count-overflow
9607 @opindex Wno-analyzer-shift-count-overflow
9608 This warning requires @option{-fanalyzer}, which enables it; use
9609 @option{-Wno-analyzer-shift-count-overflow} to disable it.
9611 This diagnostic warns for paths through the code in which a
9612 shift is attempted with a count greater than or equal to the
9613 precision of the operand's type. It is analogous to
9614 the @option{-Wshift-count-overflow} diagnostic implemented in
9615 the C/C++ front ends, but is implemented based on analyzing
9616 interprocedural paths, rather than merely parsing the syntax tree.
9617 However, the analyzer does not prioritize detection of such paths, so
9618 false negatives are more likely relative to other warnings.
9620 @item -Wno-analyzer-stale-setjmp-buffer
9621 @opindex Wanalyzer-stale-setjmp-buffer
9622 @opindex Wno-analyzer-stale-setjmp-buffer
9623 This warning requires @option{-fanalyzer}, which enables it; use
9624 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
9626 This diagnostic warns for paths through the code in which
9627 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
9628 to a @code{setjmp} call in a function that has returned.
9630 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
9631 location, it records the stack frame. The stack frame becomes invalid
9632 when the function containing the @code{setjmp} call returns. Attempting
9633 to rewind to it via @code{longjmp} would reference a stack frame that
9634 no longer exists, and likely lead to a crash (or worse).
9636 @item -Wno-analyzer-tainted-allocation-size
9637 @opindex Wanalyzer-tainted-allocation-size
9638 @opindex Wno-analyzer-tainted-allocation-size
9639 This warning requires both @option{-fanalyzer} and
9640 @option{-fanalyzer-checker=taint} to enable it;
9641 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
9643 This diagnostic warns for paths through the code in which a value
9644 that could be under an attacker's control is used as the size
9645 of an allocation without being sanitized, so that an attacker could
9646 inject an excessively large allocation and potentially cause a denial
9649 See @url{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
9651 @item -Wno-analyzer-tainted-array-index
9652 @opindex Wanalyzer-tainted-array-index
9653 @opindex Wno-analyzer-tainted-array-index
9654 This warning requires both @option{-fanalyzer} and
9655 @option{-fanalyzer-checker=taint} to enable it;
9656 use @option{-Wno-analyzer-tainted-array-index} to disable it.
9658 This diagnostic warns for paths through the code in which a value
9659 that could be under an attacker's control is used as the index
9660 of an array access without being sanitized, so that an attacker
9661 could inject an out-of-bounds access.
9663 See @url{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
9665 @item -Wno-analyzer-tainted-divisor
9666 @opindex Wanalyzer-tainted-divisor
9667 @opindex Wno-analyzer-tainted-divisor
9668 This warning requires both @option{-fanalyzer} and
9669 @option{-fanalyzer-checker=taint} to enable it;
9670 use @option{-Wno-analyzer-tainted-divisor} to disable it.
9672 This diagnostic warns for paths through the code in which a value
9673 that could be under an attacker's control is used as the divisor
9674 in a division or modulus operation without being sanitized, so that
9675 an attacker could inject a division-by-zero.
9677 @item -Wno-analyzer-tainted-offset
9678 @opindex Wanalyzer-tainted-offset
9679 @opindex Wno-analyzer-tainted-offset
9680 This warning requires both @option{-fanalyzer} and
9681 @option{-fanalyzer-checker=taint} to enable it;
9682 use @option{-Wno-analyzer-tainted-offset} to disable it.
9684 This diagnostic warns for paths through the code in which a value
9685 that could be under an attacker's control is used as a pointer offset
9686 without being sanitized, so that an attacker could inject an out-of-bounds
9689 See @url{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
9691 @item -Wno-analyzer-tainted-size
9692 @opindex Wanalyzer-tainted-size
9693 @opindex Wno-analyzer-tainted-size
9694 This warning requires both @option{-fanalyzer} and
9695 @option{-fanalyzer-checker=taint} to enable it;
9696 use @option{-Wno-analyzer-tainted-size} to disable it.
9698 This diagnostic warns for paths through the code in which a value
9699 that could be under an attacker's control is used as the size of
9700 an operation such as @code{memset} without being sanitized, so that an
9701 attacker could inject an out-of-bounds access.
9703 @item -Wno-analyzer-unsafe-call-within-signal-handler
9704 @opindex Wanalyzer-unsafe-call-within-signal-handler
9705 @opindex Wno-analyzer-unsafe-call-within-signal-handler
9706 This warning requires @option{-fanalyzer}, which enables it; use
9707 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
9709 This diagnostic warns for paths through the code in which a
9710 function known to be async-signal-unsafe (such as @code{fprintf}) is
9711 called from a signal handler.
9713 @item -Wno-analyzer-use-after-free
9714 @opindex Wanalyzer-use-after-free
9715 @opindex Wno-analyzer-use-after-free
9716 This warning requires @option{-fanalyzer}, which enables it; use
9717 @option{-Wno-analyzer-use-after-free} to disable it.
9719 This diagnostic warns for paths through the code in which a
9720 pointer is used after a deallocator is called on it: either @code{free},
9721 or a deallocator referenced by attribute @code{malloc}.
9723 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
9724 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
9725 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
9726 This warning requires @option{-fanalyzer}, which enables it; use
9727 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
9730 This diagnostic warns for paths through the code in which a pointer
9731 is dereferenced that points to a variable in a stale stack frame.
9733 @item -Wno-analyzer-write-to-const
9734 @opindex Wanalyzer-write-to-const
9735 @opindex Wno-analyzer-write-to-const
9736 This warning requires @option{-fanalyzer}, which enables it; use
9737 @option{-Wno-analyzer-write-to-const}
9740 This diagnostic warns for paths through the code in which the analyzer
9741 detects an attempt to write through a pointer to a @code{const} object.
9742 However, the analyzer does not prioritize detection of such paths, so
9743 false negatives are more likely relative to other warnings.
9745 @item -Wno-analyzer-write-to-string-literal
9746 @opindex Wanalyzer-write-to-string-literal
9747 @opindex Wno-analyzer-write-to-string-literal
9748 This warning requires @option{-fanalyzer}, which enables it; use
9749 @option{-Wno-analyzer-write-to-string-literal}
9752 This diagnostic warns for paths through the code in which the analyzer
9753 detects an attempt to write through a pointer to a string literal.
9754 However, the analyzer does not prioritize detection of such paths, so
9755 false negatives are more likely relative to other warnings.
9757 @item -Wno-analyzer-use-of-uninitialized-value
9758 @opindex Wanalyzer-use-of-uninitialized-value
9759 @opindex Wno-analyzer-use-of-uninitialized-value
9760 This warning requires @option{-fanalyzer}, which enables it; use
9761 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
9763 This diagnostic warns for paths through the code in which an uninitialized
9768 Pertinent parameters for controlling the exploration are:
9769 @option{--param analyzer-bb-explosion-factor=@var{value}},
9770 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
9771 @option{--param analyzer-max-recursion-depth=@var{value}}, and
9772 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
9774 The following options control the analyzer.
9778 @item -fanalyzer-call-summaries
9779 @opindex fanalyzer-call-summaries
9780 @opindex fno-analyzer-call-summaries
9781 Simplify interprocedural analysis by computing the effect of certain calls,
9782 rather than exploring all paths through the function from callsite to each
9785 If enabled, call summaries are only used for functions with more than one
9786 call site, and that are sufficiently complicated (as per
9787 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
9789 @item -fanalyzer-checker=@var{name}
9790 @opindex fanalyzer-checker
9791 Restrict the analyzer to run just the named checker, and enable it.
9793 Some checkers are disabled by default (even with @option{-fanalyzer}),
9794 such as the @code{taint} checker that implements
9795 @option{-Wanalyzer-tainted-array-index}, and this option is required
9798 @item -fno-analyzer-feasibility
9799 @opindex fanalyzer-feasibility
9800 @opindex fno-analyzer-feasibility
9801 This option is intended for analyzer developers.
9803 By default the analyzer verifies that there is a feasible control flow path
9804 for each diagnostic it emits: that the conditions that hold are not mutually
9805 exclusive. Diagnostics for which no feasible path can be found are rejected.
9806 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
9807 debugging issues in this code.
9809 @item -fanalyzer-fine-grained
9810 @opindex fanalyzer-fine-grained
9811 @opindex fno-analyzer-fine-grained
9812 This option is intended for analyzer developers.
9814 Internally the analyzer builds an ``exploded graph'' that combines
9815 control flow graphs with data flow information.
9817 By default, an edge in this graph can contain the effects of a run
9818 of multiple statements within a basic block. With
9819 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
9821 @item -fanalyzer-show-duplicate-count
9822 @opindex fanalyzer-show-duplicate-count
9823 @opindex fno-analyzer-show-duplicate-count
9824 This option is intended for analyzer developers: if multiple diagnostics
9825 have been detected as being duplicates of each other, it emits a note when
9826 reporting the best diagnostic, giving the number of additional diagnostics
9827 that were suppressed by the deduplication logic.
9829 @item -fno-analyzer-state-merge
9830 @opindex fanalyzer-state-merge
9831 @opindex fno-analyzer-state-merge
9832 This option is intended for analyzer developers.
9834 By default the analyzer attempts to simplify analysis by merging
9835 sufficiently similar states at each program point as it builds its
9836 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
9837 merging can be suppressed, for debugging state-handling issues.
9839 @item -fno-analyzer-state-purge
9840 @opindex fanalyzer-state-purge
9841 @opindex fno-analyzer-state-purge
9842 This option is intended for analyzer developers.
9844 By default the analyzer attempts to simplify analysis by purging
9845 aspects of state at a program point that appear to no longer be relevant
9846 e.g. the values of locals that aren't accessed later in the function
9847 and which aren't relevant to leak analysis.
9849 With @option{-fno-analyzer-state-purge} this purging of state can
9850 be suppressed, for debugging state-handling issues.
9852 @item -fanalyzer-transitivity
9853 @opindex fanalyzer-transitivity
9854 @opindex fno-analyzer-transitivity
9855 This option enables transitivity of constraints within the analyzer.
9857 @item -fanalyzer-verbose-edges
9858 This option is intended for analyzer developers. It enables more
9859 verbose, lower-level detail in the descriptions of control flow
9860 within diagnostic paths.
9862 @item -fanalyzer-verbose-state-changes
9863 This option is intended for analyzer developers. It enables more
9864 verbose, lower-level detail in the descriptions of events relating
9865 to state machines within diagnostic paths.
9867 @item -fanalyzer-verbosity=@var{level}
9868 This option controls the complexity of the control flow paths that are
9869 emitted for analyzer diagnostics.
9871 The @var{level} can be one of:
9875 At this level, interprocedural call and return events are displayed,
9876 along with the most pertinent state-change events relating to
9877 a diagnostic. For example, for a double-@code{free} diagnostic,
9878 both calls to @code{free} will be shown.
9881 As per the previous level, but also show events for the entry
9885 As per the previous level, but also show events relating to
9886 control flow that are significant to triggering the issue
9887 (e.g. ``true path taken'' at a conditional).
9889 This level is the default.
9892 As per the previous level, but show all control flow events, not
9893 just significant ones.
9896 This level is intended for analyzer developers; it adds various
9897 other events intended for debugging the analyzer.
9901 @item -fdump-analyzer
9902 @opindex fdump-analyzer
9903 Dump internal details about what the analyzer is doing to
9904 @file{@var{file}.analyzer.txt}.
9905 This option is overridden by @option{-fdump-analyzer-stderr}.
9907 @item -fdump-analyzer-stderr
9908 @opindex fdump-analyzer-stderr
9909 Dump internal details about what the analyzer is doing to stderr.
9910 This option overrides @option{-fdump-analyzer}.
9912 @item -fdump-analyzer-callgraph
9913 @opindex fdump-analyzer-callgraph
9914 Dump a representation of the call graph suitable for viewing with
9915 GraphViz to @file{@var{file}.callgraph.dot}.
9917 @item -fdump-analyzer-exploded-graph
9918 @opindex fdump-analyzer-exploded-graph
9919 Dump a representation of the ``exploded graph'' suitable for viewing with
9920 GraphViz to @file{@var{file}.eg.dot}.
9921 Nodes are color-coded based on state-machine states to emphasize
9924 @item -fdump-analyzer-exploded-nodes
9925 @opindex dump-analyzer-exploded-nodes
9926 Emit diagnostics showing where nodes in the ``exploded graph'' are
9927 in relation to the program source.
9929 @item -fdump-analyzer-exploded-nodes-2
9930 @opindex dump-analyzer-exploded-nodes-2
9931 Dump a textual representation of the ``exploded graph'' to
9932 @file{@var{file}.eg.txt}.
9934 @item -fdump-analyzer-exploded-nodes-3
9935 @opindex dump-analyzer-exploded-nodes-3
9936 Dump a textual representation of the ``exploded graph'' to
9937 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
9938 This is typically a large number of dump files.
9940 @item -fdump-analyzer-exploded-paths
9941 @opindex fdump-analyzer-exploded-paths
9942 Dump a textual representation of the ``exploded path'' for each
9943 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
9945 @item -fdump-analyzer-feasibility
9946 @opindex dump-analyzer-feasibility
9947 Dump internal details about the analyzer's search for feasible paths.
9948 The details are written in a form suitable for viewing with GraphViz
9949 to filenames of the form @file{@var{file}.*.fg.dot} and
9950 @file{@var{file}.*.tg.dot}.
9952 @item -fdump-analyzer-json
9953 @opindex fdump-analyzer-json
9954 Dump a compressed JSON representation of analyzer internals to
9955 @file{@var{file}.analyzer.json.gz}. The precise format is subject
9958 @item -fdump-analyzer-state-purge
9959 @opindex fdump-analyzer-state-purge
9960 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
9961 ``supergraph'' suitable for viewing with GraphViz, but annotate the
9962 graph with information on what state will be purged at each node.
9963 The graph is written to @file{@var{file}.state-purge.dot}.
9965 @item -fdump-analyzer-supergraph
9966 @opindex fdump-analyzer-supergraph
9967 Dump representations of the ``supergraph'' suitable for viewing with
9968 GraphViz to @file{@var{file}.supergraph.dot} and to
9969 @file{@var{file}.supergraph-eg.dot}. These show all of the
9970 control flow graphs in the program, with interprocedural edges for
9971 calls and returns. The second dump contains annotations showing nodes
9972 in the ``exploded graph'' and diagnostics associated with them.
9976 @node Debugging Options
9977 @section Options for Debugging Your Program
9978 @cindex options, debugging
9979 @cindex debugging information options
9981 To tell GCC to emit extra information for use by a debugger, in almost
9982 all cases you need only to add @option{-g} to your other options. Some debug
9983 formats can co-exist (like DWARF with CTF) when each of them is enabled
9984 explicitly by adding the respective command line option to your other options.
9986 GCC allows you to use @option{-g} with
9987 @option{-O}. The shortcuts taken by optimized code may occasionally
9988 be surprising: some variables you declared may not exist
9989 at all; flow of control may briefly move where you did not expect it;
9990 some statements may not be executed because they compute constant
9991 results or their values are already at hand; some statements may
9992 execute in different places because they have been moved out of loops.
9993 Nevertheless it is possible to debug optimized output. This makes
9994 it reasonable to use the optimizer for programs that might have bugs.
9996 If you are not using some other optimization option, consider
9997 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
9998 With no @option{-O} option at all, some compiler passes that collect
9999 information useful for debugging do not run at all, so that
10000 @option{-Og} may result in a better debugging experience.
10005 Produce debugging information in the operating system's native format
10006 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
10009 On most systems that use stabs format, @option{-g} enables use of extra
10010 debugging information that only GDB can use; this extra information
10011 makes debugging work better in GDB but probably makes other debuggers
10013 refuse to read the program. If you want to control for certain whether
10014 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
10015 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
10019 Produce debugging information for use by GDB@. This means to use the
10020 most expressive format available (DWARF, stabs, or the native format
10021 if neither of those are supported), including GDB extensions if at all
10025 @itemx -gdwarf-@var{version}
10027 Produce debugging information in DWARF format (if that is supported).
10028 The value of @var{version} may be either 2, 3, 4 or 5; the default
10029 version for most targets is 5 (with the exception of VxWorks, TPF and
10030 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
10033 Note that with DWARF Version 2, some ports require and always
10034 use some non-conflicting DWARF 3 extensions in the unwind tables.
10036 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
10037 for maximum benefit. Version 5 requires GDB 8.0 or higher.
10039 GCC no longer supports DWARF Version 1, which is substantially
10040 different than Version 2 and later. For historical reasons, some
10041 other DWARF-related options such as
10042 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
10043 in their names, but apply to all currently-supported versions of DWARF.
10047 Request BTF debug information. BTF is the default debugging format for the
10048 eBPF target. On other targets, like x86, BTF debug information can be
10049 generated along with DWARF debug information when both of the debug formats are
10050 enabled explicitly via their respective command line options.
10053 @itemx -gctf@var{level}
10055 Request CTF debug information and use level to specify how much CTF debug
10056 information should be produced. If @option{-gctf} is specified
10057 without a value for level, the default level of CTF debug information is 2.
10059 CTF debug information can be generated along with DWARF debug information when
10060 both of the debug formats are enabled explicitly via their respective command
10063 Level 0 produces no CTF debug information at all. Thus, @option{-gctf0}
10064 negates @option{-gctf}.
10066 Level 1 produces CTF information for tracebacks only. This includes callsite
10067 information, but does not include type information.
10069 Level 2 produces type information for entities (functions, data objects etc.)
10070 at file-scope or global-scope only.
10074 Produce debugging information in stabs format (if that is supported),
10075 without GDB extensions. This is the format used by DBX on most BSD
10076 systems. On MIPS, Alpha and System V Release 4 systems this option
10077 produces stabs debugging output that is not understood by DBX@.
10078 On System V Release 4 systems this option requires the GNU assembler.
10082 Produce debugging information in stabs format (if that is supported),
10083 using GNU extensions understood only by the GNU debugger (GDB)@. The
10084 use of these extensions is likely to make other debuggers crash or
10085 refuse to read the program.
10089 Produce debugging information in XCOFF format (if that is supported).
10090 This is the format used by the DBX debugger on IBM RS/6000 systems.
10094 Produce debugging information in XCOFF format (if that is supported),
10095 using GNU extensions understood only by the GNU debugger (GDB)@. The
10096 use of these extensions is likely to make other debuggers crash or
10097 refuse to read the program, and may cause assemblers other than the GNU
10098 assembler (GAS) to fail with an error.
10102 Produce debugging information in Alpha/VMS debug format (if that is
10103 supported). This is the format used by DEBUG on Alpha/VMS systems.
10105 @item -g@var{level}
10106 @itemx -ggdb@var{level}
10107 @itemx -gstabs@var{level}
10108 @itemx -gxcoff@var{level}
10109 @itemx -gvms@var{level}
10110 Request debugging information and also use @var{level} to specify how
10111 much information. The default level is 2.
10113 Level 0 produces no debug information at all. Thus, @option{-g0} negates
10116 Level 1 produces minimal information, enough for making backtraces in
10117 parts of the program that you don't plan to debug. This includes
10118 descriptions of functions and external variables, and line number
10119 tables, but no information about local variables.
10121 Level 3 includes extra information, such as all the macro definitions
10122 present in the program. Some debuggers support macro expansion when
10123 you use @option{-g3}.
10125 If you use multiple @option{-g} options, with or without level numbers,
10126 the last such option is the one that is effective.
10128 @option{-gdwarf} does not accept a concatenated debug level, to avoid
10129 confusion with @option{-gdwarf-@var{level}}.
10130 Instead use an additional @option{-g@var{level}} option to change the
10131 debug level for DWARF.
10133 @item -fno-eliminate-unused-debug-symbols
10134 @opindex feliminate-unused-debug-symbols
10135 @opindex fno-eliminate-unused-debug-symbols
10136 By default, no debug information is produced for symbols that are not actually
10137 used. Use this option if you want debug information for all symbols.
10139 @item -femit-class-debug-always
10140 @opindex femit-class-debug-always
10141 Instead of emitting debugging information for a C++ class in only one
10142 object file, emit it in all object files using the class. This option
10143 should be used only with debuggers that are unable to handle the way GCC
10144 normally emits debugging information for classes because using this
10145 option increases the size of debugging information by as much as a
10148 @item -fno-merge-debug-strings
10149 @opindex fmerge-debug-strings
10150 @opindex fno-merge-debug-strings
10151 Direct the linker to not merge together strings in the debugging
10152 information that are identical in different object files. Merging is
10153 not supported by all assemblers or linkers. Merging decreases the size
10154 of the debug information in the output file at the cost of increasing
10155 link processing time. Merging is enabled by default.
10157 @item -fdebug-prefix-map=@var{old}=@var{new}
10158 @opindex fdebug-prefix-map
10159 When compiling files residing in directory @file{@var{old}}, record
10160 debugging information describing them as if the files resided in
10161 directory @file{@var{new}} instead. This can be used to replace a
10162 build-time path with an install-time path in the debug info. It can
10163 also be used to change an absolute path to a relative path by using
10164 @file{.} for @var{new}. This can give more reproducible builds, which
10165 are location independent, but may require an extra command to tell GDB
10166 where to find the source files. See also @option{-ffile-prefix-map}.
10168 @item -fvar-tracking
10169 @opindex fvar-tracking
10170 Run variable tracking pass. It computes where variables are stored at each
10171 position in code. Better debugging information is then generated
10172 (if the debugging information format supports this information).
10174 It is enabled by default when compiling with optimization (@option{-Os},
10175 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
10176 the debug info format supports it.
10178 @item -fvar-tracking-assignments
10179 @opindex fvar-tracking-assignments
10180 @opindex fno-var-tracking-assignments
10181 Annotate assignments to user variables early in the compilation and
10182 attempt to carry the annotations over throughout the compilation all the
10183 way to the end, in an attempt to improve debug information while
10184 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
10186 It can be enabled even if var-tracking is disabled, in which case
10187 annotations are created and maintained, but discarded at the end.
10188 By default, this flag is enabled together with @option{-fvar-tracking},
10189 except when selective scheduling is enabled.
10191 @item -gsplit-dwarf
10192 @opindex gsplit-dwarf
10193 If DWARF debugging information is enabled, separate as much debugging
10194 information as possible into a separate output file with the extension
10195 @file{.dwo}. This option allows the build system to avoid linking files with
10196 debug information. To be useful, this option requires a debugger capable of
10197 reading @file{.dwo} files.
10203 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
10204 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
10205 DWARF format. The default is target specific, on most targets it is
10206 @option{-gdwarf32} though. The 32-bit DWARF format is smaller, but
10207 can't support more than 2GiB of debug information in any of the DWARF
10208 debug information sections. The 64-bit DWARF format allows larger debug
10209 information and might not be well supported by all consumers yet.
10211 @item -gdescribe-dies
10212 @opindex gdescribe-dies
10213 Add description attributes to some DWARF DIEs that have no name attribute,
10214 such as artificial variables, external references and call site
10219 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
10221 @item -ggnu-pubnames
10222 @opindex ggnu-pubnames
10223 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
10224 suitable for conversion into a GDB@ index. This option is only useful
10225 with a linker that can produce GDB@ index version 7.
10227 @item -fdebug-types-section
10228 @opindex fdebug-types-section
10229 @opindex fno-debug-types-section
10230 When using DWARF Version 4 or higher, type DIEs can be put into
10231 their own @code{.debug_types} section instead of making them part of the
10232 @code{.debug_info} section. It is more efficient to put them in a separate
10233 comdat section since the linker can then remove duplicates.
10234 But not all DWARF consumers support @code{.debug_types} sections yet
10235 and on some objects @code{.debug_types} produces larger instead of smaller
10236 debugging information.
10238 @item -grecord-gcc-switches
10239 @itemx -gno-record-gcc-switches
10240 @opindex grecord-gcc-switches
10241 @opindex gno-record-gcc-switches
10242 This switch causes the command-line options used to invoke the
10243 compiler that may affect code generation to be appended to the
10244 DW_AT_producer attribute in DWARF debugging information. The options
10245 are concatenated with spaces separating them from each other and from
10246 the compiler version.
10247 It is enabled by default.
10248 See also @option{-frecord-gcc-switches} for another
10249 way of storing compiler options into the object file.
10251 @item -gstrict-dwarf
10252 @opindex gstrict-dwarf
10253 Disallow using extensions of later DWARF standard version than selected
10254 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
10255 DWARF extensions from later standard versions is allowed.
10257 @item -gno-strict-dwarf
10258 @opindex gno-strict-dwarf
10259 Allow using extensions of later DWARF standard version than selected with
10260 @option{-gdwarf-@var{version}}.
10262 @item -gas-loc-support
10263 @opindex gas-loc-support
10264 Inform the compiler that the assembler supports @code{.loc} directives.
10265 It may then use them for the assembler to generate DWARF2+ line number
10268 This is generally desirable, because assembler-generated line-number
10269 tables are a lot more compact than those the compiler can generate
10272 This option will be enabled by default if, at GCC configure time, the
10273 assembler was found to support such directives.
10275 @item -gno-as-loc-support
10276 @opindex gno-as-loc-support
10277 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
10278 line number tables are to be generated.
10280 @item -gas-locview-support
10281 @opindex gas-locview-support
10282 Inform the compiler that the assembler supports @code{view} assignment
10283 and reset assertion checking in @code{.loc} directives.
10285 This option will be enabled by default if, at GCC configure time, the
10286 assembler was found to support them.
10288 @item -gno-as-locview-support
10289 Force GCC to assign view numbers internally, if
10290 @option{-gvariable-location-views} are explicitly requested.
10292 @item -gcolumn-info
10293 @itemx -gno-column-info
10294 @opindex gcolumn-info
10295 @opindex gno-column-info
10296 Emit location column information into DWARF debugging information, rather
10297 than just file and line.
10298 This option is enabled by default.
10300 @item -gstatement-frontiers
10301 @itemx -gno-statement-frontiers
10302 @opindex gstatement-frontiers
10303 @opindex gno-statement-frontiers
10304 This option causes GCC to create markers in the internal representation
10305 at the beginning of statements, and to keep them roughly in place
10306 throughout compilation, using them to guide the output of @code{is_stmt}
10307 markers in the line number table. This is enabled by default when
10308 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
10309 @dots{}), and outputting DWARF 2 debug information at the normal level.
10311 @item -gvariable-location-views
10312 @itemx -gvariable-location-views=incompat5
10313 @itemx -gno-variable-location-views
10314 @opindex gvariable-location-views
10315 @opindex gvariable-location-views=incompat5
10316 @opindex gno-variable-location-views
10317 Augment variable location lists with progressive view numbers implied
10318 from the line number table. This enables debug information consumers to
10319 inspect state at certain points of the program, even if no instructions
10320 associated with the corresponding source locations are present at that
10321 point. If the assembler lacks support for view numbers in line number
10322 tables, this will cause the compiler to emit the line number table,
10323 which generally makes them somewhat less compact. The augmented line
10324 number tables and location lists are fully backward-compatible, so they
10325 can be consumed by debug information consumers that are not aware of
10326 these augmentations, but they won't derive any benefit from them either.
10328 This is enabled by default when outputting DWARF 2 debug information at
10329 the normal level, as long as there is assembler support,
10330 @option{-fvar-tracking-assignments} is enabled and
10331 @option{-gstrict-dwarf} is not. When assembler support is not
10332 available, this may still be enabled, but it will force GCC to output
10333 internal line number tables, and if
10334 @option{-ginternal-reset-location-views} is not enabled, that will most
10335 certainly lead to silently mismatching location views.
10337 There is a proposed representation for view numbers that is not backward
10338 compatible with the location list format introduced in DWARF 5, that can
10339 be enabled with @option{-gvariable-location-views=incompat5}. This
10340 option may be removed in the future, is only provided as a reference
10341 implementation of the proposed representation. Debug information
10342 consumers are not expected to support this extended format, and they
10343 would be rendered unable to decode location lists using it.
10345 @item -ginternal-reset-location-views
10346 @itemx -gno-internal-reset-location-views
10347 @opindex ginternal-reset-location-views
10348 @opindex gno-internal-reset-location-views
10349 Attempt to determine location views that can be omitted from location
10350 view lists. This requires the compiler to have very accurate insn
10351 length estimates, which isn't always the case, and it may cause
10352 incorrect view lists to be generated silently when using an assembler
10353 that does not support location view lists. The GNU assembler will flag
10354 any such error as a @code{view number mismatch}. This is only enabled
10355 on ports that define a reliable estimation function.
10357 @item -ginline-points
10358 @itemx -gno-inline-points
10359 @opindex ginline-points
10360 @opindex gno-inline-points
10361 Generate extended debug information for inlined functions. Location
10362 view tracking markers are inserted at inlined entry points, so that
10363 address and view numbers can be computed and output in debug
10364 information. This can be enabled independently of location views, in
10365 which case the view numbers won't be output, but it can only be enabled
10366 along with statement frontiers, and it is only enabled by default if
10367 location views are enabled.
10369 @item -gz@r{[}=@var{type}@r{]}
10371 Produce compressed debug sections in DWARF format, if that is supported.
10372 If @var{type} is not given, the default type depends on the capabilities
10373 of the assembler and linker used. @var{type} may be one of
10374 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
10375 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
10376 compression in traditional GNU format). If the linker doesn't support
10377 writing compressed debug sections, the option is rejected. Otherwise,
10378 if the assembler does not support them, @option{-gz} is silently ignored
10379 when producing object files.
10381 @item -femit-struct-debug-baseonly
10382 @opindex femit-struct-debug-baseonly
10383 Emit debug information for struct-like types
10384 only when the base name of the compilation source file
10385 matches the base name of file in which the struct is defined.
10387 This option substantially reduces the size of debugging information,
10388 but at significant potential loss in type information to the debugger.
10389 See @option{-femit-struct-debug-reduced} for a less aggressive option.
10390 See @option{-femit-struct-debug-detailed} for more detailed control.
10392 This option works only with DWARF debug output.
10394 @item -femit-struct-debug-reduced
10395 @opindex femit-struct-debug-reduced
10396 Emit debug information for struct-like types
10397 only when the base name of the compilation source file
10398 matches the base name of file in which the type is defined,
10399 unless the struct is a template or defined in a system header.
10401 This option significantly reduces the size of debugging information,
10402 with some potential loss in type information to the debugger.
10403 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
10404 See @option{-femit-struct-debug-detailed} for more detailed control.
10406 This option works only with DWARF debug output.
10408 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
10409 @opindex femit-struct-debug-detailed
10410 Specify the struct-like types
10411 for which the compiler generates debug information.
10412 The intent is to reduce duplicate struct debug information
10413 between different object files within the same program.
10415 This option is a detailed version of
10416 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
10417 which serves for most needs.
10419 A specification has the syntax@*
10420 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
10422 The optional first word limits the specification to
10423 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
10424 A struct type is used directly when it is the type of a variable, member.
10425 Indirect uses arise through pointers to structs.
10426 That is, when use of an incomplete struct is valid, the use is indirect.
10428 @samp{struct one direct; struct two * indirect;}.
10430 The optional second word limits the specification to
10431 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
10432 Generic structs are a bit complicated to explain.
10433 For C++, these are non-explicit specializations of template classes,
10434 or non-template classes within the above.
10435 Other programming languages have generics,
10436 but @option{-femit-struct-debug-detailed} does not yet implement them.
10438 The third word specifies the source files for those
10439 structs for which the compiler should emit debug information.
10440 The values @samp{none} and @samp{any} have the normal meaning.
10441 The value @samp{base} means that
10442 the base of name of the file in which the type declaration appears
10443 must match the base of the name of the main compilation file.
10444 In practice, this means that when compiling @file{foo.c}, debug information
10445 is generated for types declared in that file and @file{foo.h},
10446 but not other header files.
10447 The value @samp{sys} means those types satisfying @samp{base}
10448 or declared in system or compiler headers.
10450 You may need to experiment to determine the best settings for your application.
10452 The default is @option{-femit-struct-debug-detailed=all}.
10454 This option works only with DWARF debug output.
10456 @item -fno-dwarf2-cfi-asm
10457 @opindex fdwarf2-cfi-asm
10458 @opindex fno-dwarf2-cfi-asm
10459 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
10460 instead of using GAS @code{.cfi_*} directives.
10462 @item -fno-eliminate-unused-debug-types
10463 @opindex feliminate-unused-debug-types
10464 @opindex fno-eliminate-unused-debug-types
10465 Normally, when producing DWARF output, GCC avoids producing debug symbol
10466 output for types that are nowhere used in the source file being compiled.
10467 Sometimes it is useful to have GCC emit debugging
10468 information for all types declared in a compilation
10469 unit, regardless of whether or not they are actually used
10470 in that compilation unit, for example
10471 if, in the debugger, you want to cast a value to a type that is
10472 not actually used in your program (but is declared). More often,
10473 however, this results in a significant amount of wasted space.
10476 @node Optimize Options
10477 @section Options That Control Optimization
10478 @cindex optimize options
10479 @cindex options, optimization
10481 These options control various sorts of optimizations.
10483 Without any optimization option, the compiler's goal is to reduce the
10484 cost of compilation and to make debugging produce the expected
10485 results. Statements are independent: if you stop the program with a
10486 breakpoint between statements, you can then assign a new value to any
10487 variable or change the program counter to any other statement in the
10488 function and get exactly the results you expect from the source
10491 Turning on optimization flags makes the compiler attempt to improve
10492 the performance and/or code size at the expense of compilation time
10493 and possibly the ability to debug the program.
10495 The compiler performs optimization based on the knowledge it has of the
10496 program. Compiling multiple files at once to a single output file mode allows
10497 the compiler to use information gained from all of the files when compiling
10500 Not all optimizations are controlled directly by a flag. Only
10501 optimizations that have a flag are listed in this section.
10503 Most optimizations are completely disabled at @option{-O0} or if an
10504 @option{-O} level is not set on the command line, even if individual
10505 optimization flags are specified. Similarly, @option{-Og} suppresses
10506 many optimization passes.
10508 Depending on the target and how GCC was configured, a slightly different
10509 set of optimizations may be enabled at each @option{-O} level than
10510 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
10511 to find out the exact set of optimizations that are enabled at each level.
10512 @xref{Overall Options}, for examples.
10519 Optimize. Optimizing compilation takes somewhat more time, and a lot
10520 more memory for a large function.
10522 With @option{-O}, the compiler tries to reduce code size and execution
10523 time, without performing any optimizations that take a great deal of
10526 @c Note that in addition to the default_options_table list in opts.c,
10527 @c several optimization flags default to true but control optimization
10528 @c passes that are explicitly disabled at -O0.
10530 @option{-O} turns on the following optimization flags:
10532 @c Please keep the following list alphabetized.
10533 @gccoptlist{-fauto-inc-dec @gol
10534 -fbranch-count-reg @gol
10535 -fcombine-stack-adjustments @gol
10536 -fcompare-elim @gol
10537 -fcprop-registers @gol
10540 -fdelayed-branch @gol
10542 -fforward-propagate @gol
10543 -fguess-branch-probability @gol
10544 -fif-conversion @gol
10545 -fif-conversion2 @gol
10546 -finline-functions-called-once @gol
10549 -fipa-pure-const @gol
10550 -fipa-reference @gol
10551 -fipa-reference-addressable @gol
10552 -fmerge-constants @gol
10553 -fmove-loop-invariants @gol
10554 -fmove-loop-stores@gol
10555 -fomit-frame-pointer @gol
10556 -freorder-blocks @gol
10558 -fshrink-wrap-separate @gol
10559 -fsplit-wide-types @gol
10560 -fssa-backprop @gol
10562 -ftree-bit-ccp @gol
10565 -ftree-coalesce-vars @gol
10566 -ftree-copy-prop @gol
10568 -ftree-dominator-opts @gol
10570 -ftree-forwprop @gol
10572 -ftree-phiprop @gol
10574 -ftree-scev-cprop @gol
10583 Optimize even more. GCC performs nearly all supported optimizations
10584 that do not involve a space-speed tradeoff.
10585 As compared to @option{-O}, this option increases both compilation time
10586 and the performance of the generated code.
10588 @option{-O2} turns on all optimization flags specified by @option{-O1}. It
10589 also turns on the following optimization flags:
10591 @c Please keep the following list alphabetized!
10592 @gccoptlist{-falign-functions -falign-jumps @gol
10593 -falign-labels -falign-loops @gol
10594 -fcaller-saves @gol
10595 -fcode-hoisting @gol
10596 -fcrossjumping @gol
10597 -fcse-follow-jumps -fcse-skip-blocks @gol
10598 -fdelete-null-pointer-checks @gol
10599 -fdevirtualize -fdevirtualize-speculatively @gol
10600 -fexpensive-optimizations @gol
10601 -ffinite-loops @gol
10602 -fgcse -fgcse-lm @gol
10603 -fhoist-adjacent-loads @gol
10604 -finline-functions @gol
10605 -finline-small-functions @gol
10606 -findirect-inlining @gol
10607 -fipa-bit-cp -fipa-cp -fipa-icf @gol
10608 -fipa-ra -fipa-sra -fipa-vrp @gol
10609 -fisolate-erroneous-paths-dereference @gol
10611 -foptimize-sibling-calls @gol
10612 -foptimize-strlen @gol
10613 -fpartial-inlining @gol
10615 -freorder-blocks-algorithm=stc @gol
10616 -freorder-blocks-and-partition -freorder-functions @gol
10617 -frerun-cse-after-loop @gol
10618 -fschedule-insns -fschedule-insns2 @gol
10619 -fsched-interblock -fsched-spec @gol
10620 -fstore-merging @gol
10621 -fstrict-aliasing @gol
10622 -fthread-jumps @gol
10623 -ftree-builtin-call-dce @gol
10624 -ftree-loop-vectorize @gol
10626 -ftree-slp-vectorize @gol
10627 -ftree-switch-conversion -ftree-tail-merge @gol
10629 -fvect-cost-model=very-cheap}
10631 Please note the warning under @option{-fgcse} about
10632 invoking @option{-O2} on programs that use computed gotos.
10636 Optimize yet more. @option{-O3} turns on all optimizations specified
10637 by @option{-O2} and also turns on the following optimization flags:
10639 @c Please keep the following list alphabetized!
10640 @gccoptlist{-fgcse-after-reload @gol
10642 -floop-interchange @gol
10643 -floop-unroll-and-jam @gol
10645 -fpredictive-commoning @gol
10648 -ftree-loop-distribution @gol
10649 -ftree-partial-pre @gol
10650 -funswitch-loops @gol
10651 -fvect-cost-model=dynamic @gol
10652 -fversion-loops-for-strides}
10656 Reduce compilation time and make debugging produce the expected
10657 results. This is the default.
10661 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
10662 except those that often increase code size:
10664 @gccoptlist{-falign-functions -falign-jumps @gol
10665 -falign-labels -falign-loops @gol
10666 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
10668 It also enables @option{-finline-functions}, causes the compiler to tune for
10669 code size rather than execution speed, and performs further optimizations
10670 designed to reduce code size.
10674 Disregard strict standards compliance. @option{-Ofast} enables all
10675 @option{-O3} optimizations. It also enables optimizations that are not
10676 valid for all standard-compliant programs.
10677 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
10678 and the Fortran-specific @option{-fstack-arrays}, unless
10679 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
10683 Optimize debugging experience. @option{-Og} should be the optimization
10684 level of choice for the standard edit-compile-debug cycle, offering
10685 a reasonable level of optimization while maintaining fast compilation
10686 and a good debugging experience. It is a better choice than @option{-O0}
10687 for producing debuggable code because some compiler passes
10688 that collect debug information are disabled at @option{-O0}.
10690 Like @option{-O0}, @option{-Og} completely disables a number of
10691 optimization passes so that individual options controlling them have
10692 no effect. Otherwise @option{-Og} enables all @option{-O1}
10693 optimization flags except for those that may interfere with debugging:
10695 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
10696 -fdse -fif-conversion -fif-conversion2 @gol
10697 -finline-functions-called-once @gol
10698 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt @gol
10699 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
10703 If you use multiple @option{-O} options, with or without level numbers,
10704 the last such option is the one that is effective.
10706 Options of the form @option{-f@var{flag}} specify machine-independent
10707 flags. Most flags have both positive and negative forms; the negative
10708 form of @option{-ffoo} is @option{-fno-foo}. In the table
10709 below, only one of the forms is listed---the one you typically
10710 use. You can figure out the other form by either removing @samp{no-}
10713 The following options control specific optimizations. They are either
10714 activated by @option{-O} options or are related to ones that are. You
10715 can use the following flags in the rare cases when ``fine-tuning'' of
10716 optimizations to be performed is desired.
10719 @item -fno-defer-pop
10720 @opindex fno-defer-pop
10721 @opindex fdefer-pop
10722 For machines that must pop arguments after a function call, always pop
10723 the arguments as soon as each function returns.
10724 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
10725 this allows the compiler to let arguments accumulate on the stack for several
10726 function calls and pop them all at once.
10728 @item -fforward-propagate
10729 @opindex fforward-propagate
10730 Perform a forward propagation pass on RTL@. The pass tries to combine two
10731 instructions and checks if the result can be simplified. If loop unrolling
10732 is active, two passes are performed and the second is scheduled after
10735 This option is enabled by default at optimization levels @option{-O1},
10736 @option{-O2}, @option{-O3}, @option{-Os}.
10738 @item -ffp-contract=@var{style}
10739 @opindex ffp-contract
10740 @option{-ffp-contract=off} disables floating-point expression contraction.
10741 @option{-ffp-contract=fast} enables floating-point expression contraction
10742 such as forming of fused multiply-add operations if the target has
10743 native support for them.
10744 @option{-ffp-contract=on} enables floating-point expression contraction
10745 if allowed by the language standard. This is currently not implemented
10746 and treated equal to @option{-ffp-contract=off}.
10748 The default is @option{-ffp-contract=fast}.
10750 @item -fomit-frame-pointer
10751 @opindex fomit-frame-pointer
10752 Omit the frame pointer in functions that don't need one. This avoids the
10753 instructions to save, set up and restore the frame pointer; on many targets
10754 it also makes an extra register available.
10756 On some targets this flag has no effect because the standard calling sequence
10757 always uses a frame pointer, so it cannot be omitted.
10759 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
10760 is used in all functions. Several targets always omit the frame pointer in
10763 Enabled by default at @option{-O1} and higher.
10765 @item -foptimize-sibling-calls
10766 @opindex foptimize-sibling-calls
10767 Optimize sibling and tail recursive calls.
10769 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10771 @item -foptimize-strlen
10772 @opindex foptimize-strlen
10773 Optimize various standard C string functions (e.g.@: @code{strlen},
10774 @code{strchr} or @code{strcpy}) and
10775 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
10777 Enabled at levels @option{-O2}, @option{-O3}.
10780 @opindex fno-inline
10782 Do not expand any functions inline apart from those marked with
10783 the @code{always_inline} attribute. This is the default when not
10786 Single functions can be exempted from inlining by marking them
10787 with the @code{noinline} attribute.
10789 @item -finline-small-functions
10790 @opindex finline-small-functions
10791 Integrate functions into their callers when their body is smaller than expected
10792 function call code (so overall size of program gets smaller). The compiler
10793 heuristically decides which functions are simple enough to be worth integrating
10794 in this way. This inlining applies to all functions, even those not declared
10797 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10799 @item -findirect-inlining
10800 @opindex findirect-inlining
10801 Inline also indirect calls that are discovered to be known at compile
10802 time thanks to previous inlining. This option has any effect only
10803 when inlining itself is turned on by the @option{-finline-functions}
10804 or @option{-finline-small-functions} options.
10806 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10808 @item -finline-functions
10809 @opindex finline-functions
10810 Consider all functions for inlining, even if they are not declared inline.
10811 The compiler heuristically decides which functions are worth integrating
10814 If all calls to a given function are integrated, and the function is
10815 declared @code{static}, then the function is normally not output as
10816 assembler code in its own right.
10818 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
10819 by @option{-fprofile-use} and @option{-fauto-profile}.
10821 @item -finline-functions-called-once
10822 @opindex finline-functions-called-once
10823 Consider all @code{static} functions called once for inlining into their
10824 caller even if they are not marked @code{inline}. If a call to a given
10825 function is integrated, then the function is not output as assembler code
10828 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
10829 but not @option{-Og}.
10831 @item -fearly-inlining
10832 @opindex fearly-inlining
10833 Inline functions marked by @code{always_inline} and functions whose body seems
10834 smaller than the function call overhead early before doing
10835 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
10836 makes profiling significantly cheaper and usually inlining faster on programs
10837 having large chains of nested wrapper functions.
10839 Enabled by default.
10843 Perform interprocedural scalar replacement of aggregates, removal of
10844 unused parameters and replacement of parameters passed by reference
10845 by parameters passed by value.
10847 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
10849 @item -finline-limit=@var{n}
10850 @opindex finline-limit
10851 By default, GCC limits the size of functions that can be inlined. This flag
10852 allows coarse control of this limit. @var{n} is the size of functions that
10853 can be inlined in number of pseudo instructions.
10855 Inlining is actually controlled by a number of parameters, which may be
10856 specified individually by using @option{--param @var{name}=@var{value}}.
10857 The @option{-finline-limit=@var{n}} option sets some of these parameters
10861 @item max-inline-insns-single
10862 is set to @var{n}/2.
10863 @item max-inline-insns-auto
10864 is set to @var{n}/2.
10867 See below for a documentation of the individual
10868 parameters controlling inlining and for the defaults of these parameters.
10870 @emph{Note:} there may be no value to @option{-finline-limit} that results
10871 in default behavior.
10873 @emph{Note:} pseudo instruction represents, in this particular context, an
10874 abstract measurement of function's size. In no way does it represent a count
10875 of assembly instructions and as such its exact meaning might change from one
10876 release to an another.
10878 @item -fno-keep-inline-dllexport
10879 @opindex fno-keep-inline-dllexport
10880 @opindex fkeep-inline-dllexport
10881 This is a more fine-grained version of @option{-fkeep-inline-functions},
10882 which applies only to functions that are declared using the @code{dllexport}
10883 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
10886 @item -fkeep-inline-functions
10887 @opindex fkeep-inline-functions
10888 In C, emit @code{static} functions that are declared @code{inline}
10889 into the object file, even if the function has been inlined into all
10890 of its callers. This switch does not affect functions using the
10891 @code{extern inline} extension in GNU C90@. In C++, emit any and all
10892 inline functions into the object file.
10894 @item -fkeep-static-functions
10895 @opindex fkeep-static-functions
10896 Emit @code{static} functions into the object file, even if the function
10899 @item -fkeep-static-consts
10900 @opindex fkeep-static-consts
10901 Emit variables declared @code{static const} when optimization isn't turned
10902 on, even if the variables aren't referenced.
10904 GCC enables this option by default. If you want to force the compiler to
10905 check if a variable is referenced, regardless of whether or not
10906 optimization is turned on, use the @option{-fno-keep-static-consts} option.
10908 @item -fmerge-constants
10909 @opindex fmerge-constants
10910 Attempt to merge identical constants (string constants and floating-point
10911 constants) across compilation units.
10913 This option is the default for optimized compilation if the assembler and
10914 linker support it. Use @option{-fno-merge-constants} to inhibit this
10917 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
10919 @item -fmerge-all-constants
10920 @opindex fmerge-all-constants
10921 Attempt to merge identical constants and identical variables.
10923 This option implies @option{-fmerge-constants}. In addition to
10924 @option{-fmerge-constants} this considers e.g.@: even constant initialized
10925 arrays or initialized constant variables with integral or floating-point
10926 types. Languages like C or C++ require each variable, including multiple
10927 instances of the same variable in recursive calls, to have distinct locations,
10928 so using this option results in non-conforming
10931 @item -fmodulo-sched
10932 @opindex fmodulo-sched
10933 Perform swing modulo scheduling immediately before the first scheduling
10934 pass. This pass looks at innermost loops and reorders their
10935 instructions by overlapping different iterations.
10937 @item -fmodulo-sched-allow-regmoves
10938 @opindex fmodulo-sched-allow-regmoves
10939 Perform more aggressive SMS-based modulo scheduling with register moves
10940 allowed. By setting this flag certain anti-dependences edges are
10941 deleted, which triggers the generation of reg-moves based on the
10942 life-range analysis. This option is effective only with
10943 @option{-fmodulo-sched} enabled.
10945 @item -fno-branch-count-reg
10946 @opindex fno-branch-count-reg
10947 @opindex fbranch-count-reg
10948 Disable the optimization pass that scans for opportunities to use
10949 ``decrement and branch'' instructions on a count register instead of
10950 instruction sequences that decrement a register, compare it against zero, and
10951 then branch based upon the result. This option is only meaningful on
10952 architectures that support such instructions, which include x86, PowerPC,
10953 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
10954 doesn't remove the decrement and branch instructions from the generated
10955 instruction stream introduced by other optimization passes.
10957 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
10958 except for @option{-Og}.
10960 @item -fno-function-cse
10961 @opindex fno-function-cse
10962 @opindex ffunction-cse
10963 Do not put function addresses in registers; make each instruction that
10964 calls a constant function contain the function's address explicitly.
10966 This option results in less efficient code, but some strange hacks
10967 that alter the assembler output may be confused by the optimizations
10968 performed when this option is not used.
10970 The default is @option{-ffunction-cse}
10972 @item -fno-zero-initialized-in-bss
10973 @opindex fno-zero-initialized-in-bss
10974 @opindex fzero-initialized-in-bss
10975 If the target supports a BSS section, GCC by default puts variables that
10976 are initialized to zero into BSS@. This can save space in the resulting
10979 This option turns off this behavior because some programs explicitly
10980 rely on variables going to the data section---e.g., so that the
10981 resulting executable can find the beginning of that section and/or make
10982 assumptions based on that.
10984 The default is @option{-fzero-initialized-in-bss}.
10986 @item -fthread-jumps
10987 @opindex fthread-jumps
10988 Perform optimizations that check to see if a jump branches to a
10989 location where another comparison subsumed by the first is found. If
10990 so, the first branch is redirected to either the destination of the
10991 second branch or a point immediately following it, depending on whether
10992 the condition is known to be true or false.
10994 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
10996 @item -fsplit-wide-types
10997 @opindex fsplit-wide-types
10998 When using a type that occupies multiple registers, such as @code{long
10999 long} on a 32-bit system, split the registers apart and allocate them
11000 independently. This normally generates better code for those types,
11001 but may make debugging more difficult.
11003 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
11006 @item -fsplit-wide-types-early
11007 @opindex fsplit-wide-types-early
11008 Fully split wide types early, instead of very late.
11009 This option has no effect unless @option{-fsplit-wide-types} is turned on.
11011 This is the default on some targets.
11013 @item -fcse-follow-jumps
11014 @opindex fcse-follow-jumps
11015 In common subexpression elimination (CSE), scan through jump instructions
11016 when the target of the jump is not reached by any other path. For
11017 example, when CSE encounters an @code{if} statement with an
11018 @code{else} clause, CSE follows the jump when the condition
11021 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11023 @item -fcse-skip-blocks
11024 @opindex fcse-skip-blocks
11025 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
11026 follow jumps that conditionally skip over blocks. When CSE
11027 encounters a simple @code{if} statement with no else clause,
11028 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
11029 body of the @code{if}.
11031 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11033 @item -frerun-cse-after-loop
11034 @opindex frerun-cse-after-loop
11035 Re-run common subexpression elimination after loop optimizations are
11038 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11042 Perform a global common subexpression elimination pass.
11043 This pass also performs global constant and copy propagation.
11045 @emph{Note:} When compiling a program using computed gotos, a GCC
11046 extension, you may get better run-time performance if you disable
11047 the global common subexpression elimination pass by adding
11048 @option{-fno-gcse} to the command line.
11050 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11054 When @option{-fgcse-lm} is enabled, global common subexpression elimination
11055 attempts to move loads that are only killed by stores into themselves. This
11056 allows a loop containing a load/store sequence to be changed to a load outside
11057 the loop, and a copy/store within the loop.
11059 Enabled by default when @option{-fgcse} is enabled.
11063 When @option{-fgcse-sm} is enabled, a store motion pass is run after
11064 global common subexpression elimination. This pass attempts to move
11065 stores out of loops. When used in conjunction with @option{-fgcse-lm},
11066 loops containing a load/store sequence can be changed to a load before
11067 the loop and a store after the loop.
11069 Not enabled at any optimization level.
11073 When @option{-fgcse-las} is enabled, the global common subexpression
11074 elimination pass eliminates redundant loads that come after stores to the
11075 same memory location (both partial and full redundancies).
11077 Not enabled at any optimization level.
11079 @item -fgcse-after-reload
11080 @opindex fgcse-after-reload
11081 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
11082 pass is performed after reload. The purpose of this pass is to clean up
11083 redundant spilling.
11085 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
11087 @item -faggressive-loop-optimizations
11088 @opindex faggressive-loop-optimizations
11089 This option tells the loop optimizer to use language constraints to
11090 derive bounds for the number of iterations of a loop. This assumes that
11091 loop code does not invoke undefined behavior by for example causing signed
11092 integer overflows or out-of-bound array accesses. The bounds for the
11093 number of iterations of a loop are used to guide loop unrolling and peeling
11094 and loop exit test optimizations.
11095 This option is enabled by default.
11097 @item -funconstrained-commons
11098 @opindex funconstrained-commons
11099 This option tells the compiler that variables declared in common blocks
11100 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
11101 prevents certain optimizations that depend on knowing the array bounds.
11103 @item -fcrossjumping
11104 @opindex fcrossjumping
11105 Perform cross-jumping transformation.
11106 This transformation unifies equivalent code and saves code size. The
11107 resulting code may or may not perform better than without cross-jumping.
11109 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11111 @item -fauto-inc-dec
11112 @opindex fauto-inc-dec
11113 Combine increments or decrements of addresses with memory accesses.
11114 This pass is always skipped on architectures that do not have
11115 instructions to support this. Enabled by default at @option{-O1} and
11116 higher on architectures that support this.
11120 Perform dead code elimination (DCE) on RTL@.
11121 Enabled by default at @option{-O1} and higher.
11125 Perform dead store elimination (DSE) on RTL@.
11126 Enabled by default at @option{-O1} and higher.
11128 @item -fif-conversion
11129 @opindex fif-conversion
11130 Attempt to transform conditional jumps into branch-less equivalents. This
11131 includes use of conditional moves, min, max, set flags and abs instructions, and
11132 some tricks doable by standard arithmetics. The use of conditional execution
11133 on chips where it is available is controlled by @option{-fif-conversion2}.
11135 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
11136 not with @option{-Og}.
11138 @item -fif-conversion2
11139 @opindex fif-conversion2
11140 Use conditional execution (where available) to transform conditional jumps into
11141 branch-less equivalents.
11143 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
11144 not with @option{-Og}.
11146 @item -fdeclone-ctor-dtor
11147 @opindex fdeclone-ctor-dtor
11148 The C++ ABI requires multiple entry points for constructors and
11149 destructors: one for a base subobject, one for a complete object, and
11150 one for a virtual destructor that calls operator delete afterwards.
11151 For a hierarchy with virtual bases, the base and complete variants are
11152 clones, which means two copies of the function. With this option, the
11153 base and complete variants are changed to be thunks that call a common
11156 Enabled by @option{-Os}.
11158 @item -fdelete-null-pointer-checks
11159 @opindex fdelete-null-pointer-checks
11160 Assume that programs cannot safely dereference null pointers, and that
11161 no code or data element resides at address zero.
11162 This option enables simple constant
11163 folding optimizations at all optimization levels. In addition, other
11164 optimization passes in GCC use this flag to control global dataflow
11165 analyses that eliminate useless checks for null pointers; these assume
11166 that a memory access to address zero always results in a trap, so
11167 that if a pointer is checked after it has already been dereferenced,
11170 Note however that in some environments this assumption is not true.
11171 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
11172 for programs that depend on that behavior.
11174 This option is enabled by default on most targets. On Nios II ELF, it
11175 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
11177 Passes that use the dataflow information
11178 are enabled independently at different optimization levels.
11180 @item -fdevirtualize
11181 @opindex fdevirtualize
11182 Attempt to convert calls to virtual functions to direct calls. This
11183 is done both within a procedure and interprocedurally as part of
11184 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
11185 propagation (@option{-fipa-cp}).
11186 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11188 @item -fdevirtualize-speculatively
11189 @opindex fdevirtualize-speculatively
11190 Attempt to convert calls to virtual functions to speculative direct calls.
11191 Based on the analysis of the type inheritance graph, determine for a given call
11192 the set of likely targets. If the set is small, preferably of size 1, change
11193 the call into a conditional deciding between direct and indirect calls. The
11194 speculative calls enable more optimizations, such as inlining. When they seem
11195 useless after further optimization, they are converted back into original form.
11197 @item -fdevirtualize-at-ltrans
11198 @opindex fdevirtualize-at-ltrans
11199 Stream extra information needed for aggressive devirtualization when running
11200 the link-time optimizer in local transformation mode.
11201 This option enables more devirtualization but
11202 significantly increases the size of streamed data. For this reason it is
11203 disabled by default.
11205 @item -fexpensive-optimizations
11206 @opindex fexpensive-optimizations
11207 Perform a number of minor optimizations that are relatively expensive.
11209 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11213 Attempt to remove redundant extension instructions. This is especially
11214 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
11215 registers after writing to their lower 32-bit half.
11217 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
11218 @option{-O3}, @option{-Os}.
11220 @item -fno-lifetime-dse
11221 @opindex fno-lifetime-dse
11222 @opindex flifetime-dse
11223 In C++ the value of an object is only affected by changes within its
11224 lifetime: when the constructor begins, the object has an indeterminate
11225 value, and any changes during the lifetime of the object are dead when
11226 the object is destroyed. Normally dead store elimination will take
11227 advantage of this; if your code relies on the value of the object
11228 storage persisting beyond the lifetime of the object, you can use this
11229 flag to disable this optimization. To preserve stores before the
11230 constructor starts (e.g.@: because your operator new clears the object
11231 storage) but still treat the object as dead after the destructor, you
11232 can use @option{-flifetime-dse=1}. The default behavior can be
11233 explicitly selected with @option{-flifetime-dse=2}.
11234 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
11236 @item -flive-range-shrinkage
11237 @opindex flive-range-shrinkage
11238 Attempt to decrease register pressure through register live range
11239 shrinkage. This is helpful for fast processors with small or moderate
11240 size register sets.
11242 @item -fira-algorithm=@var{algorithm}
11243 @opindex fira-algorithm
11244 Use the specified coloring algorithm for the integrated register
11245 allocator. The @var{algorithm} argument can be @samp{priority}, which
11246 specifies Chow's priority coloring, or @samp{CB}, which specifies
11247 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
11248 for all architectures, but for those targets that do support it, it is
11249 the default because it generates better code.
11251 @item -fira-region=@var{region}
11252 @opindex fira-region
11253 Use specified regions for the integrated register allocator. The
11254 @var{region} argument should be one of the following:
11259 Use all loops as register allocation regions.
11260 This can give the best results for machines with a small and/or
11261 irregular register set.
11264 Use all loops except for loops with small register pressure
11265 as the regions. This value usually gives
11266 the best results in most cases and for most architectures,
11267 and is enabled by default when compiling with optimization for speed
11268 (@option{-O}, @option{-O2}, @dots{}).
11271 Use all functions as a single region.
11272 This typically results in the smallest code size, and is enabled by default for
11273 @option{-Os} or @option{-O0}.
11277 @item -fira-hoist-pressure
11278 @opindex fira-hoist-pressure
11279 Use IRA to evaluate register pressure in the code hoisting pass for
11280 decisions to hoist expressions. This option usually results in smaller
11281 code, but it can slow the compiler down.
11283 This option is enabled at level @option{-Os} for all targets.
11285 @item -fira-loop-pressure
11286 @opindex fira-loop-pressure
11287 Use IRA to evaluate register pressure in loops for decisions to move
11288 loop invariants. This option usually results in generation
11289 of faster and smaller code on machines with large register files (>= 32
11290 registers), but it can slow the compiler down.
11292 This option is enabled at level @option{-O3} for some targets.
11294 @item -fno-ira-share-save-slots
11295 @opindex fno-ira-share-save-slots
11296 @opindex fira-share-save-slots
11297 Disable sharing of stack slots used for saving call-used hard
11298 registers living through a call. Each hard register gets a
11299 separate stack slot, and as a result function stack frames are
11302 @item -fno-ira-share-spill-slots
11303 @opindex fno-ira-share-spill-slots
11304 @opindex fira-share-spill-slots
11305 Disable sharing of stack slots allocated for pseudo-registers. Each
11306 pseudo-register that does not get a hard register gets a separate
11307 stack slot, and as a result function stack frames are larger.
11310 @opindex flra-remat
11311 Enable CFG-sensitive rematerialization in LRA. Instead of loading
11312 values of spilled pseudos, LRA tries to rematerialize (recalculate)
11313 values if it is profitable.
11315 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11317 @item -fdelayed-branch
11318 @opindex fdelayed-branch
11319 If supported for the target machine, attempt to reorder instructions
11320 to exploit instruction slots available after delayed branch
11323 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
11324 but not at @option{-Og}.
11326 @item -fschedule-insns
11327 @opindex fschedule-insns
11328 If supported for the target machine, attempt to reorder instructions to
11329 eliminate execution stalls due to required data being unavailable. This
11330 helps machines that have slow floating point or memory load instructions
11331 by allowing other instructions to be issued until the result of the load
11332 or floating-point instruction is required.
11334 Enabled at levels @option{-O2}, @option{-O3}.
11336 @item -fschedule-insns2
11337 @opindex fschedule-insns2
11338 Similar to @option{-fschedule-insns}, but requests an additional pass of
11339 instruction scheduling after register allocation has been done. This is
11340 especially useful on machines with a relatively small number of
11341 registers and where memory load instructions take more than one cycle.
11343 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11345 @item -fno-sched-interblock
11346 @opindex fno-sched-interblock
11347 @opindex fsched-interblock
11348 Disable instruction scheduling across basic blocks, which
11349 is normally enabled when scheduling before register allocation, i.e.@:
11350 with @option{-fschedule-insns} or at @option{-O2} or higher.
11352 @item -fno-sched-spec
11353 @opindex fno-sched-spec
11354 @opindex fsched-spec
11355 Disable speculative motion of non-load instructions, which
11356 is normally enabled when scheduling before register allocation, i.e.@:
11357 with @option{-fschedule-insns} or at @option{-O2} or higher.
11359 @item -fsched-pressure
11360 @opindex fsched-pressure
11361 Enable register pressure sensitive insn scheduling before register
11362 allocation. This only makes sense when scheduling before register
11363 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
11364 @option{-O2} or higher. Usage of this option can improve the
11365 generated code and decrease its size by preventing register pressure
11366 increase above the number of available hard registers and subsequent
11367 spills in register allocation.
11369 @item -fsched-spec-load
11370 @opindex fsched-spec-load
11371 Allow speculative motion of some load instructions. This only makes
11372 sense when scheduling before register allocation, i.e.@: with
11373 @option{-fschedule-insns} or at @option{-O2} or higher.
11375 @item -fsched-spec-load-dangerous
11376 @opindex fsched-spec-load-dangerous
11377 Allow speculative motion of more load instructions. This only makes
11378 sense when scheduling before register allocation, i.e.@: with
11379 @option{-fschedule-insns} or at @option{-O2} or higher.
11381 @item -fsched-stalled-insns
11382 @itemx -fsched-stalled-insns=@var{n}
11383 @opindex fsched-stalled-insns
11384 Define how many insns (if any) can be moved prematurely from the queue
11385 of stalled insns into the ready list during the second scheduling pass.
11386 @option{-fno-sched-stalled-insns} means that no insns are moved
11387 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
11388 on how many queued insns can be moved prematurely.
11389 @option{-fsched-stalled-insns} without a value is equivalent to
11390 @option{-fsched-stalled-insns=1}.
11392 @item -fsched-stalled-insns-dep
11393 @itemx -fsched-stalled-insns-dep=@var{n}
11394 @opindex fsched-stalled-insns-dep
11395 Define how many insn groups (cycles) are examined for a dependency
11396 on a stalled insn that is a candidate for premature removal from the queue
11397 of stalled insns. This has an effect only during the second scheduling pass,
11398 and only if @option{-fsched-stalled-insns} is used.
11399 @option{-fno-sched-stalled-insns-dep} is equivalent to
11400 @option{-fsched-stalled-insns-dep=0}.
11401 @option{-fsched-stalled-insns-dep} without a value is equivalent to
11402 @option{-fsched-stalled-insns-dep=1}.
11404 @item -fsched2-use-superblocks
11405 @opindex fsched2-use-superblocks
11406 When scheduling after register allocation, use superblock scheduling.
11407 This allows motion across basic block boundaries,
11408 resulting in faster schedules. This option is experimental, as not all machine
11409 descriptions used by GCC model the CPU closely enough to avoid unreliable
11410 results from the algorithm.
11412 This only makes sense when scheduling after register allocation, i.e.@: with
11413 @option{-fschedule-insns2} or at @option{-O2} or higher.
11415 @item -fsched-group-heuristic
11416 @opindex fsched-group-heuristic
11417 Enable the group heuristic in the scheduler. This heuristic favors
11418 the instruction that belongs to a schedule group. This is enabled
11419 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11420 or @option{-fschedule-insns2} or at @option{-O2} or higher.
11422 @item -fsched-critical-path-heuristic
11423 @opindex fsched-critical-path-heuristic
11424 Enable the critical-path heuristic in the scheduler. This heuristic favors
11425 instructions on the critical path. This is enabled by default when
11426 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11427 or @option{-fschedule-insns2} or at @option{-O2} or higher.
11429 @item -fsched-spec-insn-heuristic
11430 @opindex fsched-spec-insn-heuristic
11431 Enable the speculative instruction heuristic in the scheduler. This
11432 heuristic favors speculative instructions with greater dependency weakness.
11433 This is enabled by default when scheduling is enabled, i.e.@:
11434 with @option{-fschedule-insns} or @option{-fschedule-insns2}
11435 or at @option{-O2} or higher.
11437 @item -fsched-rank-heuristic
11438 @opindex fsched-rank-heuristic
11439 Enable the rank heuristic in the scheduler. This heuristic favors
11440 the instruction belonging to a basic block with greater size or frequency.
11441 This is enabled by default when scheduling is enabled, i.e.@:
11442 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11443 at @option{-O2} or higher.
11445 @item -fsched-last-insn-heuristic
11446 @opindex fsched-last-insn-heuristic
11447 Enable the last-instruction heuristic in the scheduler. This heuristic
11448 favors the instruction that is less dependent on the last instruction
11449 scheduled. This is enabled by default when scheduling is enabled,
11450 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11451 at @option{-O2} or higher.
11453 @item -fsched-dep-count-heuristic
11454 @opindex fsched-dep-count-heuristic
11455 Enable the dependent-count heuristic in the scheduler. This heuristic
11456 favors the instruction that has more instructions depending on it.
11457 This is enabled by default when scheduling is enabled, i.e.@:
11458 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11459 at @option{-O2} or higher.
11461 @item -freschedule-modulo-scheduled-loops
11462 @opindex freschedule-modulo-scheduled-loops
11463 Modulo scheduling is performed before traditional scheduling. If a loop
11464 is modulo scheduled, later scheduling passes may change its schedule.
11465 Use this option to control that behavior.
11467 @item -fselective-scheduling
11468 @opindex fselective-scheduling
11469 Schedule instructions using selective scheduling algorithm. Selective
11470 scheduling runs instead of the first scheduler pass.
11472 @item -fselective-scheduling2
11473 @opindex fselective-scheduling2
11474 Schedule instructions using selective scheduling algorithm. Selective
11475 scheduling runs instead of the second scheduler pass.
11477 @item -fsel-sched-pipelining
11478 @opindex fsel-sched-pipelining
11479 Enable software pipelining of innermost loops during selective scheduling.
11480 This option has no effect unless one of @option{-fselective-scheduling} or
11481 @option{-fselective-scheduling2} is turned on.
11483 @item -fsel-sched-pipelining-outer-loops
11484 @opindex fsel-sched-pipelining-outer-loops
11485 When pipelining loops during selective scheduling, also pipeline outer loops.
11486 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
11488 @item -fsemantic-interposition
11489 @opindex fsemantic-interposition
11490 Some object formats, like ELF, allow interposing of symbols by the
11492 This means that for symbols exported from the DSO, the compiler cannot perform
11493 interprocedural propagation, inlining and other optimizations in anticipation
11494 that the function or variable in question may change. While this feature is
11495 useful, for example, to rewrite memory allocation functions by a debugging
11496 implementation, it is expensive in the terms of code quality.
11497 With @option{-fno-semantic-interposition} the compiler assumes that
11498 if interposition happens for functions the overwriting function will have
11499 precisely the same semantics (and side effects).
11500 Similarly if interposition happens
11501 for variables, the constructor of the variable will be the same. The flag
11502 has no effect for functions explicitly declared inline
11503 (where it is never allowed for interposition to change semantics)
11504 and for symbols explicitly declared weak.
11506 @item -fshrink-wrap
11507 @opindex fshrink-wrap
11508 Emit function prologues only before parts of the function that need it,
11509 rather than at the top of the function. This flag is enabled by default at
11510 @option{-O} and higher.
11512 @item -fshrink-wrap-separate
11513 @opindex fshrink-wrap-separate
11514 Shrink-wrap separate parts of the prologue and epilogue separately, so that
11515 those parts are only executed when needed.
11516 This option is on by default, but has no effect unless @option{-fshrink-wrap}
11517 is also turned on and the target supports this.
11519 @item -fcaller-saves
11520 @opindex fcaller-saves
11521 Enable allocation of values to registers that are clobbered by
11522 function calls, by emitting extra instructions to save and restore the
11523 registers around such calls. Such allocation is done only when it
11524 seems to result in better code.
11526 This option is always enabled by default on certain machines, usually
11527 those which have no call-preserved registers to use instead.
11529 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11531 @item -fcombine-stack-adjustments
11532 @opindex fcombine-stack-adjustments
11533 Tracks stack adjustments (pushes and pops) and stack memory references
11534 and then tries to find ways to combine them.
11536 Enabled by default at @option{-O1} and higher.
11540 Use caller save registers for allocation if those registers are not used by
11541 any called function. In that case it is not necessary to save and restore
11542 them around calls. This is only possible if called functions are part of
11543 same compilation unit as current function and they are compiled before it.
11545 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
11546 is disabled if generated code will be instrumented for profiling
11547 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
11548 exactly (this happens on targets that do not expose prologues
11549 and epilogues in RTL).
11551 @item -fconserve-stack
11552 @opindex fconserve-stack
11553 Attempt to minimize stack usage. The compiler attempts to use less
11554 stack space, even if that makes the program slower. This option
11555 implies setting the @option{large-stack-frame} parameter to 100
11556 and the @option{large-stack-frame-growth} parameter to 400.
11558 @item -ftree-reassoc
11559 @opindex ftree-reassoc
11560 Perform reassociation on trees. This flag is enabled by default
11561 at @option{-O1} and higher.
11563 @item -fcode-hoisting
11564 @opindex fcode-hoisting
11565 Perform code hoisting. Code hoisting tries to move the
11566 evaluation of expressions executed on all paths to the function exit
11567 as early as possible. This is especially useful as a code size
11568 optimization, but it often helps for code speed as well.
11569 This flag is enabled by default at @option{-O2} and higher.
11573 Perform partial redundancy elimination (PRE) on trees. This flag is
11574 enabled by default at @option{-O2} and @option{-O3}.
11576 @item -ftree-partial-pre
11577 @opindex ftree-partial-pre
11578 Make partial redundancy elimination (PRE) more aggressive. This flag is
11579 enabled by default at @option{-O3}.
11581 @item -ftree-forwprop
11582 @opindex ftree-forwprop
11583 Perform forward propagation on trees. This flag is enabled by default
11584 at @option{-O1} and higher.
11588 Perform full redundancy elimination (FRE) on trees. The difference
11589 between FRE and PRE is that FRE only considers expressions
11590 that are computed on all paths leading to the redundant computation.
11591 This analysis is faster than PRE, though it exposes fewer redundancies.
11592 This flag is enabled by default at @option{-O1} and higher.
11594 @item -ftree-phiprop
11595 @opindex ftree-phiprop
11596 Perform hoisting of loads from conditional pointers on trees. This
11597 pass is enabled by default at @option{-O1} and higher.
11599 @item -fhoist-adjacent-loads
11600 @opindex fhoist-adjacent-loads
11601 Speculatively hoist loads from both branches of an if-then-else if the
11602 loads are from adjacent locations in the same structure and the target
11603 architecture has a conditional move instruction. This flag is enabled
11604 by default at @option{-O2} and higher.
11606 @item -ftree-copy-prop
11607 @opindex ftree-copy-prop
11608 Perform copy propagation on trees. This pass eliminates unnecessary
11609 copy operations. This flag is enabled by default at @option{-O1} and
11612 @item -fipa-pure-const
11613 @opindex fipa-pure-const
11614 Discover which functions are pure or constant.
11615 Enabled by default at @option{-O1} and higher.
11617 @item -fipa-reference
11618 @opindex fipa-reference
11619 Discover which static variables do not escape the
11621 Enabled by default at @option{-O1} and higher.
11623 @item -fipa-reference-addressable
11624 @opindex fipa-reference-addressable
11625 Discover read-only, write-only and non-addressable static variables.
11626 Enabled by default at @option{-O1} and higher.
11628 @item -fipa-stack-alignment
11629 @opindex fipa-stack-alignment
11630 Reduce stack alignment on call sites if possible.
11631 Enabled by default.
11635 Perform interprocedural pointer analysis and interprocedural modification
11636 and reference analysis. This option can cause excessive memory and
11637 compile-time usage on large compilation units. It is not enabled by
11638 default at any optimization level.
11640 @item -fipa-profile
11641 @opindex fipa-profile
11642 Perform interprocedural profile propagation. The functions called only from
11643 cold functions are marked as cold. Also functions executed once (such as
11644 @code{cold}, @code{noreturn}, static constructors or destructors) are
11645 identified. Cold functions and loop less parts of functions executed once are
11646 then optimized for size.
11647 Enabled by default at @option{-O1} and higher.
11650 @opindex fipa-modref
11651 Perform interprocedural mod/ref analysis. This optimization analyzes the side
11652 effects of functions (memory locations that are modified or referenced) and
11653 enables better optimization across the function call boundary. This flag is
11654 enabled by default at @option{-O1} and higher.
11658 Perform interprocedural constant propagation.
11659 This optimization analyzes the program to determine when values passed
11660 to functions are constants and then optimizes accordingly.
11661 This optimization can substantially increase performance
11662 if the application has constants passed to functions.
11663 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
11664 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11666 @item -fipa-cp-clone
11667 @opindex fipa-cp-clone
11668 Perform function cloning to make interprocedural constant propagation stronger.
11669 When enabled, interprocedural constant propagation performs function cloning
11670 when externally visible function can be called with constant arguments.
11671 Because this optimization can create multiple copies of functions,
11672 it may significantly increase code size
11673 (see @option{--param ipa-cp-unit-growth=@var{value}}).
11674 This flag is enabled by default at @option{-O3}.
11675 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11678 @opindex fipa-bit-cp
11679 When enabled, perform interprocedural bitwise constant
11680 propagation. This flag is enabled by default at @option{-O2} and
11681 by @option{-fprofile-use} and @option{-fauto-profile}.
11682 It requires that @option{-fipa-cp} is enabled.
11686 When enabled, perform interprocedural propagation of value
11687 ranges. This flag is enabled by default at @option{-O2}. It requires
11688 that @option{-fipa-cp} is enabled.
11692 Perform Identical Code Folding for functions and read-only variables.
11693 The optimization reduces code size and may disturb unwind stacks by replacing
11694 a function by equivalent one with a different name. The optimization works
11695 more effectively with link-time optimization enabled.
11697 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
11698 works on different levels and thus the optimizations are not same - there are
11699 equivalences that are found only by GCC and equivalences found only by Gold.
11701 This flag is enabled by default at @option{-O2} and @option{-Os}.
11703 @item -flive-patching=@var{level}
11704 @opindex flive-patching
11705 Control GCC's optimizations to produce output suitable for live-patching.
11707 If the compiler's optimization uses a function's body or information extracted
11708 from its body to optimize/change another function, the latter is called an
11709 impacted function of the former. If a function is patched, its impacted
11710 functions should be patched too.
11712 The impacted functions are determined by the compiler's interprocedural
11713 optimizations. For example, a caller is impacted when inlining a function
11715 cloning a function and changing its caller to call this new clone,
11716 or extracting a function's pureness/constness information to optimize
11717 its direct or indirect callers, etc.
11719 Usually, the more IPA optimizations enabled, the larger the number of
11720 impacted functions for each function. In order to control the number of
11721 impacted functions and more easily compute the list of impacted function,
11722 IPA optimizations can be partially enabled at two different levels.
11724 The @var{level} argument should be one of the following:
11730 Only enable inlining and cloning optimizations, which includes inlining,
11731 cloning, interprocedural scalar replacement of aggregates and partial inlining.
11732 As a result, when patching a function, all its callers and its clones'
11733 callers are impacted, therefore need to be patched as well.
11735 @option{-flive-patching=inline-clone} disables the following optimization flags:
11736 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
11737 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
11738 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
11739 -fipa-stack-alignment -fipa-modref}
11741 @item inline-only-static
11743 Only enable inlining of static functions.
11744 As a result, when patching a static function, all its callers are impacted
11745 and so need to be patched as well.
11747 In addition to all the flags that @option{-flive-patching=inline-clone}
11749 @option{-flive-patching=inline-only-static} disables the following additional
11750 optimization flags:
11751 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
11755 When @option{-flive-patching} is specified without any value, the default value
11756 is @var{inline-clone}.
11758 This flag is disabled by default.
11760 Note that @option{-flive-patching} is not supported with link-time optimization
11763 @item -fisolate-erroneous-paths-dereference
11764 @opindex fisolate-erroneous-paths-dereference
11765 Detect paths that trigger erroneous or undefined behavior due to
11766 dereferencing a null pointer. Isolate those paths from the main control
11767 flow and turn the statement with erroneous or undefined behavior into a trap.
11768 This flag is enabled by default at @option{-O2} and higher and depends on
11769 @option{-fdelete-null-pointer-checks} also being enabled.
11771 @item -fisolate-erroneous-paths-attribute
11772 @opindex fisolate-erroneous-paths-attribute
11773 Detect paths that trigger erroneous or undefined behavior due to a null value
11774 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
11775 attribute. Isolate those paths from the main control flow and turn the
11776 statement with erroneous or undefined behavior into a trap. This is not
11777 currently enabled, but may be enabled by @option{-O2} in the future.
11780 @opindex ftree-sink
11781 Perform forward store motion on trees. This flag is
11782 enabled by default at @option{-O1} and higher.
11784 @item -ftree-bit-ccp
11785 @opindex ftree-bit-ccp
11786 Perform sparse conditional bit constant propagation on trees and propagate
11787 pointer alignment information.
11788 This pass only operates on local scalar variables and is enabled by default
11789 at @option{-O1} and higher, except for @option{-Og}.
11790 It requires that @option{-ftree-ccp} is enabled.
11794 Perform sparse conditional constant propagation (CCP) on trees. This
11795 pass only operates on local scalar variables and is enabled by default
11796 at @option{-O1} and higher.
11798 @item -fssa-backprop
11799 @opindex fssa-backprop
11800 Propagate information about uses of a value up the definition chain
11801 in order to simplify the definitions. For example, this pass strips
11802 sign operations if the sign of a value never matters. The flag is
11803 enabled by default at @option{-O1} and higher.
11806 @opindex fssa-phiopt
11807 Perform pattern matching on SSA PHI nodes to optimize conditional
11808 code. This pass is enabled by default at @option{-O1} and higher,
11809 except for @option{-Og}.
11811 @item -ftree-switch-conversion
11812 @opindex ftree-switch-conversion
11813 Perform conversion of simple initializations in a switch to
11814 initializations from a scalar array. This flag is enabled by default
11815 at @option{-O2} and higher.
11817 @item -ftree-tail-merge
11818 @opindex ftree-tail-merge
11819 Look for identical code sequences. When found, replace one with a jump to the
11820 other. This optimization is known as tail merging or cross jumping. This flag
11821 is enabled by default at @option{-O2} and higher. The compilation time
11823 be limited using @option{max-tail-merge-comparisons} parameter and
11824 @option{max-tail-merge-iterations} parameter.
11828 Perform dead code elimination (DCE) on trees. This flag is enabled by
11829 default at @option{-O1} and higher.
11831 @item -ftree-builtin-call-dce
11832 @opindex ftree-builtin-call-dce
11833 Perform conditional dead code elimination (DCE) for calls to built-in functions
11834 that may set @code{errno} but are otherwise free of side effects. This flag is
11835 enabled by default at @option{-O2} and higher if @option{-Os} is not also
11838 @item -ffinite-loops
11839 @opindex ffinite-loops
11840 @opindex fno-finite-loops
11841 Assume that a loop with an exit will eventually take the exit and not loop
11842 indefinitely. This allows the compiler to remove loops that otherwise have
11843 no side-effects, not considering eventual endless looping as such.
11845 This option is enabled by default at @option{-O2} for C++ with -std=c++11
11848 @item -ftree-dominator-opts
11849 @opindex ftree-dominator-opts
11850 Perform a variety of simple scalar cleanups (constant/copy
11851 propagation, redundancy elimination, range propagation and expression
11852 simplification) based on a dominator tree traversal. This also
11853 performs jump threading (to reduce jumps to jumps). This flag is
11854 enabled by default at @option{-O1} and higher.
11858 Perform dead store elimination (DSE) on trees. A dead store is a store into
11859 a memory location that is later overwritten by another store without
11860 any intervening loads. In this case the earlier store can be deleted. This
11861 flag is enabled by default at @option{-O1} and higher.
11865 Perform loop header copying on trees. This is beneficial since it increases
11866 effectiveness of code motion optimizations. It also saves one jump. This flag
11867 is enabled by default at @option{-O1} and higher. It is not enabled
11868 for @option{-Os}, since it usually increases code size.
11870 @item -ftree-loop-optimize
11871 @opindex ftree-loop-optimize
11872 Perform loop optimizations on trees. This flag is enabled by default
11873 at @option{-O1} and higher.
11875 @item -ftree-loop-linear
11876 @itemx -floop-strip-mine
11877 @itemx -floop-block
11878 @opindex ftree-loop-linear
11879 @opindex floop-strip-mine
11880 @opindex floop-block
11881 Perform loop nest optimizations. Same as
11882 @option{-floop-nest-optimize}. To use this code transformation, GCC has
11883 to be configured with @option{--with-isl} to enable the Graphite loop
11884 transformation infrastructure.
11886 @item -fgraphite-identity
11887 @opindex fgraphite-identity
11888 Enable the identity transformation for graphite. For every SCoP we generate
11889 the polyhedral representation and transform it back to gimple. Using
11890 @option{-fgraphite-identity} we can check the costs or benefits of the
11891 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
11892 are also performed by the code generator isl, like index splitting and
11893 dead code elimination in loops.
11895 @item -floop-nest-optimize
11896 @opindex floop-nest-optimize
11897 Enable the isl based loop nest optimizer. This is a generic loop nest
11898 optimizer based on the Pluto optimization algorithms. It calculates a loop
11899 structure optimized for data-locality and parallelism. This option
11902 @item -floop-parallelize-all
11903 @opindex floop-parallelize-all
11904 Use the Graphite data dependence analysis to identify loops that can
11905 be parallelized. Parallelize all the loops that can be analyzed to
11906 not contain loop carried dependences without checking that it is
11907 profitable to parallelize the loops.
11909 @item -ftree-coalesce-vars
11910 @opindex ftree-coalesce-vars
11911 While transforming the program out of the SSA representation, attempt to
11912 reduce copying by coalescing versions of different user-defined
11913 variables, instead of just compiler temporaries. This may severely
11914 limit the ability to debug an optimized program compiled with
11915 @option{-fno-var-tracking-assignments}. In the negated form, this flag
11916 prevents SSA coalescing of user variables. This option is enabled by
11917 default if optimization is enabled, and it does very little otherwise.
11919 @item -ftree-loop-if-convert
11920 @opindex ftree-loop-if-convert
11921 Attempt to transform conditional jumps in the innermost loops to
11922 branch-less equivalents. The intent is to remove control-flow from
11923 the innermost loops in order to improve the ability of the
11924 vectorization pass to handle these loops. This is enabled by default
11925 if vectorization is enabled.
11927 @item -ftree-loop-distribution
11928 @opindex ftree-loop-distribution
11929 Perform loop distribution. This flag can improve cache performance on
11930 big loop bodies and allow further loop optimizations, like
11931 parallelization or vectorization, to take place. For example, the loop
11947 This flag is enabled by default at @option{-O3}.
11948 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11950 @item -ftree-loop-distribute-patterns
11951 @opindex ftree-loop-distribute-patterns
11952 Perform loop distribution of patterns that can be code generated with
11953 calls to a library. This flag is enabled by default at @option{-O2} and
11954 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
11956 This pass distributes the initialization loops and generates a call to
11957 memset zero. For example, the loop
11973 and the initialization loop is transformed into a call to memset zero.
11974 This flag is enabled by default at @option{-O3}.
11975 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11977 @item -floop-interchange
11978 @opindex floop-interchange
11979 Perform loop interchange outside of graphite. This flag can improve cache
11980 performance on loop nest and allow further loop optimizations, like
11981 vectorization, to take place. For example, the loop
11983 for (int i = 0; i < N; i++)
11984 for (int j = 0; j < N; j++)
11985 for (int k = 0; k < N; k++)
11986 c[i][j] = c[i][j] + a[i][k]*b[k][j];
11990 for (int i = 0; i < N; i++)
11991 for (int k = 0; k < N; k++)
11992 for (int j = 0; j < N; j++)
11993 c[i][j] = c[i][j] + a[i][k]*b[k][j];
11995 This flag is enabled by default at @option{-O3}.
11996 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11998 @item -floop-unroll-and-jam
11999 @opindex floop-unroll-and-jam
12000 Apply unroll and jam transformations on feasible loops. In a loop
12001 nest this unrolls the outer loop by some factor and fuses the resulting
12002 multiple inner loops. This flag is enabled by default at @option{-O3}.
12003 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12005 @item -ftree-loop-im
12006 @opindex ftree-loop-im
12007 Perform loop invariant motion on trees. This pass moves only invariants that
12008 are hard to handle at RTL level (function calls, operations that expand to
12009 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
12010 operands of conditions that are invariant out of the loop, so that we can use
12011 just trivial invariantness analysis in loop unswitching. The pass also includes
12014 @item -ftree-loop-ivcanon
12015 @opindex ftree-loop-ivcanon
12016 Create a canonical counter for number of iterations in loops for which
12017 determining number of iterations requires complicated analysis. Later
12018 optimizations then may determine the number easily. Useful especially
12019 in connection with unrolling.
12021 @item -ftree-scev-cprop
12022 @opindex ftree-scev-cprop
12023 Perform final value replacement. If a variable is modified in a loop
12024 in such a way that its value when exiting the loop can be determined using
12025 only its initial value and the number of loop iterations, replace uses of
12026 the final value by such a computation, provided it is sufficiently cheap.
12027 This reduces data dependencies and may allow further simplifications.
12028 Enabled by default at @option{-O1} and higher.
12032 Perform induction variable optimizations (strength reduction, induction
12033 variable merging and induction variable elimination) on trees.
12035 @item -ftree-parallelize-loops=n
12036 @opindex ftree-parallelize-loops
12037 Parallelize loops, i.e., split their iteration space to run in n threads.
12038 This is only possible for loops whose iterations are independent
12039 and can be arbitrarily reordered. The optimization is only
12040 profitable on multiprocessor machines, for loops that are CPU-intensive,
12041 rather than constrained e.g.@: by memory bandwidth. This option
12042 implies @option{-pthread}, and thus is only supported on targets
12043 that have support for @option{-pthread}.
12047 Perform function-local points-to analysis on trees. This flag is
12048 enabled by default at @option{-O1} and higher, except for @option{-Og}.
12052 Perform scalar replacement of aggregates. This pass replaces structure
12053 references with scalars to prevent committing structures to memory too
12054 early. This flag is enabled by default at @option{-O1} and higher,
12055 except for @option{-Og}.
12057 @item -fstore-merging
12058 @opindex fstore-merging
12059 Perform merging of narrow stores to consecutive memory addresses. This pass
12060 merges contiguous stores of immediate values narrower than a word into fewer
12061 wider stores to reduce the number of instructions. This is enabled by default
12062 at @option{-O2} and higher as well as @option{-Os}.
12066 Perform temporary expression replacement during the SSA->normal phase. Single
12067 use/single def temporaries are replaced at their use location with their
12068 defining expression. This results in non-GIMPLE code, but gives the expanders
12069 much more complex trees to work on resulting in better RTL generation. This is
12070 enabled by default at @option{-O1} and higher.
12073 @opindex ftree-slsr
12074 Perform straight-line strength reduction on trees. This recognizes related
12075 expressions involving multiplications and replaces them by less expensive
12076 calculations when possible. This is enabled by default at @option{-O1} and
12079 @item -ftree-vectorize
12080 @opindex ftree-vectorize
12081 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
12082 and @option{-ftree-slp-vectorize} if not explicitly specified.
12084 @item -ftree-loop-vectorize
12085 @opindex ftree-loop-vectorize
12086 Perform loop vectorization on trees. This flag is enabled by default at
12087 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
12088 and @option{-fauto-profile}.
12090 @item -ftree-slp-vectorize
12091 @opindex ftree-slp-vectorize
12092 Perform basic block vectorization on trees. This flag is enabled by default at
12093 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
12094 and @option{-fauto-profile}.
12096 @item -ftrivial-auto-var-init=@var{choice}
12097 @opindex ftrivial-auto-var-init
12098 Initialize automatic variables with either a pattern or with zeroes to increase
12099 the security and predictability of a program by preventing uninitialized memory
12100 disclosure and use.
12101 GCC still considers an automatic variable that doesn't have an explicit
12102 initializer as uninitialized, -Wuninitialized will still report warning messages
12103 on such automatic variables.
12104 With this option, GCC will also initialize any padding of automatic variables
12105 that have structure or union types to zeroes.
12107 The three values of @var{choice} are:
12111 @samp{uninitialized} doesn't initialize any automatic variables.
12112 This is C and C++'s default.
12115 @samp{pattern} Initialize automatic variables with values which will likely
12116 transform logic bugs into crashes down the line, are easily recognized in a
12117 crash dump and without being values that programmers can rely on for useful
12119 The current value is byte-repeatable pattern with byte "0xFE".
12120 The values used for pattern initialization might be changed in the future.
12123 @samp{zero} Initialize automatic variables with zeroes.
12126 The default is @samp{uninitialized}.
12128 You can control this behavior for a specific variable by using the variable
12129 attribute @code{uninitialized} (@pxref{Variable Attributes}).
12131 @item -fvect-cost-model=@var{model}
12132 @opindex fvect-cost-model
12133 Alter the cost model used for vectorization. The @var{model} argument
12134 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
12136 With the @samp{unlimited} model the vectorized code-path is assumed
12137 to be profitable while with the @samp{dynamic} model a runtime check
12138 guards the vectorized code-path to enable it only for iteration
12139 counts that will likely execute faster than when executing the original
12140 scalar loop. The @samp{cheap} model disables vectorization of
12141 loops where doing so would be cost prohibitive for example due to
12142 required runtime checks for data dependence or alignment but otherwise
12143 is equal to the @samp{dynamic} model. The @samp{very-cheap} model only
12144 allows vectorization if the vector code would entirely replace the
12145 scalar code that is being vectorized. For example, if each iteration
12146 of a vectorized loop would only be able to handle exactly four iterations
12147 of the scalar loop, the @samp{very-cheap} model would only allow
12148 vectorization if the scalar iteration count is known to be a multiple
12151 The default cost model depends on other optimization flags and is
12152 either @samp{dynamic} or @samp{cheap}.
12154 @item -fsimd-cost-model=@var{model}
12155 @opindex fsimd-cost-model
12156 Alter the cost model used for vectorization of loops marked with the OpenMP
12157 simd directive. The @var{model} argument should be one of
12158 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
12159 have the same meaning as described in @option{-fvect-cost-model} and by
12160 default a cost model defined with @option{-fvect-cost-model} is used.
12164 Perform Value Range Propagation on trees. This is similar to the
12165 constant propagation pass, but instead of values, ranges of values are
12166 propagated. This allows the optimizers to remove unnecessary range
12167 checks like array bound checks and null pointer checks. This is
12168 enabled by default at @option{-O2} and higher. Null pointer check
12169 elimination is only done if @option{-fdelete-null-pointer-checks} is
12172 @item -fsplit-paths
12173 @opindex fsplit-paths
12174 Split paths leading to loop backedges. This can improve dead code
12175 elimination and common subexpression elimination. This is enabled by
12176 default at @option{-O3} and above.
12178 @item -fsplit-ivs-in-unroller
12179 @opindex fsplit-ivs-in-unroller
12180 Enables expression of values of induction variables in later iterations
12181 of the unrolled loop using the value in the first iteration. This breaks
12182 long dependency chains, thus improving efficiency of the scheduling passes.
12184 A combination of @option{-fweb} and CSE is often sufficient to obtain the
12185 same effect. However, that is not reliable in cases where the loop body
12186 is more complicated than a single basic block. It also does not work at all
12187 on some architectures due to restrictions in the CSE pass.
12189 This optimization is enabled by default.
12191 @item -fvariable-expansion-in-unroller
12192 @opindex fvariable-expansion-in-unroller
12193 With this option, the compiler creates multiple copies of some
12194 local variables when unrolling a loop, which can result in superior code.
12196 This optimization is enabled by default for PowerPC targets, but disabled
12197 by default otherwise.
12199 @item -fpartial-inlining
12200 @opindex fpartial-inlining
12201 Inline parts of functions. This option has any effect only
12202 when inlining itself is turned on by the @option{-finline-functions}
12203 or @option{-finline-small-functions} options.
12205 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12207 @item -fpredictive-commoning
12208 @opindex fpredictive-commoning
12209 Perform predictive commoning optimization, i.e., reusing computations
12210 (especially memory loads and stores) performed in previous
12211 iterations of loops.
12213 This option is enabled at level @option{-O3}.
12214 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12216 @item -fprefetch-loop-arrays
12217 @opindex fprefetch-loop-arrays
12218 If supported by the target machine, generate instructions to prefetch
12219 memory to improve the performance of loops that access large arrays.
12221 This option may generate better or worse code; results are highly
12222 dependent on the structure of loops within the source code.
12224 Disabled at level @option{-Os}.
12226 @item -fno-printf-return-value
12227 @opindex fno-printf-return-value
12228 @opindex fprintf-return-value
12229 Do not substitute constants for known return value of formatted output
12230 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
12231 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
12232 transformation allows GCC to optimize or even eliminate branches based
12233 on the known return value of these functions called with arguments that
12234 are either constant, or whose values are known to be in a range that
12235 makes determining the exact return value possible. For example, when
12236 @option{-fprintf-return-value} is in effect, both the branch and the
12237 body of the @code{if} statement (but not the call to @code{snprint})
12238 can be optimized away when @code{i} is a 32-bit or smaller integer
12239 because the return value is guaranteed to be at most 8.
12243 if (snprintf (buf, "%08x", i) >= sizeof buf)
12247 The @option{-fprintf-return-value} option relies on other optimizations
12248 and yields best results with @option{-O2} and above. It works in tandem
12249 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
12250 options. The @option{-fprintf-return-value} option is enabled by default.
12252 @item -fno-peephole
12253 @itemx -fno-peephole2
12254 @opindex fno-peephole
12256 @opindex fno-peephole2
12257 @opindex fpeephole2
12258 Disable any machine-specific peephole optimizations. The difference
12259 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
12260 are implemented in the compiler; some targets use one, some use the
12261 other, a few use both.
12263 @option{-fpeephole} is enabled by default.
12264 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12266 @item -fno-guess-branch-probability
12267 @opindex fno-guess-branch-probability
12268 @opindex fguess-branch-probability
12269 Do not guess branch probabilities using heuristics.
12271 GCC uses heuristics to guess branch probabilities if they are
12272 not provided by profiling feedback (@option{-fprofile-arcs}). These
12273 heuristics are based on the control flow graph. If some branch probabilities
12274 are specified by @code{__builtin_expect}, then the heuristics are
12275 used to guess branch probabilities for the rest of the control flow graph,
12276 taking the @code{__builtin_expect} info into account. The interactions
12277 between the heuristics and @code{__builtin_expect} can be complex, and in
12278 some cases, it may be useful to disable the heuristics so that the effects
12279 of @code{__builtin_expect} are easier to understand.
12281 It is also possible to specify expected probability of the expression
12282 with @code{__builtin_expect_with_probability} built-in function.
12284 The default is @option{-fguess-branch-probability} at levels
12285 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12287 @item -freorder-blocks
12288 @opindex freorder-blocks
12289 Reorder basic blocks in the compiled function in order to reduce number of
12290 taken branches and improve code locality.
12292 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12294 @item -freorder-blocks-algorithm=@var{algorithm}
12295 @opindex freorder-blocks-algorithm
12296 Use the specified algorithm for basic block reordering. The
12297 @var{algorithm} argument can be @samp{simple}, which does not increase
12298 code size (except sometimes due to secondary effects like alignment),
12299 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
12300 put all often executed code together, minimizing the number of branches
12301 executed by making extra copies of code.
12303 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
12304 @samp{stc} at levels @option{-O2}, @option{-O3}.
12306 @item -freorder-blocks-and-partition
12307 @opindex freorder-blocks-and-partition
12308 In addition to reordering basic blocks in the compiled function, in order
12309 to reduce number of taken branches, partitions hot and cold basic blocks
12310 into separate sections of the assembly and @file{.o} files, to improve
12311 paging and cache locality performance.
12313 This optimization is automatically turned off in the presence of
12314 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
12315 section attribute and on any architecture that does not support named
12316 sections. When @option{-fsplit-stack} is used this option is not
12317 enabled by default (to avoid linker errors), but may be enabled
12318 explicitly (if using a working linker).
12320 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
12322 @item -freorder-functions
12323 @opindex freorder-functions
12324 Reorder functions in the object file in order to
12325 improve code locality. This is implemented by using special
12326 subsections @code{.text.hot} for most frequently executed functions and
12327 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
12328 the linker so object file format must support named sections and linker must
12329 place them in a reasonable way.
12331 This option isn't effective unless you either provide profile feedback
12332 (see @option{-fprofile-arcs} for details) or manually annotate functions with
12333 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
12335 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12337 @item -fstrict-aliasing
12338 @opindex fstrict-aliasing
12339 Allow the compiler to assume the strictest aliasing rules applicable to
12340 the language being compiled. For C (and C++), this activates
12341 optimizations based on the type of expressions. In particular, an
12342 object of one type is assumed never to reside at the same address as an
12343 object of a different type, unless the types are almost the same. For
12344 example, an @code{unsigned int} can alias an @code{int}, but not a
12345 @code{void*} or a @code{double}. A character type may alias any other
12348 @anchor{Type-punning}Pay special attention to code like this:
12361 The practice of reading from a different union member than the one most
12362 recently written to (called ``type-punning'') is common. Even with
12363 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
12364 is accessed through the union type. So, the code above works as
12365 expected. @xref{Structures unions enumerations and bit-fields
12366 implementation}. However, this code might not:
12377 Similarly, access by taking the address, casting the resulting pointer
12378 and dereferencing the result has undefined behavior, even if the cast
12379 uses a union type, e.g.:
12383 return ((union a_union *) &d)->i;
12387 The @option{-fstrict-aliasing} option is enabled at levels
12388 @option{-O2}, @option{-O3}, @option{-Os}.
12390 @item -falign-functions
12391 @itemx -falign-functions=@var{n}
12392 @itemx -falign-functions=@var{n}:@var{m}
12393 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
12394 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
12395 @opindex falign-functions
12396 Align the start of functions to the next power-of-two greater than or
12397 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
12398 least the first @var{m} bytes of the function can be fetched by the CPU
12399 without crossing an @var{n}-byte alignment boundary.
12401 If @var{m} is not specified, it defaults to @var{n}.
12403 Examples: @option{-falign-functions=32} aligns functions to the next
12404 32-byte boundary, @option{-falign-functions=24} aligns to the next
12405 32-byte boundary only if this can be done by skipping 23 bytes or less,
12406 @option{-falign-functions=32:7} aligns to the next
12407 32-byte boundary only if this can be done by skipping 6 bytes or less.
12409 The second pair of @var{n2}:@var{m2} values allows you to specify
12410 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
12411 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
12412 otherwise aligns to the next 32-byte boundary if this can be done
12413 by skipping 2 bytes or less.
12414 If @var{m2} is not specified, it defaults to @var{n2}.
12416 Some assemblers only support this flag when @var{n} is a power of two;
12417 in that case, it is rounded up.
12419 @option{-fno-align-functions} and @option{-falign-functions=1} are
12420 equivalent and mean that functions are not aligned.
12422 If @var{n} is not specified or is zero, use a machine-dependent default.
12423 The maximum allowed @var{n} option value is 65536.
12425 Enabled at levels @option{-O2}, @option{-O3}.
12427 @item -flimit-function-alignment
12428 If this option is enabled, the compiler tries to avoid unnecessarily
12429 overaligning functions. It attempts to instruct the assembler to align
12430 by the amount specified by @option{-falign-functions}, but not to
12431 skip more bytes than the size of the function.
12433 @item -falign-labels
12434 @itemx -falign-labels=@var{n}
12435 @itemx -falign-labels=@var{n}:@var{m}
12436 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
12437 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
12438 @opindex falign-labels
12439 Align all branch targets to a power-of-two boundary.
12441 Parameters of this option are analogous to the @option{-falign-functions} option.
12442 @option{-fno-align-labels} and @option{-falign-labels=1} are
12443 equivalent and mean that labels are not aligned.
12445 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
12446 are greater than this value, then their values are used instead.
12448 If @var{n} is not specified or is zero, use a machine-dependent default
12449 which is very likely to be @samp{1}, meaning no alignment.
12450 The maximum allowed @var{n} option value is 65536.
12452 Enabled at levels @option{-O2}, @option{-O3}.
12454 @item -falign-loops
12455 @itemx -falign-loops=@var{n}
12456 @itemx -falign-loops=@var{n}:@var{m}
12457 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
12458 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
12459 @opindex falign-loops
12460 Align loops to a power-of-two boundary. If the loops are executed
12461 many times, this makes up for any execution of the dummy padding
12464 If @option{-falign-labels} is greater than this value, then its value
12467 Parameters of this option are analogous to the @option{-falign-functions} option.
12468 @option{-fno-align-loops} and @option{-falign-loops=1} are
12469 equivalent and mean that loops are not aligned.
12470 The maximum allowed @var{n} option value is 65536.
12472 If @var{n} is not specified or is zero, use a machine-dependent default.
12474 Enabled at levels @option{-O2}, @option{-O3}.
12476 @item -falign-jumps
12477 @itemx -falign-jumps=@var{n}
12478 @itemx -falign-jumps=@var{n}:@var{m}
12479 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
12480 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
12481 @opindex falign-jumps
12482 Align branch targets to a power-of-two boundary, for branch targets
12483 where the targets can only be reached by jumping. In this case,
12484 no dummy operations need be executed.
12486 If @option{-falign-labels} is greater than this value, then its value
12489 Parameters of this option are analogous to the @option{-falign-functions} option.
12490 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
12491 equivalent and mean that loops are not aligned.
12493 If @var{n} is not specified or is zero, use a machine-dependent default.
12494 The maximum allowed @var{n} option value is 65536.
12496 Enabled at levels @option{-O2}, @option{-O3}.
12498 @item -fno-allocation-dce
12499 @opindex fno-allocation-dce
12500 Do not remove unused C++ allocations in dead code elimination.
12502 @item -fallow-store-data-races
12503 @opindex fallow-store-data-races
12504 Allow the compiler to perform optimizations that may introduce new data races
12505 on stores, without proving that the variable cannot be concurrently accessed
12506 by other threads. Does not affect optimization of local data. It is safe to
12507 use this option if it is known that global data will not be accessed by
12510 Examples of optimizations enabled by @option{-fallow-store-data-races} include
12511 hoisting or if-conversions that may cause a value that was already in memory
12512 to be re-written with that same value. Such re-writing is safe in a single
12513 threaded context but may be unsafe in a multi-threaded context. Note that on
12514 some processors, if-conversions may be required in order to enable
12517 Enabled at level @option{-Ofast}.
12519 @item -funit-at-a-time
12520 @opindex funit-at-a-time
12521 This option is left for compatibility reasons. @option{-funit-at-a-time}
12522 has no effect, while @option{-fno-unit-at-a-time} implies
12523 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
12525 Enabled by default.
12527 @item -fno-toplevel-reorder
12528 @opindex fno-toplevel-reorder
12529 @opindex ftoplevel-reorder
12530 Do not reorder top-level functions, variables, and @code{asm}
12531 statements. Output them in the same order that they appear in the
12532 input file. When this option is used, unreferenced static variables
12533 are not removed. This option is intended to support existing code
12534 that relies on a particular ordering. For new code, it is better to
12535 use attributes when possible.
12537 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
12538 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
12539 Additionally @option{-fno-toplevel-reorder} implies
12540 @option{-fno-section-anchors}.
12544 Constructs webs as commonly used for register allocation purposes and assign
12545 each web individual pseudo register. This allows the register allocation pass
12546 to operate on pseudos directly, but also strengthens several other optimization
12547 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
12548 however, make debugging impossible, since variables no longer stay in a
12551 Enabled by default with @option{-funroll-loops}.
12553 @item -fwhole-program
12554 @opindex fwhole-program
12555 Assume that the current compilation unit represents the whole program being
12556 compiled. All public functions and variables with the exception of @code{main}
12557 and those merged by attribute @code{externally_visible} become static functions
12558 and in effect are optimized more aggressively by interprocedural optimizers.
12560 This option should not be used in combination with @option{-flto}.
12561 Instead relying on a linker plugin should provide safer and more precise
12564 @item -flto[=@var{n}]
12566 This option runs the standard link-time optimizer. When invoked
12567 with source code, it generates GIMPLE (one of GCC's internal
12568 representations) and writes it to special ELF sections in the object
12569 file. When the object files are linked together, all the function
12570 bodies are read from these ELF sections and instantiated as if they
12571 had been part of the same translation unit.
12573 To use the link-time optimizer, @option{-flto} and optimization
12574 options should be specified at compile time and during the final link.
12575 It is recommended that you compile all the files participating in the
12576 same link with the same options and also specify those options at
12581 gcc -c -O2 -flto foo.c
12582 gcc -c -O2 -flto bar.c
12583 gcc -o myprog -flto -O2 foo.o bar.o
12586 The first two invocations to GCC save a bytecode representation
12587 of GIMPLE into special ELF sections inside @file{foo.o} and
12588 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
12589 @file{foo.o} and @file{bar.o}, merges the two files into a single
12590 internal image, and compiles the result as usual. Since both
12591 @file{foo.o} and @file{bar.o} are merged into a single image, this
12592 causes all the interprocedural analyses and optimizations in GCC to
12593 work across the two files as if they were a single one. This means,
12594 for example, that the inliner is able to inline functions in
12595 @file{bar.o} into functions in @file{foo.o} and vice-versa.
12597 Another (simpler) way to enable link-time optimization is:
12600 gcc -o myprog -flto -O2 foo.c bar.c
12603 The above generates bytecode for @file{foo.c} and @file{bar.c},
12604 merges them together into a single GIMPLE representation and optimizes
12605 them as usual to produce @file{myprog}.
12607 The important thing to keep in mind is that to enable link-time
12608 optimizations you need to use the GCC driver to perform the link step.
12609 GCC automatically performs link-time optimization if any of the
12610 objects involved were compiled with the @option{-flto} command-line option.
12611 You can always override
12612 the automatic decision to do link-time optimization
12613 by passing @option{-fno-lto} to the link command.
12615 To make whole program optimization effective, it is necessary to make
12616 certain whole program assumptions. The compiler needs to know
12617 what functions and variables can be accessed by libraries and runtime
12618 outside of the link-time optimized unit. When supported by the linker,
12619 the linker plugin (see @option{-fuse-linker-plugin}) passes information
12620 to the compiler about used and externally visible symbols. When
12621 the linker plugin is not available, @option{-fwhole-program} should be
12622 used to allow the compiler to make these assumptions, which leads
12623 to more aggressive optimization decisions.
12625 When a file is compiled with @option{-flto} without
12626 @option{-fuse-linker-plugin}, the generated object file is larger than
12627 a regular object file because it contains GIMPLE bytecodes and the usual
12628 final code (see @option{-ffat-lto-objects}). This means that
12629 object files with LTO information can be linked as normal object
12630 files; if @option{-fno-lto} is passed to the linker, no
12631 interprocedural optimizations are applied. Note that when
12632 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
12633 but you cannot perform a regular, non-LTO link on them.
12635 When producing the final binary, GCC only
12636 applies link-time optimizations to those files that contain bytecode.
12637 Therefore, you can mix and match object files and libraries with
12638 GIMPLE bytecodes and final object code. GCC automatically selects
12639 which files to optimize in LTO mode and which files to link without
12640 further processing.
12642 Generally, options specified at link time override those
12643 specified at compile time, although in some cases GCC attempts to infer
12644 link-time options from the settings used to compile the input files.
12646 If you do not specify an optimization level option @option{-O} at
12647 link time, then GCC uses the highest optimization level
12648 used when compiling the object files. Note that it is generally
12649 ineffective to specify an optimization level option only at link time and
12650 not at compile time, for two reasons. First, compiling without
12651 optimization suppresses compiler passes that gather information
12652 needed for effective optimization at link time. Second, some early
12653 optimization passes can be performed only at compile time and
12656 There are some code generation flags preserved by GCC when
12657 generating bytecodes, as they need to be used during the final link.
12658 Currently, the following options and their settings are taken from
12659 the first object file that explicitly specifies them:
12660 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
12661 @option{-fgnu-tm} and all the @option{-m} target flags.
12663 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
12664 @option{-fPIE} are combined based on the following scheme:
12667 @option{-fPIC} + @option{-fpic} = @option{-fpic}
12668 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
12669 @option{-fpic/-fPIC} + (no option) = (no option)
12670 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
12671 @option{-fpic} + @option{-fPIE} = @option{-fpie}
12672 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
12675 Certain ABI-changing flags are required to match in all compilation units,
12676 and trying to override this at link time with a conflicting value
12677 is ignored. This includes options such as @option{-freg-struct-return}
12678 and @option{-fpcc-struct-return}.
12680 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
12681 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
12682 are passed through to the link stage and merged conservatively for
12683 conflicting translation units. Specifically
12684 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
12685 precedence; and for example @option{-ffp-contract=off} takes precedence
12686 over @option{-ffp-contract=fast}. You can override them at link time.
12688 Diagnostic options such as @option{-Wstringop-overflow} are passed
12689 through to the link stage and their setting matches that of the
12690 compile-step at function granularity. Note that this matters only
12691 for diagnostics emitted during optimization. Note that code
12692 transforms such as inlining can lead to warnings being enabled
12693 or disabled for regions if code not consistent with the setting
12696 When you need to pass options to the assembler via @option{-Wa} or
12697 @option{-Xassembler} make sure to either compile such translation
12698 units with @option{-fno-lto} or consistently use the same assembler
12699 options on all translation units. You can alternatively also
12700 specify assembler options at LTO link time.
12702 To enable debug info generation you need to supply @option{-g} at
12703 compile time. If any of the input files at link time were built
12704 with debug info generation enabled the link will enable debug info
12705 generation as well. Any elaborate debug info settings
12706 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
12707 at the linker command line and mixing different settings in different
12708 translation units is discouraged.
12710 If LTO encounters objects with C linkage declared with incompatible
12711 types in separate translation units to be linked together (undefined
12712 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
12713 issued. The behavior is still undefined at run time. Similar
12714 diagnostics may be raised for other languages.
12716 Another feature of LTO is that it is possible to apply interprocedural
12717 optimizations on files written in different languages:
12721 g++ -c -flto bar.cc
12722 gfortran -c -flto baz.f90
12723 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
12726 Notice that the final link is done with @command{g++} to get the C++
12727 runtime libraries and @option{-lgfortran} is added to get the Fortran
12728 runtime libraries. In general, when mixing languages in LTO mode, you
12729 should use the same link command options as when mixing languages in a
12730 regular (non-LTO) compilation.
12732 If object files containing GIMPLE bytecode are stored in a library archive, say
12733 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
12734 are using a linker with plugin support. To create static libraries suitable
12735 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
12736 and @command{ranlib};
12737 to show the symbols of object files with GIMPLE bytecode, use
12738 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
12739 and @command{nm} have been compiled with plugin support. At link time, use the
12740 flag @option{-fuse-linker-plugin} to ensure that the library participates in
12741 the LTO optimization process:
12744 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
12747 With the linker plugin enabled, the linker extracts the needed
12748 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
12749 to make them part of the aggregated GIMPLE image to be optimized.
12751 If you are not using a linker with plugin support and/or do not
12752 enable the linker plugin, then the objects inside @file{libfoo.a}
12753 are extracted and linked as usual, but they do not participate
12754 in the LTO optimization process. In order to make a static library suitable
12755 for both LTO optimization and usual linkage, compile its object files with
12756 @option{-flto} @option{-ffat-lto-objects}.
12758 Link-time optimizations do not require the presence of the whole program to
12759 operate. If the program does not require any symbols to be exported, it is
12760 possible to combine @option{-flto} and @option{-fwhole-program} to allow
12761 the interprocedural optimizers to use more aggressive assumptions which may
12762 lead to improved optimization opportunities.
12763 Use of @option{-fwhole-program} is not needed when linker plugin is
12764 active (see @option{-fuse-linker-plugin}).
12766 The current implementation of LTO makes no
12767 attempt to generate bytecode that is portable between different
12768 types of hosts. The bytecode files are versioned and there is a
12769 strict version check, so bytecode files generated in one version of
12770 GCC do not work with an older or newer version of GCC.
12772 Link-time optimization does not work well with generation of debugging
12773 information on systems other than those using a combination of ELF and
12776 If you specify the optional @var{n}, the optimization and code
12777 generation done at link time is executed in parallel using @var{n}
12778 parallel jobs by utilizing an installed @command{make} program. The
12779 environment variable @env{MAKE} may be used to override the program
12782 You can also specify @option{-flto=jobserver} to use GNU make's
12783 job server mode to determine the number of parallel jobs. This
12784 is useful when the Makefile calling GCC is already executing in parallel.
12785 You must prepend a @samp{+} to the command recipe in the parent Makefile
12786 for this to work. This option likely only works if @env{MAKE} is
12787 GNU make. Even without the option value, GCC tries to automatically
12788 detect a running GNU make's job server.
12790 Use @option{-flto=auto} to use GNU make's job server, if available,
12791 or otherwise fall back to autodetection of the number of CPU threads
12792 present in your system.
12794 @item -flto-partition=@var{alg}
12795 @opindex flto-partition
12796 Specify the partitioning algorithm used by the link-time optimizer.
12797 The value is either @samp{1to1} to specify a partitioning mirroring
12798 the original source files or @samp{balanced} to specify partitioning
12799 into equally sized chunks (whenever possible) or @samp{max} to create
12800 new partition for every symbol where possible. Specifying @samp{none}
12801 as an algorithm disables partitioning and streaming completely.
12802 The default value is @samp{balanced}. While @samp{1to1} can be used
12803 as an workaround for various code ordering issues, the @samp{max}
12804 partitioning is intended for internal testing only.
12805 The value @samp{one} specifies that exactly one partition should be
12806 used while the value @samp{none} bypasses partitioning and executes
12807 the link-time optimization step directly from the WPA phase.
12809 @item -flto-compression-level=@var{n}
12810 @opindex flto-compression-level
12811 This option specifies the level of compression used for intermediate
12812 language written to LTO object files, and is only meaningful in
12813 conjunction with LTO mode (@option{-flto}). GCC currently supports two
12814 LTO compression algorithms. For zstd, valid values are 0 (no compression)
12815 to 19 (maximum compression), while zlib supports values from 0 to 9.
12816 Values outside this range are clamped to either minimum or maximum
12817 of the supported values. If the option is not given,
12818 a default balanced compression setting is used.
12820 @item -fuse-linker-plugin
12821 @opindex fuse-linker-plugin
12822 Enables the use of a linker plugin during link-time optimization. This
12823 option relies on plugin support in the linker, which is available in gold
12824 or in GNU ld 2.21 or newer.
12826 This option enables the extraction of object files with GIMPLE bytecode out
12827 of library archives. This improves the quality of optimization by exposing
12828 more code to the link-time optimizer. This information specifies what
12829 symbols can be accessed externally (by non-LTO object or during dynamic
12830 linking). Resulting code quality improvements on binaries (and shared
12831 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
12832 See @option{-flto} for a description of the effect of this flag and how to
12835 This option is enabled by default when LTO support in GCC is enabled
12836 and GCC was configured for use with
12837 a linker supporting plugins (GNU ld 2.21 or newer or gold).
12839 @item -ffat-lto-objects
12840 @opindex ffat-lto-objects
12841 Fat LTO objects are object files that contain both the intermediate language
12842 and the object code. This makes them usable for both LTO linking and normal
12843 linking. This option is effective only when compiling with @option{-flto}
12844 and is ignored at link time.
12846 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
12847 requires the complete toolchain to be aware of LTO. It requires a linker with
12848 linker plugin support for basic functionality. Additionally,
12849 @command{nm}, @command{ar} and @command{ranlib}
12850 need to support linker plugins to allow a full-featured build environment
12851 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
12852 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
12853 to these tools. With non fat LTO makefiles need to be modified to use them.
12855 Note that modern binutils provide plugin auto-load mechanism.
12856 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
12857 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
12858 @command{gcc-ranlib}).
12860 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
12863 @item -fcompare-elim
12864 @opindex fcompare-elim
12865 After register allocation and post-register allocation instruction splitting,
12866 identify arithmetic instructions that compute processor flags similar to a
12867 comparison operation based on that arithmetic. If possible, eliminate the
12868 explicit comparison operation.
12870 This pass only applies to certain targets that cannot explicitly represent
12871 the comparison operation before register allocation is complete.
12873 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12875 @item -fcprop-registers
12876 @opindex fcprop-registers
12877 After register allocation and post-register allocation instruction splitting,
12878 perform a copy-propagation pass to try to reduce scheduling dependencies
12879 and occasionally eliminate the copy.
12881 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12883 @item -fprofile-correction
12884 @opindex fprofile-correction
12885 Profiles collected using an instrumented binary for multi-threaded programs may
12886 be inconsistent due to missed counter updates. When this option is specified,
12887 GCC uses heuristics to correct or smooth out such inconsistencies. By
12888 default, GCC emits an error message when an inconsistent profile is detected.
12890 This option is enabled by @option{-fauto-profile}.
12892 @item -fprofile-partial-training
12893 @opindex fprofile-partial-training
12894 With @code{-fprofile-use} all portions of programs not executed during train
12895 run are optimized agressively for size rather than speed. In some cases it is
12896 not practical to train all possible hot paths in the program. (For
12897 example, program may contain functions specific for a given hardware and
12898 trianing may not cover all hardware configurations program is run on.) With
12899 @code{-fprofile-partial-training} profile feedback will be ignored for all
12900 functions not executed during the train run leading them to be optimized as if
12901 they were compiled without profile feedback. This leads to better performance
12902 when train run is not representative but also leads to significantly bigger
12905 @item -fprofile-use
12906 @itemx -fprofile-use=@var{path}
12907 @opindex fprofile-use
12908 Enable profile feedback-directed optimizations,
12909 and the following optimizations, many of which
12910 are generally profitable only with profile feedback available:
12912 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
12913 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
12914 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
12915 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
12916 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
12917 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
12918 -fprofile-reorder-functions}
12920 Before you can use this option, you must first generate profiling information.
12921 @xref{Instrumentation Options}, for information about the
12922 @option{-fprofile-generate} option.
12924 By default, GCC emits an error message if the feedback profiles do not
12925 match the source code. This error can be turned into a warning by using
12926 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
12927 optimized code. Additionally, by default, GCC also emits a warning message if
12928 the feedback profiles do not exist (see @option{-Wmissing-profile}).
12930 If @var{path} is specified, GCC looks at the @var{path} to find
12931 the profile feedback data files. See @option{-fprofile-dir}.
12933 @item -fauto-profile
12934 @itemx -fauto-profile=@var{path}
12935 @opindex fauto-profile
12936 Enable sampling-based feedback-directed optimizations,
12937 and the following optimizations,
12938 many of which are generally profitable only with profile feedback available:
12940 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
12941 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
12942 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
12943 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
12944 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
12945 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
12946 -fprofile-correction}
12948 @var{path} is the name of a file containing AutoFDO profile information.
12949 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
12951 Producing an AutoFDO profile data file requires running your program
12952 with the @command{perf} utility on a supported GNU/Linux target system.
12953 For more information, see @uref{https://perf.wiki.kernel.org/}.
12957 perf record -e br_inst_retired:near_taken -b -o perf.data \
12961 Then use the @command{create_gcov} tool to convert the raw profile data
12962 to a format that can be used by GCC.@ You must also supply the
12963 unstripped binary for your program to this tool.
12964 See @uref{https://github.com/google/autofdo}.
12968 create_gcov --binary=your_program.unstripped --profile=perf.data \
12969 --gcov=profile.afdo
12973 The following options control compiler behavior regarding floating-point
12974 arithmetic. These options trade off between speed and
12975 correctness. All must be specifically enabled.
12978 @item -ffloat-store
12979 @opindex ffloat-store
12980 Do not store floating-point variables in registers, and inhibit other
12981 options that might change whether a floating-point value is taken from a
12982 register or memory.
12984 @cindex floating-point precision
12985 This option prevents undesirable excess precision on machines such as
12986 the 68000 where the floating registers (of the 68881) keep more
12987 precision than a @code{double} is supposed to have. Similarly for the
12988 x86 architecture. For most programs, the excess precision does only
12989 good, but a few programs rely on the precise definition of IEEE floating
12990 point. Use @option{-ffloat-store} for such programs, after modifying
12991 them to store all pertinent intermediate computations into variables.
12993 @item -fexcess-precision=@var{style}
12994 @opindex fexcess-precision
12995 This option allows further control over excess precision on machines
12996 where floating-point operations occur in a format with more precision or
12997 range than the IEEE standard and interchange floating-point types. By
12998 default, @option{-fexcess-precision=fast} is in effect; this means that
12999 operations may be carried out in a wider precision than the types specified
13000 in the source if that would result in faster code, and it is unpredictable
13001 when rounding to the types specified in the source code takes place.
13002 When compiling C, if @option{-fexcess-precision=standard} is specified then
13003 excess precision follows the rules specified in ISO C99; in particular,
13004 both casts and assignments cause values to be rounded to their
13005 semantic types (whereas @option{-ffloat-store} only affects
13006 assignments). This option is enabled by default for C if a strict
13007 conformance option such as @option{-std=c99} is used.
13008 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
13009 regardless of whether a strict conformance option is used.
13012 @option{-fexcess-precision=standard} is not implemented for languages
13013 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
13014 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
13015 semantics apply without excess precision, and in the latter, rounding
13019 @opindex ffast-math
13020 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
13021 @option{-ffinite-math-only}, @option{-fno-rounding-math},
13022 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
13023 @option{-fexcess-precision=fast}.
13025 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
13027 This option is not turned on by any @option{-O} option besides
13028 @option{-Ofast} since it can result in incorrect output for programs
13029 that depend on an exact implementation of IEEE or ISO rules/specifications
13030 for math functions. It may, however, yield faster code for programs
13031 that do not require the guarantees of these specifications.
13033 @item -fno-math-errno
13034 @opindex fno-math-errno
13035 @opindex fmath-errno
13036 Do not set @code{errno} after calling math functions that are executed
13037 with a single instruction, e.g., @code{sqrt}. A program that relies on
13038 IEEE exceptions for math error handling may want to use this flag
13039 for speed while maintaining IEEE arithmetic compatibility.
13041 This option is not turned on by any @option{-O} option since
13042 it can result in incorrect output for programs that depend on
13043 an exact implementation of IEEE or ISO rules/specifications for
13044 math functions. It may, however, yield faster code for programs
13045 that do not require the guarantees of these specifications.
13047 The default is @option{-fmath-errno}.
13049 On Darwin systems, the math library never sets @code{errno}. There is
13050 therefore no reason for the compiler to consider the possibility that
13051 it might, and @option{-fno-math-errno} is the default.
13053 @item -funsafe-math-optimizations
13054 @opindex funsafe-math-optimizations
13056 Allow optimizations for floating-point arithmetic that (a) assume
13057 that arguments and results are valid and (b) may violate IEEE or
13058 ANSI standards. When used at link time, it may include libraries
13059 or startup files that change the default FPU control word or other
13060 similar optimizations.
13062 This option is not turned on by any @option{-O} option since
13063 it can result in incorrect output for programs that depend on
13064 an exact implementation of IEEE or ISO rules/specifications for
13065 math functions. It may, however, yield faster code for programs
13066 that do not require the guarantees of these specifications.
13067 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
13068 @option{-fassociative-math} and @option{-freciprocal-math}.
13070 The default is @option{-fno-unsafe-math-optimizations}.
13072 @item -fassociative-math
13073 @opindex fassociative-math
13075 Allow re-association of operands in series of floating-point operations.
13076 This violates the ISO C and C++ language standard by possibly changing
13077 computation result. NOTE: re-ordering may change the sign of zero as
13078 well as ignore NaNs and inhibit or create underflow or overflow (and
13079 thus cannot be used on code that relies on rounding behavior like
13080 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
13081 and thus may not be used when ordered comparisons are required.
13082 This option requires that both @option{-fno-signed-zeros} and
13083 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
13084 much sense with @option{-frounding-math}. For Fortran the option
13085 is automatically enabled when both @option{-fno-signed-zeros} and
13086 @option{-fno-trapping-math} are in effect.
13088 The default is @option{-fno-associative-math}.
13090 @item -freciprocal-math
13091 @opindex freciprocal-math
13093 Allow the reciprocal of a value to be used instead of dividing by
13094 the value if this enables optimizations. For example @code{x / y}
13095 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
13096 is subject to common subexpression elimination. Note that this loses
13097 precision and increases the number of flops operating on the value.
13099 The default is @option{-fno-reciprocal-math}.
13101 @item -ffinite-math-only
13102 @opindex ffinite-math-only
13103 Allow optimizations for floating-point arithmetic that assume
13104 that arguments and results are not NaNs or +-Infs.
13106 This option is not turned on by any @option{-O} option since
13107 it can result in incorrect output for programs that depend on
13108 an exact implementation of IEEE or ISO rules/specifications for
13109 math functions. It may, however, yield faster code for programs
13110 that do not require the guarantees of these specifications.
13112 The default is @option{-fno-finite-math-only}.
13114 @item -fno-signed-zeros
13115 @opindex fno-signed-zeros
13116 @opindex fsigned-zeros
13117 Allow optimizations for floating-point arithmetic that ignore the
13118 signedness of zero. IEEE arithmetic specifies the behavior of
13119 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
13120 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
13121 This option implies that the sign of a zero result isn't significant.
13123 The default is @option{-fsigned-zeros}.
13125 @item -fno-trapping-math
13126 @opindex fno-trapping-math
13127 @opindex ftrapping-math
13128 Compile code assuming that floating-point operations cannot generate
13129 user-visible traps. These traps include division by zero, overflow,
13130 underflow, inexact result and invalid operation. This option requires
13131 that @option{-fno-signaling-nans} be in effect. Setting this option may
13132 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
13134 This option should never be turned on by any @option{-O} option since
13135 it can result in incorrect output for programs that depend on
13136 an exact implementation of IEEE or ISO rules/specifications for
13139 The default is @option{-ftrapping-math}.
13141 @item -frounding-math
13142 @opindex frounding-math
13143 Disable transformations and optimizations that assume default floating-point
13144 rounding behavior. This is round-to-zero for all floating point
13145 to integer conversions, and round-to-nearest for all other arithmetic
13146 truncations. This option should be specified for programs that change
13147 the FP rounding mode dynamically, or that may be executed with a
13148 non-default rounding mode. This option disables constant folding of
13149 floating-point expressions at compile time (which may be affected by
13150 rounding mode) and arithmetic transformations that are unsafe in the
13151 presence of sign-dependent rounding modes.
13153 The default is @option{-fno-rounding-math}.
13155 This option is experimental and does not currently guarantee to
13156 disable all GCC optimizations that are affected by rounding mode.
13157 Future versions of GCC may provide finer control of this setting
13158 using C99's @code{FENV_ACCESS} pragma. This command-line option
13159 will be used to specify the default state for @code{FENV_ACCESS}.
13161 @item -fsignaling-nans
13162 @opindex fsignaling-nans
13163 Compile code assuming that IEEE signaling NaNs may generate user-visible
13164 traps during floating-point operations. Setting this option disables
13165 optimizations that may change the number of exceptions visible with
13166 signaling NaNs. This option implies @option{-ftrapping-math}.
13168 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
13171 The default is @option{-fno-signaling-nans}.
13173 This option is experimental and does not currently guarantee to
13174 disable all GCC optimizations that affect signaling NaN behavior.
13176 @item -fno-fp-int-builtin-inexact
13177 @opindex fno-fp-int-builtin-inexact
13178 @opindex ffp-int-builtin-inexact
13179 Do not allow the built-in functions @code{ceil}, @code{floor},
13180 @code{round} and @code{trunc}, and their @code{float} and @code{long
13181 double} variants, to generate code that raises the ``inexact''
13182 floating-point exception for noninteger arguments. ISO C99 and C11
13183 allow these functions to raise the ``inexact'' exception, but ISO/IEC
13184 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
13185 ISO C2X, does not allow these functions to do so.
13187 The default is @option{-ffp-int-builtin-inexact}, allowing the
13188 exception to be raised, unless C2X or a later C standard is selected.
13189 This option does nothing unless @option{-ftrapping-math} is in effect.
13191 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
13192 generate a call to a library function then the ``inexact'' exception
13193 may be raised if the library implementation does not follow TS 18661.
13195 @item -fsingle-precision-constant
13196 @opindex fsingle-precision-constant
13197 Treat floating-point constants as single precision instead of
13198 implicitly converting them to double-precision constants.
13200 @item -fcx-limited-range
13201 @opindex fcx-limited-range
13202 When enabled, this option states that a range reduction step is not
13203 needed when performing complex division. Also, there is no checking
13204 whether the result of a complex multiplication or division is @code{NaN
13205 + I*NaN}, with an attempt to rescue the situation in that case. The
13206 default is @option{-fno-cx-limited-range}, but is enabled by
13207 @option{-ffast-math}.
13209 This option controls the default setting of the ISO C99
13210 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
13213 @item -fcx-fortran-rules
13214 @opindex fcx-fortran-rules
13215 Complex multiplication and division follow Fortran rules. Range
13216 reduction is done as part of complex division, but there is no checking
13217 whether the result of a complex multiplication or division is @code{NaN
13218 + I*NaN}, with an attempt to rescue the situation in that case.
13220 The default is @option{-fno-cx-fortran-rules}.
13224 The following options control optimizations that may improve
13225 performance, but are not enabled by any @option{-O} options. This
13226 section includes experimental options that may produce broken code.
13229 @item -fbranch-probabilities
13230 @opindex fbranch-probabilities
13231 After running a program compiled with @option{-fprofile-arcs}
13232 (@pxref{Instrumentation Options}),
13233 you can compile it a second time using
13234 @option{-fbranch-probabilities}, to improve optimizations based on
13235 the number of times each branch was taken. When a program
13236 compiled with @option{-fprofile-arcs} exits, it saves arc execution
13237 counts to a file called @file{@var{sourcename}.gcda} for each source
13238 file. The information in this data file is very dependent on the
13239 structure of the generated code, so you must use the same source code
13240 and the same optimization options for both compilations.
13242 With @option{-fbranch-probabilities}, GCC puts a
13243 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
13244 These can be used to improve optimization. Currently, they are only
13245 used in one place: in @file{reorg.c}, instead of guessing which path a
13246 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
13247 exactly determine which path is taken more often.
13249 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13251 @item -fprofile-values
13252 @opindex fprofile-values
13253 If combined with @option{-fprofile-arcs}, it adds code so that some
13254 data about values of expressions in the program is gathered.
13256 With @option{-fbranch-probabilities}, it reads back the data gathered
13257 from profiling values of expressions for usage in optimizations.
13259 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
13260 @option{-fauto-profile}.
13262 @item -fprofile-reorder-functions
13263 @opindex fprofile-reorder-functions
13264 Function reordering based on profile instrumentation collects
13265 first time of execution of a function and orders these functions
13266 in ascending order.
13268 Enabled with @option{-fprofile-use}.
13272 If combined with @option{-fprofile-arcs}, this option instructs the compiler
13273 to add code to gather information about values of expressions.
13275 With @option{-fbranch-probabilities}, it reads back the data gathered
13276 and actually performs the optimizations based on them.
13277 Currently the optimizations include specialization of division operations
13278 using the knowledge about the value of the denominator.
13280 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
13282 @item -frename-registers
13283 @opindex frename-registers
13284 Attempt to avoid false dependencies in scheduled code by making use
13285 of registers left over after register allocation. This optimization
13286 most benefits processors with lots of registers. Depending on the
13287 debug information format adopted by the target, however, it can
13288 make debugging impossible, since variables no longer stay in
13289 a ``home register''.
13291 Enabled by default with @option{-funroll-loops}.
13293 @item -fschedule-fusion
13294 @opindex fschedule-fusion
13295 Performs a target dependent pass over the instruction stream to schedule
13296 instructions of same type together because target machine can execute them
13297 more efficiently if they are adjacent to each other in the instruction flow.
13299 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13303 Perform tail duplication to enlarge superblock size. This transformation
13304 simplifies the control flow of the function allowing other optimizations to do
13307 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13309 @item -funroll-loops
13310 @opindex funroll-loops
13311 Unroll loops whose number of iterations can be determined at compile time or
13312 upon entry to the loop. @option{-funroll-loops} implies
13313 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
13314 It also turns on complete loop peeling (i.e.@: complete removal of loops with
13315 a small constant number of iterations). This option makes code larger, and may
13316 or may not make it run faster.
13318 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13320 @item -funroll-all-loops
13321 @opindex funroll-all-loops
13322 Unroll all loops, even if their number of iterations is uncertain when
13323 the loop is entered. This usually makes programs run more slowly.
13324 @option{-funroll-all-loops} implies the same options as
13325 @option{-funroll-loops}.
13328 @opindex fpeel-loops
13329 Peels loops for which there is enough information that they do not
13330 roll much (from profile feedback or static analysis). It also turns on
13331 complete loop peeling (i.e.@: complete removal of loops with small constant
13332 number of iterations).
13334 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
13336 @item -fmove-loop-invariants
13337 @opindex fmove-loop-invariants
13338 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
13339 at level @option{-O1} and higher, except for @option{-Og}.
13341 @item -fmove-loop-stores
13342 @opindex fmove-loop-stores
13343 Enables the loop store motion pass in the GIMPLE loop optimizer. This
13344 moves invariant stores to after the end of the loop in exchange for
13345 carrying the stored value in a register across the iteration.
13346 Note for this option to have an effect @option{-ftree-loop-im} has to
13347 be enabled as well. Enabled at level @option{-O1} and higher, except
13350 @item -fsplit-loops
13351 @opindex fsplit-loops
13352 Split a loop into two if it contains a condition that's always true
13353 for one side of the iteration space and false for the other.
13355 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13357 @item -funswitch-loops
13358 @opindex funswitch-loops
13359 Move branches with loop invariant conditions out of the loop, with duplicates
13360 of the loop on both branches (modified according to result of the condition).
13362 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13364 @item -fversion-loops-for-strides
13365 @opindex fversion-loops-for-strides
13366 If a loop iterates over an array with a variable stride, create another
13367 version of the loop that assumes the stride is always one. For example:
13370 for (int i = 0; i < n; ++i)
13371 x[i * stride] = @dots{};
13378 for (int i = 0; i < n; ++i)
13381 for (int i = 0; i < n; ++i)
13382 x[i * stride] = @dots{};
13385 This is particularly useful for assumed-shape arrays in Fortran where
13386 (for example) it allows better vectorization assuming contiguous accesses.
13387 This flag is enabled by default at @option{-O3}.
13388 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13390 @item -ffunction-sections
13391 @itemx -fdata-sections
13392 @opindex ffunction-sections
13393 @opindex fdata-sections
13394 Place each function or data item into its own section in the output
13395 file if the target supports arbitrary sections. The name of the
13396 function or the name of the data item determines the section's name
13397 in the output file.
13399 Use these options on systems where the linker can perform optimizations to
13400 improve locality of reference in the instruction space. Most systems using the
13401 ELF object format have linkers with such optimizations. On AIX, the linker
13402 rearranges sections (CSECTs) based on the call graph. The performance impact
13405 Together with a linker garbage collection (linker @option{--gc-sections}
13406 option) these options may lead to smaller statically-linked executables (after
13409 On ELF/DWARF systems these options do not degenerate the quality of the debug
13410 information. There could be issues with other object files/debug info formats.
13412 Only use these options when there are significant benefits from doing so. When
13413 you specify these options, the assembler and linker create larger object and
13414 executable files and are also slower. These options affect code generation.
13415 They prevent optimizations by the compiler and assembler using relative
13416 locations inside a translation unit since the locations are unknown until
13417 link time. An example of such an optimization is relaxing calls to short call
13421 @opindex fstdarg-opt
13422 Optimize the prologue of variadic argument functions with respect to usage of
13425 @item -fsection-anchors
13426 @opindex fsection-anchors
13427 Try to reduce the number of symbolic address calculations by using
13428 shared ``anchor'' symbols to address nearby objects. This transformation
13429 can help to reduce the number of GOT entries and GOT accesses on some
13432 For example, the implementation of the following function @code{foo}:
13435 static int a, b, c;
13436 int foo (void) @{ return a + b + c; @}
13440 usually calculates the addresses of all three variables, but if you
13441 compile it with @option{-fsection-anchors}, it accesses the variables
13442 from a common anchor point instead. The effect is similar to the
13443 following pseudocode (which isn't valid C):
13448 register int *xr = &x;
13449 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
13453 Not all targets support this option.
13455 @item -fzero-call-used-regs=@var{choice}
13456 @opindex fzero-call-used-regs
13457 Zero call-used registers at function return to increase program
13458 security by either mitigating Return-Oriented Programming (ROP)
13459 attacks or preventing information leakage through registers.
13461 The possible values of @var{choice} are the same as for the
13462 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
13463 The default is @samp{skip}.
13465 You can control this behavior for a specific function by using the function
13466 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
13468 @item --param @var{name}=@var{value}
13470 In some places, GCC uses various constants to control the amount of
13471 optimization that is done. For example, GCC does not inline functions
13472 that contain more than a certain number of instructions. You can
13473 control some of these constants on the command line using the
13474 @option{--param} option.
13476 The names of specific parameters, and the meaning of the values, are
13477 tied to the internals of the compiler, and are subject to change
13478 without notice in future releases.
13480 In order to get minimal, maximal and default value of a parameter,
13481 one can use @option{--help=param -Q} options.
13483 In each case, the @var{value} is an integer. The following choices
13484 of @var{name} are recognized for all targets:
13487 @item predictable-branch-outcome
13488 When branch is predicted to be taken with probability lower than this threshold
13489 (in percent), then it is considered well predictable.
13491 @item max-rtl-if-conversion-insns
13492 RTL if-conversion tries to remove conditional branches around a block and
13493 replace them with conditionally executed instructions. This parameter
13494 gives the maximum number of instructions in a block which should be
13495 considered for if-conversion. The compiler will
13496 also use other heuristics to decide whether if-conversion is likely to be
13499 @item max-rtl-if-conversion-predictable-cost
13500 RTL if-conversion will try to remove conditional branches around a block
13501 and replace them with conditionally executed instructions. These parameters
13502 give the maximum permissible cost for the sequence that would be generated
13503 by if-conversion depending on whether the branch is statically determined
13504 to be predictable or not. The units for this parameter are the same as
13505 those for the GCC internal seq_cost metric. The compiler will try to
13506 provide a reasonable default for this parameter using the BRANCH_COST
13509 @item max-crossjump-edges
13510 The maximum number of incoming edges to consider for cross-jumping.
13511 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
13512 the number of edges incoming to each block. Increasing values mean
13513 more aggressive optimization, making the compilation time increase with
13514 probably small improvement in executable size.
13516 @item min-crossjump-insns
13517 The minimum number of instructions that must be matched at the end
13518 of two blocks before cross-jumping is performed on them. This
13519 value is ignored in the case where all instructions in the block being
13520 cross-jumped from are matched.
13522 @item max-grow-copy-bb-insns
13523 The maximum code size expansion factor when copying basic blocks
13524 instead of jumping. The expansion is relative to a jump instruction.
13526 @item max-goto-duplication-insns
13527 The maximum number of instructions to duplicate to a block that jumps
13528 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
13529 passes, GCC factors computed gotos early in the compilation process,
13530 and unfactors them as late as possible. Only computed jumps at the
13531 end of a basic blocks with no more than max-goto-duplication-insns are
13534 @item max-delay-slot-insn-search
13535 The maximum number of instructions to consider when looking for an
13536 instruction to fill a delay slot. If more than this arbitrary number of
13537 instructions are searched, the time savings from filling the delay slot
13538 are minimal, so stop searching. Increasing values mean more
13539 aggressive optimization, making the compilation time increase with probably
13540 small improvement in execution time.
13542 @item max-delay-slot-live-search
13543 When trying to fill delay slots, the maximum number of instructions to
13544 consider when searching for a block with valid live register
13545 information. Increasing this arbitrarily chosen value means more
13546 aggressive optimization, increasing the compilation time. This parameter
13547 should be removed when the delay slot code is rewritten to maintain the
13548 control-flow graph.
13550 @item max-gcse-memory
13551 The approximate maximum amount of memory in @code{kB} that can be allocated in
13552 order to perform the global common subexpression elimination
13553 optimization. If more memory than specified is required, the
13554 optimization is not done.
13556 @item max-gcse-insertion-ratio
13557 If the ratio of expression insertions to deletions is larger than this value
13558 for any expression, then RTL PRE inserts or removes the expression and thus
13559 leaves partially redundant computations in the instruction stream.
13561 @item max-pending-list-length
13562 The maximum number of pending dependencies scheduling allows
13563 before flushing the current state and starting over. Large functions
13564 with few branches or calls can create excessively large lists which
13565 needlessly consume memory and resources.
13567 @item max-modulo-backtrack-attempts
13568 The maximum number of backtrack attempts the scheduler should make
13569 when modulo scheduling a loop. Larger values can exponentially increase
13572 @item max-inline-insns-single
13573 Several parameters control the tree inliner used in GCC@. This number sets the
13574 maximum number of instructions (counted in GCC's internal representation) in a
13575 single function that the tree inliner considers for inlining. This only
13576 affects functions declared inline and methods implemented in a class
13580 @item max-inline-insns-auto
13581 When you use @option{-finline-functions} (included in @option{-O3}),
13582 a lot of functions that would otherwise not be considered for inlining
13583 by the compiler are investigated. To those functions, a different
13584 (more restrictive) limit compared to functions declared inline can
13585 be applied (@option{--param max-inline-insns-auto}).
13587 @item max-inline-insns-small
13588 This is bound applied to calls which are considered relevant with
13589 @option{-finline-small-functions}.
13591 @item max-inline-insns-size
13592 This is bound applied to calls which are optimized for size. Small growth
13593 may be desirable to anticipate optimization oppurtunities exposed by inlining.
13595 @item uninlined-function-insns
13596 Number of instructions accounted by inliner for function overhead such as
13597 function prologue and epilogue.
13599 @item uninlined-function-time
13600 Extra time accounted by inliner for function overhead such as time needed to
13601 execute function prologue and epilogue.
13603 @item inline-heuristics-hint-percent
13604 The scale (in percents) applied to @option{inline-insns-single},
13605 @option{inline-insns-single-O2}, @option{inline-insns-auto}
13606 when inline heuristics hints that inlining is
13607 very profitable (will enable later optimizations).
13609 @item uninlined-thunk-insns
13610 @item uninlined-thunk-time
13611 Same as @option{--param uninlined-function-insns} and
13612 @option{--param uninlined-function-time} but applied to function thunks.
13614 @item inline-min-speedup
13615 When estimated performance improvement of caller + callee runtime exceeds this
13616 threshold (in percent), the function can be inlined regardless of the limit on
13617 @option{--param max-inline-insns-single} and @option{--param
13618 max-inline-insns-auto}.
13620 @item large-function-insns
13621 The limit specifying really large functions. For functions larger than this
13622 limit after inlining, inlining is constrained by
13623 @option{--param large-function-growth}. This parameter is useful primarily
13624 to avoid extreme compilation time caused by non-linear algorithms used by the
13627 @item large-function-growth
13628 Specifies maximal growth of large function caused by inlining in percents.
13629 For example, parameter value 100 limits large function growth to 2.0 times
13632 @item large-unit-insns
13633 The limit specifying large translation unit. Growth caused by inlining of
13634 units larger than this limit is limited by @option{--param inline-unit-growth}.
13635 For small units this might be too tight.
13636 For example, consider a unit consisting of function A
13637 that is inline and B that just calls A three times. If B is small relative to
13638 A, the growth of unit is 300\% and yet such inlining is very sane. For very
13639 large units consisting of small inlineable functions, however, the overall unit
13640 growth limit is needed to avoid exponential explosion of code size. Thus for
13641 smaller units, the size is increased to @option{--param large-unit-insns}
13642 before applying @option{--param inline-unit-growth}.
13645 Maximum number of concurrently open C++ module files when lazy loading.
13647 @item inline-unit-growth
13648 Specifies maximal overall growth of the compilation unit caused by inlining.
13649 For example, parameter value 20 limits unit growth to 1.2 times the original
13650 size. Cold functions (either marked cold via an attribute or by profile
13651 feedback) are not accounted into the unit size.
13653 @item ipa-cp-unit-growth
13654 Specifies maximal overall growth of the compilation unit caused by
13655 interprocedural constant propagation. For example, parameter value 10 limits
13656 unit growth to 1.1 times the original size.
13658 @item ipa-cp-large-unit-insns
13659 The size of translation unit that IPA-CP pass considers large.
13661 @item large-stack-frame
13662 The limit specifying large stack frames. While inlining the algorithm is trying
13663 to not grow past this limit too much.
13665 @item large-stack-frame-growth
13666 Specifies maximal growth of large stack frames caused by inlining in percents.
13667 For example, parameter value 1000 limits large stack frame growth to 11 times
13670 @item max-inline-insns-recursive
13671 @itemx max-inline-insns-recursive-auto
13672 Specifies the maximum number of instructions an out-of-line copy of a
13673 self-recursive inline
13674 function can grow into by performing recursive inlining.
13676 @option{--param max-inline-insns-recursive} applies to functions
13678 For functions not declared inline, recursive inlining
13679 happens only when @option{-finline-functions} (included in @option{-O3}) is
13680 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
13682 @item max-inline-recursive-depth
13683 @itemx max-inline-recursive-depth-auto
13684 Specifies the maximum recursion depth used for recursive inlining.
13686 @option{--param max-inline-recursive-depth} applies to functions
13687 declared inline. For functions not declared inline, recursive inlining
13688 happens only when @option{-finline-functions} (included in @option{-O3}) is
13689 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
13691 @item min-inline-recursive-probability
13692 Recursive inlining is profitable only for function having deep recursion
13693 in average and can hurt for function having little recursion depth by
13694 increasing the prologue size or complexity of function body to other
13697 When profile feedback is available (see @option{-fprofile-generate}) the actual
13698 recursion depth can be guessed from the probability that function recurses
13699 via a given call expression. This parameter limits inlining only to call
13700 expressions whose probability exceeds the given threshold (in percents).
13702 @item early-inlining-insns
13703 Specify growth that the early inliner can make. In effect it increases
13704 the amount of inlining for code having a large abstraction penalty.
13706 @item max-early-inliner-iterations
13707 Limit of iterations of the early inliner. This basically bounds
13708 the number of nested indirect calls the early inliner can resolve.
13709 Deeper chains are still handled by late inlining.
13711 @item comdat-sharing-probability
13712 Probability (in percent) that C++ inline function with comdat visibility
13713 are shared across multiple compilation units.
13715 @item modref-max-bases
13716 @item modref-max-refs
13717 @item modref-max-accesses
13718 Specifies the maximal number of base pointers, references and accesses stored
13719 for a single function by mod/ref analysis.
13721 @item modref-max-tests
13722 Specifies the maxmal number of tests alias oracle can perform to disambiguate
13723 memory locations using the mod/ref information. This parameter ought to be
13724 bigger than @option{--param modref-max-bases} and @option{--param
13727 @item modref-max-depth
13728 Specifies the maximum depth of DFS walk used by modref escape analysis.
13729 Setting to 0 disables the analysis completely.
13731 @item modref-max-escape-points
13732 Specifies the maximum number of escape points tracked by modref per SSA-name.
13734 @item modref-max-adjustments
13735 Specifies the maximum number the access range is enlarged during modref dataflow
13738 @item profile-func-internal-id
13739 A parameter to control whether to use function internal id in profile
13740 database lookup. If the value is 0, the compiler uses an id that
13741 is based on function assembler name and filename, which makes old profile
13742 data more tolerant to source changes such as function reordering etc.
13744 @item min-vect-loop-bound
13745 The minimum number of iterations under which loops are not vectorized
13746 when @option{-ftree-vectorize} is used. The number of iterations after
13747 vectorization needs to be greater than the value specified by this option
13748 to allow vectorization.
13750 @item gcse-cost-distance-ratio
13751 Scaling factor in calculation of maximum distance an expression
13752 can be moved by GCSE optimizations. This is currently supported only in the
13753 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
13754 is with simple expressions, i.e., the expressions that have cost
13755 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
13756 hoisting of simple expressions.
13758 @item gcse-unrestricted-cost
13759 Cost, roughly measured as the cost of a single typical machine
13760 instruction, at which GCSE optimizations do not constrain
13761 the distance an expression can travel. This is currently
13762 supported only in the code hoisting pass. The lesser the cost,
13763 the more aggressive code hoisting is. Specifying 0
13764 allows all expressions to travel unrestricted distances.
13766 @item max-hoist-depth
13767 The depth of search in the dominator tree for expressions to hoist.
13768 This is used to avoid quadratic behavior in hoisting algorithm.
13769 The value of 0 does not limit on the search, but may slow down compilation
13772 @item max-tail-merge-comparisons
13773 The maximum amount of similar bbs to compare a bb with. This is used to
13774 avoid quadratic behavior in tree tail merging.
13776 @item max-tail-merge-iterations
13777 The maximum amount of iterations of the pass over the function. This is used to
13778 limit compilation time in tree tail merging.
13780 @item store-merging-allow-unaligned
13781 Allow the store merging pass to introduce unaligned stores if it is legal to
13784 @item max-stores-to-merge
13785 The maximum number of stores to attempt to merge into wider stores in the store
13788 @item max-store-chains-to-track
13789 The maximum number of store chains to track at the same time in the attempt
13790 to merge them into wider stores in the store merging pass.
13792 @item max-stores-to-track
13793 The maximum number of stores to track at the same time in the attemt to
13794 to merge them into wider stores in the store merging pass.
13796 @item max-unrolled-insns
13797 The maximum number of instructions that a loop may have to be unrolled.
13798 If a loop is unrolled, this parameter also determines how many times
13799 the loop code is unrolled.
13801 @item max-average-unrolled-insns
13802 The maximum number of instructions biased by probabilities of their execution
13803 that a loop may have to be unrolled. If a loop is unrolled,
13804 this parameter also determines how many times the loop code is unrolled.
13806 @item max-unroll-times
13807 The maximum number of unrollings of a single loop.
13809 @item max-peeled-insns
13810 The maximum number of instructions that a loop may have to be peeled.
13811 If a loop is peeled, this parameter also determines how many times
13812 the loop code is peeled.
13814 @item max-peel-times
13815 The maximum number of peelings of a single loop.
13817 @item max-peel-branches
13818 The maximum number of branches on the hot path through the peeled sequence.
13820 @item max-completely-peeled-insns
13821 The maximum number of insns of a completely peeled loop.
13823 @item max-completely-peel-times
13824 The maximum number of iterations of a loop to be suitable for complete peeling.
13826 @item max-completely-peel-loop-nest-depth
13827 The maximum depth of a loop nest suitable for complete peeling.
13829 @item max-unswitch-insns
13830 The maximum number of insns of an unswitched loop.
13832 @item max-unswitch-level
13833 The maximum number of branches unswitched in a single loop.
13835 @item lim-expensive
13836 The minimum cost of an expensive expression in the loop invariant motion.
13838 @item min-loop-cond-split-prob
13839 When FDO profile information is available, @option{min-loop-cond-split-prob}
13840 specifies minimum threshold for probability of semi-invariant condition
13841 statement to trigger loop split.
13843 @item iv-consider-all-candidates-bound
13844 Bound on number of candidates for induction variables, below which
13845 all candidates are considered for each use in induction variable
13846 optimizations. If there are more candidates than this,
13847 only the most relevant ones are considered to avoid quadratic time complexity.
13849 @item iv-max-considered-uses
13850 The induction variable optimizations give up on loops that contain more
13851 induction variable uses.
13853 @item iv-always-prune-cand-set-bound
13854 If the number of candidates in the set is smaller than this value,
13855 always try to remove unnecessary ivs from the set
13856 when adding a new one.
13858 @item avg-loop-niter
13859 Average number of iterations of a loop.
13861 @item dse-max-object-size
13862 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
13863 Larger values may result in larger compilation times.
13865 @item dse-max-alias-queries-per-store
13866 Maximum number of queries into the alias oracle per store.
13867 Larger values result in larger compilation times and may result in more
13868 removed dead stores.
13870 @item scev-max-expr-size
13871 Bound on size of expressions used in the scalar evolutions analyzer.
13872 Large expressions slow the analyzer.
13874 @item scev-max-expr-complexity
13875 Bound on the complexity of the expressions in the scalar evolutions analyzer.
13876 Complex expressions slow the analyzer.
13878 @item max-tree-if-conversion-phi-args
13879 Maximum number of arguments in a PHI supported by TREE if conversion
13880 unless the loop is marked with simd pragma.
13882 @item vect-max-version-for-alignment-checks
13883 The maximum number of run-time checks that can be performed when
13884 doing loop versioning for alignment in the vectorizer.
13886 @item vect-max-version-for-alias-checks
13887 The maximum number of run-time checks that can be performed when
13888 doing loop versioning for alias in the vectorizer.
13890 @item vect-max-peeling-for-alignment
13891 The maximum number of loop peels to enhance access alignment
13892 for vectorizer. Value -1 means no limit.
13894 @item max-iterations-to-track
13895 The maximum number of iterations of a loop the brute-force algorithm
13896 for analysis of the number of iterations of the loop tries to evaluate.
13898 @item hot-bb-count-fraction
13899 The denominator n of fraction 1/n of the maximal execution count of a
13900 basic block in the entire program that a basic block needs to at least
13901 have in order to be considered hot. The default is 10000, which means
13902 that a basic block is considered hot if its execution count is greater
13903 than 1/10000 of the maximal execution count. 0 means that it is never
13904 considered hot. Used in non-LTO mode.
13906 @item hot-bb-count-ws-permille
13907 The number of most executed permilles, ranging from 0 to 1000, of the
13908 profiled execution of the entire program to which the execution count
13909 of a basic block must be part of in order to be considered hot. The
13910 default is 990, which means that a basic block is considered hot if
13911 its execution count contributes to the upper 990 permilles, or 99.0%,
13912 of the profiled execution of the entire program. 0 means that it is
13913 never considered hot. Used in LTO mode.
13915 @item hot-bb-frequency-fraction
13916 The denominator n of fraction 1/n of the execution frequency of the
13917 entry block of a function that a basic block of this function needs
13918 to at least have in order to be considered hot. The default is 1000,
13919 which means that a basic block is considered hot in a function if it
13920 is executed more frequently than 1/1000 of the frequency of the entry
13921 block of the function. 0 means that it is never considered hot.
13923 @item unlikely-bb-count-fraction
13924 The denominator n of fraction 1/n of the number of profiled runs of
13925 the entire program below which the execution count of a basic block
13926 must be in order for the basic block to be considered unlikely executed.
13927 The default is 20, which means that a basic block is considered unlikely
13928 executed if it is executed in fewer than 1/20, or 5%, of the runs of
13929 the program. 0 means that it is always considered unlikely executed.
13931 @item max-predicted-iterations
13932 The maximum number of loop iterations we predict statically. This is useful
13933 in cases where a function contains a single loop with known bound and
13934 another loop with unknown bound.
13935 The known number of iterations is predicted correctly, while
13936 the unknown number of iterations average to roughly 10. This means that the
13937 loop without bounds appears artificially cold relative to the other one.
13939 @item builtin-expect-probability
13940 Control the probability of the expression having the specified value. This
13941 parameter takes a percentage (i.e.@: 0 ... 100) as input.
13943 @item builtin-string-cmp-inline-length
13944 The maximum length of a constant string for a builtin string cmp call
13945 eligible for inlining.
13947 @item align-threshold
13949 Select fraction of the maximal frequency of executions of a basic block in
13950 a function to align the basic block.
13952 @item align-loop-iterations
13954 A loop expected to iterate at least the selected number of iterations is
13957 @item tracer-dynamic-coverage
13958 @itemx tracer-dynamic-coverage-feedback
13960 This value is used to limit superblock formation once the given percentage of
13961 executed instructions is covered. This limits unnecessary code size
13964 The @option{tracer-dynamic-coverage-feedback} parameter
13965 is used only when profile
13966 feedback is available. The real profiles (as opposed to statically estimated
13967 ones) are much less balanced allowing the threshold to be larger value.
13969 @item tracer-max-code-growth
13970 Stop tail duplication once code growth has reached given percentage. This is
13971 a rather artificial limit, as most of the duplicates are eliminated later in
13972 cross jumping, so it may be set to much higher values than is the desired code
13975 @item tracer-min-branch-ratio
13977 Stop reverse growth when the reverse probability of best edge is less than this
13978 threshold (in percent).
13980 @item tracer-min-branch-probability
13981 @itemx tracer-min-branch-probability-feedback
13983 Stop forward growth if the best edge has probability lower than this
13986 Similarly to @option{tracer-dynamic-coverage} two parameters are
13987 provided. @option{tracer-min-branch-probability-feedback} is used for
13988 compilation with profile feedback and @option{tracer-min-branch-probability}
13989 compilation without. The value for compilation with profile feedback
13990 needs to be more conservative (higher) in order to make tracer
13993 @item stack-clash-protection-guard-size
13994 Specify the size of the operating system provided stack guard as
13995 2 raised to @var{num} bytes. Higher values may reduce the
13996 number of explicit probes, but a value larger than the operating system
13997 provided guard will leave code vulnerable to stack clash style attacks.
13999 @item stack-clash-protection-probe-interval
14000 Stack clash protection involves probing stack space as it is allocated. This
14001 param controls the maximum distance between probes into the stack as 2 raised
14002 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
14003 larger than the operating system provided guard will leave code vulnerable to
14004 stack clash style attacks.
14006 @item max-cse-path-length
14008 The maximum number of basic blocks on path that CSE considers.
14010 @item max-cse-insns
14011 The maximum number of instructions CSE processes before flushing.
14013 @item ggc-min-expand
14015 GCC uses a garbage collector to manage its own memory allocation. This
14016 parameter specifies the minimum percentage by which the garbage
14017 collector's heap should be allowed to expand between collections.
14018 Tuning this may improve compilation speed; it has no effect on code
14021 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
14022 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
14023 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
14024 GCC is not able to calculate RAM on a particular platform, the lower
14025 bound of 30% is used. Setting this parameter and
14026 @option{ggc-min-heapsize} to zero causes a full collection to occur at
14027 every opportunity. This is extremely slow, but can be useful for
14030 @item ggc-min-heapsize
14032 Minimum size of the garbage collector's heap before it begins bothering
14033 to collect garbage. The first collection occurs after the heap expands
14034 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
14035 tuning this may improve compilation speed, and has no effect on code
14038 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
14039 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
14040 with a lower bound of 4096 (four megabytes) and an upper bound of
14041 131072 (128 megabytes). If GCC is not able to calculate RAM on a
14042 particular platform, the lower bound is used. Setting this parameter
14043 very large effectively disables garbage collection. Setting this
14044 parameter and @option{ggc-min-expand} to zero causes a full collection
14045 to occur at every opportunity.
14047 @item max-reload-search-insns
14048 The maximum number of instruction reload should look backward for equivalent
14049 register. Increasing values mean more aggressive optimization, making the
14050 compilation time increase with probably slightly better performance.
14052 @item max-cselib-memory-locations
14053 The maximum number of memory locations cselib should take into account.
14054 Increasing values mean more aggressive optimization, making the compilation time
14055 increase with probably slightly better performance.
14057 @item max-sched-ready-insns
14058 The maximum number of instructions ready to be issued the scheduler should
14059 consider at any given time during the first scheduling pass. Increasing
14060 values mean more thorough searches, making the compilation time increase
14061 with probably little benefit.
14063 @item max-sched-region-blocks
14064 The maximum number of blocks in a region to be considered for
14065 interblock scheduling.
14067 @item max-pipeline-region-blocks
14068 The maximum number of blocks in a region to be considered for
14069 pipelining in the selective scheduler.
14071 @item max-sched-region-insns
14072 The maximum number of insns in a region to be considered for
14073 interblock scheduling.
14075 @item max-pipeline-region-insns
14076 The maximum number of insns in a region to be considered for
14077 pipelining in the selective scheduler.
14079 @item min-spec-prob
14080 The minimum probability (in percents) of reaching a source block
14081 for interblock speculative scheduling.
14083 @item max-sched-extend-regions-iters
14084 The maximum number of iterations through CFG to extend regions.
14085 A value of 0 disables region extensions.
14087 @item max-sched-insn-conflict-delay
14088 The maximum conflict delay for an insn to be considered for speculative motion.
14090 @item sched-spec-prob-cutoff
14091 The minimal probability of speculation success (in percents), so that
14092 speculative insns are scheduled.
14094 @item sched-state-edge-prob-cutoff
14095 The minimum probability an edge must have for the scheduler to save its
14098 @item sched-mem-true-dep-cost
14099 Minimal distance (in CPU cycles) between store and load targeting same
14102 @item selsched-max-lookahead
14103 The maximum size of the lookahead window of selective scheduling. It is a
14104 depth of search for available instructions.
14106 @item selsched-max-sched-times
14107 The maximum number of times that an instruction is scheduled during
14108 selective scheduling. This is the limit on the number of iterations
14109 through which the instruction may be pipelined.
14111 @item selsched-insns-to-rename
14112 The maximum number of best instructions in the ready list that are considered
14113 for renaming in the selective scheduler.
14116 The minimum value of stage count that swing modulo scheduler
14119 @item max-last-value-rtl
14120 The maximum size measured as number of RTLs that can be recorded in an expression
14121 in combiner for a pseudo register as last known value of that register.
14123 @item max-combine-insns
14124 The maximum number of instructions the RTL combiner tries to combine.
14126 @item integer-share-limit
14127 Small integer constants can use a shared data structure, reducing the
14128 compiler's memory usage and increasing its speed. This sets the maximum
14129 value of a shared integer constant.
14131 @item ssp-buffer-size
14132 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
14133 protection when @option{-fstack-protection} is used.
14135 @item min-size-for-stack-sharing
14136 The minimum size of variables taking part in stack slot sharing when not
14139 @item max-jump-thread-duplication-stmts
14140 Maximum number of statements allowed in a block that needs to be
14141 duplicated when threading jumps.
14143 @item max-fields-for-field-sensitive
14144 Maximum number of fields in a structure treated in
14145 a field sensitive manner during pointer analysis.
14147 @item prefetch-latency
14148 Estimate on average number of instructions that are executed before
14149 prefetch finishes. The distance prefetched ahead is proportional
14150 to this constant. Increasing this number may also lead to less
14151 streams being prefetched (see @option{simultaneous-prefetches}).
14153 @item simultaneous-prefetches
14154 Maximum number of prefetches that can run at the same time.
14156 @item l1-cache-line-size
14157 The size of cache line in L1 data cache, in bytes.
14159 @item l1-cache-size
14160 The size of L1 data cache, in kilobytes.
14162 @item l2-cache-size
14163 The size of L2 data cache, in kilobytes.
14165 @item prefetch-dynamic-strides
14166 Whether the loop array prefetch pass should issue software prefetch hints
14167 for strides that are non-constant. In some cases this may be
14168 beneficial, though the fact the stride is non-constant may make it
14169 hard to predict when there is clear benefit to issuing these hints.
14171 Set to 1 if the prefetch hints should be issued for non-constant
14172 strides. Set to 0 if prefetch hints should be issued only for strides that
14173 are known to be constant and below @option{prefetch-minimum-stride}.
14175 @item prefetch-minimum-stride
14176 Minimum constant stride, in bytes, to start using prefetch hints for. If
14177 the stride is less than this threshold, prefetch hints will not be issued.
14179 This setting is useful for processors that have hardware prefetchers, in
14180 which case there may be conflicts between the hardware prefetchers and
14181 the software prefetchers. If the hardware prefetchers have a maximum
14182 stride they can handle, it should be used here to improve the use of
14183 software prefetchers.
14185 A value of -1 means we don't have a threshold and therefore
14186 prefetch hints can be issued for any constant stride.
14188 This setting is only useful for strides that are known and constant.
14190 @item destructive-interference-size
14191 @item constructive-interference-size
14192 The values for the C++17 variables
14193 @code{std::hardware_destructive_interference_size} and
14194 @code{std::hardware_constructive_interference_size}. The destructive
14195 interference size is the minimum recommended offset between two
14196 independent concurrently-accessed objects; the constructive
14197 interference size is the maximum recommended size of contiguous memory
14198 accessed together. Typically both will be the size of an L1 cache
14199 line for the target, in bytes. For a generic target covering a range of L1
14200 cache line sizes, typically the constructive interference size will be
14201 the small end of the range and the destructive size will be the large
14204 The destructive interference size is intended to be used for layout,
14205 and thus has ABI impact. The default value is not expected to be
14206 stable, and on some targets varies with @option{-mtune}, so use of
14207 this variable in a context where ABI stability is important, such as
14208 the public interface of a library, is strongly discouraged; if it is
14209 used in that context, users can stabilize the value using this
14212 The constructive interference size is less sensitive, as it is
14213 typically only used in a @samp{static_assert} to make sure that a type
14214 fits within a cache line.
14216 See also @option{-Winterference-size}.
14218 @item loop-interchange-max-num-stmts
14219 The maximum number of stmts in a loop to be interchanged.
14221 @item loop-interchange-stride-ratio
14222 The minimum ratio between stride of two loops for interchange to be profitable.
14224 @item min-insn-to-prefetch-ratio
14225 The minimum ratio between the number of instructions and the
14226 number of prefetches to enable prefetching in a loop.
14228 @item prefetch-min-insn-to-mem-ratio
14229 The minimum ratio between the number of instructions and the
14230 number of memory references to enable prefetching in a loop.
14232 @item use-canonical-types
14233 Whether the compiler should use the ``canonical'' type system.
14234 Should always be 1, which uses a more efficient internal
14235 mechanism for comparing types in C++ and Objective-C++. However, if
14236 bugs in the canonical type system are causing compilation failures,
14237 set this value to 0 to disable canonical types.
14239 @item switch-conversion-max-branch-ratio
14240 Switch initialization conversion refuses to create arrays that are
14241 bigger than @option{switch-conversion-max-branch-ratio} times the number of
14242 branches in the switch.
14244 @item max-partial-antic-length
14245 Maximum length of the partial antic set computed during the tree
14246 partial redundancy elimination optimization (@option{-ftree-pre}) when
14247 optimizing at @option{-O3} and above. For some sorts of source code
14248 the enhanced partial redundancy elimination optimization can run away,
14249 consuming all of the memory available on the host machine. This
14250 parameter sets a limit on the length of the sets that are computed,
14251 which prevents the runaway behavior. Setting a value of 0 for
14252 this parameter allows an unlimited set length.
14254 @item rpo-vn-max-loop-depth
14255 Maximum loop depth that is value-numbered optimistically.
14256 When the limit hits the innermost
14257 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
14258 loop nest are value-numbered optimistically and the remaining ones not.
14260 @item sccvn-max-alias-queries-per-access
14261 Maximum number of alias-oracle queries we perform when looking for
14262 redundancies for loads and stores. If this limit is hit the search
14263 is aborted and the load or store is not considered redundant. The
14264 number of queries is algorithmically limited to the number of
14265 stores on all paths from the load to the function entry.
14267 @item ira-max-loops-num
14268 IRA uses regional register allocation by default. If a function
14269 contains more loops than the number given by this parameter, only at most
14270 the given number of the most frequently-executed loops form regions
14271 for regional register allocation.
14273 @item ira-max-conflict-table-size
14274 Although IRA uses a sophisticated algorithm to compress the conflict
14275 table, the table can still require excessive amounts of memory for
14276 huge functions. If the conflict table for a function could be more
14277 than the size in MB given by this parameter, the register allocator
14278 instead uses a faster, simpler, and lower-quality
14279 algorithm that does not require building a pseudo-register conflict table.
14281 @item ira-loop-reserved-regs
14282 IRA can be used to evaluate more accurate register pressure in loops
14283 for decisions to move loop invariants (see @option{-O3}). The number
14284 of available registers reserved for some other purposes is given
14285 by this parameter. Default of the parameter
14286 is the best found from numerous experiments.
14288 @item ira-consider-dup-in-all-alts
14289 Make IRA to consider matching constraint (duplicated operand number)
14290 heavily in all available alternatives for preferred register class.
14291 If it is set as zero, it means IRA only respects the matching
14292 constraint when it's in the only available alternative with an
14293 appropriate register class. Otherwise, it means IRA will check all
14294 available alternatives for preferred register class even if it has
14295 found some choice with an appropriate register class and respect the
14296 found qualified matching constraint.
14298 @item lra-inheritance-ebb-probability-cutoff
14299 LRA tries to reuse values reloaded in registers in subsequent insns.
14300 This optimization is called inheritance. EBB is used as a region to
14301 do this optimization. The parameter defines a minimal fall-through
14302 edge probability in percentage used to add BB to inheritance EBB in
14303 LRA. The default value was chosen
14304 from numerous runs of SPEC2000 on x86-64.
14306 @item loop-invariant-max-bbs-in-loop
14307 Loop invariant motion can be very expensive, both in compilation time and
14308 in amount of needed compile-time memory, with very large loops. Loops
14309 with more basic blocks than this parameter won't have loop invariant
14310 motion optimization performed on them.
14312 @item loop-max-datarefs-for-datadeps
14313 Building data dependencies is expensive for very large loops. This
14314 parameter limits the number of data references in loops that are
14315 considered for data dependence analysis. These large loops are no
14316 handled by the optimizations using loop data dependencies.
14318 @item max-vartrack-size
14319 Sets a maximum number of hash table slots to use during variable
14320 tracking dataflow analysis of any function. If this limit is exceeded
14321 with variable tracking at assignments enabled, analysis for that
14322 function is retried without it, after removing all debug insns from
14323 the function. If the limit is exceeded even without debug insns, var
14324 tracking analysis is completely disabled for the function. Setting
14325 the parameter to zero makes it unlimited.
14327 @item max-vartrack-expr-depth
14328 Sets a maximum number of recursion levels when attempting to map
14329 variable names or debug temporaries to value expressions. This trades
14330 compilation time for more complete debug information. If this is set too
14331 low, value expressions that are available and could be represented in
14332 debug information may end up not being used; setting this higher may
14333 enable the compiler to find more complex debug expressions, but compile
14334 time and memory use may grow.
14336 @item max-debug-marker-count
14337 Sets a threshold on the number of debug markers (e.g.@: begin stmt
14338 markers) to avoid complexity explosion at inlining or expanding to RTL.
14339 If a function has more such gimple stmts than the set limit, such stmts
14340 will be dropped from the inlined copy of a function, and from its RTL
14343 @item min-nondebug-insn-uid
14344 Use uids starting at this parameter for nondebug insns. The range below
14345 the parameter is reserved exclusively for debug insns created by
14346 @option{-fvar-tracking-assignments}, but debug insns may get
14347 (non-overlapping) uids above it if the reserved range is exhausted.
14349 @item ipa-sra-ptr-growth-factor
14350 IPA-SRA replaces a pointer to an aggregate with one or more new
14351 parameters only when their cumulative size is less or equal to
14352 @option{ipa-sra-ptr-growth-factor} times the size of the original
14355 @item ipa-sra-max-replacements
14356 Maximum pieces of an aggregate that IPA-SRA tracks. As a
14357 consequence, it is also the maximum number of replacements of a formal
14360 @item sra-max-scalarization-size-Ospeed
14361 @itemx sra-max-scalarization-size-Osize
14362 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
14363 replace scalar parts of aggregates with uses of independent scalar
14364 variables. These parameters control the maximum size, in storage units,
14365 of aggregate which is considered for replacement when compiling for
14367 (@option{sra-max-scalarization-size-Ospeed}) or size
14368 (@option{sra-max-scalarization-size-Osize}) respectively.
14370 @item sra-max-propagations
14371 The maximum number of artificial accesses that Scalar Replacement of
14372 Aggregates (SRA) will track, per one local variable, in order to
14373 facilitate copy propagation.
14375 @item tm-max-aggregate-size
14376 When making copies of thread-local variables in a transaction, this
14377 parameter specifies the size in bytes after which variables are
14378 saved with the logging functions as opposed to save/restore code
14379 sequence pairs. This option only applies when using
14382 @item graphite-max-nb-scop-params
14383 To avoid exponential effects in the Graphite loop transforms, the
14384 number of parameters in a Static Control Part (SCoP) is bounded.
14385 A value of zero can be used to lift
14386 the bound. A variable whose value is unknown at compilation time and
14387 defined outside a SCoP is a parameter of the SCoP.
14389 @item loop-block-tile-size
14390 Loop blocking or strip mining transforms, enabled with
14391 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
14392 loop in the loop nest by a given number of iterations. The strip
14393 length can be changed using the @option{loop-block-tile-size}
14396 @item ipa-jump-function-lookups
14397 Specifies number of statements visited during jump function offset discovery.
14399 @item ipa-cp-value-list-size
14400 IPA-CP attempts to track all possible values and types passed to a function's
14401 parameter in order to propagate them and perform devirtualization.
14402 @option{ipa-cp-value-list-size} is the maximum number of values and types it
14403 stores per one formal parameter of a function.
14405 @item ipa-cp-eval-threshold
14406 IPA-CP calculates its own score of cloning profitability heuristics
14407 and performs those cloning opportunities with scores that exceed
14408 @option{ipa-cp-eval-threshold}.
14410 @item ipa-cp-max-recursive-depth
14411 Maximum depth of recursive cloning for self-recursive function.
14413 @item ipa-cp-min-recursive-probability
14414 Recursive cloning only when the probability of call being executed exceeds
14417 @item ipa-cp-profile-count-base
14418 When using @option{-fprofile-use} option, IPA-CP will consider the measured
14419 execution count of a call graph edge at this percentage position in their
14420 histogram as the basis for its heuristics calculation.
14422 @item ipa-cp-recursive-freq-factor
14423 The number of times interprocedural copy propagation expects recursive
14424 functions to call themselves.
14426 @item ipa-cp-recursion-penalty
14427 Percentage penalty the recursive functions will receive when they
14428 are evaluated for cloning.
14430 @item ipa-cp-single-call-penalty
14431 Percentage penalty functions containing a single call to another
14432 function will receive when they are evaluated for cloning.
14434 @item ipa-max-agg-items
14435 IPA-CP is also capable to propagate a number of scalar values passed
14436 in an aggregate. @option{ipa-max-agg-items} controls the maximum
14437 number of such values per one parameter.
14439 @item ipa-cp-loop-hint-bonus
14440 When IPA-CP determines that a cloning candidate would make the number
14441 of iterations of a loop known, it adds a bonus of
14442 @option{ipa-cp-loop-hint-bonus} to the profitability score of
14445 @item ipa-max-loop-predicates
14446 The maximum number of different predicates IPA will use to describe when
14447 loops in a function have known properties.
14449 @item ipa-max-aa-steps
14450 During its analysis of function bodies, IPA-CP employs alias analysis
14451 in order to track values pointed to by function parameters. In order
14452 not spend too much time analyzing huge functions, it gives up and
14453 consider all memory clobbered after examining
14454 @option{ipa-max-aa-steps} statements modifying memory.
14456 @item ipa-max-switch-predicate-bounds
14457 Maximal number of boundary endpoints of case ranges of switch statement.
14458 For switch exceeding this limit, IPA-CP will not construct cloning cost
14459 predicate, which is used to estimate cloning benefit, for default case
14460 of the switch statement.
14462 @item ipa-max-param-expr-ops
14463 IPA-CP will analyze conditional statement that references some function
14464 parameter to estimate benefit for cloning upon certain constant value.
14465 But if number of operations in a parameter expression exceeds
14466 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
14467 one, and is not handled by IPA analysis.
14469 @item lto-partitions
14470 Specify desired number of partitions produced during WHOPR compilation.
14471 The number of partitions should exceed the number of CPUs used for compilation.
14473 @item lto-min-partition
14474 Size of minimal partition for WHOPR (in estimated instructions).
14475 This prevents expenses of splitting very small programs into too many
14478 @item lto-max-partition
14479 Size of max partition for WHOPR (in estimated instructions).
14480 to provide an upper bound for individual size of partition.
14481 Meant to be used only with balanced partitioning.
14483 @item lto-max-streaming-parallelism
14484 Maximal number of parallel processes used for LTO streaming.
14486 @item cxx-max-namespaces-for-diagnostic-help
14487 The maximum number of namespaces to consult for suggestions when C++
14488 name lookup fails for an identifier.
14490 @item sink-frequency-threshold
14491 The maximum relative execution frequency (in percents) of the target block
14492 relative to a statement's original block to allow statement sinking of a
14493 statement. Larger numbers result in more aggressive statement sinking.
14494 A small positive adjustment is applied for
14495 statements with memory operands as those are even more profitable so sink.
14497 @item max-stores-to-sink
14498 The maximum number of conditional store pairs that can be sunk. Set to 0
14499 if either vectorization (@option{-ftree-vectorize}) or if-conversion
14500 (@option{-ftree-loop-if-convert}) is disabled.
14502 @item case-values-threshold
14503 The smallest number of different values for which it is best to use a
14504 jump-table instead of a tree of conditional branches. If the value is
14505 0, use the default for the machine.
14507 @item jump-table-max-growth-ratio-for-size
14508 The maximum code size growth ratio when expanding
14509 into a jump table (in percent). The parameter is used when
14510 optimizing for size.
14512 @item jump-table-max-growth-ratio-for-speed
14513 The maximum code size growth ratio when expanding
14514 into a jump table (in percent). The parameter is used when
14515 optimizing for speed.
14517 @item tree-reassoc-width
14518 Set the maximum number of instructions executed in parallel in
14519 reassociated tree. This parameter overrides target dependent
14520 heuristics used by default if has non zero value.
14522 @item sched-pressure-algorithm
14523 Choose between the two available implementations of
14524 @option{-fsched-pressure}. Algorithm 1 is the original implementation
14525 and is the more likely to prevent instructions from being reordered.
14526 Algorithm 2 was designed to be a compromise between the relatively
14527 conservative approach taken by algorithm 1 and the rather aggressive
14528 approach taken by the default scheduler. It relies more heavily on
14529 having a regular register file and accurate register pressure classes.
14530 See @file{haifa-sched.c} in the GCC sources for more details.
14532 The default choice depends on the target.
14534 @item max-slsr-cand-scan
14535 Set the maximum number of existing candidates that are considered when
14536 seeking a basis for a new straight-line strength reduction candidate.
14539 Enable buffer overflow detection for global objects. This kind
14540 of protection is enabled by default if you are using
14541 @option{-fsanitize=address} option.
14542 To disable global objects protection use @option{--param asan-globals=0}.
14545 Enable buffer overflow detection for stack objects. This kind of
14546 protection is enabled by default when using @option{-fsanitize=address}.
14547 To disable stack protection use @option{--param asan-stack=0} option.
14549 @item asan-instrument-reads
14550 Enable buffer overflow detection for memory reads. This kind of
14551 protection is enabled by default when using @option{-fsanitize=address}.
14552 To disable memory reads protection use
14553 @option{--param asan-instrument-reads=0}.
14555 @item asan-instrument-writes
14556 Enable buffer overflow detection for memory writes. This kind of
14557 protection is enabled by default when using @option{-fsanitize=address}.
14558 To disable memory writes protection use
14559 @option{--param asan-instrument-writes=0} option.
14561 @item asan-memintrin
14562 Enable detection for built-in functions. This kind of protection
14563 is enabled by default when using @option{-fsanitize=address}.
14564 To disable built-in functions protection use
14565 @option{--param asan-memintrin=0}.
14567 @item asan-use-after-return
14568 Enable detection of use-after-return. This kind of protection
14569 is enabled by default when using the @option{-fsanitize=address} option.
14570 To disable it use @option{--param asan-use-after-return=0}.
14572 Note: By default the check is disabled at run time. To enable it,
14573 add @code{detect_stack_use_after_return=1} to the environment variable
14574 @env{ASAN_OPTIONS}.
14576 @item asan-instrumentation-with-call-threshold
14577 If number of memory accesses in function being instrumented
14578 is greater or equal to this number, use callbacks instead of inline checks.
14579 E.g. to disable inline code use
14580 @option{--param asan-instrumentation-with-call-threshold=0}.
14582 @item hwasan-instrument-stack
14583 Enable hwasan instrumentation of statically sized stack-allocated variables.
14584 This kind of instrumentation is enabled by default when using
14585 @option{-fsanitize=hwaddress} and disabled by default when using
14586 @option{-fsanitize=kernel-hwaddress}.
14587 To disable stack instrumentation use
14588 @option{--param hwasan-instrument-stack=0}, and to enable it use
14589 @option{--param hwasan-instrument-stack=1}.
14591 @item hwasan-random-frame-tag
14592 When using stack instrumentation, decide tags for stack variables using a
14593 deterministic sequence beginning at a random tag for each frame. With this
14594 parameter unset tags are chosen using the same sequence but beginning from 1.
14595 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
14596 for @option{-fsanitize=kernel-hwaddress}.
14597 To disable it use @option{--param hwasan-random-frame-tag=0}.
14599 @item hwasan-instrument-allocas
14600 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
14601 This kind of instrumentation is enabled by default when using
14602 @option{-fsanitize=hwaddress} and disabled by default when using
14603 @option{-fsanitize=kernel-hwaddress}.
14604 To disable instrumentation of such variables use
14605 @option{--param hwasan-instrument-allocas=0}, and to enable it use
14606 @option{--param hwasan-instrument-allocas=1}.
14608 @item hwasan-instrument-reads
14609 Enable hwasan checks on memory reads. Instrumentation of reads is enabled by
14610 default for both @option{-fsanitize=hwaddress} and
14611 @option{-fsanitize=kernel-hwaddress}.
14612 To disable checking memory reads use
14613 @option{--param hwasan-instrument-reads=0}.
14615 @item hwasan-instrument-writes
14616 Enable hwasan checks on memory writes. Instrumentation of writes is enabled by
14617 default for both @option{-fsanitize=hwaddress} and
14618 @option{-fsanitize=kernel-hwaddress}.
14619 To disable checking memory writes use
14620 @option{--param hwasan-instrument-writes=0}.
14622 @item hwasan-instrument-mem-intrinsics
14623 Enable hwasan instrumentation of builtin functions. Instrumentation of these
14624 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
14625 and @option{-fsanitize=kernel-hwaddress}.
14626 To disable instrumentation of builtin functions use
14627 @option{--param hwasan-instrument-mem-intrinsics=0}.
14629 @item use-after-scope-direct-emission-threshold
14630 If the size of a local variable in bytes is smaller or equal to this
14631 number, directly poison (or unpoison) shadow memory instead of using
14632 run-time callbacks.
14634 @item tsan-distinguish-volatile
14635 Emit special instrumentation for accesses to volatiles.
14637 @item tsan-instrument-func-entry-exit
14638 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
14640 @item max-fsm-thread-path-insns
14641 Maximum number of instructions to copy when duplicating blocks on a
14642 finite state automaton jump thread path.
14644 @item max-fsm-thread-length
14645 Maximum number of basic blocks on a jump thread path.
14647 @item threader-debug
14648 threader-debug=[none|all] Enables verbose dumping of the threader solver.
14650 @item parloops-chunk-size
14651 Chunk size of omp schedule for loops parallelized by parloops.
14653 @item parloops-schedule
14654 Schedule type of omp schedule for loops parallelized by parloops (static,
14655 dynamic, guided, auto, runtime).
14657 @item parloops-min-per-thread
14658 The minimum number of iterations per thread of an innermost parallelized
14659 loop for which the parallelized variant is preferred over the single threaded
14660 one. Note that for a parallelized loop nest the
14661 minimum number of iterations of the outermost loop per thread is two.
14663 @item max-ssa-name-query-depth
14664 Maximum depth of recursion when querying properties of SSA names in things
14665 like fold routines. One level of recursion corresponds to following a
14668 @item max-speculative-devirt-maydefs
14669 The maximum number of may-defs we analyze when looking for a must-def
14670 specifying the dynamic type of an object that invokes a virtual call
14671 we may be able to devirtualize speculatively.
14673 @item max-vrp-switch-assertions
14674 The maximum number of assertions to add along the default edge of a switch
14675 statement during VRP.
14677 @item evrp-sparse-threshold
14678 Maximum number of basic blocks before EVRP uses a sparse cache.
14681 Specifies the mode Early VRP should operate in.
14684 Specifies the mode VRP pass 1 should operate in.
14687 Specifies the mode VRP pass 2 should operate in.
14690 Specifies the type of debug output to be issued for ranges.
14692 @item evrp-switch-limit
14693 Specifies the maximum number of switch cases before EVRP ignores a switch.
14695 @item unroll-jam-min-percent
14696 The minimum percentage of memory references that must be optimized
14697 away for the unroll-and-jam transformation to be considered profitable.
14699 @item unroll-jam-max-unroll
14700 The maximum number of times the outer loop should be unrolled by
14701 the unroll-and-jam transformation.
14703 @item max-rtl-if-conversion-unpredictable-cost
14704 Maximum permissible cost for the sequence that would be generated
14705 by the RTL if-conversion pass for a branch that is considered unpredictable.
14707 @item max-variable-expansions-in-unroller
14708 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
14709 of times that an individual variable will be expanded during loop unrolling.
14711 @item tracer-min-branch-probability-feedback
14712 Stop forward growth if the probability of best edge is less than
14713 this threshold (in percent). Used when profile feedback is available.
14715 @item partial-inlining-entry-probability
14716 Maximum probability of the entry BB of split region
14717 (in percent relative to entry BB of the function)
14718 to make partial inlining happen.
14720 @item max-tracked-strlens
14721 Maximum number of strings for which strlen optimization pass will
14722 track string lengths.
14724 @item gcse-after-reload-partial-fraction
14725 The threshold ratio for performing partial redundancy
14726 elimination after reload.
14728 @item gcse-after-reload-critical-fraction
14729 The threshold ratio of critical edges execution count that
14730 permit performing redundancy elimination after reload.
14732 @item max-loop-header-insns
14733 The maximum number of insns in loop header duplicated
14734 by the copy loop headers pass.
14736 @item vect-epilogues-nomask
14737 Enable loop epilogue vectorization using smaller vector size.
14739 @item vect-partial-vector-usage
14740 Controls when the loop vectorizer considers using partial vector loads
14741 and stores as an alternative to falling back to scalar code. 0 stops
14742 the vectorizer from ever using partial vector loads and stores. 1 allows
14743 partial vector loads and stores if vectorization removes the need for the
14744 code to iterate. 2 allows partial vector loads and stores in all loops.
14745 The parameter only has an effect on targets that support partial
14746 vector loads and stores.
14748 @item vect-inner-loop-cost-factor
14749 The maximum factor which the loop vectorizer applies to the cost of statements
14750 in an inner loop relative to the loop being vectorized. The factor applied
14751 is the maximum of the estimated number of iterations of the inner loop and
14752 this parameter. The default value of this parameter is 50.
14754 @item avoid-fma-max-bits
14755 Maximum number of bits for which we avoid creating FMAs.
14757 @item sms-loop-average-count-threshold
14758 A threshold on the average loop count considered by the swing modulo scheduler.
14760 @item sms-dfa-history
14761 The number of cycles the swing modulo scheduler considers when checking
14762 conflicts using DFA.
14764 @item max-inline-insns-recursive-auto
14765 The maximum number of instructions non-inline function
14766 can grow to via recursive inlining.
14768 @item graphite-allow-codegen-errors
14769 Whether codegen errors should be ICEs when @option{-fchecking}.
14771 @item sms-max-ii-factor
14772 A factor for tuning the upper bound that swing modulo scheduler
14773 uses for scheduling a loop.
14775 @item lra-max-considered-reload-pseudos
14776 The max number of reload pseudos which are considered during
14777 spilling a non-reload pseudo.
14779 @item max-pow-sqrt-depth
14780 Maximum depth of sqrt chains to use when synthesizing exponentiation
14781 by a real constant.
14783 @item max-dse-active-local-stores
14784 Maximum number of active local stores in RTL dead store elimination.
14786 @item asan-instrument-allocas
14787 Enable asan allocas/VLAs protection.
14789 @item max-iterations-computation-cost
14790 Bound on the cost of an expression to compute the number of iterations.
14792 @item max-isl-operations
14793 Maximum number of isl operations, 0 means unlimited.
14795 @item graphite-max-arrays-per-scop
14796 Maximum number of arrays per scop.
14798 @item max-vartrack-reverse-op-size
14799 Max. size of loc list for which reverse ops should be added.
14801 @item tracer-dynamic-coverage-feedback
14802 The percentage of function, weighted by execution frequency,
14803 that must be covered by trace formation.
14804 Used when profile feedback is available.
14806 @item max-inline-recursive-depth-auto
14807 The maximum depth of recursive inlining for non-inline functions.
14809 @item fsm-scale-path-stmts
14810 Scale factor to apply to the number of statements in a threading path
14811 when comparing to the number of (scaled) blocks.
14813 @item uninit-control-dep-attempts
14814 Maximum number of nested calls to search for control dependencies
14815 during uninitialized variable analysis.
14817 @item sra-max-scalarization-size-Osize
14818 Maximum size, in storage units, of an aggregate
14819 which should be considered for scalarization when compiling for size.
14821 @item fsm-scale-path-blocks
14822 Scale factor to apply to the number of blocks in a threading path
14823 when comparing to the number of (scaled) statements.
14825 @item sched-autopref-queue-depth
14826 Hardware autoprefetcher scheduler model control flag.
14827 Number of lookahead cycles the model looks into; at '
14828 ' only enable instruction sorting heuristic.
14830 @item loop-versioning-max-inner-insns
14831 The maximum number of instructions that an inner loop can have
14832 before the loop versioning pass considers it too big to copy.
14834 @item loop-versioning-max-outer-insns
14835 The maximum number of instructions that an outer loop can have
14836 before the loop versioning pass considers it too big to copy,
14837 discounting any instructions in inner loops that directly benefit
14840 @item ssa-name-def-chain-limit
14841 The maximum number of SSA_NAME assignments to follow in determining
14842 a property of a variable such as its value. This limits the number
14843 of iterations or recursive calls GCC performs when optimizing certain
14844 statements or when determining their validity prior to issuing
14847 @item store-merging-max-size
14848 Maximum size of a single store merging region in bytes.
14850 @item hash-table-verification-limit
14851 The number of elements for which hash table verification is done
14852 for each searched element.
14854 @item max-find-base-term-values
14855 Maximum number of VALUEs handled during a single find_base_term call.
14857 @item analyzer-max-enodes-per-program-point
14858 The maximum number of exploded nodes per program point within
14859 the analyzer, before terminating analysis of that point.
14861 @item analyzer-max-constraints
14862 The maximum number of constraints per state.
14864 @item analyzer-min-snodes-for-call-summary
14865 The minimum number of supernodes within a function for the
14866 analyzer to consider summarizing its effects at call sites.
14868 @item analyzer-max-enodes-for-full-dump
14869 The maximum depth of exploded nodes that should appear in a dot dump
14870 before switching to a less verbose format.
14872 @item analyzer-max-recursion-depth
14873 The maximum number of times a callsite can appear in a call stack
14874 within the analyzer, before terminating analysis of a call that would
14877 @item analyzer-max-svalue-depth
14878 The maximum depth of a symbolic value, before approximating
14879 the value as unknown.
14881 @item analyzer-max-infeasible-edges
14882 The maximum number of infeasible edges to reject before declaring
14883 a diagnostic as infeasible.
14885 @item gimple-fe-computed-hot-bb-threshold
14886 The number of executions of a basic block which is considered hot.
14887 The parameter is used only in GIMPLE FE.
14889 @item analyzer-bb-explosion-factor
14890 The maximum number of 'after supernode' exploded nodes within the analyzer
14891 per supernode, before terminating analysis.
14893 @item ranger-logical-depth
14894 Maximum depth of logical expression evaluation ranger will look through
14895 when evaluating outgoing edge ranges.
14897 @item openacc-kernels
14898 Specify mode of OpenACC `kernels' constructs handling.
14899 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
14900 constructs are decomposed into parts, a sequence of compute
14901 constructs, each then handled individually.
14902 This is work in progress.
14903 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
14904 constructs are handled by the @samp{parloops} pass, en bloc.
14905 This is the current default.
14907 @item openacc-privatization
14908 Specify mode of OpenACC privatization diagnostics for
14909 @option{-fopt-info-omp-note} and applicable
14910 @option{-fdump-tree-*-details}.
14911 With @option{--param=openacc-privatization=quiet}, don't diagnose.
14912 This is the current default.
14913 With @option{--param=openacc-privatization=noisy}, do diagnose.
14917 The following choices of @var{name} are available on AArch64 targets:
14920 @item aarch64-sve-compare-costs
14921 When vectorizing for SVE, consider using ``unpacked'' vectors for
14922 smaller elements and use the cost model to pick the cheapest approach.
14923 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
14925 Using unpacked vectors includes storing smaller elements in larger
14926 containers and accessing elements with extending loads and truncating
14929 @item aarch64-float-recp-precision
14930 The number of Newton iterations for calculating the reciprocal for float type.
14931 The precision of division is proportional to this param when division
14932 approximation is enabled. The default value is 1.
14934 @item aarch64-double-recp-precision
14935 The number of Newton iterations for calculating the reciprocal for double type.
14936 The precision of division is propotional to this param when division
14937 approximation is enabled. The default value is 2.
14939 @item aarch64-autovec-preference
14940 Force an ISA selection strategy for auto-vectorization. Accepts values from
14944 Use the default heuristics.
14946 Use only Advanced SIMD for auto-vectorization.
14948 Use only SVE for auto-vectorization.
14950 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are
14953 Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal.
14955 The default value is 0.
14957 @item aarch64-loop-vect-issue-rate-niters
14958 The tuning for some AArch64 CPUs tries to take both latencies and issue
14959 rates into account when deciding whether a loop should be vectorized
14960 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
14961 If this parameter is set to @var{n}, GCC will not use this heuristic
14962 for loops that are known to execute in fewer than @var{n} Advanced
14969 @node Instrumentation Options
14970 @section Program Instrumentation Options
14971 @cindex instrumentation options
14972 @cindex program instrumentation options
14973 @cindex run-time error checking options
14974 @cindex profiling options
14975 @cindex options, program instrumentation
14976 @cindex options, run-time error checking
14977 @cindex options, profiling
14979 GCC supports a number of command-line options that control adding
14980 run-time instrumentation to the code it normally generates.
14981 For example, one purpose of instrumentation is collect profiling
14982 statistics for use in finding program hot spots, code coverage
14983 analysis, or profile-guided optimizations.
14984 Another class of program instrumentation is adding run-time checking
14985 to detect programming errors like invalid pointer
14986 dereferences or out-of-bounds array accesses, as well as deliberately
14987 hostile attacks such as stack smashing or C++ vtable hijacking.
14988 There is also a general hook which can be used to implement other
14989 forms of tracing or function-level instrumentation for debug or
14990 program analysis purposes.
14993 @cindex @command{prof}
14994 @cindex @command{gprof}
14999 Generate extra code to write profile information suitable for the
15000 analysis program @command{prof} (for @option{-p}) or @command{gprof}
15001 (for @option{-pg}). You must use this option when compiling
15002 the source files you want data about, and you must also use it when
15005 You can use the function attribute @code{no_instrument_function} to
15006 suppress profiling of individual functions when compiling with these options.
15007 @xref{Common Function Attributes}.
15009 @item -fprofile-arcs
15010 @opindex fprofile-arcs
15011 Add code so that program flow @dfn{arcs} are instrumented. During
15012 execution the program records how many times each branch and call is
15013 executed and how many times it is taken or returns. On targets that support
15014 constructors with priority support, profiling properly handles constructors,
15015 destructors and C++ constructors (and destructors) of classes which are used
15016 as a type of a global variable.
15019 program exits it saves this data to a file called
15020 @file{@var{auxname}.gcda} for each source file. The data may be used for
15021 profile-directed optimizations (@option{-fbranch-probabilities}), or for
15022 test coverage analysis (@option{-ftest-coverage}). Each object file's
15023 @var{auxname} is generated from the name of the output file, if
15024 explicitly specified and it is not the final executable, otherwise it is
15025 the basename of the source file. In both cases any suffix is removed
15026 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
15027 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
15028 @xref{Cross-profiling}.
15030 @cindex @command{gcov}
15034 This option is used to compile and link code instrumented for coverage
15035 analysis. The option is a synonym for @option{-fprofile-arcs}
15036 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
15037 linking). See the documentation for those options for more details.
15042 Compile the source files with @option{-fprofile-arcs} plus optimization
15043 and code generation options. For test coverage analysis, use the
15044 additional @option{-ftest-coverage} option. You do not need to profile
15045 every source file in a program.
15048 Compile the source files additionally with @option{-fprofile-abs-path}
15049 to create absolute path names in the @file{.gcno} files. This allows
15050 @command{gcov} to find the correct sources in projects where compilations
15051 occur with different working directories.
15054 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
15055 (the latter implies the former).
15058 Run the program on a representative workload to generate the arc profile
15059 information. This may be repeated any number of times. You can run
15060 concurrent instances of your program, and provided that the file system
15061 supports locking, the data files will be correctly updated. Unless
15062 a strict ISO C dialect option is in effect, @code{fork} calls are
15063 detected and correctly handled without double counting.
15065 Moreover, an object file can be recompiled multiple times
15066 and the corresponding @file{.gcda} file merges as long as
15067 the source file and the compiler options are unchanged.
15070 For profile-directed optimizations, compile the source files again with
15071 the same optimization and code generation options plus
15072 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
15073 Control Optimization}).
15076 For test coverage analysis, use @command{gcov} to produce human readable
15077 information from the @file{.gcno} and @file{.gcda} files. Refer to the
15078 @command{gcov} documentation for further information.
15082 With @option{-fprofile-arcs}, for each function of your program GCC
15083 creates a program flow graph, then finds a spanning tree for the graph.
15084 Only arcs that are not on the spanning tree have to be instrumented: the
15085 compiler adds code to count the number of times that these arcs are
15086 executed. When an arc is the only exit or only entrance to a block, the
15087 instrumentation code can be added to the block; otherwise, a new basic
15088 block must be created to hold the instrumentation code.
15091 @item -ftest-coverage
15092 @opindex ftest-coverage
15093 Produce a notes file that the @command{gcov} code-coverage utility
15094 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
15095 show program coverage. Each source file's note file is called
15096 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
15097 above for a description of @var{auxname} and instructions on how to
15098 generate test coverage data. Coverage data matches the source files
15099 more closely if you do not optimize.
15101 @item -fprofile-abs-path
15102 @opindex fprofile-abs-path
15103 Automatically convert relative source file names to absolute path names
15104 in the @file{.gcno} files. This allows @command{gcov} to find the correct
15105 sources in projects where compilations occur with different working
15108 @item -fprofile-dir=@var{path}
15109 @opindex fprofile-dir
15111 Set the directory to search for the profile data files in to @var{path}.
15112 This option affects only the profile data generated by
15113 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
15114 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
15115 and its related options. Both absolute and relative paths can be used.
15116 By default, GCC uses the current directory as @var{path}, thus the
15117 profile data file appears in the same directory as the object file.
15118 In order to prevent the file name clashing, if the object file name is
15119 not an absolute path, we mangle the absolute path of the
15120 @file{@var{sourcename}.gcda} file and use it as the file name of a
15121 @file{.gcda} file. See similar option @option{-fprofile-note}.
15123 When an executable is run in a massive parallel environment, it is recommended
15124 to save profile to different folders. That can be done with variables
15125 in @var{path} that are exported during run-time:
15133 value of environment variable @var{VAR}
15137 @item -fprofile-generate
15138 @itemx -fprofile-generate=@var{path}
15139 @opindex fprofile-generate
15141 Enable options usually used for instrumenting application to produce
15142 profile useful for later recompilation with profile feedback based
15143 optimization. You must use @option{-fprofile-generate} both when
15144 compiling and when linking your program.
15146 The following options are enabled:
15147 @option{-fprofile-arcs}, @option{-fprofile-values},
15148 @option{-finline-functions}, and @option{-fipa-bit-cp}.
15150 If @var{path} is specified, GCC looks at the @var{path} to find
15151 the profile feedback data files. See @option{-fprofile-dir}.
15153 To optimize the program based on the collected profile information, use
15154 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
15156 @item -fprofile-info-section
15157 @itemx -fprofile-info-section=@var{name}
15158 @opindex fprofile-info-section
15160 Register the profile information in the specified section instead of using a
15161 constructor/destructor. The section name is @var{name} if it is specified,
15162 otherwise the section name defaults to @code{.gcov_info}. A pointer to the
15163 profile information generated by @option{-fprofile-arcs} is placed in the
15164 specified section for each translation unit. This option disables the profile
15165 information registration through a constructor and it disables the profile
15166 information processing through a destructor. This option is not intended to be
15167 used in hosted environments such as GNU/Linux. It targets free-standing
15168 environments (for example embedded systems) with limited resources which do not
15169 support constructors/destructors or the C library file I/O.
15171 The linker could collect the input sections in a continuous memory block and
15172 define start and end symbols. A GNU linker script example which defines a
15173 linker output section follows:
15178 PROVIDE (__gcov_info_start = .);
15179 KEEP (*(.gcov_info))
15180 PROVIDE (__gcov_info_end = .);
15184 The program could dump the profiling information registered in this linker set
15185 for example like this:
15190 #include <stdlib.h>
15192 extern const struct gcov_info *__gcov_info_start[];
15193 extern const struct gcov_info *__gcov_info_end[];
15196 filename (const char *f, void *arg)
15202 dump (const void *d, unsigned n, void *arg)
15204 const unsigned char *c = d;
15206 for (unsigned i = 0; i < n; ++i)
15207 printf ("%02x", c[i]);
15211 allocate (unsigned length, void *arg)
15213 return malloc (length);
15217 dump_gcov_info (void)
15219 const struct gcov_info **info = __gcov_info_start;
15220 const struct gcov_info **end = __gcov_info_end;
15222 /* Obfuscate variable to prevent compiler optimizations. */
15223 __asm__ ("" : "+r" (info));
15225 while (info != end)
15228 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
15242 @item -fprofile-note=@var{path}
15243 @opindex fprofile-note
15245 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
15246 location. If you combine the option with multiple source files,
15247 the @file{.gcno} file will be overwritten.
15249 @item -fprofile-prefix-path=@var{path}
15250 @opindex fprofile-prefix-path
15252 This option can be used in combination with
15253 @option{profile-generate=}@var{profile_dir} and
15254 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
15255 directory of built source tree. By default @var{profile_dir} will contain
15256 files with mangled absolute paths of all object files in the built project.
15257 This is not desirable when directory used to build the instrumented binary
15258 differs from the directory used to build the binary optimized with profile
15259 feedback because the profile data will not be found during the optimized build.
15260 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
15261 pointing to the base directory of the build can be used to strip the irrelevant
15262 part of the path and keep all file names relative to the main build directory.
15264 @item -fprofile-update=@var{method}
15265 @opindex fprofile-update
15267 Alter the update method for an application instrumented for profile
15268 feedback based optimization. The @var{method} argument should be one of
15269 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
15270 The first one is useful for single-threaded applications,
15271 while the second one prevents profile corruption by emitting thread-safe code.
15273 @strong{Warning:} When an application does not properly join all threads
15274 (or creates an detached thread), a profile file can be still corrupted.
15276 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
15277 when supported by a target, or to @samp{single} otherwise. The GCC driver
15278 automatically selects @samp{prefer-atomic} when @option{-pthread}
15279 is present in the command line.
15281 @item -fprofile-filter-files=@var{regex}
15282 @opindex fprofile-filter-files
15284 Instrument only functions from files whose name matches
15285 any of the regular expressions (separated by semi-colons).
15287 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
15288 only @file{main.c} and all C files starting with 'module'.
15290 @item -fprofile-exclude-files=@var{regex}
15291 @opindex fprofile-exclude-files
15293 Instrument only functions from files whose name does not match
15294 any of the regular expressions (separated by semi-colons).
15296 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
15297 of all files that are located in the @file{/usr/} folder.
15299 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
15300 @opindex fprofile-reproducible
15301 Control level of reproducibility of profile gathered by
15302 @code{-fprofile-generate}. This makes it possible to rebuild program
15303 with same outcome which is useful, for example, for distribution
15306 With @option{-fprofile-reproducible=serial} the profile gathered by
15307 @option{-fprofile-generate} is reproducible provided the trained program
15308 behaves the same at each invocation of the train run, it is not
15309 multi-threaded and profile data streaming is always done in the same
15310 order. Note that profile streaming happens at the end of program run but
15311 also before @code{fork} function is invoked.
15313 Note that it is quite common that execution counts of some part of
15314 programs depends, for example, on length of temporary file names or
15315 memory space randomization (that may affect hash-table collision rate).
15316 Such non-reproducible part of programs may be annotated by
15317 @code{no_instrument_function} function attribute. @command{gcov-dump} with
15318 @option{-l} can be used to dump gathered data and verify that they are
15319 indeed reproducible.
15321 With @option{-fprofile-reproducible=parallel-runs} collected profile
15322 stays reproducible regardless the order of streaming of the data into
15323 gcda files. This setting makes it possible to run multiple instances of
15324 instrumented program in parallel (such as with @code{make -j}). This
15325 reduces quality of gathered data, in particular of indirect call
15328 @item -fsanitize=address
15329 @opindex fsanitize=address
15330 Enable AddressSanitizer, a fast memory error detector.
15331 Memory access instructions are instrumented to detect
15332 out-of-bounds and use-after-free bugs.
15333 The option enables @option{-fsanitize-address-use-after-scope}.
15334 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
15335 more details. The run-time behavior can be influenced using the
15336 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
15337 the available options are shown at startup of the instrumented program. See
15338 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
15339 for a list of supported options.
15340 The option cannot be combined with @option{-fsanitize=thread} or
15341 @option{-fsanitize=hwaddress}. Note that the only target
15342 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
15344 @item -fsanitize=kernel-address
15345 @opindex fsanitize=kernel-address
15346 Enable AddressSanitizer for Linux kernel.
15347 See @uref{https://github.com/google/kasan} for more details.
15349 @item -fsanitize=hwaddress
15350 @opindex fsanitize=hwaddress
15351 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
15352 ignore the top byte of a pointer to allow the detection of memory errors with
15353 a low memory overhead.
15354 Memory access instructions are instrumented to detect out-of-bounds and
15355 use-after-free bugs.
15356 The option enables @option{-fsanitize-address-use-after-scope}.
15358 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
15359 for more details. The run-time behavior can be influenced using the
15360 @env{HWASAN_OPTIONS} environment variable. When set to @code{help=1},
15361 the available options are shown at startup of the instrumented program.
15362 The option cannot be combined with @option{-fsanitize=thread} or
15363 @option{-fsanitize=address}, and is currently only available on AArch64.
15365 @item -fsanitize=kernel-hwaddress
15366 @opindex fsanitize=kernel-hwaddress
15367 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
15368 Similar to @option{-fsanitize=kernel-address} but using an alternate
15369 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
15370 instrumentation differences necessary for compiling the Linux kernel.
15371 These differences are to avoid hwasan library initialization calls and to
15372 account for the stack pointer having a different value in its top byte.
15374 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
15375 Instrumenting the stack and alloca calls are not on by default but are still
15376 possible by specifying the command-line options
15377 @option{--param hwasan-instrument-stack=1} and
15378 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
15379 tag is not implemented for kernel instrumentation.
15381 @item -fsanitize=pointer-compare
15382 @opindex fsanitize=pointer-compare
15383 Instrument comparison operation (<, <=, >, >=) with pointer operands.
15384 The option must be combined with either @option{-fsanitize=kernel-address} or
15385 @option{-fsanitize=address}
15386 The option cannot be combined with @option{-fsanitize=thread}.
15387 Note: By default the check is disabled at run time. To enable it,
15388 add @code{detect_invalid_pointer_pairs=2} to the environment variable
15389 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
15390 invalid operation only when both pointers are non-null.
15392 @item -fsanitize=pointer-subtract
15393 @opindex fsanitize=pointer-subtract
15394 Instrument subtraction with pointer operands.
15395 The option must be combined with either @option{-fsanitize=kernel-address} or
15396 @option{-fsanitize=address}
15397 The option cannot be combined with @option{-fsanitize=thread}.
15398 Note: By default the check is disabled at run time. To enable it,
15399 add @code{detect_invalid_pointer_pairs=2} to the environment variable
15400 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
15401 invalid operation only when both pointers are non-null.
15403 @item -fsanitize=thread
15404 @opindex fsanitize=thread
15405 Enable ThreadSanitizer, a fast data race detector.
15406 Memory access instructions are instrumented to detect
15407 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
15408 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
15409 environment variable; see
15410 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
15412 The option cannot be combined with @option{-fsanitize=address},
15413 @option{-fsanitize=leak}.
15415 Note that sanitized atomic builtins cannot throw exceptions when
15416 operating on invalid memory addresses with non-call exceptions
15417 (@option{-fnon-call-exceptions}).
15419 @item -fsanitize=leak
15420 @opindex fsanitize=leak
15421 Enable LeakSanitizer, a memory leak detector.
15422 This option only matters for linking of executables and
15423 the executable is linked against a library that overrides @code{malloc}
15424 and other allocator functions. See
15425 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
15426 details. The run-time behavior can be influenced using the
15427 @env{LSAN_OPTIONS} environment variable.
15428 The option cannot be combined with @option{-fsanitize=thread}.
15430 @item -fsanitize=undefined
15431 @opindex fsanitize=undefined
15432 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
15433 Various computations are instrumented to detect undefined behavior
15434 at runtime. See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details. The run-time behavior can be influenced using the
15435 @env{UBSAN_OPTIONS} environment variable. Current suboptions are:
15439 @item -fsanitize=shift
15440 @opindex fsanitize=shift
15441 This option enables checking that the result of a shift operation is
15442 not undefined. Note that what exactly is considered undefined differs
15443 slightly between C and C++, as well as between ISO C90 and C99, etc.
15444 This option has two suboptions, @option{-fsanitize=shift-base} and
15445 @option{-fsanitize=shift-exponent}.
15447 @item -fsanitize=shift-exponent
15448 @opindex fsanitize=shift-exponent
15449 This option enables checking that the second argument of a shift operation
15450 is not negative and is smaller than the precision of the promoted first
15453 @item -fsanitize=shift-base
15454 @opindex fsanitize=shift-base
15455 If the second argument of a shift operation is within range, check that the
15456 result of a shift operation is not undefined. Note that what exactly is
15457 considered undefined differs slightly between C and C++, as well as between
15458 ISO C90 and C99, etc.
15460 @item -fsanitize=integer-divide-by-zero
15461 @opindex fsanitize=integer-divide-by-zero
15462 Detect integer division by zero.
15464 @item -fsanitize=unreachable
15465 @opindex fsanitize=unreachable
15466 With this option, the compiler turns the @code{__builtin_unreachable}
15467 call into a diagnostics message call instead. When reaching the
15468 @code{__builtin_unreachable} call, the behavior is undefined.
15470 @item -fsanitize=vla-bound
15471 @opindex fsanitize=vla-bound
15472 This option instructs the compiler to check that the size of a variable
15473 length array is positive.
15475 @item -fsanitize=null
15476 @opindex fsanitize=null
15477 This option enables pointer checking. Particularly, the application
15478 built with this option turned on will issue an error message when it
15479 tries to dereference a NULL pointer, or if a reference (possibly an
15480 rvalue reference) is bound to a NULL pointer, or if a method is invoked
15481 on an object pointed by a NULL pointer.
15483 @item -fsanitize=return
15484 @opindex fsanitize=return
15485 This option enables return statement checking. Programs
15486 built with this option turned on will issue an error message
15487 when the end of a non-void function is reached without actually
15488 returning a value. This option works in C++ only.
15490 @item -fsanitize=signed-integer-overflow
15491 @opindex fsanitize=signed-integer-overflow
15492 This option enables signed integer overflow checking. We check that
15493 the result of @code{+}, @code{*}, and both unary and binary @code{-}
15494 does not overflow in the signed arithmetics. This also detects
15495 @code{INT_MIN / -1} signed division. Note, integer promotion
15496 rules must be taken into account. That is, the following is not an
15499 signed char a = SCHAR_MAX;
15503 @item -fsanitize=bounds
15504 @opindex fsanitize=bounds
15505 This option enables instrumentation of array bounds. Various out of bounds
15506 accesses are detected. Flexible array members, flexible array member-like
15507 arrays, and initializers of variables with static storage are not instrumented.
15509 @item -fsanitize=bounds-strict
15510 @opindex fsanitize=bounds-strict
15511 This option enables strict instrumentation of array bounds. Most out of bounds
15512 accesses are detected, including flexible array members and flexible array
15513 member-like arrays. Initializers of variables with static storage are not
15516 @item -fsanitize=alignment
15517 @opindex fsanitize=alignment
15519 This option enables checking of alignment of pointers when they are
15520 dereferenced, or when a reference is bound to insufficiently aligned target,
15521 or when a method or constructor is invoked on insufficiently aligned object.
15523 @item -fsanitize=object-size
15524 @opindex fsanitize=object-size
15525 This option enables instrumentation of memory references using the
15526 @code{__builtin_object_size} function. Various out of bounds pointer
15527 accesses are detected.
15529 @item -fsanitize=float-divide-by-zero
15530 @opindex fsanitize=float-divide-by-zero
15531 Detect floating-point division by zero. Unlike other similar options,
15532 @option{-fsanitize=float-divide-by-zero} is not enabled by
15533 @option{-fsanitize=undefined}, since floating-point division by zero can
15534 be a legitimate way of obtaining infinities and NaNs.
15536 @item -fsanitize=float-cast-overflow
15537 @opindex fsanitize=float-cast-overflow
15538 This option enables floating-point type to integer conversion checking.
15539 We check that the result of the conversion does not overflow.
15540 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
15541 not enabled by @option{-fsanitize=undefined}.
15542 This option does not work well with @code{FE_INVALID} exceptions enabled.
15544 @item -fsanitize=nonnull-attribute
15545 @opindex fsanitize=nonnull-attribute
15547 This option enables instrumentation of calls, checking whether null values
15548 are not passed to arguments marked as requiring a non-null value by the
15549 @code{nonnull} function attribute.
15551 @item -fsanitize=returns-nonnull-attribute
15552 @opindex fsanitize=returns-nonnull-attribute
15554 This option enables instrumentation of return statements in functions
15555 marked with @code{returns_nonnull} function attribute, to detect returning
15556 of null values from such functions.
15558 @item -fsanitize=bool
15559 @opindex fsanitize=bool
15561 This option enables instrumentation of loads from bool. If a value other
15562 than 0/1 is loaded, a run-time error is issued.
15564 @item -fsanitize=enum
15565 @opindex fsanitize=enum
15567 This option enables instrumentation of loads from an enum type. If
15568 a value outside the range of values for the enum type is loaded,
15569 a run-time error is issued.
15571 @item -fsanitize=vptr
15572 @opindex fsanitize=vptr
15574 This option enables instrumentation of C++ member function calls, member
15575 accesses and some conversions between pointers to base and derived classes,
15576 to verify the referenced object has the correct dynamic type.
15578 @item -fsanitize=pointer-overflow
15579 @opindex fsanitize=pointer-overflow
15581 This option enables instrumentation of pointer arithmetics. If the pointer
15582 arithmetics overflows, a run-time error is issued.
15584 @item -fsanitize=builtin
15585 @opindex fsanitize=builtin
15587 This option enables instrumentation of arguments to selected builtin
15588 functions. If an invalid value is passed to such arguments, a run-time
15589 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
15590 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
15595 While @option{-ftrapv} causes traps for signed overflows to be emitted,
15596 @option{-fsanitize=undefined} gives a diagnostic message.
15597 This currently works only for the C family of languages.
15599 @item -fno-sanitize=all
15600 @opindex fno-sanitize=all
15602 This option disables all previously enabled sanitizers.
15603 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
15606 @item -fasan-shadow-offset=@var{number}
15607 @opindex fasan-shadow-offset
15608 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
15609 It is useful for experimenting with different shadow memory layouts in
15610 Kernel AddressSanitizer.
15612 @item -fsanitize-sections=@var{s1},@var{s2},...
15613 @opindex fsanitize-sections
15614 Sanitize global variables in selected user-defined sections. @var{si} may
15617 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
15618 @opindex fsanitize-recover
15619 @opindex fno-sanitize-recover
15620 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
15621 mentioned in comma-separated list of @var{opts}. Enabling this option
15622 for a sanitizer component causes it to attempt to continue
15623 running the program as if no error happened. This means multiple
15624 runtime errors can be reported in a single program run, and the exit
15625 code of the program may indicate success even when errors
15626 have been reported. The @option{-fno-sanitize-recover=} option
15627 can be used to alter
15628 this behavior: only the first detected error is reported
15629 and program then exits with a non-zero exit code.
15631 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
15632 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
15633 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
15634 @option{-fsanitize=bounds-strict},
15635 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
15636 For these sanitizers error recovery is turned on by default,
15637 except @option{-fsanitize=address}, for which this feature is experimental.
15638 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
15639 accepted, the former enables recovery for all sanitizers that support it,
15640 the latter disables recovery for all sanitizers that support it.
15642 Even if a recovery mode is turned on the compiler side, it needs to be also
15643 enabled on the runtime library side, otherwise the failures are still fatal.
15644 The runtime library defaults to @code{halt_on_error=0} for
15645 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
15646 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
15647 setting the @code{halt_on_error} flag in the corresponding environment variable.
15649 Syntax without an explicit @var{opts} parameter is deprecated. It is
15650 equivalent to specifying an @var{opts} list of:
15653 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
15656 @item -fsanitize-address-use-after-scope
15657 @opindex fsanitize-address-use-after-scope
15658 Enable sanitization of local variables to detect use-after-scope bugs.
15659 The option sets @option{-fstack-reuse} to @samp{none}.
15661 @item -fsanitize-undefined-trap-on-error
15662 @opindex fsanitize-undefined-trap-on-error
15663 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
15664 report undefined behavior using @code{__builtin_trap} rather than
15665 a @code{libubsan} library routine. The advantage of this is that the
15666 @code{libubsan} library is not needed and is not linked in, so this
15667 is usable even in freestanding environments.
15669 @item -fsanitize-coverage=trace-pc
15670 @opindex fsanitize-coverage=trace-pc
15671 Enable coverage-guided fuzzing code instrumentation.
15672 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
15674 @item -fsanitize-coverage=trace-cmp
15675 @opindex fsanitize-coverage=trace-cmp
15676 Enable dataflow guided fuzzing code instrumentation.
15677 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
15678 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
15679 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
15680 variable or @code{__sanitizer_cov_trace_const_cmp1},
15681 @code{__sanitizer_cov_trace_const_cmp2},
15682 @code{__sanitizer_cov_trace_const_cmp4} or
15683 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
15684 operand constant, @code{__sanitizer_cov_trace_cmpf} or
15685 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
15686 @code{__sanitizer_cov_trace_switch} for switch statements.
15688 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
15689 @opindex fcf-protection
15690 Enable code instrumentation of control-flow transfers to increase
15691 program security by checking that target addresses of control-flow
15692 transfer instructions (such as indirect function call, function return,
15693 indirect jump) are valid. This prevents diverting the flow of control
15694 to an unexpected target. This is intended to protect against such
15695 threats as Return-oriented Programming (ROP), and similarly
15696 call/jmp-oriented programming (COP/JOP).
15698 The value @code{branch} tells the compiler to implement checking of
15699 validity of control-flow transfer at the point of indirect branch
15700 instructions, i.e.@: call/jmp instructions. The value @code{return}
15701 implements checking of validity at the point of returning from a
15702 function. The value @code{full} is an alias for specifying both
15703 @code{branch} and @code{return}. The value @code{none} turns off
15706 The value @code{check} is used for the final link with link-time
15707 optimization (LTO). An error is issued if LTO object files are
15708 compiled with different @option{-fcf-protection} values. The
15709 value @code{check} is ignored at the compile time.
15711 The macro @code{__CET__} is defined when @option{-fcf-protection} is
15712 used. The first bit of @code{__CET__} is set to 1 for the value
15713 @code{branch} and the second bit of @code{__CET__} is set to 1 for
15716 You can also use the @code{nocf_check} attribute to identify
15717 which functions and calls should be skipped from instrumentation
15718 (@pxref{Function Attributes}).
15720 Currently the x86 GNU/Linux target provides an implementation based
15721 on Intel Control-flow Enforcement Technology (CET) which works for
15722 i686 processor or newer.
15724 @item -fharden-compares
15725 @opindex fharden-compares
15726 For every logical test that survives gimple optimizations and is
15727 @emph{not} the condition in a conditional branch (for example,
15728 conditions tested for conditional moves, or to store in boolean
15729 variables), emit extra code to compute and verify the reversed
15730 condition, and to call @code{__builtin_trap} if the results do not
15731 match. Use with @samp{-fharden-conditional-branches} to cover all
15734 @item -fharden-conditional-branches
15735 @opindex fharden-conditional-branches
15736 For every non-vectorized conditional branch that survives gimple
15737 optimizations, emit extra code to compute and verify the reversed
15738 condition, and to call @code{__builtin_trap} if the result is
15739 unexpected. Use with @samp{-fharden-compares} to cover all
15742 @item -fstack-protector
15743 @opindex fstack-protector
15744 Emit extra code to check for buffer overflows, such as stack smashing
15745 attacks. This is done by adding a guard variable to functions with
15746 vulnerable objects. This includes functions that call @code{alloca}, and
15747 functions with buffers larger than or equal to 8 bytes. The guards are
15748 initialized when a function is entered and then checked when the function
15749 exits. If a guard check fails, an error message is printed and the program
15750 exits. Only variables that are actually allocated on the stack are
15751 considered, optimized away variables or variables allocated in registers
15754 @item -fstack-protector-all
15755 @opindex fstack-protector-all
15756 Like @option{-fstack-protector} except that all functions are protected.
15758 @item -fstack-protector-strong
15759 @opindex fstack-protector-strong
15760 Like @option{-fstack-protector} but includes additional functions to
15761 be protected --- those that have local array definitions, or have
15762 references to local frame addresses. Only variables that are actually
15763 allocated on the stack are considered, optimized away variables or variables
15764 allocated in registers don't count.
15766 @item -fstack-protector-explicit
15767 @opindex fstack-protector-explicit
15768 Like @option{-fstack-protector} but only protects those functions which
15769 have the @code{stack_protect} attribute.
15771 @item -fstack-check
15772 @opindex fstack-check
15773 Generate code to verify that you do not go beyond the boundary of the
15774 stack. You should specify this flag if you are running in an
15775 environment with multiple threads, but you only rarely need to specify it in
15776 a single-threaded environment since stack overflow is automatically
15777 detected on nearly all systems if there is only one stack.
15779 Note that this switch does not actually cause checking to be done; the
15780 operating system or the language runtime must do that. The switch causes
15781 generation of code to ensure that they see the stack being extended.
15783 You can additionally specify a string parameter: @samp{no} means no
15784 checking, @samp{generic} means force the use of old-style checking,
15785 @samp{specific} means use the best checking method and is equivalent
15786 to bare @option{-fstack-check}.
15788 Old-style checking is a generic mechanism that requires no specific
15789 target support in the compiler but comes with the following drawbacks:
15793 Modified allocation strategy for large objects: they are always
15794 allocated dynamically if their size exceeds a fixed threshold. Note this
15795 may change the semantics of some code.
15798 Fixed limit on the size of the static frame of functions: when it is
15799 topped by a particular function, stack checking is not reliable and
15800 a warning is issued by the compiler.
15803 Inefficiency: because of both the modified allocation strategy and the
15804 generic implementation, code performance is hampered.
15807 Note that old-style stack checking is also the fallback method for
15808 @samp{specific} if no target support has been added in the compiler.
15810 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
15811 and stack overflows. @samp{specific} is an excellent choice when compiling
15812 Ada code. It is not generally sufficient to protect against stack-clash
15813 attacks. To protect against those you want @samp{-fstack-clash-protection}.
15815 @item -fstack-clash-protection
15816 @opindex fstack-clash-protection
15817 Generate code to prevent stack clash style attacks. When this option is
15818 enabled, the compiler will only allocate one page of stack space at a time
15819 and each page is accessed immediately after allocation. Thus, it prevents
15820 allocations from jumping over any stack guard page provided by the
15823 Most targets do not fully support stack clash protection. However, on
15824 those targets @option{-fstack-clash-protection} will protect dynamic stack
15825 allocations. @option{-fstack-clash-protection} may also provide limited
15826 protection for static stack allocations if the target supports
15827 @option{-fstack-check=specific}.
15829 @item -fstack-limit-register=@var{reg}
15830 @itemx -fstack-limit-symbol=@var{sym}
15831 @itemx -fno-stack-limit
15832 @opindex fstack-limit-register
15833 @opindex fstack-limit-symbol
15834 @opindex fno-stack-limit
15835 Generate code to ensure that the stack does not grow beyond a certain value,
15836 either the value of a register or the address of a symbol. If a larger
15837 stack is required, a signal is raised at run time. For most targets,
15838 the signal is raised before the stack overruns the boundary, so
15839 it is possible to catch the signal without taking special precautions.
15841 For instance, if the stack starts at absolute address @samp{0x80000000}
15842 and grows downwards, you can use the flags
15843 @option{-fstack-limit-symbol=__stack_limit} and
15844 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
15845 of 128KB@. Note that this may only work with the GNU linker.
15847 You can locally override stack limit checking by using the
15848 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
15850 @item -fsplit-stack
15851 @opindex fsplit-stack
15852 Generate code to automatically split the stack before it overflows.
15853 The resulting program has a discontiguous stack which can only
15854 overflow if the program is unable to allocate any more memory. This
15855 is most useful when running threaded programs, as it is no longer
15856 necessary to calculate a good stack size to use for each thread. This
15857 is currently only implemented for the x86 targets running
15860 When code compiled with @option{-fsplit-stack} calls code compiled
15861 without @option{-fsplit-stack}, there may not be much stack space
15862 available for the latter code to run. If compiling all code,
15863 including library code, with @option{-fsplit-stack} is not an option,
15864 then the linker can fix up these calls so that the code compiled
15865 without @option{-fsplit-stack} always has a large stack. Support for
15866 this is implemented in the gold linker in GNU binutils release 2.21
15869 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
15870 @opindex fvtable-verify
15871 This option is only available when compiling C++ code.
15872 It turns on (or off, if using @option{-fvtable-verify=none}) the security
15873 feature that verifies at run time, for every virtual call, that
15874 the vtable pointer through which the call is made is valid for the type of
15875 the object, and has not been corrupted or overwritten. If an invalid vtable
15876 pointer is detected at run time, an error is reported and execution of the
15877 program is immediately halted.
15879 This option causes run-time data structures to be built at program startup,
15880 which are used for verifying the vtable pointers.
15881 The options @samp{std} and @samp{preinit}
15882 control the timing of when these data structures are built. In both cases the
15883 data structures are built before execution reaches @code{main}. Using
15884 @option{-fvtable-verify=std} causes the data structures to be built after
15885 shared libraries have been loaded and initialized.
15886 @option{-fvtable-verify=preinit} causes them to be built before shared
15887 libraries have been loaded and initialized.
15889 If this option appears multiple times in the command line with different
15890 values specified, @samp{none} takes highest priority over both @samp{std} and
15891 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
15894 @opindex fvtv-debug
15895 When used in conjunction with @option{-fvtable-verify=std} or
15896 @option{-fvtable-verify=preinit}, causes debug versions of the
15897 runtime functions for the vtable verification feature to be called.
15898 This flag also causes the compiler to log information about which
15899 vtable pointers it finds for each class.
15900 This information is written to a file named @file{vtv_set_ptr_data.log}
15901 in the directory named by the environment variable @env{VTV_LOGS_DIR}
15902 if that is defined or the current working directory otherwise.
15904 Note: This feature @emph{appends} data to the log file. If you want a fresh log
15905 file, be sure to delete any existing one.
15908 @opindex fvtv-counts
15909 This is a debugging flag. When used in conjunction with
15910 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
15911 causes the compiler to keep track of the total number of virtual calls
15912 it encounters and the number of verifications it inserts. It also
15913 counts the number of calls to certain run-time library functions
15914 that it inserts and logs this information for each compilation unit.
15915 The compiler writes this information to a file named
15916 @file{vtv_count_data.log} in the directory named by the environment
15917 variable @env{VTV_LOGS_DIR} if that is defined or the current working
15918 directory otherwise. It also counts the size of the vtable pointer sets
15919 for each class, and writes this information to @file{vtv_class_set_sizes.log}
15920 in the same directory.
15922 Note: This feature @emph{appends} data to the log files. To get fresh log
15923 files, be sure to delete any existing ones.
15925 @item -finstrument-functions
15926 @opindex finstrument-functions
15927 Generate instrumentation calls for entry and exit to functions. Just
15928 after function entry and just before function exit, the following
15929 profiling functions are called with the address of the current
15930 function and its call site. (On some platforms,
15931 @code{__builtin_return_address} does not work beyond the current
15932 function, so the call site information may not be available to the
15933 profiling functions otherwise.)
15936 void __cyg_profile_func_enter (void *this_fn,
15938 void __cyg_profile_func_exit (void *this_fn,
15942 The first argument is the address of the start of the current function,
15943 which may be looked up exactly in the symbol table.
15945 This instrumentation is also done for functions expanded inline in other
15946 functions. The profiling calls indicate where, conceptually, the
15947 inline function is entered and exited. This means that addressable
15948 versions of such functions must be available. If all your uses of a
15949 function are expanded inline, this may mean an additional expansion of
15950 code size. If you use @code{extern inline} in your C code, an
15951 addressable version of such functions must be provided. (This is
15952 normally the case anyway, but if you get lucky and the optimizer always
15953 expands the functions inline, you might have gotten away without
15954 providing static copies.)
15956 A function may be given the attribute @code{no_instrument_function}, in
15957 which case this instrumentation is not done. This can be used, for
15958 example, for the profiling functions listed above, high-priority
15959 interrupt routines, and any functions from which the profiling functions
15960 cannot safely be called (perhaps signal handlers, if the profiling
15961 routines generate output or allocate memory).
15962 @xref{Common Function Attributes}.
15964 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
15965 @opindex finstrument-functions-exclude-file-list
15967 Set the list of functions that are excluded from instrumentation (see
15968 the description of @option{-finstrument-functions}). If the file that
15969 contains a function definition matches with one of @var{file}, then
15970 that function is not instrumented. The match is done on substrings:
15971 if the @var{file} parameter is a substring of the file name, it is
15972 considered to be a match.
15977 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
15981 excludes any inline function defined in files whose pathnames
15982 contain @file{/bits/stl} or @file{include/sys}.
15984 If, for some reason, you want to include letter @samp{,} in one of
15985 @var{sym}, write @samp{\,}. For example,
15986 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
15987 (note the single quote surrounding the option).
15989 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
15990 @opindex finstrument-functions-exclude-function-list
15992 This is similar to @option{-finstrument-functions-exclude-file-list},
15993 but this option sets the list of function names to be excluded from
15994 instrumentation. The function name to be matched is its user-visible
15995 name, such as @code{vector<int> blah(const vector<int> &)}, not the
15996 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
15997 match is done on substrings: if the @var{sym} parameter is a substring
15998 of the function name, it is considered to be a match. For C99 and C++
15999 extended identifiers, the function name must be given in UTF-8, not
16000 using universal character names.
16002 @item -fpatchable-function-entry=@var{N}[,@var{M}]
16003 @opindex fpatchable-function-entry
16004 Generate @var{N} NOPs right at the beginning
16005 of each function, with the function entry point before the @var{M}th NOP.
16006 If @var{M} is omitted, it defaults to @code{0} so the
16007 function entry points to the address just at the first NOP.
16008 The NOP instructions reserve extra space which can be used to patch in
16009 any desired instrumentation at run time, provided that the code segment
16010 is writable. The amount of space is controllable indirectly via
16011 the number of NOPs; the NOP instruction used corresponds to the instruction
16012 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
16013 is target-specific and may also depend on the architecture variant and/or
16014 other compilation options.
16016 For run-time identification, the starting addresses of these areas,
16017 which correspond to their respective function entries minus @var{M},
16018 are additionally collected in the @code{__patchable_function_entries}
16019 section of the resulting binary.
16021 Note that the value of @code{__attribute__ ((patchable_function_entry
16022 (N,M)))} takes precedence over command-line option
16023 @option{-fpatchable-function-entry=N,M}. This can be used to increase
16024 the area size or to remove it completely on a single function.
16025 If @code{N=0}, no pad location is recorded.
16027 The NOP instructions are inserted at---and maybe before, depending on
16028 @var{M}---the function entry address, even before the prologue.
16030 The maximum value of @var{N} and @var{M} is 65535.
16034 @node Preprocessor Options
16035 @section Options Controlling the Preprocessor
16036 @cindex preprocessor options
16037 @cindex options, preprocessor
16039 These options control the C preprocessor, which is run on each C source
16040 file before actual compilation.
16042 If you use the @option{-E} option, nothing is done except preprocessing.
16043 Some of these options make sense only together with @option{-E} because
16044 they cause the preprocessor output to be unsuitable for actual
16047 In addition to the options listed here, there are a number of options
16048 to control search paths for include files documented in
16049 @ref{Directory Options}.
16050 Options to control preprocessor diagnostics are listed in
16051 @ref{Warning Options}.
16054 @include cppopts.texi
16056 @item -Wp,@var{option}
16058 You can use @option{-Wp,@var{option}} to bypass the compiler driver
16059 and pass @var{option} directly through to the preprocessor. If
16060 @var{option} contains commas, it is split into multiple options at the
16061 commas. However, many options are modified, translated or interpreted
16062 by the compiler driver before being passed to the preprocessor, and
16063 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
16064 interface is undocumented and subject to change, so whenever possible
16065 you should avoid using @option{-Wp} and let the driver handle the
16068 @item -Xpreprocessor @var{option}
16069 @opindex Xpreprocessor
16070 Pass @var{option} as an option to the preprocessor. You can use this to
16071 supply system-specific preprocessor options that GCC does not
16074 If you want to pass an option that takes an argument, you must use
16075 @option{-Xpreprocessor} twice, once for the option and once for the argument.
16077 @item -no-integrated-cpp
16078 @opindex no-integrated-cpp
16079 Perform preprocessing as a separate pass before compilation.
16080 By default, GCC performs preprocessing as an integrated part of
16081 input tokenization and parsing.
16082 If this option is provided, the appropriate language front end
16083 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
16084 and Objective-C, respectively) is instead invoked twice,
16085 once for preprocessing only and once for actual compilation
16086 of the preprocessed input.
16087 This option may be useful in conjunction with the @option{-B} or
16088 @option{-wrapper} options to specify an alternate preprocessor or
16089 perform additional processing of the program source between
16090 normal preprocessing and compilation.
16092 @item -flarge-source-files
16093 @opindex flarge-source-files
16094 Adjust GCC to expect large source files, at the expense of slower
16095 compilation and higher memory usage.
16097 Specifically, GCC normally tracks both column numbers and line numbers
16098 within source files and it normally prints both of these numbers in
16099 diagnostics. However, once it has processed a certain number of source
16100 lines, it stops tracking column numbers and only tracks line numbers.
16101 This means that diagnostics for later lines do not include column numbers.
16102 It also means that options like @option{-Wmisleading-indentation} cease to work
16103 at that point, although the compiler prints a note if this happens.
16104 Passing @option{-flarge-source-files} significantly increases the number
16105 of source lines that GCC can process before it stops tracking columns.
16109 @node Assembler Options
16110 @section Passing Options to the Assembler
16112 @c prevent bad page break with this line
16113 You can pass options to the assembler.
16116 @item -Wa,@var{option}
16118 Pass @var{option} as an option to the assembler. If @var{option}
16119 contains commas, it is split into multiple options at the commas.
16121 @item -Xassembler @var{option}
16122 @opindex Xassembler
16123 Pass @var{option} as an option to the assembler. You can use this to
16124 supply system-specific assembler options that GCC does not
16127 If you want to pass an option that takes an argument, you must use
16128 @option{-Xassembler} twice, once for the option and once for the argument.
16133 @section Options for Linking
16134 @cindex link options
16135 @cindex options, linking
16137 These options come into play when the compiler links object files into
16138 an executable output file. They are meaningless if the compiler is
16139 not doing a link step.
16143 @item @var{object-file-name}
16144 A file name that does not end in a special recognized suffix is
16145 considered to name an object file or library. (Object files are
16146 distinguished from libraries by the linker according to the file
16147 contents.) If linking is done, these object files are used as input
16156 If any of these options is used, then the linker is not run, and
16157 object file names should not be used as arguments. @xref{Overall
16160 @item -flinker-output=@var{type}
16161 @opindex flinker-output
16162 This option controls code generation of the link-time optimizer. By
16163 default the linker output is automatically determined by the linker
16164 plugin. For debugging the compiler and if incremental linking with a
16165 non-LTO object file is desired, it may be useful to control the type
16168 If @var{type} is @samp{exec}, code generation produces a static
16169 binary. In this case @option{-fpic} and @option{-fpie} are both
16172 If @var{type} is @samp{dyn}, code generation produces a shared
16173 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
16174 but not enabled automatically. This allows to build shared libraries
16175 without position-independent code on architectures where this is
16176 possible, i.e.@: on x86.
16178 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
16179 executable. This results in similar optimizations as @samp{exec}
16180 except that @option{-fpie} is not disabled if specified at compilation
16183 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
16184 done. The sections containing intermediate code for link-time optimization are
16185 merged, pre-optimized, and output to the resulting object file. In addition, if
16186 @option{-ffat-lto-objects} is specified, binary code is produced for future
16187 non-LTO linking. The object file produced by incremental linking is smaller
16188 than a static library produced from the same object files. At link time the
16189 result of incremental linking also loads faster than a static
16190 library assuming that the majority of objects in the library are used.
16192 Finally @samp{nolto-rel} configures the compiler for incremental linking where
16193 code generation is forced, a final binary is produced, and the intermediate
16194 code for later link-time optimization is stripped. When multiple object files
16195 are linked together the resulting code is better optimized than with
16196 link-time optimizations disabled (for example, cross-module inlining
16197 happens), but most of benefits of whole program optimizations are lost.
16199 During the incremental link (by @option{-r}) the linker plugin defaults to
16200 @option{rel}. With current interfaces to GNU Binutils it is however not
16201 possible to incrementally link LTO objects and non-LTO objects into a single
16202 mixed object file. If any of object files in incremental link cannot
16203 be used for link-time optimization, the linker plugin issues a warning and
16204 uses @samp{nolto-rel}. To maintain whole program optimization, it is
16205 recommended to link such objects into static library instead. Alternatively it
16206 is possible to use H.J. Lu's binutils with support for mixed objects.
16209 @opindex fuse-ld=bfd
16210 Use the @command{bfd} linker instead of the default linker.
16212 @item -fuse-ld=gold
16213 @opindex fuse-ld=gold
16214 Use the @command{gold} linker instead of the default linker.
16217 @opindex fuse-ld=lld
16218 Use the LLVM @command{lld} linker instead of the default linker.
16221 @item -l@var{library}
16222 @itemx -l @var{library}
16224 Search the library named @var{library} when linking. (The second
16225 alternative with the library as a separate argument is only for
16226 POSIX compliance and is not recommended.)
16228 The @option{-l} option is passed directly to the linker by GCC. Refer
16229 to your linker documentation for exact details. The general
16230 description below applies to the GNU linker.
16232 The linker searches a standard list of directories for the library.
16233 The directories searched include several standard system directories
16234 plus any that you specify with @option{-L}.
16236 Static libraries are archives of object files, and have file names
16237 like @file{lib@var{library}.a}. Some targets also support shared
16238 libraries, which typically have names like @file{lib@var{library}.so}.
16239 If both static and shared libraries are found, the linker gives
16240 preference to linking with the shared library unless the
16241 @option{-static} option is used.
16243 It makes a difference where in the command you write this option; the
16244 linker searches and processes libraries and object files in the order they
16245 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
16246 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
16247 to functions in @samp{z}, those functions may not be loaded.
16251 You need this special case of the @option{-l} option in order to
16252 link an Objective-C or Objective-C++ program.
16254 @item -nostartfiles
16255 @opindex nostartfiles
16256 Do not use the standard system startup files when linking.
16257 The standard system libraries are used normally, unless @option{-nostdlib},
16258 @option{-nolibc}, or @option{-nodefaultlibs} is used.
16260 @item -nodefaultlibs
16261 @opindex nodefaultlibs
16262 Do not use the standard system libraries when linking.
16263 Only the libraries you specify are passed to the linker, and options
16264 specifying linkage of the system libraries, such as @option{-static-libgcc}
16265 or @option{-shared-libgcc}, are ignored.
16266 The standard startup files are used normally, unless @option{-nostartfiles}
16269 The compiler may generate calls to @code{memcmp},
16270 @code{memset}, @code{memcpy} and @code{memmove}.
16271 These entries are usually resolved by entries in
16272 libc. These entry points should be supplied through some other
16273 mechanism when this option is specified.
16277 Do not use the C library or system libraries tightly coupled with it when
16278 linking. Still link with the startup files, @file{libgcc} or toolchain
16279 provided language support libraries such as @file{libgnat}, @file{libgfortran}
16280 or @file{libstdc++} unless options preventing their inclusion are used as
16281 well. This typically removes @option{-lc} from the link command line, as well
16282 as system libraries that normally go with it and become meaningless when
16283 absence of a C library is assumed, for example @option{-lpthread} or
16284 @option{-lm} in some configurations. This is intended for bare-board
16285 targets when there is indeed no C library available.
16289 Do not use the standard system startup files or libraries when linking.
16290 No startup files and only the libraries you specify are passed to
16291 the linker, and options specifying linkage of the system libraries, such as
16292 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
16294 The compiler may generate calls to @code{memcmp}, @code{memset},
16295 @code{memcpy} and @code{memmove}.
16296 These entries are usually resolved by entries in
16297 libc. These entry points should be supplied through some other
16298 mechanism when this option is specified.
16300 @cindex @option{-lgcc}, use with @option{-nostdlib}
16301 @cindex @option{-nostdlib} and unresolved references
16302 @cindex unresolved references and @option{-nostdlib}
16303 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
16304 @cindex @option{-nodefaultlibs} and unresolved references
16305 @cindex unresolved references and @option{-nodefaultlibs}
16306 One of the standard libraries bypassed by @option{-nostdlib} and
16307 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
16308 which GCC uses to overcome shortcomings of particular machines, or special
16309 needs for some languages.
16310 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
16311 Collection (GCC) Internals},
16312 for more discussion of @file{libgcc.a}.)
16313 In most cases, you need @file{libgcc.a} even when you want to avoid
16314 other standard libraries. In other words, when you specify @option{-nostdlib}
16315 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
16316 This ensures that you have no unresolved references to internal GCC
16317 library subroutines.
16318 (An example of such an internal subroutine is @code{__main}, used to ensure C++
16319 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
16320 GNU Compiler Collection (GCC) Internals}.)
16322 @item -e @var{entry}
16323 @itemx --entry=@var{entry}
16327 Specify that the program entry point is @var{entry}. The argument is
16328 interpreted by the linker; the GNU linker accepts either a symbol name
16333 Produce a dynamically linked position independent executable on targets
16334 that support it. For predictable results, you must also specify the same
16335 set of options used for compilation (@option{-fpie}, @option{-fPIE},
16336 or model suboptions) when you specify this linker option.
16340 Don't produce a dynamically linked position independent executable.
16343 @opindex static-pie
16344 Produce a static position independent executable on targets that support
16345 it. A static position independent executable is similar to a static
16346 executable, but can be loaded at any address without a dynamic linker.
16347 For predictable results, you must also specify the same set of options
16348 used for compilation (@option{-fpie}, @option{-fPIE}, or model
16349 suboptions) when you specify this linker option.
16353 Link with the POSIX threads library. This option is supported on
16354 GNU/Linux targets, most other Unix derivatives, and also on
16355 x86 Cygwin and MinGW targets. On some targets this option also sets
16356 flags for the preprocessor, so it should be used consistently for both
16357 compilation and linking.
16361 Produce a relocatable object as output. This is also known as partial
16366 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
16367 that support it. This instructs the linker to add all symbols, not
16368 only used ones, to the dynamic symbol table. This option is needed
16369 for some uses of @code{dlopen} or to allow obtaining backtraces
16370 from within a program.
16374 Remove all symbol table and relocation information from the executable.
16378 On systems that support dynamic linking, this overrides @option{-pie}
16379 and prevents linking with the shared libraries. On other systems, this
16380 option has no effect.
16384 Produce a shared object which can then be linked with other objects to
16385 form an executable. Not all systems support this option. For predictable
16386 results, you must also specify the same set of options used for compilation
16387 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
16388 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
16389 needs to build supplementary stub code for constructors to work. On
16390 multi-libbed systems, @samp{gcc -shared} must select the correct support
16391 libraries to link against. Failing to supply the correct flags may lead
16392 to subtle defects. Supplying them in cases where they are not necessary
16395 @item -shared-libgcc
16396 @itemx -static-libgcc
16397 @opindex shared-libgcc
16398 @opindex static-libgcc
16399 On systems that provide @file{libgcc} as a shared library, these options
16400 force the use of either the shared or static version, respectively.
16401 If no shared version of @file{libgcc} was built when the compiler was
16402 configured, these options have no effect.
16404 There are several situations in which an application should use the
16405 shared @file{libgcc} instead of the static version. The most common
16406 of these is when the application wishes to throw and catch exceptions
16407 across different shared libraries. In that case, each of the libraries
16408 as well as the application itself should use the shared @file{libgcc}.
16410 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
16411 whenever you build a shared library or a main executable, because C++
16412 programs typically use exceptions, so this is the right thing to do.
16414 If, instead, you use the GCC driver to create shared libraries, you may
16415 find that they are not always linked with the shared @file{libgcc}.
16416 If GCC finds, at its configuration time, that you have a non-GNU linker
16417 or a GNU linker that does not support option @option{--eh-frame-hdr},
16418 it links the shared version of @file{libgcc} into shared libraries
16419 by default. Otherwise, it takes advantage of the linker and optimizes
16420 away the linking with the shared version of @file{libgcc}, linking with
16421 the static version of libgcc by default. This allows exceptions to
16422 propagate through such shared libraries, without incurring relocation
16423 costs at library load time.
16425 However, if a library or main executable is supposed to throw or catch
16426 exceptions, you must link it using the G++ driver, or using the option
16427 @option{-shared-libgcc}, such that it is linked with the shared
16430 @item -static-libasan
16431 @opindex static-libasan
16432 When the @option{-fsanitize=address} option is used to link a program,
16433 the GCC driver automatically links against @option{libasan}. If
16434 @file{libasan} is available as a shared library, and the @option{-static}
16435 option is not used, then this links against the shared version of
16436 @file{libasan}. The @option{-static-libasan} option directs the GCC
16437 driver to link @file{libasan} statically, without necessarily linking
16438 other libraries statically.
16440 @item -static-libtsan
16441 @opindex static-libtsan
16442 When the @option{-fsanitize=thread} option is used to link a program,
16443 the GCC driver automatically links against @option{libtsan}. If
16444 @file{libtsan} is available as a shared library, and the @option{-static}
16445 option is not used, then this links against the shared version of
16446 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
16447 driver to link @file{libtsan} statically, without necessarily linking
16448 other libraries statically.
16450 @item -static-liblsan
16451 @opindex static-liblsan
16452 When the @option{-fsanitize=leak} option is used to link a program,
16453 the GCC driver automatically links against @option{liblsan}. If
16454 @file{liblsan} is available as a shared library, and the @option{-static}
16455 option is not used, then this links against the shared version of
16456 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
16457 driver to link @file{liblsan} statically, without necessarily linking
16458 other libraries statically.
16460 @item -static-libubsan
16461 @opindex static-libubsan
16462 When the @option{-fsanitize=undefined} option is used to link a program,
16463 the GCC driver automatically links against @option{libubsan}. If
16464 @file{libubsan} is available as a shared library, and the @option{-static}
16465 option is not used, then this links against the shared version of
16466 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
16467 driver to link @file{libubsan} statically, without necessarily linking
16468 other libraries statically.
16470 @item -static-libstdc++
16471 @opindex static-libstdc++
16472 When the @command{g++} program is used to link a C++ program, it
16473 normally automatically links against @option{libstdc++}. If
16474 @file{libstdc++} is available as a shared library, and the
16475 @option{-static} option is not used, then this links against the
16476 shared version of @file{libstdc++}. That is normally fine. However, it
16477 is sometimes useful to freeze the version of @file{libstdc++} used by
16478 the program without going all the way to a fully static link. The
16479 @option{-static-libstdc++} option directs the @command{g++} driver to
16480 link @file{libstdc++} statically, without necessarily linking other
16481 libraries statically.
16485 Bind references to global symbols when building a shared object. Warn
16486 about any unresolved references (unless overridden by the link editor
16487 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
16490 @item -T @var{script}
16492 @cindex linker script
16493 Use @var{script} as the linker script. This option is supported by most
16494 systems using the GNU linker. On some targets, such as bare-board
16495 targets without an operating system, the @option{-T} option may be required
16496 when linking to avoid references to undefined symbols.
16498 @item -Xlinker @var{option}
16500 Pass @var{option} as an option to the linker. You can use this to
16501 supply system-specific linker options that GCC does not recognize.
16503 If you want to pass an option that takes a separate argument, you must use
16504 @option{-Xlinker} twice, once for the option and once for the argument.
16505 For example, to pass @option{-assert definitions}, you must write
16506 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
16507 @option{-Xlinker "-assert definitions"}, because this passes the entire
16508 string as a single argument, which is not what the linker expects.
16510 When using the GNU linker, it is usually more convenient to pass
16511 arguments to linker options using the @option{@var{option}=@var{value}}
16512 syntax than as separate arguments. For example, you can specify
16513 @option{-Xlinker -Map=output.map} rather than
16514 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
16515 this syntax for command-line options.
16517 @item -Wl,@var{option}
16519 Pass @var{option} as an option to the linker. If @var{option} contains
16520 commas, it is split into multiple options at the commas. You can use this
16521 syntax to pass an argument to the option.
16522 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
16523 linker. When using the GNU linker, you can also get the same effect with
16524 @option{-Wl,-Map=output.map}.
16526 @item -u @var{symbol}
16528 Pretend the symbol @var{symbol} is undefined, to force linking of
16529 library modules to define it. You can use @option{-u} multiple times with
16530 different symbols to force loading of additional library modules.
16532 @item -z @var{keyword}
16534 @option{-z} is passed directly on to the linker along with the keyword
16535 @var{keyword}. See the section in the documentation of your linker for
16536 permitted values and their meanings.
16539 @node Directory Options
16540 @section Options for Directory Search
16541 @cindex directory options
16542 @cindex options, directory search
16543 @cindex search path
16545 These options specify directories to search for header files, for
16546 libraries and for parts of the compiler:
16549 @include cppdiropts.texi
16551 @item -iplugindir=@var{dir}
16552 @opindex iplugindir=
16553 Set the directory to search for plugins that are passed
16554 by @option{-fplugin=@var{name}} instead of
16555 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
16556 to be used by the user, but only passed by the driver.
16560 Add directory @var{dir} to the list of directories to be searched
16563 @item -B@var{prefix}
16565 This option specifies where to find the executables, libraries,
16566 include files, and data files of the compiler itself.
16568 The compiler driver program runs one or more of the subprograms
16569 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
16570 @var{prefix} as a prefix for each program it tries to run, both with and
16571 without @samp{@var{machine}/@var{version}/} for the corresponding target
16572 machine and compiler version.
16574 For each subprogram to be run, the compiler driver first tries the
16575 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
16576 is not specified, the driver tries two standard prefixes,
16577 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
16578 those results in a file name that is found, the unmodified program
16579 name is searched for using the directories specified in your
16580 @env{PATH} environment variable.
16582 The compiler checks to see if the path provided by @option{-B}
16583 refers to a directory, and if necessary it adds a directory
16584 separator character at the end of the path.
16586 @option{-B} prefixes that effectively specify directory names also apply
16587 to libraries in the linker, because the compiler translates these
16588 options into @option{-L} options for the linker. They also apply to
16589 include files in the preprocessor, because the compiler translates these
16590 options into @option{-isystem} options for the preprocessor. In this case,
16591 the compiler appends @samp{include} to the prefix.
16593 The runtime support file @file{libgcc.a} can also be searched for using
16594 the @option{-B} prefix, if needed. If it is not found there, the two
16595 standard prefixes above are tried, and that is all. The file is left
16596 out of the link if it is not found by those means.
16598 Another way to specify a prefix much like the @option{-B} prefix is to use
16599 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
16602 As a special kludge, if the path provided by @option{-B} is
16603 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
16604 9, then it is replaced by @file{[dir/]include}. This is to help
16605 with boot-strapping the compiler.
16607 @item -no-canonical-prefixes
16608 @opindex no-canonical-prefixes
16609 Do not expand any symbolic links, resolve references to @samp{/../}
16610 or @samp{/./}, or make the path absolute when generating a relative
16613 @item --sysroot=@var{dir}
16615 Use @var{dir} as the logical root directory for headers and libraries.
16616 For example, if the compiler normally searches for headers in
16617 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
16618 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
16620 If you use both this option and the @option{-isysroot} option, then
16621 the @option{--sysroot} option applies to libraries, but the
16622 @option{-isysroot} option applies to header files.
16624 The GNU linker (beginning with version 2.16) has the necessary support
16625 for this option. If your linker does not support this option, the
16626 header file aspect of @option{--sysroot} still works, but the
16627 library aspect does not.
16629 @item --no-sysroot-suffix
16630 @opindex no-sysroot-suffix
16631 For some targets, a suffix is added to the root directory specified
16632 with @option{--sysroot}, depending on the other options used, so that
16633 headers may for example be found in
16634 @file{@var{dir}/@var{suffix}/usr/include} instead of
16635 @file{@var{dir}/usr/include}. This option disables the addition of
16640 @node Code Gen Options
16641 @section Options for Code Generation Conventions
16642 @cindex code generation conventions
16643 @cindex options, code generation
16644 @cindex run-time options
16646 These machine-independent options control the interface conventions
16647 used in code generation.
16649 Most of them have both positive and negative forms; the negative form
16650 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
16651 one of the forms is listed---the one that is not the default. You
16652 can figure out the other form by either removing @samp{no-} or adding
16656 @item -fstack-reuse=@var{reuse-level}
16657 @opindex fstack_reuse
16658 This option controls stack space reuse for user declared local/auto variables
16659 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
16660 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
16661 local variables and temporaries, @samp{named_vars} enables the reuse only for
16662 user defined local variables with names, and @samp{none} disables stack reuse
16663 completely. The default value is @samp{all}. The option is needed when the
16664 program extends the lifetime of a scoped local variable or a compiler generated
16665 temporary beyond the end point defined by the language. When a lifetime of
16666 a variable ends, and if the variable lives in memory, the optimizing compiler
16667 has the freedom to reuse its stack space with other temporaries or scoped
16668 local variables whose live range does not overlap with it. Legacy code extending
16669 local lifetime is likely to break with the stack reuse optimization.
16688 if (*p == 10) // out of scope use of local1
16699 A(int k) : i(k), j(k) @{ @}
16706 void foo(const A& ar)
16713 foo(A(10)); // temp object's lifetime ends when foo returns
16719 ap->i+= 10; // ap references out of scope temp whose space
16720 // is reused with a. What is the value of ap->i?
16725 The lifetime of a compiler generated temporary is well defined by the C++
16726 standard. When a lifetime of a temporary ends, and if the temporary lives
16727 in memory, the optimizing compiler has the freedom to reuse its stack
16728 space with other temporaries or scoped local variables whose live range
16729 does not overlap with it. However some of the legacy code relies on
16730 the behavior of older compilers in which temporaries' stack space is
16731 not reused, the aggressive stack reuse can lead to runtime errors. This
16732 option is used to control the temporary stack reuse optimization.
16736 This option generates traps for signed overflow on addition, subtraction,
16737 multiplication operations.
16738 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16739 @option{-ftrapv} @option{-fwrapv} on the command-line results in
16740 @option{-fwrapv} being effective. Note that only active options override, so
16741 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16742 results in @option{-ftrapv} being effective.
16746 This option instructs the compiler to assume that signed arithmetic
16747 overflow of addition, subtraction and multiplication wraps around
16748 using twos-complement representation. This flag enables some optimizations
16749 and disables others.
16750 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16751 @option{-ftrapv} @option{-fwrapv} on the command-line results in
16752 @option{-fwrapv} being effective. Note that only active options override, so
16753 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16754 results in @option{-ftrapv} being effective.
16756 @item -fwrapv-pointer
16757 @opindex fwrapv-pointer
16758 This option instructs the compiler to assume that pointer arithmetic
16759 overflow on addition and subtraction wraps around using twos-complement
16760 representation. This flag disables some optimizations which assume
16761 pointer overflow is invalid.
16763 @item -fstrict-overflow
16764 @opindex fstrict-overflow
16765 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
16766 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
16769 @opindex fexceptions
16770 Enable exception handling. Generates extra code needed to propagate
16771 exceptions. For some targets, this implies GCC generates frame
16772 unwind information for all functions, which can produce significant data
16773 size overhead, although it does not affect execution. If you do not
16774 specify this option, GCC enables it by default for languages like
16775 C++ that normally require exception handling, and disables it for
16776 languages like C that do not normally require it. However, you may need
16777 to enable this option when compiling C code that needs to interoperate
16778 properly with exception handlers written in C++. You may also wish to
16779 disable this option if you are compiling older C++ programs that don't
16780 use exception handling.
16782 @item -fnon-call-exceptions
16783 @opindex fnon-call-exceptions
16784 Generate code that allows trapping instructions to throw exceptions.
16785 Note that this requires platform-specific runtime support that does
16786 not exist everywhere. Moreover, it only allows @emph{trapping}
16787 instructions to throw exceptions, i.e.@: memory references or floating-point
16788 instructions. It does not allow exceptions to be thrown from
16789 arbitrary signal handlers such as @code{SIGALRM}. This enables
16790 @option{-fexceptions}.
16792 @item -fdelete-dead-exceptions
16793 @opindex fdelete-dead-exceptions
16794 Consider that instructions that may throw exceptions but don't otherwise
16795 contribute to the execution of the program can be optimized away.
16796 This does not affect calls to functions except those with the
16797 @code{pure} or @code{const} attributes.
16798 This option is enabled by default for the Ada and C++ compilers, as permitted by
16799 the language specifications.
16800 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
16802 @item -funwind-tables
16803 @opindex funwind-tables
16804 Similar to @option{-fexceptions}, except that it just generates any needed
16805 static data, but does not affect the generated code in any other way.
16806 You normally do not need to enable this option; instead, a language processor
16807 that needs this handling enables it on your behalf.
16809 @item -fasynchronous-unwind-tables
16810 @opindex fasynchronous-unwind-tables
16811 Generate unwind table in DWARF format, if supported by target machine. The
16812 table is exact at each instruction boundary, so it can be used for stack
16813 unwinding from asynchronous events (such as debugger or garbage collector).
16815 @item -fno-gnu-unique
16816 @opindex fno-gnu-unique
16817 @opindex fgnu-unique
16818 On systems with recent GNU assembler and C library, the C++ compiler
16819 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
16820 of template static data members and static local variables in inline
16821 functions are unique even in the presence of @code{RTLD_LOCAL}; this
16822 is necessary to avoid problems with a library used by two different
16823 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
16824 therefore disagreeing with the other one about the binding of the
16825 symbol. But this causes @code{dlclose} to be ignored for affected
16826 DSOs; if your program relies on reinitialization of a DSO via
16827 @code{dlclose} and @code{dlopen}, you can use
16828 @option{-fno-gnu-unique}.
16830 @item -fpcc-struct-return
16831 @opindex fpcc-struct-return
16832 Return ``short'' @code{struct} and @code{union} values in memory like
16833 longer ones, rather than in registers. This convention is less
16834 efficient, but it has the advantage of allowing intercallability between
16835 GCC-compiled files and files compiled with other compilers, particularly
16836 the Portable C Compiler (pcc).
16838 The precise convention for returning structures in memory depends
16839 on the target configuration macros.
16841 Short structures and unions are those whose size and alignment match
16842 that of some integer type.
16844 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
16845 switch is not binary compatible with code compiled with the
16846 @option{-freg-struct-return} switch.
16847 Use it to conform to a non-default application binary interface.
16849 @item -freg-struct-return
16850 @opindex freg-struct-return
16851 Return @code{struct} and @code{union} values in registers when possible.
16852 This is more efficient for small structures than
16853 @option{-fpcc-struct-return}.
16855 If you specify neither @option{-fpcc-struct-return} nor
16856 @option{-freg-struct-return}, GCC defaults to whichever convention is
16857 standard for the target. If there is no standard convention, GCC
16858 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
16859 the principal compiler. In those cases, we can choose the standard, and
16860 we chose the more efficient register return alternative.
16862 @strong{Warning:} code compiled with the @option{-freg-struct-return}
16863 switch is not binary compatible with code compiled with the
16864 @option{-fpcc-struct-return} switch.
16865 Use it to conform to a non-default application binary interface.
16867 @item -fshort-enums
16868 @opindex fshort-enums
16869 Allocate to an @code{enum} type only as many bytes as it needs for the
16870 declared range of possible values. Specifically, the @code{enum} type
16871 is equivalent to the smallest integer type that has enough room.
16873 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
16874 code that is not binary compatible with code generated without that switch.
16875 Use it to conform to a non-default application binary interface.
16877 @item -fshort-wchar
16878 @opindex fshort-wchar
16879 Override the underlying type for @code{wchar_t} to be @code{short
16880 unsigned int} instead of the default for the target. This option is
16881 useful for building programs to run under WINE@.
16883 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
16884 code that is not binary compatible with code generated without that switch.
16885 Use it to conform to a non-default application binary interface.
16889 @opindex fno-common
16890 @cindex tentative definitions
16891 In C code, this option controls the placement of global variables
16892 defined without an initializer, known as @dfn{tentative definitions}
16893 in the C standard. Tentative definitions are distinct from declarations
16894 of a variable with the @code{extern} keyword, which do not allocate storage.
16896 The default is @option{-fno-common}, which specifies that the compiler places
16897 uninitialized global variables in the BSS section of the object file.
16898 This inhibits the merging of tentative definitions by the linker so you get a
16899 multiple-definition error if the same variable is accidentally defined in more
16900 than one compilation unit.
16902 The @option{-fcommon} places uninitialized global variables in a common block.
16903 This allows the linker to resolve all tentative definitions of the same variable
16904 in different compilation units to the same object, or to a non-tentative
16905 definition. This behavior is inconsistent with C++, and on many targets implies
16906 a speed and code size penalty on global variable references. It is mainly
16907 useful to enable legacy code to link without errors.
16912 Ignore the @code{#ident} directive.
16914 @item -finhibit-size-directive
16915 @opindex finhibit-size-directive
16916 Don't output a @code{.size} assembler directive, or anything else that
16917 would cause trouble if the function is split in the middle, and the
16918 two halves are placed at locations far apart in memory. This option is
16919 used when compiling @file{crtstuff.c}; you should not need to use it
16922 @item -fverbose-asm
16923 @opindex fverbose-asm
16924 Put extra commentary information in the generated assembly code to
16925 make it more readable. This option is generally only of use to those
16926 who actually need to read the generated assembly code (perhaps while
16927 debugging the compiler itself).
16929 @option{-fno-verbose-asm}, the default, causes the
16930 extra information to be omitted and is useful when comparing two assembler
16933 The added comments include:
16938 information on the compiler version and command-line options,
16941 the source code lines associated with the assembly instructions,
16942 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16945 hints on which high-level expressions correspond to
16946 the various assembly instruction operands.
16950 For example, given this C source file:
16958 for (i = 0; i < n; i++)
16965 compiling to (x86_64) assembly via @option{-S} and emitting the result
16966 direct to stdout via @option{-o} @option{-}
16969 gcc -S test.c -fverbose-asm -Os -o -
16972 gives output similar to this:
16976 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
16983 .type test, @@function
16987 # test.c:4: int total = 0;
16988 xorl %eax, %eax # <retval>
16989 # test.c:6: for (i = 0; i < n; i++)
16990 xorl %edx, %edx # i
16992 # test.c:6: for (i = 0; i < n; i++)
16993 cmpl %edi, %edx # n, i
16995 # test.c:7: total += i * i;
16996 movl %edx, %ecx # i, tmp92
16997 imull %edx, %ecx # i, tmp92
16998 # test.c:6: for (i = 0; i < n; i++)
17000 # test.c:7: total += i * i;
17001 addl %ecx, %eax # tmp92, <retval>
17009 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
17010 .section .note.GNU-stack,"",@@progbits
17013 The comments are intended for humans rather than machines and hence the
17014 precise format of the comments is subject to change.
17016 @item -frecord-gcc-switches
17017 @opindex frecord-gcc-switches
17018 This switch causes the command line used to invoke the
17019 compiler to be recorded into the object file that is being created.
17020 This switch is only implemented on some targets and the exact format
17021 of the recording is target and binary file format dependent, but it
17022 usually takes the form of a section containing ASCII text. This
17023 switch is related to the @option{-fverbose-asm} switch, but that
17024 switch only records information in the assembler output file as
17025 comments, so it never reaches the object file.
17026 See also @option{-grecord-gcc-switches} for another
17027 way of storing compiler options into the object file.
17031 @cindex global offset table
17033 Generate position-independent code (PIC) suitable for use in a shared
17034 library, if supported for the target machine. Such code accesses all
17035 constant addresses through a global offset table (GOT)@. The dynamic
17036 loader resolves the GOT entries when the program starts (the dynamic
17037 loader is not part of GCC; it is part of the operating system). If
17038 the GOT size for the linked executable exceeds a machine-specific
17039 maximum size, you get an error message from the linker indicating that
17040 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
17041 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
17042 on the m68k and RS/6000. The x86 has no such limit.)
17044 Position-independent code requires special support, and therefore works
17045 only on certain machines. For the x86, GCC supports PIC for System V
17046 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
17047 position-independent.
17049 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17054 If supported for the target machine, emit position-independent code,
17055 suitable for dynamic linking and avoiding any limit on the size of the
17056 global offset table. This option makes a difference on AArch64, m68k,
17057 PowerPC and SPARC@.
17059 Position-independent code requires special support, and therefore works
17060 only on certain machines.
17062 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17069 These options are similar to @option{-fpic} and @option{-fPIC}, but the
17070 generated position-independent code can be only linked into executables.
17071 Usually these options are used to compile code that will be linked using
17072 the @option{-pie} GCC option.
17074 @option{-fpie} and @option{-fPIE} both define the macros
17075 @code{__pie__} and @code{__PIE__}. The macros have the value 1
17076 for @option{-fpie} and 2 for @option{-fPIE}.
17081 Do not use the PLT for external function calls in position-independent code.
17082 Instead, load the callee address at call sites from the GOT and branch to it.
17083 This leads to more efficient code by eliminating PLT stubs and exposing
17084 GOT loads to optimizations. On architectures such as 32-bit x86 where
17085 PLT stubs expect the GOT pointer in a specific register, this gives more
17086 register allocation freedom to the compiler.
17087 Lazy binding requires use of the PLT;
17088 with @option{-fno-plt} all external symbols are resolved at load time.
17090 Alternatively, the function attribute @code{noplt} can be used to avoid calls
17091 through the PLT for specific external functions.
17093 In position-dependent code, a few targets also convert calls to
17094 functions that are marked to not use the PLT to use the GOT instead.
17096 @item -fno-jump-tables
17097 @opindex fno-jump-tables
17098 @opindex fjump-tables
17099 Do not use jump tables for switch statements even where it would be
17100 more efficient than other code generation strategies. This option is
17101 of use in conjunction with @option{-fpic} or @option{-fPIC} for
17102 building code that forms part of a dynamic linker and cannot
17103 reference the address of a jump table. On some targets, jump tables
17104 do not require a GOT and this option is not needed.
17106 @item -fno-bit-tests
17107 @opindex fno-bit-tests
17108 @opindex fbit-tests
17109 Do not use bit tests for switch statements even where it would be
17110 more efficient than other code generation strategies.
17112 @item -ffixed-@var{reg}
17114 Treat the register named @var{reg} as a fixed register; generated code
17115 should never refer to it (except perhaps as a stack pointer, frame
17116 pointer or in some other fixed role).
17118 @var{reg} must be the name of a register. The register names accepted
17119 are machine-specific and are defined in the @code{REGISTER_NAMES}
17120 macro in the machine description macro file.
17122 This flag does not have a negative form, because it specifies a
17125 @item -fcall-used-@var{reg}
17126 @opindex fcall-used
17127 Treat the register named @var{reg} as an allocable register that is
17128 clobbered by function calls. It may be allocated for temporaries or
17129 variables that do not live across a call. Functions compiled this way
17130 do not save and restore the register @var{reg}.
17132 It is an error to use this flag with the frame pointer or stack pointer.
17133 Use of this flag for other registers that have fixed pervasive roles in
17134 the machine's execution model produces disastrous results.
17136 This flag does not have a negative form, because it specifies a
17139 @item -fcall-saved-@var{reg}
17140 @opindex fcall-saved
17141 Treat the register named @var{reg} as an allocable register saved by
17142 functions. It may be allocated even for temporaries or variables that
17143 live across a call. Functions compiled this way save and restore
17144 the register @var{reg} if they use it.
17146 It is an error to use this flag with the frame pointer or stack pointer.
17147 Use of this flag for other registers that have fixed pervasive roles in
17148 the machine's execution model produces disastrous results.
17150 A different sort of disaster results from the use of this flag for
17151 a register in which function values may be returned.
17153 This flag does not have a negative form, because it specifies a
17156 @item -fpack-struct[=@var{n}]
17157 @opindex fpack-struct
17158 Without a value specified, pack all structure members together without
17159 holes. When a value is specified (which must be a small power of two), pack
17160 structure members according to this value, representing the maximum
17161 alignment (that is, objects with default alignment requirements larger than
17162 this are output potentially unaligned at the next fitting location.
17164 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
17165 code that is not binary compatible with code generated without that switch.
17166 Additionally, it makes the code suboptimal.
17167 Use it to conform to a non-default application binary interface.
17169 @item -fleading-underscore
17170 @opindex fleading-underscore
17171 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
17172 change the way C symbols are represented in the object file. One use
17173 is to help link with legacy assembly code.
17175 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
17176 generate code that is not binary compatible with code generated without that
17177 switch. Use it to conform to a non-default application binary interface.
17178 Not all targets provide complete support for this switch.
17180 @item -ftls-model=@var{model}
17181 @opindex ftls-model
17182 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
17183 The @var{model} argument should be one of @samp{global-dynamic},
17184 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
17185 Note that the choice is subject to optimization: the compiler may use
17186 a more efficient model for symbols not visible outside of the translation
17187 unit, or if @option{-fpic} is not given on the command line.
17189 The default without @option{-fpic} is @samp{initial-exec}; with
17190 @option{-fpic} the default is @samp{global-dynamic}.
17192 @item -ftrampolines
17193 @opindex ftrampolines
17194 For targets that normally need trampolines for nested functions, always
17195 generate them instead of using descriptors. Otherwise, for targets that
17196 do not need them, like for example HP-PA or IA-64, do nothing.
17198 A trampoline is a small piece of code that is created at run time on the
17199 stack when the address of a nested function is taken, and is used to call
17200 the nested function indirectly. Therefore, it requires the stack to be
17201 made executable in order for the program to work properly.
17203 @option{-fno-trampolines} is enabled by default on a language by language
17204 basis to let the compiler avoid generating them, if it computes that this
17205 is safe, and replace them with descriptors. Descriptors are made up of data
17206 only, but the generated code must be prepared to deal with them. As of this
17207 writing, @option{-fno-trampolines} is enabled by default only for Ada.
17209 Moreover, code compiled with @option{-ftrampolines} and code compiled with
17210 @option{-fno-trampolines} are not binary compatible if nested functions are
17211 present. This option must therefore be used on a program-wide basis and be
17212 manipulated with extreme care.
17214 For languages other than Ada, the @code{-ftrampolines} and
17215 @code{-fno-trampolines} options currently have no effect, and
17216 trampolines are always generated on platforms that need them
17217 for nested functions.
17219 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
17220 @opindex fvisibility
17221 Set the default ELF image symbol visibility to the specified option---all
17222 symbols are marked with this unless overridden within the code.
17223 Using this feature can very substantially improve linking and
17224 load times of shared object libraries, produce more optimized
17225 code, provide near-perfect API export and prevent symbol clashes.
17226 It is @strong{strongly} recommended that you use this in any shared objects
17229 Despite the nomenclature, @samp{default} always means public; i.e.,
17230 available to be linked against from outside the shared object.
17231 @samp{protected} and @samp{internal} are pretty useless in real-world
17232 usage so the only other commonly used option is @samp{hidden}.
17233 The default if @option{-fvisibility} isn't specified is
17234 @samp{default}, i.e., make every symbol public.
17236 A good explanation of the benefits offered by ensuring ELF
17237 symbols have the correct visibility is given by ``How To Write
17238 Shared Libraries'' by Ulrich Drepper (which can be found at
17239 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
17240 solution made possible by this option to marking things hidden when
17241 the default is public is to make the default hidden and mark things
17242 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
17243 and @code{__attribute__ ((visibility("default")))} instead of
17244 @code{__declspec(dllexport)} you get almost identical semantics with
17245 identical syntax. This is a great boon to those working with
17246 cross-platform projects.
17248 For those adding visibility support to existing code, you may find
17249 @code{#pragma GCC visibility} of use. This works by you enclosing
17250 the declarations you wish to set visibility for with (for example)
17251 @code{#pragma GCC visibility push(hidden)} and
17252 @code{#pragma GCC visibility pop}.
17253 Bear in mind that symbol visibility should be viewed @strong{as
17254 part of the API interface contract} and thus all new code should
17255 always specify visibility when it is not the default; i.e., declarations
17256 only for use within the local DSO should @strong{always} be marked explicitly
17257 as hidden as so to avoid PLT indirection overheads---making this
17258 abundantly clear also aids readability and self-documentation of the code.
17259 Note that due to ISO C++ specification requirements, @code{operator new} and
17260 @code{operator delete} must always be of default visibility.
17262 Be aware that headers from outside your project, in particular system
17263 headers and headers from any other library you use, may not be
17264 expecting to be compiled with visibility other than the default. You
17265 may need to explicitly say @code{#pragma GCC visibility push(default)}
17266 before including any such headers.
17268 @code{extern} declarations are not affected by @option{-fvisibility}, so
17269 a lot of code can be recompiled with @option{-fvisibility=hidden} with
17270 no modifications. However, this means that calls to @code{extern}
17271 functions with no explicit visibility use the PLT, so it is more
17272 effective to use @code{__attribute ((visibility))} and/or
17273 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
17274 declarations should be treated as hidden.
17276 Note that @option{-fvisibility} does affect C++ vague linkage
17277 entities. This means that, for instance, an exception class that is
17278 be thrown between DSOs must be explicitly marked with default
17279 visibility so that the @samp{type_info} nodes are unified between
17282 An overview of these techniques, their benefits and how to use them
17283 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
17285 @item -fstrict-volatile-bitfields
17286 @opindex fstrict-volatile-bitfields
17287 This option should be used if accesses to volatile bit-fields (or other
17288 structure fields, although the compiler usually honors those types
17289 anyway) should use a single access of the width of the
17290 field's type, aligned to a natural alignment if possible. For
17291 example, targets with memory-mapped peripheral registers might require
17292 all such accesses to be 16 bits wide; with this flag you can
17293 declare all peripheral bit-fields as @code{unsigned short} (assuming short
17294 is 16 bits on these targets) to force GCC to use 16-bit accesses
17295 instead of, perhaps, a more efficient 32-bit access.
17297 If this option is disabled, the compiler uses the most efficient
17298 instruction. In the previous example, that might be a 32-bit load
17299 instruction, even though that accesses bytes that do not contain
17300 any portion of the bit-field, or memory-mapped registers unrelated to
17301 the one being updated.
17303 In some cases, such as when the @code{packed} attribute is applied to a
17304 structure field, it may not be possible to access the field with a single
17305 read or write that is correctly aligned for the target machine. In this
17306 case GCC falls back to generating multiple accesses rather than code that
17307 will fault or truncate the result at run time.
17309 Note: Due to restrictions of the C/C++11 memory model, write accesses are
17310 not allowed to touch non bit-field members. It is therefore recommended
17311 to define all bits of the field's type as bit-field members.
17313 The default value of this option is determined by the application binary
17314 interface for the target processor.
17316 @item -fsync-libcalls
17317 @opindex fsync-libcalls
17318 This option controls whether any out-of-line instance of the @code{__sync}
17319 family of functions may be used to implement the C++11 @code{__atomic}
17320 family of functions.
17322 The default value of this option is enabled, thus the only useful form
17323 of the option is @option{-fno-sync-libcalls}. This option is used in
17324 the implementation of the @file{libatomic} runtime library.
17328 @node Developer Options
17329 @section GCC Developer Options
17330 @cindex developer options
17331 @cindex debugging GCC
17332 @cindex debug dump options
17333 @cindex dump options
17334 @cindex compilation statistics
17336 This section describes command-line options that are primarily of
17337 interest to GCC developers, including options to support compiler
17338 testing and investigation of compiler bugs and compile-time
17339 performance problems. This includes options that produce debug dumps
17340 at various points in the compilation; that print statistics such as
17341 memory use and execution time; and that print information about GCC's
17342 configuration, such as where it searches for libraries. You should
17343 rarely need to use any of these options for ordinary compilation and
17346 Many developer options that cause GCC to dump output to a file take an
17347 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
17348 or @samp{-} to dump to standard output, and @samp{stderr} for standard
17351 If @samp{=@var{filename}} is omitted, a default dump file name is
17352 constructed by concatenating the base dump file name, a pass number,
17353 phase letter, and pass name. The base dump file name is the name of
17354 output file produced by the compiler if explicitly specified and not
17355 an executable; otherwise it is the source file name.
17356 The pass number is determined by the order passes are registered with
17357 the compiler's pass manager.
17358 This is generally the same as the order of execution, but passes
17359 registered by plugins, target-specific passes, or passes that are
17360 otherwise registered late are numbered higher than the pass named
17361 @samp{final}, even if they are executed earlier. The phase letter is
17362 one of @samp{i} (inter-procedural analysis), @samp{l}
17363 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
17364 The files are created in the directory of the output file.
17368 @item -fcallgraph-info
17369 @itemx -fcallgraph-info=@var{MARKERS}
17370 @opindex fcallgraph-info
17371 Makes the compiler output callgraph information for the program, on a
17372 per-object-file basis. The information is generated in the common VCG
17373 format. It can be decorated with additional, per-node and/or per-edge
17374 information, if a list of comma-separated markers is additionally
17375 specified. When the @code{su} marker is specified, the callgraph is
17376 decorated with stack usage information; it is equivalent to
17377 @option{-fstack-usage}. When the @code{da} marker is specified, the
17378 callgraph is decorated with information about dynamically allocated
17381 When compiling with @option{-flto}, no callgraph information is output
17382 along with the object file. At LTO link time, @option{-fcallgraph-info}
17383 may generate multiple callgraph information files next to intermediate
17386 @item -d@var{letters}
17387 @itemx -fdump-rtl-@var{pass}
17388 @itemx -fdump-rtl-@var{pass}=@var{filename}
17390 @opindex fdump-rtl-@var{pass}
17391 Says to make debugging dumps during compilation at times specified by
17392 @var{letters}. This is used for debugging the RTL-based passes of the
17395 Some @option{-d@var{letters}} switches have different meaning when
17396 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
17397 for information about preprocessor-specific dump options.
17399 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
17400 @option{-d} option @var{letters}. Here are the possible
17401 letters for use in @var{pass} and @var{letters}, and their meanings:
17405 @item -fdump-rtl-alignments
17406 @opindex fdump-rtl-alignments
17407 Dump after branch alignments have been computed.
17409 @item -fdump-rtl-asmcons
17410 @opindex fdump-rtl-asmcons
17411 Dump after fixing rtl statements that have unsatisfied in/out constraints.
17413 @item -fdump-rtl-auto_inc_dec
17414 @opindex fdump-rtl-auto_inc_dec
17415 Dump after auto-inc-dec discovery. This pass is only run on
17416 architectures that have auto inc or auto dec instructions.
17418 @item -fdump-rtl-barriers
17419 @opindex fdump-rtl-barriers
17420 Dump after cleaning up the barrier instructions.
17422 @item -fdump-rtl-bbpart
17423 @opindex fdump-rtl-bbpart
17424 Dump after partitioning hot and cold basic blocks.
17426 @item -fdump-rtl-bbro
17427 @opindex fdump-rtl-bbro
17428 Dump after block reordering.
17430 @item -fdump-rtl-btl1
17431 @itemx -fdump-rtl-btl2
17432 @opindex fdump-rtl-btl2
17433 @opindex fdump-rtl-btl2
17434 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
17435 after the two branch
17436 target load optimization passes.
17438 @item -fdump-rtl-bypass
17439 @opindex fdump-rtl-bypass
17440 Dump after jump bypassing and control flow optimizations.
17442 @item -fdump-rtl-combine
17443 @opindex fdump-rtl-combine
17444 Dump after the RTL instruction combination pass.
17446 @item -fdump-rtl-compgotos
17447 @opindex fdump-rtl-compgotos
17448 Dump after duplicating the computed gotos.
17450 @item -fdump-rtl-ce1
17451 @itemx -fdump-rtl-ce2
17452 @itemx -fdump-rtl-ce3
17453 @opindex fdump-rtl-ce1
17454 @opindex fdump-rtl-ce2
17455 @opindex fdump-rtl-ce3
17456 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
17457 @option{-fdump-rtl-ce3} enable dumping after the three
17458 if conversion passes.
17460 @item -fdump-rtl-cprop_hardreg
17461 @opindex fdump-rtl-cprop_hardreg
17462 Dump after hard register copy propagation.
17464 @item -fdump-rtl-csa
17465 @opindex fdump-rtl-csa
17466 Dump after combining stack adjustments.
17468 @item -fdump-rtl-cse1
17469 @itemx -fdump-rtl-cse2
17470 @opindex fdump-rtl-cse1
17471 @opindex fdump-rtl-cse2
17472 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
17473 the two common subexpression elimination passes.
17475 @item -fdump-rtl-dce
17476 @opindex fdump-rtl-dce
17477 Dump after the standalone dead code elimination passes.
17479 @item -fdump-rtl-dbr
17480 @opindex fdump-rtl-dbr
17481 Dump after delayed branch scheduling.
17483 @item -fdump-rtl-dce1
17484 @itemx -fdump-rtl-dce2
17485 @opindex fdump-rtl-dce1
17486 @opindex fdump-rtl-dce2
17487 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
17488 the two dead store elimination passes.
17490 @item -fdump-rtl-eh
17491 @opindex fdump-rtl-eh
17492 Dump after finalization of EH handling code.
17494 @item -fdump-rtl-eh_ranges
17495 @opindex fdump-rtl-eh_ranges
17496 Dump after conversion of EH handling range regions.
17498 @item -fdump-rtl-expand
17499 @opindex fdump-rtl-expand
17500 Dump after RTL generation.
17502 @item -fdump-rtl-fwprop1
17503 @itemx -fdump-rtl-fwprop2
17504 @opindex fdump-rtl-fwprop1
17505 @opindex fdump-rtl-fwprop2
17506 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
17507 dumping after the two forward propagation passes.
17509 @item -fdump-rtl-gcse1
17510 @itemx -fdump-rtl-gcse2
17511 @opindex fdump-rtl-gcse1
17512 @opindex fdump-rtl-gcse2
17513 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
17514 after global common subexpression elimination.
17516 @item -fdump-rtl-init-regs
17517 @opindex fdump-rtl-init-regs
17518 Dump after the initialization of the registers.
17520 @item -fdump-rtl-initvals
17521 @opindex fdump-rtl-initvals
17522 Dump after the computation of the initial value sets.
17524 @item -fdump-rtl-into_cfglayout
17525 @opindex fdump-rtl-into_cfglayout
17526 Dump after converting to cfglayout mode.
17528 @item -fdump-rtl-ira
17529 @opindex fdump-rtl-ira
17530 Dump after iterated register allocation.
17532 @item -fdump-rtl-jump
17533 @opindex fdump-rtl-jump
17534 Dump after the second jump optimization.
17536 @item -fdump-rtl-loop2
17537 @opindex fdump-rtl-loop2
17538 @option{-fdump-rtl-loop2} enables dumping after the rtl
17539 loop optimization passes.
17541 @item -fdump-rtl-mach
17542 @opindex fdump-rtl-mach
17543 Dump after performing the machine dependent reorganization pass, if that
17546 @item -fdump-rtl-mode_sw
17547 @opindex fdump-rtl-mode_sw
17548 Dump after removing redundant mode switches.
17550 @item -fdump-rtl-rnreg
17551 @opindex fdump-rtl-rnreg
17552 Dump after register renumbering.
17554 @item -fdump-rtl-outof_cfglayout
17555 @opindex fdump-rtl-outof_cfglayout
17556 Dump after converting from cfglayout mode.
17558 @item -fdump-rtl-peephole2
17559 @opindex fdump-rtl-peephole2
17560 Dump after the peephole pass.
17562 @item -fdump-rtl-postreload
17563 @opindex fdump-rtl-postreload
17564 Dump after post-reload optimizations.
17566 @item -fdump-rtl-pro_and_epilogue
17567 @opindex fdump-rtl-pro_and_epilogue
17568 Dump after generating the function prologues and epilogues.
17570 @item -fdump-rtl-sched1
17571 @itemx -fdump-rtl-sched2
17572 @opindex fdump-rtl-sched1
17573 @opindex fdump-rtl-sched2
17574 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
17575 after the basic block scheduling passes.
17577 @item -fdump-rtl-ree
17578 @opindex fdump-rtl-ree
17579 Dump after sign/zero extension elimination.
17581 @item -fdump-rtl-seqabstr
17582 @opindex fdump-rtl-seqabstr
17583 Dump after common sequence discovery.
17585 @item -fdump-rtl-shorten
17586 @opindex fdump-rtl-shorten
17587 Dump after shortening branches.
17589 @item -fdump-rtl-sibling
17590 @opindex fdump-rtl-sibling
17591 Dump after sibling call optimizations.
17593 @item -fdump-rtl-split1
17594 @itemx -fdump-rtl-split2
17595 @itemx -fdump-rtl-split3
17596 @itemx -fdump-rtl-split4
17597 @itemx -fdump-rtl-split5
17598 @opindex fdump-rtl-split1
17599 @opindex fdump-rtl-split2
17600 @opindex fdump-rtl-split3
17601 @opindex fdump-rtl-split4
17602 @opindex fdump-rtl-split5
17603 These options enable dumping after five rounds of
17604 instruction splitting.
17606 @item -fdump-rtl-sms
17607 @opindex fdump-rtl-sms
17608 Dump after modulo scheduling. This pass is only run on some
17611 @item -fdump-rtl-stack
17612 @opindex fdump-rtl-stack
17613 Dump after conversion from GCC's ``flat register file'' registers to the
17614 x87's stack-like registers. This pass is only run on x86 variants.
17616 @item -fdump-rtl-subreg1
17617 @itemx -fdump-rtl-subreg2
17618 @opindex fdump-rtl-subreg1
17619 @opindex fdump-rtl-subreg2
17620 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
17621 the two subreg expansion passes.
17623 @item -fdump-rtl-unshare
17624 @opindex fdump-rtl-unshare
17625 Dump after all rtl has been unshared.
17627 @item -fdump-rtl-vartrack
17628 @opindex fdump-rtl-vartrack
17629 Dump after variable tracking.
17631 @item -fdump-rtl-vregs
17632 @opindex fdump-rtl-vregs
17633 Dump after converting virtual registers to hard registers.
17635 @item -fdump-rtl-web
17636 @opindex fdump-rtl-web
17637 Dump after live range splitting.
17639 @item -fdump-rtl-regclass
17640 @itemx -fdump-rtl-subregs_of_mode_init
17641 @itemx -fdump-rtl-subregs_of_mode_finish
17642 @itemx -fdump-rtl-dfinit
17643 @itemx -fdump-rtl-dfinish
17644 @opindex fdump-rtl-regclass
17645 @opindex fdump-rtl-subregs_of_mode_init
17646 @opindex fdump-rtl-subregs_of_mode_finish
17647 @opindex fdump-rtl-dfinit
17648 @opindex fdump-rtl-dfinish
17649 These dumps are defined but always produce empty files.
17652 @itemx -fdump-rtl-all
17654 @opindex fdump-rtl-all
17655 Produce all the dumps listed above.
17659 Annotate the assembler output with miscellaneous debugging information.
17663 Dump all macro definitions, at the end of preprocessing, in addition to
17668 Produce a core dump whenever an error occurs.
17672 Annotate the assembler output with a comment indicating which
17673 pattern and alternative is used. The length and cost of each instruction are
17678 Dump the RTL in the assembler output as a comment before each instruction.
17679 Also turns on @option{-dp} annotation.
17683 Just generate RTL for a function instead of compiling it. Usually used
17684 with @option{-fdump-rtl-expand}.
17688 @opindex fdump-debug
17689 Dump debugging information generated during the debug
17692 @item -fdump-earlydebug
17693 @opindex fdump-earlydebug
17694 Dump debugging information generated during the early debug
17697 @item -fdump-noaddr
17698 @opindex fdump-noaddr
17699 When doing debugging dumps, suppress address output. This makes it more
17700 feasible to use diff on debugging dumps for compiler invocations with
17701 different compiler binaries and/or different
17702 text / bss / data / heap / stack / dso start locations.
17705 @opindex freport-bug
17706 Collect and dump debug information into a temporary file if an
17707 internal compiler error (ICE) occurs.
17709 @item -fdump-unnumbered
17710 @opindex fdump-unnumbered
17711 When doing debugging dumps, suppress instruction numbers and address output.
17712 This makes it more feasible to use diff on debugging dumps for compiler
17713 invocations with different options, in particular with and without
17716 @item -fdump-unnumbered-links
17717 @opindex fdump-unnumbered-links
17718 When doing debugging dumps (see @option{-d} option above), suppress
17719 instruction numbers for the links to the previous and next instructions
17722 @item -fdump-ipa-@var{switch}
17723 @itemx -fdump-ipa-@var{switch}-@var{options}
17725 Control the dumping at various stages of inter-procedural analysis
17726 language tree to a file. The file name is generated by appending a
17727 switch specific suffix to the source file name, and the file is created
17728 in the same directory as the output file. The following dumps are
17733 Enables all inter-procedural analysis dumps.
17736 Dumps information about call-graph optimization, unused function removal,
17737 and inlining decisions.
17740 Dump after function inlining.
17744 Additionally, the options @option{-optimized}, @option{-missed},
17745 @option{-note}, and @option{-all} can be provided, with the same meaning
17746 as for @option{-fopt-info}, defaulting to @option{-optimized}.
17748 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
17749 information on callsites that were inlined, along with callsites
17750 that were not inlined.
17752 By default, the dump will contain messages about successful
17753 optimizations (equivalent to @option{-optimized}) together with
17754 low-level details about the analysis.
17757 @opindex fdump-lang
17758 Dump language-specific information. The file name is made by appending
17759 @file{.lang} to the source file name.
17761 @item -fdump-lang-all
17762 @itemx -fdump-lang-@var{switch}
17763 @itemx -fdump-lang-@var{switch}-@var{options}
17764 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
17765 @opindex fdump-lang-all
17766 @opindex fdump-lang
17767 Control the dumping of language-specific information. The @var{options}
17768 and @var{filename} portions behave as described in the
17769 @option{-fdump-tree} option. The following @var{switch} values are
17775 Enable all language-specific dumps.
17778 Dump class hierarchy information. Virtual table information is emitted
17779 unless '@option{slim}' is specified. This option is applicable to C++ only.
17782 Dump module information. Options @option{lineno} (locations),
17783 @option{graph} (reachability), @option{blocks} (clusters),
17784 @option{uid} (serialization), @option{alias} (mergeable),
17785 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
17786 (macros) may provide additional information. This option is
17787 applicable to C++ only.
17790 Dump the raw internal tree data. This option is applicable to C++ only.
17794 @item -fdump-passes
17795 @opindex fdump-passes
17796 Print on @file{stderr} the list of optimization passes that are turned
17797 on and off by the current command-line options.
17799 @item -fdump-statistics-@var{option}
17800 @opindex fdump-statistics
17801 Enable and control dumping of pass statistics in a separate file. The
17802 file name is generated by appending a suffix ending in
17803 @samp{.statistics} to the source file name, and the file is created in
17804 the same directory as the output file. If the @samp{-@var{option}}
17805 form is used, @samp{-stats} causes counters to be summed over the
17806 whole compilation unit while @samp{-details} dumps every event as
17807 the passes generate them. The default with no option is to sum
17808 counters for each function compiled.
17810 @item -fdump-tree-all
17811 @itemx -fdump-tree-@var{switch}
17812 @itemx -fdump-tree-@var{switch}-@var{options}
17813 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
17814 @opindex fdump-tree-all
17815 @opindex fdump-tree
17816 Control the dumping at various stages of processing the intermediate
17817 language tree to a file. If the @samp{-@var{options}}
17818 form is used, @var{options} is a list of @samp{-} separated options
17819 which control the details of the dump. Not all options are applicable
17820 to all dumps; those that are not meaningful are ignored. The
17821 following options are available
17825 Print the address of each node. Usually this is not meaningful as it
17826 changes according to the environment and source file. Its primary use
17827 is for tying up a dump file with a debug environment.
17829 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
17830 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
17831 use working backward from mangled names in the assembly file.
17833 When dumping front-end intermediate representations, inhibit dumping
17834 of members of a scope or body of a function merely because that scope
17835 has been reached. Only dump such items when they are directly reachable
17836 by some other path.
17838 When dumping pretty-printed trees, this option inhibits dumping the
17839 bodies of control structures.
17841 When dumping RTL, print the RTL in slim (condensed) form instead of
17842 the default LISP-like representation.
17844 Print a raw representation of the tree. By default, trees are
17845 pretty-printed into a C-like representation.
17847 Enable more detailed dumps (not honored by every dump option). Also
17848 include information from the optimization passes.
17850 Enable dumping various statistics about the pass (not honored by every dump
17853 Enable showing basic block boundaries (disabled in raw dumps).
17855 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
17856 dump a representation of the control flow graph suitable for viewing with
17857 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
17858 the file is pretty-printed as a subgraph, so that GraphViz can render them
17859 all in a single plot.
17861 This option currently only works for RTL dumps, and the RTL is always
17862 dumped in slim form.
17864 Enable showing virtual operands for every statement.
17866 Enable showing line numbers for statements.
17868 Enable showing the unique ID (@code{DECL_UID}) for each variable.
17870 Enable showing the tree dump for each statement.
17872 Enable showing the EH region number holding each statement.
17874 Enable showing scalar evolution analysis details.
17876 Enable showing optimization information (only available in certain
17879 Enable showing missed optimization information (only available in certain
17882 Enable other detailed optimization information (only available in
17885 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
17886 and @option{lineno}.
17888 Turn on all optimization options, i.e., @option{optimized},
17889 @option{missed}, and @option{note}.
17892 To determine what tree dumps are available or find the dump for a pass
17893 of interest follow the steps below.
17897 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
17898 look for a code that corresponds to the pass you are interested in.
17899 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
17900 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
17901 The number at the end distinguishes distinct invocations of the same pass.
17903 To enable the creation of the dump file, append the pass code to
17904 the @option{-fdump-} option prefix and invoke GCC with it. For example,
17905 to enable the dump from the Early Value Range Propagation pass, invoke
17906 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
17907 specify the name of the dump file. If you don't specify one, GCC
17908 creates as described below.
17910 Find the pass dump in a file whose name is composed of three components
17911 separated by a period: the name of the source file GCC was invoked to
17912 compile, a numeric suffix indicating the pass number followed by the
17913 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
17914 and finally the pass code. For example, the Early VRP pass dump might
17915 be in a file named @file{myfile.c.038t.evrp} in the current working
17916 directory. Note that the numeric codes are not stable and may change
17917 from one version of GCC to another.
17921 @itemx -fopt-info-@var{options}
17922 @itemx -fopt-info-@var{options}=@var{filename}
17924 Controls optimization dumps from various optimization passes. If the
17925 @samp{-@var{options}} form is used, @var{options} is a list of
17926 @samp{-} separated option keywords to select the dump details and
17929 The @var{options} can be divided into three groups:
17932 options describing what kinds of messages should be emitted,
17934 options describing the verbosity of the dump, and
17936 options describing which optimizations should be included.
17938 The options from each group can be freely mixed as they are
17939 non-overlapping. However, in case of any conflicts,
17940 the later options override the earlier options on the command
17943 The following options control which kinds of messages should be emitted:
17947 Print information when an optimization is successfully applied. It is
17948 up to a pass to decide which information is relevant. For example, the
17949 vectorizer passes print the source location of loops which are
17950 successfully vectorized.
17952 Print information about missed optimizations. Individual passes
17953 control which information to include in the output.
17955 Print verbose information about optimizations, such as certain
17956 transformations, more detailed messages about decisions etc.
17958 Print detailed optimization information. This includes
17959 @samp{optimized}, @samp{missed}, and @samp{note}.
17962 The following option controls the dump verbosity:
17966 By default, only ``high-level'' messages are emitted. This option enables
17967 additional, more detailed, messages, which are likely to only be of interest
17971 One or more of the following option keywords can be used to describe a
17972 group of optimizations:
17976 Enable dumps from all interprocedural optimizations.
17978 Enable dumps from all loop optimizations.
17980 Enable dumps from all inlining optimizations.
17982 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
17984 Enable dumps from all vectorization optimizations.
17986 Enable dumps from all optimizations. This is a superset of
17987 the optimization groups listed above.
17990 If @var{options} is
17991 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
17992 about successful optimizations from all the passes, omitting messages
17993 that are treated as ``internals''.
17995 If the @var{filename} is provided, then the dumps from all the
17996 applicable optimizations are concatenated into the @var{filename}.
17997 Otherwise the dump is output onto @file{stderr}. Though multiple
17998 @option{-fopt-info} options are accepted, only one of them can include
17999 a @var{filename}. If other filenames are provided then all but the
18000 first such option are ignored.
18002 Note that the output @var{filename} is overwritten
18003 in case of multiple translation units. If a combined output from
18004 multiple translation units is desired, @file{stderr} should be used
18007 In the following example, the optimization info is output to
18016 gcc -O3 -fopt-info-missed=missed.all
18020 outputs missed optimization report from all the passes into
18021 @file{missed.all}, and this one:
18024 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
18028 prints information about missed optimization opportunities from
18029 vectorization passes on @file{stderr}.
18030 Note that @option{-fopt-info-vec-missed} is equivalent to
18031 @option{-fopt-info-missed-vec}. The order of the optimization group
18032 names and message types listed after @option{-fopt-info} does not matter.
18034 As another example,
18036 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
18040 outputs information about missed optimizations as well as
18041 optimized locations from all the inlining passes into
18047 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
18051 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
18052 in conflict since only one output file is allowed. In this case, only
18053 the first option takes effect and the subsequent options are
18054 ignored. Thus only @file{vec.miss} is produced which contains
18055 dumps from the vectorizer about missed opportunities.
18057 @item -fsave-optimization-record
18058 @opindex fsave-optimization-record
18059 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
18060 were performed, for those optimizations that support @option{-fopt-info}.
18062 This option is experimental and the format of the data within the
18063 compressed JSON file is subject to change.
18065 It is roughly equivalent to a machine-readable version of
18066 @option{-fopt-info-all}, as a collection of messages with source file,
18067 line number and column number, with the following additional data for
18073 the execution count of the code being optimized, along with metadata about
18074 whether this was from actual profile data, or just an estimate, allowing
18075 consumers to prioritize messages by code hotness,
18078 the function name of the code being optimized, where applicable,
18081 the ``inlining chain'' for the code being optimized, so that when
18082 a function is inlined into several different places (which might
18083 themselves be inlined), the reader can distinguish between the copies,
18086 objects identifying those parts of the message that refer to expressions,
18087 statements or symbol-table nodes, which of these categories they are, and,
18088 when available, their source code location,
18091 the GCC pass that emitted the message, and
18094 the location in GCC's own code from which the message was emitted
18098 Additionally, some messages are logically nested within other
18099 messages, reflecting implementation details of the optimization
18102 @item -fsched-verbose=@var{n}
18103 @opindex fsched-verbose
18104 On targets that use instruction scheduling, this option controls the
18105 amount of debugging output the scheduler prints to the dump files.
18107 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
18108 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
18109 For @var{n} greater than one, it also output basic block probabilities,
18110 detailed ready list information and unit/insn info. For @var{n} greater
18111 than two, it includes RTL at abort point, control-flow and regions info.
18112 And for @var{n} over four, @option{-fsched-verbose} also includes
18117 @item -fenable-@var{kind}-@var{pass}
18118 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
18122 This is a set of options that are used to explicitly disable/enable
18123 optimization passes. These options are intended for use for debugging GCC.
18124 Compiler users should use regular options for enabling/disabling
18129 @item -fdisable-ipa-@var{pass}
18130 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
18131 statically invoked in the compiler multiple times, the pass name should be
18132 appended with a sequential number starting from 1.
18134 @item -fdisable-rtl-@var{pass}
18135 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
18136 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
18137 statically invoked in the compiler multiple times, the pass name should be
18138 appended with a sequential number starting from 1. @var{range-list} is a
18139 comma-separated list of function ranges or assembler names. Each range is a number
18140 pair separated by a colon. The range is inclusive in both ends. If the range
18141 is trivial, the number pair can be simplified as a single number. If the
18142 function's call graph node's @var{uid} falls within one of the specified ranges,
18143 the @var{pass} is disabled for that function. The @var{uid} is shown in the
18144 function header of a dump file, and the pass names can be dumped by using
18145 option @option{-fdump-passes}.
18147 @item -fdisable-tree-@var{pass}
18148 @itemx -fdisable-tree-@var{pass}=@var{range-list}
18149 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
18152 @item -fenable-ipa-@var{pass}
18153 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
18154 statically invoked in the compiler multiple times, the pass name should be
18155 appended with a sequential number starting from 1.
18157 @item -fenable-rtl-@var{pass}
18158 @itemx -fenable-rtl-@var{pass}=@var{range-list}
18159 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
18160 description and examples.
18162 @item -fenable-tree-@var{pass}
18163 @itemx -fenable-tree-@var{pass}=@var{range-list}
18164 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
18165 of option arguments.
18169 Here are some examples showing uses of these options.
18173 # disable ccp1 for all functions
18174 -fdisable-tree-ccp1
18175 # disable complete unroll for function whose cgraph node uid is 1
18176 -fenable-tree-cunroll=1
18177 # disable gcse2 for functions at the following ranges [1,1],
18178 # [300,400], and [400,1000]
18179 # disable gcse2 for functions foo and foo2
18180 -fdisable-rtl-gcse2=foo,foo2
18181 # disable early inlining
18182 -fdisable-tree-einline
18183 # disable ipa inlining
18184 -fdisable-ipa-inline
18185 # enable tree full unroll
18186 -fenable-tree-unroll
18191 @itemx -fchecking=@var{n}
18193 @opindex fno-checking
18194 Enable internal consistency checking. The default depends on
18195 the compiler configuration. @option{-fchecking=2} enables further
18196 internal consistency checking that might affect code generation.
18198 @item -frandom-seed=@var{string}
18199 @opindex frandom-seed
18200 This option provides a seed that GCC uses in place of
18201 random numbers in generating certain symbol names
18202 that have to be different in every compiled file. It is also used to
18203 place unique stamps in coverage data files and the object files that
18204 produce them. You can use the @option{-frandom-seed} option to produce
18205 reproducibly identical object files.
18207 The @var{string} can either be a number (decimal, octal or hex) or an
18208 arbitrary string (in which case it's converted to a number by
18211 The @var{string} should be different for every file you compile.
18214 @opindex save-temps
18215 Store the usual ``temporary'' intermediate files permanently; name them
18216 as auxiliary output files, as specified described under
18217 @option{-dumpbase} and @option{-dumpdir}.
18219 When used in combination with the @option{-x} command-line option,
18220 @option{-save-temps} is sensible enough to avoid overwriting an
18221 input source file with the same extension as an intermediate file.
18222 The corresponding intermediate file may be obtained by renaming the
18223 source file before using @option{-save-temps}.
18225 @item -save-temps=cwd
18226 @opindex save-temps=cwd
18227 Equivalent to @option{-save-temps -dumpdir ./}.
18229 @item -save-temps=obj
18230 @opindex save-temps=obj
18231 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
18232 @file{outdir/} is the directory of the output file specified after the
18233 @option{-o} option, including any directory separators. If the
18234 @option{-o} option is not used, the @option{-save-temps=obj} switch
18235 behaves like @option{-save-temps=cwd}.
18237 @item -time@r{[}=@var{file}@r{]}
18239 Report the CPU time taken by each subprocess in the compilation
18240 sequence. For C source files, this is the compiler proper and assembler
18241 (plus the linker if linking is done).
18243 Without the specification of an output file, the output looks like this:
18250 The first number on each line is the ``user time'', that is time spent
18251 executing the program itself. The second number is ``system time'',
18252 time spent executing operating system routines on behalf of the program.
18253 Both numbers are in seconds.
18255 With the specification of an output file, the output is appended to the
18256 named file, and it looks like this:
18259 0.12 0.01 cc1 @var{options}
18260 0.00 0.01 as @var{options}
18263 The ``user time'' and the ``system time'' are moved before the program
18264 name, and the options passed to the program are displayed, so that one
18265 can later tell what file was being compiled, and with which options.
18267 @item -fdump-final-insns@r{[}=@var{file}@r{]}
18268 @opindex fdump-final-insns
18269 Dump the final internal representation (RTL) to @var{file}. If the
18270 optional argument is omitted (or if @var{file} is @code{.}), the name
18271 of the dump file is determined by appending @code{.gkd} to the
18272 dump base name, see @option{-dumpbase}.
18274 @item -fcompare-debug@r{[}=@var{opts}@r{]}
18275 @opindex fcompare-debug
18276 @opindex fno-compare-debug
18277 If no error occurs during compilation, run the compiler a second time,
18278 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
18279 passed to the second compilation. Dump the final internal
18280 representation in both compilations, and print an error if they differ.
18282 If the equal sign is omitted, the default @option{-gtoggle} is used.
18284 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
18285 and nonzero, implicitly enables @option{-fcompare-debug}. If
18286 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
18287 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
18290 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
18291 is equivalent to @option{-fno-compare-debug}, which disables the dumping
18292 of the final representation and the second compilation, preventing even
18293 @env{GCC_COMPARE_DEBUG} from taking effect.
18295 To verify full coverage during @option{-fcompare-debug} testing, set
18296 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
18297 which GCC rejects as an invalid option in any actual compilation
18298 (rather than preprocessing, assembly or linking). To get just a
18299 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
18300 not overridden} will do.
18302 @item -fcompare-debug-second
18303 @opindex fcompare-debug-second
18304 This option is implicitly passed to the compiler for the second
18305 compilation requested by @option{-fcompare-debug}, along with options to
18306 silence warnings, and omitting other options that would cause the compiler
18307 to produce output to files or to standard output as a side effect. Dump
18308 files and preserved temporary files are renamed so as to contain the
18309 @code{.gk} additional extension during the second compilation, to avoid
18310 overwriting those generated by the first.
18312 When this option is passed to the compiler driver, it causes the
18313 @emph{first} compilation to be skipped, which makes it useful for little
18314 other than debugging the compiler proper.
18318 Turn off generation of debug info, if leaving out this option
18319 generates it, or turn it on at level 2 otherwise. The position of this
18320 argument in the command line does not matter; it takes effect after all
18321 other options are processed, and it does so only once, no matter how
18322 many times it is given. This is mainly intended to be used with
18323 @option{-fcompare-debug}.
18325 @item -fvar-tracking-assignments-toggle
18326 @opindex fvar-tracking-assignments-toggle
18327 @opindex fno-var-tracking-assignments-toggle
18328 Toggle @option{-fvar-tracking-assignments}, in the same way that
18329 @option{-gtoggle} toggles @option{-g}.
18333 Makes the compiler print out each function name as it is compiled, and
18334 print some statistics about each pass when it finishes.
18336 @item -ftime-report
18337 @opindex ftime-report
18338 Makes the compiler print some statistics about the time consumed by each
18339 pass when it finishes.
18341 @item -ftime-report-details
18342 @opindex ftime-report-details
18343 Record the time consumed by infrastructure parts separately for each pass.
18345 @item -fira-verbose=@var{n}
18346 @opindex fira-verbose
18347 Control the verbosity of the dump file for the integrated register allocator.
18348 The default value is 5. If the value @var{n} is greater or equal to 10,
18349 the dump output is sent to stderr using the same format as @var{n} minus 10.
18352 @opindex flto-report
18353 Prints a report with internal details on the workings of the link-time
18354 optimizer. The contents of this report vary from version to version.
18355 It is meant to be useful to GCC developers when processing object
18356 files in LTO mode (via @option{-flto}).
18358 Disabled by default.
18360 @item -flto-report-wpa
18361 @opindex flto-report-wpa
18362 Like @option{-flto-report}, but only print for the WPA phase of link-time
18366 @opindex fmem-report
18367 Makes the compiler print some statistics about permanent memory
18368 allocation when it finishes.
18370 @item -fmem-report-wpa
18371 @opindex fmem-report-wpa
18372 Makes the compiler print some statistics about permanent memory
18373 allocation for the WPA phase only.
18375 @item -fpre-ipa-mem-report
18376 @opindex fpre-ipa-mem-report
18377 @item -fpost-ipa-mem-report
18378 @opindex fpost-ipa-mem-report
18379 Makes the compiler print some statistics about permanent memory
18380 allocation before or after interprocedural optimization.
18382 @item -fprofile-report
18383 @opindex fprofile-report
18384 Makes the compiler print some statistics about consistency of the
18385 (estimated) profile and effect of individual passes.
18387 @item -fstack-usage
18388 @opindex fstack-usage
18389 Makes the compiler output stack usage information for the program, on a
18390 per-function basis. The filename for the dump is made by appending
18391 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
18392 the output file, if explicitly specified and it is not an executable,
18393 otherwise it is the basename of the source file. An entry is made up
18398 The name of the function.
18402 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
18405 The qualifier @code{static} means that the function manipulates the stack
18406 statically: a fixed number of bytes are allocated for the frame on function
18407 entry and released on function exit; no stack adjustments are otherwise made
18408 in the function. The second field is this fixed number of bytes.
18410 The qualifier @code{dynamic} means that the function manipulates the stack
18411 dynamically: in addition to the static allocation described above, stack
18412 adjustments are made in the body of the function, for example to push/pop
18413 arguments around function calls. If the qualifier @code{bounded} is also
18414 present, the amount of these adjustments is bounded at compile time and
18415 the second field is an upper bound of the total amount of stack used by
18416 the function. If it is not present, the amount of these adjustments is
18417 not bounded at compile time and the second field only represents the
18422 Emit statistics about front-end processing at the end of the compilation.
18423 This option is supported only by the C++ front end, and
18424 the information is generally only useful to the G++ development team.
18426 @item -fdbg-cnt-list
18427 @opindex fdbg-cnt-list
18428 Print the name and the counter upper bound for all debug counters.
18431 @item -fdbg-cnt=@var{counter-value-list}
18433 Set the internal debug counter lower and upper bound. @var{counter-value-list}
18434 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
18435 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
18436 the name of the counter and list of closed intervals.
18437 The @var{lower_bound} is optional and is zero
18438 initialized if not set.
18439 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
18440 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
18441 eleventh invocation.
18442 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
18444 @item -print-file-name=@var{library}
18445 @opindex print-file-name
18446 Print the full absolute name of the library file @var{library} that
18447 would be used when linking---and don't do anything else. With this
18448 option, GCC does not compile or link anything; it just prints the
18451 @item -print-multi-directory
18452 @opindex print-multi-directory
18453 Print the directory name corresponding to the multilib selected by any
18454 other switches present in the command line. This directory is supposed
18455 to exist in @env{GCC_EXEC_PREFIX}.
18457 @item -print-multi-lib
18458 @opindex print-multi-lib
18459 Print the mapping from multilib directory names to compiler switches
18460 that enable them. The directory name is separated from the switches by
18461 @samp{;}, and each switch starts with an @samp{@@} instead of the
18462 @samp{-}, without spaces between multiple switches. This is supposed to
18463 ease shell processing.
18465 @item -print-multi-os-directory
18466 @opindex print-multi-os-directory
18467 Print the path to OS libraries for the selected
18468 multilib, relative to some @file{lib} subdirectory. If OS libraries are
18469 present in the @file{lib} subdirectory and no multilibs are used, this is
18470 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
18471 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
18472 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
18473 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
18475 @item -print-multiarch
18476 @opindex print-multiarch
18477 Print the path to OS libraries for the selected multiarch,
18478 relative to some @file{lib} subdirectory.
18480 @item -print-prog-name=@var{program}
18481 @opindex print-prog-name
18482 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
18484 @item -print-libgcc-file-name
18485 @opindex print-libgcc-file-name
18486 Same as @option{-print-file-name=libgcc.a}.
18488 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
18489 but you do want to link with @file{libgcc.a}. You can do:
18492 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
18495 @item -print-search-dirs
18496 @opindex print-search-dirs
18497 Print the name of the configured installation directory and a list of
18498 program and library directories @command{gcc} searches---and don't do anything else.
18500 This is useful when @command{gcc} prints the error message
18501 @samp{installation problem, cannot exec cpp0: No such file or directory}.
18502 To resolve this you either need to put @file{cpp0} and the other compiler
18503 components where @command{gcc} expects to find them, or you can set the environment
18504 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
18505 Don't forget the trailing @samp{/}.
18506 @xref{Environment Variables}.
18508 @item -print-sysroot
18509 @opindex print-sysroot
18510 Print the target sysroot directory that is used during
18511 compilation. This is the target sysroot specified either at configure
18512 time or using the @option{--sysroot} option, possibly with an extra
18513 suffix that depends on compilation options. If no target sysroot is
18514 specified, the option prints nothing.
18516 @item -print-sysroot-headers-suffix
18517 @opindex print-sysroot-headers-suffix
18518 Print the suffix added to the target sysroot when searching for
18519 headers, or give an error if the compiler is not configured with such
18520 a suffix---and don't do anything else.
18523 @opindex dumpmachine
18524 Print the compiler's target machine (for example,
18525 @samp{i686-pc-linux-gnu})---and don't do anything else.
18528 @opindex dumpversion
18529 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
18530 anything else. This is the compiler version used in filesystem paths and
18531 specs. Depending on how the compiler has been configured it can be just
18532 a single number (major version), two numbers separated by a dot (major and
18533 minor version) or three numbers separated by dots (major, minor and patchlevel
18536 @item -dumpfullversion
18537 @opindex dumpfullversion
18538 Print the full compiler version---and don't do anything else. The output is
18539 always three numbers separated by dots, major, minor and patchlevel version.
18543 Print the compiler's built-in specs---and don't do anything else. (This
18544 is used when GCC itself is being built.) @xref{Spec Files}.
18547 @node Submodel Options
18548 @section Machine-Dependent Options
18549 @cindex submodel options
18550 @cindex specifying hardware config
18551 @cindex hardware models and configurations, specifying
18552 @cindex target-dependent options
18553 @cindex machine-dependent options
18555 Each target machine supported by GCC can have its own options---for
18556 example, to allow you to compile for a particular processor variant or
18557 ABI, or to control optimizations specific to that machine. By
18558 convention, the names of machine-specific options start with
18561 Some configurations of the compiler also support additional target-specific
18562 options, usually for compatibility with other compilers on the same
18565 @c This list is ordered alphanumerically by subsection name.
18566 @c It should be the same order and spelling as these options are listed
18567 @c in Machine Dependent Options
18570 * AArch64 Options::
18571 * Adapteva Epiphany Options::
18572 * AMD GCN Options::
18576 * Blackfin Options::
18582 * DEC Alpha Options::
18587 * GNU/Linux Options::
18597 * MicroBlaze Options::
18600 * MN10300 Options::
18604 * Nios II Options::
18605 * Nvidia PTX Options::
18606 * OpenRISC Options::
18608 * picoChip Options::
18609 * PowerPC Options::
18613 * RS/6000 and PowerPC Options::
18615 * S/390 and zSeries Options::
18618 * Solaris 2 Options::
18620 * System V Options::
18621 * TILE-Gx Options::
18622 * TILEPro Options::
18627 * VxWorks Options::
18629 * x86 Windows Options::
18630 * Xstormy16 Options::
18632 * zSeries Options::
18635 @node AArch64 Options
18636 @subsection AArch64 Options
18637 @cindex AArch64 Options
18639 These options are defined for AArch64 implementations:
18643 @item -mabi=@var{name}
18645 Generate code for the specified data model. Permissible values
18646 are @samp{ilp32} for SysV-like data model where int, long int and pointers
18647 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
18648 but long int and pointers are 64 bits.
18650 The default depends on the specific target configuration. Note that
18651 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
18652 entire program with the same ABI, and link with a compatible set of libraries.
18655 @opindex mbig-endian
18656 Generate big-endian code. This is the default when GCC is configured for an
18657 @samp{aarch64_be-*-*} target.
18659 @item -mgeneral-regs-only
18660 @opindex mgeneral-regs-only
18661 Generate code which uses only the general-purpose registers. This will prevent
18662 the compiler from using floating-point and Advanced SIMD registers but will not
18663 impose any restrictions on the assembler.
18665 @item -mlittle-endian
18666 @opindex mlittle-endian
18667 Generate little-endian code. This is the default when GCC is configured for an
18668 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
18670 @item -mcmodel=tiny
18671 @opindex mcmodel=tiny
18672 Generate code for the tiny code model. The program and its statically defined
18673 symbols must be within 1MB of each other. Programs can be statically or
18674 dynamically linked.
18676 @item -mcmodel=small
18677 @opindex mcmodel=small
18678 Generate code for the small code model. The program and its statically defined
18679 symbols must be within 4GB of each other. Programs can be statically or
18680 dynamically linked. This is the default code model.
18682 @item -mcmodel=large
18683 @opindex mcmodel=large
18684 Generate code for the large code model. This makes no assumptions about
18685 addresses and sizes of sections. Programs can be statically linked only. The
18686 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
18687 @option{-fpic} and @option{-fPIC}.
18689 @item -mstrict-align
18690 @itemx -mno-strict-align
18691 @opindex mstrict-align
18692 @opindex mno-strict-align
18693 Avoid or allow generating memory accesses that may not be aligned on a natural
18694 object boundary as described in the architecture specification.
18696 @item -momit-leaf-frame-pointer
18697 @itemx -mno-omit-leaf-frame-pointer
18698 @opindex momit-leaf-frame-pointer
18699 @opindex mno-omit-leaf-frame-pointer
18700 Omit or keep the frame pointer in leaf functions. The former behavior is the
18703 @item -mstack-protector-guard=@var{guard}
18704 @itemx -mstack-protector-guard-reg=@var{reg}
18705 @itemx -mstack-protector-guard-offset=@var{offset}
18706 @opindex mstack-protector-guard
18707 @opindex mstack-protector-guard-reg
18708 @opindex mstack-protector-guard-offset
18709 Generate stack protection code using canary at @var{guard}. Supported
18710 locations are @samp{global} for a global canary or @samp{sysreg} for a
18711 canary in an appropriate system register.
18713 With the latter choice the options
18714 @option{-mstack-protector-guard-reg=@var{reg}} and
18715 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
18716 which system register to use as base register for reading the canary,
18717 and from what offset from that base register. There is no default
18718 register or offset as this is entirely for use within the Linux
18721 @item -mtls-dialect=desc
18722 @opindex mtls-dialect=desc
18723 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
18724 of TLS variables. This is the default.
18726 @item -mtls-dialect=traditional
18727 @opindex mtls-dialect=traditional
18728 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
18731 @item -mtls-size=@var{size}
18733 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
18734 This option requires binutils 2.26 or newer.
18736 @item -mfix-cortex-a53-835769
18737 @itemx -mno-fix-cortex-a53-835769
18738 @opindex mfix-cortex-a53-835769
18739 @opindex mno-fix-cortex-a53-835769
18740 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
18741 This involves inserting a NOP instruction between memory instructions and
18742 64-bit integer multiply-accumulate instructions.
18744 @item -mfix-cortex-a53-843419
18745 @itemx -mno-fix-cortex-a53-843419
18746 @opindex mfix-cortex-a53-843419
18747 @opindex mno-fix-cortex-a53-843419
18748 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
18749 This erratum workaround is made at link time and this will only pass the
18750 corresponding flag to the linker.
18752 @item -mlow-precision-recip-sqrt
18753 @itemx -mno-low-precision-recip-sqrt
18754 @opindex mlow-precision-recip-sqrt
18755 @opindex mno-low-precision-recip-sqrt
18756 Enable or disable the reciprocal square root approximation.
18757 This option only has an effect if @option{-ffast-math} or
18758 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18759 precision of reciprocal square root results to about 16 bits for
18760 single precision and to 32 bits for double precision.
18762 @item -mlow-precision-sqrt
18763 @itemx -mno-low-precision-sqrt
18764 @opindex mlow-precision-sqrt
18765 @opindex mno-low-precision-sqrt
18766 Enable or disable the square root approximation.
18767 This option only has an effect if @option{-ffast-math} or
18768 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18769 precision of square root results to about 16 bits for
18770 single precision and to 32 bits for double precision.
18771 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
18773 @item -mlow-precision-div
18774 @itemx -mno-low-precision-div
18775 @opindex mlow-precision-div
18776 @opindex mno-low-precision-div
18777 Enable or disable the division approximation.
18778 This option only has an effect if @option{-ffast-math} or
18779 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
18780 precision of division results to about 16 bits for
18781 single precision and to 32 bits for double precision.
18783 @item -mtrack-speculation
18784 @itemx -mno-track-speculation
18785 Enable or disable generation of additional code to track speculative
18786 execution through conditional branches. The tracking state can then
18787 be used by the compiler when expanding calls to
18788 @code{__builtin_speculation_safe_copy} to permit a more efficient code
18789 sequence to be generated.
18791 @item -moutline-atomics
18792 @itemx -mno-outline-atomics
18793 Enable or disable calls to out-of-line helpers to implement atomic operations.
18794 These helpers will, at runtime, determine if the LSE instructions from
18795 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
18796 instructions that are present in the base ARMv8.0 ISA.
18798 This option is only applicable when compiling for the base ARMv8.0
18799 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
18800 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
18801 used directly. The same applies when using @option{-mcpu=} when the
18802 selected cpu supports the @samp{lse} feature.
18803 This option is on by default.
18805 @item -march=@var{name}
18807 Specify the name of the target architecture and, optionally, one or
18808 more feature modifiers. This option has the form
18809 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
18811 The table below summarizes the permissible values for @var{arch}
18812 and the features that they enable by default:
18814 @multitable @columnfractions 0.20 0.20 0.60
18815 @headitem @var{arch} value @tab Architecture @tab Includes by default
18816 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
18817 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
18818 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
18819 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
18820 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
18821 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
18822 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
18823 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
18824 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
18825 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
18828 The value @samp{native} is available on native AArch64 GNU/Linux and
18829 causes the compiler to pick the architecture of the host system. This
18830 option has no effect if the compiler is unable to recognize the
18831 architecture of the host system,
18833 The permissible values for @var{feature} are listed in the sub-section
18834 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18835 Feature Modifiers}. Where conflicting feature modifiers are
18836 specified, the right-most feature is used.
18838 GCC uses @var{name} to determine what kind of instructions it can emit
18839 when generating assembly code. If @option{-march} is specified
18840 without either of @option{-mtune} or @option{-mcpu} also being
18841 specified, the code is tuned to perform well across a range of target
18842 processors implementing the target architecture.
18844 @item -mtune=@var{name}
18846 Specify the name of the target processor for which GCC should tune the
18847 performance of the code. Permissible values for this option are:
18848 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18849 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18850 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18851 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
18852 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
18853 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
18854 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
18855 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{qdf24xx},
18856 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
18857 @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83},
18858 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
18859 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
18860 @samp{octeontx2f95mm},
18862 @samp{thunderx}, @samp{thunderxt88},
18863 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
18864 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
18865 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18866 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18867 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
18868 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x2},
18869 @samp{cortex-a510}, @samp{cortex-a710}, @samp{ampere1}, @samp{native}.
18871 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18872 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18873 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
18874 should tune for a big.LITTLE system.
18876 The value @samp{neoverse-512tvb} specifies that GCC should tune
18877 for Neoverse cores that (a) implement SVE and (b) have a total vector
18878 bandwidth of 512 bits per cycle. In other words, the option tells GCC to
18879 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
18880 instructions a cycle and that can execute an equivalent number of SVE
18881 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
18882 This is more general than tuning for a specific core like Neoverse V1
18883 but is more specific than the default tuning described below.
18885 Additionally on native AArch64 GNU/Linux systems the value
18886 @samp{native} tunes performance to the host system. This option has no effect
18887 if the compiler is unable to recognize the processor of the host system.
18889 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
18890 are specified, the code is tuned to perform well across a range
18891 of target processors.
18893 This option cannot be suffixed by feature modifiers.
18895 @item -mcpu=@var{name}
18897 Specify the name of the target processor, optionally suffixed by one
18898 or more feature modifiers. This option has the form
18899 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
18900 the permissible values for @var{cpu} are the same as those available
18901 for @option{-mtune}. The permissible values for @var{feature} are
18902 documented in the sub-section on
18903 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18904 Feature Modifiers}. Where conflicting feature modifiers are
18905 specified, the right-most feature is used.
18907 GCC uses @var{name} to determine what kind of instructions it can emit when
18908 generating assembly code (as if by @option{-march}) and to determine
18909 the target processor for which to tune for performance (as if
18910 by @option{-mtune}). Where this option is used in conjunction
18911 with @option{-march} or @option{-mtune}, those options take precedence
18912 over the appropriate part of this option.
18914 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
18915 to a specific core, but instead refers to all Neoverse cores that
18916 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
18917 a cycle. Unless overridden by @option{-march},
18918 @option{-mcpu=neoverse-512tvb} generates code that can run on a
18919 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
18920 these properties. Unless overridden by @option{-mtune},
18921 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
18922 @option{-mtune=neoverse-512tvb}.
18924 @item -moverride=@var{string}
18926 Override tuning decisions made by the back-end in response to a
18927 @option{-mtune=} switch. The syntax, semantics, and accepted values
18928 for @var{string} in this option are not guaranteed to be consistent
18931 This option is only intended to be useful when developing GCC.
18933 @item -mverbose-cost-dump
18934 @opindex mverbose-cost-dump
18935 Enable verbose cost model dumping in the debug dump files. This option is
18936 provided for use in debugging the compiler.
18938 @item -mpc-relative-literal-loads
18939 @itemx -mno-pc-relative-literal-loads
18940 @opindex mpc-relative-literal-loads
18941 @opindex mno-pc-relative-literal-loads
18942 Enable or disable PC-relative literal loads. With this option literal pools are
18943 accessed using a single instruction and emitted after each function. This
18944 limits the maximum size of functions to 1MB. This is enabled by default for
18945 @option{-mcmodel=tiny}.
18947 @item -msign-return-address=@var{scope}
18948 @opindex msign-return-address
18949 Select the function scope on which return address signing will be applied.
18950 Permissible values are @samp{none}, which disables return address signing,
18951 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
18952 functions, and @samp{all}, which enables pointer signing for all functions. The
18953 default value is @samp{none}. This option has been deprecated by
18954 -mbranch-protection.
18956 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
18957 @opindex mbranch-protection
18958 Select the branch protection features to use.
18959 @samp{none} is the default and turns off all types of branch protection.
18960 @samp{standard} turns on all types of branch protection features. If a feature
18961 has additional tuning options, then @samp{standard} sets it to its standard
18963 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
18964 level: signing functions that save the return address to memory (non-leaf
18965 functions will practically always do this) using the a-key. The optional
18966 argument @samp{leaf} can be used to extend the signing to include leaf
18967 functions. The optional argument @samp{b-key} can be used to sign the functions
18968 with the B-key instead of the A-key.
18969 @samp{bti} turns on branch target identification mechanism.
18971 @item -mharden-sls=@var{opts}
18972 @opindex mharden-sls
18973 Enable compiler hardening against straight line speculation (SLS).
18974 @var{opts} is a comma-separated list of the following options:
18979 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
18980 @samp{-mharden-sls=none} disables all SLS hardening.
18982 @item -msve-vector-bits=@var{bits}
18983 @opindex msve-vector-bits
18984 Specify the number of bits in an SVE vector register. This option only has
18985 an effect when SVE is enabled.
18987 GCC supports two forms of SVE code generation: ``vector-length
18988 agnostic'' output that works with any size of vector register and
18989 ``vector-length specific'' output that allows GCC to make assumptions
18990 about the vector length when it is useful for optimization reasons.
18991 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
18992 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
18993 Specifying @samp{scalable} selects vector-length agnostic
18994 output. At present @samp{-msve-vector-bits=128} also generates vector-length
18995 agnostic output for big-endian targets. All other values generate
18996 vector-length specific code. The behavior of these values may change
18997 in future releases and no value except @samp{scalable} should be
18998 relied on for producing code that is portable across different
18999 hardware SVE vector lengths.
19001 The default is @samp{-msve-vector-bits=scalable}, which produces
19002 vector-length agnostic code.
19005 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
19006 @anchor{aarch64-feature-modifiers}
19007 @cindex @option{-march} feature modifiers
19008 @cindex @option{-mcpu} feature modifiers
19009 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
19010 the following and their inverses @option{no@var{feature}}:
19014 Enable CRC extension. This is on by default for
19015 @option{-march=armv8.1-a}.
19017 Enable Crypto extension. This also enables Advanced SIMD and floating-point
19020 Enable floating-point instructions. This is on by default for all possible
19021 values for options @option{-march} and @option{-mcpu}.
19023 Enable Advanced SIMD instructions. This also enables floating-point
19024 instructions. This is on by default for all possible values for options
19025 @option{-march} and @option{-mcpu}.
19027 Enable Scalable Vector Extension instructions. This also enables Advanced
19028 SIMD and floating-point instructions.
19030 Enable Large System Extension instructions. This is on by default for
19031 @option{-march=armv8.1-a}.
19033 Enable Round Double Multiply Accumulate instructions. This is on by default
19034 for @option{-march=armv8.1-a}.
19036 Enable FP16 extension. This also enables floating-point instructions.
19038 Enable FP16 fmla extension. This also enables FP16 extensions and
19039 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.
19042 Enable the RcPc extension. This does not change code generation from GCC,
19043 but is passed on to the assembler, enabling inline asm statements to use
19044 instructions from the RcPc extension.
19046 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
19048 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
19051 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
19053 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
19054 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
19056 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
19057 Use of this option with architectures prior to Armv8.2-A is not supported.
19059 Enable the Statistical Profiling extension. This option is only to enable the
19060 extension at the assembler level and does not affect code generation.
19062 Enable the Armv8.5-a Random Number instructions. This option is only to
19063 enable the extension at the assembler level and does not affect code
19066 Enable the Armv8.5-a Memory Tagging Extensions.
19067 Use of this option with architectures prior to Armv8.5-A is not supported.
19069 Enable the Armv8-a Speculation Barrier instruction. This option is only to
19070 enable the extension at the assembler level and does not affect code
19071 generation. This option is enabled by default for @option{-march=armv8.5-a}.
19073 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
19074 is only to enable the extension at the assembler level and does not affect code
19075 generation. This option is enabled by default for @option{-march=armv8.5-a}.
19077 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
19078 This option is only to enable the extension at the assembler level and does
19079 not affect code generation. This option is enabled by default for
19080 @option{-march=armv8.5-a}.
19082 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
19085 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
19087 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
19089 Enable SVE2 aes instructions. This also enables SVE2 instructions.
19091 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
19093 Enable the Transactional Memory Extension.
19095 Enable 8-bit Integer Matrix Multiply instructions. This also enables
19096 Advanced SIMD and floating-point instructions. This option is enabled by
19097 default for @option{-march=armv8.6-a}. Use of this option with architectures
19098 prior to Armv8.2-A is not supported.
19100 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
19101 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
19104 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
19105 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
19108 Enable brain half-precision floating-point instructions. This also enables
19109 Advanced SIMD and floating-point instructions. This option is enabled by
19110 default for @option{-march=armv8.6-a}. Use of this option with architectures
19111 prior to Armv8.2-A is not supported.
19113 Enable the 64-byte atomic load and store instructions for accelerators.
19114 This option is enabled by default for @option{-march=armv8.7-a}.
19116 Enable the Flag Manipulation instructions Extension.
19118 Enable the Pointer Authentication Extension.
19122 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
19123 which implies @option{fp}.
19124 Conversely, @option{nofp} implies @option{nosimd}, which implies
19125 @option{nocrypto}, @option{noaes} and @option{nosha2}.
19127 @node Adapteva Epiphany Options
19128 @subsection Adapteva Epiphany Options
19130 These @samp{-m} options are defined for Adapteva Epiphany:
19133 @item -mhalf-reg-file
19134 @opindex mhalf-reg-file
19135 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
19136 That allows code to run on hardware variants that lack these registers.
19138 @item -mprefer-short-insn-regs
19139 @opindex mprefer-short-insn-regs
19140 Preferentially allocate registers that allow short instruction generation.
19141 This can result in increased instruction count, so this may either reduce or
19142 increase overall code size.
19144 @item -mbranch-cost=@var{num}
19145 @opindex mbranch-cost
19146 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19147 This cost is only a heuristic and is not guaranteed to produce
19148 consistent results across releases.
19152 Enable the generation of conditional moves.
19154 @item -mnops=@var{num}
19156 Emit @var{num} NOPs before every other generated instruction.
19158 @item -mno-soft-cmpsf
19159 @opindex mno-soft-cmpsf
19160 @opindex msoft-cmpsf
19161 For single-precision floating-point comparisons, emit an @code{fsub} instruction
19162 and test the flags. This is faster than a software comparison, but can
19163 get incorrect results in the presence of NaNs, or when two different small
19164 numbers are compared such that their difference is calculated as zero.
19165 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
19166 software comparisons.
19168 @item -mstack-offset=@var{num}
19169 @opindex mstack-offset
19170 Set the offset between the top of the stack and the stack pointer.
19171 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
19172 can be used by leaf functions without stack allocation.
19173 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
19174 Note also that this option changes the ABI; compiling a program with a
19175 different stack offset than the libraries have been compiled with
19176 generally does not work.
19177 This option can be useful if you want to evaluate if a different stack
19178 offset would give you better code, but to actually use a different stack
19179 offset to build working programs, it is recommended to configure the
19180 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
19182 @item -mno-round-nearest
19183 @opindex mno-round-nearest
19184 @opindex mround-nearest
19185 Make the scheduler assume that the rounding mode has been set to
19186 truncating. The default is @option{-mround-nearest}.
19189 @opindex mlong-calls
19190 If not otherwise specified by an attribute, assume all calls might be beyond
19191 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
19192 function address into a register before performing a (otherwise direct) call.
19193 This is the default.
19195 @item -mshort-calls
19196 @opindex short-calls
19197 If not otherwise specified by an attribute, assume all direct calls are
19198 in the range of the @code{b} / @code{bl} instructions, so use these instructions
19199 for direct calls. The default is @option{-mlong-calls}.
19203 Assume addresses can be loaded as 16-bit unsigned values. This does not
19204 apply to function addresses for which @option{-mlong-calls} semantics
19207 @item -mfp-mode=@var{mode}
19209 Set the prevailing mode of the floating-point unit.
19210 This determines the floating-point mode that is provided and expected
19211 at function call and return time. Making this mode match the mode you
19212 predominantly need at function start can make your programs smaller and
19213 faster by avoiding unnecessary mode switches.
19215 @var{mode} can be set to one the following values:
19219 Any mode at function entry is valid, and retained or restored when
19220 the function returns, and when it calls other functions.
19221 This mode is useful for compiling libraries or other compilation units
19222 you might want to incorporate into different programs with different
19223 prevailing FPU modes, and the convenience of being able to use a single
19224 object file outweighs the size and speed overhead for any extra
19225 mode switching that might be needed, compared with what would be needed
19226 with a more specific choice of prevailing FPU mode.
19229 This is the mode used for floating-point calculations with
19230 truncating (i.e.@: round towards zero) rounding mode. That includes
19231 conversion from floating point to integer.
19233 @item round-nearest
19234 This is the mode used for floating-point calculations with
19235 round-to-nearest-or-even rounding mode.
19238 This is the mode used to perform integer calculations in the FPU, e.g.@:
19239 integer multiply, or integer multiply-and-accumulate.
19242 The default is @option{-mfp-mode=caller}
19244 @item -mno-split-lohi
19245 @itemx -mno-postinc
19246 @itemx -mno-postmodify
19247 @opindex mno-split-lohi
19248 @opindex msplit-lohi
19249 @opindex mno-postinc
19251 @opindex mno-postmodify
19252 @opindex mpostmodify
19253 Code generation tweaks that disable, respectively, splitting of 32-bit
19254 loads, generation of post-increment addresses, and generation of
19255 post-modify addresses. The defaults are @option{msplit-lohi},
19256 @option{-mpost-inc}, and @option{-mpost-modify}.
19258 @item -mnovect-double
19259 @opindex mno-vect-double
19260 @opindex mvect-double
19261 Change the preferred SIMD mode to SImode. The default is
19262 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
19264 @item -max-vect-align=@var{num}
19265 @opindex max-vect-align
19266 The maximum alignment for SIMD vector mode types.
19267 @var{num} may be 4 or 8. The default is 8.
19268 Note that this is an ABI change, even though many library function
19269 interfaces are unaffected if they don't use SIMD vector modes
19270 in places that affect size and/or alignment of relevant types.
19272 @item -msplit-vecmove-early
19273 @opindex msplit-vecmove-early
19274 Split vector moves into single word moves before reload. In theory this
19275 can give better register allocation, but so far the reverse seems to be
19276 generally the case.
19278 @item -m1reg-@var{reg}
19280 Specify a register to hold the constant @minus{}1, which makes loading small negative
19281 constants and certain bitmasks faster.
19282 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
19283 which specify use of that register as a fixed register,
19284 and @samp{none}, which means that no register is used for this
19285 purpose. The default is @option{-m1reg-none}.
19289 @node AMD GCN Options
19290 @subsection AMD GCN Options
19291 @cindex AMD GCN Options
19293 These options are defined specifically for the AMD GCN port.
19297 @item -march=@var{gpu}
19299 @itemx -mtune=@var{gpu}
19301 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
19307 Compile for GCN3 Fiji devices (gfx803).
19310 Compile for GCN5 Vega 10 devices (gfx900).
19313 Compile for GCN5 Vega 20 devices (gfx906).
19317 @item -msram-ecc=on
19318 @itemx -msram-ecc=off
19319 @itemx -msram-ecc=any
19321 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
19322 disabled, or either mode. This feature can be enabled per-process on some
19323 devices. The compiled code must match the device mode. The default is
19324 @samp{any}, for devices that support it.
19326 @item -mstack-size=@var{bytes}
19327 @opindex mstack-size
19328 Specify how many @var{bytes} of stack space will be requested for each GPU
19329 thread (wave-front). Beware that there may be many threads and limited memory
19330 available. The size of the stack allocation may also have an impact on
19331 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
19336 Compile binaries suitable for devices with the XNACK feature enabled. Some
19337 devices always require XNACK and some allow the user to configure XNACK. The
19338 compiled code must match the device mode. The default is @samp{-mno-xnack}.
19339 At present this option is a placeholder for support that is not yet
19345 @subsection ARC Options
19346 @cindex ARC options
19348 The following options control the architecture variant for which code
19351 @c architecture variants
19354 @item -mbarrel-shifter
19355 @opindex mbarrel-shifter
19356 Generate instructions supported by barrel shifter. This is the default
19357 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
19360 @opindex mjli-alawys
19361 Force to call a function using jli_s instruction. This option is
19362 valid only for ARCv2 architecture.
19364 @item -mcpu=@var{cpu}
19366 Set architecture type, register usage, and instruction scheduling
19367 parameters for @var{cpu}. There are also shortcut alias options
19368 available for backward compatibility and convenience. Supported
19369 values for @var{cpu} are
19375 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
19379 Compile for ARC601. Alias: @option{-mARC601}.
19384 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
19385 This is the default when configured with @option{--with-cpu=arc700}@.
19388 Compile for ARC EM.
19391 Compile for ARC HS.
19394 Compile for ARC EM CPU with no hardware extensions.
19397 Compile for ARC EM4 CPU.
19400 Compile for ARC EM4 DMIPS CPU.
19403 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
19407 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
19408 double assist instructions.
19411 Compile for ARC HS CPU with no hardware extensions except the atomic
19415 Compile for ARC HS34 CPU.
19418 Compile for ARC HS38 CPU.
19421 Compile for ARC HS38 CPU with all hardware extensions on.
19424 Compile for ARC 600 CPU with @code{norm} instructions enabled.
19426 @item arc600_mul32x16
19427 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
19428 instructions enabled.
19431 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
19432 instructions enabled.
19435 Compile for ARC 601 CPU with @code{norm} instructions enabled.
19437 @item arc601_mul32x16
19438 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
19439 instructions enabled.
19442 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
19443 instructions enabled.
19446 Compile for ARC 700 on NPS400 chip.
19449 Compile for ARC EM minimalist configuration featuring reduced register
19456 @itemx -mdpfp-compact
19457 @opindex mdpfp-compact
19458 Generate double-precision FPX instructions, tuned for the compact
19462 @opindex mdpfp-fast
19463 Generate double-precision FPX instructions, tuned for the fast
19466 @item -mno-dpfp-lrsr
19467 @opindex mno-dpfp-lrsr
19468 Disable @code{lr} and @code{sr} instructions from using FPX extension
19473 Generate extended arithmetic instructions. Currently only
19474 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
19475 supported. Only valid for @option{-mcpu=ARC700}.
19480 Do not generate @code{mpy}-family instructions for ARC700. This option is
19485 Generate 32x16-bit multiply and multiply-accumulate instructions.
19489 Generate @code{mul64} and @code{mulu64} instructions.
19490 Only valid for @option{-mcpu=ARC600}.
19494 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
19499 @itemx -mspfp-compact
19500 @opindex mspfp-compact
19501 Generate single-precision FPX instructions, tuned for the compact
19505 @opindex mspfp-fast
19506 Generate single-precision FPX instructions, tuned for the fast
19511 Enable generation of ARC SIMD instructions via target-specific
19512 builtins. Only valid for @option{-mcpu=ARC700}.
19515 @opindex msoft-float
19516 This option ignored; it is provided for compatibility purposes only.
19517 Software floating-point code is emitted by default, and this default
19518 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
19519 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
19520 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
19524 Generate @code{swap} instructions.
19528 This enables use of the locked load/store conditional extension to implement
19529 atomic memory built-in functions. Not available for ARC 6xx or ARC
19534 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
19536 @item -mcode-density
19537 @opindex mcode-density
19538 Enable code density instructions for ARC EM.
19539 This option is on by default for ARC HS.
19543 Enable double load/store operations for ARC HS cores.
19545 @item -mtp-regno=@var{regno}
19547 Specify thread pointer register number.
19549 @item -mmpy-option=@var{multo}
19550 @opindex mmpy-option
19551 Compile ARCv2 code with a multiplier design option. You can specify
19552 the option using either a string or numeric value for @var{multo}.
19553 @samp{wlh1} is the default value. The recognized values are:
19558 No multiplier available.
19562 16x16 multiplier, fully pipelined.
19563 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
19567 32x32 multiplier, fully
19568 pipelined (1 stage). The following instructions are additionally
19569 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19573 32x32 multiplier, fully pipelined
19574 (2 stages). The following instructions are additionally enabled: @code{mpy},
19575 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19579 Two 16x16 multipliers, blocking,
19580 sequential. The following instructions are additionally enabled: @code{mpy},
19581 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19585 One 16x16 multiplier, blocking,
19586 sequential. The following instructions are additionally enabled: @code{mpy},
19587 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19591 One 32x4 multiplier, blocking,
19592 sequential. The following instructions are additionally enabled: @code{mpy},
19593 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
19597 ARC HS SIMD support.
19601 ARC HS SIMD support.
19605 ARC HS SIMD support.
19609 This option is only available for ARCv2 cores@.
19611 @item -mfpu=@var{fpu}
19613 Enables support for specific floating-point hardware extensions for ARCv2
19614 cores. Supported values for @var{fpu} are:
19619 Enables support for single-precision floating-point hardware
19623 Enables support for double-precision floating-point hardware
19624 extensions. The single-precision floating-point extension is also
19625 enabled. Not available for ARC EM@.
19628 Enables support for double-precision floating-point hardware
19629 extensions using double-precision assist instructions. The single-precision
19630 floating-point extension is also enabled. This option is
19631 only available for ARC EM@.
19634 Enables support for double-precision floating-point hardware
19635 extensions using double-precision assist instructions.
19636 The single-precision floating-point, square-root, and divide
19637 extensions are also enabled. This option is
19638 only available for ARC EM@.
19641 Enables support for double-precision floating-point hardware
19642 extensions using double-precision assist instructions.
19643 The single-precision floating-point and fused multiply and add
19644 hardware extensions are also enabled. This option is
19645 only available for ARC EM@.
19648 Enables support for double-precision floating-point hardware
19649 extensions using double-precision assist instructions.
19650 All single-precision floating-point hardware extensions are also
19651 enabled. This option is only available for ARC EM@.
19654 Enables support for single-precision floating-point, square-root and divide
19655 hardware extensions@.
19658 Enables support for double-precision floating-point, square-root and divide
19659 hardware extensions. This option
19660 includes option @samp{fpus_div}. Not available for ARC EM@.
19663 Enables support for single-precision floating-point and
19664 fused multiply and add hardware extensions@.
19667 Enables support for double-precision floating-point and
19668 fused multiply and add hardware extensions. This option
19669 includes option @samp{fpus_fma}. Not available for ARC EM@.
19672 Enables support for all single-precision floating-point hardware
19676 Enables support for all single- and double-precision floating-point
19677 hardware extensions. Not available for ARC EM@.
19681 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
19682 @opindex mirq-ctrl-saved
19683 Specifies general-purposes registers that the processor automatically
19684 saves/restores on interrupt entry and exit. @var{register-range} is
19685 specified as two registers separated by a dash. The register range
19686 always starts with @code{r0}, the upper limit is @code{fp} register.
19687 @var{blink} and @var{lp_count} are optional. This option is only
19688 valid for ARC EM and ARC HS cores.
19690 @item -mrgf-banked-regs=@var{number}
19691 @opindex mrgf-banked-regs
19692 Specifies the number of registers replicated in second register bank
19693 on entry to fast interrupt. Fast interrupts are interrupts with the
19694 highest priority level P0. These interrupts save only PC and STATUS32
19695 registers to avoid memory transactions during interrupt entry and exit
19696 sequences. Use this option when you are using fast interrupts in an
19697 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
19699 @item -mlpc-width=@var{width}
19700 @opindex mlpc-width
19701 Specify the width of the @code{lp_count} register. Valid values for
19702 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
19703 fixed to 32 bits. If the width is less than 32, the compiler does not
19704 attempt to transform loops in your program to use the zero-delay loop
19705 mechanism unless it is known that the @code{lp_count} register can
19706 hold the required loop-counter value. Depending on the width
19707 specified, the compiler and run-time library might continue to use the
19708 loop mechanism for various needs. This option defines macro
19709 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
19713 This option instructs the compiler to generate code for a 16-entry
19714 register file. This option defines the @code{__ARC_RF16__}
19715 preprocessor macro.
19717 @item -mbranch-index
19718 @opindex mbranch-index
19719 Enable use of @code{bi} or @code{bih} instructions to implement jump
19724 The following options are passed through to the assembler, and also
19725 define preprocessor macro symbols.
19727 @c Flags used by the assembler, but for which we define preprocessor
19728 @c macro symbols as well.
19731 @opindex mdsp-packa
19732 Passed down to the assembler to enable the DSP Pack A extensions.
19733 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
19738 Passed down to the assembler to enable the dual Viterbi butterfly
19739 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
19740 option is deprecated.
19742 @c ARC700 4.10 extension instruction
19745 Passed down to the assembler to enable the locked load/store
19746 conditional extension. Also sets the preprocessor symbol
19751 Passed down to the assembler. Also sets the preprocessor symbol
19752 @code{__Xxmac_d16}. This option is deprecated.
19756 Passed down to the assembler. Also sets the preprocessor symbol
19757 @code{__Xxmac_24}. This option is deprecated.
19759 @c ARC700 4.10 extension instruction
19762 Passed down to the assembler to enable the 64-bit time-stamp counter
19763 extension instruction. Also sets the preprocessor symbol
19764 @code{__Xrtsc}. This option is deprecated.
19766 @c ARC700 4.10 extension instruction
19769 Passed down to the assembler to enable the swap byte ordering
19770 extension instruction. Also sets the preprocessor symbol
19774 @opindex mtelephony
19775 Passed down to the assembler to enable dual- and single-operand
19776 instructions for telephony. Also sets the preprocessor symbol
19777 @code{__Xtelephony}. This option is deprecated.
19781 Passed down to the assembler to enable the XY memory extension. Also
19782 sets the preprocessor symbol @code{__Xxy}.
19786 The following options control how the assembly code is annotated:
19788 @c Assembly annotation options
19792 Annotate assembler instructions with estimated addresses.
19794 @item -mannotate-align
19795 @opindex mannotate-align
19796 Explain what alignment considerations lead to the decision to make an
19797 instruction short or long.
19801 The following options are passed through to the linker:
19803 @c options passed through to the linker
19807 Passed through to the linker, to specify use of the @code{arclinux} emulation.
19808 This option is enabled by default in tool chains built for
19809 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
19810 when profiling is not requested.
19812 @item -marclinux_prof
19813 @opindex marclinux_prof
19814 Passed through to the linker, to specify use of the
19815 @code{arclinux_prof} emulation. This option is enabled by default in
19816 tool chains built for @w{@code{arc-linux-uclibc}} and
19817 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
19821 The following options control the semantics of generated code:
19823 @c semantically relevant code generation options
19826 @opindex mlong-calls
19827 Generate calls as register indirect calls, thus providing access
19828 to the full 32-bit address range.
19830 @item -mmedium-calls
19831 @opindex mmedium-calls
19832 Don't use less than 25-bit addressing range for calls, which is the
19833 offset available for an unconditional branch-and-link
19834 instruction. Conditional execution of function calls is suppressed, to
19835 allow use of the 25-bit range, rather than the 21-bit range with
19836 conditional branch-and-link. This is the default for tool chains built
19837 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
19841 Put definitions of externally-visible data in a small data section if
19842 that data is no bigger than @var{num} bytes. The default value of
19843 @var{num} is 4 for any ARC configuration, or 8 when we have double
19844 load/store operations.
19849 Do not generate sdata references. This is the default for tool chains
19850 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
19853 @item -mvolatile-cache
19854 @opindex mvolatile-cache
19855 Use ordinarily cached memory accesses for volatile references. This is the
19858 @item -mno-volatile-cache
19859 @opindex mno-volatile-cache
19860 @opindex mvolatile-cache
19861 Enable cache bypass for volatile references.
19865 The following options fine tune code generation:
19866 @c code generation tuning options
19869 @opindex malign-call
19870 Does nothing. Preserved for backward compatibility.
19872 @item -mauto-modify-reg
19873 @opindex mauto-modify-reg
19874 Enable the use of pre/post modify with register displacement.
19876 @item -mbbit-peephole
19877 @opindex mbbit-peephole
19878 Enable bbit peephole2.
19882 This option disables a target-specific pass in @file{arc_reorg} to
19883 generate compare-and-branch (@code{br@var{cc}}) instructions.
19884 It has no effect on
19885 generation of these instructions driven by the combiner pass.
19887 @item -mcase-vector-pcrel
19888 @opindex mcase-vector-pcrel
19889 Use PC-relative switch case tables to enable case table shortening.
19890 This is the default for @option{-Os}.
19892 @item -mcompact-casesi
19893 @opindex mcompact-casesi
19894 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
19895 and only available for ARCv1 cores. This option is deprecated.
19897 @item -mno-cond-exec
19898 @opindex mno-cond-exec
19899 Disable the ARCompact-specific pass to generate conditional
19900 execution instructions.
19902 Due to delay slot scheduling and interactions between operand numbers,
19903 literal sizes, instruction lengths, and the support for conditional execution,
19904 the target-independent pass to generate conditional execution is often lacking,
19905 so the ARC port has kept a special pass around that tries to find more
19906 conditional execution generation opportunities after register allocation,
19907 branch shortening, and delay slot scheduling have been done. This pass
19908 generally, but not always, improves performance and code size, at the cost of
19909 extra compilation time, which is why there is an option to switch it off.
19910 If you have a problem with call instructions exceeding their allowable
19911 offset range because they are conditionalized, you should consider using
19912 @option{-mmedium-calls} instead.
19914 @item -mearly-cbranchsi
19915 @opindex mearly-cbranchsi
19916 Enable pre-reload use of the @code{cbranchsi} pattern.
19918 @item -mexpand-adddi
19919 @opindex mexpand-adddi
19920 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
19921 @code{add.f}, @code{adc} etc. This option is deprecated.
19923 @item -mindexed-loads
19924 @opindex mindexed-loads
19925 Enable the use of indexed loads. This can be problematic because some
19926 optimizers then assume that indexed stores exist, which is not
19931 Enable Local Register Allocation. This is still experimental for ARC,
19932 so by default the compiler uses standard reload
19933 (i.e.@: @option{-mno-lra}).
19935 @item -mlra-priority-none
19936 @opindex mlra-priority-none
19937 Don't indicate any priority for target registers.
19939 @item -mlra-priority-compact
19940 @opindex mlra-priority-compact
19941 Indicate target register priority for r0..r3 / r12..r15.
19943 @item -mlra-priority-noncompact
19944 @opindex mlra-priority-noncompact
19945 Reduce target register priority for r0..r3 / r12..r15.
19948 @opindex mmillicode
19949 When optimizing for size (using @option{-Os}), prologues and epilogues
19950 that have to save or restore a large number of registers are often
19951 shortened by using call to a special function in libgcc; this is
19952 referred to as a @emph{millicode} call. As these calls can pose
19953 performance issues, and/or cause linking issues when linking in a
19954 nonstandard way, this option is provided to turn on or off millicode
19957 @item -mcode-density-frame
19958 @opindex mcode-density-frame
19959 This option enable the compiler to emit @code{enter} and @code{leave}
19960 instructions. These instructions are only valid for CPUs with
19961 code-density feature.
19964 @opindex mmixed-code
19965 Does nothing. Preserved for backward compatibility.
19969 Ths option is deprecated. Enable @samp{q} instruction alternatives.
19970 This is the default for @option{-Os}.
19974 Enable @samp{Rcq} constraint handling.
19975 Most short code generation depends on this.
19976 This is the default.
19980 Enable @samp{Rcw} constraint handling.
19981 Most ccfsm condexec mostly depends on this.
19982 This is the default.
19984 @item -msize-level=@var{level}
19985 @opindex msize-level
19986 Fine-tune size optimization with regards to instruction lengths and alignment.
19987 The recognized values for @var{level} are:
19990 No size optimization. This level is deprecated and treated like @samp{1}.
19993 Short instructions are used opportunistically.
19996 In addition, alignment of loops and of code after barriers are dropped.
19999 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
20003 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
20004 the behavior when this is not set is equivalent to level @samp{1}.
20006 @item -mtune=@var{cpu}
20008 Set instruction scheduling parameters for @var{cpu}, overriding any implied
20009 by @option{-mcpu=}.
20011 Supported values for @var{cpu} are
20015 Tune for ARC600 CPU.
20018 Tune for ARC601 CPU.
20021 Tune for ARC700 CPU with standard multiplier block.
20024 Tune for ARC700 CPU with XMAC block.
20027 Tune for ARC725D CPU.
20030 Tune for ARC750D CPU.
20034 @item -mmultcost=@var{num}
20036 Cost to assume for a multiply instruction, with @samp{4} being equal to a
20037 normal instruction.
20039 @item -munalign-prob-threshold=@var{probability}
20040 @opindex munalign-prob-threshold
20041 Does nothing. Preserved for backward compatibility.
20045 The following options are maintained for backward compatibility, but
20046 are now deprecated and will be removed in a future release:
20048 @c Deprecated options
20056 @opindex mbig-endian
20059 Compile code for big-endian targets. Use of these options is now
20060 deprecated. Big-endian code is supported by configuring GCC to build
20061 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
20062 for which big endian is the default.
20064 @item -mlittle-endian
20065 @opindex mlittle-endian
20068 Compile code for little-endian targets. Use of these options is now
20069 deprecated. Little-endian code is supported by configuring GCC to build
20070 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
20071 for which little endian is the default.
20073 @item -mbarrel_shifter
20074 @opindex mbarrel_shifter
20075 Replaced by @option{-mbarrel-shifter}.
20077 @item -mdpfp_compact
20078 @opindex mdpfp_compact
20079 Replaced by @option{-mdpfp-compact}.
20082 @opindex mdpfp_fast
20083 Replaced by @option{-mdpfp-fast}.
20086 @opindex mdsp_packa
20087 Replaced by @option{-mdsp-packa}.
20091 Replaced by @option{-mea}.
20095 Replaced by @option{-mmac-24}.
20099 Replaced by @option{-mmac-d16}.
20101 @item -mspfp_compact
20102 @opindex mspfp_compact
20103 Replaced by @option{-mspfp-compact}.
20106 @opindex mspfp_fast
20107 Replaced by @option{-mspfp-fast}.
20109 @item -mtune=@var{cpu}
20111 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
20112 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
20113 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
20115 @item -multcost=@var{num}
20117 Replaced by @option{-mmultcost}.
20122 @subsection ARM Options
20123 @cindex ARM options
20125 These @samp{-m} options are defined for the ARM port:
20128 @item -mabi=@var{name}
20130 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
20131 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
20134 @opindex mapcs-frame
20135 Generate a stack frame that is compliant with the ARM Procedure Call
20136 Standard for all functions, even if this is not strictly necessary for
20137 correct execution of the code. Specifying @option{-fomit-frame-pointer}
20138 with this option causes the stack frames not to be generated for
20139 leaf functions. The default is @option{-mno-apcs-frame}.
20140 This option is deprecated.
20144 This is a synonym for @option{-mapcs-frame} and is deprecated.
20147 @c not currently implemented
20148 @item -mapcs-stack-check
20149 @opindex mapcs-stack-check
20150 Generate code to check the amount of stack space available upon entry to
20151 every function (that actually uses some stack space). If there is
20152 insufficient space available then either the function
20153 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
20154 called, depending upon the amount of stack space required. The runtime
20155 system is required to provide these functions. The default is
20156 @option{-mno-apcs-stack-check}, since this produces smaller code.
20158 @c not currently implemented
20159 @item -mapcs-reentrant
20160 @opindex mapcs-reentrant
20161 Generate reentrant, position-independent code. The default is
20162 @option{-mno-apcs-reentrant}.
20165 @item -mthumb-interwork
20166 @opindex mthumb-interwork
20167 Generate code that supports calling between the ARM and Thumb
20168 instruction sets. Without this option, on pre-v5 architectures, the
20169 two instruction sets cannot be reliably used inside one program. The
20170 default is @option{-mno-thumb-interwork}, since slightly larger code
20171 is generated when @option{-mthumb-interwork} is specified. In AAPCS
20172 configurations this option is meaningless.
20174 @item -mno-sched-prolog
20175 @opindex mno-sched-prolog
20176 @opindex msched-prolog
20177 Prevent the reordering of instructions in the function prologue, or the
20178 merging of those instruction with the instructions in the function's
20179 body. This means that all functions start with a recognizable set
20180 of instructions (or in fact one of a choice from a small set of
20181 different function prologues), and this information can be used to
20182 locate the start of functions inside an executable piece of code. The
20183 default is @option{-msched-prolog}.
20185 @item -mfloat-abi=@var{name}
20186 @opindex mfloat-abi
20187 Specifies which floating-point ABI to use. Permissible values
20188 are: @samp{soft}, @samp{softfp} and @samp{hard}.
20190 Specifying @samp{soft} causes GCC to generate output containing
20191 library calls for floating-point operations.
20192 @samp{softfp} allows the generation of code using hardware floating-point
20193 instructions, but still uses the soft-float calling conventions.
20194 @samp{hard} allows generation of floating-point instructions
20195 and uses FPU-specific calling conventions.
20197 The default depends on the specific target configuration. Note that
20198 the hard-float and soft-float ABIs are not link-compatible; you must
20199 compile your entire program with the same ABI, and link with a
20200 compatible set of libraries.
20202 @item -mgeneral-regs-only
20203 @opindex mgeneral-regs-only
20204 Generate code which uses only the general-purpose registers. This will prevent
20205 the compiler from using floating-point and Advanced SIMD registers but will not
20206 impose any restrictions on the assembler.
20208 @item -mlittle-endian
20209 @opindex mlittle-endian
20210 Generate code for a processor running in little-endian mode. This is
20211 the default for all standard configurations.
20214 @opindex mbig-endian
20215 Generate code for a processor running in big-endian mode; the default is
20216 to compile code for a little-endian processor.
20221 When linking a big-endian image select between BE8 and BE32 formats.
20222 The option has no effect for little-endian images and is ignored. The
20223 default is dependent on the selected target architecture. For ARMv6
20224 and later architectures the default is BE8, for older architectures
20225 the default is BE32. BE32 format has been deprecated by ARM.
20227 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
20229 This specifies the name of the target ARM architecture. GCC uses this
20230 name to determine what kind of instructions it can emit when generating
20231 assembly code. This option can be used in conjunction with or instead
20232 of the @option{-mcpu=} option.
20234 Permissible names are:
20236 @samp{armv5t}, @samp{armv5te},
20237 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
20238 @samp{armv6z}, @samp{armv6zk},
20239 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
20240 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
20247 @samp{armv6-m}, @samp{armv6s-m},
20248 @samp{armv7-m}, @samp{armv7e-m},
20249 @samp{armv8-m.base}, @samp{armv8-m.main},
20250 @samp{armv8.1-m.main},
20252 @samp{iwmmxt} and @samp{iwmmxt2}.
20254 Additionally, the following architectures, which lack support for the
20255 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
20257 Many of the architectures support extensions. These can be added by
20258 appending @samp{+@var{extension}} to the architecture name. Extension
20259 options are processed in order and capabilities accumulate. An extension
20260 will also enable any necessary base extensions
20261 upon which it depends. For example, the @samp{+crypto} extension
20262 will always enable the @samp{+simd} extension. The exception to the
20263 additive construction is for extensions that are prefixed with
20264 @samp{+no@dots{}}: these extensions disable the specified option and
20265 any other extensions that may depend on the presence of that
20268 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
20269 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
20270 entirely disabled by the @samp{+nofp} option that follows it.
20272 Most extension names are generically named, but have an effect that is
20273 dependent upon the architecture to which it is applied. For example,
20274 the @samp{+simd} option can be applied to both @samp{armv7-a} and
20275 @samp{armv8-a} architectures, but will enable the original ARMv7-A
20276 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
20277 variant for @samp{armv8-a}.
20279 The table below lists the supported extensions for each architecture.
20280 Architectures not mentioned do not support any extensions.
20293 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
20294 used as an alias for this extension.
20297 Disable the floating-point instructions.
20301 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
20304 The VFPv3 floating-point instructions, with 16 double-precision
20305 registers. The extension @samp{+vfpv3-d16} can be used as an alias
20306 for this extension. Note that floating-point is not supported by the
20307 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
20308 ARMv7-R architectures.
20311 Disable the floating-point instructions.
20317 The multiprocessing extension.
20320 The security extension.
20323 The VFPv3 floating-point instructions, with 16 double-precision
20324 registers. The extension @samp{+vfpv3-d16} can be used as an alias
20325 for this extension.
20328 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
20329 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
20330 for this extension.
20333 The VFPv3 floating-point instructions, with 32 double-precision
20336 @item +vfpv3-d16-fp16
20337 The VFPv3 floating-point instructions, with 16 double-precision
20338 registers and the half-precision floating-point conversion operations.
20341 The VFPv3 floating-point instructions, with 32 double-precision
20342 registers and the half-precision floating-point conversion operations.
20345 The VFPv4 floating-point instructions, with 16 double-precision
20349 The VFPv4 floating-point instructions, with 32 double-precision
20353 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
20354 the half-precision floating-point conversion operations.
20357 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
20360 Disable the Advanced SIMD instructions (does not disable floating point).
20363 Disable the floating-point and Advanced SIMD instructions.
20367 The extended version of the ARMv7-A architecture with support for
20371 The VFPv4 floating-point instructions, with 16 double-precision registers.
20372 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
20375 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
20376 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
20379 The VFPv3 floating-point instructions, with 16 double-precision
20383 The VFPv3 floating-point instructions, with 32 double-precision
20386 @item +vfpv3-d16-fp16
20387 The VFPv3 floating-point instructions, with 16 double-precision
20388 registers and the half-precision floating-point conversion operations.
20391 The VFPv3 floating-point instructions, with 32 double-precision
20392 registers and the half-precision floating-point conversion operations.
20395 The VFPv4 floating-point instructions, with 16 double-precision
20399 The VFPv4 floating-point instructions, with 32 double-precision
20403 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
20404 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
20407 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
20408 the half-precision floating-point conversion operations.
20411 Disable the Advanced SIMD instructions (does not disable floating point).
20414 Disable the floating-point and Advanced SIMD instructions.
20420 The Cyclic Redundancy Check (CRC) instructions.
20422 The ARMv8-A Advanced SIMD and floating-point instructions.
20424 The cryptographic instructions.
20426 Disable the cryptographic instructions.
20428 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20430 Speculation Barrier Instruction.
20432 Execution and Data Prediction Restriction Instructions.
20438 The ARMv8.1-A Advanced SIMD and floating-point instructions.
20441 The cryptographic instructions. This also enables the Advanced SIMD and
20442 floating-point instructions.
20445 Disable the cryptographic instructions.
20448 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20451 Speculation Barrier Instruction.
20454 Execution and Data Prediction Restriction Instructions.
20461 The half-precision floating-point data processing instructions.
20462 This also enables the Advanced SIMD and floating-point instructions.
20465 The half-precision floating-point fmla extension. This also enables
20466 the half-precision floating-point extension and Advanced SIMD and
20467 floating-point instructions.
20470 The ARMv8.1-A Advanced SIMD and floating-point instructions.
20473 The cryptographic instructions. This also enables the Advanced SIMD and
20474 floating-point instructions.
20477 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
20480 Disable the cryptographic extension.
20483 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20486 Speculation Barrier Instruction.
20489 Execution and Data Prediction Restriction Instructions.
20492 8-bit Integer Matrix Multiply instructions.
20493 This also enables Advanced SIMD and floating-point instructions.
20496 Brain half-precision floating-point instructions.
20497 This also enables Advanced SIMD and floating-point instructions.
20503 The half-precision floating-point data processing instructions.
20504 This also enables the Advanced SIMD and floating-point instructions as well
20505 as the Dot Product extension and the half-precision floating-point fmla
20509 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20510 Dot Product extension.
20513 The cryptographic instructions. This also enables the Advanced SIMD and
20514 floating-point instructions as well as the Dot Product extension.
20517 Disable the cryptographic extension.
20520 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20523 Speculation Barrier Instruction.
20526 Execution and Data Prediction Restriction Instructions.
20529 8-bit Integer Matrix Multiply instructions.
20530 This also enables Advanced SIMD and floating-point instructions.
20533 Brain half-precision floating-point instructions.
20534 This also enables Advanced SIMD and floating-point instructions.
20540 The half-precision floating-point data processing instructions.
20541 This also enables the Advanced SIMD and floating-point instructions as well
20542 as the Dot Product extension and the half-precision floating-point fmla
20546 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20547 Dot Product extension.
20550 The cryptographic instructions. This also enables the Advanced SIMD and
20551 floating-point instructions as well as the Dot Product extension.
20554 Disable the cryptographic extension.
20557 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20560 8-bit Integer Matrix Multiply instructions.
20561 This also enables Advanced SIMD and floating-point instructions.
20564 Brain half-precision floating-point instructions.
20565 This also enables Advanced SIMD and floating-point instructions.
20571 The half-precision floating-point data processing instructions.
20572 This also enables the Advanced SIMD and floating-point instructions as well
20573 as the Dot Product extension and the half-precision floating-point fmla
20577 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
20578 Dot Product extension.
20581 The cryptographic instructions. This also enables the Advanced SIMD and
20582 floating-point instructions as well as the Dot Product extension.
20585 Disable the cryptographic extension.
20588 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20591 8-bit Integer Matrix Multiply instructions.
20592 This also enables Advanced SIMD and floating-point instructions.
20595 Brain half-precision floating-point instructions.
20596 This also enables Advanced SIMD and floating-point instructions.
20602 The single-precision VFPv3 floating-point instructions. The extension
20603 @samp{+vfpv3xd} can be used as an alias for this extension.
20606 The VFPv3 floating-point instructions with 16 double-precision registers.
20607 The extension +vfpv3-d16 can be used as an alias for this extension.
20609 @item +vfpv3xd-d16-fp16
20610 The single-precision VFPv3 floating-point instructions with 16 double-precision
20611 registers and the half-precision floating-point conversion operations.
20613 @item +vfpv3-d16-fp16
20614 The VFPv3 floating-point instructions with 16 double-precision
20615 registers and the half-precision floating-point conversion operations.
20618 Disable the floating-point extension.
20621 The ARM-state integer division instructions.
20624 Disable the ARM-state integer division extension.
20630 The single-precision VFPv4 floating-point instructions.
20633 The single-precision FPv5 floating-point instructions.
20636 The single- and double-precision FPv5 floating-point instructions.
20639 Disable the floating-point extensions.
20642 @item armv8.1-m.main
20646 The DSP instructions.
20649 The M-Profile Vector Extension (MVE) integer instructions.
20652 The M-Profile Vector Extension (MVE) integer and single precision
20653 floating-point instructions.
20656 The single-precision floating-point instructions.
20659 The single- and double-precision floating-point instructions.
20662 Disable the floating-point extension.
20664 @item +cdecp0, +cdecp1, ... , +cdecp7
20665 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20666 to the numbers given in the options in the range 0 to 7.
20672 The DSP instructions.
20675 Disable the DSP extension.
20678 The single-precision floating-point instructions.
20681 The single- and double-precision floating-point instructions.
20684 Disable the floating-point extension.
20686 @item +cdecp0, +cdecp1, ... , +cdecp7
20687 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20688 to the numbers given in the options in the range 0 to 7.
20694 The Cyclic Redundancy Check (CRC) instructions.
20696 The single-precision FPv5 floating-point instructions.
20698 The ARMv8-A Advanced SIMD and floating-point instructions.
20700 The cryptographic instructions.
20702 Disable the cryptographic instructions.
20704 Disable the floating-point, Advanced SIMD and cryptographic instructions.
20709 @option{-march=native} causes the compiler to auto-detect the architecture
20710 of the build computer. At present, this feature is only supported on
20711 GNU/Linux, and not all architectures are recognized. If the auto-detect
20712 is unsuccessful the option has no effect.
20714 @item -mtune=@var{name}
20716 This option specifies the name of the target ARM processor for
20717 which GCC should tune the performance of the code.
20718 For some ARM implementations better performance can be obtained by using
20720 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
20721 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
20722 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
20723 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
20724 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
20725 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
20726 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
20727 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
20728 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
20729 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
20730 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
20731 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20732 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20733 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20734 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
20735 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
20736 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
20737 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
20738 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
20739 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1},
20740 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
20741 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
20742 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
20743 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
20744 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
20746 Additionally, this option can specify that GCC should tune the performance
20747 of the code for a big.LITTLE system. Permissible names are:
20748 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
20749 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20750 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
20751 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
20753 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
20754 performance for a blend of processors within architecture @var{arch}.
20755 The aim is to generate code that run well on the current most popular
20756 processors, balancing between optimizations that benefit some CPUs in the
20757 range, and avoiding performance pitfalls of other CPUs. The effects of
20758 this option may change in future GCC versions as CPU models come and go.
20760 @option{-mtune} permits the same extension options as @option{-mcpu}, but
20761 the extension options do not affect the tuning of the generated code.
20763 @option{-mtune=native} causes the compiler to auto-detect the CPU
20764 of the build computer. At present, this feature is only supported on
20765 GNU/Linux, and not all architectures are recognized. If the auto-detect is
20766 unsuccessful the option has no effect.
20768 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
20770 This specifies the name of the target ARM processor. GCC uses this name
20771 to derive the name of the target ARM architecture (as if specified
20772 by @option{-march}) and the ARM processor type for which to tune for
20773 performance (as if specified by @option{-mtune}). Where this option
20774 is used in conjunction with @option{-march} or @option{-mtune},
20775 those options take precedence over the appropriate part of this option.
20777 Many of the supported CPUs implement optional architectural
20778 extensions. Where this is so the architectural extensions are
20779 normally enabled by default. If implementations that lack the
20780 extension exist, then the extension syntax can be used to disable
20781 those extensions that have been omitted. For floating-point and
20782 Advanced SIMD (Neon) instructions, the settings of the options
20783 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
20784 floating-point and Advanced SIMD instructions will only be used if
20785 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
20786 @option{-mfpu} other than @samp{auto} will override the available
20787 floating-point and SIMD extension instructions.
20789 For example, @samp{cortex-a9} can be found in three major
20790 configurations: integer only, with just a floating-point unit or with
20791 floating-point and Advanced SIMD. The default is to enable all the
20792 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
20793 be used to disable just the SIMD or both the SIMD and floating-point
20794 instructions respectively.
20796 Permissible names for this option are the same as those for
20799 The following extension options are common to the listed CPUs:
20803 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
20806 Disables the floating-point instructions on @samp{arm9e},
20807 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
20808 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
20809 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
20810 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
20811 Disables the floating-point and SIMD instructions on
20812 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
20813 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
20814 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
20815 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
20816 @samp{cortex-a53} and @samp{cortex-a55}.
20819 Disables the double-precision component of the floating-point instructions
20820 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
20821 @samp{cortex-r52plus} and @samp{cortex-m7}.
20824 Disables the SIMD (but not floating-point) instructions on
20825 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
20826 and @samp{cortex-a9}.
20829 Enables the cryptographic instructions on @samp{cortex-a32},
20830 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
20831 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
20832 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20833 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
20834 @samp{cortex-a75.cortex-a55}.
20837 Additionally the @samp{generic-armv7-a} pseudo target defaults to
20838 VFPv3 with 16 double-precision registers. It supports the following
20839 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
20840 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
20841 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
20842 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
20843 the extensions to @option{-march=armv7-a}.
20845 @option{-mcpu=generic-@var{arch}} is also permissible, and is
20846 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
20847 See @option{-mtune} for more information.
20849 @option{-mcpu=native} causes the compiler to auto-detect the CPU
20850 of the build computer. At present, this feature is only supported on
20851 GNU/Linux, and not all architectures are recognized. If the auto-detect
20852 is unsuccessful the option has no effect.
20854 @item -mfpu=@var{name}
20856 This specifies what floating-point hardware (or hardware emulation) is
20857 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
20859 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
20860 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
20861 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
20862 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
20863 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
20864 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
20865 is an alias for @samp{vfpv2}.
20867 The setting @samp{auto} is the default and is special. It causes the
20868 compiler to select the floating-point and Advanced SIMD instructions
20869 based on the settings of @option{-mcpu} and @option{-march}.
20871 If the selected floating-point hardware includes the NEON extension
20872 (e.g.@: @option{-mfpu=neon}), note that floating-point
20873 operations are not generated by GCC's auto-vectorization pass unless
20874 @option{-funsafe-math-optimizations} is also specified. This is
20875 because NEON hardware does not fully implement the IEEE 754 standard for
20876 floating-point arithmetic (in particular denormal values are treated as
20877 zero), so the use of NEON instructions may lead to a loss of precision.
20879 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}).
20881 @item -mfp16-format=@var{name}
20882 @opindex mfp16-format
20883 Specify the format of the @code{__fp16} half-precision floating-point type.
20884 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
20885 the default is @samp{none}, in which case the @code{__fp16} type is not
20886 defined. @xref{Half-Precision}, for more information.
20888 @item -mstructure-size-boundary=@var{n}
20889 @opindex mstructure-size-boundary
20890 The sizes of all structures and unions are rounded up to a multiple
20891 of the number of bits set by this option. Permissible values are 8, 32
20892 and 64. The default value varies for different toolchains. For the COFF
20893 targeted toolchain the default value is 8. A value of 64 is only allowed
20894 if the underlying ABI supports it.
20896 Specifying a larger number can produce faster, more efficient code, but
20897 can also increase the size of the program. Different values are potentially
20898 incompatible. Code compiled with one value cannot necessarily expect to
20899 work with code or libraries compiled with another value, if they exchange
20900 information using structures or unions.
20902 This option is deprecated.
20904 @item -mabort-on-noreturn
20905 @opindex mabort-on-noreturn
20906 Generate a call to the function @code{abort} at the end of a
20907 @code{noreturn} function. It is executed if the function tries to
20911 @itemx -mno-long-calls
20912 @opindex mlong-calls
20913 @opindex mno-long-calls
20914 Tells the compiler to perform function calls by first loading the
20915 address of the function into a register and then performing a subroutine
20916 call on this register. This switch is needed if the target function
20917 lies outside of the 64-megabyte addressing range of the offset-based
20918 version of subroutine call instruction.
20920 Even if this switch is enabled, not all function calls are turned
20921 into long calls. The heuristic is that static functions, functions
20922 that have the @code{short_call} attribute, functions that are inside
20923 the scope of a @code{#pragma no_long_calls} directive, and functions whose
20924 definitions have already been compiled within the current compilation
20925 unit are not turned into long calls. The exceptions to this rule are
20926 that weak function definitions, functions with the @code{long_call}
20927 attribute or the @code{section} attribute, and functions that are within
20928 the scope of a @code{#pragma long_calls} directive are always
20929 turned into long calls.
20931 This feature is not enabled by default. Specifying
20932 @option{-mno-long-calls} restores the default behavior, as does
20933 placing the function calls within the scope of a @code{#pragma
20934 long_calls_off} directive. Note these switches have no effect on how
20935 the compiler generates code to handle function calls via function
20938 @item -msingle-pic-base
20939 @opindex msingle-pic-base
20940 Treat the register used for PIC addressing as read-only, rather than
20941 loading it in the prologue for each function. The runtime system is
20942 responsible for initializing this register with an appropriate value
20943 before execution begins.
20945 @item -mpic-register=@var{reg}
20946 @opindex mpic-register
20947 Specify the register to be used for PIC addressing.
20948 For standard PIC base case, the default is any suitable register
20949 determined by compiler. For single PIC base case, the default is
20950 @samp{R9} if target is EABI based or stack-checking is enabled,
20951 otherwise the default is @samp{R10}.
20953 @item -mpic-data-is-text-relative
20954 @opindex mpic-data-is-text-relative
20955 Assume that the displacement between the text and data segments is fixed
20956 at static link time. This permits using PC-relative addressing
20957 operations to access data known to be in the data segment. For
20958 non-VxWorks RTP targets, this option is enabled by default. When
20959 disabled on such targets, it will enable @option{-msingle-pic-base} by
20962 @item -mpoke-function-name
20963 @opindex mpoke-function-name
20964 Write the name of each function into the text section, directly
20965 preceding the function prologue. The generated code is similar to this:
20969 .ascii "arm_poke_function_name", 0
20972 .word 0xff000000 + (t1 - t0)
20973 arm_poke_function_name
20975 stmfd sp!, @{fp, ip, lr, pc@}
20979 When performing a stack backtrace, code can inspect the value of
20980 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
20981 location @code{pc - 12} and the top 8 bits are set, then we know that
20982 there is a function name embedded immediately preceding this location
20983 and has length @code{((pc[-3]) & 0xff000000)}.
20990 Select between generating code that executes in ARM and Thumb
20991 states. The default for most configurations is to generate code
20992 that executes in ARM state, but the default can be changed by
20993 configuring GCC with the @option{--with-mode=}@var{state}
20996 You can also override the ARM and Thumb mode for each function
20997 by using the @code{target("thumb")} and @code{target("arm")} function attributes
20998 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
21001 @opindex mflip-thumb
21002 Switch ARM/Thumb modes on alternating functions.
21003 This option is provided for regression testing of mixed Thumb/ARM code
21004 generation, and is not intended for ordinary use in compiling code.
21007 @opindex mtpcs-frame
21008 Generate a stack frame that is compliant with the Thumb Procedure Call
21009 Standard for all non-leaf functions. (A leaf function is one that does
21010 not call any other functions.) The default is @option{-mno-tpcs-frame}.
21012 @item -mtpcs-leaf-frame
21013 @opindex mtpcs-leaf-frame
21014 Generate a stack frame that is compliant with the Thumb Procedure Call
21015 Standard for all leaf functions. (A leaf function is one that does
21016 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
21018 @item -mcallee-super-interworking
21019 @opindex mcallee-super-interworking
21020 Gives all externally visible functions in the file being compiled an ARM
21021 instruction set header which switches to Thumb mode before executing the
21022 rest of the function. This allows these functions to be called from
21023 non-interworking code. This option is not valid in AAPCS configurations
21024 because interworking is enabled by default.
21026 @item -mcaller-super-interworking
21027 @opindex mcaller-super-interworking
21028 Allows calls via function pointers (including virtual functions) to
21029 execute correctly regardless of whether the target code has been
21030 compiled for interworking or not. There is a small overhead in the cost
21031 of executing a function pointer if this option is enabled. This option
21032 is not valid in AAPCS configurations because interworking is enabled
21035 @item -mtp=@var{name}
21037 Specify the access model for the thread local storage pointer. The valid
21038 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
21039 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
21040 (supported in the arm6k architecture), and @samp{auto}, which uses the
21041 best available method for the selected processor. The default setting is
21044 @item -mtls-dialect=@var{dialect}
21045 @opindex mtls-dialect
21046 Specify the dialect to use for accessing thread local storage. Two
21047 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
21048 @samp{gnu} dialect selects the original GNU scheme for supporting
21049 local and global dynamic TLS models. The @samp{gnu2} dialect
21050 selects the GNU descriptor scheme, which provides better performance
21051 for shared libraries. The GNU descriptor scheme is compatible with
21052 the original scheme, but does require new assembler, linker and
21053 library support. Initial and local exec TLS models are unaffected by
21054 this option and always use the original scheme.
21056 @item -mword-relocations
21057 @opindex mword-relocations
21058 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
21059 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
21060 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
21061 is specified. This option conflicts with @option{-mslow-flash-data}.
21063 @item -mfix-cortex-m3-ldrd
21064 @opindex mfix-cortex-m3-ldrd
21065 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
21066 with overlapping destination and base registers are used. This option avoids
21067 generating these instructions. This option is enabled by default when
21068 @option{-mcpu=cortex-m3} is specified.
21070 @item -munaligned-access
21071 @itemx -mno-unaligned-access
21072 @opindex munaligned-access
21073 @opindex mno-unaligned-access
21074 Enables (or disables) reading and writing of 16- and 32- bit values
21075 from addresses that are not 16- or 32- bit aligned. By default
21076 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
21077 ARMv8-M Baseline architectures, and enabled for all other
21078 architectures. If unaligned access is not enabled then words in packed
21079 data structures are accessed a byte at a time.
21081 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
21082 generated object file to either true or false, depending upon the
21083 setting of this option. If unaligned access is enabled then the
21084 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
21087 @item -mneon-for-64bits
21088 @opindex mneon-for-64bits
21089 This option is deprecated and has no effect.
21091 @item -mslow-flash-data
21092 @opindex mslow-flash-data
21093 Assume loading data from flash is slower than fetching instruction.
21094 Therefore literal load is minimized for better performance.
21095 This option is only supported when compiling for ARMv7 M-profile and
21096 off by default. It conflicts with @option{-mword-relocations}.
21098 @item -masm-syntax-unified
21099 @opindex masm-syntax-unified
21100 Assume inline assembler is using unified asm syntax. The default is
21101 currently off which implies divided syntax. This option has no impact
21102 on Thumb2. However, this may change in future releases of GCC.
21103 Divided syntax should be considered deprecated.
21105 @item -mrestrict-it
21106 @opindex mrestrict-it
21107 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
21108 IT blocks can only contain a single 16-bit instruction from a select
21109 set of instructions. This option is on by default for ARMv8-A Thumb mode.
21111 @item -mprint-tune-info
21112 @opindex mprint-tune-info
21113 Print CPU tuning information as comment in assembler file. This is
21114 an option used only for regression testing of the compiler and not
21115 intended for ordinary use in compiling code. This option is disabled
21118 @item -mverbose-cost-dump
21119 @opindex mverbose-cost-dump
21120 Enable verbose cost model dumping in the debug dump files. This option is
21121 provided for use in debugging the compiler.
21124 @opindex mpure-code
21125 Do not allow constant data to be placed in code sections.
21126 Additionally, when compiling for ELF object format give all text sections the
21127 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
21128 is only available when generating non-pic code for M-profile targets.
21132 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
21133 Development Tools Engineering Specification", which can be found on
21134 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
21136 @item -mfix-cmse-cve-2021-35465
21137 @opindex mfix-cmse-cve-2021-35465
21138 Mitigate against a potential security issue with the @code{VLLDM} instruction
21139 in some M-profile devices when using CMSE (CVE-2021-365465). This option is
21140 enabled by default when the option @option{-mcpu=} is used with
21141 @code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option
21142 @option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
21148 Select the FDPIC ABI, which uses 64-bit function descriptors to
21149 represent pointers to functions. When the compiler is configured for
21150 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
21151 and implies @option{-fPIE} if none of the PIC/PIE-related options is
21152 provided. On other targets, it only enables the FDPIC-specific code
21153 generation features, and the user should explicitly provide the
21154 PIC/PIE-related options as needed.
21156 Note that static linking is not supported because it would still
21157 involve the dynamic linker when the program self-relocates. If such
21158 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
21160 The opposite @option{-mno-fdpic} option is useful (and required) to
21161 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
21162 toolchain as the one used to build the userland programs.
21167 @subsection AVR Options
21168 @cindex AVR Options
21170 These options are defined for AVR implementations:
21173 @item -mmcu=@var{mcu}
21175 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
21177 The default for this option is@tie{}@samp{avr2}.
21179 GCC supports the following AVR devices and ISAs:
21181 @include avr-mmcu.texi
21186 Assume that all data in static storage can be accessed by LDS / STS
21187 instructions. This option has only an effect on reduced Tiny devices like
21188 ATtiny40. See also the @code{absdata}
21189 @ref{AVR Variable Attributes,variable attribute}.
21191 @item -maccumulate-args
21192 @opindex maccumulate-args
21193 Accumulate outgoing function arguments and acquire/release the needed
21194 stack space for outgoing function arguments once in function
21195 prologue/epilogue. Without this option, outgoing arguments are pushed
21196 before calling a function and popped afterwards.
21198 Popping the arguments after the function call can be expensive on
21199 AVR so that accumulating the stack space might lead to smaller
21200 executables because arguments need not be removed from the
21201 stack after such a function call.
21203 This option can lead to reduced code size for functions that perform
21204 several calls to functions that get their arguments on the stack like
21205 calls to printf-like functions.
21207 @item -mbranch-cost=@var{cost}
21208 @opindex mbranch-cost
21209 Set the branch costs for conditional branch instructions to
21210 @var{cost}. Reasonable values for @var{cost} are small, non-negative
21211 integers. The default branch cost is 0.
21213 @item -mcall-prologues
21214 @opindex mcall-prologues
21215 Functions prologues/epilogues are expanded as calls to appropriate
21216 subroutines. Code size is smaller.
21218 @item -mdouble=@var{bits}
21219 @itemx -mlong-double=@var{bits}
21221 @opindex mlong-double
21222 Set the size (in bits) of the @code{double} or @code{long double} type,
21223 respectively. Possible values for @var{bits} are 32 and 64.
21224 Whether or not a specific value for @var{bits} is allowed depends on
21225 the @code{--with-double=} and @code{--with-long-double=}
21226 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
21227 and the same applies for the default values of the options.
21229 @item -mgas-isr-prologues
21230 @opindex mgas-isr-prologues
21231 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
21232 instruction supported by GNU Binutils.
21233 If this option is on, the feature can still be disabled for individual
21234 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
21235 function attribute. This feature is activated per default
21236 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
21237 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
21241 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
21242 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
21243 and @code{long long} is 4 bytes. Please note that this option does not
21244 conform to the C standards, but it results in smaller code
21247 @item -mmain-is-OS_task
21248 @opindex mmain-is-OS_task
21249 Do not save registers in @code{main}. The effect is the same like
21250 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
21251 to @code{main}. It is activated per default if optimization is on.
21253 @item -mn-flash=@var{num}
21255 Assume that the flash memory has a size of
21256 @var{num} times 64@tie{}KiB.
21258 @item -mno-interrupts
21259 @opindex mno-interrupts
21260 Generated code is not compatible with hardware interrupts.
21261 Code size is smaller.
21265 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
21266 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
21267 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
21268 the assembler's command line and the @option{--relax} option to the
21269 linker's command line.
21271 Jump relaxing is performed by the linker because jump offsets are not
21272 known before code is located. Therefore, the assembler code generated by the
21273 compiler is the same, but the instructions in the executable may
21274 differ from instructions in the assembler code.
21276 Relaxing must be turned on if linker stubs are needed, see the
21277 section on @code{EIND} and linker stubs below.
21281 Assume that the device supports the Read-Modify-Write
21282 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
21284 @item -mshort-calls
21285 @opindex mshort-calls
21287 Assume that @code{RJMP} and @code{RCALL} can target the whole
21290 This option is used internally for multilib selection. It is
21291 not an optimization option, and you don't need to set it by hand.
21295 Treat the stack pointer register as an 8-bit register,
21296 i.e.@: assume the high byte of the stack pointer is zero.
21297 In general, you don't need to set this option by hand.
21299 This option is used internally by the compiler to select and
21300 build multilibs for architectures @code{avr2} and @code{avr25}.
21301 These architectures mix devices with and without @code{SPH}.
21302 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
21303 the compiler driver adds or removes this option from the compiler
21304 proper's command line, because the compiler then knows if the device
21305 or architecture has an 8-bit stack pointer and thus no @code{SPH}
21310 Use address register @code{X} in a way proposed by the hardware. This means
21311 that @code{X} is only used in indirect, post-increment or
21312 pre-decrement addressing.
21314 Without this option, the @code{X} register may be used in the same way
21315 as @code{Y} or @code{Z} which then is emulated by additional
21317 For example, loading a value with @code{X+const} addressing with a
21318 small non-negative @code{const < 64} to a register @var{Rn} is
21322 adiw r26, const ; X += const
21323 ld @var{Rn}, X ; @var{Rn} = *X
21324 sbiw r26, const ; X -= const
21328 @opindex mtiny-stack
21329 Only change the lower 8@tie{}bits of the stack pointer.
21331 @item -mfract-convert-truncate
21332 @opindex mfract-convert-truncate
21333 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
21336 @opindex nodevicelib
21337 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
21339 @item -nodevicespecs
21340 @opindex nodevicespecs
21341 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
21342 command line. The user takes responsibility for supplying the sub-processes
21343 like compiler proper, assembler and linker with appropriate command line
21344 options. This means that the user has to supply her private device specs
21345 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
21346 more need for option @option{-mmcu=@var{mcu}}.
21348 This option can also serve as a replacement for the older way of
21349 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
21350 which contains a folder named @code{device-specs} which contains a specs file named
21351 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
21353 @item -Waddr-space-convert
21354 @opindex Waddr-space-convert
21355 @opindex Wno-addr-space-convert
21356 Warn about conversions between address spaces in the case where the
21357 resulting address space is not contained in the incoming address space.
21359 @item -Wmisspelled-isr
21360 @opindex Wmisspelled-isr
21361 @opindex Wno-misspelled-isr
21362 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
21363 Enabled by default.
21366 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
21367 @cindex @code{EIND}
21368 Pointers in the implementation are 16@tie{}bits wide.
21369 The address of a function or label is represented as word address so
21370 that indirect jumps and calls can target any code address in the
21371 range of 64@tie{}Ki words.
21373 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
21374 bytes of program memory space, there is a special function register called
21375 @code{EIND} that serves as most significant part of the target address
21376 when @code{EICALL} or @code{EIJMP} instructions are used.
21378 Indirect jumps and calls on these devices are handled as follows by
21379 the compiler and are subject to some limitations:
21384 The compiler never sets @code{EIND}.
21387 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
21388 instructions or might read @code{EIND} directly in order to emulate an
21389 indirect call/jump by means of a @code{RET} instruction.
21392 The compiler assumes that @code{EIND} never changes during the startup
21393 code or during the application. In particular, @code{EIND} is not
21394 saved/restored in function or interrupt service routine
21398 For indirect calls to functions and computed goto, the linker
21399 generates @emph{stubs}. Stubs are jump pads sometimes also called
21400 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
21401 The stub contains a direct jump to the desired address.
21404 Linker relaxation must be turned on so that the linker generates
21405 the stubs correctly in all situations. See the compiler option
21406 @option{-mrelax} and the linker option @option{--relax}.
21407 There are corner cases where the linker is supposed to generate stubs
21408 but aborts without relaxation and without a helpful error message.
21411 The default linker script is arranged for code with @code{EIND = 0}.
21412 If code is supposed to work for a setup with @code{EIND != 0}, a custom
21413 linker script has to be used in order to place the sections whose
21414 name start with @code{.trampolines} into the segment where @code{EIND}
21418 The startup code from libgcc never sets @code{EIND}.
21419 Notice that startup code is a blend of code from libgcc and AVR-LibC.
21420 For the impact of AVR-LibC on @code{EIND}, see the
21421 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
21424 It is legitimate for user-specific startup code to set up @code{EIND}
21425 early, for example by means of initialization code located in
21426 section @code{.init3}. Such code runs prior to general startup code
21427 that initializes RAM and calls constructors, but after the bit
21428 of startup code from AVR-LibC that sets @code{EIND} to the segment
21429 where the vector table is located.
21431 #include <avr/io.h>
21434 __attribute__((section(".init3"),naked,used,no_instrument_function))
21435 init3_set_eind (void)
21437 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
21438 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
21443 The @code{__trampolines_start} symbol is defined in the linker script.
21446 Stubs are generated automatically by the linker if
21447 the following two conditions are met:
21450 @item The address of a label is taken by means of the @code{gs} modifier
21451 (short for @emph{generate stubs}) like so:
21453 LDI r24, lo8(gs(@var{func}))
21454 LDI r25, hi8(gs(@var{func}))
21456 @item The final location of that label is in a code segment
21457 @emph{outside} the segment where the stubs are located.
21461 The compiler emits such @code{gs} modifiers for code labels in the
21462 following situations:
21464 @item Taking address of a function or code label.
21465 @item Computed goto.
21466 @item If prologue-save function is used, see @option{-mcall-prologues}
21467 command-line option.
21468 @item Switch/case dispatch tables. If you do not want such dispatch
21469 tables you can specify the @option{-fno-jump-tables} command-line option.
21470 @item C and C++ constructors/destructors called during startup/shutdown.
21471 @item If the tools hit a @code{gs()} modifier explained above.
21475 Jumping to non-symbolic addresses like so is @emph{not} supported:
21480 /* Call function at word address 0x2 */
21481 return ((int(*)(void)) 0x2)();
21485 Instead, a stub has to be set up, i.e.@: the function has to be called
21486 through a symbol (@code{func_4} in the example):
21491 extern int func_4 (void);
21493 /* Call function at byte address 0x4 */
21498 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
21499 Alternatively, @code{func_4} can be defined in the linker script.
21502 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
21503 @cindex @code{RAMPD}
21504 @cindex @code{RAMPX}
21505 @cindex @code{RAMPY}
21506 @cindex @code{RAMPZ}
21507 Some AVR devices support memories larger than the 64@tie{}KiB range
21508 that can be accessed with 16-bit pointers. To access memory locations
21509 outside this 64@tie{}KiB range, the content of a @code{RAMP}
21510 register is used as high part of the address:
21511 The @code{X}, @code{Y}, @code{Z} address register is concatenated
21512 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
21513 register, respectively, to get a wide address. Similarly,
21514 @code{RAMPD} is used together with direct addressing.
21518 The startup code initializes the @code{RAMP} special function
21519 registers with zero.
21522 If a @ref{AVR Named Address Spaces,named address space} other than
21523 generic or @code{__flash} is used, then @code{RAMPZ} is set
21524 as needed before the operation.
21527 If the device supports RAM larger than 64@tie{}KiB and the compiler
21528 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
21529 is reset to zero after the operation.
21532 If the device comes with a specific @code{RAMP} register, the ISR
21533 prologue/epilogue saves/restores that SFR and initializes it with
21534 zero in case the ISR code might (implicitly) use it.
21537 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
21538 If you use inline assembler to read from locations outside the
21539 16-bit address range and change one of the @code{RAMP} registers,
21540 you must reset it to zero after the access.
21544 @subsubsection AVR Built-in Macros
21546 GCC defines several built-in macros so that the user code can test
21547 for the presence or absence of features. Almost any of the following
21548 built-in macros are deduced from device capabilities and thus
21549 triggered by the @option{-mmcu=} command-line option.
21551 For even more AVR-specific built-in macros see
21552 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
21557 Build-in macro that resolves to a decimal number that identifies the
21558 architecture and depends on the @option{-mmcu=@var{mcu}} option.
21559 Possible values are:
21561 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
21562 @code{4}, @code{5}, @code{51}, @code{6}
21564 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
21565 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
21570 @code{102}, @code{103}, @code{104},
21571 @code{105}, @code{106}, @code{107}
21573 for @var{mcu}=@code{avrtiny},
21574 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
21575 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
21576 If @var{mcu} specifies a device, this built-in macro is set
21577 accordingly. For example, with @option{-mmcu=atmega8} the macro is
21578 defined to @code{4}.
21580 @item __AVR_@var{Device}__
21581 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
21582 the device's name. For example, @option{-mmcu=atmega8} defines the
21583 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
21584 @code{__AVR_ATtiny261A__}, etc.
21586 The built-in macros' names follow
21587 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
21588 the device name as from the AVR user manual. The difference between
21589 @var{Device} in the built-in macro and @var{device} in
21590 @option{-mmcu=@var{device}} is that the latter is always lowercase.
21592 If @var{device} is not a device but only a core architecture like
21593 @samp{avr51}, this macro is not defined.
21595 @item __AVR_DEVICE_NAME__
21596 Setting @option{-mmcu=@var{device}} defines this built-in macro to
21597 the device's name. For example, with @option{-mmcu=atmega8} the macro
21598 is defined to @code{atmega8}.
21600 If @var{device} is not a device but only a core architecture like
21601 @samp{avr51}, this macro is not defined.
21603 @item __AVR_XMEGA__
21604 The device / architecture belongs to the XMEGA family of devices.
21606 @item __AVR_HAVE_ELPM__
21607 The device has the @code{ELPM} instruction.
21609 @item __AVR_HAVE_ELPMX__
21610 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
21611 R@var{n},Z+} instructions.
21613 @item __AVR_HAVE_MOVW__
21614 The device has the @code{MOVW} instruction to perform 16-bit
21615 register-register moves.
21617 @item __AVR_HAVE_LPMX__
21618 The device has the @code{LPM R@var{n},Z} and
21619 @code{LPM R@var{n},Z+} instructions.
21621 @item __AVR_HAVE_MUL__
21622 The device has a hardware multiplier.
21624 @item __AVR_HAVE_JMP_CALL__
21625 The device has the @code{JMP} and @code{CALL} instructions.
21626 This is the case for devices with more than 8@tie{}KiB of program
21629 @item __AVR_HAVE_EIJMP_EICALL__
21630 @itemx __AVR_3_BYTE_PC__
21631 The device has the @code{EIJMP} and @code{EICALL} instructions.
21632 This is the case for devices with more than 128@tie{}KiB of program memory.
21633 This also means that the program counter
21634 (PC) is 3@tie{}bytes wide.
21636 @item __AVR_2_BYTE_PC__
21637 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
21638 with up to 128@tie{}KiB of program memory.
21640 @item __AVR_HAVE_8BIT_SP__
21641 @itemx __AVR_HAVE_16BIT_SP__
21642 The stack pointer (SP) register is treated as 8-bit respectively
21643 16-bit register by the compiler.
21644 The definition of these macros is affected by @option{-mtiny-stack}.
21646 @item __AVR_HAVE_SPH__
21648 The device has the SPH (high part of stack pointer) special function
21649 register or has an 8-bit stack pointer, respectively.
21650 The definition of these macros is affected by @option{-mmcu=} and
21651 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
21654 @item __AVR_HAVE_RAMPD__
21655 @itemx __AVR_HAVE_RAMPX__
21656 @itemx __AVR_HAVE_RAMPY__
21657 @itemx __AVR_HAVE_RAMPZ__
21658 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
21659 @code{RAMPZ} special function register, respectively.
21661 @item __NO_INTERRUPTS__
21662 This macro reflects the @option{-mno-interrupts} command-line option.
21664 @item __AVR_ERRATA_SKIP__
21665 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
21666 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
21667 instructions because of a hardware erratum. Skip instructions are
21668 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
21669 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
21672 @item __AVR_ISA_RMW__
21673 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
21675 @item __AVR_SFR_OFFSET__=@var{offset}
21676 Instructions that can address I/O special function registers directly
21677 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
21678 address as if addressed by an instruction to access RAM like @code{LD}
21679 or @code{STS}. This offset depends on the device architecture and has
21680 to be subtracted from the RAM address in order to get the
21681 respective I/O@tie{}address.
21683 @item __AVR_SHORT_CALLS__
21684 The @option{-mshort-calls} command line option is set.
21686 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
21687 Some devices support reading from flash memory by means of @code{LD*}
21688 instructions. The flash memory is seen in the data address space
21689 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
21690 is not defined, this feature is not available. If defined,
21691 the address space is linear and there is no need to put
21692 @code{.rodata} into RAM. This is handled by the default linker
21693 description file, and is currently available for
21694 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
21695 there is no need to use address spaces like @code{__flash} or
21696 features like attribute @code{progmem} and @code{pgm_read_*}.
21698 @item __WITH_AVRLIBC__
21699 The compiler is configured to be used together with AVR-Libc.
21700 See the @option{--with-avrlibc} configure option.
21702 @item __HAVE_DOUBLE_MULTILIB__
21703 Defined if @option{-mdouble=} acts as a multilib option.
21705 @item __HAVE_DOUBLE32__
21706 @itemx __HAVE_DOUBLE64__
21707 Defined if the compiler supports 32-bit double resp. 64-bit double.
21708 The actual layout is specified by option @option{-mdouble=}.
21710 @item __DEFAULT_DOUBLE__
21711 The size in bits of @code{double} if @option{-mdouble=} is not set.
21712 To test the layout of @code{double} in a program, use the built-in
21713 macro @code{__SIZEOF_DOUBLE__}.
21715 @item __HAVE_LONG_DOUBLE32__
21716 @itemx __HAVE_LONG_DOUBLE64__
21717 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
21718 @itemx __DEFAULT_LONG_DOUBLE__
21719 Same as above, but for @code{long double} instead of @code{double}.
21721 @item __WITH_DOUBLE_COMPARISON__
21722 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
21723 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
21724 and is defined to @code{2} or @code{3}.
21726 @item __WITH_LIBF7_LIBGCC__
21727 @itemx __WITH_LIBF7_MATH__
21728 @itemx __WITH_LIBF7_MATH_SYMBOLS__
21729 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
21730 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
21734 @node Blackfin Options
21735 @subsection Blackfin Options
21736 @cindex Blackfin Options
21739 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
21741 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
21742 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
21743 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
21744 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
21745 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
21746 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
21747 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
21748 @samp{bf561}, @samp{bf592}.
21750 The optional @var{sirevision} specifies the silicon revision of the target
21751 Blackfin processor. Any workarounds available for the targeted silicon revision
21752 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
21753 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
21754 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
21755 hexadecimal digits representing the major and minor numbers in the silicon
21756 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
21757 is not defined. If @var{sirevision} is @samp{any}, the
21758 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
21759 If this optional @var{sirevision} is not used, GCC assumes the latest known
21760 silicon revision of the targeted Blackfin processor.
21762 GCC defines a preprocessor macro for the specified @var{cpu}.
21763 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
21764 provided by libgloss to be linked in if @option{-msim} is not given.
21766 Without this option, @samp{bf532} is used as the processor by default.
21768 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
21769 only the preprocessor macro is defined.
21773 Specifies that the program will be run on the simulator. This causes
21774 the simulator BSP provided by libgloss to be linked in. This option
21775 has effect only for @samp{bfin-elf} toolchain.
21776 Certain other options, such as @option{-mid-shared-library} and
21777 @option{-mfdpic}, imply @option{-msim}.
21779 @item -momit-leaf-frame-pointer
21780 @opindex momit-leaf-frame-pointer
21781 Don't keep the frame pointer in a register for leaf functions. This
21782 avoids the instructions to save, set up and restore frame pointers and
21783 makes an extra register available in leaf functions.
21785 @item -mspecld-anomaly
21786 @opindex mspecld-anomaly
21787 When enabled, the compiler ensures that the generated code does not
21788 contain speculative loads after jump instructions. If this option is used,
21789 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
21791 @item -mno-specld-anomaly
21792 @opindex mno-specld-anomaly
21793 @opindex mspecld-anomaly
21794 Don't generate extra code to prevent speculative loads from occurring.
21796 @item -mcsync-anomaly
21797 @opindex mcsync-anomaly
21798 When enabled, the compiler ensures that the generated code does not
21799 contain CSYNC or SSYNC instructions too soon after conditional branches.
21800 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
21802 @item -mno-csync-anomaly
21803 @opindex mno-csync-anomaly
21804 @opindex mcsync-anomaly
21805 Don't generate extra code to prevent CSYNC or SSYNC instructions from
21806 occurring too soon after a conditional branch.
21810 When enabled, the compiler is free to take advantage of the knowledge that
21811 the entire program fits into the low 64k of memory.
21814 @opindex mno-low64k
21815 Assume that the program is arbitrarily large. This is the default.
21817 @item -mstack-check-l1
21818 @opindex mstack-check-l1
21819 Do stack checking using information placed into L1 scratchpad memory by the
21822 @item -mid-shared-library
21823 @opindex mid-shared-library
21824 Generate code that supports shared libraries via the library ID method.
21825 This allows for execute in place and shared libraries in an environment
21826 without virtual memory management. This option implies @option{-fPIC}.
21827 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21829 @item -mno-id-shared-library
21830 @opindex mno-id-shared-library
21831 @opindex mid-shared-library
21832 Generate code that doesn't assume ID-based shared libraries are being used.
21833 This is the default.
21835 @item -mleaf-id-shared-library
21836 @opindex mleaf-id-shared-library
21837 Generate code that supports shared libraries via the library ID method,
21838 but assumes that this library or executable won't link against any other
21839 ID shared libraries. That allows the compiler to use faster code for jumps
21842 @item -mno-leaf-id-shared-library
21843 @opindex mno-leaf-id-shared-library
21844 @opindex mleaf-id-shared-library
21845 Do not assume that the code being compiled won't link against any ID shared
21846 libraries. Slower code is generated for jump and call insns.
21848 @item -mshared-library-id=n
21849 @opindex mshared-library-id
21850 Specifies the identification number of the ID-based shared library being
21851 compiled. Specifying a value of 0 generates more compact code; specifying
21852 other values forces the allocation of that number to the current
21853 library but is no more space- or time-efficient than omitting this option.
21857 Generate code that allows the data segment to be located in a different
21858 area of memory from the text segment. This allows for execute in place in
21859 an environment without virtual memory management by eliminating relocations
21860 against the text section.
21862 @item -mno-sep-data
21863 @opindex mno-sep-data
21865 Generate code that assumes that the data segment follows the text segment.
21866 This is the default.
21869 @itemx -mno-long-calls
21870 @opindex mlong-calls
21871 @opindex mno-long-calls
21872 Tells the compiler to perform function calls by first loading the
21873 address of the function into a register and then performing a subroutine
21874 call on this register. This switch is needed if the target function
21875 lies outside of the 24-bit addressing range of the offset-based
21876 version of subroutine call instruction.
21878 This feature is not enabled by default. Specifying
21879 @option{-mno-long-calls} restores the default behavior. Note these
21880 switches have no effect on how the compiler generates code to handle
21881 function calls via function pointers.
21885 Link with the fast floating-point library. This library relaxes some of
21886 the IEEE floating-point standard's rules for checking inputs against
21887 Not-a-Number (NAN), in the interest of performance.
21890 @opindex minline-plt
21891 Enable inlining of PLT entries in function calls to functions that are
21892 not known to bind locally. It has no effect without @option{-mfdpic}.
21895 @opindex mmulticore
21896 Build a standalone application for multicore Blackfin processors.
21897 This option causes proper start files and link scripts supporting
21898 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
21899 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
21901 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
21902 selects the one-application-per-core programming model. Without
21903 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
21904 programming model is used. In this model, the main function of Core B
21905 should be named as @code{coreb_main}.
21907 If this option is not used, the single-core application programming
21912 Build a standalone application for Core A of BF561 when using
21913 the one-application-per-core programming model. Proper start files
21914 and link scripts are used to support Core A, and the macro
21915 @code{__BFIN_COREA} is defined.
21916 This option can only be used in conjunction with @option{-mmulticore}.
21920 Build a standalone application for Core B of BF561 when using
21921 the one-application-per-core programming model. Proper start files
21922 and link scripts are used to support Core B, and the macro
21923 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
21924 should be used instead of @code{main}.
21925 This option can only be used in conjunction with @option{-mmulticore}.
21929 Build a standalone application for SDRAM. Proper start files and
21930 link scripts are used to put the application into SDRAM, and the macro
21931 @code{__BFIN_SDRAM} is defined.
21932 The loader should initialize SDRAM before loading the application.
21936 Assume that ICPLBs are enabled at run time. This has an effect on certain
21937 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
21938 are enabled; for standalone applications the default is off.
21942 @subsection C6X Options
21943 @cindex C6X Options
21946 @item -march=@var{name}
21948 This specifies the name of the target architecture. GCC uses this
21949 name to determine what kind of instructions it can emit when generating
21950 assembly code. Permissible names are: @samp{c62x},
21951 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
21954 @opindex mbig-endian
21955 Generate code for a big-endian target.
21957 @item -mlittle-endian
21958 @opindex mlittle-endian
21959 Generate code for a little-endian target. This is the default.
21963 Choose startup files and linker script suitable for the simulator.
21965 @item -msdata=default
21966 @opindex msdata=default
21967 Put small global and static data in the @code{.neardata} section,
21968 which is pointed to by register @code{B14}. Put small uninitialized
21969 global and static data in the @code{.bss} section, which is adjacent
21970 to the @code{.neardata} section. Put small read-only data into the
21971 @code{.rodata} section. The corresponding sections used for large
21972 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
21975 @opindex msdata=all
21976 Put all data, not just small objects, into the sections reserved for
21977 small data, and use addressing relative to the @code{B14} register to
21981 @opindex msdata=none
21982 Make no use of the sections reserved for small data, and use absolute
21983 addresses to access all data. Put all initialized global and static
21984 data in the @code{.fardata} section, and all uninitialized data in the
21985 @code{.far} section. Put all constant data into the @code{.const}
21990 @subsection CRIS Options
21991 @cindex CRIS Options
21993 These options are defined specifically for the CRIS ports.
21996 @item -march=@var{architecture-type}
21997 @itemx -mcpu=@var{architecture-type}
22000 Generate code for the specified architecture. The choices for
22001 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
22002 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
22003 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
22006 @item -mtune=@var{architecture-type}
22008 Tune to @var{architecture-type} everything applicable about the generated
22009 code, except for the ABI and the set of available instructions. The
22010 choices for @var{architecture-type} are the same as for
22011 @option{-march=@var{architecture-type}}.
22013 @item -mmax-stack-frame=@var{n}
22014 @opindex mmax-stack-frame
22015 Warn when the stack frame of a function exceeds @var{n} bytes.
22021 The options @option{-metrax4} and @option{-metrax100} are synonyms for
22022 @option{-march=v3} and @option{-march=v8} respectively.
22024 @item -mmul-bug-workaround
22025 @itemx -mno-mul-bug-workaround
22026 @opindex mmul-bug-workaround
22027 @opindex mno-mul-bug-workaround
22028 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
22029 models where it applies. This option is active by default.
22033 Enable CRIS-specific verbose debug-related information in the assembly
22034 code. This option also has the effect of turning off the @samp{#NO_APP}
22035 formatted-code indicator to the assembler at the beginning of the
22040 Do not use condition-code results from previous instruction; always emit
22041 compare and test instructions before use of condition codes.
22043 @item -mno-side-effects
22044 @opindex mno-side-effects
22045 @opindex mside-effects
22046 Do not emit instructions with side effects in addressing modes other than
22049 @item -mstack-align
22050 @itemx -mno-stack-align
22051 @itemx -mdata-align
22052 @itemx -mno-data-align
22053 @itemx -mconst-align
22054 @itemx -mno-const-align
22055 @opindex mstack-align
22056 @opindex mno-stack-align
22057 @opindex mdata-align
22058 @opindex mno-data-align
22059 @opindex mconst-align
22060 @opindex mno-const-align
22061 These options (@samp{no-} options) arrange (eliminate arrangements) for the
22062 stack frame, individual data and constants to be aligned for the maximum
22063 single data access size for the chosen CPU model. The default is to
22064 arrange for 32-bit alignment. ABI details such as structure layout are
22065 not affected by these options.
22073 Similar to the stack- data- and const-align options above, these options
22074 arrange for stack frame, writable data and constants to all be 32-bit,
22075 16-bit or 8-bit aligned. The default is 32-bit alignment.
22077 @item -mno-prologue-epilogue
22078 @itemx -mprologue-epilogue
22079 @opindex mno-prologue-epilogue
22080 @opindex mprologue-epilogue
22081 With @option{-mno-prologue-epilogue}, the normal function prologue and
22082 epilogue which set up the stack frame are omitted and no return
22083 instructions or return sequences are generated in the code. Use this
22084 option only together with visual inspection of the compiled code: no
22085 warnings or errors are generated when call-saved registers must be saved,
22086 or storage for local variables needs to be allocated.
22090 @opindex mno-gotplt
22092 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
22093 instruction sequences that load addresses for functions from the PLT part
22094 of the GOT rather than (traditional on other architectures) calls to the
22095 PLT@. The default is @option{-mgotplt}.
22099 Legacy no-op option only recognized with the cris-axis-elf and
22100 cris-axis-linux-gnu targets.
22104 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
22108 This option, recognized for the cris-axis-elf, arranges
22109 to link with input-output functions from a simulator library. Code,
22110 initialized data and zero-initialized data are allocated consecutively.
22114 Like @option{-sim}, but pass linker options to locate initialized data at
22115 0x40000000 and zero-initialized data at 0x80000000.
22119 @subsection CR16 Options
22120 @cindex CR16 Options
22122 These options are defined specifically for the CR16 ports.
22128 Enable the use of multiply-accumulate instructions. Disabled by default.
22132 @opindex mcr16cplus
22134 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
22139 Links the library libsim.a which is in compatible with simulator. Applicable
22140 to ELF compiler only.
22144 Choose integer type as 32-bit wide.
22148 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
22150 @item -mdata-model=@var{model}
22151 @opindex mdata-model
22152 Choose a data model. The choices for @var{model} are @samp{near},
22153 @samp{far} or @samp{medium}. @samp{medium} is default.
22154 However, @samp{far} is not valid with @option{-mcr16c}, as the
22155 CR16C architecture does not support the far data model.
22158 @node C-SKY Options
22159 @subsection C-SKY Options
22160 @cindex C-SKY Options
22162 GCC supports these options when compiling for C-SKY V2 processors.
22166 @item -march=@var{arch}
22168 Specify the C-SKY target architecture. Valid values for @var{arch} are:
22169 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
22170 The default is @samp{ck810}.
22172 @item -mcpu=@var{cpu}
22174 Specify the C-SKY target processor. Valid values for @var{cpu} are:
22175 @samp{ck801}, @samp{ck801t},
22176 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
22177 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
22178 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
22179 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
22180 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
22181 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
22182 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
22183 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
22184 @samp{ck803eftr1}, @samp{ck803efhtr1},
22185 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
22186 @samp{ck803sef}, @samp{ck803seft},
22187 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
22188 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
22189 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
22190 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
22193 @opindex mbig-endian
22196 @itemx -mlittle-endian
22197 @opindex mlittle-endian
22201 Select big- or little-endian code. The default is little-endian.
22203 @item -mfloat-abi=@var{name}
22204 @opindex mfloat-abi
22205 Specifies which floating-point ABI to use. Permissible values
22206 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22208 Specifying @samp{soft} causes GCC to generate output containing
22209 library calls for floating-point operations.
22210 @samp{softfp} allows the generation of code using hardware floating-point
22211 instructions, but still uses the soft-float calling conventions.
22212 @samp{hard} allows generation of floating-point instructions
22213 and uses FPU-specific calling conventions.
22215 The default depends on the specific target configuration. Note that
22216 the hard-float and soft-float ABIs are not link-compatible; you must
22217 compile your entire program with the same ABI, and link with a
22218 compatible set of libraries.
22221 @opindex mhard-float
22222 @itemx -msoft-float
22223 @opindex msoft-float
22225 Select hardware or software floating-point implementations.
22226 The default is soft float.
22228 @item -mdouble-float
22229 @itemx -mno-double-float
22230 @opindex mdouble-float
22231 When @option{-mhard-float} is in effect, enable generation of
22232 double-precision float instructions. This is the default except
22233 when compiling for CK803.
22238 When @option{-mhard-float} is in effect, enable generation of
22239 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
22240 This is the default except when compiling for CK803.
22242 @item -mfpu=@var{fpu}
22244 Select the floating-point processor. This option can only be used with
22245 @option{-mhard-float}.
22246 Values for @var{fpu} are
22247 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
22248 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
22249 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
22254 Enable the extended @code{lrw} instruction. This option defaults to on
22255 for CK801 and off otherwise.
22260 Enable interrupt stack instructions; the default is off.
22262 The @option{-mistack} option is required to handle the
22263 @code{interrupt} and @code{isr} function attributes
22264 (@pxref{C-SKY Function Attributes}).
22268 Enable multiprocessor instructions; the default is off.
22272 Enable coprocessor instructions; the default is off.
22276 Enable coprocessor instructions; the default is off.
22280 Enable C-SKY security instructions; the default is off.
22284 Enable C-SKY trust instructions; the default is off.
22292 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
22293 All of these options default to off.
22298 Generate divide instructions. Default is off.
22303 Generate code for Smart Mode, using only registers numbered 0-7 to allow
22304 use of 16-bit instructions. This option is ignored for CK801 where this
22305 is the required behavior, and it defaults to on for CK802.
22306 For other targets, the default is off.
22308 @item -mhigh-registers
22309 @itemx -mno-high-registers
22310 @opindex mhigh-registers
22311 Generate code using the high registers numbered 16-31. This option
22312 is not supported on CK801, CK802, or CK803, and is enabled by default
22313 for other processors.
22318 Generate code using global anchor symbol addresses.
22321 @itemx -mno-pushpop
22323 Generate code using @code{push} and @code{pop} instructions. This option
22326 @item -mmultiple-stld
22328 @itemx -mno-multiple-stld
22330 @opindex mmultiple-stld
22331 Generate code using @code{stm} and @code{ldm} instructions. This option
22332 isn't supported on CK801 but is enabled by default on other processors.
22335 @itemx -mno-constpool
22336 @opindex mconstpool
22337 Create constant pools in the compiler instead of deferring it to the
22338 assembler. This option is the default and required for correct code
22339 generation on CK801 and CK802, and is optional on other processors.
22342 @item -mno-stack-size
22343 @opindex mstack-size
22344 Emit @code{.stack_size} directives for each function in the assembly
22345 output. This option defaults to off.
22350 Generate code for the C-SKY compiler runtime instead of libgcc. This
22351 option defaults to off.
22353 @item -mbranch-cost=@var{n}
22354 @opindex mbranch-cost=
22355 Set the branch costs to roughly @code{n} instructions. The default is 1.
22357 @item -msched-prolog
22358 @itemx -mno-sched-prolog
22359 @opindex msched-prolog
22360 Permit scheduling of function prologue and epilogue sequences. Using
22361 this option can result in code that is not compliant with the C-SKY V2 ABI
22362 prologue requirements and that cannot be debugged or backtraced.
22363 It is disabled by default.
22367 Links the library libsemi.a which is in compatible with simulator. Applicable
22368 to ELF compiler only.
22372 @node Darwin Options
22373 @subsection Darwin Options
22374 @cindex Darwin options
22376 These options are defined for all architectures running the Darwin operating
22379 FSF GCC on Darwin does not create ``fat'' object files; it creates
22380 an object file for the single architecture that GCC was built to
22381 target. Apple's GCC on Darwin does create ``fat'' files if multiple
22382 @option{-arch} options are used; it does so by running the compiler or
22383 linker multiple times and joining the results together with
22386 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
22387 @samp{i686}) is determined by the flags that specify the ISA
22388 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
22389 @option{-force_cpusubtype_ALL} option can be used to override this.
22391 The Darwin tools vary in their behavior when presented with an ISA
22392 mismatch. The assembler, @file{as}, only permits instructions to
22393 be used that are valid for the subtype of the file it is generating,
22394 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
22395 The linker for shared libraries, @file{/usr/bin/libtool}, fails
22396 and prints an error if asked to create a shared library with a less
22397 restrictive subtype than its input files (for instance, trying to put
22398 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
22399 for executables, @command{ld}, quietly gives the executable the most
22400 restrictive subtype of any of its input files.
22405 Add the framework directory @var{dir} to the head of the list of
22406 directories to be searched for header files. These directories are
22407 interleaved with those specified by @option{-I} options and are
22408 scanned in a left-to-right order.
22410 A framework directory is a directory with frameworks in it. A
22411 framework is a directory with a @file{Headers} and/or
22412 @file{PrivateHeaders} directory contained directly in it that ends
22413 in @file{.framework}. The name of a framework is the name of this
22414 directory excluding the @file{.framework}. Headers associated with
22415 the framework are found in one of those two directories, with
22416 @file{Headers} being searched first. A subframework is a framework
22417 directory that is in a framework's @file{Frameworks} directory.
22418 Includes of subframework headers can only appear in a header of a
22419 framework that contains the subframework, or in a sibling subframework
22420 header. Two subframeworks are siblings if they occur in the same
22421 framework. A subframework should not have the same name as a
22422 framework; a warning is issued if this is violated. Currently a
22423 subframework cannot have subframeworks; in the future, the mechanism
22424 may be extended to support this. The standard frameworks can be found
22425 in @file{/System/Library/Frameworks} and
22426 @file{/Library/Frameworks}. An example include looks like
22427 @code{#include <Framework/header.h>}, where @file{Framework} denotes
22428 the name of the framework and @file{header.h} is found in the
22429 @file{PrivateHeaders} or @file{Headers} directory.
22431 @item -iframework@var{dir}
22432 @opindex iframework
22433 Like @option{-F} except the directory is a treated as a system
22434 directory. The main difference between this @option{-iframework} and
22435 @option{-F} is that with @option{-iframework} the compiler does not
22436 warn about constructs contained within header files found via
22437 @var{dir}. This option is valid only for the C family of languages.
22441 Emit debugging information for symbols that are used. For stabs
22442 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
22443 This is by default ON@.
22447 Emit debugging information for all symbols and types.
22449 @item -mmacosx-version-min=@var{version}
22450 The earliest version of MacOS X that this executable will run on
22451 is @var{version}. Typical values of @var{version} include @code{10.1},
22452 @code{10.2}, and @code{10.3.9}.
22454 If the compiler was built to use the system's headers by default,
22455 then the default for this option is the system version on which the
22456 compiler is running, otherwise the default is to make choices that
22457 are compatible with as many systems and code bases as possible.
22461 Enable kernel development mode. The @option{-mkernel} option sets
22462 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
22463 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
22464 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
22465 applicable. This mode also sets @option{-mno-altivec},
22466 @option{-msoft-float}, @option{-fno-builtin} and
22467 @option{-mlong-branch} for PowerPC targets.
22469 @item -mone-byte-bool
22470 @opindex mone-byte-bool
22471 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
22472 By default @code{sizeof(bool)} is @code{4} when compiling for
22473 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
22474 option has no effect on x86.
22476 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
22477 to generate code that is not binary compatible with code generated
22478 without that switch. Using this switch may require recompiling all
22479 other modules in a program, including system libraries. Use this
22480 switch to conform to a non-default data model.
22482 @item -mfix-and-continue
22483 @itemx -ffix-and-continue
22484 @itemx -findirect-data
22485 @opindex mfix-and-continue
22486 @opindex ffix-and-continue
22487 @opindex findirect-data
22488 Generate code suitable for fast turnaround development, such as to
22489 allow GDB to dynamically load @file{.o} files into already-running
22490 programs. @option{-findirect-data} and @option{-ffix-and-continue}
22491 are provided for backwards compatibility.
22495 Loads all members of static archive libraries.
22496 See man ld(1) for more information.
22498 @item -arch_errors_fatal
22499 @opindex arch_errors_fatal
22500 Cause the errors having to do with files that have the wrong architecture
22503 @item -bind_at_load
22504 @opindex bind_at_load
22505 Causes the output file to be marked such that the dynamic linker will
22506 bind all undefined references when the file is loaded or launched.
22510 Produce a Mach-o bundle format file.
22511 See man ld(1) for more information.
22513 @item -bundle_loader @var{executable}
22514 @opindex bundle_loader
22515 This option specifies the @var{executable} that will load the build
22516 output file being linked. See man ld(1) for more information.
22519 @opindex dynamiclib
22520 When passed this option, GCC produces a dynamic library instead of
22521 an executable when linking, using the Darwin @file{libtool} command.
22523 @item -force_cpusubtype_ALL
22524 @opindex force_cpusubtype_ALL
22525 This causes GCC's output file to have the @samp{ALL} subtype, instead of
22526 one controlled by the @option{-mcpu} or @option{-march} option.
22528 @item -allowable_client @var{client_name}
22529 @itemx -client_name
22530 @itemx -compatibility_version
22531 @itemx -current_version
22533 @itemx -dependency-file
22535 @itemx -dylinker_install_name
22537 @itemx -exported_symbols_list
22540 @itemx -flat_namespace
22541 @itemx -force_flat_namespace
22542 @itemx -headerpad_max_install_names
22545 @itemx -install_name
22546 @itemx -keep_private_externs
22547 @itemx -multi_module
22548 @itemx -multiply_defined
22549 @itemx -multiply_defined_unused
22552 @itemx -no_dead_strip_inits_and_terms
22553 @itemx -nofixprebinding
22554 @itemx -nomultidefs
22556 @itemx -noseglinkedit
22557 @itemx -pagezero_size
22559 @itemx -prebind_all_twolevel_modules
22560 @itemx -private_bundle
22562 @itemx -read_only_relocs
22564 @itemx -sectobjectsymbols
22568 @itemx -sectobjectsymbols
22571 @itemx -segs_read_only_addr
22573 @itemx -segs_read_write_addr
22574 @itemx -seg_addr_table
22575 @itemx -seg_addr_table_filename
22576 @itemx -seglinkedit
22578 @itemx -segs_read_only_addr
22579 @itemx -segs_read_write_addr
22580 @itemx -single_module
22582 @itemx -sub_library
22584 @itemx -sub_umbrella
22585 @itemx -twolevel_namespace
22588 @itemx -unexported_symbols_list
22589 @itemx -weak_reference_mismatches
22590 @itemx -whatsloaded
22591 @opindex allowable_client
22592 @opindex client_name
22593 @opindex compatibility_version
22594 @opindex current_version
22595 @opindex dead_strip
22596 @opindex dependency-file
22597 @opindex dylib_file
22598 @opindex dylinker_install_name
22600 @opindex exported_symbols_list
22602 @opindex flat_namespace
22603 @opindex force_flat_namespace
22604 @opindex headerpad_max_install_names
22605 @opindex image_base
22607 @opindex install_name
22608 @opindex keep_private_externs
22609 @opindex multi_module
22610 @opindex multiply_defined
22611 @opindex multiply_defined_unused
22612 @opindex noall_load
22613 @opindex no_dead_strip_inits_and_terms
22614 @opindex nofixprebinding
22615 @opindex nomultidefs
22617 @opindex noseglinkedit
22618 @opindex pagezero_size
22620 @opindex prebind_all_twolevel_modules
22621 @opindex private_bundle
22622 @opindex read_only_relocs
22624 @opindex sectobjectsymbols
22627 @opindex sectcreate
22628 @opindex sectobjectsymbols
22631 @opindex segs_read_only_addr
22632 @opindex segs_read_write_addr
22633 @opindex seg_addr_table
22634 @opindex seg_addr_table_filename
22635 @opindex seglinkedit
22637 @opindex segs_read_only_addr
22638 @opindex segs_read_write_addr
22639 @opindex single_module
22641 @opindex sub_library
22642 @opindex sub_umbrella
22643 @opindex twolevel_namespace
22646 @opindex unexported_symbols_list
22647 @opindex weak_reference_mismatches
22648 @opindex whatsloaded
22649 These options are passed to the Darwin linker. The Darwin linker man page
22650 describes them in detail.
22653 @node DEC Alpha Options
22654 @subsection DEC Alpha Options
22656 These @samp{-m} options are defined for the DEC Alpha implementations:
22659 @item -mno-soft-float
22660 @itemx -msoft-float
22661 @opindex mno-soft-float
22662 @opindex msoft-float
22663 Use (do not use) the hardware floating-point instructions for
22664 floating-point operations. When @option{-msoft-float} is specified,
22665 functions in @file{libgcc.a} are used to perform floating-point
22666 operations. Unless they are replaced by routines that emulate the
22667 floating-point operations, or compiled in such a way as to call such
22668 emulations routines, these routines issue floating-point
22669 operations. If you are compiling for an Alpha without floating-point
22670 operations, you must ensure that the library is built so as not to call
22673 Note that Alpha implementations without floating-point operations are
22674 required to have floating-point registers.
22677 @itemx -mno-fp-regs
22679 @opindex mno-fp-regs
22680 Generate code that uses (does not use) the floating-point register set.
22681 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
22682 register set is not used, floating-point operands are passed in integer
22683 registers as if they were integers and floating-point results are passed
22684 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
22685 so any function with a floating-point argument or return value called by code
22686 compiled with @option{-mno-fp-regs} must also be compiled with that
22689 A typical use of this option is building a kernel that does not use,
22690 and hence need not save and restore, any floating-point registers.
22694 The Alpha architecture implements floating-point hardware optimized for
22695 maximum performance. It is mostly compliant with the IEEE floating-point
22696 standard. However, for full compliance, software assistance is
22697 required. This option generates code fully IEEE-compliant code
22698 @emph{except} that the @var{inexact-flag} is not maintained (see below).
22699 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
22700 defined during compilation. The resulting code is less efficient but is
22701 able to correctly support denormalized numbers and exceptional IEEE
22702 values such as not-a-number and plus/minus infinity. Other Alpha
22703 compilers call this option @option{-ieee_with_no_inexact}.
22705 @item -mieee-with-inexact
22706 @opindex mieee-with-inexact
22707 This is like @option{-mieee} except the generated code also maintains
22708 the IEEE @var{inexact-flag}. Turning on this option causes the
22709 generated code to implement fully-compliant IEEE math. In addition to
22710 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
22711 macro. On some Alpha implementations the resulting code may execute
22712 significantly slower than the code generated by default. Since there is
22713 very little code that depends on the @var{inexact-flag}, you should
22714 normally not specify this option. Other Alpha compilers call this
22715 option @option{-ieee_with_inexact}.
22717 @item -mfp-trap-mode=@var{trap-mode}
22718 @opindex mfp-trap-mode
22719 This option controls what floating-point related traps are enabled.
22720 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
22721 The trap mode can be set to one of four values:
22725 This is the default (normal) setting. The only traps that are enabled
22726 are the ones that cannot be disabled in software (e.g., division by zero
22730 In addition to the traps enabled by @samp{n}, underflow traps are enabled
22734 Like @samp{u}, but the instructions are marked to be safe for software
22735 completion (see Alpha architecture manual for details).
22738 Like @samp{su}, but inexact traps are enabled as well.
22741 @item -mfp-rounding-mode=@var{rounding-mode}
22742 @opindex mfp-rounding-mode
22743 Selects the IEEE rounding mode. Other Alpha compilers call this option
22744 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
22749 Normal IEEE rounding mode. Floating-point numbers are rounded towards
22750 the nearest machine number or towards the even machine number in case
22754 Round towards minus infinity.
22757 Chopped rounding mode. Floating-point numbers are rounded towards zero.
22760 Dynamic rounding mode. A field in the floating-point control register
22761 (@var{fpcr}, see Alpha architecture reference manual) controls the
22762 rounding mode in effect. The C library initializes this register for
22763 rounding towards plus infinity. Thus, unless your program modifies the
22764 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
22767 @item -mtrap-precision=@var{trap-precision}
22768 @opindex mtrap-precision
22769 In the Alpha architecture, floating-point traps are imprecise. This
22770 means without software assistance it is impossible to recover from a
22771 floating trap and program execution normally needs to be terminated.
22772 GCC can generate code that can assist operating system trap handlers
22773 in determining the exact location that caused a floating-point trap.
22774 Depending on the requirements of an application, different levels of
22775 precisions can be selected:
22779 Program precision. This option is the default and means a trap handler
22780 can only identify which program caused a floating-point exception.
22783 Function precision. The trap handler can determine the function that
22784 caused a floating-point exception.
22787 Instruction precision. The trap handler can determine the exact
22788 instruction that caused a floating-point exception.
22791 Other Alpha compilers provide the equivalent options called
22792 @option{-scope_safe} and @option{-resumption_safe}.
22794 @item -mieee-conformant
22795 @opindex mieee-conformant
22796 This option marks the generated code as IEEE conformant. You must not
22797 use this option unless you also specify @option{-mtrap-precision=i} and either
22798 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
22799 is to emit the line @samp{.eflag 48} in the function prologue of the
22800 generated assembly file.
22802 @item -mbuild-constants
22803 @opindex mbuild-constants
22804 Normally GCC examines a 32- or 64-bit integer constant to
22805 see if it can construct it from smaller constants in two or three
22806 instructions. If it cannot, it outputs the constant as a literal and
22807 generates code to load it from the data segment at run time.
22809 Use this option to require GCC to construct @emph{all} integer constants
22810 using code, even if it takes more instructions (the maximum is six).
22812 You typically use this option to build a shared library dynamic
22813 loader. Itself a shared library, it must relocate itself in memory
22814 before it can find the variables and constants in its own data segment.
22832 Indicate whether GCC should generate code to use the optional BWX,
22833 CIX, FIX and MAX instruction sets. The default is to use the instruction
22834 sets supported by the CPU type specified via @option{-mcpu=} option or that
22835 of the CPU on which GCC was built if none is specified.
22838 @itemx -mfloat-ieee
22839 @opindex mfloat-vax
22840 @opindex mfloat-ieee
22841 Generate code that uses (does not use) VAX F and G floating-point
22842 arithmetic instead of IEEE single and double precision.
22844 @item -mexplicit-relocs
22845 @itemx -mno-explicit-relocs
22846 @opindex mexplicit-relocs
22847 @opindex mno-explicit-relocs
22848 Older Alpha assemblers provided no way to generate symbol relocations
22849 except via assembler macros. Use of these macros does not allow
22850 optimal instruction scheduling. GNU binutils as of version 2.12
22851 supports a new syntax that allows the compiler to explicitly mark
22852 which relocations should apply to which instructions. This option
22853 is mostly useful for debugging, as GCC detects the capabilities of
22854 the assembler when it is built and sets the default accordingly.
22857 @itemx -mlarge-data
22858 @opindex msmall-data
22859 @opindex mlarge-data
22860 When @option{-mexplicit-relocs} is in effect, static data is
22861 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
22862 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
22863 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
22864 16-bit relocations off of the @code{$gp} register. This limits the
22865 size of the small data area to 64KB, but allows the variables to be
22866 directly accessed via a single instruction.
22868 The default is @option{-mlarge-data}. With this option the data area
22869 is limited to just below 2GB@. Programs that require more than 2GB of
22870 data must use @code{malloc} or @code{mmap} to allocate the data in the
22871 heap instead of in the program's data segment.
22873 When generating code for shared libraries, @option{-fpic} implies
22874 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
22877 @itemx -mlarge-text
22878 @opindex msmall-text
22879 @opindex mlarge-text
22880 When @option{-msmall-text} is used, the compiler assumes that the
22881 code of the entire program (or shared library) fits in 4MB, and is
22882 thus reachable with a branch instruction. When @option{-msmall-data}
22883 is used, the compiler can assume that all local symbols share the
22884 same @code{$gp} value, and thus reduce the number of instructions
22885 required for a function call from 4 to 1.
22887 The default is @option{-mlarge-text}.
22889 @item -mcpu=@var{cpu_type}
22891 Set the instruction set and instruction scheduling parameters for
22892 machine type @var{cpu_type}. You can specify either the @samp{EV}
22893 style name or the corresponding chip number. GCC supports scheduling
22894 parameters for the EV4, EV5 and EV6 family of processors and
22895 chooses the default values for the instruction set from the processor
22896 you specify. If you do not specify a processor type, GCC defaults
22897 to the processor on which the compiler was built.
22899 Supported values for @var{cpu_type} are
22905 Schedules as an EV4 and has no instruction set extensions.
22909 Schedules as an EV5 and has no instruction set extensions.
22913 Schedules as an EV5 and supports the BWX extension.
22918 Schedules as an EV5 and supports the BWX and MAX extensions.
22922 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
22926 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
22929 Native toolchains also support the value @samp{native},
22930 which selects the best architecture option for the host processor.
22931 @option{-mcpu=native} has no effect if GCC does not recognize
22934 @item -mtune=@var{cpu_type}
22936 Set only the instruction scheduling parameters for machine type
22937 @var{cpu_type}. The instruction set is not changed.
22939 Native toolchains also support the value @samp{native},
22940 which selects the best architecture option for the host processor.
22941 @option{-mtune=native} has no effect if GCC does not recognize
22944 @item -mmemory-latency=@var{time}
22945 @opindex mmemory-latency
22946 Sets the latency the scheduler should assume for typical memory
22947 references as seen by the application. This number is highly
22948 dependent on the memory access patterns used by the application
22949 and the size of the external cache on the machine.
22951 Valid options for @var{time} are
22955 A decimal number representing clock cycles.
22961 The compiler contains estimates of the number of clock cycles for
22962 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
22963 (also called Dcache, Scache, and Bcache), as well as to main memory.
22964 Note that L3 is only valid for EV5.
22970 @subsection eBPF Options
22971 @cindex eBPF Options
22974 @item -mframe-limit=@var{bytes}
22975 This specifies the hard limit for frame sizes, in bytes. Currently,
22976 the value that can be specified should be less than or equal to
22977 @samp{32767}. Defaults to whatever limit is imposed by the version of
22978 the Linux kernel targeted.
22980 @item -mkernel=@var{version}
22982 This specifies the minimum version of the kernel that will run the
22983 compiled program. GCC uses this version to determine which
22984 instructions to use, what kernel helpers to allow, etc. Currently,
22985 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
22986 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
22987 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
22988 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
22989 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
22990 @samp{5.2}, @samp{latest} and @samp{native}.
22993 @opindex mbig-endian
22994 Generate code for a big-endian target.
22996 @item -mlittle-endian
22997 @opindex mlittle-endian
22998 Generate code for a little-endian target. This is the default.
23002 Enable generation of extra conditional-branch instructions.
23003 Enabled for CPU v2 and above.
23007 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
23011 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
23013 @item -mcpu=@var{version}
23015 This specifies which version of the eBPF ISA to target. Newer versions
23016 may not be supported by all kernels. The default is @samp{v3}.
23018 Supported values for @var{version} are:
23022 The first stable eBPF ISA with no special features or extensions.
23025 Supports the jump extensions, as in @option{-mjmpext}.
23028 All features of v2, plus:
23030 @item 32-bit jump operations, as in @option{-mjmp32}
23031 @item 32-bit ALU operations, as in @option{-malu32}
23038 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
23039 is implied by @option{-gbtf}.
23043 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
23044 support is enabled by default when generating BTF debug information for
23048 Generate code for an expanded version of BPF, which relaxes some of
23049 the restrictions imposed by the BPF architecture:
23051 @item Save and restore callee-saved registers at function entry and
23052 exit, respectively.
23057 @subsection FR30 Options
23058 @cindex FR30 Options
23060 These options are defined specifically for the FR30 port.
23064 @item -msmall-model
23065 @opindex msmall-model
23066 Use the small address space model. This can produce smaller code, but
23067 it does assume that all symbolic values and addresses fit into a
23072 Assume that runtime support has been provided and so there is no need
23073 to include the simulator library (@file{libsim.a}) on the linker
23079 @subsection FT32 Options
23080 @cindex FT32 Options
23082 These options are defined specifically for the FT32 port.
23088 Specifies that the program will be run on the simulator. This causes
23089 an alternate runtime startup and library to be linked.
23090 You must not use this option when generating programs that will run on
23091 real hardware; you must provide your own runtime library for whatever
23092 I/O functions are needed.
23096 Enable Local Register Allocation. This is still experimental for FT32,
23097 so by default the compiler uses standard reload.
23101 Do not use div and mod instructions.
23105 Enable use of the extended instructions of the FT32B processor.
23109 Compress all code using the Ft32B code compression scheme.
23113 Do not generate code that reads program memory.
23118 @subsection FRV Options
23119 @cindex FRV Options
23125 Only use the first 32 general-purpose registers.
23130 Use all 64 general-purpose registers.
23135 Use only the first 32 floating-point registers.
23140 Use all 64 floating-point registers.
23143 @opindex mhard-float
23145 Use hardware instructions for floating-point operations.
23148 @opindex msoft-float
23150 Use library routines for floating-point operations.
23155 Dynamically allocate condition code registers.
23160 Do not try to dynamically allocate condition code registers, only
23161 use @code{icc0} and @code{fcc0}.
23166 Change ABI to use double word insns.
23172 Do not use double word instructions.
23177 Use floating-point double instructions.
23180 @opindex mno-double
23182 Do not use floating-point double instructions.
23187 Use media instructions.
23192 Do not use media instructions.
23197 Use multiply and add/subtract instructions.
23200 @opindex mno-muladd
23202 Do not use multiply and add/subtract instructions.
23207 Select the FDPIC ABI, which uses function descriptors to represent
23208 pointers to functions. Without any PIC/PIE-related options, it
23209 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
23210 assumes GOT entries and small data are within a 12-bit range from the
23211 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
23212 are computed with 32 bits.
23213 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23216 @opindex minline-plt
23218 Enable inlining of PLT entries in function calls to functions that are
23219 not known to bind locally. It has no effect without @option{-mfdpic}.
23220 It's enabled by default if optimizing for speed and compiling for
23221 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
23222 optimization option such as @option{-O3} or above is present in the
23228 Assume a large TLS segment when generating thread-local code.
23233 Do not assume a large TLS segment when generating thread-local code.
23238 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
23239 that is known to be in read-only sections. It's enabled by default,
23240 except for @option{-fpic} or @option{-fpie}: even though it may help
23241 make the global offset table smaller, it trades 1 instruction for 4.
23242 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
23243 one of which may be shared by multiple symbols, and it avoids the need
23244 for a GOT entry for the referenced symbol, so it's more likely to be a
23245 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
23247 @item -multilib-library-pic
23248 @opindex multilib-library-pic
23250 Link with the (library, not FD) pic libraries. It's implied by
23251 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
23252 @option{-fpic} without @option{-mfdpic}. You should never have to use
23256 @opindex mlinked-fp
23258 Follow the EABI requirement of always creating a frame pointer whenever
23259 a stack frame is allocated. This option is enabled by default and can
23260 be disabled with @option{-mno-linked-fp}.
23263 @opindex mlong-calls
23265 Use indirect addressing to call functions outside the current
23266 compilation unit. This allows the functions to be placed anywhere
23267 within the 32-bit address space.
23269 @item -malign-labels
23270 @opindex malign-labels
23272 Try to align labels to an 8-byte boundary by inserting NOPs into the
23273 previous packet. This option only has an effect when VLIW packing
23274 is enabled. It doesn't create new packets; it merely adds NOPs to
23277 @item -mlibrary-pic
23278 @opindex mlibrary-pic
23280 Generate position-independent EABI code.
23285 Use only the first four media accumulator registers.
23290 Use all eight media accumulator registers.
23295 Pack VLIW instructions.
23300 Do not pack VLIW instructions.
23303 @opindex mno-eflags
23305 Do not mark ABI switches in e_flags.
23308 @opindex mcond-move
23310 Enable the use of conditional-move instructions (default).
23312 This switch is mainly for debugging the compiler and will likely be removed
23313 in a future version.
23315 @item -mno-cond-move
23316 @opindex mno-cond-move
23318 Disable the use of conditional-move instructions.
23320 This switch is mainly for debugging the compiler and will likely be removed
23321 in a future version.
23326 Enable the use of conditional set instructions (default).
23328 This switch is mainly for debugging the compiler and will likely be removed
23329 in a future version.
23334 Disable the use of conditional set instructions.
23336 This switch is mainly for debugging the compiler and will likely be removed
23337 in a future version.
23340 @opindex mcond-exec
23342 Enable the use of conditional execution (default).
23344 This switch is mainly for debugging the compiler and will likely be removed
23345 in a future version.
23347 @item -mno-cond-exec
23348 @opindex mno-cond-exec
23350 Disable the use of conditional execution.
23352 This switch is mainly for debugging the compiler and will likely be removed
23353 in a future version.
23355 @item -mvliw-branch
23356 @opindex mvliw-branch
23358 Run a pass to pack branches into VLIW instructions (default).
23360 This switch is mainly for debugging the compiler and will likely be removed
23361 in a future version.
23363 @item -mno-vliw-branch
23364 @opindex mno-vliw-branch
23366 Do not run a pass to pack branches into VLIW instructions.
23368 This switch is mainly for debugging the compiler and will likely be removed
23369 in a future version.
23371 @item -mmulti-cond-exec
23372 @opindex mmulti-cond-exec
23374 Enable optimization of @code{&&} and @code{||} in conditional execution
23377 This switch is mainly for debugging the compiler and will likely be removed
23378 in a future version.
23380 @item -mno-multi-cond-exec
23381 @opindex mno-multi-cond-exec
23383 Disable optimization of @code{&&} and @code{||} in conditional execution.
23385 This switch is mainly for debugging the compiler and will likely be removed
23386 in a future version.
23388 @item -mnested-cond-exec
23389 @opindex mnested-cond-exec
23391 Enable nested conditional execution optimizations (default).
23393 This switch is mainly for debugging the compiler and will likely be removed
23394 in a future version.
23396 @item -mno-nested-cond-exec
23397 @opindex mno-nested-cond-exec
23399 Disable nested conditional execution optimizations.
23401 This switch is mainly for debugging the compiler and will likely be removed
23402 in a future version.
23404 @item -moptimize-membar
23405 @opindex moptimize-membar
23407 This switch removes redundant @code{membar} instructions from the
23408 compiler-generated code. It is enabled by default.
23410 @item -mno-optimize-membar
23411 @opindex mno-optimize-membar
23412 @opindex moptimize-membar
23414 This switch disables the automatic removal of redundant @code{membar}
23415 instructions from the generated code.
23417 @item -mtomcat-stats
23418 @opindex mtomcat-stats
23420 Cause gas to print out tomcat statistics.
23422 @item -mcpu=@var{cpu}
23425 Select the processor type for which to generate code. Possible values are
23426 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
23427 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
23431 @node GNU/Linux Options
23432 @subsection GNU/Linux Options
23434 These @samp{-m} options are defined for GNU/Linux targets:
23439 Use the GNU C library. This is the default except
23440 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
23441 @samp{*-*-linux-*android*} targets.
23445 Use uClibc C library. This is the default on
23446 @samp{*-*-linux-*uclibc*} targets.
23450 Use the musl C library. This is the default on
23451 @samp{*-*-linux-*musl*} targets.
23455 Use Bionic C library. This is the default on
23456 @samp{*-*-linux-*android*} targets.
23460 Compile code compatible with Android platform. This is the default on
23461 @samp{*-*-linux-*android*} targets.
23463 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
23464 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
23465 this option makes the GCC driver pass Android-specific options to the linker.
23466 Finally, this option causes the preprocessor macro @code{__ANDROID__}
23469 @item -tno-android-cc
23470 @opindex tno-android-cc
23471 Disable compilation effects of @option{-mandroid}, i.e., do not enable
23472 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
23473 @option{-fno-rtti} by default.
23475 @item -tno-android-ld
23476 @opindex tno-android-ld
23477 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
23478 linking options to the linker.
23482 @node H8/300 Options
23483 @subsection H8/300 Options
23485 These @samp{-m} options are defined for the H8/300 implementations:
23490 Shorten some address references at link time, when possible; uses the
23491 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
23492 ld, Using ld}, for a fuller description.
23496 Generate code for the H8/300H@.
23500 Generate code for the H8S@.
23504 Generate code for the H8S and H8/300H in the normal mode. This switch
23505 must be used either with @option{-mh} or @option{-ms}.
23509 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
23513 Extended registers are stored on stack before execution of function
23514 with monitor attribute. Default option is @option{-mexr}.
23515 This option is valid only for H8S targets.
23520 Extended registers are not stored on stack before execution of function
23521 with monitor attribute. Default option is @option{-mno-exr}.
23522 This option is valid only for H8S targets.
23526 Make @code{int} data 32 bits by default.
23529 @opindex malign-300
23530 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
23531 The default for the H8/300H and H8S is to align longs and floats on
23533 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
23534 This option has no effect on the H8/300.
23538 @subsection HPPA Options
23539 @cindex HPPA Options
23541 These @samp{-m} options are defined for the HPPA family of computers:
23544 @item -march=@var{architecture-type}
23546 Generate code for the specified architecture. The choices for
23547 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
23548 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
23549 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
23550 architecture option for your machine. Code compiled for lower numbered
23551 architectures runs on higher numbered architectures, but not the
23554 @item -mpa-risc-1-0
23555 @itemx -mpa-risc-1-1
23556 @itemx -mpa-risc-2-0
23557 @opindex mpa-risc-1-0
23558 @opindex mpa-risc-1-1
23559 @opindex mpa-risc-2-0
23560 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
23562 @item -mcaller-copies
23563 @opindex mcaller-copies
23564 The caller copies function arguments passed by hidden reference. This
23565 option should be used with care as it is not compatible with the default
23566 32-bit runtime. However, only aggregates larger than eight bytes are
23567 passed by hidden reference and the option provides better compatibility
23570 @item -mjump-in-delay
23571 @opindex mjump-in-delay
23572 This option is ignored and provided for compatibility purposes only.
23574 @item -mdisable-fpregs
23575 @opindex mdisable-fpregs
23576 Prevent floating-point registers from being used in any manner. This is
23577 necessary for compiling kernels that perform lazy context switching of
23578 floating-point registers. If you use this option and attempt to perform
23579 floating-point operations, the compiler aborts.
23581 @item -mdisable-indexing
23582 @opindex mdisable-indexing
23583 Prevent the compiler from using indexing address modes. This avoids some
23584 rather obscure problems when compiling MIG generated code under MACH@.
23586 @item -mno-space-regs
23587 @opindex mno-space-regs
23588 @opindex mspace-regs
23589 Generate code that assumes the target has no space registers. This allows
23590 GCC to generate faster indirect calls and use unscaled index address modes.
23592 Such code is suitable for level 0 PA systems and kernels.
23594 @item -mfast-indirect-calls
23595 @opindex mfast-indirect-calls
23596 Generate code that assumes calls never cross space boundaries. This
23597 allows GCC to emit code that performs faster indirect calls.
23599 This option does not work in the presence of shared libraries or nested
23602 @item -mfixed-range=@var{register-range}
23603 @opindex mfixed-range
23604 Generate code treating the given register range as fixed registers.
23605 A fixed register is one that the register allocator cannot use. This is
23606 useful when compiling kernel code. A register range is specified as
23607 two registers separated by a dash. Multiple register ranges can be
23608 specified separated by a comma.
23610 @item -mlong-load-store
23611 @opindex mlong-load-store
23612 Generate 3-instruction load and store sequences as sometimes required by
23613 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
23616 @item -mportable-runtime
23617 @opindex mportable-runtime
23618 Use the portable calling conventions proposed by HP for ELF systems.
23622 Enable the use of assembler directives only GAS understands.
23624 @item -mschedule=@var{cpu-type}
23626 Schedule code according to the constraints for the machine type
23627 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
23628 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
23629 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
23630 proper scheduling option for your machine. The default scheduling is
23634 @opindex mlinker-opt
23635 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
23636 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
23637 linkers in which they give bogus error messages when linking some programs.
23640 @opindex msoft-float
23641 Generate output containing library calls for floating point.
23642 @strong{Warning:} the requisite libraries are not available for all HPPA
23643 targets. Normally the facilities of the machine's usual C compiler are
23644 used, but this cannot be done directly in cross-compilation. You must make
23645 your own arrangements to provide suitable library functions for
23648 @option{-msoft-float} changes the calling convention in the output file;
23649 therefore, it is only useful if you compile @emph{all} of a program with
23650 this option. In particular, you need to compile @file{libgcc.a}, the
23651 library that comes with GCC, with @option{-msoft-float} in order for
23656 Generate the predefine, @code{_SIO}, for server IO@. The default is
23657 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
23658 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
23659 options are available under HP-UX and HI-UX@.
23663 Use options specific to GNU @command{ld}.
23664 This passes @option{-shared} to @command{ld} when
23665 building a shared library. It is the default when GCC is configured,
23666 explicitly or implicitly, with the GNU linker. This option does not
23667 affect which @command{ld} is called; it only changes what parameters
23668 are passed to that @command{ld}.
23669 The @command{ld} that is called is determined by the
23670 @option{--with-ld} configure option, GCC's program search path, and
23671 finally by the user's @env{PATH}. The linker used by GCC can be printed
23672 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
23673 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23677 Use options specific to HP @command{ld}.
23678 This passes @option{-b} to @command{ld} when building
23679 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
23680 links. It is the default when GCC is configured, explicitly or
23681 implicitly, with the HP linker. This option does not affect
23682 which @command{ld} is called; it only changes what parameters are passed to that
23684 The @command{ld} that is called is determined by the @option{--with-ld}
23685 configure option, GCC's program search path, and finally by the user's
23686 @env{PATH}. The linker used by GCC can be printed using @samp{which
23687 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
23688 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23691 @opindex mno-long-calls
23692 @opindex mlong-calls
23693 Generate code that uses long call sequences. This ensures that a call
23694 is always able to reach linker generated stubs. The default is to generate
23695 long calls only when the distance from the call site to the beginning
23696 of the function or translation unit, as the case may be, exceeds a
23697 predefined limit set by the branch type being used. The limits for
23698 normal calls are 7,600,000 and 240,000 bytes, respectively for the
23699 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
23702 Distances are measured from the beginning of functions when using the
23703 @option{-ffunction-sections} option, or when using the @option{-mgas}
23704 and @option{-mno-portable-runtime} options together under HP-UX with
23707 It is normally not desirable to use this option as it degrades
23708 performance. However, it may be useful in large applications,
23709 particularly when partial linking is used to build the application.
23711 The types of long calls used depends on the capabilities of the
23712 assembler and linker, and the type of code being generated. The
23713 impact on systems that support long absolute calls, and long pic
23714 symbol-difference or pc-relative calls should be relatively small.
23715 However, an indirect call is used on 32-bit ELF systems in pic code
23716 and it is quite long.
23718 @item -munix=@var{unix-std}
23720 Generate compiler predefines and select a startfile for the specified
23721 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
23722 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
23723 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
23724 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
23725 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
23728 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
23729 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
23730 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
23731 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
23732 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
23733 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
23735 It is @emph{important} to note that this option changes the interfaces
23736 for various library routines. It also affects the operational behavior
23737 of the C library. Thus, @emph{extreme} care is needed in using this
23740 Library code that is intended to operate with more than one UNIX
23741 standard must test, set and restore the variable @code{__xpg4_extended_mask}
23742 as appropriate. Most GNU software doesn't provide this capability.
23746 Suppress the generation of link options to search libdld.sl when the
23747 @option{-static} option is specified on HP-UX 10 and later.
23751 The HP-UX implementation of setlocale in libc has a dependency on
23752 libdld.sl. There isn't an archive version of libdld.sl. Thus,
23753 when the @option{-static} option is specified, special link options
23754 are needed to resolve this dependency.
23756 On HP-UX 10 and later, the GCC driver adds the necessary options to
23757 link with libdld.sl when the @option{-static} option is specified.
23758 This causes the resulting binary to be dynamic. On the 64-bit port,
23759 the linkers generate dynamic binaries by default in any case. The
23760 @option{-nolibdld} option can be used to prevent the GCC driver from
23761 adding these link options.
23765 Add support for multithreading with the @dfn{dce thread} library
23766 under HP-UX@. This option sets flags for both the preprocessor and
23770 @node IA-64 Options
23771 @subsection IA-64 Options
23772 @cindex IA-64 Options
23774 These are the @samp{-m} options defined for the Intel IA-64 architecture.
23778 @opindex mbig-endian
23779 Generate code for a big-endian target. This is the default for HP-UX@.
23781 @item -mlittle-endian
23782 @opindex mlittle-endian
23783 Generate code for a little-endian target. This is the default for AIX5
23789 @opindex mno-gnu-as
23790 Generate (or don't) code for the GNU assembler. This is the default.
23791 @c Also, this is the default if the configure option @option{--with-gnu-as}
23797 @opindex mno-gnu-ld
23798 Generate (or don't) code for the GNU linker. This is the default.
23799 @c Also, this is the default if the configure option @option{--with-gnu-ld}
23804 Generate code that does not use a global pointer register. The result
23805 is not position independent code, and violates the IA-64 ABI@.
23807 @item -mvolatile-asm-stop
23808 @itemx -mno-volatile-asm-stop
23809 @opindex mvolatile-asm-stop
23810 @opindex mno-volatile-asm-stop
23811 Generate (or don't) a stop bit immediately before and after volatile asm
23814 @item -mregister-names
23815 @itemx -mno-register-names
23816 @opindex mregister-names
23817 @opindex mno-register-names
23818 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
23819 the stacked registers. This may make assembler output more readable.
23825 Disable (or enable) optimizations that use the small data section. This may
23826 be useful for working around optimizer bugs.
23828 @item -mconstant-gp
23829 @opindex mconstant-gp
23830 Generate code that uses a single constant global pointer value. This is
23831 useful when compiling kernel code.
23835 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
23836 This is useful when compiling firmware code.
23838 @item -minline-float-divide-min-latency
23839 @opindex minline-float-divide-min-latency
23840 Generate code for inline divides of floating-point values
23841 using the minimum latency algorithm.
23843 @item -minline-float-divide-max-throughput
23844 @opindex minline-float-divide-max-throughput
23845 Generate code for inline divides of floating-point values
23846 using the maximum throughput algorithm.
23848 @item -mno-inline-float-divide
23849 @opindex mno-inline-float-divide
23850 Do not generate inline code for divides of floating-point values.
23852 @item -minline-int-divide-min-latency
23853 @opindex minline-int-divide-min-latency
23854 Generate code for inline divides of integer values
23855 using the minimum latency algorithm.
23857 @item -minline-int-divide-max-throughput
23858 @opindex minline-int-divide-max-throughput
23859 Generate code for inline divides of integer values
23860 using the maximum throughput algorithm.
23862 @item -mno-inline-int-divide
23863 @opindex mno-inline-int-divide
23864 @opindex minline-int-divide
23865 Do not generate inline code for divides of integer values.
23867 @item -minline-sqrt-min-latency
23868 @opindex minline-sqrt-min-latency
23869 Generate code for inline square roots
23870 using the minimum latency algorithm.
23872 @item -minline-sqrt-max-throughput
23873 @opindex minline-sqrt-max-throughput
23874 Generate code for inline square roots
23875 using the maximum throughput algorithm.
23877 @item -mno-inline-sqrt
23878 @opindex mno-inline-sqrt
23879 Do not generate inline code for @code{sqrt}.
23882 @itemx -mno-fused-madd
23883 @opindex mfused-madd
23884 @opindex mno-fused-madd
23885 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
23886 instructions. The default is to use these instructions.
23888 @item -mno-dwarf2-asm
23889 @itemx -mdwarf2-asm
23890 @opindex mno-dwarf2-asm
23891 @opindex mdwarf2-asm
23892 Don't (or do) generate assembler code for the DWARF line number debugging
23893 info. This may be useful when not using the GNU assembler.
23895 @item -mearly-stop-bits
23896 @itemx -mno-early-stop-bits
23897 @opindex mearly-stop-bits
23898 @opindex mno-early-stop-bits
23899 Allow stop bits to be placed earlier than immediately preceding the
23900 instruction that triggered the stop bit. This can improve instruction
23901 scheduling, but does not always do so.
23903 @item -mfixed-range=@var{register-range}
23904 @opindex mfixed-range
23905 Generate code treating the given register range as fixed registers.
23906 A fixed register is one that the register allocator cannot use. This is
23907 useful when compiling kernel code. A register range is specified as
23908 two registers separated by a dash. Multiple register ranges can be
23909 specified separated by a comma.
23911 @item -mtls-size=@var{tls-size}
23913 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
23916 @item -mtune=@var{cpu-type}
23918 Tune the instruction scheduling for a particular CPU, Valid values are
23919 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
23920 and @samp{mckinley}.
23926 Generate code for a 32-bit or 64-bit environment.
23927 The 32-bit environment sets int, long and pointer to 32 bits.
23928 The 64-bit environment sets int to 32 bits and long and pointer
23929 to 64 bits. These are HP-UX specific flags.
23931 @item -mno-sched-br-data-spec
23932 @itemx -msched-br-data-spec
23933 @opindex mno-sched-br-data-spec
23934 @opindex msched-br-data-spec
23935 (Dis/En)able data speculative scheduling before reload.
23936 This results in generation of @code{ld.a} instructions and
23937 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23938 The default setting is disabled.
23940 @item -msched-ar-data-spec
23941 @itemx -mno-sched-ar-data-spec
23942 @opindex msched-ar-data-spec
23943 @opindex mno-sched-ar-data-spec
23944 (En/Dis)able data speculative scheduling after reload.
23945 This results in generation of @code{ld.a} instructions and
23946 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23947 The default setting is enabled.
23949 @item -mno-sched-control-spec
23950 @itemx -msched-control-spec
23951 @opindex mno-sched-control-spec
23952 @opindex msched-control-spec
23953 (Dis/En)able control speculative scheduling. This feature is
23954 available only during region scheduling (i.e.@: before reload).
23955 This results in generation of the @code{ld.s} instructions and
23956 the corresponding check instructions @code{chk.s}.
23957 The default setting is disabled.
23959 @item -msched-br-in-data-spec
23960 @itemx -mno-sched-br-in-data-spec
23961 @opindex msched-br-in-data-spec
23962 @opindex mno-sched-br-in-data-spec
23963 (En/Dis)able speculative scheduling of the instructions that
23964 are dependent on the data speculative loads before reload.
23965 This is effective only with @option{-msched-br-data-spec} enabled.
23966 The default setting is enabled.
23968 @item -msched-ar-in-data-spec
23969 @itemx -mno-sched-ar-in-data-spec
23970 @opindex msched-ar-in-data-spec
23971 @opindex mno-sched-ar-in-data-spec
23972 (En/Dis)able speculative scheduling of the instructions that
23973 are dependent on the data speculative loads after reload.
23974 This is effective only with @option{-msched-ar-data-spec} enabled.
23975 The default setting is enabled.
23977 @item -msched-in-control-spec
23978 @itemx -mno-sched-in-control-spec
23979 @opindex msched-in-control-spec
23980 @opindex mno-sched-in-control-spec
23981 (En/Dis)able speculative scheduling of the instructions that
23982 are dependent on the control speculative loads.
23983 This is effective only with @option{-msched-control-spec} enabled.
23984 The default setting is enabled.
23986 @item -mno-sched-prefer-non-data-spec-insns
23987 @itemx -msched-prefer-non-data-spec-insns
23988 @opindex mno-sched-prefer-non-data-spec-insns
23989 @opindex msched-prefer-non-data-spec-insns
23990 If enabled, data-speculative instructions are chosen for schedule
23991 only if there are no other choices at the moment. This makes
23992 the use of the data speculation much more conservative.
23993 The default setting is disabled.
23995 @item -mno-sched-prefer-non-control-spec-insns
23996 @itemx -msched-prefer-non-control-spec-insns
23997 @opindex mno-sched-prefer-non-control-spec-insns
23998 @opindex msched-prefer-non-control-spec-insns
23999 If enabled, control-speculative instructions are chosen for schedule
24000 only if there are no other choices at the moment. This makes
24001 the use of the control speculation much more conservative.
24002 The default setting is disabled.
24004 @item -mno-sched-count-spec-in-critical-path
24005 @itemx -msched-count-spec-in-critical-path
24006 @opindex mno-sched-count-spec-in-critical-path
24007 @opindex msched-count-spec-in-critical-path
24008 If enabled, speculative dependencies are considered during
24009 computation of the instructions priorities. This makes the use of the
24010 speculation a bit more conservative.
24011 The default setting is disabled.
24013 @item -msched-spec-ldc
24014 @opindex msched-spec-ldc
24015 Use a simple data speculation check. This option is on by default.
24017 @item -msched-control-spec-ldc
24018 @opindex msched-spec-ldc
24019 Use a simple check for control speculation. This option is on by default.
24021 @item -msched-stop-bits-after-every-cycle
24022 @opindex msched-stop-bits-after-every-cycle
24023 Place a stop bit after every cycle when scheduling. This option is on
24026 @item -msched-fp-mem-deps-zero-cost
24027 @opindex msched-fp-mem-deps-zero-cost
24028 Assume that floating-point stores and loads are not likely to cause a conflict
24029 when placed into the same instruction group. This option is disabled by
24032 @item -msel-sched-dont-check-control-spec
24033 @opindex msel-sched-dont-check-control-spec
24034 Generate checks for control speculation in selective scheduling.
24035 This flag is disabled by default.
24037 @item -msched-max-memory-insns=@var{max-insns}
24038 @opindex msched-max-memory-insns
24039 Limit on the number of memory insns per instruction group, giving lower
24040 priority to subsequent memory insns attempting to schedule in the same
24041 instruction group. Frequently useful to prevent cache bank conflicts.
24042 The default value is 1.
24044 @item -msched-max-memory-insns-hard-limit
24045 @opindex msched-max-memory-insns-hard-limit
24046 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
24047 disallowing more than that number in an instruction group.
24048 Otherwise, the limit is ``soft'', meaning that non-memory operations
24049 are preferred when the limit is reached, but memory operations may still
24055 @subsection LM32 Options
24056 @cindex LM32 options
24058 These @option{-m} options are defined for the LatticeMico32 architecture:
24061 @item -mbarrel-shift-enabled
24062 @opindex mbarrel-shift-enabled
24063 Enable barrel-shift instructions.
24065 @item -mdivide-enabled
24066 @opindex mdivide-enabled
24067 Enable divide and modulus instructions.
24069 @item -mmultiply-enabled
24070 @opindex multiply-enabled
24071 Enable multiply instructions.
24073 @item -msign-extend-enabled
24074 @opindex msign-extend-enabled
24075 Enable sign extend instructions.
24077 @item -muser-enabled
24078 @opindex muser-enabled
24079 Enable user-defined instructions.
24084 @subsection M32C Options
24085 @cindex M32C options
24088 @item -mcpu=@var{name}
24090 Select the CPU for which code is generated. @var{name} may be one of
24091 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
24092 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
24093 the M32C/80 series.
24097 Specifies that the program will be run on the simulator. This causes
24098 an alternate runtime library to be linked in which supports, for
24099 example, file I/O@. You must not use this option when generating
24100 programs that will run on real hardware; you must provide your own
24101 runtime library for whatever I/O functions are needed.
24103 @item -memregs=@var{number}
24105 Specifies the number of memory-based pseudo-registers GCC uses
24106 during code generation. These pseudo-registers are used like real
24107 registers, so there is a tradeoff between GCC's ability to fit the
24108 code into available registers, and the performance penalty of using
24109 memory instead of registers. Note that all modules in a program must
24110 be compiled with the same value for this option. Because of that, you
24111 must not use this option with GCC's default runtime libraries.
24115 @node M32R/D Options
24116 @subsection M32R/D Options
24117 @cindex M32R/D options
24119 These @option{-m} options are defined for Renesas M32R/D architectures:
24124 Generate code for the M32R/2@.
24128 Generate code for the M32R/X@.
24132 Generate code for the M32R@. This is the default.
24134 @item -mmodel=small
24135 @opindex mmodel=small
24136 Assume all objects live in the lower 16MB of memory (so that their addresses
24137 can be loaded with the @code{ld24} instruction), and assume all subroutines
24138 are reachable with the @code{bl} instruction.
24139 This is the default.
24141 The addressability of a particular object can be set with the
24142 @code{model} attribute.
24144 @item -mmodel=medium
24145 @opindex mmodel=medium
24146 Assume objects may be anywhere in the 32-bit address space (the compiler
24147 generates @code{seth/add3} instructions to load their addresses), and
24148 assume all subroutines are reachable with the @code{bl} instruction.
24150 @item -mmodel=large
24151 @opindex mmodel=large
24152 Assume objects may be anywhere in the 32-bit address space (the compiler
24153 generates @code{seth/add3} instructions to load their addresses), and
24154 assume subroutines may not be reachable with the @code{bl} instruction
24155 (the compiler generates the much slower @code{seth/add3/jl}
24156 instruction sequence).
24159 @opindex msdata=none
24160 Disable use of the small data area. Variables are put into
24161 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
24162 @code{section} attribute has been specified).
24163 This is the default.
24165 The small data area consists of sections @code{.sdata} and @code{.sbss}.
24166 Objects may be explicitly put in the small data area with the
24167 @code{section} attribute using one of these sections.
24169 @item -msdata=sdata
24170 @opindex msdata=sdata
24171 Put small global and static data in the small data area, but do not
24172 generate special code to reference them.
24175 @opindex msdata=use
24176 Put small global and static data in the small data area, and generate
24177 special instructions to reference them.
24181 @cindex smaller data references
24182 Put global and static objects less than or equal to @var{num} bytes
24183 into the small data or BSS sections instead of the normal data or BSS
24184 sections. The default value of @var{num} is 8.
24185 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
24186 for this option to have any effect.
24188 All modules should be compiled with the same @option{-G @var{num}} value.
24189 Compiling with different values of @var{num} may or may not work; if it
24190 doesn't the linker gives an error message---incorrect code is not
24195 Makes the M32R-specific code in the compiler display some statistics
24196 that might help in debugging programs.
24198 @item -malign-loops
24199 @opindex malign-loops
24200 Align all loops to a 32-byte boundary.
24202 @item -mno-align-loops
24203 @opindex mno-align-loops
24204 Do not enforce a 32-byte alignment for loops. This is the default.
24206 @item -missue-rate=@var{number}
24207 @opindex missue-rate=@var{number}
24208 Issue @var{number} instructions per cycle. @var{number} can only be 1
24211 @item -mbranch-cost=@var{number}
24212 @opindex mbranch-cost=@var{number}
24213 @var{number} can only be 1 or 2. If it is 1 then branches are
24214 preferred over conditional code, if it is 2, then the opposite applies.
24216 @item -mflush-trap=@var{number}
24217 @opindex mflush-trap=@var{number}
24218 Specifies the trap number to use to flush the cache. The default is
24219 12. Valid numbers are between 0 and 15 inclusive.
24221 @item -mno-flush-trap
24222 @opindex mno-flush-trap
24223 Specifies that the cache cannot be flushed by using a trap.
24225 @item -mflush-func=@var{name}
24226 @opindex mflush-func=@var{name}
24227 Specifies the name of the operating system function to call to flush
24228 the cache. The default is @samp{_flush_cache}, but a function call
24229 is only used if a trap is not available.
24231 @item -mno-flush-func
24232 @opindex mno-flush-func
24233 Indicates that there is no OS function for flushing the cache.
24237 @node M680x0 Options
24238 @subsection M680x0 Options
24239 @cindex M680x0 options
24241 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
24242 The default settings depend on which architecture was selected when
24243 the compiler was configured; the defaults for the most common choices
24247 @item -march=@var{arch}
24249 Generate code for a specific M680x0 or ColdFire instruction set
24250 architecture. Permissible values of @var{arch} for M680x0
24251 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
24252 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
24253 architectures are selected according to Freescale's ISA classification
24254 and the permissible values are: @samp{isaa}, @samp{isaaplus},
24255 @samp{isab} and @samp{isac}.
24257 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
24258 code for a ColdFire target. The @var{arch} in this macro is one of the
24259 @option{-march} arguments given above.
24261 When used together, @option{-march} and @option{-mtune} select code
24262 that runs on a family of similar processors but that is optimized
24263 for a particular microarchitecture.
24265 @item -mcpu=@var{cpu}
24267 Generate code for a specific M680x0 or ColdFire processor.
24268 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
24269 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
24270 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
24271 below, which also classifies the CPUs into families:
24273 @multitable @columnfractions 0.20 0.80
24274 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
24275 @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}
24276 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
24277 @item @samp{5206e} @tab @samp{5206e}
24278 @item @samp{5208} @tab @samp{5207} @samp{5208}
24279 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
24280 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
24281 @item @samp{5216} @tab @samp{5214} @samp{5216}
24282 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
24283 @item @samp{5225} @tab @samp{5224} @samp{5225}
24284 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
24285 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
24286 @item @samp{5249} @tab @samp{5249}
24287 @item @samp{5250} @tab @samp{5250}
24288 @item @samp{5271} @tab @samp{5270} @samp{5271}
24289 @item @samp{5272} @tab @samp{5272}
24290 @item @samp{5275} @tab @samp{5274} @samp{5275}
24291 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
24292 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
24293 @item @samp{5307} @tab @samp{5307}
24294 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
24295 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
24296 @item @samp{5407} @tab @samp{5407}
24297 @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}
24300 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
24301 @var{arch} is compatible with @var{cpu}. Other combinations of
24302 @option{-mcpu} and @option{-march} are rejected.
24304 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
24305 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
24306 where the value of @var{family} is given by the table above.
24308 @item -mtune=@var{tune}
24310 Tune the code for a particular microarchitecture within the
24311 constraints set by @option{-march} and @option{-mcpu}.
24312 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
24313 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
24314 and @samp{cpu32}. The ColdFire microarchitectures
24315 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
24317 You can also use @option{-mtune=68020-40} for code that needs
24318 to run relatively well on 68020, 68030 and 68040 targets.
24319 @option{-mtune=68020-60} is similar but includes 68060 targets
24320 as well. These two options select the same tuning decisions as
24321 @option{-m68020-40} and @option{-m68020-60} respectively.
24323 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
24324 when tuning for 680x0 architecture @var{arch}. It also defines
24325 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
24326 option is used. If GCC is tuning for a range of architectures,
24327 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
24328 it defines the macros for every architecture in the range.
24330 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
24331 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
24332 of the arguments given above.
24338 Generate output for a 68000. This is the default
24339 when the compiler is configured for 68000-based systems.
24340 It is equivalent to @option{-march=68000}.
24342 Use this option for microcontrollers with a 68000 or EC000 core,
24343 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
24347 Generate output for a 68010. This is the default
24348 when the compiler is configured for 68010-based systems.
24349 It is equivalent to @option{-march=68010}.
24355 Generate output for a 68020. This is the default
24356 when the compiler is configured for 68020-based systems.
24357 It is equivalent to @option{-march=68020}.
24361 Generate output for a 68030. This is the default when the compiler is
24362 configured for 68030-based systems. It is equivalent to
24363 @option{-march=68030}.
24367 Generate output for a 68040. This is the default when the compiler is
24368 configured for 68040-based systems. It is equivalent to
24369 @option{-march=68040}.
24371 This option inhibits the use of 68881/68882 instructions that have to be
24372 emulated by software on the 68040. Use this option if your 68040 does not
24373 have code to emulate those instructions.
24377 Generate output for a 68060. This is the default when the compiler is
24378 configured for 68060-based systems. It is equivalent to
24379 @option{-march=68060}.
24381 This option inhibits the use of 68020 and 68881/68882 instructions that
24382 have to be emulated by software on the 68060. Use this option if your 68060
24383 does not have code to emulate those instructions.
24387 Generate output for a CPU32. This is the default
24388 when the compiler is configured for CPU32-based systems.
24389 It is equivalent to @option{-march=cpu32}.
24391 Use this option for microcontrollers with a
24392 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
24393 68336, 68340, 68341, 68349 and 68360.
24397 Generate output for a 520X ColdFire CPU@. This is the default
24398 when the compiler is configured for 520X-based systems.
24399 It is equivalent to @option{-mcpu=5206}, and is now deprecated
24400 in favor of that option.
24402 Use this option for microcontroller with a 5200 core, including
24403 the MCF5202, MCF5203, MCF5204 and MCF5206.
24407 Generate output for a 5206e ColdFire CPU@. The option is now
24408 deprecated in favor of the equivalent @option{-mcpu=5206e}.
24412 Generate output for a member of the ColdFire 528X family.
24413 The option is now deprecated in favor of the equivalent
24414 @option{-mcpu=528x}.
24418 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
24419 in favor of the equivalent @option{-mcpu=5307}.
24423 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
24424 in favor of the equivalent @option{-mcpu=5407}.
24428 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
24429 This includes use of hardware floating-point instructions.
24430 The option is equivalent to @option{-mcpu=547x}, and is now
24431 deprecated in favor of that option.
24435 Generate output for a 68040, without using any of the new instructions.
24436 This results in code that can run relatively efficiently on either a
24437 68020/68881 or a 68030 or a 68040. The generated code does use the
24438 68881 instructions that are emulated on the 68040.
24440 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
24444 Generate output for a 68060, without using any of the new instructions.
24445 This results in code that can run relatively efficiently on either a
24446 68020/68881 or a 68030 or a 68040. The generated code does use the
24447 68881 instructions that are emulated on the 68060.
24449 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
24453 @opindex mhard-float
24455 Generate floating-point instructions. This is the default for 68020
24456 and above, and for ColdFire devices that have an FPU@. It defines the
24457 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
24458 on ColdFire targets.
24461 @opindex msoft-float
24462 Do not generate floating-point instructions; use library calls instead.
24463 This is the default for 68000, 68010, and 68832 targets. It is also
24464 the default for ColdFire devices that have no FPU.
24470 Generate (do not generate) ColdFire hardware divide and remainder
24471 instructions. If @option{-march} is used without @option{-mcpu},
24472 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
24473 architectures. Otherwise, the default is taken from the target CPU
24474 (either the default CPU, or the one specified by @option{-mcpu}). For
24475 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
24476 @option{-mcpu=5206e}.
24478 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
24482 Consider type @code{int} to be 16 bits wide, like @code{short int}.
24483 Additionally, parameters passed on the stack are also aligned to a
24484 16-bit boundary even on targets whose API mandates promotion to 32-bit.
24488 Do not consider type @code{int} to be 16 bits wide. This is the default.
24491 @itemx -mno-bitfield
24492 @opindex mnobitfield
24493 @opindex mno-bitfield
24494 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
24495 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
24499 Do use the bit-field instructions. The @option{-m68020} option implies
24500 @option{-mbitfield}. This is the default if you use a configuration
24501 designed for a 68020.
24505 Use a different function-calling convention, in which functions
24506 that take a fixed number of arguments return with the @code{rtd}
24507 instruction, which pops their arguments while returning. This
24508 saves one instruction in the caller since there is no need to pop
24509 the arguments there.
24511 This calling convention is incompatible with the one normally
24512 used on Unix, so you cannot use it if you need to call libraries
24513 compiled with the Unix compiler.
24515 Also, you must provide function prototypes for all functions that
24516 take variable numbers of arguments (including @code{printf});
24517 otherwise incorrect code is generated for calls to those
24520 In addition, seriously incorrect code results if you call a
24521 function with too many arguments. (Normally, extra arguments are
24522 harmlessly ignored.)
24524 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
24525 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
24527 The default is @option{-mno-rtd}.
24530 @itemx -mno-align-int
24531 @opindex malign-int
24532 @opindex mno-align-int
24533 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
24534 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
24535 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
24536 Aligning variables on 32-bit boundaries produces code that runs somewhat
24537 faster on processors with 32-bit busses at the expense of more memory.
24539 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
24540 aligns structures containing the above types differently than
24541 most published application binary interface specifications for the m68k.
24544 Use the pc-relative addressing mode of the 68000 directly, instead of
24545 using a global offset table. At present, this option implies @option{-fpic},
24546 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
24547 not presently supported with @option{-mpcrel}, though this could be supported for
24548 68020 and higher processors.
24550 @item -mno-strict-align
24551 @itemx -mstrict-align
24552 @opindex mno-strict-align
24553 @opindex mstrict-align
24554 Do not (do) assume that unaligned memory references are handled by
24558 Generate code that allows the data segment to be located in a different
24559 area of memory from the text segment. This allows for execute-in-place in
24560 an environment without virtual memory management. This option implies
24563 @item -mno-sep-data
24564 Generate code that assumes that the data segment follows the text segment.
24565 This is the default.
24567 @item -mid-shared-library
24568 Generate code that supports shared libraries via the library ID method.
24569 This allows for execute-in-place and shared libraries in an environment
24570 without virtual memory management. This option implies @option{-fPIC}.
24572 @item -mno-id-shared-library
24573 Generate code that doesn't assume ID-based shared libraries are being used.
24574 This is the default.
24576 @item -mshared-library-id=n
24577 Specifies the identification number of the ID-based shared library being
24578 compiled. Specifying a value of 0 generates more compact code; specifying
24579 other values forces the allocation of that number to the current
24580 library, but is no more space- or time-efficient than omitting this option.
24586 When generating position-independent code for ColdFire, generate code
24587 that works if the GOT has more than 8192 entries. This code is
24588 larger and slower than code generated without this option. On M680x0
24589 processors, this option is not needed; @option{-fPIC} suffices.
24591 GCC normally uses a single instruction to load values from the GOT@.
24592 While this is relatively efficient, it only works if the GOT
24593 is smaller than about 64k. Anything larger causes the linker
24594 to report an error such as:
24596 @cindex relocation truncated to fit (ColdFire)
24598 relocation truncated to fit: R_68K_GOT16O foobar
24601 If this happens, you should recompile your code with @option{-mxgot}.
24602 It should then work with very large GOTs. However, code generated with
24603 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
24604 the value of a global symbol.
24606 Note that some linkers, including newer versions of the GNU linker,
24607 can create multiple GOTs and sort GOT entries. If you have such a linker,
24608 you should only need to use @option{-mxgot} when compiling a single
24609 object file that accesses more than 8192 GOT entries. Very few do.
24611 These options have no effect unless GCC is generating
24612 position-independent code.
24614 @item -mlong-jump-table-offsets
24615 @opindex mlong-jump-table-offsets
24616 Use 32-bit offsets in @code{switch} tables. The default is to use
24621 @node MCore Options
24622 @subsection MCore Options
24623 @cindex MCore options
24625 These are the @samp{-m} options defined for the Motorola M*Core
24631 @itemx -mno-hardlit
24633 @opindex mno-hardlit
24634 Inline constants into the code stream if it can be done in two
24635 instructions or less.
24641 Use the divide instruction. (Enabled by default).
24643 @item -mrelax-immediate
24644 @itemx -mno-relax-immediate
24645 @opindex mrelax-immediate
24646 @opindex mno-relax-immediate
24647 Allow arbitrary-sized immediates in bit operations.
24649 @item -mwide-bitfields
24650 @itemx -mno-wide-bitfields
24651 @opindex mwide-bitfields
24652 @opindex mno-wide-bitfields
24653 Always treat bit-fields as @code{int}-sized.
24655 @item -m4byte-functions
24656 @itemx -mno-4byte-functions
24657 @opindex m4byte-functions
24658 @opindex mno-4byte-functions
24659 Force all functions to be aligned to a 4-byte boundary.
24661 @item -mcallgraph-data
24662 @itemx -mno-callgraph-data
24663 @opindex mcallgraph-data
24664 @opindex mno-callgraph-data
24665 Emit callgraph information.
24668 @itemx -mno-slow-bytes
24669 @opindex mslow-bytes
24670 @opindex mno-slow-bytes
24671 Prefer word access when reading byte quantities.
24673 @item -mlittle-endian
24674 @itemx -mbig-endian
24675 @opindex mlittle-endian
24676 @opindex mbig-endian
24677 Generate code for a little-endian target.
24683 Generate code for the 210 processor.
24687 Assume that runtime support has been provided and so omit the
24688 simulator library (@file{libsim.a)} from the linker command line.
24690 @item -mstack-increment=@var{size}
24691 @opindex mstack-increment
24692 Set the maximum amount for a single stack increment operation. Large
24693 values can increase the speed of programs that contain functions
24694 that need a large amount of stack space, but they can also trigger a
24695 segmentation fault if the stack is extended too much. The default
24701 @subsection MeP Options
24702 @cindex MeP options
24708 Enables the @code{abs} instruction, which is the absolute difference
24709 between two registers.
24713 Enables all the optional instructions---average, multiply, divide, bit
24714 operations, leading zero, absolute difference, min/max, clip, and
24720 Enables the @code{ave} instruction, which computes the average of two
24723 @item -mbased=@var{n}
24725 Variables of size @var{n} bytes or smaller are placed in the
24726 @code{.based} section by default. Based variables use the @code{$tp}
24727 register as a base register, and there is a 128-byte limit to the
24728 @code{.based} section.
24732 Enables the bit operation instructions---bit test (@code{btstm}), set
24733 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
24734 test-and-set (@code{tas}).
24736 @item -mc=@var{name}
24738 Selects which section constant data is placed in. @var{name} may
24739 be @samp{tiny}, @samp{near}, or @samp{far}.
24743 Enables the @code{clip} instruction. Note that @option{-mclip} is not
24744 useful unless you also provide @option{-mminmax}.
24746 @item -mconfig=@var{name}
24748 Selects one of the built-in core configurations. Each MeP chip has
24749 one or more modules in it; each module has a core CPU and a variety of
24750 coprocessors, optional instructions, and peripherals. The
24751 @code{MeP-Integrator} tool, not part of GCC, provides these
24752 configurations through this option; using this option is the same as
24753 using all the corresponding command-line options. The default
24754 configuration is @samp{default}.
24758 Enables the coprocessor instructions. By default, this is a 32-bit
24759 coprocessor. Note that the coprocessor is normally enabled via the
24760 @option{-mconfig=} option.
24764 Enables the 32-bit coprocessor's instructions.
24768 Enables the 64-bit coprocessor's instructions.
24772 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
24776 Causes constant variables to be placed in the @code{.near} section.
24780 Enables the @code{div} and @code{divu} instructions.
24784 Generate big-endian code.
24788 Generate little-endian code.
24790 @item -mio-volatile
24791 @opindex mio-volatile
24792 Tells the compiler that any variable marked with the @code{io}
24793 attribute is to be considered volatile.
24797 Causes variables to be assigned to the @code{.far} section by default.
24801 Enables the @code{leadz} (leading zero) instruction.
24805 Causes variables to be assigned to the @code{.near} section by default.
24809 Enables the @code{min} and @code{max} instructions.
24813 Enables the multiplication and multiply-accumulate instructions.
24817 Disables all the optional instructions enabled by @option{-mall-opts}.
24821 Enables the @code{repeat} and @code{erepeat} instructions, used for
24822 low-overhead looping.
24826 Causes all variables to default to the @code{.tiny} section. Note
24827 that there is a 65536-byte limit to this section. Accesses to these
24828 variables use the @code{%gp} base register.
24832 Enables the saturation instructions. Note that the compiler does not
24833 currently generate these itself, but this option is included for
24834 compatibility with other tools, like @code{as}.
24838 Link the SDRAM-based runtime instead of the default ROM-based runtime.
24842 Link the simulator run-time libraries.
24846 Link the simulator runtime libraries, excluding built-in support
24847 for reset and exception vectors and tables.
24851 Causes all functions to default to the @code{.far} section. Without
24852 this option, functions default to the @code{.near} section.
24854 @item -mtiny=@var{n}
24856 Variables that are @var{n} bytes or smaller are allocated to the
24857 @code{.tiny} section. These variables use the @code{$gp} base
24858 register. The default for this option is 4, but note that there's a
24859 65536-byte limit to the @code{.tiny} section.
24863 @node MicroBlaze Options
24864 @subsection MicroBlaze Options
24865 @cindex MicroBlaze Options
24870 @opindex msoft-float
24871 Use software emulation for floating point (default).
24874 @opindex mhard-float
24875 Use hardware floating-point instructions.
24879 Do not optimize block moves, use @code{memcpy}.
24881 @item -mno-clearbss
24882 @opindex mno-clearbss
24883 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
24885 @item -mcpu=@var{cpu-type}
24887 Use features of, and schedule code for, the given CPU.
24888 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
24889 where @var{X} is a major version, @var{YY} is the minor version, and
24890 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
24891 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
24893 @item -mxl-soft-mul
24894 @opindex mxl-soft-mul
24895 Use software multiply emulation (default).
24897 @item -mxl-soft-div
24898 @opindex mxl-soft-div
24899 Use software emulation for divides (default).
24901 @item -mxl-barrel-shift
24902 @opindex mxl-barrel-shift
24903 Use the hardware barrel shifter.
24905 @item -mxl-pattern-compare
24906 @opindex mxl-pattern-compare
24907 Use pattern compare instructions.
24909 @item -msmall-divides
24910 @opindex msmall-divides
24911 Use table lookup optimization for small signed integer divisions.
24913 @item -mxl-stack-check
24914 @opindex mxl-stack-check
24915 This option is deprecated. Use @option{-fstack-check} instead.
24918 @opindex mxl-gp-opt
24919 Use GP-relative @code{.sdata}/@code{.sbss} sections.
24921 @item -mxl-multiply-high
24922 @opindex mxl-multiply-high
24923 Use multiply high instructions for high part of 32x32 multiply.
24925 @item -mxl-float-convert
24926 @opindex mxl-float-convert
24927 Use hardware floating-point conversion instructions.
24929 @item -mxl-float-sqrt
24930 @opindex mxl-float-sqrt
24931 Use hardware floating-point square root instruction.
24934 @opindex mbig-endian
24935 Generate code for a big-endian target.
24937 @item -mlittle-endian
24938 @opindex mlittle-endian
24939 Generate code for a little-endian target.
24942 @opindex mxl-reorder
24943 Use reorder instructions (swap and byte reversed load/store).
24945 @item -mxl-mode-@var{app-model}
24946 Select application model @var{app-model}. Valid models are
24949 normal executable (default), uses startup code @file{crt0.o}.
24952 for use with Xilinx Microprocessor Debugger (XMD) based
24953 software intrusive debug agent called xmdstub. This uses startup file
24954 @file{crt1.o} and sets the start address of the program to 0x800.
24957 for applications that are loaded using a bootloader.
24958 This model uses startup file @file{crt2.o} which does not contain a processor
24959 reset vector handler. This is suitable for transferring control on a
24960 processor reset to the bootloader rather than the application.
24963 for applications that do not require any of the
24964 MicroBlaze vectors. This option may be useful for applications running
24965 within a monitoring application. This model uses @file{crt3.o} as a startup file.
24968 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
24969 @option{-mxl-mode-@var{app-model}}.
24971 @item -mpic-data-is-text-relative
24972 @opindex mpic-data-is-text-relative
24973 Assume that the displacement between the text and data segments is fixed
24974 at static link time. This allows data to be referenced by offset from start of
24975 text address instead of GOT since PC-relative addressing is not supported.
24980 @subsection MIPS Options
24981 @cindex MIPS options
24987 Generate big-endian code.
24991 Generate little-endian code. This is the default for @samp{mips*el-*-*}
24994 @item -march=@var{arch}
24996 Generate code that runs on @var{arch}, which can be the name of a
24997 generic MIPS ISA, or the name of a particular processor.
24999 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
25000 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
25001 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
25002 @samp{mips64r5} and @samp{mips64r6}.
25003 The processor names are:
25004 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
25005 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
25006 @samp{5kc}, @samp{5kf},
25008 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
25009 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
25010 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
25011 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
25012 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
25013 @samp{i6400}, @samp{i6500},
25015 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
25016 @samp{gs464e}, @samp{gs264e},
25018 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
25019 @samp{m5100}, @samp{m5101},
25020 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
25022 @samp{p5600}, @samp{p6600},
25023 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
25024 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
25025 @samp{r6000}, @samp{r8000},
25026 @samp{rm7000}, @samp{rm9000},
25027 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
25030 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
25031 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
25032 @samp{xlr} and @samp{xlp}.
25033 The special value @samp{from-abi} selects the
25034 most compatible architecture for the selected ABI (that is,
25035 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
25037 The native Linux/GNU toolchain also supports the value @samp{native},
25038 which selects the best architecture option for the host processor.
25039 @option{-march=native} has no effect if GCC does not recognize
25042 In processor names, a final @samp{000} can be abbreviated as @samp{k}
25043 (for example, @option{-march=r2k}). Prefixes are optional, and
25044 @samp{vr} may be written @samp{r}.
25046 Names of the form @samp{@var{n}f2_1} refer to processors with
25047 FPUs clocked at half the rate of the core, names of the form
25048 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
25049 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
25050 processors with FPUs clocked a ratio of 3:2 with respect to the core.
25051 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
25052 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
25053 accepted as synonyms for @samp{@var{n}f1_1}.
25055 GCC defines two macros based on the value of this option. The first
25056 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
25057 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
25058 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
25059 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
25060 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
25062 Note that the @code{_MIPS_ARCH} macro uses the processor names given
25063 above. In other words, it has the full prefix and does not
25064 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
25065 the macro names the resolved architecture (either @code{"mips1"} or
25066 @code{"mips3"}). It names the default architecture when no
25067 @option{-march} option is given.
25069 @item -mtune=@var{arch}
25071 Optimize for @var{arch}. Among other things, this option controls
25072 the way instructions are scheduled, and the perceived cost of arithmetic
25073 operations. The list of @var{arch} values is the same as for
25076 When this option is not used, GCC optimizes for the processor
25077 specified by @option{-march}. By using @option{-march} and
25078 @option{-mtune} together, it is possible to generate code that
25079 runs on a family of processors, but optimize the code for one
25080 particular member of that family.
25082 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
25083 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
25084 @option{-march} ones described above.
25088 Equivalent to @option{-march=mips1}.
25092 Equivalent to @option{-march=mips2}.
25096 Equivalent to @option{-march=mips3}.
25100 Equivalent to @option{-march=mips4}.
25104 Equivalent to @option{-march=mips32}.
25108 Equivalent to @option{-march=mips32r3}.
25112 Equivalent to @option{-march=mips32r5}.
25116 Equivalent to @option{-march=mips32r6}.
25120 Equivalent to @option{-march=mips64}.
25124 Equivalent to @option{-march=mips64r2}.
25128 Equivalent to @option{-march=mips64r3}.
25132 Equivalent to @option{-march=mips64r5}.
25136 Equivalent to @option{-march=mips64r6}.
25141 @opindex mno-mips16
25142 Generate (do not generate) MIPS16 code. If GCC is targeting a
25143 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
25145 MIPS16 code generation can also be controlled on a per-function basis
25146 by means of @code{mips16} and @code{nomips16} attributes.
25147 @xref{Function Attributes}, for more information.
25149 @item -mflip-mips16
25150 @opindex mflip-mips16
25151 Generate MIPS16 code on alternating functions. This option is provided
25152 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
25153 not intended for ordinary use in compiling user code.
25155 @item -minterlink-compressed
25156 @itemx -mno-interlink-compressed
25157 @opindex minterlink-compressed
25158 @opindex mno-interlink-compressed
25159 Require (do not require) that code using the standard (uncompressed) MIPS ISA
25160 be link-compatible with MIPS16 and microMIPS code, and vice versa.
25162 For example, code using the standard ISA encoding cannot jump directly
25163 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
25164 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
25165 knows that the target of the jump is not compressed.
25167 @item -minterlink-mips16
25168 @itemx -mno-interlink-mips16
25169 @opindex minterlink-mips16
25170 @opindex mno-interlink-mips16
25171 Aliases of @option{-minterlink-compressed} and
25172 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
25173 and are retained for backwards compatibility.
25185 Generate code for the given ABI@.
25187 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
25188 generates 64-bit code when you select a 64-bit architecture, but you
25189 can use @option{-mgp32} to get 32-bit code instead.
25191 For information about the O64 ABI, see
25192 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
25194 GCC supports a variant of the o32 ABI in which floating-point registers
25195 are 64 rather than 32 bits wide. You can select this combination with
25196 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
25197 and @code{mfhc1} instructions and is therefore only supported for
25198 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
25200 The register assignments for arguments and return values remain the
25201 same, but each scalar value is passed in a single 64-bit register
25202 rather than a pair of 32-bit registers. For example, scalar
25203 floating-point values are returned in @samp{$f0} only, not a
25204 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
25205 remains the same in that the even-numbered double-precision registers
25208 Two additional variants of the o32 ABI are supported to enable
25209 a transition from 32-bit to 64-bit registers. These are FPXX
25210 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
25211 The FPXX extension mandates that all code must execute correctly
25212 when run using 32-bit or 64-bit registers. The code can be interlinked
25213 with either FP32 or FP64, but not both.
25214 The FP64A extension is similar to the FP64 extension but forbids the
25215 use of odd-numbered single-precision registers. This can be used
25216 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
25217 processors and allows both FP32 and FP64A code to interlink and
25218 run in the same process without changing FPU modes.
25221 @itemx -mno-abicalls
25223 @opindex mno-abicalls
25224 Generate (do not generate) code that is suitable for SVR4-style
25225 dynamic objects. @option{-mabicalls} is the default for SVR4-based
25230 Generate (do not generate) code that is fully position-independent,
25231 and that can therefore be linked into shared libraries. This option
25232 only affects @option{-mabicalls}.
25234 All @option{-mabicalls} code has traditionally been position-independent,
25235 regardless of options like @option{-fPIC} and @option{-fpic}. However,
25236 as an extension, the GNU toolchain allows executables to use absolute
25237 accesses for locally-binding symbols. It can also use shorter GP
25238 initialization sequences and generate direct calls to locally-defined
25239 functions. This mode is selected by @option{-mno-shared}.
25241 @option{-mno-shared} depends on binutils 2.16 or higher and generates
25242 objects that can only be linked by the GNU linker. However, the option
25243 does not affect the ABI of the final executable; it only affects the ABI
25244 of relocatable objects. Using @option{-mno-shared} generally makes
25245 executables both smaller and quicker.
25247 @option{-mshared} is the default.
25253 Assume (do not assume) that the static and dynamic linkers
25254 support PLTs and copy relocations. This option only affects
25255 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
25256 has no effect without @option{-msym32}.
25258 You can make @option{-mplt} the default by configuring
25259 GCC with @option{--with-mips-plt}. The default is
25260 @option{-mno-plt} otherwise.
25266 Lift (do not lift) the usual restrictions on the size of the global
25269 GCC normally uses a single instruction to load values from the GOT@.
25270 While this is relatively efficient, it only works if the GOT
25271 is smaller than about 64k. Anything larger causes the linker
25272 to report an error such as:
25274 @cindex relocation truncated to fit (MIPS)
25276 relocation truncated to fit: R_MIPS_GOT16 foobar
25279 If this happens, you should recompile your code with @option{-mxgot}.
25280 This works with very large GOTs, although the code is also
25281 less efficient, since it takes three instructions to fetch the
25282 value of a global symbol.
25284 Note that some linkers can create multiple GOTs. If you have such a
25285 linker, you should only need to use @option{-mxgot} when a single object
25286 file accesses more than 64k's worth of GOT entries. Very few do.
25288 These options have no effect unless GCC is generating position
25293 Assume that general-purpose registers are 32 bits wide.
25297 Assume that general-purpose registers are 64 bits wide.
25301 Assume that floating-point registers are 32 bits wide.
25305 Assume that floating-point registers are 64 bits wide.
25309 Do not assume the width of floating-point registers.
25312 @opindex mhard-float
25313 Use floating-point coprocessor instructions.
25316 @opindex msoft-float
25317 Do not use floating-point coprocessor instructions. Implement
25318 floating-point calculations using library calls instead.
25322 Equivalent to @option{-msoft-float}, but additionally asserts that the
25323 program being compiled does not perform any floating-point operations.
25324 This option is presently supported only by some bare-metal MIPS
25325 configurations, where it may select a special set of libraries
25326 that lack all floating-point support (including, for example, the
25327 floating-point @code{printf} formats).
25328 If code compiled with @option{-mno-float} accidentally contains
25329 floating-point operations, it is likely to suffer a link-time
25330 or run-time failure.
25332 @item -msingle-float
25333 @opindex msingle-float
25334 Assume that the floating-point coprocessor only supports single-precision
25337 @item -mdouble-float
25338 @opindex mdouble-float
25339 Assume that the floating-point coprocessor supports double-precision
25340 operations. This is the default.
25343 @itemx -mno-odd-spreg
25344 @opindex modd-spreg
25345 @opindex mno-odd-spreg
25346 Enable the use of odd-numbered single-precision floating-point registers
25347 for the o32 ABI. This is the default for processors that are known to
25348 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
25352 @itemx -mabs=legacy
25354 @opindex mabs=legacy
25355 These options control the treatment of the special not-a-number (NaN)
25356 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
25357 @code{neg.@i{fmt}} machine instructions.
25359 By default or when @option{-mabs=legacy} is used the legacy
25360 treatment is selected. In this case these instructions are considered
25361 arithmetic and avoided where correct operation is required and the
25362 input operand might be a NaN. A longer sequence of instructions that
25363 manipulate the sign bit of floating-point datum manually is used
25364 instead unless the @option{-ffinite-math-only} option has also been
25367 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
25368 this case these instructions are considered non-arithmetic and therefore
25369 operating correctly in all cases, including in particular where the
25370 input operand is a NaN. These instructions are therefore always used
25371 for the respective operations.
25374 @itemx -mnan=legacy
25376 @opindex mnan=legacy
25377 These options control the encoding of the special not-a-number (NaN)
25378 IEEE 754 floating-point data.
25380 The @option{-mnan=legacy} option selects the legacy encoding. In this
25381 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
25382 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
25383 by the first bit of their trailing significand field being 1.
25385 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
25386 this case qNaNs are denoted by the first bit of their trailing
25387 significand field being 1, whereas sNaNs are denoted by the first bit of
25388 their trailing significand field being 0.
25390 The default is @option{-mnan=legacy} unless GCC has been configured with
25391 @option{--with-nan=2008}.
25397 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
25398 implement atomic memory built-in functions. When neither option is
25399 specified, GCC uses the instructions if the target architecture
25402 @option{-mllsc} is useful if the runtime environment can emulate the
25403 instructions and @option{-mno-llsc} can be useful when compiling for
25404 nonstandard ISAs. You can make either option the default by
25405 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
25406 respectively. @option{--with-llsc} is the default for some
25407 configurations; see the installation documentation for details.
25413 Use (do not use) revision 1 of the MIPS DSP ASE@.
25414 @xref{MIPS DSP Built-in Functions}. This option defines the
25415 preprocessor macro @code{__mips_dsp}. It also defines
25416 @code{__mips_dsp_rev} to 1.
25422 Use (do not use) revision 2 of the MIPS DSP ASE@.
25423 @xref{MIPS DSP Built-in Functions}. This option defines the
25424 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
25425 It also defines @code{__mips_dsp_rev} to 2.
25428 @itemx -mno-smartmips
25429 @opindex msmartmips
25430 @opindex mno-smartmips
25431 Use (do not use) the MIPS SmartMIPS ASE.
25433 @item -mpaired-single
25434 @itemx -mno-paired-single
25435 @opindex mpaired-single
25436 @opindex mno-paired-single
25437 Use (do not use) paired-single floating-point instructions.
25438 @xref{MIPS Paired-Single Support}. This option requires
25439 hardware floating-point support to be enabled.
25445 Use (do not use) MIPS Digital Media Extension instructions.
25446 This option can only be used when generating 64-bit code and requires
25447 hardware floating-point support to be enabled.
25452 @opindex mno-mips3d
25453 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
25454 The option @option{-mips3d} implies @option{-mpaired-single}.
25457 @itemx -mno-micromips
25458 @opindex mmicromips
25459 @opindex mno-mmicromips
25460 Generate (do not generate) microMIPS code.
25462 MicroMIPS code generation can also be controlled on a per-function basis
25463 by means of @code{micromips} and @code{nomicromips} attributes.
25464 @xref{Function Attributes}, for more information.
25470 Use (do not use) MT Multithreading instructions.
25476 Use (do not use) the MIPS MCU ASE instructions.
25482 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
25488 Use (do not use) the MIPS Virtualization (VZ) instructions.
25494 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
25500 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
25506 Use (do not use) the MIPS Global INValidate (GINV) instructions.
25508 @item -mloongson-mmi
25509 @itemx -mno-loongson-mmi
25510 @opindex mloongson-mmi
25511 @opindex mno-loongson-mmi
25512 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
25514 @item -mloongson-ext
25515 @itemx -mno-loongson-ext
25516 @opindex mloongson-ext
25517 @opindex mno-loongson-ext
25518 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
25520 @item -mloongson-ext2
25521 @itemx -mno-loongson-ext2
25522 @opindex mloongson-ext2
25523 @opindex mno-loongson-ext2
25524 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
25528 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
25529 an explanation of the default and the way that the pointer size is
25534 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
25536 The default size of @code{int}s, @code{long}s and pointers depends on
25537 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
25538 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
25539 32-bit @code{long}s. Pointers are the same size as @code{long}s,
25540 or the same size as integer registers, whichever is smaller.
25546 Assume (do not assume) that all symbols have 32-bit values, regardless
25547 of the selected ABI@. This option is useful in combination with
25548 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
25549 to generate shorter and faster references to symbolic addresses.
25553 Put definitions of externally-visible data in a small data section
25554 if that data is no bigger than @var{num} bytes. GCC can then generate
25555 more efficient accesses to the data; see @option{-mgpopt} for details.
25557 The default @option{-G} option depends on the configuration.
25559 @item -mlocal-sdata
25560 @itemx -mno-local-sdata
25561 @opindex mlocal-sdata
25562 @opindex mno-local-sdata
25563 Extend (do not extend) the @option{-G} behavior to local data too,
25564 such as to static variables in C@. @option{-mlocal-sdata} is the
25565 default for all configurations.
25567 If the linker complains that an application is using too much small data,
25568 you might want to try rebuilding the less performance-critical parts with
25569 @option{-mno-local-sdata}. You might also want to build large
25570 libraries with @option{-mno-local-sdata}, so that the libraries leave
25571 more room for the main program.
25573 @item -mextern-sdata
25574 @itemx -mno-extern-sdata
25575 @opindex mextern-sdata
25576 @opindex mno-extern-sdata
25577 Assume (do not assume) that externally-defined data is in
25578 a small data section if the size of that data is within the @option{-G} limit.
25579 @option{-mextern-sdata} is the default for all configurations.
25581 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
25582 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
25583 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
25584 is placed in a small data section. If @var{Var} is defined by another
25585 module, you must either compile that module with a high-enough
25586 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
25587 definition. If @var{Var} is common, you must link the application
25588 with a high-enough @option{-G} setting.
25590 The easiest way of satisfying these restrictions is to compile
25591 and link every module with the same @option{-G} option. However,
25592 you may wish to build a library that supports several different
25593 small data limits. You can do this by compiling the library with
25594 the highest supported @option{-G} setting and additionally using
25595 @option{-mno-extern-sdata} to stop the library from making assumptions
25596 about externally-defined data.
25602 Use (do not use) GP-relative accesses for symbols that are known to be
25603 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
25604 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
25607 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
25608 might not hold the value of @code{_gp}. For example, if the code is
25609 part of a library that might be used in a boot monitor, programs that
25610 call boot monitor routines pass an unknown value in @code{$gp}.
25611 (In such situations, the boot monitor itself is usually compiled
25612 with @option{-G0}.)
25614 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
25615 @option{-mno-extern-sdata}.
25617 @item -membedded-data
25618 @itemx -mno-embedded-data
25619 @opindex membedded-data
25620 @opindex mno-embedded-data
25621 Allocate variables to the read-only data section first if possible, then
25622 next in the small data section if possible, otherwise in data. This gives
25623 slightly slower code than the default, but reduces the amount of RAM required
25624 when executing, and thus may be preferred for some embedded systems.
25626 @item -muninit-const-in-rodata
25627 @itemx -mno-uninit-const-in-rodata
25628 @opindex muninit-const-in-rodata
25629 @opindex mno-uninit-const-in-rodata
25630 Put uninitialized @code{const} variables in the read-only data section.
25631 This option is only meaningful in conjunction with @option{-membedded-data}.
25633 @item -mcode-readable=@var{setting}
25634 @opindex mcode-readable
25635 Specify whether GCC may generate code that reads from executable sections.
25636 There are three possible settings:
25639 @item -mcode-readable=yes
25640 Instructions may freely access executable sections. This is the
25643 @item -mcode-readable=pcrel
25644 MIPS16 PC-relative load instructions can access executable sections,
25645 but other instructions must not do so. This option is useful on 4KSc
25646 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
25647 It is also useful on processors that can be configured to have a dual
25648 instruction/data SRAM interface and that, like the M4K, automatically
25649 redirect PC-relative loads to the instruction RAM.
25651 @item -mcode-readable=no
25652 Instructions must not access executable sections. This option can be
25653 useful on targets that are configured to have a dual instruction/data
25654 SRAM interface but that (unlike the M4K) do not automatically redirect
25655 PC-relative loads to the instruction RAM.
25658 @item -msplit-addresses
25659 @itemx -mno-split-addresses
25660 @opindex msplit-addresses
25661 @opindex mno-split-addresses
25662 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
25663 relocation operators. This option has been superseded by
25664 @option{-mexplicit-relocs} but is retained for backwards compatibility.
25666 @item -mexplicit-relocs
25667 @itemx -mno-explicit-relocs
25668 @opindex mexplicit-relocs
25669 @opindex mno-explicit-relocs
25670 Use (do not use) assembler relocation operators when dealing with symbolic
25671 addresses. The alternative, selected by @option{-mno-explicit-relocs},
25672 is to use assembler macros instead.
25674 @option{-mexplicit-relocs} is the default if GCC was configured
25675 to use an assembler that supports relocation operators.
25677 @item -mcheck-zero-division
25678 @itemx -mno-check-zero-division
25679 @opindex mcheck-zero-division
25680 @opindex mno-check-zero-division
25681 Trap (do not trap) on integer division by zero.
25683 The default is @option{-mcheck-zero-division}.
25685 @item -mdivide-traps
25686 @itemx -mdivide-breaks
25687 @opindex mdivide-traps
25688 @opindex mdivide-breaks
25689 MIPS systems check for division by zero by generating either a
25690 conditional trap or a break instruction. Using traps results in
25691 smaller code, but is only supported on MIPS II and later. Also, some
25692 versions of the Linux kernel have a bug that prevents trap from
25693 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
25694 allow conditional traps on architectures that support them and
25695 @option{-mdivide-breaks} to force the use of breaks.
25697 The default is usually @option{-mdivide-traps}, but this can be
25698 overridden at configure time using @option{--with-divide=breaks}.
25699 Divide-by-zero checks can be completely disabled using
25700 @option{-mno-check-zero-division}.
25702 @item -mload-store-pairs
25703 @itemx -mno-load-store-pairs
25704 @opindex mload-store-pairs
25705 @opindex mno-load-store-pairs
25706 Enable (disable) an optimization that pairs consecutive load or store
25707 instructions to enable load/store bonding. This option is enabled by
25708 default but only takes effect when the selected architecture is known
25709 to support bonding.
25714 @opindex mno-memcpy
25715 Force (do not force) the use of @code{memcpy} for non-trivial block
25716 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
25717 most constant-sized copies.
25720 @itemx -mno-long-calls
25721 @opindex mlong-calls
25722 @opindex mno-long-calls
25723 Disable (do not disable) use of the @code{jal} instruction. Calling
25724 functions using @code{jal} is more efficient but requires the caller
25725 and callee to be in the same 256 megabyte segment.
25727 This option has no effect on abicalls code. The default is
25728 @option{-mno-long-calls}.
25734 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
25735 instructions, as provided by the R4650 ISA@.
25741 Enable (disable) use of the @code{madd} and @code{msub} integer
25742 instructions. The default is @option{-mimadd} on architectures
25743 that support @code{madd} and @code{msub} except for the 74k
25744 architecture where it was found to generate slower code.
25747 @itemx -mno-fused-madd
25748 @opindex mfused-madd
25749 @opindex mno-fused-madd
25750 Enable (disable) use of the floating-point multiply-accumulate
25751 instructions, when they are available. The default is
25752 @option{-mfused-madd}.
25754 On the R8000 CPU when multiply-accumulate instructions are used,
25755 the intermediate product is calculated to infinite precision
25756 and is not subject to the FCSR Flush to Zero bit. This may be
25757 undesirable in some circumstances. On other processors the result
25758 is numerically identical to the equivalent computation using
25759 separate multiply, add, subtract and negate instructions.
25763 Tell the MIPS assembler to not run its preprocessor over user
25764 assembler files (with a @samp{.s} suffix) when assembling them.
25767 @itemx -mno-fix-24k
25769 @opindex mno-fix-24k
25770 Work around the 24K E48 (lost data on stores during refill) errata.
25771 The workarounds are implemented by the assembler rather than by GCC@.
25774 @itemx -mno-fix-r4000
25775 @opindex mfix-r4000
25776 @opindex mno-fix-r4000
25777 Work around certain R4000 CPU errata:
25780 A double-word or a variable shift may give an incorrect result if executed
25781 immediately after starting an integer division.
25783 A double-word or a variable shift may give an incorrect result if executed
25784 while an integer multiplication is in progress.
25786 An integer division may give an incorrect result if started in a delay slot
25787 of a taken branch or a jump.
25791 @itemx -mno-fix-r4400
25792 @opindex mfix-r4400
25793 @opindex mno-fix-r4400
25794 Work around certain R4400 CPU errata:
25797 A double-word or a variable shift may give an incorrect result if executed
25798 immediately after starting an integer division.
25802 @itemx -mno-fix-r10000
25803 @opindex mfix-r10000
25804 @opindex mno-fix-r10000
25805 Work around certain R10000 errata:
25808 @code{ll}/@code{sc} sequences may not behave atomically on revisions
25809 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
25812 This option can only be used if the target architecture supports
25813 branch-likely instructions. @option{-mfix-r10000} is the default when
25814 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
25818 @itemx -mno-fix-r5900
25819 @opindex mfix-r5900
25820 Do not attempt to schedule the preceding instruction into the delay slot
25821 of a branch instruction placed at the end of a short loop of six
25822 instructions or fewer and always schedule a @code{nop} instruction there
25823 instead. The short loop bug under certain conditions causes loops to
25824 execute only once or twice, due to a hardware bug in the R5900 chip. The
25825 workaround is implemented by the assembler rather than by GCC@.
25828 @itemx -mno-fix-rm7000
25829 @opindex mfix-rm7000
25830 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
25831 workarounds are implemented by the assembler rather than by GCC@.
25834 @itemx -mno-fix-vr4120
25835 @opindex mfix-vr4120
25836 Work around certain VR4120 errata:
25839 @code{dmultu} does not always produce the correct result.
25841 @code{div} and @code{ddiv} do not always produce the correct result if one
25842 of the operands is negative.
25844 The workarounds for the division errata rely on special functions in
25845 @file{libgcc.a}. At present, these functions are only provided by
25846 the @code{mips64vr*-elf} configurations.
25848 Other VR4120 errata require a NOP to be inserted between certain pairs of
25849 instructions. These errata are handled by the assembler, not by GCC itself.
25852 @opindex mfix-vr4130
25853 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
25854 workarounds are implemented by the assembler rather than by GCC,
25855 although GCC avoids using @code{mflo} and @code{mfhi} if the
25856 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
25857 instructions are available instead.
25860 @itemx -mno-fix-sb1
25862 Work around certain SB-1 CPU core errata.
25863 (This flag currently works around the SB-1 revision 2
25864 ``F1'' and ``F2'' floating-point errata.)
25866 @item -mr10k-cache-barrier=@var{setting}
25867 @opindex mr10k-cache-barrier
25868 Specify whether GCC should insert cache barriers to avoid the
25869 side effects of speculation on R10K processors.
25871 In common with many processors, the R10K tries to predict the outcome
25872 of a conditional branch and speculatively executes instructions from
25873 the ``taken'' branch. It later aborts these instructions if the
25874 predicted outcome is wrong. However, on the R10K, even aborted
25875 instructions can have side effects.
25877 This problem only affects kernel stores and, depending on the system,
25878 kernel loads. As an example, a speculatively-executed store may load
25879 the target memory into cache and mark the cache line as dirty, even if
25880 the store itself is later aborted. If a DMA operation writes to the
25881 same area of memory before the ``dirty'' line is flushed, the cached
25882 data overwrites the DMA-ed data. See the R10K processor manual
25883 for a full description, including other potential problems.
25885 One workaround is to insert cache barrier instructions before every memory
25886 access that might be speculatively executed and that might have side
25887 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
25888 controls GCC's implementation of this workaround. It assumes that
25889 aborted accesses to any byte in the following regions does not have
25894 the memory occupied by the current function's stack frame;
25897 the memory occupied by an incoming stack argument;
25900 the memory occupied by an object with a link-time-constant address.
25903 It is the kernel's responsibility to ensure that speculative
25904 accesses to these regions are indeed safe.
25906 If the input program contains a function declaration such as:
25912 then the implementation of @code{foo} must allow @code{j foo} and
25913 @code{jal foo} to be executed speculatively. GCC honors this
25914 restriction for functions it compiles itself. It expects non-GCC
25915 functions (such as hand-written assembly code) to do the same.
25917 The option has three forms:
25920 @item -mr10k-cache-barrier=load-store
25921 Insert a cache barrier before a load or store that might be
25922 speculatively executed and that might have side effects even
25925 @item -mr10k-cache-barrier=store
25926 Insert a cache barrier before a store that might be speculatively
25927 executed and that might have side effects even if aborted.
25929 @item -mr10k-cache-barrier=none
25930 Disable the insertion of cache barriers. This is the default setting.
25933 @item -mflush-func=@var{func}
25934 @itemx -mno-flush-func
25935 @opindex mflush-func
25936 Specifies the function to call to flush the I and D caches, or to not
25937 call any such function. If called, the function must take the same
25938 arguments as the common @code{_flush_func}, that is, the address of the
25939 memory range for which the cache is being flushed, the size of the
25940 memory range, and the number 3 (to flush both caches). The default
25941 depends on the target GCC was configured for, but commonly is either
25942 @code{_flush_func} or @code{__cpu_flush}.
25944 @item mbranch-cost=@var{num}
25945 @opindex mbranch-cost
25946 Set the cost of branches to roughly @var{num} ``simple'' instructions.
25947 This cost is only a heuristic and is not guaranteed to produce
25948 consistent results across releases. A zero cost redundantly selects
25949 the default, which is based on the @option{-mtune} setting.
25951 @item -mbranch-likely
25952 @itemx -mno-branch-likely
25953 @opindex mbranch-likely
25954 @opindex mno-branch-likely
25955 Enable or disable use of Branch Likely instructions, regardless of the
25956 default for the selected architecture. By default, Branch Likely
25957 instructions may be generated if they are supported by the selected
25958 architecture. An exception is for the MIPS32 and MIPS64 architectures
25959 and processors that implement those architectures; for those, Branch
25960 Likely instructions are not be generated by default because the MIPS32
25961 and MIPS64 architectures specifically deprecate their use.
25963 @item -mcompact-branches=never
25964 @itemx -mcompact-branches=optimal
25965 @itemx -mcompact-branches=always
25966 @opindex mcompact-branches=never
25967 @opindex mcompact-branches=optimal
25968 @opindex mcompact-branches=always
25969 These options control which form of branches will be generated. The
25970 default is @option{-mcompact-branches=optimal}.
25972 The @option{-mcompact-branches=never} option ensures that compact branch
25973 instructions will never be generated.
25975 The @option{-mcompact-branches=always} option ensures that a compact
25976 branch instruction will be generated if available. If a compact branch
25977 instruction is not available, a delay slot form of the branch will be
25980 This option is supported from MIPS Release 6 onwards.
25982 The @option{-mcompact-branches=optimal} option will cause a delay slot
25983 branch to be used if one is available in the current ISA and the delay
25984 slot is successfully filled. If the delay slot is not filled, a compact
25985 branch will be chosen if one is available.
25987 @item -mfp-exceptions
25988 @itemx -mno-fp-exceptions
25989 @opindex mfp-exceptions
25990 Specifies whether FP exceptions are enabled. This affects how
25991 FP instructions are scheduled for some processors.
25992 The default is that FP exceptions are
25995 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
25996 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
25999 @item -mvr4130-align
26000 @itemx -mno-vr4130-align
26001 @opindex mvr4130-align
26002 The VR4130 pipeline is two-way superscalar, but can only issue two
26003 instructions together if the first one is 8-byte aligned. When this
26004 option is enabled, GCC aligns pairs of instructions that it
26005 thinks should execute in parallel.
26007 This option only has an effect when optimizing for the VR4130.
26008 It normally makes code faster, but at the expense of making it bigger.
26009 It is enabled by default at optimization level @option{-O3}.
26014 Enable (disable) generation of @code{synci} instructions on
26015 architectures that support it. The @code{synci} instructions (if
26016 enabled) are generated when @code{__builtin___clear_cache} is
26019 This option defaults to @option{-mno-synci}, but the default can be
26020 overridden by configuring GCC with @option{--with-synci}.
26022 When compiling code for single processor systems, it is generally safe
26023 to use @code{synci}. However, on many multi-core (SMP) systems, it
26024 does not invalidate the instruction caches on all cores and may lead
26025 to undefined behavior.
26027 @item -mrelax-pic-calls
26028 @itemx -mno-relax-pic-calls
26029 @opindex mrelax-pic-calls
26030 Try to turn PIC calls that are normally dispatched via register
26031 @code{$25} into direct calls. This is only possible if the linker can
26032 resolve the destination at link time and if the destination is within
26033 range for a direct call.
26035 @option{-mrelax-pic-calls} is the default if GCC was configured to use
26036 an assembler and a linker that support the @code{.reloc} assembly
26037 directive and @option{-mexplicit-relocs} is in effect. With
26038 @option{-mno-explicit-relocs}, this optimization can be performed by the
26039 assembler and the linker alone without help from the compiler.
26041 @item -mmcount-ra-address
26042 @itemx -mno-mcount-ra-address
26043 @opindex mmcount-ra-address
26044 @opindex mno-mcount-ra-address
26045 Emit (do not emit) code that allows @code{_mcount} to modify the
26046 calling function's return address. When enabled, this option extends
26047 the usual @code{_mcount} interface with a new @var{ra-address}
26048 parameter, which has type @code{intptr_t *} and is passed in register
26049 @code{$12}. @code{_mcount} can then modify the return address by
26050 doing both of the following:
26053 Returning the new address in register @code{$31}.
26055 Storing the new address in @code{*@var{ra-address}},
26056 if @var{ra-address} is nonnull.
26059 The default is @option{-mno-mcount-ra-address}.
26061 @item -mframe-header-opt
26062 @itemx -mno-frame-header-opt
26063 @opindex mframe-header-opt
26064 Enable (disable) frame header optimization in the o32 ABI. When using the
26065 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
26066 function to write out register arguments. When enabled, this optimization
26067 will suppress the allocation of the frame header if it can be determined that
26070 This optimization is off by default at all optimization levels.
26073 @itemx -mno-lxc1-sxc1
26074 @opindex mlxc1-sxc1
26075 When applicable, enable (disable) the generation of @code{lwxc1},
26076 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
26081 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
26082 @code{madd.d} and related instructions. Enabled by default.
26087 @subsection MMIX Options
26088 @cindex MMIX Options
26090 These options are defined for the MMIX:
26094 @itemx -mno-libfuncs
26096 @opindex mno-libfuncs
26097 Specify that intrinsic library functions are being compiled, passing all
26098 values in registers, no matter the size.
26101 @itemx -mno-epsilon
26103 @opindex mno-epsilon
26104 Generate floating-point comparison instructions that compare with respect
26105 to the @code{rE} epsilon register.
26107 @item -mabi=mmixware
26109 @opindex mabi=mmixware
26111 Generate code that passes function parameters and return values that (in
26112 the called function) are seen as registers @code{$0} and up, as opposed to
26113 the GNU ABI which uses global registers @code{$231} and up.
26115 @item -mzero-extend
26116 @itemx -mno-zero-extend
26117 @opindex mzero-extend
26118 @opindex mno-zero-extend
26119 When reading data from memory in sizes shorter than 64 bits, use (do not
26120 use) zero-extending load instructions by default, rather than
26121 sign-extending ones.
26124 @itemx -mno-knuthdiv
26126 @opindex mno-knuthdiv
26127 Make the result of a division yielding a remainder have the same sign as
26128 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
26129 remainder follows the sign of the dividend. Both methods are
26130 arithmetically valid, the latter being almost exclusively used.
26132 @item -mtoplevel-symbols
26133 @itemx -mno-toplevel-symbols
26134 @opindex mtoplevel-symbols
26135 @opindex mno-toplevel-symbols
26136 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
26137 code can be used with the @code{PREFIX} assembly directive.
26141 Generate an executable in the ELF format, rather than the default
26142 @samp{mmo} format used by the @command{mmix} simulator.
26144 @item -mbranch-predict
26145 @itemx -mno-branch-predict
26146 @opindex mbranch-predict
26147 @opindex mno-branch-predict
26148 Use (do not use) the probable-branch instructions, when static branch
26149 prediction indicates a probable branch.
26151 @item -mbase-addresses
26152 @itemx -mno-base-addresses
26153 @opindex mbase-addresses
26154 @opindex mno-base-addresses
26155 Generate (do not generate) code that uses @emph{base addresses}. Using a
26156 base address automatically generates a request (handled by the assembler
26157 and the linker) for a constant to be set up in a global register. The
26158 register is used for one or more base address requests within the range 0
26159 to 255 from the value held in the register. The generally leads to short
26160 and fast code, but the number of different data items that can be
26161 addressed is limited. This means that a program that uses lots of static
26162 data may require @option{-mno-base-addresses}.
26164 @item -msingle-exit
26165 @itemx -mno-single-exit
26166 @opindex msingle-exit
26167 @opindex mno-single-exit
26168 Force (do not force) generated code to have a single exit point in each
26172 @node MN10300 Options
26173 @subsection MN10300 Options
26174 @cindex MN10300 options
26176 These @option{-m} options are defined for Matsushita MN10300 architectures:
26181 Generate code to avoid bugs in the multiply instructions for the MN10300
26182 processors. This is the default.
26184 @item -mno-mult-bug
26185 @opindex mno-mult-bug
26186 Do not generate code to avoid bugs in the multiply instructions for the
26187 MN10300 processors.
26191 Generate code using features specific to the AM33 processor.
26195 Do not generate code using features specific to the AM33 processor. This
26200 Generate code using features specific to the AM33/2.0 processor.
26204 Generate code using features specific to the AM34 processor.
26206 @item -mtune=@var{cpu-type}
26208 Use the timing characteristics of the indicated CPU type when
26209 scheduling instructions. This does not change the targeted processor
26210 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
26211 @samp{am33-2} or @samp{am34}.
26213 @item -mreturn-pointer-on-d0
26214 @opindex mreturn-pointer-on-d0
26215 When generating a function that returns a pointer, return the pointer
26216 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
26217 only in @code{a0}, and attempts to call such functions without a prototype
26218 result in errors. Note that this option is on by default; use
26219 @option{-mno-return-pointer-on-d0} to disable it.
26223 Do not link in the C run-time initialization object file.
26227 Indicate to the linker that it should perform a relaxation optimization pass
26228 to shorten branches, calls and absolute memory addresses. This option only
26229 has an effect when used on the command line for the final link step.
26231 This option makes symbolic debugging impossible.
26235 Allow the compiler to generate @emph{Long Instruction Word}
26236 instructions if the target is the @samp{AM33} or later. This is the
26237 default. This option defines the preprocessor macro @code{__LIW__}.
26241 Do not allow the compiler to generate @emph{Long Instruction Word}
26242 instructions. This option defines the preprocessor macro
26247 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
26248 instructions if the target is the @samp{AM33} or later. This is the
26249 default. This option defines the preprocessor macro @code{__SETLB__}.
26253 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
26254 instructions. This option defines the preprocessor macro
26255 @code{__NO_SETLB__}.
26259 @node Moxie Options
26260 @subsection Moxie Options
26261 @cindex Moxie Options
26267 Generate big-endian code. This is the default for @samp{moxie-*-*}
26272 Generate little-endian code.
26276 Generate mul.x and umul.x instructions. This is the default for
26277 @samp{moxiebox-*-*} configurations.
26281 Do not link in the C run-time initialization object file.
26285 @node MSP430 Options
26286 @subsection MSP430 Options
26287 @cindex MSP430 Options
26289 These options are defined for the MSP430:
26295 Force assembly output to always use hex constants. Normally such
26296 constants are signed decimals, but this option is available for
26297 testsuite and/or aesthetic purposes.
26301 Select the MCU to target. This is used to create a C preprocessor
26302 symbol based upon the MCU name, converted to upper case and pre- and
26303 post-fixed with @samp{__}. This in turn is used by the
26304 @file{msp430.h} header file to select an MCU-specific supplementary
26307 The option also sets the ISA to use. If the MCU name is one that is
26308 known to only support the 430 ISA then that is selected, otherwise the
26309 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
26310 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
26311 name selects the 430X ISA.
26313 In addition an MCU-specific linker script is added to the linker
26314 command line. The script's name is the name of the MCU with
26315 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
26316 command line defines the C preprocessor symbol @code{__XXX__} and
26317 cause the linker to search for a script called @file{xxx.ld}.
26319 The ISA and hardware multiply supported for the different MCUs is hard-coded
26320 into GCC. However, an external @samp{devices.csv} file can be used to
26321 extend device support beyond those that have been hard-coded.
26323 GCC searches for the @samp{devices.csv} file using the following methods in the
26324 given precedence order, where the first method takes precendence over the
26325 second which takes precedence over the third.
26328 @item Include path specified with @code{-I} and @code{-L}
26329 @samp{devices.csv} will be searched for in each of the directories specified by
26330 include paths and linker library search paths.
26331 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
26332 Define the value of the global environment variable
26333 @samp{MSP430_GCC_INCLUDE_DIR}
26334 to the full path to the directory containing devices.csv, and GCC will search
26335 this directory for devices.csv. If devices.csv is found, this directory will
26336 also be registered as an include path, and linker library path. Header files
26337 and linker scripts in this directory can therefore be used without manually
26338 specifying @code{-I} and @code{-L} on the command line.
26339 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
26340 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
26341 toolchain root directory. This directory does not exist in a default
26342 installation, but if the user has created it and copied @samp{devices.csv}
26343 there, then the MCU data will be read. As above, this directory will
26344 also be registered as an include path, and linker library path.
26347 If none of the above search methods find @samp{devices.csv}, then the
26348 hard-coded MCU data is used.
26352 @itemx -mno-warn-mcu
26354 @opindex mno-warn-mcu
26355 This option enables or disables warnings about conflicts between the
26356 MCU name specified by the @option{-mmcu} option and the ISA set by the
26357 @option{-mcpu} option and/or the hardware multiply support set by the
26358 @option{-mhwmult} option. It also toggles warnings about unrecognized
26359 MCU names. This option is on by default.
26363 Specifies the ISA to use. Accepted values are @samp{msp430},
26364 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
26365 @option{-mmcu=} option should be used to select the ISA.
26369 Link to the simulator runtime libraries and linker script. Overrides
26370 any scripts that would be selected by the @option{-mmcu=} option.
26374 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
26378 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
26382 This option is passed to the assembler and linker, and allows the
26383 linker to perform certain optimizations that cannot be done until
26388 Describes the type of hardware multiply supported by the target.
26389 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
26390 for the original 16-bit-only multiply supported by early MCUs.
26391 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
26392 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
26393 A value of @samp{auto} can also be given. This tells GCC to deduce
26394 the hardware multiply support based upon the MCU name provided by the
26395 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
26396 the MCU name is not recognized then no hardware multiply support is
26397 assumed. @code{auto} is the default setting.
26399 Hardware multiplies are normally performed by calling a library
26400 routine. This saves space in the generated code. When compiling at
26401 @option{-O3} or higher however the hardware multiplier is invoked
26402 inline. This makes for bigger, but faster code.
26404 The hardware multiply routines disable interrupts whilst running and
26405 restore the previous interrupt state when they finish. This makes
26406 them safe to use inside interrupt handlers as well as in normal code.
26410 Enable the use of a minimum runtime environment - no static
26411 initializers or constructors. This is intended for memory-constrained
26412 devices. The compiler includes special symbols in some objects
26413 that tell the linker and runtime which code fragments are required.
26415 @item -mtiny-printf
26416 @opindex mtiny-printf
26417 Enable reduced code size @code{printf} and @code{puts} library functions.
26418 The @samp{tiny} implementations of these functions are not reentrant, so
26419 must be used with caution in multi-threaded applications.
26421 Support for streams has been removed and the string to be printed will
26422 always be sent to stdout via the @code{write} syscall. The string is not
26423 buffered before it is sent to write.
26425 This option requires Newlib Nano IO, so GCC must be configured with
26426 @samp{--enable-newlib-nano-formatted-io}.
26428 @item -mmax-inline-shift=
26429 @opindex mmax-inline-shift=
26430 This option takes an integer between 0 and 64 inclusive, and sets
26431 the maximum number of inline shift instructions which should be emitted to
26432 perform a shift operation by a constant amount. When this value needs to be
26433 exceeded, an mspabi helper function is used instead. The default value is 4.
26435 This only affects cases where a shift by multiple positions cannot be
26436 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
26438 Shifts of a 32-bit value are at least twice as costly, so the value passed for
26439 this option is divided by 2 and the resulting value used instead.
26441 @item -mcode-region=
26442 @itemx -mdata-region=
26443 @opindex mcode-region
26444 @opindex mdata-region
26445 These options tell the compiler where to place functions and data that
26446 do not have one of the @code{lower}, @code{upper}, @code{either} or
26447 @code{section} attributes. Possible values are @code{lower},
26448 @code{upper}, @code{either} or @code{any}. The first three behave
26449 like the corresponding attribute. The fourth possible value -
26450 @code{any} - is the default. It leaves placement entirely up to the
26451 linker script and how it assigns the standard sections
26452 (@code{.text}, @code{.data}, etc) to the memory regions.
26454 @item -msilicon-errata=
26455 @opindex msilicon-errata
26456 This option passes on a request to assembler to enable the fixes for
26457 the named silicon errata.
26459 @item -msilicon-errata-warn=
26460 @opindex msilicon-errata-warn
26461 This option passes on a request to the assembler to enable warning
26462 messages when a silicon errata might need to be applied.
26464 @item -mwarn-devices-csv
26465 @itemx -mno-warn-devices-csv
26466 @opindex mwarn-devices-csv
26467 @opindex mno-warn-devices-csv
26468 Warn if @samp{devices.csv} is not found or there are problem parsing it
26473 @node NDS32 Options
26474 @subsection NDS32 Options
26475 @cindex NDS32 Options
26477 These options are defined for NDS32 implementations:
26482 @opindex mbig-endian
26483 Generate code in big-endian mode.
26485 @item -mlittle-endian
26486 @opindex mlittle-endian
26487 Generate code in little-endian mode.
26489 @item -mreduced-regs
26490 @opindex mreduced-regs
26491 Use reduced-set registers for register allocation.
26494 @opindex mfull-regs
26495 Use full-set registers for register allocation.
26499 Generate conditional move instructions.
26503 Do not generate conditional move instructions.
26507 Generate performance extension instructions.
26509 @item -mno-ext-perf
26510 @opindex mno-ext-perf
26511 Do not generate performance extension instructions.
26514 @opindex mext-perf2
26515 Generate performance extension 2 instructions.
26517 @item -mno-ext-perf2
26518 @opindex mno-ext-perf2
26519 Do not generate performance extension 2 instructions.
26522 @opindex mext-string
26523 Generate string extension instructions.
26525 @item -mno-ext-string
26526 @opindex mno-ext-string
26527 Do not generate string extension instructions.
26531 Generate v3 push25/pop25 instructions.
26534 @opindex mno-v3push
26535 Do not generate v3 push25/pop25 instructions.
26539 Generate 16-bit instructions.
26542 @opindex mno-16-bit
26543 Do not generate 16-bit instructions.
26545 @item -misr-vector-size=@var{num}
26546 @opindex misr-vector-size
26547 Specify the size of each interrupt vector, which must be 4 or 16.
26549 @item -mcache-block-size=@var{num}
26550 @opindex mcache-block-size
26551 Specify the size of each cache block,
26552 which must be a power of 2 between 4 and 512.
26554 @item -march=@var{arch}
26556 Specify the name of the target architecture.
26558 @item -mcmodel=@var{code-model}
26560 Set the code model to one of
26563 All the data and read-only data segments must be within 512KB addressing space.
26564 The text segment must be within 16MB addressing space.
26565 @item @samp{medium}
26566 The data segment must be within 512KB while the read-only data segment can be
26567 within 4GB addressing space. The text segment should be still within 16MB
26570 All the text and data segments can be within 4GB addressing space.
26574 @opindex mctor-dtor
26575 Enable constructor/destructor feature.
26579 Guide linker to relax instructions.
26583 @node Nios II Options
26584 @subsection Nios II Options
26585 @cindex Nios II options
26586 @cindex Altera Nios II options
26588 These are the options defined for the Altera Nios II processor.
26594 @cindex smaller data references
26595 Put global and static objects less than or equal to @var{num} bytes
26596 into the small data or BSS sections instead of the normal data or BSS
26597 sections. The default value of @var{num} is 8.
26599 @item -mgpopt=@var{option}
26604 Generate (do not generate) GP-relative accesses. The following
26605 @var{option} names are recognized:
26610 Do not generate GP-relative accesses.
26613 Generate GP-relative accesses for small data objects that are not
26614 external, weak, or uninitialized common symbols.
26615 Also use GP-relative addressing for objects that
26616 have been explicitly placed in a small data section via a @code{section}
26620 As for @samp{local}, but also generate GP-relative accesses for
26621 small data objects that are external, weak, or common. If you use this option,
26622 you must ensure that all parts of your program (including libraries) are
26623 compiled with the same @option{-G} setting.
26626 Generate GP-relative accesses for all data objects in the program. If you
26627 use this option, the entire data and BSS segments
26628 of your program must fit in 64K of memory and you must use an appropriate
26629 linker script to allocate them within the addressable range of the
26633 Generate GP-relative addresses for function pointers as well as data
26634 pointers. If you use this option, the entire text, data, and BSS segments
26635 of your program must fit in 64K of memory and you must use an appropriate
26636 linker script to allocate them within the addressable range of the
26641 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
26642 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
26644 The default is @option{-mgpopt} except when @option{-fpic} or
26645 @option{-fPIC} is specified to generate position-independent code.
26646 Note that the Nios II ABI does not permit GP-relative accesses from
26649 You may need to specify @option{-mno-gpopt} explicitly when building
26650 programs that include large amounts of small data, including large
26651 GOT data sections. In this case, the 16-bit offset for GP-relative
26652 addressing may not be large enough to allow access to the entire
26653 small data section.
26655 @item -mgprel-sec=@var{regexp}
26656 @opindex mgprel-sec
26657 This option specifies additional section names that can be accessed via
26658 GP-relative addressing. It is most useful in conjunction with
26659 @code{section} attributes on variable declarations
26660 (@pxref{Common Variable Attributes}) and a custom linker script.
26661 The @var{regexp} is a POSIX Extended Regular Expression.
26663 This option does not affect the behavior of the @option{-G} option, and
26664 the specified sections are in addition to the standard @code{.sdata}
26665 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
26667 @item -mr0rel-sec=@var{regexp}
26668 @opindex mr0rel-sec
26669 This option specifies names of sections that can be accessed via a
26670 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
26671 of the 32-bit address space. It is most useful in conjunction with
26672 @code{section} attributes on variable declarations
26673 (@pxref{Common Variable Attributes}) and a custom linker script.
26674 The @var{regexp} is a POSIX Extended Regular Expression.
26676 In contrast to the use of GP-relative addressing for small data,
26677 zero-based addressing is never generated by default and there are no
26678 conventional section names used in standard linker scripts for sections
26679 in the low or high areas of memory.
26685 Generate little-endian (default) or big-endian (experimental) code,
26688 @item -march=@var{arch}
26690 This specifies the name of the target Nios II architecture. GCC uses this
26691 name to determine what kind of instructions it can emit when generating
26692 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
26694 The preprocessor macro @code{__nios2_arch__} is available to programs,
26695 with value 1 or 2, indicating the targeted ISA level.
26697 @item -mbypass-cache
26698 @itemx -mno-bypass-cache
26699 @opindex mno-bypass-cache
26700 @opindex mbypass-cache
26701 Force all load and store instructions to always bypass cache by
26702 using I/O variants of the instructions. The default is not to
26705 @item -mno-cache-volatile
26706 @itemx -mcache-volatile
26707 @opindex mcache-volatile
26708 @opindex mno-cache-volatile
26709 Volatile memory access bypass the cache using the I/O variants of
26710 the load and store instructions. The default is not to bypass the cache.
26712 @item -mno-fast-sw-div
26713 @itemx -mfast-sw-div
26714 @opindex mno-fast-sw-div
26715 @opindex mfast-sw-div
26716 Do not use table-based fast divide for small numbers. The default
26717 is to use the fast divide at @option{-O3} and above.
26721 @itemx -mno-hw-mulx
26725 @opindex mno-hw-mul
26727 @opindex mno-hw-mulx
26729 @opindex mno-hw-div
26731 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
26732 instructions by the compiler. The default is to emit @code{mul}
26733 and not emit @code{div} and @code{mulx}.
26739 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
26740 CDX (code density) instructions. Enabling these instructions also
26741 requires @option{-march=r2}. Since these instructions are optional
26742 extensions to the R2 architecture, the default is not to emit them.
26744 @item -mcustom-@var{insn}=@var{N}
26745 @itemx -mno-custom-@var{insn}
26746 @opindex mcustom-@var{insn}
26747 @opindex mno-custom-@var{insn}
26748 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
26749 custom instruction with encoding @var{N} when generating code that uses
26750 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
26751 instruction 253 for single-precision floating-point add operations instead
26752 of the default behavior of using a library call.
26754 The following values of @var{insn} are supported. Except as otherwise
26755 noted, floating-point operations are expected to be implemented with
26756 normal IEEE 754 semantics and correspond directly to the C operators or the
26757 equivalent GCC built-in functions (@pxref{Other Builtins}).
26759 Single-precision floating point:
26762 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
26763 Binary arithmetic operations.
26769 Unary absolute value.
26771 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
26772 Comparison operations.
26774 @item @samp{fmins}, @samp{fmaxs}
26775 Floating-point minimum and maximum. These instructions are only
26776 generated if @option{-ffinite-math-only} is specified.
26778 @item @samp{fsqrts}
26779 Unary square root operation.
26781 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
26782 Floating-point trigonometric and exponential functions. These instructions
26783 are only generated if @option{-funsafe-math-optimizations} is also specified.
26787 Double-precision floating point:
26790 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
26791 Binary arithmetic operations.
26797 Unary absolute value.
26799 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
26800 Comparison operations.
26802 @item @samp{fmind}, @samp{fmaxd}
26803 Double-precision minimum and maximum. These instructions are only
26804 generated if @option{-ffinite-math-only} is specified.
26806 @item @samp{fsqrtd}
26807 Unary square root operation.
26809 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
26810 Double-precision trigonometric and exponential functions. These instructions
26811 are only generated if @option{-funsafe-math-optimizations} is also specified.
26817 @item @samp{fextsd}
26818 Conversion from single precision to double precision.
26820 @item @samp{ftruncds}
26821 Conversion from double precision to single precision.
26823 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
26824 Conversion from floating point to signed or unsigned integer types, with
26825 truncation towards zero.
26828 Conversion from single-precision floating point to signed integer,
26829 rounding to the nearest integer and ties away from zero.
26830 This corresponds to the @code{__builtin_lroundf} function when
26831 @option{-fno-math-errno} is used.
26833 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
26834 Conversion from signed or unsigned integer types to floating-point types.
26838 In addition, all of the following transfer instructions for internal
26839 registers X and Y must be provided to use any of the double-precision
26840 floating-point instructions. Custom instructions taking two
26841 double-precision source operands expect the first operand in the
26842 64-bit register X. The other operand (or only operand of a unary
26843 operation) is given to the custom arithmetic instruction with the
26844 least significant half in source register @var{src1} and the most
26845 significant half in @var{src2}. A custom instruction that returns a
26846 double-precision result returns the most significant 32 bits in the
26847 destination register and the other half in 32-bit register Y.
26848 GCC automatically generates the necessary code sequences to write
26849 register X and/or read register Y when double-precision floating-point
26850 instructions are used.
26855 Write @var{src1} into the least significant half of X and @var{src2} into
26856 the most significant half of X.
26859 Write @var{src1} into Y.
26861 @item @samp{frdxhi}, @samp{frdxlo}
26862 Read the most or least (respectively) significant half of X and store it in
26866 Read the value of Y and store it into @var{dest}.
26869 Note that you can gain more local control over generation of Nios II custom
26870 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
26871 and @code{target("no-custom-@var{insn}")} function attributes
26872 (@pxref{Function Attributes})
26873 or pragmas (@pxref{Function Specific Option Pragmas}).
26875 @item -mcustom-fpu-cfg=@var{name}
26876 @opindex mcustom-fpu-cfg
26878 This option enables a predefined, named set of custom instruction encodings
26879 (see @option{-mcustom-@var{insn}} above).
26880 Currently, the following sets are defined:
26882 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
26883 @gccoptlist{-mcustom-fmuls=252 @gol
26884 -mcustom-fadds=253 @gol
26885 -mcustom-fsubs=254 @gol
26886 -fsingle-precision-constant}
26888 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
26889 @gccoptlist{-mcustom-fmuls=252 @gol
26890 -mcustom-fadds=253 @gol
26891 -mcustom-fsubs=254 @gol
26892 -mcustom-fdivs=255 @gol
26893 -fsingle-precision-constant}
26895 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
26896 @gccoptlist{-mcustom-floatus=243 @gol
26897 -mcustom-fixsi=244 @gol
26898 -mcustom-floatis=245 @gol
26899 -mcustom-fcmpgts=246 @gol
26900 -mcustom-fcmples=249 @gol
26901 -mcustom-fcmpeqs=250 @gol
26902 -mcustom-fcmpnes=251 @gol
26903 -mcustom-fmuls=252 @gol
26904 -mcustom-fadds=253 @gol
26905 -mcustom-fsubs=254 @gol
26906 -mcustom-fdivs=255 @gol
26907 -fsingle-precision-constant}
26909 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
26910 @gccoptlist{-mcustom-fabss=224 @gol
26911 -mcustom-fnegs=225 @gol
26912 -mcustom-fcmpnes=226 @gol
26913 -mcustom-fcmpeqs=227 @gol
26914 -mcustom-fcmpges=228 @gol
26915 -mcustom-fcmpgts=229 @gol
26916 -mcustom-fcmples=230 @gol
26917 -mcustom-fcmplts=231 @gol
26918 -mcustom-fmaxs=232 @gol
26919 -mcustom-fmins=233 @gol
26920 -mcustom-round=248 @gol
26921 -mcustom-fixsi=249 @gol
26922 -mcustom-floatis=250 @gol
26923 -mcustom-fsqrts=251 @gol
26924 -mcustom-fmuls=252 @gol
26925 -mcustom-fadds=253 @gol
26926 -mcustom-fsubs=254 @gol
26927 -mcustom-fdivs=255 @gol}
26929 Custom instruction assignments given by individual
26930 @option{-mcustom-@var{insn}=} options override those given by
26931 @option{-mcustom-fpu-cfg=}, regardless of the
26932 order of the options on the command line.
26934 Note that you can gain more local control over selection of a FPU
26935 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
26936 function attribute (@pxref{Function Attributes})
26937 or pragma (@pxref{Function Specific Option Pragmas}).
26939 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
26940 Hardware 2 Component}. Please note that the custom instructions enabled by
26941 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
26942 if @option{-ffinite-math-only} is specified. The custom instruction enabled by
26943 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
26944 specified. In contrast to the other configurations,
26945 @option{-fsingle-precision-constant} is not set.
26949 These additional @samp{-m} options are available for the Altera Nios II
26950 ELF (bare-metal) target:
26956 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
26957 startup and termination code, and is typically used in conjunction with
26958 @option{-msys-crt0=} to specify the location of the alternate startup code
26959 provided by the HAL BSP.
26963 Link with a limited version of the C library, @option{-lsmallc}, rather than
26966 @item -msys-crt0=@var{startfile}
26968 @var{startfile} is the file name of the startfile (crt0) to use
26969 when linking. This option is only useful in conjunction with @option{-mhal}.
26971 @item -msys-lib=@var{systemlib}
26973 @var{systemlib} is the library name of the library that provides
26974 low-level system calls required by the C library,
26975 e.g.@: @code{read} and @code{write}.
26976 This option is typically used to link with a library provided by a HAL BSP.
26980 @node Nvidia PTX Options
26981 @subsection Nvidia PTX Options
26982 @cindex Nvidia PTX options
26983 @cindex nvptx options
26985 These options are defined for Nvidia PTX:
26991 Ignored, but preserved for backward compatibility. Only 64-bit ABI is
26994 @item -misa=@var{ISA-string}
26996 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
26997 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
26998 @samp{sm_35}. The default ISA is sm_35.
27000 @item -mptx=@var{version-string}
27002 Generate code for given the specified PTX version (e.g.@: @samp{6.3}).
27003 Valid version strings include @samp{3.1} and @samp{6.3}. The default PTX
27007 @opindex mmainkernel
27008 Link in code for a __main kernel. This is for stand-alone instead of
27009 offloading execution.
27013 Apply partitioned execution optimizations. This is the default when any
27014 level of optimization is selected.
27017 @opindex msoft-stack
27018 Generate code that does not use @code{.local} memory
27019 directly for stack storage. Instead, a per-warp stack pointer is
27020 maintained explicitly. This enables variable-length stack allocation (with
27021 variable-length arrays or @code{alloca}), and when global memory is used for
27022 underlying storage, makes it possible to access automatic variables from other
27023 threads, or with atomic instructions. This code generation variant is used
27024 for OpenMP offloading, but the option is exposed on its own for the purpose
27025 of testing the compiler; to generate code suitable for linking into programs
27026 using OpenMP offloading, use option @option{-mgomp}.
27028 @item -muniform-simt
27029 @opindex muniform-simt
27030 Switch to code generation variant that allows to execute all threads in each
27031 warp, while maintaining memory state and side effects as if only one thread
27032 in each warp was active outside of OpenMP SIMD regions. All atomic operations
27033 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
27034 current lane index equals the master lane index), and the register being
27035 assigned is copied via a shuffle instruction from the master lane. Outside of
27036 SIMD regions lane 0 is the master; inside, each thread sees itself as the
27037 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
27038 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
27039 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
27040 with current lane index to compute the master lane index.
27044 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
27045 @option{-muniform-simt} options, and selects corresponding multilib variant.
27049 @node OpenRISC Options
27050 @subsection OpenRISC Options
27051 @cindex OpenRISC Options
27053 These options are defined for OpenRISC:
27057 @item -mboard=@var{name}
27059 Configure a board specific runtime. This will be passed to the linker for
27060 newlib board library linking. The default is @code{or1ksim}.
27064 This option is ignored; it is for compatibility purposes only. This used to
27065 select linker and preprocessor options for use with newlib.
27071 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
27072 This default is hardware divide.
27078 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
27079 This default is hardware multiply.
27082 @itemx -mhard-float
27083 @opindex msoft-float
27084 @opindex mhard-float
27085 Select software or hardware for floating point operations.
27086 The default is software.
27088 @item -mdouble-float
27089 @opindex mdouble-float
27090 When @option{-mhard-float} is selected, enables generation of double-precision
27091 floating point instructions. By default functions from @file{libgcc} are used
27092 to perform double-precision floating point operations.
27094 @item -munordered-float
27095 @opindex munordered-float
27096 When @option{-mhard-float} is selected, enables generation of unordered
27097 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
27098 functions from @file{libgcc} are used to perform unordered floating point
27099 compare and set flag operations.
27103 Enable generation of conditional move (@code{l.cmov}) instructions. By
27104 default the equivalent will be generated using set and branch.
27108 Enable generation of rotate right (@code{l.ror}) instructions. By default
27109 functions from @file{libgcc} are used to perform rotate right operations.
27113 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
27114 By default functions from @file{libgcc} are used to perform rotate right with
27115 immediate operations.
27119 Enable generation of sign extension (@code{l.ext*}) instructions. By default
27120 memory loads are used to perform sign extension.
27124 Enable generation of compare and set flag with immediate (@code{l.sf*i})
27125 instructions. By default extra instructions will be generated to store the
27126 immediate to a register first.
27130 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
27131 @code{l.slli}) instructions. By default extra instructions will be generated
27132 to store the immediate to a register first.
27134 @item -mcmodel=small
27135 @opindex mcmodel=small
27136 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
27139 @item -mcmodel=large
27140 @opindex mcmodel=large
27141 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
27146 @node PDP-11 Options
27147 @subsection PDP-11 Options
27148 @cindex PDP-11 Options
27150 These options are defined for the PDP-11:
27155 Use hardware FPP floating point. This is the default. (FIS floating
27156 point on the PDP-11/40 is not supported.) Implies -m45.
27159 @opindex msoft-float
27160 Do not use hardware floating point.
27164 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
27168 Return floating-point results in memory. This is the default.
27172 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
27176 Generate code for a PDP-11/45. This is the default.
27180 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
27186 Use 16-bit @code{int}. This is the default.
27192 Use 32-bit @code{int}.
27196 Target has split instruction and data space. Implies -m45.
27200 Use Unix assembler syntax.
27204 Use DEC assembler syntax.
27208 Use GNU assembler syntax. This is the default.
27212 Use the new LRA register allocator. By default, the old ``reload''
27216 @node picoChip Options
27217 @subsection picoChip Options
27218 @cindex picoChip options
27220 These @samp{-m} options are defined for picoChip implementations:
27224 @item -mae=@var{ae_type}
27226 Set the instruction set, register set, and instruction scheduling
27227 parameters for array element type @var{ae_type}. Supported values
27228 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
27230 @option{-mae=ANY} selects a completely generic AE type. Code
27231 generated with this option runs on any of the other AE types. The
27232 code is not as efficient as it would be if compiled for a specific
27233 AE type, and some types of operation (e.g., multiplication) do not
27234 work properly on all types of AE.
27236 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
27237 for compiled code, and is the default.
27239 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
27240 option may suffer from poor performance of byte (char) manipulation,
27241 since the DSP AE does not provide hardware support for byte load/stores.
27243 @item -msymbol-as-address
27244 Enable the compiler to directly use a symbol name as an address in a
27245 load/store instruction, without first loading it into a
27246 register. Typically, the use of this option generates larger
27247 programs, which run faster than when the option isn't used. However, the
27248 results vary from program to program, so it is left as a user option,
27249 rather than being permanently enabled.
27251 @item -mno-inefficient-warnings
27252 Disables warnings about the generation of inefficient code. These
27253 warnings can be generated, for example, when compiling code that
27254 performs byte-level memory operations on the MAC AE type. The MAC AE has
27255 no hardware support for byte-level memory operations, so all byte
27256 load/stores must be synthesized from word load/store operations. This is
27257 inefficient and a warning is generated to indicate
27258 that you should rewrite the code to avoid byte operations, or to target
27259 an AE type that has the necessary hardware support. This option disables
27264 @node PowerPC Options
27265 @subsection PowerPC Options
27266 @cindex PowerPC options
27268 These are listed under @xref{RS/6000 and PowerPC Options}.
27271 @subsection PRU Options
27272 @cindex PRU Options
27274 These command-line options are defined for PRU target:
27279 Link with a minimum runtime environment, with no support for static
27280 initializers and constructors. Using this option can significantly reduce
27281 the size of the final ELF binary. Beware that the compiler could still
27282 generate code with static initializers and constructors. It is up to the
27283 programmer to ensure that the source program will not use those features.
27285 @item -mmcu=@var{mcu}
27287 Specify the PRU MCU variant to use. Check Newlib for the exact list of
27292 Make GCC pass the @option{--no-relax} command-line option to the linker
27293 instead of the @option{--relax} option.
27297 Allow (or do not allow) GCC to use the LOOP instruction.
27299 @item -mabi=@var{variant}
27301 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
27302 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
27303 more naturally with certain GCC assumptions. These are the differences:
27306 @item Function Pointer Size
27307 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
27308 supports only 32-bit data and code pointers.
27310 @item Optional Return Value Pointer
27311 Function return values larger than 64 bits are passed by using a hidden
27312 pointer as the first argument of the function. TI ABI, though, mandates that
27313 the pointer can be NULL in case the caller is not using the returned value.
27314 GNU always passes and expects a valid return value pointer.
27318 The current @option{-mabi=ti} implementation simply raises a compile error
27319 when any of the above code constructs is detected. As a consequence
27320 the standard C library cannot be built and it is omitted when linking with
27323 Relaxation is a GNU feature and for safety reasons is disabled when using
27324 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
27325 instructions, so the GNU linker cannot adjust them when shortening adjacent
27326 LDI32 pseudo instructions.
27330 @node RISC-V Options
27331 @subsection RISC-V Options
27332 @cindex RISC-V Options
27334 These command-line options are defined for RISC-V targets:
27337 @item -mbranch-cost=@var{n}
27338 @opindex mbranch-cost
27339 Set the cost of branches to roughly @var{n} instructions.
27344 When generating PIC code, do or don't allow the use of PLTs. Ignored for
27345 non-PIC. The default is @option{-mplt}.
27347 @item -mabi=@var{ABI-string}
27349 Specify integer and floating-point calling convention. @var{ABI-string}
27350 contains two parts: the size of integer types and the registers used for
27351 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
27352 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
27353 32-bit), and that floating-point values up to 64 bits wide are passed in F
27354 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
27355 allows the compiler to generate code that uses the F and D extensions but only
27356 allows floating-point values up to 32 bits long to be passed in registers; or
27357 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
27358 passed in registers.
27360 The default for this argument is system dependent, users who want a specific
27361 calling convention should specify one explicitly. The valid calling
27362 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
27363 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
27364 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
27365 invalid because the ABI requires 64-bit values be passed in F registers, but F
27366 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
27367 only be used with the @samp{rv32e} architecture. This ABI is not well
27368 specified at present, and is subject to change.
27373 Do or don't use hardware floating-point divide and square root instructions.
27374 This requires the F or D extensions for floating-point registers. The default
27375 is to use them if the specified architecture has these instructions.
27380 Do or don't use hardware instructions for integer division. This requires the
27381 M extension. The default is to use them if the specified architecture has
27382 these instructions.
27384 @item -march=@var{ISA-string}
27386 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
27387 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
27390 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
27392 If both @option{-march} and @option{-mcpu=} are not specified, the default for
27393 this argument is system dependent, users who want a specific architecture
27394 extensions should specify one explicitly.
27396 @item -mcpu=@var{processor-string}
27398 Use architecture of and optimize the output for the given processor, specified
27399 by particular CPU name.
27400 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
27401 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
27402 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
27403 @samp{sifive-u54}, and @samp{sifive-u74}.
27405 @item -mtune=@var{processor-string}
27407 Optimize the output for the given processor, specified by microarchitecture or
27408 particular CPU name. Permissible values for this option are: @samp{rocket},
27409 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
27410 @samp{size}, and all valid options for @option{-mcpu=}.
27412 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
27413 the default is @samp{rocket} if both are not specified.
27415 The @samp{size} choice is not intended for use by end-users. This is used
27416 when @option{-Os} is specified. It overrides the instruction cost info
27417 provided by @option{-mtune=}, but does not override the pipeline info. This
27418 helps reduce code size while still giving good performance.
27420 @item -mpreferred-stack-boundary=@var{num}
27421 @opindex mpreferred-stack-boundary
27422 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27423 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27424 the default is 4 (16 bytes or 128-bits).
27426 @strong{Warning:} If you use this switch, then you must build all modules with
27427 the same value, including any libraries. This includes the system libraries
27428 and startup modules.
27430 @item -msmall-data-limit=@var{n}
27431 @opindex msmall-data-limit
27432 Put global and static data smaller than @var{n} bytes into a special section
27435 @item -msave-restore
27436 @itemx -mno-save-restore
27437 @opindex msave-restore
27438 Do or don't use smaller but slower prologue and epilogue code that uses
27439 library function calls. The default is to use fast inline prologues and
27442 @item -mshorten-memrefs
27443 @itemx -mno-shorten-memrefs
27444 @opindex mshorten-memrefs
27445 Do or do not attempt to make more use of compressed load/store instructions by
27446 replacing a load/store of 'base register + large offset' with a new load/store
27447 of 'new base + small offset'. If the new base gets stored in a compressed
27448 register, then the new load/store can be compressed. Currently targets 32-bit
27449 integer load/stores only.
27451 @item -mstrict-align
27452 @itemx -mno-strict-align
27453 @opindex mstrict-align
27454 Do not or do generate unaligned memory accesses. The default is set depending
27455 on whether the processor we are optimizing for supports fast unaligned access
27458 @item -mcmodel=medlow
27459 @opindex mcmodel=medlow
27460 Generate code for the medium-low code model. The program and its statically
27461 defined symbols must lie within a single 2 GiB address range and must lie
27462 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
27463 statically or dynamically linked. This is the default code model.
27465 @item -mcmodel=medany
27466 @opindex mcmodel=medany
27467 Generate code for the medium-any code model. The program and its statically
27468 defined symbols must be within any single 2 GiB address range. Programs can be
27469 statically or dynamically linked.
27471 @item -mexplicit-relocs
27472 @itemx -mno-exlicit-relocs
27473 Use or do not use assembler relocation operators when dealing with symbolic
27474 addresses. The alternative is to use assembler macros instead, which may
27475 limit optimization.
27479 Take advantage of linker relaxations to reduce the number of instructions
27480 required to materialize symbol addresses. The default is to take advantage of
27481 linker relaxations.
27483 @item -memit-attribute
27484 @itemx -mno-emit-attribute
27485 Emit (do not emit) RISC-V attribute to record extra information into ELF
27486 objects. This feature requires at least binutils 2.32.
27488 @item -malign-data=@var{type}
27489 @opindex malign-data
27490 Control how GCC aligns variables and constants of array, structure, or union
27491 types. Supported values for @var{type} are @samp{xlen} which uses x register
27492 width as the alignment value, and @samp{natural} which uses natural alignment.
27493 @samp{xlen} is the default.
27496 @opindex mbig-endian
27497 Generate big-endian code. This is the default when GCC is configured for a
27498 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
27500 @item -mlittle-endian
27501 @opindex mlittle-endian
27502 Generate little-endian code. This is the default when GCC is configured for a
27503 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
27504 @samp{riscv32be-*-*} target.
27506 @item -mstack-protector-guard=@var{guard}
27507 @itemx -mstack-protector-guard-reg=@var{reg}
27508 @itemx -mstack-protector-guard-offset=@var{offset}
27509 @opindex mstack-protector-guard
27510 @opindex mstack-protector-guard-reg
27511 @opindex mstack-protector-guard-offset
27512 Generate stack protection code using canary at @var{guard}. Supported
27513 locations are @samp{global} for a global canary or @samp{tls} for per-thread
27514 canary in the TLS block.
27516 With the latter choice the options
27517 @option{-mstack-protector-guard-reg=@var{reg}} and
27518 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27519 which register to use as base register for reading the canary,
27520 and from what offset from that base register. There is no default
27521 register or offset as this is entirely for use within the Linux
27526 @subsection RL78 Options
27527 @cindex RL78 Options
27533 Links in additional target libraries to support operation within a
27542 Specifies the type of hardware multiplication and division support to
27543 be used. The simplest is @code{none}, which uses software for both
27544 multiplication and division. This is the default. The @code{g13}
27545 value is for the hardware multiply/divide peripheral found on the
27546 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
27547 the multiplication and division instructions supported by the RL78/G14
27548 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
27549 the value @code{mg10} is an alias for @code{none}.
27551 In addition a C preprocessor macro is defined, based upon the setting
27552 of this option. Possible values are: @code{__RL78_MUL_NONE__},
27553 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
27560 Specifies the RL78 core to target. The default is the G14 core, also
27561 known as an S3 core or just RL78. The G13 or S2 core does not have
27562 multiply or divide instructions, instead it uses a hardware peripheral
27563 for these operations. The G10 or S1 core does not have register
27564 banks, so it uses a different calling convention.
27566 If this option is set it also selects the type of hardware multiply
27567 support to use, unless this is overridden by an explicit
27568 @option{-mmul=none} option on the command line. Thus specifying
27569 @option{-mcpu=g13} enables the use of the G13 hardware multiply
27570 peripheral and specifying @option{-mcpu=g10} disables the use of
27571 hardware multiplications altogether.
27573 Note, although the RL78/G14 core is the default target, specifying
27574 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
27575 change the behavior of the toolchain since it also enables G14
27576 hardware multiply support. If these options are not specified on the
27577 command line then software multiplication routines will be used even
27578 though the code targets the RL78 core. This is for backwards
27579 compatibility with older toolchains which did not have hardware
27580 multiply and divide support.
27582 In addition a C preprocessor macro is defined, based upon the setting
27583 of this option. Possible values are: @code{__RL78_G10__},
27584 @code{__RL78_G13__} or @code{__RL78_G14__}.
27594 These are aliases for the corresponding @option{-mcpu=} option. They
27595 are provided for backwards compatibility.
27599 Allow the compiler to use all of the available registers. By default
27600 registers @code{r24..r31} are reserved for use in interrupt handlers.
27601 With this option enabled these registers can be used in ordinary
27604 @item -m64bit-doubles
27605 @itemx -m32bit-doubles
27606 @opindex m64bit-doubles
27607 @opindex m32bit-doubles
27608 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
27609 or 32 bits (@option{-m32bit-doubles}) in size. The default is
27610 @option{-m32bit-doubles}.
27612 @item -msave-mduc-in-interrupts
27613 @itemx -mno-save-mduc-in-interrupts
27614 @opindex msave-mduc-in-interrupts
27615 @opindex mno-save-mduc-in-interrupts
27616 Specifies that interrupt handler functions should preserve the
27617 MDUC registers. This is only necessary if normal code might use
27618 the MDUC registers, for example because it performs multiplication
27619 and division operations. The default is to ignore the MDUC registers
27620 as this makes the interrupt handlers faster. The target option -mg13
27621 needs to be passed for this to work as this feature is only available
27622 on the G13 target (S2 core). The MDUC registers will only be saved
27623 if the interrupt handler performs a multiplication or division
27624 operation or it calls another function.
27628 @node RS/6000 and PowerPC Options
27629 @subsection IBM RS/6000 and PowerPC Options
27630 @cindex RS/6000 and PowerPC Options
27631 @cindex IBM RS/6000 and PowerPC Options
27633 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
27635 @item -mpowerpc-gpopt
27636 @itemx -mno-powerpc-gpopt
27637 @itemx -mpowerpc-gfxopt
27638 @itemx -mno-powerpc-gfxopt
27641 @itemx -mno-powerpc64
27645 @itemx -mno-popcntb
27647 @itemx -mno-popcntd
27654 @itemx -mno-hard-dfp
27655 @opindex mpowerpc-gpopt
27656 @opindex mno-powerpc-gpopt
27657 @opindex mpowerpc-gfxopt
27658 @opindex mno-powerpc-gfxopt
27659 @opindex mpowerpc64
27660 @opindex mno-powerpc64
27664 @opindex mno-popcntb
27666 @opindex mno-popcntd
27672 @opindex mno-hard-dfp
27673 You use these options to specify which instructions are available on the
27674 processor you are using. The default value of these options is
27675 determined when configuring GCC@. Specifying the
27676 @option{-mcpu=@var{cpu_type}} overrides the specification of these
27677 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
27678 rather than the options listed above.
27680 Specifying @option{-mpowerpc-gpopt} allows
27681 GCC to use the optional PowerPC architecture instructions in the
27682 General Purpose group, including floating-point square root. Specifying
27683 @option{-mpowerpc-gfxopt} allows GCC to
27684 use the optional PowerPC architecture instructions in the Graphics
27685 group, including floating-point select.
27687 The @option{-mmfcrf} option allows GCC to generate the move from
27688 condition register field instruction implemented on the POWER4
27689 processor and other processors that support the PowerPC V2.01
27691 The @option{-mpopcntb} option allows GCC to generate the popcount and
27692 double-precision FP reciprocal estimate instruction implemented on the
27693 POWER5 processor and other processors that support the PowerPC V2.02
27695 The @option{-mpopcntd} option allows GCC to generate the popcount
27696 instruction implemented on the POWER7 processor and other processors
27697 that support the PowerPC V2.06 architecture.
27698 The @option{-mfprnd} option allows GCC to generate the FP round to
27699 integer instructions implemented on the POWER5+ processor and other
27700 processors that support the PowerPC V2.03 architecture.
27701 The @option{-mcmpb} option allows GCC to generate the compare bytes
27702 instruction implemented on the POWER6 processor and other processors
27703 that support the PowerPC V2.05 architecture.
27704 The @option{-mhard-dfp} option allows GCC to generate the decimal
27705 floating-point instructions implemented on some POWER processors.
27707 The @option{-mpowerpc64} option allows GCC to generate the additional
27708 64-bit instructions that are found in the full PowerPC64 architecture
27709 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
27710 @option{-mno-powerpc64}.
27712 @item -mcpu=@var{cpu_type}
27714 Set architecture type, register usage, and
27715 instruction scheduling parameters for machine type @var{cpu_type}.
27716 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
27717 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
27718 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
27719 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
27720 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
27721 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
27722 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
27723 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
27724 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
27725 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
27726 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
27727 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
27729 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
27730 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
27731 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
27732 architecture machine types, with an appropriate, generic processor
27733 model assumed for scheduling purposes.
27735 Specifying @samp{native} as cpu type detects and selects the
27736 architecture option that corresponds to the host processor of the
27737 system performing the compilation.
27738 @option{-mcpu=native} has no effect if GCC does not recognize the
27741 The other options specify a specific processor. Code generated under
27742 those options runs best on that processor, and may not run at all on
27745 The @option{-mcpu} options automatically enable or disable the
27748 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
27749 -mpopcntb -mpopcntd -mpowerpc64 @gol
27750 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
27751 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
27752 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
27753 -mquad-memory -mquad-memory-atomic -mfloat128 @gol
27754 -mfloat128-hardware -mprefixed -mpcrel -mmma @gol
27757 The particular options set for any particular CPU varies between
27758 compiler versions, depending on what setting seems to produce optimal
27759 code for that CPU; it doesn't necessarily reflect the actual hardware's
27760 capabilities. If you wish to set an individual option to a particular
27761 value, you may specify it after the @option{-mcpu} option, like
27762 @option{-mcpu=970 -mno-altivec}.
27764 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
27765 not enabled or disabled by the @option{-mcpu} option at present because
27766 AIX does not have full support for these options. You may still
27767 enable or disable them individually if you're sure it'll work in your
27770 @item -mtune=@var{cpu_type}
27772 Set the instruction scheduling parameters for machine type
27773 @var{cpu_type}, but do not set the architecture type or register usage,
27774 as @option{-mcpu=@var{cpu_type}} does. The same
27775 values for @var{cpu_type} are used for @option{-mtune} as for
27776 @option{-mcpu}. If both are specified, the code generated uses the
27777 architecture and registers set by @option{-mcpu}, but the
27778 scheduling parameters set by @option{-mtune}.
27780 @item -mcmodel=small
27781 @opindex mcmodel=small
27782 Generate PowerPC64 code for the small model: The TOC is limited to
27785 @item -mcmodel=medium
27786 @opindex mcmodel=medium
27787 Generate PowerPC64 code for the medium model: The TOC and other static
27788 data may be up to a total of 4G in size. This is the default for 64-bit
27791 @item -mcmodel=large
27792 @opindex mcmodel=large
27793 Generate PowerPC64 code for the large model: The TOC may be up to 4G
27794 in size. Other data and code is only limited by the 64-bit address
27798 @itemx -mno-altivec
27800 @opindex mno-altivec
27801 Generate code that uses (does not use) AltiVec instructions, and also
27802 enable the use of built-in functions that allow more direct access to
27803 the AltiVec instruction set. You may also need to set
27804 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
27807 When @option{-maltivec} is used, the element order for AltiVec intrinsics
27808 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
27809 match array element order corresponding to the endianness of the
27810 target. That is, element zero identifies the leftmost element in a
27811 vector register when targeting a big-endian platform, and identifies
27812 the rightmost element in a vector register when targeting a
27813 little-endian platform.
27818 @opindex mno-vrsave
27819 Generate VRSAVE instructions when generating AltiVec code.
27822 @opindex msecure-plt
27823 Generate code that allows @command{ld} and @command{ld.so}
27824 to build executables and shared
27825 libraries with non-executable @code{.plt} and @code{.got} sections.
27827 32-bit SYSV ABI option.
27831 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
27833 requires @code{.plt} and @code{.got}
27834 sections that are both writable and executable.
27835 This is a PowerPC 32-bit SYSV ABI option.
27841 This switch enables or disables the generation of ISEL instructions.
27847 Generate code that uses (does not use) vector/scalar (VSX)
27848 instructions, and also enable the use of built-in functions that allow
27849 more direct access to the VSX instruction set.
27854 @opindex mno-crypto
27855 Enable the use (disable) of the built-in functions that allow direct
27856 access to the cryptographic instructions that were added in version
27857 2.07 of the PowerPC ISA.
27863 Enable (disable) the use of the built-in functions that allow direct
27864 access to the Hardware Transactional Memory (HTM) instructions that
27865 were added in version 2.07 of the PowerPC ISA.
27867 @item -mpower8-fusion
27868 @itemx -mno-power8-fusion
27869 @opindex mpower8-fusion
27870 @opindex mno-power8-fusion
27871 Generate code that keeps (does not keeps) some integer operations
27872 adjacent so that the instructions can be fused together on power8 and
27875 @item -mpower8-vector
27876 @itemx -mno-power8-vector
27877 @opindex mpower8-vector
27878 @opindex mno-power8-vector
27879 Generate code that uses (does not use) the vector and scalar
27880 instructions that were added in version 2.07 of the PowerPC ISA. Also
27881 enable the use of built-in functions that allow more direct access to
27882 the vector instructions.
27884 @item -mquad-memory
27885 @itemx -mno-quad-memory
27886 @opindex mquad-memory
27887 @opindex mno-quad-memory
27888 Generate code that uses (does not use) the non-atomic quad word memory
27889 instructions. The @option{-mquad-memory} option requires use of
27892 @item -mquad-memory-atomic
27893 @itemx -mno-quad-memory-atomic
27894 @opindex mquad-memory-atomic
27895 @opindex mno-quad-memory-atomic
27896 Generate code that uses (does not use) the atomic quad word memory
27897 instructions. The @option{-mquad-memory-atomic} option requires use of
27901 @itemx -mno-float128
27903 @opindex mno-float128
27904 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
27905 and use either software emulation for IEEE 128-bit floating point or
27906 hardware instructions.
27908 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
27909 128-bit floating point support. The IEEE 128-bit floating point is only
27910 supported on Linux.
27912 The default for @option{-mfloat128} is enabled on PowerPC Linux
27913 systems using the VSX instruction set, and disabled on other systems.
27915 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
27916 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
27917 point support will also enable the generation of ISA 3.0 IEEE 128-bit
27918 floating point instructions. Otherwise, if you do not specify to
27919 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
27920 system, IEEE 128-bit floating point will be done with software
27923 @item -mfloat128-hardware
27924 @itemx -mno-float128-hardware
27925 @opindex mfloat128-hardware
27926 @opindex mno-float128-hardware
27927 Enable/disable using ISA 3.0 hardware instructions to support the
27928 @var{__float128} data type.
27930 The default for @option{-mfloat128-hardware} is enabled on PowerPC
27931 Linux systems using the ISA 3.0 instruction set, and disabled on other
27938 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
27939 targets (including GNU/Linux). The 32-bit environment sets int, long
27940 and pointer to 32 bits and generates code that runs on any PowerPC
27941 variant. The 64-bit environment sets int to 32 bits and long and
27942 pointer to 64 bits, and generates code for PowerPC64, as for
27943 @option{-mpowerpc64}.
27946 @itemx -mno-fp-in-toc
27947 @itemx -mno-sum-in-toc
27948 @itemx -mminimal-toc
27950 @opindex mno-fp-in-toc
27951 @opindex mno-sum-in-toc
27952 @opindex mminimal-toc
27953 Modify generation of the TOC (Table Of Contents), which is created for
27954 every executable file. The @option{-mfull-toc} option is selected by
27955 default. In that case, GCC allocates at least one TOC entry for
27956 each unique non-automatic variable reference in your program. GCC
27957 also places floating-point constants in the TOC@. However, only
27958 16,384 entries are available in the TOC@.
27960 If you receive a linker error message that saying you have overflowed
27961 the available TOC space, you can reduce the amount of TOC space used
27962 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
27963 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
27964 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
27965 generate code to calculate the sum of an address and a constant at
27966 run time instead of putting that sum into the TOC@. You may specify one
27967 or both of these options. Each causes GCC to produce very slightly
27968 slower and larger code at the expense of conserving TOC space.
27970 If you still run out of space in the TOC even when you specify both of
27971 these options, specify @option{-mminimal-toc} instead. This option causes
27972 GCC to make only one TOC entry for every file. When you specify this
27973 option, GCC produces code that is slower and larger but which
27974 uses extremely little TOC space. You may wish to use this option
27975 only on files that contain less frequently-executed code.
27981 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
27982 @code{long} type, and the infrastructure needed to support them.
27983 Specifying @option{-maix64} implies @option{-mpowerpc64},
27984 while @option{-maix32} disables the 64-bit ABI and
27985 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
27988 @itemx -mno-xl-compat
27989 @opindex mxl-compat
27990 @opindex mno-xl-compat
27991 Produce code that conforms more closely to IBM XL compiler semantics
27992 when using AIX-compatible ABI@. Pass floating-point arguments to
27993 prototyped functions beyond the register save area (RSA) on the stack
27994 in addition to argument FPRs. Do not assume that most significant
27995 double in 128-bit long double value is properly rounded when comparing
27996 values and converting to double. Use XL symbol names for long double
27999 The AIX calling convention was extended but not initially documented to
28000 handle an obscure K&R C case of calling a function that takes the
28001 address of its arguments with fewer arguments than declared. IBM XL
28002 compilers access floating-point arguments that do not fit in the
28003 RSA from the stack when a subroutine is compiled without
28004 optimization. Because always storing floating-point arguments on the
28005 stack is inefficient and rarely needed, this option is not enabled by
28006 default and only is necessary when calling subroutines compiled by IBM
28007 XL compilers without optimization.
28011 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
28012 application written to use message passing with special startup code to
28013 enable the application to run. The system must have PE installed in the
28014 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
28015 must be overridden with the @option{-specs=} option to specify the
28016 appropriate directory location. The Parallel Environment does not
28017 support threads, so the @option{-mpe} option and the @option{-pthread}
28018 option are incompatible.
28020 @item -malign-natural
28021 @itemx -malign-power
28022 @opindex malign-natural
28023 @opindex malign-power
28024 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
28025 @option{-malign-natural} overrides the ABI-defined alignment of larger
28026 types, such as floating-point doubles, on their natural size-based boundary.
28027 The option @option{-malign-power} instructs GCC to follow the ABI-specified
28028 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
28030 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
28034 @itemx -mhard-float
28035 @opindex msoft-float
28036 @opindex mhard-float
28037 Generate code that does not use (uses) the floating-point register set.
28038 Software floating-point emulation is provided if you use the
28039 @option{-msoft-float} option, and pass the option to GCC when linking.
28042 @itemx -mno-multiple
28044 @opindex mno-multiple
28045 Generate code that uses (does not use) the load multiple word
28046 instructions and the store multiple word instructions. These
28047 instructions are generated by default on POWER systems, and not
28048 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
28049 PowerPC systems, since those instructions do not work when the
28050 processor is in little-endian mode. The exceptions are PPC740 and
28051 PPC750 which permit these instructions in little-endian mode.
28056 @opindex mno-update
28057 Generate code that uses (does not use) the load or store instructions
28058 that update the base register to the address of the calculated memory
28059 location. These instructions are generated by default. If you use
28060 @option{-mno-update}, there is a small window between the time that the
28061 stack pointer is updated and the address of the previous frame is
28062 stored, which means code that walks the stack frame across interrupts or
28063 signals may get corrupted data.
28065 @item -mavoid-indexed-addresses
28066 @itemx -mno-avoid-indexed-addresses
28067 @opindex mavoid-indexed-addresses
28068 @opindex mno-avoid-indexed-addresses
28069 Generate code that tries to avoid (not avoid) the use of indexed load
28070 or store instructions. These instructions can incur a performance
28071 penalty on Power6 processors in certain situations, such as when
28072 stepping through large arrays that cross a 16M boundary. This option
28073 is enabled by default when targeting Power6 and disabled otherwise.
28076 @itemx -mno-fused-madd
28077 @opindex mfused-madd
28078 @opindex mno-fused-madd
28079 Generate code that uses (does not use) the floating-point multiply and
28080 accumulate instructions. These instructions are generated by default
28081 if hardware floating point is used. The machine-dependent
28082 @option{-mfused-madd} option is now mapped to the machine-independent
28083 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
28084 mapped to @option{-ffp-contract=off}.
28090 Generate code that uses (does not use) the half-word multiply and
28091 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
28092 These instructions are generated by default when targeting those
28099 Generate code that uses (does not use) the string-search @samp{dlmzb}
28100 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
28101 generated by default when targeting those processors.
28103 @item -mno-bit-align
28105 @opindex mno-bit-align
28106 @opindex mbit-align
28107 On System V.4 and embedded PowerPC systems do not (do) force structures
28108 and unions that contain bit-fields to be aligned to the base type of the
28111 For example, by default a structure containing nothing but 8
28112 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
28113 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
28114 the structure is aligned to a 1-byte boundary and is 1 byte in
28117 @item -mno-strict-align
28118 @itemx -mstrict-align
28119 @opindex mno-strict-align
28120 @opindex mstrict-align
28121 On System V.4 and embedded PowerPC systems do not (do) assume that
28122 unaligned memory references are handled by the system.
28124 @item -mrelocatable
28125 @itemx -mno-relocatable
28126 @opindex mrelocatable
28127 @opindex mno-relocatable
28128 Generate code that allows (does not allow) a static executable to be
28129 relocated to a different address at run time. A simple embedded
28130 PowerPC system loader should relocate the entire contents of
28131 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
28132 a table of 32-bit addresses generated by this option. For this to
28133 work, all objects linked together must be compiled with
28134 @option{-mrelocatable} or @option{-mrelocatable-lib}.
28135 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
28137 @item -mrelocatable-lib
28138 @itemx -mno-relocatable-lib
28139 @opindex mrelocatable-lib
28140 @opindex mno-relocatable-lib
28141 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
28142 @code{.fixup} section to allow static executables to be relocated at
28143 run time, but @option{-mrelocatable-lib} does not use the smaller stack
28144 alignment of @option{-mrelocatable}. Objects compiled with
28145 @option{-mrelocatable-lib} may be linked with objects compiled with
28146 any combination of the @option{-mrelocatable} options.
28152 On System V.4 and embedded PowerPC systems do not (do) assume that
28153 register 2 contains a pointer to a global area pointing to the addresses
28154 used in the program.
28157 @itemx -mlittle-endian
28159 @opindex mlittle-endian
28160 On System V.4 and embedded PowerPC systems compile code for the
28161 processor in little-endian mode. The @option{-mlittle-endian} option is
28162 the same as @option{-mlittle}.
28165 @itemx -mbig-endian
28167 @opindex mbig-endian
28168 On System V.4 and embedded PowerPC systems compile code for the
28169 processor in big-endian mode. The @option{-mbig-endian} option is
28170 the same as @option{-mbig}.
28172 @item -mdynamic-no-pic
28173 @opindex mdynamic-no-pic
28174 On Darwin and Mac OS X systems, compile code so that it is not
28175 relocatable, but that its external references are relocatable. The
28176 resulting code is suitable for applications, but not shared
28179 @item -msingle-pic-base
28180 @opindex msingle-pic-base
28181 Treat the register used for PIC addressing as read-only, rather than
28182 loading it in the prologue for each function. The runtime system is
28183 responsible for initializing this register with an appropriate value
28184 before execution begins.
28186 @item -mprioritize-restricted-insns=@var{priority}
28187 @opindex mprioritize-restricted-insns
28188 This option controls the priority that is assigned to
28189 dispatch-slot restricted instructions during the second scheduling
28190 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
28191 or @samp{2} to assign no, highest, or second-highest (respectively)
28192 priority to dispatch-slot restricted
28195 @item -msched-costly-dep=@var{dependence_type}
28196 @opindex msched-costly-dep
28197 This option controls which dependences are considered costly
28198 by the target during instruction scheduling. The argument
28199 @var{dependence_type} takes one of the following values:
28203 No dependence is costly.
28206 All dependences are costly.
28208 @item @samp{true_store_to_load}
28209 A true dependence from store to load is costly.
28211 @item @samp{store_to_load}
28212 Any dependence from store to load is costly.
28215 Any dependence for which the latency is greater than or equal to
28216 @var{number} is costly.
28219 @item -minsert-sched-nops=@var{scheme}
28220 @opindex minsert-sched-nops
28221 This option controls which NOP insertion scheme is used during
28222 the second scheduling pass. The argument @var{scheme} takes one of the
28230 Pad with NOPs any dispatch group that has vacant issue slots,
28231 according to the scheduler's grouping.
28233 @item @samp{regroup_exact}
28234 Insert NOPs to force costly dependent insns into
28235 separate groups. Insert exactly as many NOPs as needed to force an insn
28236 to a new group, according to the estimated processor grouping.
28239 Insert NOPs to force costly dependent insns into
28240 separate groups. Insert @var{number} NOPs to force an insn to a new group.
28244 @opindex mcall-sysv
28245 On System V.4 and embedded PowerPC systems compile code using calling
28246 conventions that adhere to the March 1995 draft of the System V
28247 Application Binary Interface, PowerPC processor supplement. This is the
28248 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
28250 @item -mcall-sysv-eabi
28252 @opindex mcall-sysv-eabi
28253 @opindex mcall-eabi
28254 Specify both @option{-mcall-sysv} and @option{-meabi} options.
28256 @item -mcall-sysv-noeabi
28257 @opindex mcall-sysv-noeabi
28258 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
28260 @item -mcall-aixdesc
28262 On System V.4 and embedded PowerPC systems compile code for the AIX
28266 @opindex mcall-linux
28267 On System V.4 and embedded PowerPC systems compile code for the
28268 Linux-based GNU system.
28270 @item -mcall-freebsd
28271 @opindex mcall-freebsd
28272 On System V.4 and embedded PowerPC systems compile code for the
28273 FreeBSD operating system.
28275 @item -mcall-netbsd
28276 @opindex mcall-netbsd
28277 On System V.4 and embedded PowerPC systems compile code for the
28278 NetBSD operating system.
28280 @item -mcall-openbsd
28281 @opindex mcall-netbsd
28282 On System V.4 and embedded PowerPC systems compile code for the
28283 OpenBSD operating system.
28285 @item -mtraceback=@var{traceback_type}
28286 @opindex mtraceback
28287 Select the type of traceback table. Valid values for @var{traceback_type}
28288 are @samp{full}, @samp{part}, and @samp{no}.
28290 @item -maix-struct-return
28291 @opindex maix-struct-return
28292 Return all structures in memory (as specified by the AIX ABI)@.
28294 @item -msvr4-struct-return
28295 @opindex msvr4-struct-return
28296 Return structures smaller than 8 bytes in registers (as specified by the
28299 @item -mabi=@var{abi-type}
28301 Extend the current ABI with a particular extension, or remove such extension.
28302 Valid values are: @samp{altivec}, @samp{no-altivec},
28303 @samp{ibmlongdouble}, @samp{ieeelongdouble},
28304 @samp{elfv1}, @samp{elfv2},
28305 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
28307 @item -mabi=ibmlongdouble
28308 @opindex mabi=ibmlongdouble
28309 Change the current ABI to use IBM extended-precision long double.
28310 This is not likely to work if your system defaults to using IEEE
28311 extended-precision long double. If you change the long double type
28312 from IEEE extended-precision, the compiler will issue a warning unless
28313 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
28316 @item -mabi=ieeelongdouble
28317 @opindex mabi=ieeelongdouble
28318 Change the current ABI to use IEEE extended-precision long double.
28319 This is not likely to work if your system defaults to using IBM
28320 extended-precision long double. If you change the long double type
28321 from IBM extended-precision, the compiler will issue a warning unless
28322 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
28326 @opindex mabi=elfv1
28327 Change the current ABI to use the ELFv1 ABI.
28328 This is the default ABI for big-endian PowerPC 64-bit Linux.
28329 Overriding the default ABI requires special system support and is
28330 likely to fail in spectacular ways.
28333 @opindex mabi=elfv2
28334 Change the current ABI to use the ELFv2 ABI.
28335 This is the default ABI for little-endian PowerPC 64-bit Linux.
28336 Overriding the default ABI requires special system support and is
28337 likely to fail in spectacular ways.
28339 @item -mgnu-attribute
28340 @itemx -mno-gnu-attribute
28341 @opindex mgnu-attribute
28342 @opindex mno-gnu-attribute
28343 Emit .gnu_attribute assembly directives to set tag/value pairs in a
28344 .gnu.attributes section that specify ABI variations in function
28345 parameters or return values.
28348 @itemx -mno-prototype
28349 @opindex mprototype
28350 @opindex mno-prototype
28351 On System V.4 and embedded PowerPC systems assume that all calls to
28352 variable argument functions are properly prototyped. Otherwise, the
28353 compiler must insert an instruction before every non-prototyped call to
28354 set or clear bit 6 of the condition code register (@code{CR}) to
28355 indicate whether floating-point values are passed in the floating-point
28356 registers in case the function takes variable arguments. With
28357 @option{-mprototype}, only calls to prototyped variable argument functions
28358 set or clear the bit.
28362 On embedded PowerPC systems, assume that the startup module is called
28363 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
28364 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
28369 On embedded PowerPC systems, assume that the startup module is called
28370 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
28375 On embedded PowerPC systems, assume that the startup module is called
28376 @file{crt0.o} and the standard C libraries are @file{libads.a} and
28379 @item -myellowknife
28380 @opindex myellowknife
28381 On embedded PowerPC systems, assume that the startup module is called
28382 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
28387 On System V.4 and embedded PowerPC systems, specify that you are
28388 compiling for a VxWorks system.
28392 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
28393 header to indicate that @samp{eabi} extended relocations are used.
28399 On System V.4 and embedded PowerPC systems do (do not) adhere to the
28400 Embedded Applications Binary Interface (EABI), which is a set of
28401 modifications to the System V.4 specifications. Selecting @option{-meabi}
28402 means that the stack is aligned to an 8-byte boundary, a function
28403 @code{__eabi} is called from @code{main} to set up the EABI
28404 environment, and the @option{-msdata} option can use both @code{r2} and
28405 @code{r13} to point to two separate small data areas. Selecting
28406 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
28407 no EABI initialization function is called from @code{main}, and the
28408 @option{-msdata} option only uses @code{r13} to point to a single
28409 small data area. The @option{-meabi} option is on by default if you
28410 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
28413 @opindex msdata=eabi
28414 On System V.4 and embedded PowerPC systems, put small initialized
28415 @code{const} global and static data in the @code{.sdata2} section, which
28416 is pointed to by register @code{r2}. Put small initialized
28417 non-@code{const} global and static data in the @code{.sdata} section,
28418 which is pointed to by register @code{r13}. Put small uninitialized
28419 global and static data in the @code{.sbss} section, which is adjacent to
28420 the @code{.sdata} section. The @option{-msdata=eabi} option is
28421 incompatible with the @option{-mrelocatable} option. The
28422 @option{-msdata=eabi} option also sets the @option{-memb} option.
28425 @opindex msdata=sysv
28426 On System V.4 and embedded PowerPC systems, put small global and static
28427 data in the @code{.sdata} section, which is pointed to by register
28428 @code{r13}. Put small uninitialized global and static data in the
28429 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
28430 The @option{-msdata=sysv} option is incompatible with the
28431 @option{-mrelocatable} option.
28433 @item -msdata=default
28435 @opindex msdata=default
28437 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
28438 compile code the same as @option{-msdata=eabi}, otherwise compile code the
28439 same as @option{-msdata=sysv}.
28442 @opindex msdata=data
28443 On System V.4 and embedded PowerPC systems, put small global
28444 data in the @code{.sdata} section. Put small uninitialized global
28445 data in the @code{.sbss} section. Do not use register @code{r13}
28446 to address small data however. This is the default behavior unless
28447 other @option{-msdata} options are used.
28451 @opindex msdata=none
28453 On embedded PowerPC systems, put all initialized global and static data
28454 in the @code{.data} section, and all uninitialized data in the
28455 @code{.bss} section.
28457 @item -mreadonly-in-sdata
28458 @opindex mreadonly-in-sdata
28459 @opindex mno-readonly-in-sdata
28460 Put read-only objects in the @code{.sdata} section as well. This is the
28463 @item -mblock-move-inline-limit=@var{num}
28464 @opindex mblock-move-inline-limit
28465 Inline all block moves (such as calls to @code{memcpy} or structure
28466 copies) less than or equal to @var{num} bytes. The minimum value for
28467 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
28468 targets. The default value is target-specific.
28470 @item -mblock-compare-inline-limit=@var{num}
28471 @opindex mblock-compare-inline-limit
28472 Generate non-looping inline code for all block compares (such as calls
28473 to @code{memcmp} or structure compares) less than or equal to @var{num}
28474 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
28475 block compare is disabled. The default value is target-specific.
28477 @item -mblock-compare-inline-loop-limit=@var{num}
28478 @opindex mblock-compare-inline-loop-limit
28479 Generate an inline expansion using loop code for all block compares that
28480 are less than or equal to @var{num} bytes, but greater than the limit
28481 for non-loop inline block compare expansion. If the block length is not
28482 constant, at most @var{num} bytes will be compared before @code{memcmp}
28483 is called to compare the remainder of the block. The default value is
28486 @item -mstring-compare-inline-limit=@var{num}
28487 @opindex mstring-compare-inline-limit
28488 Compare at most @var{num} string bytes with inline code.
28489 If the difference or end of string is not found at the
28490 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
28491 take care of the rest of the comparison. The default is 64 bytes.
28495 @cindex smaller data references (PowerPC)
28496 @cindex .sdata/.sdata2 references (PowerPC)
28497 On embedded PowerPC systems, put global and static items less than or
28498 equal to @var{num} bytes into the small data or BSS sections instead of
28499 the normal data or BSS section. By default, @var{num} is 8. The
28500 @option{-G @var{num}} switch is also passed to the linker.
28501 All modules should be compiled with the same @option{-G @var{num}} value.
28504 @itemx -mno-regnames
28506 @opindex mno-regnames
28507 On System V.4 and embedded PowerPC systems do (do not) emit register
28508 names in the assembly language output using symbolic forms.
28511 @itemx -mno-longcall
28513 @opindex mno-longcall
28514 By default assume that all calls are far away so that a longer and more
28515 expensive calling sequence is required. This is required for calls
28516 farther than 32 megabytes (33,554,432 bytes) from the current location.
28517 A short call is generated if the compiler knows
28518 the call cannot be that far away. This setting can be overridden by
28519 the @code{shortcall} function attribute, or by @code{#pragma
28522 Some linkers are capable of detecting out-of-range calls and generating
28523 glue code on the fly. On these systems, long calls are unnecessary and
28524 generate slower code. As of this writing, the AIX linker can do this,
28525 as can the GNU linker for PowerPC/64. It is planned to add this feature
28526 to the GNU linker for 32-bit PowerPC systems as well.
28528 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
28529 GCC can generate long calls using an inline PLT call sequence (see
28530 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
28531 ELFv1 (big-endian) do not support inline PLT calls.
28533 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
28534 callee, L42}, plus a @dfn{branch island} (glue code). The two target
28535 addresses represent the callee and the branch island. The
28536 Darwin/PPC linker prefers the first address and generates a @code{bl
28537 callee} if the PPC @code{bl} instruction reaches the callee directly;
28538 otherwise, the linker generates @code{bl L42} to call the branch
28539 island. The branch island is appended to the body of the
28540 calling function; it computes the full 32-bit address of the callee
28543 On Mach-O (Darwin) systems, this option directs the compiler emit to
28544 the glue for every direct call, and the Darwin linker decides whether
28545 to use or discard it.
28547 In the future, GCC may ignore all longcall specifications
28548 when the linker is known to generate glue.
28553 @opindex mno-pltseq
28554 Implement (do not implement) -fno-plt and long calls using an inline
28555 PLT call sequence that supports lazy linking and long calls to
28556 functions in dlopen'd shared libraries. Inline PLT calls are only
28557 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
28558 linkers, and are enabled by default if the support is detected when
28559 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
28560 configured with @option{--enable-secureplt}. @option{-mpltseq} code
28561 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
28564 @item -mtls-markers
28565 @itemx -mno-tls-markers
28566 @opindex mtls-markers
28567 @opindex mno-tls-markers
28568 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
28569 specifying the function argument. The relocation allows the linker to
28570 reliably associate function call with argument setup instructions for
28571 TLS optimization, which in turn allows GCC to better schedule the
28577 This option enables use of the reciprocal estimate and
28578 reciprocal square root estimate instructions with additional
28579 Newton-Raphson steps to increase precision instead of doing a divide or
28580 square root and divide for floating-point arguments. You should use
28581 the @option{-ffast-math} option when using @option{-mrecip} (or at
28582 least @option{-funsafe-math-optimizations},
28583 @option{-ffinite-math-only}, @option{-freciprocal-math} and
28584 @option{-fno-trapping-math}). Note that while the throughput of the
28585 sequence is generally higher than the throughput of the non-reciprocal
28586 instruction, the precision of the sequence can be decreased by up to 2
28587 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
28590 @item -mrecip=@var{opt}
28591 @opindex mrecip=opt
28592 This option controls which reciprocal estimate instructions
28593 may be used. @var{opt} is a comma-separated list of options, which may
28594 be preceded by a @code{!} to invert the option:
28599 Enable all estimate instructions.
28602 Enable the default instructions, equivalent to @option{-mrecip}.
28605 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28608 Enable the reciprocal approximation instructions for both
28609 single and double precision.
28612 Enable the single-precision reciprocal approximation instructions.
28615 Enable the double-precision reciprocal approximation instructions.
28618 Enable the reciprocal square root approximation instructions for both
28619 single and double precision.
28622 Enable the single-precision reciprocal square root approximation instructions.
28625 Enable the double-precision reciprocal square root approximation instructions.
28629 So, for example, @option{-mrecip=all,!rsqrtd} enables
28630 all of the reciprocal estimate instructions, except for the
28631 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
28632 which handle the double-precision reciprocal square root calculations.
28634 @item -mrecip-precision
28635 @itemx -mno-recip-precision
28636 @opindex mrecip-precision
28637 Assume (do not assume) that the reciprocal estimate instructions
28638 provide higher-precision estimates than is mandated by the PowerPC
28639 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
28640 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
28641 The double-precision square root estimate instructions are not generated by
28642 default on low-precision machines, since they do not provide an
28643 estimate that converges after three steps.
28645 @item -mveclibabi=@var{type}
28646 @opindex mveclibabi
28647 Specifies the ABI type to use for vectorizing intrinsics using an
28648 external library. The only type supported at present is @samp{mass},
28649 which specifies to use IBM's Mathematical Acceleration Subsystem
28650 (MASS) libraries for vectorizing intrinsics using external libraries.
28651 GCC currently emits calls to @code{acosd2}, @code{acosf4},
28652 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
28653 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
28654 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
28655 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
28656 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
28657 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
28658 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
28659 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
28660 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
28661 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
28662 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
28663 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
28664 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
28665 for power7. Both @option{-ftree-vectorize} and
28666 @option{-funsafe-math-optimizations} must also be enabled. The MASS
28667 libraries must be specified at link time.
28672 Generate (do not generate) the @code{friz} instruction when the
28673 @option{-funsafe-math-optimizations} option is used to optimize
28674 rounding of floating-point values to 64-bit integer and back to floating
28675 point. The @code{friz} instruction does not return the same value if
28676 the floating-point number is too large to fit in an integer.
28678 @item -mpointers-to-nested-functions
28679 @itemx -mno-pointers-to-nested-functions
28680 @opindex mpointers-to-nested-functions
28681 Generate (do not generate) code to load up the static chain register
28682 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
28683 systems where a function pointer points to a 3-word descriptor giving
28684 the function address, TOC value to be loaded in register @code{r2}, and
28685 static chain value to be loaded in register @code{r11}. The
28686 @option{-mpointers-to-nested-functions} is on by default. You cannot
28687 call through pointers to nested functions or pointers
28688 to functions compiled in other languages that use the static chain if
28689 you use @option{-mno-pointers-to-nested-functions}.
28691 @item -msave-toc-indirect
28692 @itemx -mno-save-toc-indirect
28693 @opindex msave-toc-indirect
28694 Generate (do not generate) code to save the TOC value in the reserved
28695 stack location in the function prologue if the function calls through
28696 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
28697 saved in the prologue, it is saved just before the call through the
28698 pointer. The @option{-mno-save-toc-indirect} option is the default.
28700 @item -mcompat-align-parm
28701 @itemx -mno-compat-align-parm
28702 @opindex mcompat-align-parm
28703 Generate (do not generate) code to pass structure parameters with a
28704 maximum alignment of 64 bits, for compatibility with older versions
28707 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
28708 structure parameter on a 128-bit boundary when that structure contained
28709 a member requiring 128-bit alignment. This is corrected in more
28710 recent versions of GCC. This option may be used to generate code
28711 that is compatible with functions compiled with older versions of
28714 The @option{-mno-compat-align-parm} option is the default.
28716 @item -mstack-protector-guard=@var{guard}
28717 @itemx -mstack-protector-guard-reg=@var{reg}
28718 @itemx -mstack-protector-guard-offset=@var{offset}
28719 @itemx -mstack-protector-guard-symbol=@var{symbol}
28720 @opindex mstack-protector-guard
28721 @opindex mstack-protector-guard-reg
28722 @opindex mstack-protector-guard-offset
28723 @opindex mstack-protector-guard-symbol
28724 Generate stack protection code using canary at @var{guard}. Supported
28725 locations are @samp{global} for global canary or @samp{tls} for per-thread
28726 canary in the TLS block (the default with GNU libc version 2.4 or later).
28728 With the latter choice the options
28729 @option{-mstack-protector-guard-reg=@var{reg}} and
28730 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28731 which register to use as base register for reading the canary, and from what
28732 offset from that base register. The default for those is as specified in the
28733 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
28734 the offset with a symbol reference to a canary in the TLS block.
28740 Generate (do not generate) pc-relative addressing. The @option{-mpcrel}
28741 option requires that the medium code model (@option{-mcmodel=medium})
28742 and prefixed addressing (@option{-mprefixed}) options are enabled.
28745 @itemx -mno-prefixed
28747 @opindex mno-prefixed
28748 Generate (do not generate) addressing modes using prefixed load and
28749 store instructions. The @option{-mprefixed} option requires that
28750 the option @option{-mcpu=power10} (or later) is enabled.
28756 Generate (do not generate) the MMA instructions. The @option{-mma}
28757 option requires that the option @option{-mcpu=power10} (or later)
28760 @item -mrop-protect
28761 @itemx -mno-rop-protect
28762 @opindex mrop-protect
28763 @opindex mno-rop-protect
28764 Generate (do not generate) ROP protection instructions when the target
28765 processor supports them. Currently this option disables the shrink-wrap
28766 optimization (@option{-fshrink-wrap}).
28769 @itemx -mno-privileged
28770 @opindex mprivileged
28771 @opindex mno-privileged
28772 Generate (do not generate) code that will run in privileged state.
28774 @item -mblock-ops-unaligned-vsx
28775 @itemx -mno-block-ops-unaligned-vsx
28776 @opindex block-ops-unaligned-vsx
28777 @opindex no-block-ops-unaligned-vsx
28778 Generate (do not generate) unaligned vsx loads and stores for
28779 inline expansion of @code{memcpy} and @code{memmove}.
28783 @subsection RX Options
28786 These command-line options are defined for RX targets:
28789 @item -m64bit-doubles
28790 @itemx -m32bit-doubles
28791 @opindex m64bit-doubles
28792 @opindex m32bit-doubles
28793 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
28794 or 32 bits (@option{-m32bit-doubles}) in size. The default is
28795 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
28796 works on 32-bit values, which is why the default is
28797 @option{-m32bit-doubles}.
28803 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
28804 floating-point hardware. The default is enabled for the RX600
28805 series and disabled for the RX200 series.
28807 Floating-point instructions are only generated for 32-bit floating-point
28808 values, however, so the FPU hardware is not used for doubles if the
28809 @option{-m64bit-doubles} option is used.
28811 @emph{Note} If the @option{-fpu} option is enabled then
28812 @option{-funsafe-math-optimizations} is also enabled automatically.
28813 This is because the RX FPU instructions are themselves unsafe.
28815 @item -mcpu=@var{name}
28817 Selects the type of RX CPU to be targeted. Currently three types are
28818 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
28819 the specific @samp{RX610} CPU. The default is @samp{RX600}.
28821 The only difference between @samp{RX600} and @samp{RX610} is that the
28822 @samp{RX610} does not support the @code{MVTIPL} instruction.
28824 The @samp{RX200} series does not have a hardware floating-point unit
28825 and so @option{-nofpu} is enabled by default when this type is
28828 @item -mbig-endian-data
28829 @itemx -mlittle-endian-data
28830 @opindex mbig-endian-data
28831 @opindex mlittle-endian-data
28832 Store data (but not code) in the big-endian format. The default is
28833 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
28836 @item -msmall-data-limit=@var{N}
28837 @opindex msmall-data-limit
28838 Specifies the maximum size in bytes of global and static variables
28839 which can be placed into the small data area. Using the small data
28840 area can lead to smaller and faster code, but the size of area is
28841 limited and it is up to the programmer to ensure that the area does
28842 not overflow. Also when the small data area is used one of the RX's
28843 registers (usually @code{r13}) is reserved for use pointing to this
28844 area, so it is no longer available for use by the compiler. This
28845 could result in slower and/or larger code if variables are pushed onto
28846 the stack instead of being held in this register.
28848 Note, common variables (variables that have not been initialized) and
28849 constants are not placed into the small data area as they are assigned
28850 to other sections in the output executable.
28852 The default value is zero, which disables this feature. Note, this
28853 feature is not enabled by default with higher optimization levels
28854 (@option{-O2} etc) because of the potentially detrimental effects of
28855 reserving a register. It is up to the programmer to experiment and
28856 discover whether this feature is of benefit to their program. See the
28857 description of the @option{-mpid} option for a description of how the
28858 actual register to hold the small data area pointer is chosen.
28864 Use the simulator runtime. The default is to use the libgloss
28865 board-specific runtime.
28867 @item -mas100-syntax
28868 @itemx -mno-as100-syntax
28869 @opindex mas100-syntax
28870 @opindex mno-as100-syntax
28871 When generating assembler output use a syntax that is compatible with
28872 Renesas's AS100 assembler. This syntax can also be handled by the GAS
28873 assembler, but it has some restrictions so it is not generated by default.
28875 @item -mmax-constant-size=@var{N}
28876 @opindex mmax-constant-size
28877 Specifies the maximum size, in bytes, of a constant that can be used as
28878 an operand in a RX instruction. Although the RX instruction set does
28879 allow constants of up to 4 bytes in length to be used in instructions,
28880 a longer value equates to a longer instruction. Thus in some
28881 circumstances it can be beneficial to restrict the size of constants
28882 that are used in instructions. Constants that are too big are instead
28883 placed into a constant pool and referenced via register indirection.
28885 The value @var{N} can be between 0 and 4. A value of 0 (the default)
28886 or 4 means that constants of any size are allowed.
28890 Enable linker relaxation. Linker relaxation is a process whereby the
28891 linker attempts to reduce the size of a program by finding shorter
28892 versions of various instructions. Disabled by default.
28894 @item -mint-register=@var{N}
28895 @opindex mint-register
28896 Specify the number of registers to reserve for fast interrupt handler
28897 functions. The value @var{N} can be between 0 and 4. A value of 1
28898 means that register @code{r13} is reserved for the exclusive use
28899 of fast interrupt handlers. A value of 2 reserves @code{r13} and
28900 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
28901 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
28902 A value of 0, the default, does not reserve any registers.
28904 @item -msave-acc-in-interrupts
28905 @opindex msave-acc-in-interrupts
28906 Specifies that interrupt handler functions should preserve the
28907 accumulator register. This is only necessary if normal code might use
28908 the accumulator register, for example because it performs 64-bit
28909 multiplications. The default is to ignore the accumulator as this
28910 makes the interrupt handlers faster.
28916 Enables the generation of position independent data. When enabled any
28917 access to constant data is done via an offset from a base address
28918 held in a register. This allows the location of constant data to be
28919 determined at run time without requiring the executable to be
28920 relocated, which is a benefit to embedded applications with tight
28921 memory constraints. Data that can be modified is not affected by this
28924 Note, using this feature reserves a register, usually @code{r13}, for
28925 the constant data base address. This can result in slower and/or
28926 larger code, especially in complicated functions.
28928 The actual register chosen to hold the constant data base address
28929 depends upon whether the @option{-msmall-data-limit} and/or the
28930 @option{-mint-register} command-line options are enabled. Starting
28931 with register @code{r13} and proceeding downwards, registers are
28932 allocated first to satisfy the requirements of @option{-mint-register},
28933 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
28934 is possible for the small data area register to be @code{r8} if both
28935 @option{-mint-register=4} and @option{-mpid} are specified on the
28938 By default this feature is not enabled. The default can be restored
28939 via the @option{-mno-pid} command-line option.
28941 @item -mno-warn-multiple-fast-interrupts
28942 @itemx -mwarn-multiple-fast-interrupts
28943 @opindex mno-warn-multiple-fast-interrupts
28944 @opindex mwarn-multiple-fast-interrupts
28945 Prevents GCC from issuing a warning message if it finds more than one
28946 fast interrupt handler when it is compiling a file. The default is to
28947 issue a warning for each extra fast interrupt handler found, as the RX
28948 only supports one such interrupt.
28950 @item -mallow-string-insns
28951 @itemx -mno-allow-string-insns
28952 @opindex mallow-string-insns
28953 @opindex mno-allow-string-insns
28954 Enables or disables the use of the string manipulation instructions
28955 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
28956 @code{SWHILE} and also the @code{RMPA} instruction. These
28957 instructions may prefetch data, which is not safe to do if accessing
28958 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
28959 for more information).
28961 The default is to allow these instructions, but it is not possible for
28962 GCC to reliably detect all circumstances where a string instruction
28963 might be used to access an I/O register, so their use cannot be
28964 disabled automatically. Instead it is reliant upon the programmer to
28965 use the @option{-mno-allow-string-insns} option if their program
28966 accesses I/O space.
28968 When the instructions are enabled GCC defines the C preprocessor
28969 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
28970 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
28976 Use only (or not only) @code{JSR} instructions to access functions.
28977 This option can be used when code size exceeds the range of @code{BSR}
28978 instructions. Note that @option{-mno-jsr} does not mean to not use
28979 @code{JSR} but instead means that any type of branch may be used.
28982 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
28983 has special significance to the RX port when used with the
28984 @code{interrupt} function attribute. This attribute indicates a
28985 function intended to process fast interrupts. GCC ensures
28986 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
28987 and/or @code{r13} and only provided that the normal use of the
28988 corresponding registers have been restricted via the
28989 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
28992 @node S/390 and zSeries Options
28993 @subsection S/390 and zSeries Options
28994 @cindex S/390 and zSeries Options
28996 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
29000 @itemx -msoft-float
29001 @opindex mhard-float
29002 @opindex msoft-float
29003 Use (do not use) the hardware floating-point instructions and registers
29004 for floating-point operations. When @option{-msoft-float} is specified,
29005 functions in @file{libgcc.a} are used to perform floating-point
29006 operations. When @option{-mhard-float} is specified, the compiler
29007 generates IEEE floating-point instructions. This is the default.
29010 @itemx -mno-hard-dfp
29012 @opindex mno-hard-dfp
29013 Use (do not use) the hardware decimal-floating-point instructions for
29014 decimal-floating-point operations. When @option{-mno-hard-dfp} is
29015 specified, functions in @file{libgcc.a} are used to perform
29016 decimal-floating-point operations. When @option{-mhard-dfp} is
29017 specified, the compiler generates decimal-floating-point hardware
29018 instructions. This is the default for @option{-march=z9-ec} or higher.
29020 @item -mlong-double-64
29021 @itemx -mlong-double-128
29022 @opindex mlong-double-64
29023 @opindex mlong-double-128
29024 These switches control the size of @code{long double} type. A size
29025 of 64 bits makes the @code{long double} type equivalent to the @code{double}
29026 type. This is the default.
29029 @itemx -mno-backchain
29030 @opindex mbackchain
29031 @opindex mno-backchain
29032 Store (do not store) the address of the caller's frame as backchain pointer
29033 into the callee's stack frame.
29034 A backchain may be needed to allow debugging using tools that do not understand
29035 DWARF call frame information.
29036 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
29037 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
29038 the backchain is placed into the topmost word of the 96/160 byte register
29041 In general, code compiled with @option{-mbackchain} is call-compatible with
29042 code compiled with @option{-mno-backchain}; however, use of the backchain
29043 for debugging purposes usually requires that the whole binary is built with
29044 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
29045 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
29046 to build a linux kernel use @option{-msoft-float}.
29048 The default is to not maintain the backchain.
29050 @item -mpacked-stack
29051 @itemx -mno-packed-stack
29052 @opindex mpacked-stack
29053 @opindex mno-packed-stack
29054 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
29055 specified, the compiler uses the all fields of the 96/160 byte register save
29056 area only for their default purpose; unused fields still take up stack space.
29057 When @option{-mpacked-stack} is specified, register save slots are densely
29058 packed at the top of the register save area; unused space is reused for other
29059 purposes, allowing for more efficient use of the available stack space.
29060 However, when @option{-mbackchain} is also in effect, the topmost word of
29061 the save area is always used to store the backchain, and the return address
29062 register is always saved two words below the backchain.
29064 As long as the stack frame backchain is not used, code generated with
29065 @option{-mpacked-stack} is call-compatible with code generated with
29066 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
29067 S/390 or zSeries generated code that uses the stack frame backchain at run
29068 time, not just for debugging purposes. Such code is not call-compatible
29069 with code compiled with @option{-mpacked-stack}. Also, note that the
29070 combination of @option{-mbackchain},
29071 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
29072 to build a linux kernel use @option{-msoft-float}.
29074 The default is to not use the packed stack layout.
29077 @itemx -mno-small-exec
29078 @opindex msmall-exec
29079 @opindex mno-small-exec
29080 Generate (or do not generate) code using the @code{bras} instruction
29081 to do subroutine calls.
29082 This only works reliably if the total executable size does not
29083 exceed 64k. The default is to use the @code{basr} instruction instead,
29084 which does not have this limitation.
29090 When @option{-m31} is specified, generate code compliant to the
29091 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
29092 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
29093 particular to generate 64-bit instructions. For the @samp{s390}
29094 targets, the default is @option{-m31}, while the @samp{s390x}
29095 targets default to @option{-m64}.
29101 When @option{-mzarch} is specified, generate code using the
29102 instructions available on z/Architecture.
29103 When @option{-mesa} is specified, generate code using the
29104 instructions available on ESA/390. Note that @option{-mesa} is
29105 not possible with @option{-m64}.
29106 When generating code compliant to the GNU/Linux for S/390 ABI,
29107 the default is @option{-mesa}. When generating code compliant
29108 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
29114 The @option{-mhtm} option enables a set of builtins making use of
29115 instructions available with the transactional execution facility
29116 introduced with the IBM zEnterprise EC12 machine generation
29117 @ref{S/390 System z Built-in Functions}.
29118 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
29124 When @option{-mvx} is specified, generate code using the instructions
29125 available with the vector extension facility introduced with the IBM
29126 z13 machine generation.
29127 This option changes the ABI for some vector type values with regard to
29128 alignment and calling conventions. In case vector type values are
29129 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
29130 command will be added to mark the resulting binary with the ABI used.
29131 @option{-mvx} is enabled by default when using @option{-march=z13}.
29134 @itemx -mno-zvector
29136 @opindex mno-zvector
29137 The @option{-mzvector} option enables vector language extensions and
29138 builtins using instructions available with the vector extension
29139 facility introduced with the IBM z13 machine generation.
29140 This option adds support for @samp{vector} to be used as a keyword to
29141 define vector type variables and arguments. @samp{vector} is only
29142 available when GNU extensions are enabled. It will not be expanded
29143 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
29144 In addition to the GCC low-level builtins @option{-mzvector} enables
29145 a set of builtins added for compatibility with AltiVec-style
29146 implementations like Power and Cell. In order to make use of these
29147 builtins the header file @file{vecintrin.h} needs to be included.
29148 @option{-mzvector} is disabled by default.
29154 Generate (or do not generate) code using the @code{mvcle} instruction
29155 to perform block moves. When @option{-mno-mvcle} is specified,
29156 use a @code{mvc} loop instead. This is the default unless optimizing for
29163 Print (or do not print) additional debug information when compiling.
29164 The default is to not print debug information.
29166 @item -march=@var{cpu-type}
29168 Generate code that runs on @var{cpu-type}, which is the name of a
29169 system representing a certain processor type. Possible values for
29170 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
29171 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
29172 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
29173 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}.
29175 The default is @option{-march=z900}.
29177 Specifying @samp{native} as cpu type can be used to select the best
29178 architecture option for the host processor.
29179 @option{-march=native} has no effect if GCC does not recognize the
29182 @item -mtune=@var{cpu-type}
29184 Tune to @var{cpu-type} everything applicable about the generated code,
29185 except for the ABI and the set of available instructions.
29186 The list of @var{cpu-type} values is the same as for @option{-march}.
29187 The default is the value used for @option{-march}.
29190 @itemx -mno-tpf-trace
29191 @opindex mtpf-trace
29192 @opindex mno-tpf-trace
29193 Generate code that adds (does not add) in TPF OS specific branches to trace
29194 routines in the operating system. This option is off by default, even
29195 when compiling for the TPF OS@.
29197 @item -mtpf-trace-skip
29198 @itemx -mno-tpf-trace-skip
29199 @opindex mtpf-trace-skip
29200 @opindex mno-tpf-trace-skip
29201 Generate code that changes (does not change) the default branch
29202 targets enabled by @option{-mtpf-trace} to point to specialized trace
29203 routines providing the ability of selectively skipping function trace
29204 entries for the TPF OS. This option is off by default, even when
29205 compiling for the TPF OS and specifying @option{-mtpf-trace}.
29208 @itemx -mno-fused-madd
29209 @opindex mfused-madd
29210 @opindex mno-fused-madd
29211 Generate code that uses (does not use) the floating-point multiply and
29212 accumulate instructions. These instructions are generated by default if
29213 hardware floating point is used.
29215 @item -mwarn-framesize=@var{framesize}
29216 @opindex mwarn-framesize
29217 Emit a warning if the current function exceeds the given frame size. Because
29218 this is a compile-time check it doesn't need to be a real problem when the program
29219 runs. It is intended to identify functions that most probably cause
29220 a stack overflow. It is useful to be used in an environment with limited stack
29221 size e.g.@: the linux kernel.
29223 @item -mwarn-dynamicstack
29224 @opindex mwarn-dynamicstack
29225 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
29226 arrays. This is generally a bad idea with a limited stack size.
29228 @item -mstack-guard=@var{stack-guard}
29229 @itemx -mstack-size=@var{stack-size}
29230 @opindex mstack-guard
29231 @opindex mstack-size
29232 If these options are provided the S/390 back end emits additional instructions in
29233 the function prologue that trigger a trap if the stack size is @var{stack-guard}
29234 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
29235 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
29236 the frame size of the compiled function is chosen.
29237 These options are intended to be used to help debugging stack overflow problems.
29238 The additionally emitted code causes only little overhead and hence can also be
29239 used in production-like systems without greater performance degradation. The given
29240 values have to be exact powers of 2 and @var{stack-size} has to be greater than
29241 @var{stack-guard} without exceeding 64k.
29242 In order to be efficient the extra code makes the assumption that the stack starts
29243 at an address aligned to the value given by @var{stack-size}.
29244 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
29246 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
29248 If the hotpatch option is enabled, a ``hot-patching'' function
29249 prologue is generated for all functions in the compilation unit.
29250 The funtion label is prepended with the given number of two-byte
29251 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
29252 the label, 2 * @var{post-halfwords} bytes are appended, using the
29253 largest NOP like instructions the architecture allows (maximum
29256 If both arguments are zero, hotpatching is disabled.
29258 This option can be overridden for individual functions with the
29259 @code{hotpatch} attribute.
29262 @node Score Options
29263 @subsection Score Options
29264 @cindex Score Options
29266 These options are defined for Score implementations:
29271 Compile code for big-endian mode. This is the default.
29275 Compile code for little-endian mode.
29279 Disable generation of @code{bcnz} instructions.
29283 Enable generation of unaligned load and store instructions.
29287 Enable the use of multiply-accumulate instructions. Disabled by default.
29291 Specify the SCORE5 as the target architecture.
29295 Specify the SCORE5U of the target architecture.
29299 Specify the SCORE7 as the target architecture. This is the default.
29303 Specify the SCORE7D as the target architecture.
29307 @subsection SH Options
29309 These @samp{-m} options are defined for the SH implementations:
29314 Generate code for the SH1.
29318 Generate code for the SH2.
29321 Generate code for the SH2e.
29325 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
29326 that the floating-point unit is not used.
29328 @item -m2a-single-only
29329 @opindex m2a-single-only
29330 Generate code for the SH2a-FPU, in such a way that no double-precision
29331 floating-point operations are used.
29334 @opindex m2a-single
29335 Generate code for the SH2a-FPU assuming the floating-point unit is in
29336 single-precision mode by default.
29340 Generate code for the SH2a-FPU assuming the floating-point unit is in
29341 double-precision mode by default.
29345 Generate code for the SH3.
29349 Generate code for the SH3e.
29353 Generate code for the SH4 without a floating-point unit.
29355 @item -m4-single-only
29356 @opindex m4-single-only
29357 Generate code for the SH4 with a floating-point unit that only
29358 supports single-precision arithmetic.
29362 Generate code for the SH4 assuming the floating-point unit is in
29363 single-precision mode by default.
29367 Generate code for the SH4.
29371 Generate code for SH4-100.
29373 @item -m4-100-nofpu
29374 @opindex m4-100-nofpu
29375 Generate code for SH4-100 in such a way that the
29376 floating-point unit is not used.
29378 @item -m4-100-single
29379 @opindex m4-100-single
29380 Generate code for SH4-100 assuming the floating-point unit is in
29381 single-precision mode by default.
29383 @item -m4-100-single-only
29384 @opindex m4-100-single-only
29385 Generate code for SH4-100 in such a way that no double-precision
29386 floating-point operations are used.
29390 Generate code for SH4-200.
29392 @item -m4-200-nofpu
29393 @opindex m4-200-nofpu
29394 Generate code for SH4-200 without in such a way that the
29395 floating-point unit is not used.
29397 @item -m4-200-single
29398 @opindex m4-200-single
29399 Generate code for SH4-200 assuming the floating-point unit is in
29400 single-precision mode by default.
29402 @item -m4-200-single-only
29403 @opindex m4-200-single-only
29404 Generate code for SH4-200 in such a way that no double-precision
29405 floating-point operations are used.
29409 Generate code for SH4-300.
29411 @item -m4-300-nofpu
29412 @opindex m4-300-nofpu
29413 Generate code for SH4-300 without in such a way that the
29414 floating-point unit is not used.
29416 @item -m4-300-single
29417 @opindex m4-300-single
29418 Generate code for SH4-300 in such a way that no double-precision
29419 floating-point operations are used.
29421 @item -m4-300-single-only
29422 @opindex m4-300-single-only
29423 Generate code for SH4-300 in such a way that no double-precision
29424 floating-point operations are used.
29428 Generate code for SH4-340 (no MMU, no FPU).
29432 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
29437 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
29438 floating-point unit is not used.
29440 @item -m4a-single-only
29441 @opindex m4a-single-only
29442 Generate code for the SH4a, in such a way that no double-precision
29443 floating-point operations are used.
29446 @opindex m4a-single
29447 Generate code for the SH4a assuming the floating-point unit is in
29448 single-precision mode by default.
29452 Generate code for the SH4a.
29456 Same as @option{-m4a-nofpu}, except that it implicitly passes
29457 @option{-dsp} to the assembler. GCC doesn't generate any DSP
29458 instructions at the moment.
29462 Compile code for the processor in big-endian mode.
29466 Compile code for the processor in little-endian mode.
29470 Align doubles at 64-bit boundaries. Note that this changes the calling
29471 conventions, and thus some functions from the standard C library do
29472 not work unless you recompile it first with @option{-mdalign}.
29476 Shorten some address references at link time, when possible; uses the
29477 linker option @option{-relax}.
29481 Use 32-bit offsets in @code{switch} tables. The default is to use
29486 Enable the use of bit manipulation instructions on SH2A.
29490 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
29491 alignment constraints.
29495 Comply with the calling conventions defined by Renesas.
29498 @opindex mno-renesas
29499 Comply with the calling conventions defined for GCC before the Renesas
29500 conventions were available. This option is the default for all
29501 targets of the SH toolchain.
29504 @opindex mnomacsave
29505 Mark the @code{MAC} register as call-clobbered, even if
29506 @option{-mrenesas} is given.
29512 Control the IEEE compliance of floating-point comparisons, which affects the
29513 handling of cases where the result of a comparison is unordered. By default
29514 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
29515 enabled @option{-mno-ieee} is implicitly set, which results in faster
29516 floating-point greater-equal and less-equal comparisons. The implicit settings
29517 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
29519 @item -minline-ic_invalidate
29520 @opindex minline-ic_invalidate
29521 Inline code to invalidate instruction cache entries after setting up
29522 nested function trampolines.
29523 This option has no effect if @option{-musermode} is in effect and the selected
29524 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
29526 If the selected code generation option does not allow the use of the @code{icbi}
29527 instruction, and @option{-musermode} is not in effect, the inlined code
29528 manipulates the instruction cache address array directly with an associative
29529 write. This not only requires privileged mode at run time, but it also
29530 fails if the cache line had been mapped via the TLB and has become unmapped.
29534 Dump instruction size and location in the assembly code.
29537 @opindex mpadstruct
29538 This option is deprecated. It pads structures to multiple of 4 bytes,
29539 which is incompatible with the SH ABI@.
29541 @item -matomic-model=@var{model}
29542 @opindex matomic-model=@var{model}
29543 Sets the model of atomic operations and additional parameters as a comma
29544 separated list. For details on the atomic built-in functions see
29545 @ref{__atomic Builtins}. The following models and parameters are supported:
29550 Disable compiler generated atomic sequences and emit library calls for atomic
29551 operations. This is the default if the target is not @code{sh*-*-linux*}.
29554 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
29555 built-in functions. The generated atomic sequences require additional support
29556 from the interrupt/exception handling code of the system and are only suitable
29557 for SH3* and SH4* single-core systems. This option is enabled by default when
29558 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
29559 this option also partially utilizes the hardware atomic instructions
29560 @code{movli.l} and @code{movco.l} to create more efficient code, unless
29561 @samp{strict} is specified.
29564 Generate software atomic sequences that use a variable in the thread control
29565 block. This is a variation of the gUSA sequences which can also be used on
29566 SH1* and SH2* targets. The generated atomic sequences require additional
29567 support from the interrupt/exception handling code of the system and are only
29568 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
29569 parameter has to be specified as well.
29572 Generate software atomic sequences that temporarily disable interrupts by
29573 setting @code{SR.IMASK = 1111}. This model works only when the program runs
29574 in privileged mode and is only suitable for single-core systems. Additional
29575 support from the interrupt/exception handling code of the system is not
29576 required. This model is enabled by default when the target is
29577 @code{sh*-*-linux*} and SH1* or SH2*.
29580 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
29581 instructions only. This is only available on SH4A and is suitable for
29582 multi-core systems. Since the hardware instructions support only 32 bit atomic
29583 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
29584 Code compiled with this option is also compatible with other software
29585 atomic model interrupt/exception handling systems if executed on an SH4A
29586 system. Additional support from the interrupt/exception handling code of the
29587 system is not required for this model.
29590 This parameter specifies the offset in bytes of the variable in the thread
29591 control block structure that should be used by the generated atomic sequences
29592 when the @samp{soft-tcb} model has been selected. For other models this
29593 parameter is ignored. The specified value must be an integer multiple of four
29594 and in the range 0-1020.
29597 This parameter prevents mixed usage of multiple atomic models, even if they
29598 are compatible, and makes the compiler generate atomic sequences of the
29599 specified model only.
29605 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
29606 Notice that depending on the particular hardware and software configuration
29607 this can degrade overall performance due to the operand cache line flushes
29608 that are implied by the @code{tas.b} instruction. On multi-core SH4A
29609 processors the @code{tas.b} instruction must be used with caution since it
29610 can result in data corruption for certain cache configurations.
29613 @opindex mprefergot
29614 When generating position-independent code, emit function calls using
29615 the Global Offset Table instead of the Procedure Linkage Table.
29618 @itemx -mno-usermode
29620 @opindex mno-usermode
29621 Don't allow (allow) the compiler generating privileged mode code. Specifying
29622 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
29623 inlined code would not work in user mode. @option{-musermode} is the default
29624 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
29625 @option{-musermode} has no effect, since there is no user mode.
29627 @item -multcost=@var{number}
29628 @opindex multcost=@var{number}
29629 Set the cost to assume for a multiply insn.
29631 @item -mdiv=@var{strategy}
29632 @opindex mdiv=@var{strategy}
29633 Set the division strategy to be used for integer division operations.
29634 @var{strategy} can be one of:
29639 Calls a library function that uses the single-step division instruction
29640 @code{div1} to perform the operation. Division by zero calculates an
29641 unspecified result and does not trap. This is the default except for SH4,
29642 SH2A and SHcompact.
29645 Calls a library function that performs the operation in double precision
29646 floating point. Division by zero causes a floating-point exception. This is
29647 the default for SHcompact with FPU. Specifying this for targets that do not
29648 have a double precision FPU defaults to @code{call-div1}.
29651 Calls a library function that uses a lookup table for small divisors and
29652 the @code{div1} instruction with case distinction for larger divisors. Division
29653 by zero calculates an unspecified result and does not trap. This is the default
29654 for SH4. Specifying this for targets that do not have dynamic shift
29655 instructions defaults to @code{call-div1}.
29659 When a division strategy has not been specified the default strategy is
29660 selected based on the current target. For SH2A the default strategy is to
29661 use the @code{divs} and @code{divu} instructions instead of library function
29664 @item -maccumulate-outgoing-args
29665 @opindex maccumulate-outgoing-args
29666 Reserve space once for outgoing arguments in the function prologue rather
29667 than around each call. Generally beneficial for performance and size. Also
29668 needed for unwinding to avoid changing the stack frame around conditional code.
29670 @item -mdivsi3_libfunc=@var{name}
29671 @opindex mdivsi3_libfunc=@var{name}
29672 Set the name of the library function used for 32-bit signed division to
29674 This only affects the name used in the @samp{call} division strategies, and
29675 the compiler still expects the same sets of input/output/clobbered registers as
29676 if this option were not present.
29678 @item -mfixed-range=@var{register-range}
29679 @opindex mfixed-range
29680 Generate code treating the given register range as fixed registers.
29681 A fixed register is one that the register allocator cannot use. This is
29682 useful when compiling kernel code. A register range is specified as
29683 two registers separated by a dash. Multiple register ranges can be
29684 specified separated by a comma.
29686 @item -mbranch-cost=@var{num}
29687 @opindex mbranch-cost=@var{num}
29688 Assume @var{num} to be the cost for a branch instruction. Higher numbers
29689 make the compiler try to generate more branch-free code if possible.
29690 If not specified the value is selected depending on the processor type that
29691 is being compiled for.
29694 @itemx -mno-zdcbranch
29695 @opindex mzdcbranch
29696 @opindex mno-zdcbranch
29697 Assume (do not assume) that zero displacement conditional branch instructions
29698 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
29699 compiler prefers zero displacement branch code sequences. This is
29700 enabled by default when generating code for SH4 and SH4A. It can be explicitly
29701 disabled by specifying @option{-mno-zdcbranch}.
29703 @item -mcbranch-force-delay-slot
29704 @opindex mcbranch-force-delay-slot
29705 Force the usage of delay slots for conditional branches, which stuffs the delay
29706 slot with a @code{nop} if a suitable instruction cannot be found. By default
29707 this option is disabled. It can be enabled to work around hardware bugs as
29708 found in the original SH7055.
29711 @itemx -mno-fused-madd
29712 @opindex mfused-madd
29713 @opindex mno-fused-madd
29714 Generate code that uses (does not use) the floating-point multiply and
29715 accumulate instructions. These instructions are generated by default
29716 if hardware floating point is used. The machine-dependent
29717 @option{-mfused-madd} option is now mapped to the machine-independent
29718 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29719 mapped to @option{-ffp-contract=off}.
29725 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
29726 and cosine approximations. The option @option{-mfsca} must be used in
29727 combination with @option{-funsafe-math-optimizations}. It is enabled by default
29728 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
29729 approximations even if @option{-funsafe-math-optimizations} is in effect.
29735 Allow or disallow the compiler to emit the @code{fsrra} instruction for
29736 reciprocal square root approximations. The option @option{-mfsrra} must be used
29737 in combination with @option{-funsafe-math-optimizations} and
29738 @option{-ffinite-math-only}. It is enabled by default when generating code for
29739 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
29740 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
29743 @item -mpretend-cmove
29744 @opindex mpretend-cmove
29745 Prefer zero-displacement conditional branches for conditional move instruction
29746 patterns. This can result in faster code on the SH4 processor.
29750 Generate code using the FDPIC ABI.
29754 @node Solaris 2 Options
29755 @subsection Solaris 2 Options
29756 @cindex Solaris 2 options
29758 These @samp{-m} options are supported on Solaris 2:
29761 @item -mclear-hwcap
29762 @opindex mclear-hwcap
29763 @option{-mclear-hwcap} tells the compiler to remove the hardware
29764 capabilities generated by the Solaris assembler. This is only necessary
29765 when object files use ISA extensions not supported by the current
29766 machine, but check at runtime whether or not to use them.
29768 @item -mimpure-text
29769 @opindex mimpure-text
29770 @option{-mimpure-text}, used in addition to @option{-shared}, tells
29771 the compiler to not pass @option{-z text} to the linker when linking a
29772 shared object. Using this option, you can link position-dependent
29773 code into a shared object.
29775 @option{-mimpure-text} suppresses the ``relocations remain against
29776 allocatable but non-writable sections'' linker error message.
29777 However, the necessary relocations trigger copy-on-write, and the
29778 shared object is not actually shared across processes. Instead of
29779 using @option{-mimpure-text}, you should compile all source code with
29780 @option{-fpic} or @option{-fPIC}.
29784 These switches are supported in addition to the above on Solaris 2:
29789 This is a synonym for @option{-pthread}.
29792 @node SPARC Options
29793 @subsection SPARC Options
29794 @cindex SPARC options
29796 These @samp{-m} options are supported on the SPARC:
29799 @item -mno-app-regs
29801 @opindex mno-app-regs
29803 Specify @option{-mapp-regs} to generate output using the global registers
29804 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
29805 global register 1, each global register 2 through 4 is then treated as an
29806 allocable register that is clobbered by function calls. This is the default.
29808 To be fully SVR4 ABI-compliant at the cost of some performance loss,
29809 specify @option{-mno-app-regs}. You should compile libraries and system
29810 software with this option.
29816 With @option{-mflat}, the compiler does not generate save/restore instructions
29817 and uses a ``flat'' or single register window model. This model is compatible
29818 with the regular register window model. The local registers and the input
29819 registers (0--5) are still treated as ``call-saved'' registers and are
29820 saved on the stack as needed.
29822 With @option{-mno-flat} (the default), the compiler generates save/restore
29823 instructions (except for leaf functions). This is the normal operating mode.
29826 @itemx -mhard-float
29828 @opindex mhard-float
29829 Generate output containing floating-point instructions. This is the
29833 @itemx -msoft-float
29835 @opindex msoft-float
29836 Generate output containing library calls for floating point.
29837 @strong{Warning:} the requisite libraries are not available for all SPARC
29838 targets. Normally the facilities of the machine's usual C compiler are
29839 used, but this cannot be done directly in cross-compilation. You must make
29840 your own arrangements to provide suitable library functions for
29841 cross-compilation. The embedded targets @samp{sparc-*-aout} and
29842 @samp{sparclite-*-*} do provide software floating-point support.
29844 @option{-msoft-float} changes the calling convention in the output file;
29845 therefore, it is only useful if you compile @emph{all} of a program with
29846 this option. In particular, you need to compile @file{libgcc.a}, the
29847 library that comes with GCC, with @option{-msoft-float} in order for
29850 @item -mhard-quad-float
29851 @opindex mhard-quad-float
29852 Generate output containing quad-word (long double) floating-point
29855 @item -msoft-quad-float
29856 @opindex msoft-quad-float
29857 Generate output containing library calls for quad-word (long double)
29858 floating-point instructions. The functions called are those specified
29859 in the SPARC ABI@. This is the default.
29861 As of this writing, there are no SPARC implementations that have hardware
29862 support for the quad-word floating-point instructions. They all invoke
29863 a trap handler for one of these instructions, and then the trap handler
29864 emulates the effect of the instruction. Because of the trap handler overhead,
29865 this is much slower than calling the ABI library routines. Thus the
29866 @option{-msoft-quad-float} option is the default.
29868 @item -mno-unaligned-doubles
29869 @itemx -munaligned-doubles
29870 @opindex mno-unaligned-doubles
29871 @opindex munaligned-doubles
29872 Assume that doubles have 8-byte alignment. This is the default.
29874 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
29875 alignment only if they are contained in another type, or if they have an
29876 absolute address. Otherwise, it assumes they have 4-byte alignment.
29877 Specifying this option avoids some rare compatibility problems with code
29878 generated by other compilers. It is not the default because it results
29879 in a performance loss, especially for floating-point code.
29882 @itemx -mno-user-mode
29883 @opindex muser-mode
29884 @opindex mno-user-mode
29885 Do not generate code that can only run in supervisor mode. This is relevant
29886 only for the @code{casa} instruction emitted for the LEON3 processor. This
29889 @item -mfaster-structs
29890 @itemx -mno-faster-structs
29891 @opindex mfaster-structs
29892 @opindex mno-faster-structs
29893 With @option{-mfaster-structs}, the compiler assumes that structures
29894 should have 8-byte alignment. This enables the use of pairs of
29895 @code{ldd} and @code{std} instructions for copies in structure
29896 assignment, in place of twice as many @code{ld} and @code{st} pairs.
29897 However, the use of this changed alignment directly violates the SPARC
29898 ABI@. Thus, it's intended only for use on targets where the developer
29899 acknowledges that their resulting code is not directly in line with
29900 the rules of the ABI@.
29902 @item -mstd-struct-return
29903 @itemx -mno-std-struct-return
29904 @opindex mstd-struct-return
29905 @opindex mno-std-struct-return
29906 With @option{-mstd-struct-return}, the compiler generates checking code
29907 in functions returning structures or unions to detect size mismatches
29908 between the two sides of function calls, as per the 32-bit ABI@.
29910 The default is @option{-mno-std-struct-return}. This option has no effect
29917 Enable Local Register Allocation. This is the default for SPARC since GCC 7
29918 so @option{-mno-lra} needs to be passed to get old Reload.
29920 @item -mcpu=@var{cpu_type}
29922 Set the instruction set, register set, and instruction scheduling parameters
29923 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
29924 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
29925 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
29926 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
29927 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
29928 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
29931 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
29932 which selects the best architecture option for the host processor.
29933 @option{-mcpu=native} has no effect if GCC does not recognize
29936 Default instruction scheduling parameters are used for values that select
29937 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
29938 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
29940 Here is a list of each supported architecture and their supported
29948 supersparc, hypersparc, leon, leon3, leon5
29951 f930, f934, sparclite86x
29957 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
29961 By default (unless configured otherwise), GCC generates code for the V7
29962 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
29963 additionally optimizes it for the Cypress CY7C602 chip, as used in the
29964 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
29965 SPARCStation 1, 2, IPX etc.
29967 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
29968 architecture. The only difference from V7 code is that the compiler emits
29969 the integer multiply and integer divide instructions which exist in SPARC-V8
29970 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
29971 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
29974 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
29975 the SPARC architecture. This adds the integer multiply, integer divide step
29976 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
29977 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
29978 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
29979 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
29980 MB86934 chip, which is the more recent SPARClite with FPU@.
29982 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
29983 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
29984 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
29985 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
29986 optimizes it for the TEMIC SPARClet chip.
29988 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
29989 architecture. This adds 64-bit integer and floating-point move instructions,
29990 3 additional floating-point condition code registers and conditional move
29991 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
29992 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
29993 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
29994 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
29995 @option{-mcpu=niagara}, the compiler additionally optimizes it for
29996 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
29997 additionally optimizes it for Sun UltraSPARC T2 chips. With
29998 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
29999 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
30000 additionally optimizes it for Sun UltraSPARC T4 chips. With
30001 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
30002 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
30003 additionally optimizes it for Oracle M8 chips.
30005 @item -mtune=@var{cpu_type}
30007 Set the instruction scheduling parameters for machine type
30008 @var{cpu_type}, but do not set the instruction set or register set that the
30009 option @option{-mcpu=@var{cpu_type}} does.
30011 The same values for @option{-mcpu=@var{cpu_type}} can be used for
30012 @option{-mtune=@var{cpu_type}}, but the only useful values are those
30013 that select a particular CPU implementation. Those are
30014 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
30015 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
30016 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
30017 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
30018 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
30019 and GNU/Linux toolchains, @samp{native} can also be used.
30024 @opindex mno-v8plus
30025 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
30026 difference from the V8 ABI is that the global and out registers are
30027 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
30028 mode for all SPARC-V9 processors.
30034 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
30035 Visual Instruction Set extensions. The default is @option{-mno-vis}.
30041 With @option{-mvis2}, GCC generates code that takes advantage of
30042 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
30043 default is @option{-mvis2} when targeting a cpu that supports such
30044 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
30045 also sets @option{-mvis}.
30051 With @option{-mvis3}, GCC generates code that takes advantage of
30052 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
30053 default is @option{-mvis3} when targeting a cpu that supports such
30054 instructions, such as niagara-3 and later. Setting @option{-mvis3}
30055 also sets @option{-mvis2} and @option{-mvis}.
30061 With @option{-mvis4}, GCC generates code that takes advantage of
30062 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
30063 default is @option{-mvis4} when targeting a cpu that supports such
30064 instructions, such as niagara-7 and later. Setting @option{-mvis4}
30065 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
30071 With @option{-mvis4b}, GCC generates code that takes advantage of
30072 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
30073 the additional VIS instructions introduced in the Oracle SPARC
30074 Architecture 2017. The default is @option{-mvis4b} when targeting a
30075 cpu that supports such instructions, such as m8 and later. Setting
30076 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
30077 @option{-mvis2} and @option{-mvis}.
30082 @opindex mno-cbcond
30083 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
30084 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
30085 when targeting a CPU that supports such instructions, such as Niagara-4 and
30092 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
30093 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
30094 when targeting a CPU that supports such instructions, such as Niagara-3 and
30100 @opindex mno-fsmuld
30101 With @option{-mfsmuld}, GCC generates code that takes advantage of the
30102 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
30103 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
30104 or V9 with FPU except @option{-mcpu=leon}.
30110 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
30111 Population Count instruction. The default is @option{-mpopc}
30112 when targeting a CPU that supports such an instruction, such as Niagara-2 and
30119 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
30120 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
30121 when targeting a CPU that supports such an instruction, such as Niagara-7 and
30125 @opindex mfix-at697f
30126 Enable the documented workaround for the single erratum of the Atmel AT697F
30127 processor (which corresponds to erratum #13 of the AT697E processor).
30130 @opindex mfix-ut699
30131 Enable the documented workarounds for the floating-point errata and the data
30132 cache nullify errata of the UT699 processor.
30135 @opindex mfix-ut700
30136 Enable the documented workaround for the back-to-back store errata of
30137 the UT699E/UT700 processor.
30139 @item -mfix-gr712rc
30140 @opindex mfix-gr712rc
30141 Enable the documented workaround for the back-to-back store errata of
30142 the GR712RC processor.
30145 These @samp{-m} options are supported in addition to the above
30146 on SPARC-V9 processors in 64-bit environments:
30153 Generate code for a 32-bit or 64-bit environment.
30154 The 32-bit environment sets int, long and pointer to 32 bits.
30155 The 64-bit environment sets int to 32 bits and long and pointer
30158 @item -mcmodel=@var{which}
30160 Set the code model to one of
30164 The Medium/Low code model: 64-bit addresses, programs
30165 must be linked in the low 32 bits of memory. Programs can be statically
30166 or dynamically linked.
30169 The Medium/Middle code model: 64-bit addresses, programs
30170 must be linked in the low 44 bits of memory, the text and data segments must
30171 be less than 2GB in size and the data segment must be located within 2GB of
30175 The Medium/Anywhere code model: 64-bit addresses, programs
30176 may be linked anywhere in memory, the text and data segments must be less
30177 than 2GB in size and the data segment must be located within 2GB of the
30181 The Medium/Anywhere code model for embedded systems:
30182 64-bit addresses, the text and data segments must be less than 2GB in
30183 size, both starting anywhere in memory (determined at link time). The
30184 global register %g4 points to the base of the data segment. Programs
30185 are statically linked and PIC is not supported.
30188 @item -mmemory-model=@var{mem-model}
30189 @opindex mmemory-model
30190 Set the memory model in force on the processor to one of
30194 The default memory model for the processor and operating system.
30197 Relaxed Memory Order
30200 Partial Store Order
30206 Sequential Consistency
30209 These memory models are formally defined in Appendix D of the SPARC-V9
30210 architecture manual, as set in the processor's @code{PSTATE.MM} field.
30213 @itemx -mno-stack-bias
30214 @opindex mstack-bias
30215 @opindex mno-stack-bias
30216 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
30217 frame pointer if present, are offset by @minus{}2047 which must be added back
30218 when making stack frame references. This is the default in 64-bit mode.
30219 Otherwise, assume no such offset is present.
30222 @node System V Options
30223 @subsection Options for System V
30225 These additional options are available on System V Release 4 for
30226 compatibility with other compilers on those systems:
30231 Create a shared object.
30232 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
30236 Identify the versions of each tool used by the compiler, in a
30237 @code{.ident} assembler directive in the output.
30241 Refrain from adding @code{.ident} directives to the output file (this is
30244 @item -YP,@var{dirs}
30246 Search the directories @var{dirs}, and no others, for libraries
30247 specified with @option{-l}.
30249 @item -Ym,@var{dir}
30251 Look in the directory @var{dir} to find the M4 preprocessor.
30252 The assembler uses this option.
30253 @c This is supposed to go with a -Yd for predefined M4 macro files, but
30254 @c the generic assembler that comes with Solaris takes just -Ym.
30257 @node TILE-Gx Options
30258 @subsection TILE-Gx Options
30259 @cindex TILE-Gx options
30261 These @samp{-m} options are supported on the TILE-Gx:
30264 @item -mcmodel=small
30265 @opindex mcmodel=small
30266 Generate code for the small model. The distance for direct calls is
30267 limited to 500M in either direction. PC-relative addresses are 32
30268 bits. Absolute addresses support the full address range.
30270 @item -mcmodel=large
30271 @opindex mcmodel=large
30272 Generate code for the large model. There is no limitation on call
30273 distance, pc-relative addresses, or absolute addresses.
30275 @item -mcpu=@var{name}
30277 Selects the type of CPU to be targeted. Currently the only supported
30278 type is @samp{tilegx}.
30284 Generate code for a 32-bit or 64-bit environment. The 32-bit
30285 environment sets int, long, and pointer to 32 bits. The 64-bit
30286 environment sets int to 32 bits and long and pointer to 64 bits.
30289 @itemx -mlittle-endian
30290 @opindex mbig-endian
30291 @opindex mlittle-endian
30292 Generate code in big/little endian mode, respectively.
30295 @node TILEPro Options
30296 @subsection TILEPro Options
30297 @cindex TILEPro options
30299 These @samp{-m} options are supported on the TILEPro:
30302 @item -mcpu=@var{name}
30304 Selects the type of CPU to be targeted. Currently the only supported
30305 type is @samp{tilepro}.
30309 Generate code for a 32-bit environment, which sets int, long, and
30310 pointer to 32 bits. This is the only supported behavior so the flag
30311 is essentially ignored.
30315 @subsection V850 Options
30316 @cindex V850 Options
30318 These @samp{-m} options are defined for V850 implementations:
30322 @itemx -mno-long-calls
30323 @opindex mlong-calls
30324 @opindex mno-long-calls
30325 Treat all calls as being far away (near). If calls are assumed to be
30326 far away, the compiler always loads the function's address into a
30327 register, and calls indirect through the pointer.
30333 Do not optimize (do optimize) basic blocks that use the same index
30334 pointer 4 or more times to copy pointer into the @code{ep} register, and
30335 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
30336 option is on by default if you optimize.
30338 @item -mno-prolog-function
30339 @itemx -mprolog-function
30340 @opindex mno-prolog-function
30341 @opindex mprolog-function
30342 Do not use (do use) external functions to save and restore registers
30343 at the prologue and epilogue of a function. The external functions
30344 are slower, but use less code space if more than one function saves
30345 the same number of registers. The @option{-mprolog-function} option
30346 is on by default if you optimize.
30350 Try to make the code as small as possible. At present, this just turns
30351 on the @option{-mep} and @option{-mprolog-function} options.
30353 @item -mtda=@var{n}
30355 Put static or global variables whose size is @var{n} bytes or less into
30356 the tiny data area that register @code{ep} points to. The tiny data
30357 area can hold up to 256 bytes in total (128 bytes for byte references).
30359 @item -msda=@var{n}
30361 Put static or global variables whose size is @var{n} bytes or less into
30362 the small data area that register @code{gp} points to. The small data
30363 area can hold up to 64 kilobytes.
30365 @item -mzda=@var{n}
30367 Put static or global variables whose size is @var{n} bytes or less into
30368 the first 32 kilobytes of memory.
30372 Specify that the target processor is the V850.
30376 Specify that the target processor is the V850E3V5. The preprocessor
30377 constant @code{__v850e3v5__} is defined if this option is used.
30381 Specify that the target processor is the V850E3V5. This is an alias for
30382 the @option{-mv850e3v5} option.
30386 Specify that the target processor is the V850E2V3. The preprocessor
30387 constant @code{__v850e2v3__} is defined if this option is used.
30391 Specify that the target processor is the V850E2. The preprocessor
30392 constant @code{__v850e2__} is defined if this option is used.
30396 Specify that the target processor is the V850E1. The preprocessor
30397 constants @code{__v850e1__} and @code{__v850e__} are defined if
30398 this option is used.
30402 Specify that the target processor is the V850ES. This is an alias for
30403 the @option{-mv850e1} option.
30407 Specify that the target processor is the V850E@. The preprocessor
30408 constant @code{__v850e__} is defined if this option is used.
30410 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
30411 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
30412 are defined then a default target processor is chosen and the
30413 relevant @samp{__v850*__} preprocessor constant is defined.
30415 The preprocessor constants @code{__v850} and @code{__v851__} are always
30416 defined, regardless of which processor variant is the target.
30418 @item -mdisable-callt
30419 @itemx -mno-disable-callt
30420 @opindex mdisable-callt
30421 @opindex mno-disable-callt
30422 This option suppresses generation of the @code{CALLT} instruction for the
30423 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
30426 This option is enabled by default when the RH850 ABI is
30427 in use (see @option{-mrh850-abi}), and disabled by default when the
30428 GCC ABI is in use. If @code{CALLT} instructions are being generated
30429 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
30435 Pass on (or do not pass on) the @option{-mrelax} command-line option
30439 @itemx -mno-long-jumps
30440 @opindex mlong-jumps
30441 @opindex mno-long-jumps
30442 Disable (or re-enable) the generation of PC-relative jump instructions.
30445 @itemx -mhard-float
30446 @opindex msoft-float
30447 @opindex mhard-float
30448 Disable (or re-enable) the generation of hardware floating point
30449 instructions. This option is only significant when the target
30450 architecture is @samp{V850E2V3} or higher. If hardware floating point
30451 instructions are being generated then the C preprocessor symbol
30452 @code{__FPU_OK__} is defined, otherwise the symbol
30453 @code{__NO_FPU__} is defined.
30457 Enables the use of the e3v5 LOOP instruction. The use of this
30458 instruction is not enabled by default when the e3v5 architecture is
30459 selected because its use is still experimental.
30463 @opindex mrh850-abi
30465 Enables support for the RH850 version of the V850 ABI. This is the
30466 default. With this version of the ABI the following rules apply:
30470 Integer sized structures and unions are returned via a memory pointer
30471 rather than a register.
30474 Large structures and unions (more than 8 bytes in size) are passed by
30478 Functions are aligned to 16-bit boundaries.
30481 The @option{-m8byte-align} command-line option is supported.
30484 The @option{-mdisable-callt} command-line option is enabled by
30485 default. The @option{-mno-disable-callt} command-line option is not
30489 When this version of the ABI is enabled the C preprocessor symbol
30490 @code{__V850_RH850_ABI__} is defined.
30494 Enables support for the old GCC version of the V850 ABI. With this
30495 version of the ABI the following rules apply:
30499 Integer sized structures and unions are returned in register @code{r10}.
30502 Large structures and unions (more than 8 bytes in size) are passed by
30506 Functions are aligned to 32-bit boundaries, unless optimizing for
30510 The @option{-m8byte-align} command-line option is not supported.
30513 The @option{-mdisable-callt} command-line option is supported but not
30514 enabled by default.
30517 When this version of the ABI is enabled the C preprocessor symbol
30518 @code{__V850_GCC_ABI__} is defined.
30520 @item -m8byte-align
30521 @itemx -mno-8byte-align
30522 @opindex m8byte-align
30523 @opindex mno-8byte-align
30524 Enables support for @code{double} and @code{long long} types to be
30525 aligned on 8-byte boundaries. The default is to restrict the
30526 alignment of all objects to at most 4-bytes. When
30527 @option{-m8byte-align} is in effect the C preprocessor symbol
30528 @code{__V850_8BYTE_ALIGN__} is defined.
30531 @opindex mbig-switch
30532 Generate code suitable for big switch tables. Use this option only if
30533 the assembler/linker complain about out of range branches within a switch
30538 This option causes r2 and r5 to be used in the code generated by
30539 the compiler. This setting is the default.
30541 @item -mno-app-regs
30542 @opindex mno-app-regs
30543 This option causes r2 and r5 to be treated as fixed registers.
30548 @subsection VAX Options
30549 @cindex VAX options
30551 These @samp{-m} options are defined for the VAX:
30556 Do not output certain jump instructions (@code{aobleq} and so on)
30557 that the Unix assembler for the VAX cannot handle across long
30562 Do output those jump instructions, on the assumption that the
30563 GNU assembler is being used.
30567 Output code for G-format floating-point numbers instead of D-format.
30573 Enable Local Register Allocation. This is still experimental for the VAX,
30574 so by default the compiler uses standard reload.
30577 @node Visium Options
30578 @subsection Visium Options
30579 @cindex Visium options
30585 A program which performs file I/O and is destined to run on an MCM target
30586 should be linked with this option. It causes the libraries libc.a and
30587 libdebug.a to be linked. The program should be run on the target under
30588 the control of the GDB remote debugging stub.
30592 A program which performs file I/O and is destined to run on the simulator
30593 should be linked with option. This causes libraries libc.a and libsim.a to
30597 @itemx -mhard-float
30599 @opindex mhard-float
30600 Generate code containing floating-point instructions. This is the
30604 @itemx -msoft-float
30606 @opindex msoft-float
30607 Generate code containing library calls for floating-point.
30609 @option{-msoft-float} changes the calling convention in the output file;
30610 therefore, it is only useful if you compile @emph{all} of a program with
30611 this option. In particular, you need to compile @file{libgcc.a}, the
30612 library that comes with GCC, with @option{-msoft-float} in order for
30615 @item -mcpu=@var{cpu_type}
30617 Set the instruction set, register set, and instruction scheduling parameters
30618 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
30619 @samp{mcm}, @samp{gr5} and @samp{gr6}.
30621 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
30623 By default (unless configured otherwise), GCC generates code for the GR5
30624 variant of the Visium architecture.
30626 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
30627 architecture. The only difference from GR5 code is that the compiler will
30628 generate block move instructions.
30630 @item -mtune=@var{cpu_type}
30632 Set the instruction scheduling parameters for machine type @var{cpu_type},
30633 but do not set the instruction set or register set that the option
30634 @option{-mcpu=@var{cpu_type}} would.
30638 Generate code for the supervisor mode, where there are no restrictions on
30639 the access to general registers. This is the default.
30642 @opindex muser-mode
30643 Generate code for the user mode, where the access to some general registers
30644 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
30645 mode; on the GR6, only registers r29 to r31 are affected.
30649 @subsection VMS Options
30651 These @samp{-m} options are defined for the VMS implementations:
30654 @item -mvms-return-codes
30655 @opindex mvms-return-codes
30656 Return VMS condition codes from @code{main}. The default is to return POSIX-style
30657 condition (e.g.@: error) codes.
30659 @item -mdebug-main=@var{prefix}
30660 @opindex mdebug-main=@var{prefix}
30661 Flag the first routine whose name starts with @var{prefix} as the main
30662 routine for the debugger.
30666 Default to 64-bit memory allocation routines.
30668 @item -mpointer-size=@var{size}
30669 @opindex mpointer-size=@var{size}
30670 Set the default size of pointers. Possible options for @var{size} are
30671 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
30672 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
30673 The later option disables @code{pragma pointer_size}.
30676 @node VxWorks Options
30677 @subsection VxWorks Options
30678 @cindex VxWorks Options
30680 The options in this section are defined for all VxWorks targets.
30681 Options specific to the target hardware are listed with the other
30682 options for that target.
30687 GCC can generate code for both VxWorks kernels and real time processes
30688 (RTPs). This option switches from the former to the latter. It also
30689 defines the preprocessor macro @code{__RTP__}.
30692 @opindex non-static
30693 Link an RTP executable against shared libraries rather than static
30694 libraries. The options @option{-static} and @option{-shared} can
30695 also be used for RTPs (@pxref{Link Options}); @option{-static}
30702 These options are passed down to the linker. They are defined for
30703 compatibility with Diab.
30706 @opindex Xbind-lazy
30707 Enable lazy binding of function calls. This option is equivalent to
30708 @option{-Wl,-z,now} and is defined for compatibility with Diab.
30712 Disable lazy binding of function calls. This option is the default and
30713 is defined for compatibility with Diab.
30717 @subsection x86 Options
30718 @cindex x86 Options
30720 These @samp{-m} options are defined for the x86 family of computers.
30724 @item -march=@var{cpu-type}
30726 Generate instructions for the machine type @var{cpu-type}. In contrast to
30727 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
30728 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
30729 to generate code that may not run at all on processors other than the one
30730 indicated. Specifying @option{-march=@var{cpu-type}} implies
30731 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
30733 The choices for @var{cpu-type} are:
30737 This selects the CPU to generate code for at compilation time by determining
30738 the processor type of the compiling machine. Using @option{-march=native}
30739 enables all instruction subsets supported by the local machine (hence
30740 the result might not run on different machines). Using @option{-mtune=native}
30741 produces code optimized for the local machine under the constraints
30742 of the selected instruction set.
30745 A generic CPU with 64-bit extensions.
30750 These choices for @var{cpu-type} select the corresponding
30751 micro-architecture level from the x86-64 psABI. On ABIs other than
30752 the x86-64 psABI they select the same CPU features as the x86-64 psABI
30753 documents for the particular micro-architecture level.
30755 Since these @var{cpu-type} values do not have a corresponding
30756 @option{-mtune} setting, using @option{-march} with these values enables
30757 generic tuning. Specific tuning can be enabled using the
30758 @option{-mtune=@var{other-cpu-type}} option with an appropriate
30759 @var{other-cpu-type} value.
30762 Original Intel i386 CPU@.
30765 Intel i486 CPU@. (No scheduling is implemented for this chip.)
30769 Intel Pentium CPU with no MMX support.
30772 Intel Lakemont MCU, based on Intel Pentium CPU.
30775 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
30778 Intel Pentium Pro CPU@.
30781 When used with @option{-march}, the Pentium Pro
30782 instruction set is used, so the code runs on all i686 family chips.
30783 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
30786 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
30791 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
30795 Intel Pentium M; low-power version of Intel Pentium III CPU
30796 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
30800 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
30803 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
30807 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
30808 SSE2 and SSE3 instruction set support.
30811 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
30812 instruction set support.
30815 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30816 SSE4.1, SSE4.2 and POPCNT instruction set support.
30819 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30820 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
30823 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30824 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
30827 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30828 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
30829 instruction set support.
30832 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30833 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30834 BMI, BMI2 and F16C instruction set support.
30837 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30838 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
30839 F16C, RDSEED ADCX and PREFETCHW instruction set support.
30842 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30843 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30844 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES
30845 instruction set support.
30848 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
30849 instruction set support.
30852 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30853 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
30856 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30857 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30858 XSAVEOPT and FSGSBASE instruction set support.
30860 @item goldmont-plus
30861 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30862 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
30863 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
30866 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30867 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30868 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30869 MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
30872 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30873 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30874 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30875 AVX512ER and AVX512CD instruction set support.
30878 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30879 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30880 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30881 AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction
30884 @item skylake-avx512
30885 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30886 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30887 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30888 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
30891 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30892 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30893 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30894 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30895 AVX512IFMA, SHA and UMIP instruction set support.
30897 @item icelake-client
30898 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30899 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30900 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30901 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30902 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30903 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30905 @item icelake-server
30906 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30907 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30908 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30909 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30910 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30911 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
30915 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30916 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30917 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30918 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
30921 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30922 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30923 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30924 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
30928 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30929 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30930 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30931 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
30932 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
30933 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
30934 instruction set support.
30936 @item sapphirerapids
30937 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30938 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND,
30939 FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES,
30940 AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
30941 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
30942 SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8 and AVX-VNNI
30943 instruction set support.
30946 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30947 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30948 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30949 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
30950 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI
30951 instruction set support.
30954 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30955 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30956 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30957 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30958 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30959 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30962 AMD K6 CPU with MMX instruction set support.
30966 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
30969 @itemx athlon-tbird
30970 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
30976 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
30977 instruction set support.
30983 Processors based on the AMD K8 core with x86-64 instruction set support,
30984 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
30985 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
30986 instruction set extensions.)
30989 @itemx opteron-sse3
30990 @itemx athlon64-sse3
30991 Improved versions of AMD K8 cores with SSE3 instruction set support.
30995 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
30996 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
30997 instruction set extensions.)
31000 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
31001 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
31002 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
31005 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
31006 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
31007 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
31011 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
31012 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
31013 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
31014 64-bit instruction set extensions.)
31017 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
31018 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
31019 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
31020 SSE4.2, ABM and 64-bit instruction set extensions.)
31023 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
31024 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
31025 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
31026 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
31027 instruction set extensions.)
31030 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
31031 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
31032 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
31033 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
31034 WBNOINVD, and 64-bit instruction set extensions.)
31037 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
31038 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
31039 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
31040 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
31041 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
31044 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
31045 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
31046 instruction set extensions.)
31049 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
31050 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
31051 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
31054 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
31058 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
31059 instruction set support.
31062 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
31063 (No scheduling is implemented for this chip.)
31066 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
31067 (No scheduling is implemented for this chip.)
31070 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
31071 (No scheduling is implemented for this chip.)
31074 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
31075 (No scheduling is implemented for this chip.)
31078 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
31079 (No scheduling is implemented for this chip.)
31082 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
31083 (No scheduling is implemented for this chip.)
31086 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
31087 (No scheduling is implemented for this chip.)
31090 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
31091 AVX and AVX2 instruction set support.
31092 (No scheduling is implemented for this chip.)
31095 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
31096 instruction set support.
31097 (No scheduling is implemented for this chip.)
31100 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
31101 instruction set support.
31102 (No scheduling is implemented for this chip.)
31105 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
31106 instruction set support.
31107 (No scheduling is implemented for this chip.)
31110 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
31111 instruction set support.
31112 (No scheduling is implemented for this chip.)
31115 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
31116 instruction set support.
31117 (No scheduling is implemented for this chip.)
31120 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
31121 instruction set support.
31122 (No scheduling is implemented for this chip.)
31125 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
31128 @item -mtune=@var{cpu-type}
31130 Tune to @var{cpu-type} everything applicable about the generated code, except
31131 for the ABI and the set of available instructions.
31132 While picking a specific @var{cpu-type} schedules things appropriately
31133 for that particular chip, the compiler does not generate any code that
31134 cannot run on the default machine type unless you use a
31135 @option{-march=@var{cpu-type}} option.
31136 For example, if GCC is configured for i686-pc-linux-gnu
31137 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
31138 but still runs on i686 machines.
31140 The choices for @var{cpu-type} are the same as for @option{-march}.
31141 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
31145 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
31146 If you know the CPU on which your code will run, then you should use
31147 the corresponding @option{-mtune} or @option{-march} option instead of
31148 @option{-mtune=generic}. But, if you do not know exactly what CPU users
31149 of your application will have, then you should use this option.
31151 As new processors are deployed in the marketplace, the behavior of this
31152 option will change. Therefore, if you upgrade to a newer version of
31153 GCC, code generation controlled by this option will change to reflect
31155 that are most common at the time that version of GCC is released.
31157 There is no @option{-march=generic} option because @option{-march}
31158 indicates the instruction set the compiler can use, and there is no
31159 generic instruction set applicable to all processors. In contrast,
31160 @option{-mtune} indicates the processor (or, in this case, collection of
31161 processors) for which the code is optimized.
31164 Produce code optimized for the most current Intel processors, which are
31165 Haswell and Silvermont for this version of GCC. If you know the CPU
31166 on which your code will run, then you should use the corresponding
31167 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
31168 But, if you want your application performs better on both Haswell and
31169 Silvermont, then you should use this option.
31171 As new Intel processors are deployed in the marketplace, the behavior of
31172 this option will change. Therefore, if you upgrade to a newer version of
31173 GCC, code generation controlled by this option will change to reflect
31174 the most current Intel processors at the time that version of GCC is
31177 There is no @option{-march=intel} option because @option{-march} indicates
31178 the instruction set the compiler can use, and there is no common
31179 instruction set applicable to all processors. In contrast,
31180 @option{-mtune} indicates the processor (or, in this case, collection of
31181 processors) for which the code is optimized.
31184 @item -mcpu=@var{cpu-type}
31186 A deprecated synonym for @option{-mtune}.
31188 @item -mfpmath=@var{unit}
31190 Generate floating-point arithmetic for selected unit @var{unit}. The choices
31191 for @var{unit} are:
31195 Use the standard 387 floating-point coprocessor present on the majority of chips and
31196 emulated otherwise. Code compiled with this option runs almost everywhere.
31197 The temporary results are computed in 80-bit precision instead of the precision
31198 specified by the type, resulting in slightly different results compared to most
31199 of other chips. See @option{-ffloat-store} for more detailed description.
31201 This is the default choice for non-Darwin x86-32 targets.
31204 Use scalar floating-point instructions present in the SSE instruction set.
31205 This instruction set is supported by Pentium III and newer chips,
31206 and in the AMD line
31207 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
31208 instruction set supports only single-precision arithmetic, thus the double and
31209 extended-precision arithmetic are still done using 387. A later version, present
31210 only in Pentium 4 and AMD x86-64 chips, supports double-precision
31213 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
31214 or @option{-msse2} switches to enable SSE extensions and make this option
31215 effective. For the x86-64 compiler, these extensions are enabled by default.
31217 The resulting code should be considerably faster in the majority of cases and avoid
31218 the numerical instability problems of 387 code, but may break some existing
31219 code that expects temporaries to be 80 bits.
31221 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
31222 and the default choice for x86-32 targets with the SSE2 instruction set
31223 when @option{-ffast-math} is enabled.
31228 Attempt to utilize both instruction sets at once. This effectively doubles the
31229 amount of available registers, and on chips with separate execution units for
31230 387 and SSE the execution resources too. Use this option with care, as it is
31231 still experimental, because the GCC register allocator does not model separate
31232 functional units well, resulting in unstable performance.
31235 @item -masm=@var{dialect}
31236 @opindex masm=@var{dialect}
31237 Output assembly instructions using selected @var{dialect}. Also affects
31238 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
31239 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
31240 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
31241 not support @samp{intel}.
31244 @itemx -mno-ieee-fp
31246 @opindex mno-ieee-fp
31247 Control whether or not the compiler uses IEEE floating-point
31248 comparisons. These correctly handle the case where the result of a
31249 comparison is unordered.
31252 @itemx -mhard-float
31254 @opindex mhard-float
31255 Generate output containing 80387 instructions for floating point.
31258 @itemx -msoft-float
31260 @opindex msoft-float
31261 Generate output containing library calls for floating point.
31263 @strong{Warning:} the requisite libraries are not part of GCC@.
31264 Normally the facilities of the machine's usual C compiler are used, but
31265 this cannot be done directly in cross-compilation. You must make your
31266 own arrangements to provide suitable library functions for
31269 On machines where a function returns floating-point results in the 80387
31270 register stack, some floating-point opcodes may be emitted even if
31271 @option{-msoft-float} is used.
31273 @item -mno-fp-ret-in-387
31274 @opindex mno-fp-ret-in-387
31275 @opindex mfp-ret-in-387
31276 Do not use the FPU registers for return values of functions.
31278 The usual calling convention has functions return values of types
31279 @code{float} and @code{double} in an FPU register, even if there
31280 is no FPU@. The idea is that the operating system should emulate
31283 The option @option{-mno-fp-ret-in-387} causes such values to be returned
31284 in ordinary CPU registers instead.
31286 @item -mno-fancy-math-387
31287 @opindex mno-fancy-math-387
31288 @opindex mfancy-math-387
31289 Some 387 emulators do not support the @code{sin}, @code{cos} and
31290 @code{sqrt} instructions for the 387. Specify this option to avoid
31291 generating those instructions.
31292 This option is overridden when @option{-march}
31293 indicates that the target CPU always has an FPU and so the
31294 instruction does not need emulation. These
31295 instructions are not generated unless you also use the
31296 @option{-funsafe-math-optimizations} switch.
31298 @item -malign-double
31299 @itemx -mno-align-double
31300 @opindex malign-double
31301 @opindex mno-align-double
31302 Control whether GCC aligns @code{double}, @code{long double}, and
31303 @code{long long} variables on a two-word boundary or a one-word
31304 boundary. Aligning @code{double} variables on a two-word boundary
31305 produces code that runs somewhat faster on a Pentium at the
31306 expense of more memory.
31308 On x86-64, @option{-malign-double} is enabled by default.
31310 @strong{Warning:} if you use the @option{-malign-double} switch,
31311 structures containing the above types are aligned differently than
31312 the published application binary interface specifications for the x86-32
31313 and are not binary compatible with structures in code compiled
31314 without that switch.
31316 @item -m96bit-long-double
31317 @itemx -m128bit-long-double
31318 @opindex m96bit-long-double
31319 @opindex m128bit-long-double
31320 These switches control the size of @code{long double} type. The x86-32
31321 application binary interface specifies the size to be 96 bits,
31322 so @option{-m96bit-long-double} is the default in 32-bit mode.
31324 Modern architectures (Pentium and newer) prefer @code{long double}
31325 to be aligned to an 8- or 16-byte boundary. In arrays or structures
31326 conforming to the ABI, this is not possible. So specifying
31327 @option{-m128bit-long-double} aligns @code{long double}
31328 to a 16-byte boundary by padding the @code{long double} with an additional
31331 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
31332 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
31334 Notice that neither of these options enable any extra precision over the x87
31335 standard of 80 bits for a @code{long double}.
31337 @strong{Warning:} if you override the default value for your target ABI, this
31338 changes the size of
31339 structures and arrays containing @code{long double} variables,
31340 as well as modifying the function calling convention for functions taking
31341 @code{long double}. Hence they are not binary-compatible
31342 with code compiled without that switch.
31344 @item -mlong-double-64
31345 @itemx -mlong-double-80
31346 @itemx -mlong-double-128
31347 @opindex mlong-double-64
31348 @opindex mlong-double-80
31349 @opindex mlong-double-128
31350 These switches control the size of @code{long double} type. A size
31351 of 64 bits makes the @code{long double} type equivalent to the @code{double}
31352 type. This is the default for 32-bit Bionic C library. A size
31353 of 128 bits makes the @code{long double} type equivalent to the
31354 @code{__float128} type. This is the default for 64-bit Bionic C library.
31356 @strong{Warning:} if you override the default value for your target ABI, this
31357 changes the size of
31358 structures and arrays containing @code{long double} variables,
31359 as well as modifying the function calling convention for functions taking
31360 @code{long double}. Hence they are not binary-compatible
31361 with code compiled without that switch.
31363 @item -malign-data=@var{type}
31364 @opindex malign-data
31365 Control how GCC aligns variables. Supported values for @var{type} are
31366 @samp{compat} uses increased alignment value compatible uses GCC 4.8
31367 and earlier, @samp{abi} uses alignment value as specified by the
31368 psABI, and @samp{cacheline} uses increased alignment value to match
31369 the cache line size. @samp{compat} is the default.
31371 @item -mlarge-data-threshold=@var{threshold}
31372 @opindex mlarge-data-threshold
31373 When @option{-mcmodel=medium} is specified, data objects larger than
31374 @var{threshold} are placed in the large data section. This value must be the
31375 same across all objects linked into the binary, and defaults to 65535.
31379 Use a different function-calling convention, in which functions that
31380 take a fixed number of arguments return with the @code{ret @var{num}}
31381 instruction, which pops their arguments while returning. This saves one
31382 instruction in the caller since there is no need to pop the arguments
31385 You can specify that an individual function is called with this calling
31386 sequence with the function attribute @code{stdcall}. You can also
31387 override the @option{-mrtd} option by using the function attribute
31388 @code{cdecl}. @xref{Function Attributes}.
31390 @strong{Warning:} this calling convention is incompatible with the one
31391 normally used on Unix, so you cannot use it if you need to call
31392 libraries compiled with the Unix compiler.
31394 Also, you must provide function prototypes for all functions that
31395 take variable numbers of arguments (including @code{printf});
31396 otherwise incorrect code is generated for calls to those
31399 In addition, seriously incorrect code results if you call a
31400 function with too many arguments. (Normally, extra arguments are
31401 harmlessly ignored.)
31403 @item -mregparm=@var{num}
31405 Control how many registers are used to pass integer arguments. By
31406 default, no registers are used to pass arguments, and at most 3
31407 registers can be used. You can control this behavior for a specific
31408 function by using the function attribute @code{regparm}.
31409 @xref{Function Attributes}.
31411 @strong{Warning:} if you use this switch, and
31412 @var{num} is nonzero, then you must build all modules with the same
31413 value, including any libraries. This includes the system libraries and
31417 @opindex msseregparm
31418 Use SSE register passing conventions for float and double arguments
31419 and return values. You can control this behavior for a specific
31420 function by using the function attribute @code{sseregparm}.
31421 @xref{Function Attributes}.
31423 @strong{Warning:} if you use this switch then you must build all
31424 modules with the same value, including any libraries. This includes
31425 the system libraries and startup modules.
31427 @item -mvect8-ret-in-mem
31428 @opindex mvect8-ret-in-mem
31429 Return 8-byte vectors in memory instead of MMX registers. This is the
31430 default on VxWorks to match the ABI of the Sun Studio compilers until
31431 version 12. @emph{Only} use this option if you need to remain
31432 compatible with existing code produced by those previous compiler
31433 versions or older versions of GCC@.
31442 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
31443 is specified, the significands of results of floating-point operations are
31444 rounded to 24 bits (single precision); @option{-mpc64} rounds the
31445 significands of results of floating-point operations to 53 bits (double
31446 precision) and @option{-mpc80} rounds the significands of results of
31447 floating-point operations to 64 bits (extended double precision), which is
31448 the default. When this option is used, floating-point operations in higher
31449 precisions are not available to the programmer without setting the FPU
31450 control word explicitly.
31452 Setting the rounding of floating-point operations to less than the default
31453 80 bits can speed some programs by 2% or more. Note that some mathematical
31454 libraries assume that extended-precision (80-bit) floating-point operations
31455 are enabled by default; routines in such libraries could suffer significant
31456 loss of accuracy, typically through so-called ``catastrophic cancellation'',
31457 when this option is used to set the precision to less than extended precision.
31459 @item -mstackrealign
31460 @opindex mstackrealign
31461 Realign the stack at entry. On the x86, the @option{-mstackrealign}
31462 option generates an alternate prologue and epilogue that realigns the
31463 run-time stack if necessary. This supports mixing legacy codes that keep
31464 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
31465 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
31466 applicable to individual functions.
31468 @item -mpreferred-stack-boundary=@var{num}
31469 @opindex mpreferred-stack-boundary
31470 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
31471 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
31472 the default is 4 (16 bytes or 128 bits).
31474 @strong{Warning:} When generating code for the x86-64 architecture with
31475 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
31476 used to keep the stack boundary aligned to 8 byte boundary. Since
31477 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
31478 intended to be used in controlled environment where stack space is
31479 important limitation. This option leads to wrong code when functions
31480 compiled with 16 byte stack alignment (such as functions from a standard
31481 library) are called with misaligned stack. In this case, SSE
31482 instructions may lead to misaligned memory access traps. In addition,
31483 variable arguments are handled incorrectly for 16 byte aligned
31484 objects (including x87 long double and __int128), leading to wrong
31485 results. You must build all modules with
31486 @option{-mpreferred-stack-boundary=3}, including any libraries. This
31487 includes the system libraries and startup modules.
31489 @item -mincoming-stack-boundary=@var{num}
31490 @opindex mincoming-stack-boundary
31491 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
31492 boundary. If @option{-mincoming-stack-boundary} is not specified,
31493 the one specified by @option{-mpreferred-stack-boundary} is used.
31495 On Pentium and Pentium Pro, @code{double} and @code{long double} values
31496 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
31497 suffer significant run time performance penalties. On Pentium III, the
31498 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
31499 properly if it is not 16-byte aligned.
31501 To ensure proper alignment of this values on the stack, the stack boundary
31502 must be as aligned as that required by any value stored on the stack.
31503 Further, every function must be generated such that it keeps the stack
31504 aligned. Thus calling a function compiled with a higher preferred
31505 stack boundary from a function compiled with a lower preferred stack
31506 boundary most likely misaligns the stack. It is recommended that
31507 libraries that use callbacks always use the default setting.
31509 This extra alignment does consume extra stack space, and generally
31510 increases code size. Code that is sensitive to stack space usage, such
31511 as embedded systems and operating system kernels, may want to reduce the
31512 preferred alignment to @option{-mpreferred-stack-boundary=2}.
31569 @itemx -mavx512ifma
31570 @opindex mavx512ifma
31572 @itemx -mavx512vbmi
31573 @opindex mavx512vbmi
31584 @itemx -mclflushopt
31585 @opindex mclflushopt
31620 @itemx -mprefetchwt1
31621 @opindex mprefetchwt1
31692 @itemx -mavx512vbmi2
31693 @opindex mavx512vbmi2
31695 @itemx -mavx512bf16
31696 @opindex mavx512bf16
31698 @itemx -mavx512fp16
31699 @opindex mavx512fp16
31710 @itemx -mvpclmulqdq
31711 @opindex mvpclmulqdq
31713 @itemx -mavx512bitalg
31714 @opindex mavx512bitalg
31720 @opindex mmovdir64b
31730 @itemx -mavx512vpopcntdq
31731 @opindex mavx512vpopcntdq
31733 @itemx -mavx512vp2intersect
31734 @opindex mavx512vp2intersect
31736 @itemx -mavx5124fmaps
31737 @opindex mavx5124fmaps
31739 @itemx -mavx512vnni
31740 @opindex mavx512vnni
31745 @itemx -mavx5124vnniw
31746 @opindex mavx5124vnniw
31752 @opindex mserialize
31770 These switches enable the use of instructions in the MMX, SSE,
31771 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
31772 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
31773 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
31774 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
31775 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
31776 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
31777 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
31778 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
31779 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16
31780 or CLDEMOTE extended instruction sets. Each has a corresponding
31781 @option{-mno-} option to disable use of these instructions.
31783 These extensions are also available as built-in functions: see
31784 @ref{x86 Built-in Functions}, for details of the functions enabled and
31785 disabled by these switches.
31787 To generate SSE/SSE2 instructions automatically from floating-point
31788 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
31790 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
31791 generates new AVX instructions or AVX equivalence for all SSEx instructions
31794 These options enable GCC to use these extended instructions in
31795 generated code, even without @option{-mfpmath=sse}. Applications that
31796 perform run-time CPU detection must compile separate files for each
31797 supported architecture, using the appropriate flags. In particular,
31798 the file containing the CPU detection code should be compiled without
31801 @item -mdump-tune-features
31802 @opindex mdump-tune-features
31803 This option instructs GCC to dump the names of the x86 performance
31804 tuning features and default settings. The names can be used in
31805 @option{-mtune-ctrl=@var{feature-list}}.
31807 @item -mtune-ctrl=@var{feature-list}
31808 @opindex mtune-ctrl=@var{feature-list}
31809 This option is used to do fine grain control of x86 code generation features.
31810 @var{feature-list} is a comma separated list of @var{feature} names. See also
31811 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
31812 on if it is not preceded with @samp{^}, otherwise, it is turned off.
31813 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
31814 developers. Using it may lead to code paths not covered by testing and can
31815 potentially result in compiler ICEs or runtime errors.
31818 @opindex mno-default
31819 This option instructs GCC to turn off all tunable features. See also
31820 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
31824 This option instructs GCC to emit a @code{cld} instruction in the prologue
31825 of functions that use string instructions. String instructions depend on
31826 the DF flag to select between autoincrement or autodecrement mode. While the
31827 ABI specifies the DF flag to be cleared on function entry, some operating
31828 systems violate this specification by not clearing the DF flag in their
31829 exception dispatchers. The exception handler can be invoked with the DF flag
31830 set, which leads to wrong direction mode when string instructions are used.
31831 This option can be enabled by default on 32-bit x86 targets by configuring
31832 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
31833 instructions can be suppressed with the @option{-mno-cld} compiler option
31837 @opindex mvzeroupper
31838 This option instructs GCC to emit a @code{vzeroupper} instruction
31839 before a transfer of control flow out of the function to minimize
31840 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
31843 @item -mprefer-avx128
31844 @opindex mprefer-avx128
31845 This option instructs GCC to use 128-bit AVX instructions instead of
31846 256-bit AVX instructions in the auto-vectorizer.
31848 @item -mprefer-vector-width=@var{opt}
31849 @opindex mprefer-vector-width
31850 This option instructs GCC to use @var{opt}-bit vector width in instructions
31851 instead of default on the selected platform.
31855 No extra limitations applied to GCC other than defined by the selected platform.
31858 Prefer 128-bit vector width for instructions.
31861 Prefer 256-bit vector width for instructions.
31864 Prefer 512-bit vector width for instructions.
31869 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
31870 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
31871 objects. This is useful for atomic updates of data structures exceeding one
31872 machine word in size. The compiler uses this instruction to implement
31873 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
31874 128-bit integers, a library call is always used.
31878 This option enables generation of @code{SAHF} instructions in 64-bit code.
31879 Early Intel Pentium 4 CPUs with Intel 64 support,
31880 prior to the introduction of Pentium 4 G1 step in December 2005,
31881 lacked the @code{LAHF} and @code{SAHF} instructions
31882 which are supported by AMD64.
31883 These are load and store instructions, respectively, for certain status flags.
31884 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
31885 @code{drem}, and @code{remainder} built-in functions;
31886 see @ref{Other Builtins} for details.
31890 This option enables use of the @code{movbe} instruction to implement
31891 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
31895 The @option{-mshstk} option enables shadow stack built-in functions
31896 from x86 Control-flow Enforcement Technology (CET).
31900 This option enables built-in functions @code{__builtin_ia32_crc32qi},
31901 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
31902 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
31906 This option enables built-in functions @code{__builtin_ia32_monitor},
31907 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
31908 @code{mwait} machine instructions.
31912 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
31913 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
31914 with an additional Newton-Raphson step
31915 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
31916 (and their vectorized
31917 variants) for single-precision floating-point arguments. These instructions
31918 are generated only when @option{-funsafe-math-optimizations} is enabled
31919 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
31920 Note that while the throughput of the sequence is higher than the throughput
31921 of the non-reciprocal instruction, the precision of the sequence can be
31922 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
31924 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
31925 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
31926 combination), and doesn't need @option{-mrecip}.
31928 Also note that GCC emits the above sequence with additional Newton-Raphson step
31929 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
31930 already with @option{-ffast-math} (or the above option combination), and
31931 doesn't need @option{-mrecip}.
31933 @item -mrecip=@var{opt}
31934 @opindex mrecip=opt
31935 This option controls which reciprocal estimate instructions
31936 may be used. @var{opt} is a comma-separated list of options, which may
31937 be preceded by a @samp{!} to invert the option:
31941 Enable all estimate instructions.
31944 Enable the default instructions, equivalent to @option{-mrecip}.
31947 Disable all estimate instructions, equivalent to @option{-mno-recip}.
31950 Enable the approximation for scalar division.
31953 Enable the approximation for vectorized division.
31956 Enable the approximation for scalar square root.
31959 Enable the approximation for vectorized square root.
31962 So, for example, @option{-mrecip=all,!sqrt} enables
31963 all of the reciprocal approximations, except for square root.
31965 @item -mveclibabi=@var{type}
31966 @opindex mveclibabi
31967 Specifies the ABI type to use for vectorizing intrinsics using an
31968 external library. Supported values for @var{type} are @samp{svml}
31969 for the Intel short
31970 vector math library and @samp{acml} for the AMD math core library.
31971 To use this option, both @option{-ftree-vectorize} and
31972 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
31973 ABI-compatible library must be specified at link time.
31975 GCC currently emits calls to @code{vmldExp2},
31976 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
31977 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
31978 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
31979 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
31980 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
31981 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
31982 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
31983 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
31984 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
31985 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
31986 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
31987 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
31988 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
31989 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
31990 when @option{-mveclibabi=acml} is used.
31992 @item -mabi=@var{name}
31994 Generate code for the specified calling convention. Permissible values
31995 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
31996 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
31997 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
31998 You can control this behavior for specific functions by
31999 using the function attributes @code{ms_abi} and @code{sysv_abi}.
32000 @xref{Function Attributes}.
32002 @item -mforce-indirect-call
32003 @opindex mforce-indirect-call
32004 Force all calls to functions to be indirect. This is useful
32005 when using Intel Processor Trace where it generates more precise timing
32006 information for function calls.
32008 @item -mmanual-endbr
32009 @opindex mmanual-endbr
32010 Insert ENDBR instruction at function entry only via the @code{cf_check}
32011 function attribute. This is useful when used with the option
32012 @option{-fcf-protection=branch} to control ENDBR insertion at the
32015 @item -mcall-ms2sysv-xlogues
32016 @opindex mcall-ms2sysv-xlogues
32017 @opindex mno-call-ms2sysv-xlogues
32018 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
32019 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
32020 default, the code for saving and restoring these registers is emitted inline,
32021 resulting in fairly lengthy prologues and epilogues. Using
32022 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
32023 use stubs in the static portion of libgcc to perform these saves and restores,
32024 thus reducing function size at the cost of a few extra instructions.
32026 @item -mtls-dialect=@var{type}
32027 @opindex mtls-dialect
32028 Generate code to access thread-local storage using the @samp{gnu} or
32029 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
32030 @samp{gnu2} is more efficient, but it may add compile- and run-time
32031 requirements that cannot be satisfied on all systems.
32034 @itemx -mno-push-args
32035 @opindex mpush-args
32036 @opindex mno-push-args
32037 Use PUSH operations to store outgoing parameters. This method is shorter
32038 and usually equally fast as method using SUB/MOV operations and is enabled
32039 by default. In some cases disabling it may improve performance because of
32040 improved scheduling and reduced dependencies.
32042 @item -maccumulate-outgoing-args
32043 @opindex maccumulate-outgoing-args
32044 If enabled, the maximum amount of space required for outgoing arguments is
32045 computed in the function prologue. This is faster on most modern CPUs
32046 because of reduced dependencies, improved scheduling and reduced stack usage
32047 when the preferred stack boundary is not equal to 2. The drawback is a notable
32048 increase in code size. This switch implies @option{-mno-push-args}.
32052 Support thread-safe exception handling on MinGW. Programs that rely
32053 on thread-safe exception handling must compile and link all code with the
32054 @option{-mthreads} option. When compiling, @option{-mthreads} defines
32055 @option{-D_MT}; when linking, it links in a special thread helper library
32056 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
32058 @item -mms-bitfields
32059 @itemx -mno-ms-bitfields
32060 @opindex mms-bitfields
32061 @opindex mno-ms-bitfields
32063 Enable/disable bit-field layout compatible with the native Microsoft
32066 If @code{packed} is used on a structure, or if bit-fields are used,
32067 it may be that the Microsoft ABI lays out the structure differently
32068 than the way GCC normally does. Particularly when moving packed
32069 data between functions compiled with GCC and the native Microsoft compiler
32070 (either via function call or as data in a file), it may be necessary to access
32073 This option is enabled by default for Microsoft Windows
32074 targets. This behavior can also be controlled locally by use of variable
32075 or type attributes. For more information, see @ref{x86 Variable Attributes}
32076 and @ref{x86 Type Attributes}.
32078 The Microsoft structure layout algorithm is fairly simple with the exception
32079 of the bit-field packing.
32080 The padding and alignment of members of structures and whether a bit-field
32081 can straddle a storage-unit boundary are determine by these rules:
32084 @item Structure members are stored sequentially in the order in which they are
32085 declared: the first member has the lowest memory address and the last member
32088 @item Every data object has an alignment requirement. The alignment requirement
32089 for all data except structures, unions, and arrays is either the size of the
32090 object or the current packing size (specified with either the
32091 @code{aligned} attribute or the @code{pack} pragma),
32092 whichever is less. For structures, unions, and arrays,
32093 the alignment requirement is the largest alignment requirement of its members.
32094 Every object is allocated an offset so that:
32097 offset % alignment_requirement == 0
32100 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
32101 unit if the integral types are the same size and if the next bit-field fits
32102 into the current allocation unit without crossing the boundary imposed by the
32103 common alignment requirements of the bit-fields.
32106 MSVC interprets zero-length bit-fields in the following ways:
32109 @item If a zero-length bit-field is inserted between two bit-fields that
32110 are normally coalesced, the bit-fields are not coalesced.
32117 unsigned long bf_1 : 12;
32119 unsigned long bf_2 : 12;
32124 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
32125 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
32127 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
32128 alignment of the zero-length bit-field is greater than the member that follows it,
32129 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
32150 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
32151 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
32152 bit-field does not affect the alignment of @code{bar} or, as a result, the size
32155 Taking this into account, it is important to note the following:
32158 @item If a zero-length bit-field follows a normal bit-field, the type of the
32159 zero-length bit-field may affect the alignment of the structure as whole. For
32160 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
32161 normal bit-field, and is of type short.
32163 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
32164 still affect the alignment of the structure:
32175 Here, @code{t4} takes up 4 bytes.
32178 @item Zero-length bit-fields following non-bit-field members are ignored:
32190 Here, @code{t5} takes up 2 bytes.
32194 @item -mno-align-stringops
32195 @opindex mno-align-stringops
32196 @opindex malign-stringops
32197 Do not align the destination of inlined string operations. This switch reduces
32198 code size and improves performance in case the destination is already aligned,
32199 but GCC doesn't know about it.
32201 @item -minline-all-stringops
32202 @opindex minline-all-stringops
32203 By default GCC inlines string operations only when the destination is
32204 known to be aligned to least a 4-byte boundary.
32205 This enables more inlining and increases code
32206 size, but may improve performance of code that depends on fast
32207 @code{memcpy} and @code{memset} for short lengths.
32208 The option enables inline expansion of @code{strlen} for all
32209 pointer alignments.
32211 @item -minline-stringops-dynamically
32212 @opindex minline-stringops-dynamically
32213 For string operations of unknown size, use run-time checks with
32214 inline code for small blocks and a library call for large blocks.
32216 @item -mstringop-strategy=@var{alg}
32217 @opindex mstringop-strategy=@var{alg}
32218 Override the internal decision heuristic for the particular algorithm to use
32219 for inlining string operations. The allowed values for @var{alg} are:
32225 Expand using i386 @code{rep} prefix of the specified size.
32229 @itemx unrolled_loop
32230 Expand into an inline loop.
32233 Always use a library call.
32236 @item -mmemcpy-strategy=@var{strategy}
32237 @opindex mmemcpy-strategy=@var{strategy}
32238 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
32239 should be inlined and what inline algorithm to use when the expected size
32240 of the copy operation is known. @var{strategy}
32241 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
32242 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
32243 the max byte size with which inline algorithm @var{alg} is allowed. For the last
32244 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
32245 in the list must be specified in increasing order. The minimal byte size for
32246 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
32249 @item -mmemset-strategy=@var{strategy}
32250 @opindex mmemset-strategy=@var{strategy}
32251 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
32252 @code{__builtin_memset} expansion.
32254 @item -momit-leaf-frame-pointer
32255 @opindex momit-leaf-frame-pointer
32256 Don't keep the frame pointer in a register for leaf functions. This
32257 avoids the instructions to save, set up, and restore frame pointers and
32258 makes an extra register available in leaf functions. The option
32259 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
32260 which might make debugging harder.
32262 @item -mtls-direct-seg-refs
32263 @itemx -mno-tls-direct-seg-refs
32264 @opindex mtls-direct-seg-refs
32265 Controls whether TLS variables may be accessed with offsets from the
32266 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
32267 or whether the thread base pointer must be added. Whether or not this
32268 is valid depends on the operating system, and whether it maps the
32269 segment to cover the entire TLS area.
32271 For systems that use the GNU C Library, the default is on.
32274 @itemx -mno-sse2avx
32276 Specify that the assembler should encode SSE instructions with VEX
32277 prefix. The option @option{-mavx} turns this on by default.
32282 If profiling is active (@option{-pg}), put the profiling
32283 counter call before the prologue.
32284 Note: On x86 architectures the attribute @code{ms_hook_prologue}
32285 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
32287 @item -mrecord-mcount
32288 @itemx -mno-record-mcount
32289 @opindex mrecord-mcount
32290 If profiling is active (@option{-pg}), generate a __mcount_loc section
32291 that contains pointers to each profiling call. This is useful for
32292 automatically patching and out calls.
32295 @itemx -mno-nop-mcount
32296 @opindex mnop-mcount
32297 If profiling is active (@option{-pg}), generate the calls to
32298 the profiling functions as NOPs. This is useful when they
32299 should be patched in later dynamically. This is likely only
32300 useful together with @option{-mrecord-mcount}.
32302 @item -minstrument-return=@var{type}
32303 @opindex minstrument-return
32304 Instrument function exit in -pg -mfentry instrumented functions with
32305 call to specified function. This only instruments true returns ending
32306 with ret, but not sibling calls ending with jump. Valid types
32307 are @var{none} to not instrument, @var{call} to generate a call to __return__,
32308 or @var{nop5} to generate a 5 byte nop.
32310 @item -mrecord-return
32311 @itemx -mno-record-return
32312 @opindex mrecord-return
32313 Generate a __return_loc section pointing to all return instrumentation code.
32315 @item -mfentry-name=@var{name}
32316 @opindex mfentry-name
32317 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
32319 @item -mfentry-section=@var{name}
32320 @opindex mfentry-section
32321 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
32323 @item -mskip-rax-setup
32324 @itemx -mno-skip-rax-setup
32325 @opindex mskip-rax-setup
32326 When generating code for the x86-64 architecture with SSE extensions
32327 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
32328 register when there are no variable arguments passed in vector registers.
32330 @strong{Warning:} Since RAX register is used to avoid unnecessarily
32331 saving vector registers on stack when passing variable arguments, the
32332 impacts of this option are callees may waste some stack space,
32333 misbehave or jump to a random location. GCC 4.4 or newer don't have
32334 those issues, regardless the RAX register value.
32337 @itemx -mno-8bit-idiv
32338 @opindex m8bit-idiv
32339 On some processors, like Intel Atom, 8-bit unsigned integer divide is
32340 much faster than 32-bit/64-bit integer divide. This option generates a
32341 run-time check. If both dividend and divisor are within range of 0
32342 to 255, 8-bit unsigned integer divide is used instead of
32343 32-bit/64-bit integer divide.
32345 @item -mavx256-split-unaligned-load
32346 @itemx -mavx256-split-unaligned-store
32347 @opindex mavx256-split-unaligned-load
32348 @opindex mavx256-split-unaligned-store
32349 Split 32-byte AVX unaligned load and store.
32351 @item -mstack-protector-guard=@var{guard}
32352 @itemx -mstack-protector-guard-reg=@var{reg}
32353 @itemx -mstack-protector-guard-offset=@var{offset}
32354 @opindex mstack-protector-guard
32355 @opindex mstack-protector-guard-reg
32356 @opindex mstack-protector-guard-offset
32357 Generate stack protection code using canary at @var{guard}. Supported
32358 locations are @samp{global} for global canary or @samp{tls} for per-thread
32359 canary in the TLS block (the default). This option has effect only when
32360 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
32362 With the latter choice the options
32363 @option{-mstack-protector-guard-reg=@var{reg}} and
32364 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
32365 which segment register (@code{%fs} or @code{%gs}) to use as base register
32366 for reading the canary, and from what offset from that base register.
32367 The default for those is as specified in the relevant ABI.
32369 @item -mgeneral-regs-only
32370 @opindex mgeneral-regs-only
32371 Generate code that uses only the general-purpose registers. This
32372 prevents the compiler from using floating-point, vector, mask and bound
32375 @item -mrelax-cmpxchg-loop
32376 @opindex mrelax-cmpxchg-loop
32377 Relax cmpxchg loop by emitting an early load and compare before cmpxchg,
32378 execute pause if load value is not expected. This reduces excessive
32379 cachline bouncing when and works for all atomic logic fetch builtins
32380 that generates compare and swap loop.
32382 @item -mindirect-branch=@var{choice}
32383 @opindex mindirect-branch
32384 Convert indirect call and jump with @var{choice}. The default is
32385 @samp{keep}, which keeps indirect call and jump unmodified.
32386 @samp{thunk} converts indirect call and jump to call and return thunk.
32387 @samp{thunk-inline} converts indirect call and jump to inlined call
32388 and return thunk. @samp{thunk-extern} converts indirect call and jump
32389 to external call and return thunk provided in a separate object file.
32390 You can control this behavior for a specific function by using the
32391 function attribute @code{indirect_branch}. @xref{Function Attributes}.
32393 Note that @option{-mcmodel=large} is incompatible with
32394 @option{-mindirect-branch=thunk} and
32395 @option{-mindirect-branch=thunk-extern} since the thunk function may
32396 not be reachable in the large code model.
32398 Note that @option{-mindirect-branch=thunk-extern} is compatible with
32399 @option{-fcf-protection=branch} since the external thunk can be made
32400 to enable control-flow check.
32402 @item -mfunction-return=@var{choice}
32403 @opindex mfunction-return
32404 Convert function return with @var{choice}. The default is @samp{keep},
32405 which keeps function return unmodified. @samp{thunk} converts function
32406 return to call and return thunk. @samp{thunk-inline} converts function
32407 return to inlined call and return thunk. @samp{thunk-extern} converts
32408 function return to external call and return thunk provided in a separate
32409 object file. You can control this behavior for a specific function by
32410 using the function attribute @code{function_return}.
32411 @xref{Function Attributes}.
32413 Note that @option{-mindirect-return=thunk-extern} is compatible with
32414 @option{-fcf-protection=branch} since the external thunk can be made
32415 to enable control-flow check.
32417 Note that @option{-mcmodel=large} is incompatible with
32418 @option{-mfunction-return=thunk} and
32419 @option{-mfunction-return=thunk-extern} since the thunk function may
32420 not be reachable in the large code model.
32423 @item -mindirect-branch-register
32424 @opindex mindirect-branch-register
32425 Force indirect call and jump via register.
32427 @item -mharden-sls=@var{choice}
32428 @opindex mharden-sls
32429 Generate code to mitigate against straight line speculation (SLS) with
32430 @var{choice}. The default is @samp{none} which disables all SLS
32431 hardening. @samp{return} enables SLS hardening for function return.
32432 @samp{indirect-branch} enables SLS hardening for indirect branch.
32433 @samp{all} enables all SLS hardening.
32435 @item -mindirect-branch-cs-prefix
32436 @opindex mindirect-branch-cs-prefix
32437 Add CS prefix to call and jmp to indirect thunk with branch target in
32438 r8-r15 registers so that the call and jmp instruction length is 6 bytes
32439 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
32440 @samp{lfence; jmp *%r8-r15} at run-time.
32444 These @samp{-m} switches are supported in addition to the above
32445 on x86-64 processors in 64-bit environments.
32458 Generate code for a 16-bit, 32-bit or 64-bit environment.
32459 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
32461 generates code that runs on any i386 system.
32463 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
32464 types to 64 bits, and generates code for the x86-64 architecture.
32465 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
32466 and @option{-mdynamic-no-pic} options.
32468 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
32470 generates code for the x86-64 architecture.
32472 The @option{-m16} option is the same as @option{-m32}, except for that
32473 it outputs the @code{.code16gcc} assembly directive at the beginning of
32474 the assembly output so that the binary can run in 16-bit mode.
32476 The @option{-miamcu} option generates code which conforms to Intel MCU
32477 psABI. It requires the @option{-m32} option to be turned on.
32479 @item -mno-red-zone
32480 @opindex mno-red-zone
32482 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
32483 by the x86-64 ABI; it is a 128-byte area beyond the location of the
32484 stack pointer that is not modified by signal or interrupt handlers
32485 and therefore can be used for temporary data without adjusting the stack
32486 pointer. The flag @option{-mno-red-zone} disables this red zone.
32488 @item -mcmodel=small
32489 @opindex mcmodel=small
32490 Generate code for the small code model: the program and its symbols must
32491 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
32492 Programs can be statically or dynamically linked. This is the default
32495 @item -mcmodel=kernel
32496 @opindex mcmodel=kernel
32497 Generate code for the kernel code model. The kernel runs in the
32498 negative 2 GB of the address space.
32499 This model has to be used for Linux kernel code.
32501 @item -mcmodel=medium
32502 @opindex mcmodel=medium
32503 Generate code for the medium model: the program is linked in the lower 2
32504 GB of the address space. Small symbols are also placed there. Symbols
32505 with sizes larger than @option{-mlarge-data-threshold} are put into
32506 large data or BSS sections and can be located above 2GB. Programs can
32507 be statically or dynamically linked.
32509 @item -mcmodel=large
32510 @opindex mcmodel=large
32511 Generate code for the large model. This model makes no assumptions
32512 about addresses and sizes of sections.
32514 @item -maddress-mode=long
32515 @opindex maddress-mode=long
32516 Generate code for long address mode. This is only supported for 64-bit
32517 and x32 environments. It is the default address mode for 64-bit
32520 @item -maddress-mode=short
32521 @opindex maddress-mode=short
32522 Generate code for short address mode. This is only supported for 32-bit
32523 and x32 environments. It is the default address mode for 32-bit and
32529 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
32530 indicate the micro-architecture ISA level required to execute the binary.
32533 @node x86 Windows Options
32534 @subsection x86 Windows Options
32535 @cindex x86 Windows Options
32536 @cindex Windows Options for x86
32538 These additional options are available for Microsoft Windows targets:
32544 specifies that a console application is to be generated, by
32545 instructing the linker to set the PE header subsystem type
32546 required for console applications.
32547 This option is available for Cygwin and MinGW targets and is
32548 enabled by default on those targets.
32552 This option is available for Cygwin and MinGW targets. It
32553 specifies that a DLL---a dynamic link library---is to be
32554 generated, enabling the selection of the required runtime
32555 startup object and entry point.
32557 @item -mnop-fun-dllimport
32558 @opindex mnop-fun-dllimport
32559 This option is available for Cygwin and MinGW targets. It
32560 specifies that the @code{dllimport} attribute should be ignored.
32564 This option is available for MinGW targets. It specifies
32565 that MinGW-specific thread support is to be used.
32569 This option is available for MinGW-w64 targets. It causes
32570 the @code{UNICODE} preprocessor macro to be predefined, and
32571 chooses Unicode-capable runtime startup code.
32575 This option is available for Cygwin and MinGW targets. It
32576 specifies that the typical Microsoft Windows predefined macros are to
32577 be set in the pre-processor, but does not influence the choice
32578 of runtime library/startup code.
32582 This option is available for Cygwin and MinGW targets. It
32583 specifies that a GUI application is to be generated by
32584 instructing the linker to set the PE header subsystem type
32587 @item -fno-set-stack-executable
32588 @opindex fno-set-stack-executable
32589 @opindex fset-stack-executable
32590 This option is available for MinGW targets. It specifies that
32591 the executable flag for the stack used by nested functions isn't
32592 set. This is necessary for binaries running in kernel mode of
32593 Microsoft Windows, as there the User32 API, which is used to set executable
32594 privileges, isn't available.
32596 @item -fwritable-relocated-rdata
32597 @opindex fno-writable-relocated-rdata
32598 @opindex fwritable-relocated-rdata
32599 This option is available for MinGW and Cygwin targets. It specifies
32600 that relocated-data in read-only section is put into the @code{.data}
32601 section. This is a necessary for older runtimes not supporting
32602 modification of @code{.rdata} sections for pseudo-relocation.
32604 @item -mpe-aligned-commons
32605 @opindex mpe-aligned-commons
32606 This option is available for Cygwin and MinGW targets. It
32607 specifies that the GNU extension to the PE file format that
32608 permits the correct alignment of COMMON variables should be
32609 used when generating code. It is enabled by default if
32610 GCC detects that the target assembler found during configuration
32611 supports the feature.
32614 See also under @ref{x86 Options} for standard options.
32616 @node Xstormy16 Options
32617 @subsection Xstormy16 Options
32618 @cindex Xstormy16 Options
32620 These options are defined for Xstormy16:
32625 Choose startup files and linker script suitable for the simulator.
32628 @node Xtensa Options
32629 @subsection Xtensa Options
32630 @cindex Xtensa Options
32632 These options are supported for Xtensa targets:
32636 @itemx -mno-const16
32638 @opindex mno-const16
32639 Enable or disable use of @code{CONST16} instructions for loading
32640 constant values. The @code{CONST16} instruction is currently not a
32641 standard option from Tensilica. When enabled, @code{CONST16}
32642 instructions are always used in place of the standard @code{L32R}
32643 instructions. The use of @code{CONST16} is enabled by default only if
32644 the @code{L32R} instruction is not available.
32647 @itemx -mno-fused-madd
32648 @opindex mfused-madd
32649 @opindex mno-fused-madd
32650 Enable or disable use of fused multiply/add and multiply/subtract
32651 instructions in the floating-point option. This has no effect if the
32652 floating-point option is not also enabled. Disabling fused multiply/add
32653 and multiply/subtract instructions forces the compiler to use separate
32654 instructions for the multiply and add/subtract operations. This may be
32655 desirable in some cases where strict IEEE 754-compliant results are
32656 required: the fused multiply add/subtract instructions do not round the
32657 intermediate result, thereby producing results with @emph{more} bits of
32658 precision than specified by the IEEE standard. Disabling fused multiply
32659 add/subtract instructions also ensures that the program output is not
32660 sensitive to the compiler's ability to combine multiply and add/subtract
32663 @item -mserialize-volatile
32664 @itemx -mno-serialize-volatile
32665 @opindex mserialize-volatile
32666 @opindex mno-serialize-volatile
32667 When this option is enabled, GCC inserts @code{MEMW} instructions before
32668 @code{volatile} memory references to guarantee sequential consistency.
32669 The default is @option{-mserialize-volatile}. Use
32670 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
32672 @item -mforce-no-pic
32673 @opindex mforce-no-pic
32674 For targets, like GNU/Linux, where all user-mode Xtensa code must be
32675 position-independent code (PIC), this option disables PIC for compiling
32678 @item -mtext-section-literals
32679 @itemx -mno-text-section-literals
32680 @opindex mtext-section-literals
32681 @opindex mno-text-section-literals
32682 These options control the treatment of literal pools. The default is
32683 @option{-mno-text-section-literals}, which places literals in a separate
32684 section in the output file. This allows the literal pool to be placed
32685 in a data RAM/ROM, and it also allows the linker to combine literal
32686 pools from separate object files to remove redundant literals and
32687 improve code size. With @option{-mtext-section-literals}, the literals
32688 are interspersed in the text section in order to keep them as close as
32689 possible to their references. This may be necessary for large assembly
32690 files. Literals for each function are placed right before that function.
32692 @item -mauto-litpools
32693 @itemx -mno-auto-litpools
32694 @opindex mauto-litpools
32695 @opindex mno-auto-litpools
32696 These options control the treatment of literal pools. The default is
32697 @option{-mno-auto-litpools}, which places literals in a separate
32698 section in the output file unless @option{-mtext-section-literals} is
32699 used. With @option{-mauto-litpools} the literals are interspersed in
32700 the text section by the assembler. Compiler does not produce explicit
32701 @code{.literal} directives and loads literals into registers with
32702 @code{MOVI} instructions instead of @code{L32R} to let the assembler
32703 do relaxation and place literals as necessary. This option allows
32704 assembler to create several literal pools per function and assemble
32705 very big functions, which may not be possible with
32706 @option{-mtext-section-literals}.
32708 @item -mtarget-align
32709 @itemx -mno-target-align
32710 @opindex mtarget-align
32711 @opindex mno-target-align
32712 When this option is enabled, GCC instructs the assembler to
32713 automatically align instructions to reduce branch penalties at the
32714 expense of some code density. The assembler attempts to widen density
32715 instructions to align branch targets and the instructions following call
32716 instructions. If there are not enough preceding safe density
32717 instructions to align a target, no widening is performed. The
32718 default is @option{-mtarget-align}. These options do not affect the
32719 treatment of auto-aligned instructions like @code{LOOP}, which the
32720 assembler always aligns, either by widening density instructions or
32721 by inserting NOP instructions.
32724 @itemx -mno-longcalls
32725 @opindex mlongcalls
32726 @opindex mno-longcalls
32727 When this option is enabled, GCC instructs the assembler to translate
32728 direct calls to indirect calls unless it can determine that the target
32729 of a direct call is in the range allowed by the call instruction. This
32730 translation typically occurs for calls to functions in other source
32731 files. Specifically, the assembler translates a direct @code{CALL}
32732 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
32733 The default is @option{-mno-longcalls}. This option should be used in
32734 programs where the call target can potentially be out of range. This
32735 option is implemented in the assembler, not the compiler, so the
32736 assembly code generated by GCC still shows direct call
32737 instructions---look at the disassembled object code to see the actual
32738 instructions. Note that the assembler uses an indirect call for
32739 every cross-file call, not just those that really are out of range.
32741 @item -mabi=@var{name}
32743 Generate code for the specified ABI@. Permissible values are: @samp{call0},
32744 @samp{windowed}. Default ABI is chosen by the Xtensa core configuration.
32747 @opindex mabi=call0
32748 When this option is enabled function parameters are passed in registers
32749 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
32750 caller-saved, and register @code{a15} may be used as a frame pointer.
32751 When this version of the ABI is enabled the C preprocessor symbol
32752 @code{__XTENSA_CALL0_ABI__} is defined.
32754 @item -mabi=windowed
32755 @opindex mabi=windowed
32756 When this option is enabled function parameters are passed in registers
32757 @code{a10} through @code{a15}, and called function rotates register window
32758 by 8 registers on entry so that its arguments are found in registers
32759 @code{a2} through @code{a7}. Register @code{a7} may be used as a frame
32760 pointer. Register window is rotated 8 registers back upon return.
32761 When this version of the ABI is enabled the C preprocessor symbol
32762 @code{__XTENSA_WINDOWED_ABI__} is defined.
32765 @node zSeries Options
32766 @subsection zSeries Options
32767 @cindex zSeries options
32769 These are listed under @xref{S/390 and zSeries Options}.
32775 @section Specifying Subprocesses and the Switches to Pass to Them
32778 @command{gcc} is a driver program. It performs its job by invoking a
32779 sequence of other programs to do the work of compiling, assembling and
32780 linking. GCC interprets its command-line parameters and uses these to
32781 deduce which programs it should invoke, and which command-line options
32782 it ought to place on their command lines. This behavior is controlled
32783 by @dfn{spec strings}. In most cases there is one spec string for each
32784 program that GCC can invoke, but a few programs have multiple spec
32785 strings to control their behavior. The spec strings built into GCC can
32786 be overridden by using the @option{-specs=} command-line switch to specify
32789 @dfn{Spec files} are plain-text files that are used to construct spec
32790 strings. They consist of a sequence of directives separated by blank
32791 lines. The type of directive is determined by the first non-whitespace
32792 character on the line, which can be one of the following:
32795 @item %@var{command}
32796 Issues a @var{command} to the spec file processor. The commands that can
32800 @item %include <@var{file}>
32801 @cindex @code{%include}
32802 Search for @var{file} and insert its text at the current point in the
32805 @item %include_noerr <@var{file}>
32806 @cindex @code{%include_noerr}
32807 Just like @samp{%include}, but do not generate an error message if the include
32808 file cannot be found.
32810 @item %rename @var{old_name} @var{new_name}
32811 @cindex @code{%rename}
32812 Rename the spec string @var{old_name} to @var{new_name}.
32816 @item *[@var{spec_name}]:
32817 This tells the compiler to create, override or delete the named spec
32818 string. All lines after this directive up to the next directive or
32819 blank line are considered to be the text for the spec string. If this
32820 results in an empty string then the spec is deleted. (Or, if the
32821 spec did not exist, then nothing happens.) Otherwise, if the spec
32822 does not currently exist a new spec is created. If the spec does
32823 exist then its contents are overridden by the text of this
32824 directive, unless the first character of that text is the @samp{+}
32825 character, in which case the text is appended to the spec.
32827 @item [@var{suffix}]:
32828 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
32829 and up to the next directive or blank line are considered to make up the
32830 spec string for the indicated suffix. When the compiler encounters an
32831 input file with the named suffix, it processes the spec string in
32832 order to work out how to compile that file. For example:
32836 z-compile -input %i
32839 This says that any input file whose name ends in @samp{.ZZ} should be
32840 passed to the program @samp{z-compile}, which should be invoked with the
32841 command-line switch @option{-input} and with the result of performing the
32842 @samp{%i} substitution. (See below.)
32844 As an alternative to providing a spec string, the text following a
32845 suffix directive can be one of the following:
32848 @item @@@var{language}
32849 This says that the suffix is an alias for a known @var{language}. This is
32850 similar to using the @option{-x} command-line switch to GCC to specify a
32851 language explicitly. For example:
32858 Says that .ZZ files are, in fact, C++ source files.
32861 This causes an error messages saying:
32864 @var{name} compiler not installed on this system.
32868 GCC already has an extensive list of suffixes built into it.
32869 This directive adds an entry to the end of the list of suffixes, but
32870 since the list is searched from the end backwards, it is effectively
32871 possible to override earlier entries using this technique.
32875 GCC has the following spec strings built into it. Spec files can
32876 override these strings or create their own. Note that individual
32877 targets can also add their own spec strings to this list.
32880 asm Options to pass to the assembler
32881 asm_final Options to pass to the assembler post-processor
32882 cpp Options to pass to the C preprocessor
32883 cc1 Options to pass to the C compiler
32884 cc1plus Options to pass to the C++ compiler
32885 endfile Object files to include at the end of the link
32886 link Options to pass to the linker
32887 lib Libraries to include on the command line to the linker
32888 libgcc Decides which GCC support library to pass to the linker
32889 linker Sets the name of the linker
32890 predefines Defines to be passed to the C preprocessor
32891 signed_char Defines to pass to CPP to say whether @code{char} is signed
32893 startfile Object files to include at the start of the link
32896 Here is a small example of a spec file:
32899 %rename lib old_lib
32902 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
32905 This example renames the spec called @samp{lib} to @samp{old_lib} and
32906 then overrides the previous definition of @samp{lib} with a new one.
32907 The new definition adds in some extra command-line options before
32908 including the text of the old definition.
32910 @dfn{Spec strings} are a list of command-line options to be passed to their
32911 corresponding program. In addition, the spec strings can contain
32912 @samp{%}-prefixed sequences to substitute variable text or to
32913 conditionally insert text into the command line. Using these constructs
32914 it is possible to generate quite complex command lines.
32916 Here is a table of all defined @samp{%}-sequences for spec
32917 strings. Note that spaces are not generated automatically around the
32918 results of expanding these sequences. Therefore you can concatenate them
32919 together or combine them with constant text in a single argument.
32923 Substitute one @samp{%} into the program name or argument.
32926 Substitute an empty argument.
32929 Substitute the name of the input file being processed.
32932 Substitute the basename for outputs related with the input file being
32933 processed. This is often the substring up to (and not including) the
32934 last period and not including the directory but, unless %w is active, it
32935 expands to the basename for auxiliary outputs, which may be influenced
32936 by an explicit output name, and by various other options that control
32937 how auxiliary outputs are named.
32940 This is the same as @samp{%b}, but include the file suffix (text after
32941 the last period). Without %w, it expands to the basename for dump
32945 Marks the argument containing or following the @samp{%d} as a
32946 temporary file name, so that that file is deleted if GCC exits
32947 successfully. Unlike @samp{%g}, this contributes no text to the
32950 @item %g@var{suffix}
32951 Substitute a file name that has suffix @var{suffix} and is chosen
32952 once per compilation, and mark the argument in the same way as
32953 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
32954 name is now chosen in a way that is hard to predict even when previously
32955 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
32956 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
32957 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
32958 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
32959 was simply substituted with a file name chosen once per compilation,
32960 without regard to any appended suffix (which was therefore treated
32961 just like ordinary text), making such attacks more likely to succeed.
32963 @item %u@var{suffix}
32964 Like @samp{%g}, but generates a new temporary file name
32965 each time it appears instead of once per compilation.
32967 @item %U@var{suffix}
32968 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
32969 new one if there is no such last file name. In the absence of any
32970 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
32971 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
32972 involves the generation of two distinct file names, one
32973 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
32974 simply substituted with a file name chosen for the previous @samp{%u},
32975 without regard to any appended suffix.
32977 @item %j@var{suffix}
32978 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
32979 writable, and if @option{-save-temps} is not used;
32980 otherwise, substitute the name
32981 of a temporary file, just like @samp{%u}. This temporary file is not
32982 meant for communication between processes, but rather as a junk
32983 disposal mechanism.
32985 @item %|@var{suffix}
32986 @itemx %m@var{suffix}
32987 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
32988 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
32989 all. These are the two most common ways to instruct a program that it
32990 should read from standard input or write to standard output. If you
32991 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
32992 construct: see for example @file{gcc/fortran/lang-specs.h}.
32994 @item %.@var{SUFFIX}
32995 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
32996 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
32997 terminated by the next space or %.
33000 Marks the argument containing or following the @samp{%w} as the
33001 designated output file of this compilation. This puts the argument
33002 into the sequence of arguments that @samp{%o} substitutes.
33005 Indicates that this compilation produces no output file.
33008 Substitutes the names of all the output files, with spaces
33009 automatically placed around them. You should write spaces
33010 around the @samp{%o} as well or the results are undefined.
33011 @samp{%o} is for use in the specs for running the linker.
33012 Input files whose names have no recognized suffix are not compiled
33013 at all, but they are included among the output files, so they are
33017 Substitutes the suffix for object files. Note that this is
33018 handled specially when it immediately follows @samp{%g, %u, or %U},
33019 because of the need for those to form complete file names. The
33020 handling is such that @samp{%O} is treated exactly as if it had already
33021 been substituted, except that @samp{%g, %u, and %U} do not currently
33022 support additional @var{suffix} characters following @samp{%O} as they do
33023 following, for example, @samp{.o}.
33026 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
33027 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
33028 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
33029 and @option{-imultilib} as necessary.
33032 Current argument is the name of a library or startup file of some sort.
33033 Search for that file in a standard list of directories and substitute
33034 the full name found. The current working directory is included in the
33035 list of directories scanned.
33038 Current argument is the name of a linker script. Search for that file
33039 in the current list of directories to scan for libraries. If the file
33040 is located insert a @option{--script} option into the command line
33041 followed by the full path name found. If the file is not found then
33042 generate an error message. Note: the current working directory is not
33046 Print @var{str} as an error message. @var{str} is terminated by a newline.
33047 Use this when inconsistent options are detected.
33050 Print @var{str} as a notice. @var{str} is terminated by a newline.
33052 @item %(@var{name})
33053 Substitute the contents of spec string @var{name} at this point.
33055 @item %x@{@var{option}@}
33056 Accumulate an option for @samp{%X}.
33059 Output the accumulated linker options specified by a @samp{%x} spec string.
33062 Output the accumulated assembler options specified by @option{-Wa}.
33065 Output the accumulated preprocessor options specified by @option{-Wp}.
33068 Output @code{multilib_os_dir}.
33071 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
33074 Process the @code{asm} spec. This is used to compute the
33075 switches to be passed to the assembler.
33078 Process the @code{asm_final} spec. This is a spec string for
33079 passing switches to an assembler post-processor, if such a program is
33083 Process the @code{link} spec. This is the spec for computing the
33084 command line passed to the linker. Typically it makes use of the
33085 @samp{%L %G %S %D and %E} sequences.
33088 Dump out a @option{-L} option for each directory that GCC believes might
33089 contain startup files. If the target supports multilibs then the
33090 current multilib directory is prepended to each of these paths.
33093 Process the @code{lib} spec. This is a spec string for deciding which
33094 libraries are included on the command line to the linker.
33097 Process the @code{libgcc} spec. This is a spec string for deciding
33098 which GCC support library is included on the command line to the linker.
33101 Process the @code{startfile} spec. This is a spec for deciding which
33102 object files are the first ones passed to the linker. Typically
33103 this might be a file named @file{crt0.o}.
33106 Process the @code{endfile} spec. This is a spec string that specifies
33107 the last object files that are passed to the linker.
33110 Process the @code{cpp} spec. This is used to construct the arguments
33111 to be passed to the C preprocessor.
33114 Process the @code{cc1} spec. This is used to construct the options to be
33115 passed to the actual C compiler (@command{cc1}).
33118 Process the @code{cc1plus} spec. This is used to construct the options to be
33119 passed to the actual C++ compiler (@command{cc1plus}).
33122 Substitute the variable part of a matched option. See below.
33123 Note that each comma in the substituted string is replaced by
33127 Remove all occurrences of @code{-S} from the command line. Note---this
33128 command is position dependent. @samp{%} commands in the spec string
33129 before this one see @code{-S}, @samp{%} commands in the spec string
33130 after this one do not.
33133 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
33136 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
33138 @item %:@var{function}(@var{args})
33139 Call the named function @var{function}, passing it @var{args}.
33140 @var{args} is first processed as a nested spec string, then split
33141 into an argument vector in the usual fashion. The function returns
33142 a string which is processed as if it had appeared literally as part
33143 of the current spec.
33145 The following built-in spec functions are provided:
33148 @item @code{getenv}
33149 The @code{getenv} spec function takes two arguments: an environment
33150 variable name and a string. If the environment variable is not
33151 defined, a fatal error is issued. Otherwise, the return value is the
33152 value of the environment variable concatenated with the string. For
33153 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
33156 %:getenv(TOPDIR /include)
33159 expands to @file{/path/to/top/include}.
33161 @item @code{if-exists}
33162 The @code{if-exists} spec function takes one argument, an absolute
33163 pathname to a file. If the file exists, @code{if-exists} returns the
33164 pathname. Here is a small example of its usage:
33168 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
33171 @item @code{if-exists-else}
33172 The @code{if-exists-else} spec function is similar to the @code{if-exists}
33173 spec function, except that it takes two arguments. The first argument is
33174 an absolute pathname to a file. If the file exists, @code{if-exists-else}
33175 returns the pathname. If it does not exist, it returns the second argument.
33176 This way, @code{if-exists-else} can be used to select one file or another,
33177 based on the existence of the first. Here is a small example of its usage:
33181 crt0%O%s %:if-exists(crti%O%s) \
33182 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
33185 @item @code{if-exists-then-else}
33186 The @code{if-exists-then-else} spec function takes at least two arguments
33187 and an optional third one. The first argument is an absolute pathname to a
33188 file. If the file exists, the function returns the second argument.
33189 If the file does not exist, the function returns the third argument if there
33190 is one, or NULL otherwise. This can be used to expand one text, or optionally
33191 another, based on the existence of a file. Here is a small example of its
33195 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
33198 @item @code{sanitize}
33199 The @code{sanitize} spec function takes no arguments. It returns non-NULL if
33200 any address, thread or undefined behavior sanitizers are active.
33203 %@{%:sanitize(address):-funwind-tables@}
33206 @item @code{replace-outfile}
33207 The @code{replace-outfile} spec function takes two arguments. It looks for the
33208 first argument in the outfiles array and replaces it with the second argument. Here
33209 is a small example of its usage:
33212 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
33215 @item @code{remove-outfile}
33216 The @code{remove-outfile} spec function takes one argument. It looks for the
33217 first argument in the outfiles array and removes it. Here is a small example
33221 %:remove-outfile(-lm)
33224 @item @code{version-compare}
33225 The @code{version-compare} spec function takes four or five arguments of the following
33229 <comparison-op> <arg1> [<arg2>] <switch> <result>
33232 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
33233 The supported @code{comparison-op} values are:
33237 True if @code{switch} is a later (or same) version than @code{arg1}
33240 Opposite of @code{>=}
33243 True if @code{switch} is an earlier version than @code{arg1}
33246 Opposite of @code{<}
33249 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
33252 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
33255 If the @code{switch} is not present at all, the condition is false unless the first character
33256 of the @code{comparison-op} is @code{!}.
33259 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
33262 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
33265 @item @code{include}
33266 The @code{include} spec function behaves much like @code{%include}, with the advantage
33267 that it can be nested inside a spec and thus be conditionalized. It takes one argument,
33268 the filename, and looks for it in the startfile path. It always returns NULL.
33271 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
33274 @item @code{pass-through-libs}
33275 The @code{pass-through-libs} spec function takes any number of arguments. It
33276 finds any @option{-l} options and any non-options ending in @file{.a} (which it
33277 assumes are the names of linker input library archive files) and returns a
33278 result containing all the found arguments each prepended by
33279 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
33280 intended to be passed to the LTO linker plugin.
33283 %:pass-through-libs(%G %L %G)
33286 @item @code{print-asm-header}
33287 The @code{print-asm-header} function takes no arguments and simply
33288 prints a banner like:
33294 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
33297 It is used to separate compiler options from assembler options
33298 in the @option{--target-help} output.
33301 The @code{gt} spec function takes two or more arguments. It returns @code{""} (the
33302 empty string) if the second-to-last argument is greater than the last argument, and NULL
33303 otherwise. The following example inserts the @code{link_gomp} spec if the last
33304 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
33307 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
33310 @item @code{debug-level-gt}
33311 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
33312 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
33316 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
33321 Substitutes the @code{-S} switch, if that switch is given to GCC@.
33322 If that switch is not specified, this substitutes nothing. Note that
33323 the leading dash is omitted when specifying this option, and it is
33324 automatically inserted if the substitution is performed. Thus the spec
33325 string @samp{%@{foo@}} matches the command-line option @option{-foo}
33326 and outputs the command-line option @option{-foo}.
33329 Like %@{@code{S}@} but mark last argument supplied within as a file to be
33330 deleted on failure.
33333 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
33334 @code{@@FILE} if an @code{@@file} argument has been supplied.
33337 Substitutes all the switches specified to GCC whose names start
33338 with @code{-S}, but which also take an argument. This is used for
33339 switches like @option{-o}, @option{-D}, @option{-I}, etc.
33340 GCC considers @option{-o foo} as being
33341 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
33342 text, including the space. Thus two arguments are generated.
33345 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
33346 (the order of @code{S} and @code{T} in the spec is not significant).
33347 There can be any number of ampersand-separated variables; for each the
33348 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
33351 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
33354 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
33357 Substitutes @code{X} if one or more switches whose names start with
33358 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
33359 once, no matter how many such switches appeared. However, if @code{%*}
33360 appears somewhere in @code{X}, then @code{X} is substituted once
33361 for each matching switch, with the @code{%*} replaced by the part of
33362 that switch matching the @code{*}.
33364 If @code{%*} appears as the last part of a spec sequence then a space
33365 is added after the end of the last substitution. If there is more
33366 text in the sequence, however, then a space is not generated. This
33367 allows the @code{%*} substitution to be used as part of a larger
33368 string. For example, a spec string like this:
33371 %@{mcu=*:--script=%*/memory.ld@}
33375 when matching an option like @option{-mcu=newchip} produces:
33378 --script=newchip/memory.ld
33382 Substitutes @code{X}, if processing a file with suffix @code{S}.
33385 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
33388 Substitutes @code{X}, if processing a file for language @code{S}.
33391 Substitutes @code{X}, if not processing a file for language @code{S}.
33394 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
33395 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
33396 @code{*} sequences as well, although they have a stronger binding than
33397 the @samp{|}. If @code{%*} appears in @code{X}, all of the
33398 alternatives must be starred, and only the first matching alternative
33401 For example, a spec string like this:
33404 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
33408 outputs the following command-line options from the following input
33409 command-line options:
33414 -d fred.c -foo -baz -boggle
33415 -d jim.d -bar -baz -boggle
33418 @item %@{%:@var{function}(@var{args}):X@}
33420 Call function named @var{function} with args @var{args}. If the
33421 function returns non-NULL, then @code{X} is substituted, if it returns
33422 NULL, it isn't substituted.
33424 @item %@{S:X; T:Y; :D@}
33426 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
33427 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
33428 be as many clauses as you need. This may be combined with @code{.},
33429 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
33434 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
33435 or similar construct can use a backslash to ignore the special meaning
33436 of the character following it, thus allowing literal matching of a
33437 character that is otherwise specially treated. For example,
33438 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
33439 @option{-std=iso9899:1999} option is given.
33441 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
33442 construct may contain other nested @samp{%} constructs or spaces, or
33443 even newlines. They are processed as usual, as described above.
33444 Trailing white space in @code{X} is ignored. White space may also
33445 appear anywhere on the left side of the colon in these constructs,
33446 except between @code{.} or @code{*} and the corresponding word.
33448 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
33449 handled specifically in these constructs. If another value of
33450 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
33451 @option{-W} switch is found later in the command line, the earlier
33452 switch value is ignored, except with @{@code{S}*@} where @code{S} is
33453 just one letter, which passes all matching options.
33455 The character @samp{|} at the beginning of the predicate text is used to
33456 indicate that a command should be piped to the following command, but
33457 only if @option{-pipe} is specified.
33459 It is built into GCC which switches take arguments and which do not.
33460 (You might think it would be useful to generalize this to allow each
33461 compiler's spec to say which switches take arguments. But this cannot
33462 be done in a consistent fashion. GCC cannot even decide which input
33463 files have been specified without knowing which switches take arguments,
33464 and it must know which input files to compile in order to tell which
33467 GCC also knows implicitly that arguments starting in @option{-l} are to be
33468 treated as compiler output files, and passed to the linker in their
33469 proper position among the other output files.
33471 @node Environment Variables
33472 @section Environment Variables Affecting GCC
33473 @cindex environment variables
33475 @c man begin ENVIRONMENT
33476 This section describes several environment variables that affect how GCC
33477 operates. Some of them work by specifying directories or prefixes to use
33478 when searching for various kinds of files. Some are used to specify other
33479 aspects of the compilation environment.
33481 Note that you can also specify places to search using options such as
33482 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
33483 take precedence over places specified using environment variables, which
33484 in turn take precedence over those specified by the configuration of GCC@.
33485 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
33486 GNU Compiler Collection (GCC) Internals}.
33491 @c @itemx LC_COLLATE
33493 @c @itemx LC_MONETARY
33494 @c @itemx LC_NUMERIC
33499 @c @findex LC_COLLATE
33500 @findex LC_MESSAGES
33501 @c @findex LC_MONETARY
33502 @c @findex LC_NUMERIC
33506 These environment variables control the way that GCC uses
33507 localization information which allows GCC to work with different
33508 national conventions. GCC inspects the locale categories
33509 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
33510 so. These locale categories can be set to any value supported by your
33511 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
33512 Kingdom encoded in UTF-8.
33514 The @env{LC_CTYPE} environment variable specifies character
33515 classification. GCC uses it to determine the character boundaries in
33516 a string; this is needed for some multibyte encodings that contain quote
33517 and escape characters that are otherwise interpreted as a string
33520 The @env{LC_MESSAGES} environment variable specifies the language to
33521 use in diagnostic messages.
33523 If the @env{LC_ALL} environment variable is set, it overrides the value
33524 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
33525 and @env{LC_MESSAGES} default to the value of the @env{LANG}
33526 environment variable. If none of these variables are set, GCC
33527 defaults to traditional C English behavior.
33531 If @env{TMPDIR} is set, it specifies the directory to use for temporary
33532 files. GCC uses temporary files to hold the output of one stage of
33533 compilation which is to be used as input to the next stage: for example,
33534 the output of the preprocessor, which is the input to the compiler
33537 @item GCC_COMPARE_DEBUG
33538 @findex GCC_COMPARE_DEBUG
33539 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
33540 @option{-fcompare-debug} to the compiler driver. See the documentation
33541 of this option for more details.
33543 @item GCC_EXEC_PREFIX
33544 @findex GCC_EXEC_PREFIX
33545 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
33546 names of the subprograms executed by the compiler. No slash is added
33547 when this prefix is combined with the name of a subprogram, but you can
33548 specify a prefix that ends with a slash if you wish.
33550 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
33551 an appropriate prefix to use based on the pathname it is invoked with.
33553 If GCC cannot find the subprogram using the specified prefix, it
33554 tries looking in the usual places for the subprogram.
33556 The default value of @env{GCC_EXEC_PREFIX} is
33557 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
33558 the installed compiler. In many cases @var{prefix} is the value
33559 of @code{prefix} when you ran the @file{configure} script.
33561 Other prefixes specified with @option{-B} take precedence over this prefix.
33563 This prefix is also used for finding files such as @file{crt0.o} that are
33566 In addition, the prefix is used in an unusual way in finding the
33567 directories to search for header files. For each of the standard
33568 directories whose name normally begins with @samp{/usr/local/lib/gcc}
33569 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
33570 replacing that beginning with the specified prefix to produce an
33571 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
33572 @file{foo/bar} just before it searches the standard directory
33573 @file{/usr/local/lib/bar}.
33574 If a standard directory begins with the configured
33575 @var{prefix} then the value of @var{prefix} is replaced by
33576 @env{GCC_EXEC_PREFIX} when looking for header files.
33578 @item COMPILER_PATH
33579 @findex COMPILER_PATH
33580 The value of @env{COMPILER_PATH} is a colon-separated list of
33581 directories, much like @env{PATH}. GCC tries the directories thus
33582 specified when searching for subprograms, if it cannot find the
33583 subprograms using @env{GCC_EXEC_PREFIX}.
33586 @findex LIBRARY_PATH
33587 The value of @env{LIBRARY_PATH} is a colon-separated list of
33588 directories, much like @env{PATH}. When configured as a native compiler,
33589 GCC tries the directories thus specified when searching for special
33590 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
33591 using GCC also uses these directories when searching for ordinary
33592 libraries for the @option{-l} option (but directories specified with
33593 @option{-L} come first).
33597 @cindex locale definition
33598 This variable is used to pass locale information to the compiler. One way in
33599 which this information is used is to determine the character set to be used
33600 when character literals, string literals and comments are parsed in C and C++.
33601 When the compiler is configured to allow multibyte characters,
33602 the following values for @env{LANG} are recognized:
33606 Recognize JIS characters.
33608 Recognize SJIS characters.
33610 Recognize EUCJP characters.
33613 If @env{LANG} is not defined, or if it has some other value, then the
33614 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
33615 recognize and translate multibyte characters.
33617 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
33618 @findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
33619 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
33620 then additional text will be emitted to stderr when fix-it hints are
33621 emitted. @option{-fdiagnostics-parseable-fixits} and
33622 @option{-fno-diagnostics-parseable-fixits} take precedence over this
33623 environment variable.
33627 Emit parseable fix-it hints, equivalent to
33628 @option{-fdiagnostics-parseable-fixits}. In particular, columns are
33629 expressed as a count of bytes, starting at byte 1 for the initial column.
33632 As @code{fixits-v1}, but columns are expressed as display columns,
33633 as per @option{-fdiagnostics-column-unit=display}.
33639 Some additional environment variables affect the behavior of the
33642 @include cppenv.texi
33646 @node Precompiled Headers
33647 @section Using Precompiled Headers
33648 @cindex precompiled headers
33649 @cindex speed of compilation
33651 Often large projects have many header files that are included in every
33652 source file. The time the compiler takes to process these header files
33653 over and over again can account for nearly all of the time required to
33654 build the project. To make builds faster, GCC allows you to
33655 @dfn{precompile} a header file.
33657 To create a precompiled header file, simply compile it as you would any
33658 other file, if necessary using the @option{-x} option to make the driver
33659 treat it as a C or C++ header file. You may want to use a
33660 tool like @command{make} to keep the precompiled header up-to-date when
33661 the headers it contains change.
33663 A precompiled header file is searched for when @code{#include} is
33664 seen in the compilation. As it searches for the included file
33665 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
33666 compiler looks for a precompiled header in each directory just before it
33667 looks for the include file in that directory. The name searched for is
33668 the name specified in the @code{#include} with @samp{.gch} appended. If
33669 the precompiled header file cannot be used, it is ignored.
33671 For instance, if you have @code{#include "all.h"}, and you have
33672 @file{all.h.gch} in the same directory as @file{all.h}, then the
33673 precompiled header file is used if possible, and the original
33674 header is used otherwise.
33676 Alternatively, you might decide to put the precompiled header file in a
33677 directory and use @option{-I} to ensure that directory is searched
33678 before (or instead of) the directory containing the original header.
33679 Then, if you want to check that the precompiled header file is always
33680 used, you can put a file of the same name as the original header in this
33681 directory containing an @code{#error} command.
33683 This also works with @option{-include}. So yet another way to use
33684 precompiled headers, good for projects not designed with precompiled
33685 header files in mind, is to simply take most of the header files used by
33686 a project, include them from another header file, precompile that header
33687 file, and @option{-include} the precompiled header. If the header files
33688 have guards against multiple inclusion, they are skipped because
33689 they've already been included (in the precompiled header).
33691 If you need to precompile the same header file for different
33692 languages, targets, or compiler options, you can instead make a
33693 @emph{directory} named like @file{all.h.gch}, and put each precompiled
33694 header in the directory, perhaps using @option{-o}. It doesn't matter
33695 what you call the files in the directory; every precompiled header in
33696 the directory is considered. The first precompiled header
33697 encountered in the directory that is valid for this compilation is
33698 used; they're searched in no particular order.
33700 There are many other possibilities, limited only by your imagination,
33701 good sense, and the constraints of your build system.
33703 A precompiled header file can be used only when these conditions apply:
33707 Only one precompiled header can be used in a particular compilation.
33710 A precompiled header cannot be used once the first C token is seen. You
33711 can have preprocessor directives before a precompiled header; you cannot
33712 include a precompiled header from inside another header.
33715 The precompiled header file must be produced for the same language as
33716 the current compilation. You cannot use a C precompiled header for a C++
33720 The precompiled header file must have been produced by the same compiler
33721 binary as the current compilation is using.
33724 Any macros defined before the precompiled header is included must
33725 either be defined in the same way as when the precompiled header was
33726 generated, or must not affect the precompiled header, which usually
33727 means that they don't appear in the precompiled header at all.
33729 The @option{-D} option is one way to define a macro before a
33730 precompiled header is included; using a @code{#define} can also do it.
33731 There are also some options that define macros implicitly, like
33732 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
33735 @item If debugging information is output when using the precompiled
33736 header, using @option{-g} or similar, the same kind of debugging information
33737 must have been output when building the precompiled header. However,
33738 a precompiled header built using @option{-g} can be used in a compilation
33739 when no debugging information is being output.
33741 @item The same @option{-m} options must generally be used when building
33742 and using the precompiled header. @xref{Submodel Options},
33743 for any cases where this rule is relaxed.
33745 @item Each of the following options must be the same when building and using
33746 the precompiled header:
33748 @gccoptlist{-fexceptions}
33751 Some other command-line options starting with @option{-f},
33752 @option{-p}, or @option{-O} must be defined in the same way as when
33753 the precompiled header was generated. At present, it's not clear
33754 which options are safe to change and which are not; the safest choice
33755 is to use exactly the same options when generating and using the
33756 precompiled header. The following are known to be safe:
33758 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
33759 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
33760 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
33763 @item Address space layout randomization (ASLR) can lead to not binary identical
33764 PCH files. If you rely on stable PCH file contents disable ASLR when generating
33769 For all of these except the last, the compiler automatically
33770 ignores the precompiled header if the conditions aren't met. If you
33771 find an option combination that doesn't work and doesn't cause the
33772 precompiled header to be ignored, please consider filing a bug report,
33775 If you do use differing options when generating and using the
33776 precompiled header, the actual behavior is a mixture of the
33777 behavior for the options. For instance, if you use @option{-g} to
33778 generate the precompiled header but not when using it, you may or may
33779 not get debugging information for routines in the precompiled header.
33782 @section C++ Modules
33783 @cindex speed of compilation
33785 Modules are a C++20 language feature. As the name suggests, they
33786 provides a modular compilation system, intending to provide both
33787 faster builds and better library isolation. The ``Merging Modules''
33788 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
33789 of changes to the standard, although it does not capture later
33790 changes. That specification is now part of C++20,
33791 @uref{git@@github.com:cplusplus/draft.git}, it is considered complete
33792 (there may be defect reports to come).
33794 @emph{G++'s modules support is not complete.} Other than bugs, the
33795 known missing pieces are:
33799 @item Private Module Fragment
33800 The Private Module Fragment is recognized, but an error is emitted.
33802 @item Partition definition visibility rules
33803 Entities may be defined in implementation partitions, and those
33804 definitions are not available outside of the module. This is not
33805 implemented, and the definitions are available to extra-module use.
33807 @item Textual merging of reachable GM entities
33808 Entities may be multiply defined across different header-units.
33809 These must be de-duplicated, and this is implemented across imports,
33810 or when an import redefines a textually-defined entity. However the
33811 reverse is not implemented---textually redefining an entity that has
33812 been defined in an imported header-unit. A redefinition error is
33815 @item Translation-Unit local referencing rules
33816 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
33817 (@uref{https://wg21.link/p2003}) add limitations on which entities an
33818 exported region may reference (for instance, the entities an exported
33819 template definition may reference). These are not fully implemented.
33821 @item Language-linkage module attachment
33822 Declarations with explicit language linkage (@code{extern "C"} or
33823 @code{extern "C++"}) are attached to the global module, even when in
33824 the purview of a named module. This is not implemented. Such
33825 declarations will be attached to the module, if any, in which they are
33828 @item Standard Library Header Units
33829 The Standard Library is not provided as importable header units. If
33830 you want to import such units, you must explicitly build them first.
33831 If you do not do this with care, you may have multiple declarations,
33832 which the module machinery must merge---compiler resource usage can be
33833 affected by how you partition header files into header units.
33837 Modular compilation is @emph{not} enabled with just the
33838 @option{-std=c++20} option. You must explicitly enable it with the
33839 @option{-fmodules-ts} option. It is independent of the language
33840 version selected, although in pre-C++20 versions, it is of course an
33843 No new source file suffixes are required or supported. If you wish to
33844 use a non-standard suffix (@pxref{Overall Options}), you also need
33845 to provide a @option{-x c++} option too.@footnote{Some users like to
33846 distinguish module interface files with a new suffix, such as naming
33847 the source @code{module.cppm}, which involves
33848 teaching all tools about the new suffix. A different scheme, such as
33849 naming @code{module-m.cpp} would be less invasive.}
33851 Compiling a module interface unit produces an additional output (to
33852 the assembly or object file), called a Compiled Module Interface
33853 (CMI). This encodes the exported declarations of the module.
33854 Importing a module reads in the CMI. The import graph is a Directed
33855 Acyclic Graph (DAG). You must build imports before the importer.
33857 Header files may themselves be compiled to header units, which are a
33858 transitional ability aiming at faster compilation. The
33859 @option{-fmodule-header} option is used to enable this, and implies
33860 the @option{-fmodules-ts} option. These CMIs are named by the fully
33861 resolved underlying header file, and thus may be a complete pathname
33862 containing subdirectories. If the header file is found at an absolute
33863 pathname, the CMI location is still relative to a CMI root directory.
33865 As header files often have no suffix, you commonly have to specify a
33866 @option{-x} option to tell the compiler the source is a header file.
33867 You may use @option{-x c++-header}, @option{-x c++-user-header} or
33868 @option{-x c++-system-header}. When used in conjunction with
33869 @option{-fmodules-ts}, these all imply an appropriate
33870 @option{-fmodule-header} option. The latter two variants use the
33871 user or system include path to search for the file specified. This
33872 allows you to, for instance, compile standard library header files as
33873 header units, without needing to know exactly where they are
33874 installed. Specifying the language as one of these variants also
33875 inhibits output of the object file, as header files have no associated
33878 The @option{-fmodule-only} option disables generation of the
33879 associated object file for compiling a module interface. Only the CMI
33880 is generated. This option is implied when using the
33881 @option{-fmodule-header} option.
33883 The @option{-flang-info-include-translate} and
33884 @option{-flang-info-include-translate-not} options notes whether
33885 include translation occurs or not. With no argument, the first will
33886 note all include translation. The second will note all
33887 non-translations of include files not known to intentionally be
33888 textual. With an argument, queries about include translation of a
33889 header files with that particular trailing pathname are noted. You
33890 may repeat this form to cover several different header files. This
33891 option may be helpful in determining whether include translation is
33892 happening---if it is working correctly, it behaves as if it isn't
33895 The @option{-flang-info-module-cmi} option can be used to determine
33896 where the compiler is reading a CMI from. Without the option, the
33897 compiler is silent when such a read is successful. This option has an
33898 optional argument, which will restrict the notification to just the
33899 set of named modules or header units specified.
33901 The @option{-Winvalid-imported-macros} option causes all imported macros
33902 to be resolved at the end of compilation. Without this, imported
33903 macros are only resolved when expanded or (re)defined. This option
33904 detects conflicting import definitions for all macros.
33906 For details of the @option{-fmodule-mapper} family of options,
33907 @pxref{C++ Module Mapper}.
33910 * C++ Module Mapper:: Module Mapper
33911 * C++ Module Preprocessing:: Module Preprocessing
33912 * C++ Compiled Module Interface:: Compiled Module Interface
33915 @node C++ Module Mapper
33916 @subsection Module Mapper
33917 @cindex C++ Module Mapper
33919 A module mapper provides a server or file that the compiler queries to
33920 determine the mapping between module names and CMI files. It is also
33921 used to build CMIs on demand. @emph{Mapper functionality is in its
33922 infancy and is intended for experimentation with build system
33925 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
33926 option or @env{CXX_MODULE_MAPPER} environment variable. The value may
33927 have one of the following forms:
33931 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
33932 An optional hostname and a numeric port number to connect to. If the
33933 hostname is omitted, the loopback address is used. If the hostname
33934 corresponds to multiple IPV6 addresses, these are tried in turn, until
33935 one is successful. If your host lacks IPv6, this form is
33936 non-functional. If you must use IPv4 use
33937 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
33939 @item =@var{socket}@r{[}?@var{ident}@r{]}
33940 A local domain socket. If your host lacks local domain sockets, this
33941 form is non-functional.
33943 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
33944 A program to spawn, and communicate with on its stdin/stdout streams.
33945 Your @var{PATH} environment variable is searched for the program.
33946 Arguments are separated by space characters, (it is not possible for
33947 one of the arguments delivered to the program to contain a space). An
33948 exception is if @var{program} begins with @@. In that case
33949 @var{program} (sans @@) is looked for in the compiler's internal
33950 binary directory. Thus the sample mapper-server can be specified
33951 with @code{@@g++-mapper-server}.
33953 @item <>@r{[}?@var{ident}@r{]}
33954 @item <>@var{inout}@r{[}?@var{ident}@r{]}
33955 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
33956 Named pipes or file descriptors to communicate over. The first form,
33957 @option{<>}, communicates over stdin and stdout. The other forms
33958 allow you to specify a file descriptor or name a pipe. A numeric value
33959 is interpreted as a file descriptor, otherwise named pipe is opened.
33960 The second form specifies a bidirectional pipe and the last form
33961 allows specifying two independent pipes. Using file descriptors
33962 directly in this manner is fragile in general, as it can require the
33963 cooperation of intermediate processes. In particular using stdin &
33964 stdout is fraught with danger as other compiler options might also
33965 cause the compiler to read stdin or write stdout, and it can have
33966 unfortunate interactions with signal delivery from the terminal.
33968 @item @var{file}@r{[}?@var{ident}@r{]}
33969 A mapping file consisting of space-separated module-name, filename
33970 pairs, one per line. Only the mappings for the direct imports and any
33971 module export name need be provided. If other mappings are provided,
33972 they override those stored in any imported CMI files. A repository
33973 root may be specified in the mapping file by using @samp{$root} as the
33974 module name in the first active line. Use of this option will disable
33975 any default module->CMI name mapping.
33979 As shown, an optional @var{ident} may suffix the first word of the
33980 option, indicated by a @samp{?} prefix. The value is used in the
33981 initial handshake with the module server, or to specify a prefix on
33982 mapping file lines. In the server case, the main source file name is
33983 used if no @var{ident} is specified. In the file case, all non-blank
33984 lines are significant, unless a value is specified, in which case only
33985 lines beginning with @var{ident} are significant. The @var{ident}
33986 must be separated by whitespace from the module name. Be aware that
33987 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
33988 significant to the shell, and therefore may need quoting.
33990 The mapper is connected to or loaded lazily, when the first module
33991 mapping is required. The networking protocols are only supported on
33992 hosts that provide networking. If no mapper is specified a default is
33995 A project-specific mapper is expected to be provided by the build
33996 system that invokes the compiler. It is not expected that a
33997 general-purpose server is provided for all compilations. As such, the
33998 server will know the build configuration, the compiler it invoked, and
33999 the environment (such as working directory) in which that is
34000 operating. As it may parallelize builds, several compilations may
34001 connect to the same socket.
34003 The default mapper generates CMI files in a @samp{gcm.cache}
34004 directory. CMI files have a @samp{.gcm} suffix. The module unit name
34005 is used directly to provide the basename. Header units construct a
34006 relative path using the underlying header file name. If the path is
34007 already relative, a @samp{,} directory is prepended. Internal
34008 @samp{..} components are translated to @samp{,,}. No attempt is made
34009 to canonicalize these filenames beyond that done by the preprocessor's
34010 include search algorithm, as in general it is ambiguous when symbolic
34013 The mapper protocol was published as ``A Module Mapper''
34014 @uref{https://wg21.link/p1184}. The implementation is provided by
34015 @command{libcody}, @uref{https://github.com/urnathan/libcody},
34016 which specifies the canonical protocol definition. A proof of concept
34017 server implementation embedded in @command{make} was described in
34018 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
34020 @node C++ Module Preprocessing
34021 @subsection Module Preprocessing
34022 @cindex C++ Module Preprocessing
34024 Modules affect preprocessing because of header units and include
34025 translation. Some uses of the preprocessor as a separate step either
34026 do not produce a correct output, or require CMIs to be available.
34028 Header units import macros. These macros can affect later conditional
34029 inclusion, which therefore can cascade to differing import sets. When
34030 preprocessing, it is necessary to load the CMI. If a header unit is
34031 unavailable, the preprocessor issues a warning and continue (when
34032 not just preprocessing, an error is emitted). Detecting such imports
34033 requires preprocessor tokenization of the input stream to phase 4
34036 Include translation converts @code{#include}, @code{#include_next} and
34037 @code{#import} directives to internal @code{import} declarations.
34038 Whether a particular directive is translated is controlled by the
34039 module mapper. Header unit names are canonicalized during
34042 Dependency information can be emitted for macro import, extending the
34043 functionality of @option{-MD} and @option{-MMD} options. Detection of
34044 import declarations also requires phase 4 preprocessing, and thus
34045 requires full preprocessing (or compilation).
34047 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
34048 preprocessing before phase 4.
34050 The @option{-save-temps} option uses @option{-fdirectives-only} for
34051 preprocessing, and preserve the macro definitions in the preprocessed
34052 output. Usually you also want to use this option when explicitly
34053 preprocessing a header-unit, or consuming such preprocessed output:
34056 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
34057 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
34060 @node C++ Compiled Module Interface
34061 @subsection Compiled Module Interface
34062 @cindex C++ Compiled Module Interface
34064 CMIs are an additional artifact when compiling named module
34065 interfaces, partitions or header units. These are read when
34066 importing. CMI contents are implementation-specific, and in GCC's
34067 case tied to the compiler version. Consider them a rebuildable cache
34068 artifact, not a distributable object.
34070 When creating an output CMI, any missing directory components are
34071 created in a manner that is safe for concurrent builds creating
34072 multiple, different, CMIs within a common subdirectory tree.
34074 CMI contents are written to a temporary file, which is then atomically
34075 renamed. Observers either see old contents (if there is an
34076 existing file), or complete new contents. They do not observe the
34077 CMI during its creation. This is unlike object file writing, which
34078 may be observed by an external process.
34080 CMIs are read in lazily, if the host OS provides @code{mmap}
34081 functionality. Generally blocks are read when name lookup or template
34082 instantiation occurs. To inhibit this, the @option{-fno-module-lazy}
34083 option may be used.
34085 The @option{--param lazy-modules=@var{n}} parameter controls the limit
34086 on the number of concurrently open module files during lazy loading.
34087 Should more modules be imported, an LRU algorithm is used to determine
34088 which files to close---until that file is needed again. This limit
34089 may be exceeded with deep module dependency hierarchies. With large
34090 code bases there may be more imports than the process limit of file
34091 descriptors. By default, the limit is a few less than the per-process
34092 file descriptor hard limit, if that is determinable.@footnote{Where
34093 applicable the soft limit is incremented as needed towards the hard limit.}
34095 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
34096 You may use @command{readelf} to inspect them, although section
34097 contents are largely undecipherable. There is a section named
34098 @code{.gnu.c++.README}, which contains human-readable text. Other
34099 than the first line, each line consists of @code{@var{tag}: @code{value}}
34103 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
34105 String dump of section '.gnu.c++.README':
34106 [ 0] GNU C++ primary module interface
34107 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
34108 [ 6f] version: 2020/11/16-04:54
34110 [ 95] source: c_b.ii
34111 [ a4] dialect: C++20/coroutines
34112 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc
34113 [ ee] repository: gcm.cache
34114 [ 104] buildtime: 2020/11/16 15:03:21 UTC
34115 [ 127] localtime: 2020/11/16 07:03:21 PST
34116 [ 14a] export: foo:part1 foo-part1.gcm
34119 Amongst other things, this lists the source that was built, C++
34120 dialect used and imports of the module.@footnote{The precise contents
34121 of this output may change.} The timestamp is the same value as that
34122 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
34123 explicitly specified with the environment variable
34124 @code{SOURCE_DATE_EPOCH}. For further details
34125 @pxref{Environment Variables}.
34127 A set of related CMIs may be copied, provided the relative pathnames
34130 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
34131 it may be removed or altered. The section numbering of the sections
34132 whose names do not begin with @code{.gnu.c++.}, or are not the string
34133 section is significant and must not be altered.