c++: change -fconcepts to mean C++20 concepts
[official-gcc.git] / gcc / doc / invoke.texi
blob2b29db831aee04c4e118c485ebf56ddf4427e13d
1 @c Copyright (C) 1988-2022 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2022 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:
23      A GNU Manual
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.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
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}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{https://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
63 @node Invoking 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
107 -v}}.
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.
139 @c man end
141 @xref{Option Index}, for an index to GCC's options.
143 @menu
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
152                         and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154                         be formatted.
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
167                         and register usage.
168 * Developer Options::   Printing GCC configuration info, statistics, and
169                         debugging dumps.
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.
176 @end menu
178 @c man begin OPTIONS
180 @node Option Summary
181 @section Option Summary
183 Here is a summary of all the options, grouped by type.  Explanations are
184 in the following sections.
186 @table @emph
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 -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 -fstrict-flex-arrays[=@var{n}] @gol
211 -fsso-struct=@var{endianness}}
213 @item C++ Language Options
214 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
215 @gccoptlist{-fabi-version=@var{n}  -fno-access-control @gol
216 -faligned-new=@var{n}  -fargs-in-order=@var{n}  -fchar8_t  -fcheck-new @gol
217 -fconstexpr-depth=@var{n}  -fconstexpr-cache-depth=@var{n} @gol
218 -fconstexpr-loop-limit=@var{n}  -fconstexpr-ops-limit=@var{n} @gol
219 -fno-elide-constructors @gol
220 -fno-enforce-eh-specs @gol
221 -fno-gnu-keywords @gol
222 -fno-implicit-templates @gol
223 -fno-implicit-inline-templates @gol
224 -fno-implement-inlines  @gol
225 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts @gol
226 -fmodule-implicit-inline @gol
227 -fno-module-lazy @gol
228 -fmodule-mapper=@var{specification} @gol
229 -fmodule-version-ignore @gol
230 -fms-extensions @gol
231 -fnew-inheriting-ctors @gol
232 -fnew-ttp-matching @gol
233 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names @gol
234 -fno-optional-diags  -fpermissive @gol
235 -fno-pretty-templates @gol
236 -fno-rtti  -fsized-deallocation @gol
237 -ftemplate-backtrace-limit=@var{n} @gol
238 -ftemplate-depth=@var{n} @gol
239 -fno-threadsafe-statics  -fuse-cxa-atexit @gol
240 -fno-weak  -nostdinc++ @gol
241 -fvisibility-inlines-hidden @gol
242 -fvisibility-ms-compat @gol
243 -fext-numeric-literals @gol
244 -flang-info-include-translate@r{[}=@var{header}@r{]} @gol
245 -flang-info-include-translate-not @gol
246 -flang-info-module-cmi@r{[}=@var{module}@r{]} @gol
247 -stdlib=@var{libstdc++,libc++} @gol
248 -Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n} @gol
249 -Wno-class-conversion  -Wclass-memaccess @gol
250 -Wcomma-subscript  -Wconditionally-supported @gol
251 -Wno-conversion-null  -Wctad-maybe-unsupported @gol
252 -Wctor-dtor-privacy  -Wdangling-reference @gol
253 -Wno-delete-incomplete @gol
254 -Wdelete-non-virtual-dtor  -Wno-deprecated-array-compare @gol
255 -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
256 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol
257 -Weffc++  -Wno-exceptions -Wextra-semi  -Wno-inaccessible-base @gol
258 -Wno-inherited-variadic-ctor  -Wno-init-list-lifetime @gol
259 -Winvalid-imported-macros @gol
260 -Wno-invalid-offsetof  -Wno-literal-suffix @gol
261 -Wmismatched-new-delete -Wmismatched-tags @gol
262 -Wmultiple-inheritance  -Wnamespaces  -Wnarrowing @gol
263 -Wnoexcept  -Wnoexcept-type  -Wnon-virtual-dtor @gol
264 -Wpessimizing-move  -Wno-placement-new  -Wplacement-new=@var{n} @gol
265 -Wrange-loop-construct -Wredundant-move -Wredundant-tags @gol
266 -Wreorder  -Wregister @gol
267 -Wstrict-null-sentinel  -Wno-subobject-linkage  -Wtemplates @gol
268 -Wno-non-template-friend  -Wold-style-cast @gol
269 -Woverloaded-virtual  -Wno-pmf-conversions -Wself-move -Wsign-promo @gol
270 -Wsized-deallocation  -Wsuggest-final-methods @gol
271 -Wsuggest-final-types  -Wsuggest-override  @gol
272 -Wno-terminate  -Wuseless-cast  -Wno-vexing-parse  @gol
273 -Wvirtual-inheritance  @gol
274 -Wno-virtual-move-assign  -Wvolatile  -Wzero-as-null-pointer-constant}
276 @item Objective-C and Objective-C++ Language Options
277 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
278 Objective-C and Objective-C++ Dialects}.
279 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
280 -fgnu-runtime  -fnext-runtime @gol
281 -fno-nil-receivers @gol
282 -fobjc-abi-version=@var{n} @gol
283 -fobjc-call-cxx-cdtors @gol
284 -fobjc-direct-dispatch @gol
285 -fobjc-exceptions @gol
286 -fobjc-gc @gol
287 -fobjc-nilcheck @gol
288 -fobjc-std=objc1 @gol
289 -fno-local-ivars @gol
290 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
291 -freplace-objc-classes @gol
292 -fzero-link @gol
293 -gen-decls @gol
294 -Wassign-intercept  -Wno-property-assign-default @gol
295 -Wno-protocol -Wobjc-root-class -Wselector @gol
296 -Wstrict-selector-match @gol
297 -Wundeclared-selector}
299 @item Diagnostic Message Formatting Options
300 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
301 @gccoptlist{-fmessage-length=@var{n}  @gol
302 -fdiagnostics-plain-output @gol
303 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
304 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
305 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
306 -fdiagnostics-format=@r{[}text@r{|}sarif-stderr@r{|}sarif-file@r{|}json@r{|}json-stderr@r{|}json-file@r{]}  @gol
307 -fno-diagnostics-show-option  -fno-diagnostics-show-caret @gol
308 -fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers @gol
309 -fno-diagnostics-show-cwe  @gol
310 -fno-diagnostics-show-rule  @gol
311 -fdiagnostics-minimum-margin-width=@var{width} @gol
312 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch @gol
313 -fdiagnostics-show-template-tree  -fno-elide-type @gol
314 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
315 -fdiagnostics-show-path-depths @gol
316 -fno-show-column @gol
317 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol
318 -fdiagnostics-column-origin=@var{origin} @gol
319 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}}
321 @item Warning Options
322 @xref{Warning Options,,Options to Request or Suppress Warnings}.
323 @gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic @gol
324 -pedantic-errors @gol
325 -w  -Wextra  -Wall  -Wabi=@var{n} @gol
326 -Waddress  -Wno-address-of-packed-member  -Waggregate-return @gol
327 -Walloc-size-larger-than=@var{byte-size}  -Walloc-zero @gol
328 -Walloca  -Walloca-larger-than=@var{byte-size} @gol
329 -Wno-aggressive-loop-optimizations @gol
330 -Warith-conversion @gol
331 -Warray-bounds  -Warray-bounds=@var{n}  -Warray-compare @gol
332 -Wno-attributes  -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
333 -Wno-attribute-warning  @gol
334 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]} @gol
335 -Wbool-compare  -Wbool-operation @gol
336 -Wno-builtin-declaration-mismatch @gol
337 -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat @gol
338 -Wc11-c2x-compat @gol
339 -Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat  @gol
340 -Wc++20-compat   @gol
341 -Wno-c++11-extensions  -Wno-c++14-extensions -Wno-c++17-extensions  @gol
342 -Wno-c++20-extensions  -Wno-c++23-extensions  @gol
343 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual  @gol
344 -Wchar-subscripts @gol
345 -Wclobbered  -Wcomment @gol
346 -Wconversion  -Wno-coverage-mismatch  -Wno-cpp @gol
347 -Wdangling-else  -Wdangling-pointer  -Wdangling-pointer=@var{n}  @gol
348 -Wdate-time @gol
349 -Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init @gol
350 -Wdisabled-optimization @gol
351 -Wno-discarded-array-qualifiers  -Wno-discarded-qualifiers @gol
352 -Wno-div-by-zero  -Wdouble-promotion @gol
353 -Wduplicated-branches  -Wduplicated-cond @gol
354 -Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion @gol
355 -Wenum-int-mismatch @gol
356 -Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors @gol
357 -Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2 @gol
358 -Wno-format-contains-nul  -Wno-format-extra-args  @gol
359 -Wformat-nonliteral  -Wformat-overflow=@var{n} @gol
360 -Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n} @gol
361 -Wformat-y2k  -Wframe-address @gol
362 -Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object @gol
363 -Wno-if-not-aligned  -Wno-ignored-attributes @gol
364 -Wignored-qualifiers  -Wno-incompatible-pointer-types @gol
365 -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n} @gol
366 -Wno-implicit-function-declaration  -Wno-implicit-int @gol
367 -Winfinite-recursion @gol
368 -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context @gol
369 -Wno-int-to-pointer-cast  -Wno-invalid-memory-model @gol
370 -Winvalid-pch  -Winvalid-utf8  -Wno-unicode  -Wjump-misses-init  @gol
371 -Wlarger-than=@var{byte-size}  -Wlogical-not-parentheses  -Wlogical-op  @gol
372 -Wlong-long  -Wno-lto-type-mismatch -Wmain  -Wmaybe-uninitialized @gol
373 -Wmemset-elt-size  -Wmemset-transposed-args @gol
374 -Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces @gol
375 -Wmissing-field-initializers  -Wmissing-format-attribute @gol
376 -Wmissing-include-dirs  -Wmissing-noreturn  -Wno-missing-profile @gol
377 -Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare @gol
378 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
379 -Wnull-dereference  -Wno-odr  @gol
380 -Wopenacc-parallelism  @gol
381 -Wopenmp-simd  @gol
382 -Wno-overflow  -Woverlength-strings  -Wno-override-init-side-effects @gol
383 -Wpacked  -Wno-packed-bitfield-compat  -Wpacked-not-aligned  -Wpadded @gol
384 -Wparentheses  -Wno-pedantic-ms-format @gol
385 -Wpointer-arith  -Wno-pointer-compare  -Wno-pointer-to-int-cast @gol
386 -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls @gol
387 -Wrestrict  -Wno-return-local-addr  -Wreturn-type @gol
388 -Wno-scalar-storage-order  -Wsequence-point @gol
389 -Wshadow  -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local @gol
390 -Wno-shadow-ivar @gol
391 -Wno-shift-count-negative  -Wno-shift-count-overflow  -Wshift-negative-value @gol
392 -Wno-shift-overflow  -Wshift-overflow=@var{n} @gol
393 -Wsign-compare  -Wsign-conversion @gol
394 -Wno-sizeof-array-argument @gol
395 -Wsizeof-array-div @gol
396 -Wsizeof-pointer-div  -Wsizeof-pointer-memaccess @gol
397 -Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing @gol
398 -Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n} @gol
399 -Wstring-compare @gol
400 -Wno-stringop-overflow -Wno-stringop-overread @gol
401 -Wno-stringop-truncation @gol
402 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
403 -Wswitch  -Wno-switch-bool  -Wswitch-default  -Wswitch-enum @gol
404 -Wno-switch-outside-range  -Wno-switch-unreachable  -Wsync-nand @gol
405 -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs @gol
406 -Wtrivial-auto-var-init -Wtsan -Wtype-limits  -Wundef @gol
407 -Wuninitialized  -Wunknown-pragmas @gol
408 -Wunsuffixed-float-constants  -Wunused @gol
409 -Wunused-but-set-parameter  -Wunused-but-set-variable @gol
410 -Wunused-const-variable  -Wunused-const-variable=@var{n} @gol
411 -Wunused-function  -Wunused-label  -Wunused-local-typedefs @gol
412 -Wunused-macros @gol
413 -Wunused-parameter  -Wno-unused-result @gol
414 -Wunused-value  -Wunused-variable @gol
415 -Wno-varargs  -Wvariadic-macros @gol
416 -Wvector-operation-performance @gol
417 -Wvla  -Wvla-larger-than=@var{byte-size}  -Wno-vla-larger-than @gol
418 -Wvolatile-register-var  -Wwrite-strings @gol
419 -Wxor-used-as-pow @gol
420 -Wzero-length-bounds}
422 @item Static Analyzer Options
423 @gccoptlist{
424 -fanalyzer @gol
425 -fanalyzer-call-summaries @gol
426 -fanalyzer-checker=@var{name} @gol
427 -fno-analyzer-feasibility @gol
428 -fanalyzer-fine-grained @gol
429 -fno-analyzer-state-merge @gol
430 -fno-analyzer-state-purge @gol
431 -fanalyzer-transitivity @gol
432 -fno-analyzer-undo-inlining @gol
433 -fanalyzer-verbose-edges @gol
434 -fanalyzer-verbose-state-changes @gol
435 -fanalyzer-verbosity=@var{level} @gol
436 -fdump-analyzer @gol
437 -fdump-analyzer-callgraph @gol
438 -fdump-analyzer-exploded-graph @gol
439 -fdump-analyzer-exploded-nodes @gol
440 -fdump-analyzer-exploded-nodes-2 @gol
441 -fdump-analyzer-exploded-nodes-3 @gol
442 -fdump-analyzer-exploded-paths @gol
443 -fdump-analyzer-feasibility @gol
444 -fdump-analyzer-json @gol
445 -fdump-analyzer-state-purge @gol
446 -fdump-analyzer-stderr @gol
447 -fdump-analyzer-supergraph @gol
448 -fdump-analyzer-untracked @gol
449 -Wno-analyzer-double-fclose @gol
450 -Wno-analyzer-double-free @gol
451 -Wno-analyzer-exposure-through-output-file @gol
452 -Wno-analyzer-exposure-through-uninit-copy @gol
453 -Wno-analyzer-fd-access-mode-mismatch @gol
454 -Wno-analyzer-fd-double-close @gol
455 -Wno-analyzer-fd-leak @gol
456 -Wno-analyzer-fd-use-after-close @gol
457 -Wno-analyzer-fd-use-without-check @gol
458 -Wno-analyzer-file-leak @gol
459 -Wno-analyzer-free-of-non-heap @gol
460 -Wno-analyzer-imprecise-fp-arithmetic @gol
461 -Wno-analyzer-jump-through-null @gol
462 -Wno-analyzer-malloc-leak @gol
463 -Wno-analyzer-mismatching-deallocation @gol
464 -Wno-analyzer-null-argument @gol
465 -Wno-analyzer-null-dereference @gol
466 -Wno-analyzer-out-of-bounds @gol
467 -Wno-analyzer-possible-null-argument @gol
468 -Wno-analyzer-possible-null-dereference @gol
469 -Wno-analyzer-putenv-of-auto-var @gol
470 -Wno-analyzer-shift-count-negative @gol
471 -Wno-analyzer-shift-count-overflow @gol
472 -Wno-analyzer-stale-setjmp-buffer @gol
473 -Wno-analyzer-tainted-allocation-size @gol
474 -Wno-analyzer-tainted-array-index @gol
475 -Wno-analyzer-tainted-divisor @gol
476 -Wno-analyzer-tainted-offset @gol
477 -Wno-analyzer-tainted-size @gol
478 -Wanalyzer-too-complex @gol
479 -Wno-analyzer-unsafe-call-within-signal-handler @gol
480 -Wno-analyzer-use-after-free @gol
481 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
482 -Wno-analyzer-use-of-uninitialized-value @gol
483 -Wno-analyzer-va-arg-type-mismatch @gol
484 -Wno-analyzer-va-list-exhausted @gol
485 -Wno-analyzer-va-list-leak @gol
486 -Wno-analyzer-va-list-use-after-va-end @gol
487 -Wno-analyzer-write-to-const @gol
488 -Wno-analyzer-write-to-string-literal @gol
491 @item C and Objective-C-only Warning Options
492 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
493 -Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
494 -Wold-style-declaration  -Wold-style-definition @gol
495 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
496 -Wdeclaration-after-statement  -Wpointer-sign}
498 @item Debugging Options
499 @xref{Debugging Options,,Options for Debugging Your Program}.
500 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version} @gol
501 -gbtf -gctf  -gctf@var{level} @gol
502 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
503 -gstrict-dwarf  -gno-strict-dwarf @gol
504 -gas-loc-support  -gno-as-loc-support @gol
505 -gas-locview-support  -gno-as-locview-support @gol
506 -gcolumn-info  -gno-column-info  -gdwarf32  -gdwarf64 @gol
507 -gstatement-frontiers  -gno-statement-frontiers @gol
508 -gvariable-location-views  -gno-variable-location-views @gol
509 -ginternal-reset-location-views  -gno-internal-reset-location-views @gol
510 -ginline-points  -gno-inline-points @gol
511 -gvms -gz@r{[}=@var{type}@r{]} @gol
512 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies @gol
513 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
514 -fno-eliminate-unused-debug-types @gol
515 -femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol
516 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
517 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
518 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
519 -fvar-tracking  -fvar-tracking-assignments}
521 @item Optimization Options
522 @xref{Optimize Options,,Options that Control Optimization}.
523 @gccoptlist{-faggressive-loop-optimizations @gol
524 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
525 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
526 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
527 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
528 -fno-allocation-dce -fallow-store-data-races @gol
529 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}] @gol
530 -fauto-inc-dec  -fbranch-probabilities @gol
531 -fcaller-saves @gol
532 -fcombine-stack-adjustments  -fconserve-stack @gol
533 -fcompare-elim  -fcprop-registers  -fcrossjumping @gol
534 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules @gol
535 -fcx-limited-range @gol
536 -fdata-sections  -fdce  -fdelayed-branch @gol
537 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively @gol
538 -fdevirtualize-at-ltrans  -fdse @gol
539 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects @gol
540 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style} @gol
541 -ffinite-loops @gol
542 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections @gol
543 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity @gol
544 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion @gol
545 -fif-conversion2  -findirect-inlining @gol
546 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n} @gol
547 -finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone @gol
548 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const @gol
549 -fipa-reference  -fipa-reference-addressable @gol
550 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm} @gol
551 -flive-patching=@var{level} @gol
552 -fira-region=@var{region}  -fira-hoist-pressure @gol
553 -fira-loop-pressure  -fno-ira-share-save-slots @gol
554 -fno-ira-share-spill-slots @gol
555 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute @gol
556 -fivopts  -fkeep-inline-functions  -fkeep-static-functions @gol
557 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage @gol
558 -floop-block  -floop-interchange  -floop-strip-mine @gol
559 -floop-unroll-and-jam  -floop-nest-optimize @gol
560 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level @gol
561 -flto-partition=@var{alg}  -fmerge-all-constants @gol
562 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves @gol
563 -fmove-loop-invariants  -fmove-loop-stores  -fno-branch-count-reg @gol
564 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse @gol
565 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole @gol
566 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock @gol
567 -fno-sched-spec  -fno-signed-zeros @gol
568 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss @gol
569 -fomit-frame-pointer  -foptimize-sibling-calls @gol
570 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning @gol
571 -fprefetch-loop-arrays @gol
572 -fprofile-correction @gol
573 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training @gol
574 -fprofile-values -fprofile-reorder-functions @gol
575 -freciprocal-math  -free  -frename-registers  -freorder-blocks @gol
576 -freorder-blocks-algorithm=@var{algorithm} @gol
577 -freorder-blocks-and-partition  -freorder-functions @gol
578 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops @gol
579 -frounding-math  -fsave-optimization-record @gol
580 -fsched2-use-superblocks  -fsched-pressure @gol
581 -fsched-spec-load  -fsched-spec-load-dangerous @gol
582 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}] @gol
583 -fsched-group-heuristic  -fsched-critical-path-heuristic @gol
584 -fsched-spec-insn-heuristic  -fsched-rank-heuristic @gol
585 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic @gol
586 -fschedule-fusion @gol
587 -fschedule-insns  -fschedule-insns2  -fsection-anchors @gol
588 -fselective-scheduling  -fselective-scheduling2 @gol
589 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops @gol
590 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate @gol
591 -fsignaling-nans @gol
592 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops@gol
593 -fsplit-paths @gol
594 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt @gol
595 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing @gol
596 -fthread-jumps  -ftracer  -ftree-bit-ccp @gol
597 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch @gol
598 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts @gol
599 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting @gol
600 -ftree-loop-if-convert  -ftree-loop-im @gol
601 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns @gol
602 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize @gol
603 -ftree-loop-vectorize @gol
604 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta @gol
605 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra @gol
606 -ftree-switch-conversion  -ftree-tail-merge @gol
607 -ftree-ter  -ftree-vectorize  -ftree-vrp  -ftrivial-auto-var-init @gol
608 -funconstrained-commons -funit-at-a-time  -funroll-all-loops @gol
609 -funroll-loops -funsafe-math-optimizations  -funswitch-loops @gol
610 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt @gol
611 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs @gol
612 --param @var{name}=@var{value}
613 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og  -Oz}
615 @item Program Instrumentation Options
616 @xref{Instrumentation Options,,Program Instrumentation Options}.
617 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage @gol
618 -fprofile-abs-path @gol
619 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path} @gol
620 -fprofile-info-section  -fprofile-info-section=@var{name} @gol
621 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
622 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
623 -fprofile-exclude-files=@var{regex} @gol
624 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol
625 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style} @gol
626 -fsanitize-trap   -fsanitize-trap=@var{style}  @gol
627 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},... @gol
628 -fsanitize-undefined-trap-on-error  -fbounds-check @gol
629 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
630 -fharden-compares -fharden-conditional-branches @gol
631 -fstack-protector  -fstack-protector-all  -fstack-protector-strong @gol
632 -fstack-protector-explicit  -fstack-check @gol
633 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
634 -fno-stack-limit  -fsplit-stack @gol
635 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
636 -fvtv-counts  -fvtv-debug @gol
637 -finstrument-functions  -finstrument-functions-once @gol
638 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
639 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} @gol
640 -fprofile-prefix-map=@var{old}=@var{new}
642 @item Preprocessor Options
643 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
644 @gccoptlist{-A@var{question}=@var{answer} @gol
645 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
646 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]} @gol
647 -dD  -dI  -dM  -dN  -dU @gol
648 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers  @gol
649 -fexec-charset=@var{charset}  -fextended-identifiers  @gol
650 -finput-charset=@var{charset}  -flarge-source-files  @gol
651 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
652 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess  @gol
653 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion  @gol
654 -fwide-exec-charset=@var{charset}  -fworking-directory @gol
655 -H  -imacros @var{file}  -include @var{file} @gol
656 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules @gol
657 -no-integrated-cpp  -P  -pthread  -remap @gol
658 -traditional  -traditional-cpp  -trigraphs @gol
659 -U@var{macro}  -undef  @gol
660 -Wp,@var{option}  -Xpreprocessor @var{option}}
662 @item Assembler Options
663 @xref{Assembler Options,,Passing Options to the Assembler}.
664 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
666 @item Linker Options
667 @xref{Link Options,,Options for Linking}.
668 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
669 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib  -nostdlib++ @gol
670 -e @var{entry}  --entry=@var{entry} @gol
671 -pie  -pthread  -r  -rdynamic @gol
672 -s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
673 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan @gol
674 -shared  -shared-libgcc  -symbolic @gol
675 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
676 -u @var{symbol}  -z @var{keyword}}
678 @item Directory Options
679 @xref{Directory Options,,Options for Directory Search}.
680 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I- @gol
681 -idirafter @var{dir} @gol
682 -imacros @var{file}  -imultilib @var{dir} @gol
683 -iplugindir=@var{dir}  -iprefix @var{file} @gol
684 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir} @gol
685 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}  @gol
686 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix @gol
687 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
689 @item Code Generation Options
690 @xref{Code Gen Options,,Options for Code Generation Conventions}.
691 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
692 -ffixed-@var{reg}  -fexceptions @gol
693 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
694 -fasynchronous-unwind-tables @gol
695 -fno-gnu-unique @gol
696 -finhibit-size-directive  -fcommon  -fno-ident @gol
697 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
698 -fno-jump-tables -fno-bit-tests @gol
699 -frecord-gcc-switches @gol
700 -freg-struct-return  -fshort-enums  -fshort-wchar @gol
701 -fverbose-asm  -fpack-struct[=@var{n}]  @gol
702 -fleading-underscore  -ftls-model=@var{model} @gol
703 -fstack-reuse=@var{reuse_level} @gol
704 -ftrampolines  -ftrapv  -fwrapv @gol
705 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
706 -fstrict-volatile-bitfields  -fsync-libcalls}
708 @item Developer Options
709 @xref{Developer Options,,GCC Developer Options}.
710 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
711 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
712 -fchecking  -fchecking=@var{n}
713 -fdbg-cnt-list @gol  -fdbg-cnt=@var{counter-value-list} @gol
714 -fdisable-ipa-@var{pass_name} @gol
715 -fdisable-rtl-@var{pass_name} @gol
716 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
717 -fdisable-tree-@var{pass_name} @gol
718 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
719 -fdump-debug  -fdump-earlydebug @gol
720 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
721 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
722 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
723 -fdump-lang-all @gol
724 -fdump-lang-@var{switch} @gol
725 -fdump-lang-@var{switch}-@var{options} @gol
726 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
727 -fdump-passes @gol
728 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
729 -fdump-statistics @gol
730 -fdump-tree-all @gol
731 -fdump-tree-@var{switch} @gol
732 -fdump-tree-@var{switch}-@var{options} @gol
733 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
734 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
735 -fenable-@var{kind}-@var{pass} @gol
736 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
737 -fira-verbose=@var{n} @gol
738 -flto-report  -flto-report-wpa  -fmem-report-wpa @gol
739 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report @gol
740 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
741 -fprofile-report @gol
742 -frandom-seed=@var{string}  -fsched-verbose=@var{n} @gol
743 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose @gol
744 -fstats  -fstack-usage  -ftime-report  -ftime-report-details @gol
745 -fvar-tracking-assignments-toggle  -gtoggle @gol
746 -print-file-name=@var{library}  -print-libgcc-file-name @gol
747 -print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
748 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
749 -print-sysroot  -print-sysroot-headers-suffix @gol
750 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
752 @item Machine-Dependent Options
753 @xref{Submodel Options,,Machine-Dependent Options}.
754 @c This list is ordered alphanumerically by subsection name.
755 @c Try and put the significant identifier (CPU or system) first,
756 @c so users have a clue at guessing where the ones they want will be.
758 @emph{AArch64 Options}
759 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian @gol
760 -mgeneral-regs-only @gol
761 -mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
762 -mstrict-align  -mno-strict-align @gol
763 -momit-leaf-frame-pointer @gol
764 -mtls-dialect=desc  -mtls-dialect=traditional @gol
765 -mtls-size=@var{size} @gol
766 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419 @gol
767 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div @gol
768 -mpc-relative-literal-loads @gol
769 -msign-return-address=@var{scope} @gol
770 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
771 +@var{b-key}]|@var{bti} @gol
772 -mharden-sls=@var{opts} @gol
773 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}  @gol
774 -moverride=@var{string}  -mverbose-cost-dump @gol
775 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
776 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
777 -moutline-atomics }
779 @emph{Adapteva Epiphany Options}
780 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs @gol
781 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf @gol
782 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num} @gol
783 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16 @gol
784 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num} @gol
785 -msplit-vecmove-early  -m1reg-@var{reg}}
787 @emph{AMD GCN Options}
788 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
790 @emph{ARC Options}
791 @gccoptlist{-mbarrel-shifter  -mjli-always @gol
792 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700 @gol
793 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr @gol
794 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic @gol
795 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap @gol
796 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape @gol
797 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof @gol
798 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved @gol
799 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num} @gol
800 -mvolatile-cache  -mtp-regno=@var{regno} @gol
801 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc @gol
802 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi @gol
803 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none @gol
804 -mlra-priority-compact -mlra-priority-noncompact  -mmillicode @gol
805 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level} @gol
806 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame @gol
807 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo} @gol
808 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
810 @emph{ARM Options}
811 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
812 -mabi=@var{name} @gol
813 -mapcs-stack-check  -mno-apcs-stack-check @gol
814 -mapcs-reentrant  -mno-apcs-reentrant @gol
815 -mgeneral-regs-only @gol
816 -msched-prolog  -mno-sched-prolog @gol
817 -mlittle-endian  -mbig-endian @gol
818 -mbe8  -mbe32 @gol
819 -mfloat-abi=@var{name} @gol
820 -mfp16-format=@var{name}
821 -mthumb-interwork  -mno-thumb-interwork @gol
822 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
823 -mtune=@var{name}  -mprint-tune-info @gol
824 -mstructure-size-boundary=@var{n} @gol
825 -mabort-on-noreturn @gol
826 -mlong-calls  -mno-long-calls @gol
827 -msingle-pic-base  -mno-single-pic-base @gol
828 -mpic-register=@var{reg} @gol
829 -mnop-fun-dllimport @gol
830 -mpoke-function-name @gol
831 -mthumb  -marm  -mflip-thumb @gol
832 -mtpcs-frame  -mtpcs-leaf-frame @gol
833 -mcaller-super-interworking  -mcallee-super-interworking @gol
834 -mtp=@var{name}  -mtls-dialect=@var{dialect} @gol
835 -mword-relocations @gol
836 -mfix-cortex-m3-ldrd @gol
837 -mfix-cortex-a57-aes-1742098 @gol
838 -mfix-cortex-a72-aes-1655431 @gol
839 -munaligned-access @gol
840 -mneon-for-64bits @gol
841 -mslow-flash-data @gol
842 -masm-syntax-unified @gol
843 -mrestrict-it @gol
844 -mverbose-cost-dump @gol
845 -mpure-code @gol
846 -mcmse @gol
847 -mfix-cmse-cve-2021-35465 @gol
848 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset} @gol
849 -mfdpic}
851 @emph{AVR Options}
852 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
853 -mbranch-cost=@var{cost} @gol
854 -mcall-prologues  -mgas-isr-prologues  -mint8 @gol
855 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
856 -mn_flash=@var{size}  -mno-interrupts @gol
857 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack @gol
858 -mfract-convert-truncate @gol
859 -mshort-calls  -nodevicelib  -nodevicespecs @gol
860 -Waddr-space-convert  -Wmisspelled-isr}
862 @emph{Blackfin Options}
863 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
864 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
865 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
866 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
867 -mno-id-shared-library  -mshared-library-id=@var{n} @gol
868 -mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
869 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
870 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram @gol
871 -micplb}
873 @emph{C6X Options}
874 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu} @gol
875 -msim  -msdata=@var{sdata-type}}
877 @emph{CRIS Options}
878 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}
879 -mtune=@var{cpu} -mmax-stack-frame=@var{n} @gol
880 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
881 -mstack-align  -mdata-align  -mconst-align @gol
882 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue @gol
883 -melf  -maout  -sim  -sim2 @gol
884 -mmul-bug-workaround  -mno-mul-bug-workaround}
886 @emph{C-SKY Options}
887 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu} @gol
888 -mbig-endian  -EB  -mlittle-endian  -EL @gol
889 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu @gol
890 -mfloat-abi=@var{name} @gol
891 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust @gol
892 -mdsp  -medsp  -mvdsp @gol
893 -mdiv  -msmart  -mhigh-registers  -manchor @gol
894 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt @gol
895 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
897 @emph{Darwin Options}
898 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
899 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
900 -client_name  -compatibility_version  -current_version @gol
901 -dead_strip @gol
902 -dependency-file  -dylib_file  -dylinker_install_name @gol
903 -dynamic  -dynamiclib  -exported_symbols_list @gol
904 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
905 -force_flat_namespace  -headerpad_max_install_names @gol
906 -iframework @gol
907 -image_base  -init  -install_name  -keep_private_externs @gol
908 -multi_module  -multiply_defined  -multiply_defined_unused @gol
909 -noall_load   -no_dead_strip_inits_and_terms @gol
910 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit @gol
911 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
912 -private_bundle  -read_only_relocs  -sectalign @gol
913 -sectobjectsymbols  -whyload  -seg1addr @gol
914 -sectcreate  -sectobjectsymbols  -sectorder @gol
915 -segaddr  -segs_read_only_addr  -segs_read_write_addr @gol
916 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
917 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
918 -single_module  -static  -sub_library  -sub_umbrella @gol
919 -twolevel_namespace  -umbrella  -undefined @gol
920 -unexported_symbols_list  -weak_reference_mismatches @gol
921 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version} @gol
922 -mkernel  -mone-byte-bool}
924 @emph{DEC Alpha Options}
925 @gccoptlist{-mno-fp-regs  -msoft-float @gol
926 -mieee  -mieee-with-inexact  -mieee-conformant @gol
927 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
928 -mtrap-precision=@var{mode}  -mbuild-constants @gol
929 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
930 -mbwx  -mmax  -mfix  -mcix @gol
931 -mfloat-vax  -mfloat-ieee @gol
932 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
933 -msmall-text  -mlarge-text @gol
934 -mmemory-latency=@var{time}}
936 @emph{eBPF Options}
937 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
938 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re
939 -mjmpext -mjmp32 -malu32 -mcpu=@var{version}}
941 @emph{FR30 Options}
942 @gccoptlist{-msmall-model  -mno-lsim}
944 @emph{FT32 Options}
945 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
947 @emph{FRV Options}
948 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
949 -mhard-float  -msoft-float @gol
950 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
951 -mdouble  -mno-double @gol
952 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
953 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic @gol
954 -mlinked-fp  -mlong-calls  -malign-labels @gol
955 -mlibrary-pic  -macc-4  -macc-8 @gol
956 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
957 -moptimize-membar  -mno-optimize-membar @gol
958 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
959 -mvliw-branch  -mno-vliw-branch @gol
960 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
961 -mno-nested-cond-exec  -mtomcat-stats @gol
962 -mTLS  -mtls @gol
963 -mcpu=@var{cpu}}
965 @emph{GNU/Linux Options}
966 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid @gol
967 -tno-android-cc  -tno-android-ld}
969 @emph{H8/300 Options}
970 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
972 @emph{HPPA Options}
973 @gccoptlist{-march=@var{architecture-type} @gol
974 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
975 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
976 -mfixed-range=@var{register-range} @gol
977 -mjump-in-delay  -mlinker-opt  -mlong-calls @gol
978 -mlong-load-store  -mno-disable-fpregs @gol
979 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
980 -mno-jump-in-delay  -mno-long-load-store @gol
981 -mno-portable-runtime  -mno-soft-float @gol
982 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
983 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
984 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
985 -munix=@var{unix-std}  -nolibdld  -static  -threads}
987 @emph{IA-64 Options}
988 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
989 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata @gol
990 -mconstant-gp  -mauto-pic  -mfused-madd @gol
991 -minline-float-divide-min-latency @gol
992 -minline-float-divide-max-throughput @gol
993 -mno-inline-float-divide @gol
994 -minline-int-divide-min-latency @gol
995 -minline-int-divide-max-throughput  @gol
996 -mno-inline-int-divide @gol
997 -minline-sqrt-min-latency  -minline-sqrt-max-throughput @gol
998 -mno-inline-sqrt @gol
999 -mdwarf2-asm  -mearly-stop-bits @gol
1000 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size} @gol
1001 -mtune=@var{cpu-type}  -milp32  -mlp64 @gol
1002 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec @gol
1003 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec @gol
1004 -msched-spec-ldc  -msched-spec-control-ldc @gol
1005 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns @gol
1006 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path @gol
1007 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost @gol
1008 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
1010 @emph{LM32 Options}
1011 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled @gol
1012 -msign-extend-enabled  -muser-enabled}
1014 @emph{LoongArch Options}
1015 @gccoptlist{-march=@var{cpu-type}  -mtune=@var{cpu-type} -mabi=@var{base-abi-type} @gol
1016 -mfpu=@var{fpu-type} -msoft-float -msingle-float -mdouble-float @gol
1017 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division @gol
1018 -mcond-move-int  -mno-cond-move-int @gol
1019 -mcond-move-float  -mno-cond-move-float @gol
1020 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align @gol
1021 -mmax-inline-memcpy-size=@var{n} @gol
1022 -mexplicit-relocs -mno-explicit-relocs @gol
1023 -mdirect-extern-access -mno-direct-extern-access @gol
1024 -mcmodel=@var{code-model}}
1026 @emph{M32R/D Options}
1027 @gccoptlist{-m32r2  -m32rx  -m32r @gol
1028 -mdebug @gol
1029 -malign-loops  -mno-align-loops @gol
1030 -missue-rate=@var{number} @gol
1031 -mbranch-cost=@var{number} @gol
1032 -mmodel=@var{code-size-model-type} @gol
1033 -msdata=@var{sdata-type} @gol
1034 -mno-flush-func  -mflush-func=@var{name} @gol
1035 -mno-flush-trap  -mflush-trap=@var{number} @gol
1036 -G @var{num}}
1038 @emph{M32C Options}
1039 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1041 @emph{M680x0 Options}
1042 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune} @gol
1043 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
1044 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
1045 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
1046 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
1047 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
1048 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
1049 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
1050 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1052 @emph{MCore Options}
1053 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
1054 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
1055 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
1056 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
1057 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1059 @emph{MeP Options}
1060 @gccoptlist{-mabsdiff  -mall-opts  -maverage  -mbased=@var{n}  -mbitops @gol
1061 -mc=@var{n}  -mclip  -mconfig=@var{name}  -mcop  -mcop32  -mcop64  -mivc2 @gol
1062 -mdc  -mdiv  -meb  -mel  -mio-volatile  -ml  -mleadz  -mm  -mminmax @gol
1063 -mmult  -mno-opts  -mrepeat  -ms  -msatur  -msdram  -msim  -msimnovec  -mtf @gol
1064 -mtiny=@var{n}}
1066 @emph{MicroBlaze Options}
1067 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
1068 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
1069 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
1070 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
1071 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model} @gol
1072 -mpic-data-is-text-relative}
1074 @emph{MIPS Options}
1075 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
1076 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5 @gol
1077 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6 @gol
1078 -mips16  -mno-mips16  -mflip-mips16 @gol
1079 -minterlink-compressed  -mno-interlink-compressed @gol
1080 -minterlink-mips16  -mno-interlink-mips16 @gol
1081 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
1082 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
1083 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
1084 -mno-float  -msingle-float  -mdouble-float @gol
1085 -modd-spreg  -mno-odd-spreg @gol
1086 -mabs=@var{mode}  -mnan=@var{encoding} @gol
1087 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
1088 -mmcu  -mmno-mcu @gol
1089 -meva  -mno-eva @gol
1090 -mvirt  -mno-virt @gol
1091 -mxpa  -mno-xpa @gol
1092 -mcrc  -mno-crc @gol
1093 -mginv  -mno-ginv @gol
1094 -mmicromips  -mno-micromips @gol
1095 -mmsa  -mno-msa @gol
1096 -mloongson-mmi  -mno-loongson-mmi @gol
1097 -mloongson-ext  -mno-loongson-ext @gol
1098 -mloongson-ext2  -mno-loongson-ext2 @gol
1099 -mfpu=@var{fpu-type} @gol
1100 -msmartmips  -mno-smartmips @gol
1101 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
1102 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
1103 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
1104 -G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
1105 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
1106 -membedded-data  -mno-embedded-data @gol
1107 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
1108 -mcode-readable=@var{setting} @gol
1109 -msplit-addresses  -mno-split-addresses @gol
1110 -mexplicit-relocs  -mno-explicit-relocs @gol
1111 -mcheck-zero-division  -mno-check-zero-division @gol
1112 -mdivide-traps  -mdivide-breaks @gol
1113 -mload-store-pairs  -mno-load-store-pairs @gol
1114 -munaligned-access  -mno-unaligned-access @gol
1115 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
1116 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp @gol
1117 -mfix-24k  -mno-fix-24k @gol
1118 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
1119 -mfix-r5900  -mno-fix-r5900 @gol
1120 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000 @gol
1121 -mfix-vr4120  -mno-fix-vr4120 @gol
1122 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
1123 -mflush-func=@var{func}  -mno-flush-func @gol
1124 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
1125 -mcompact-branches=@var{policy} @gol
1126 -mfp-exceptions  -mno-fp-exceptions @gol
1127 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci @gol
1128 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4 @gol
1129 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address @gol
1130 -mframe-header-opt  -mno-frame-header-opt}
1132 @emph{MMIX Options}
1133 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
1134 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
1135 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
1136 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1138 @emph{MN10300 Options}
1139 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
1140 -mno-am33  -mam33  -mam33-2  -mam34 @gol
1141 -mtune=@var{cpu-type} @gol
1142 -mreturn-pointer-on-d0 @gol
1143 -mno-crt0  -mrelax  -mliw  -msetlb}
1145 @emph{Moxie Options}
1146 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1148 @emph{MSP430 Options}
1149 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax @gol
1150 -mwarn-mcu @gol
1151 -mcode-region=  -mdata-region= @gol
1152 -msilicon-errata=  -msilicon-errata-warn= @gol
1153 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1155 @emph{NDS32 Options}
1156 @gccoptlist{-mbig-endian  -mlittle-endian @gol
1157 -mreduced-regs  -mfull-regs @gol
1158 -mcmov  -mno-cmov @gol
1159 -mext-perf  -mno-ext-perf @gol
1160 -mext-perf2  -mno-ext-perf2 @gol
1161 -mext-string  -mno-ext-string @gol
1162 -mv3push  -mno-v3push @gol
1163 -m16bit  -mno-16bit @gol
1164 -misr-vector-size=@var{num} @gol
1165 -mcache-block-size=@var{num} @gol
1166 -march=@var{arch} @gol
1167 -mcmodel=@var{code-model} @gol
1168 -mctor-dtor  -mrelax}
1170 @emph{Nios II Options}
1171 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt @gol
1172 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp} @gol
1173 -mel  -meb @gol
1174 -mno-bypass-cache  -mbypass-cache @gol
1175 -mno-cache-volatile  -mcache-volatile @gol
1176 -mno-fast-sw-div  -mfast-sw-div @gol
1177 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div @gol
1178 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn} @gol
1179 -mcustom-fpu-cfg=@var{name} @gol
1180 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name} @gol
1181 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1183 @emph{Nvidia PTX Options}
1184 @gccoptlist{-m64  -mmainkernel  -moptimize}
1186 @emph{OpenRISC Options}
1187 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
1188 -msoft-mul  -msoft-div @gol
1189 -msoft-float  -mhard-float  -mdouble-float -munordered-float @gol
1190 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm @gol
1191 -mcmodel=@var{code-model}}
1193 @emph{PDP-11 Options}
1194 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
1195 -mint32  -mno-int16  -mint16  -mno-int32 @gol
1196 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1198 @emph{picoChip Options}
1199 @gccoptlist{-mae=@var{ae_type}  -mvliw-lookahead=@var{N} @gol
1200 -msymbol-as-address  -mno-inefficient-warnings}
1202 @emph{PowerPC Options}
1203 See RS/6000 and PowerPC Options.
1205 @emph{PRU Options}
1206 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop @gol
1207 -mabi=@var{variant} @gol}
1209 @emph{RISC-V Options}
1210 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1211 -mplt  -mno-plt @gol
1212 -mabi=@var{ABI-string} @gol
1213 -mfdiv  -mno-fdiv @gol
1214 -mdiv  -mno-div @gol
1215 -misa-spec=@var{ISA-spec-string} @gol
1216 -march=@var{ISA-string} @gol
1217 -mtune=@var{processor-string} @gol
1218 -mpreferred-stack-boundary=@var{num} @gol
1219 -msmall-data-limit=@var{N-bytes} @gol
1220 -msave-restore  -mno-save-restore @gol
1221 -mshorten-memrefs  -mno-shorten-memrefs @gol
1222 -mstrict-align  -mno-strict-align @gol
1223 -mcmodel=medlow  -mcmodel=medany @gol
1224 -mexplicit-relocs  -mno-explicit-relocs @gol
1225 -mrelax  -mno-relax @gol
1226 -mriscv-attribute  -mno-riscv-attribute @gol
1227 -malign-data=@var{type} @gol
1228 -mbig-endian  -mlittle-endian @gol
1229 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg} @gol
1230 -mstack-protector-guard-offset=@var{offset}}
1231 -mcsr-check -mno-csr-check @gol
1233 @emph{RL78 Options}
1234 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
1235 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14 @gol
1236 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1238 @emph{RS/6000 and PowerPC Options}
1239 @gccoptlist{-mcpu=@var{cpu-type} @gol
1240 -mtune=@var{cpu-type} @gol
1241 -mcmodel=@var{code-model} @gol
1242 -mpowerpc64 @gol
1243 -maltivec  -mno-altivec @gol
1244 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
1245 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
1246 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd @gol
1247 -mfprnd  -mno-fprnd @gol
1248 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp @gol
1249 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
1250 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
1251 -malign-power  -malign-natural @gol
1252 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
1253 -mupdate  -mno-update @gol
1254 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
1255 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
1256 -mstrict-align  -mno-strict-align  -mrelocatable @gol
1257 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
1258 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
1259 -mdynamic-no-pic  -mswdiv  -msingle-pic-base @gol
1260 -mprioritize-restricted-insns=@var{priority} @gol
1261 -msched-costly-dep=@var{dependence_type} @gol
1262 -minsert-sched-nops=@var{scheme} @gol
1263 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd  @gol
1264 -mcall-linux  -mcall-netbsd  -mcall-openbsd  @gol
1265 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi @gol
1266 -mtraceback=@var{traceback_type} @gol
1267 -maix-struct-return  -msvr4-struct-return @gol
1268 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt @gol
1269 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq  @gol
1270 -mblock-move-inline-limit=@var{num} @gol
1271 -mblock-compare-inline-limit=@var{num} @gol
1272 -mblock-compare-inline-loop-limit=@var{num} @gol
1273 -mno-block-ops-unaligned-vsx @gol
1274 -mstring-compare-inline-limit=@var{num} @gol
1275 -misel  -mno-isel @gol
1276 -mvrsave  -mno-vrsave @gol
1277 -mmulhw  -mno-mulhw @gol
1278 -mdlmzb  -mno-dlmzb @gol
1279 -mprototype  -mno-prototype @gol
1280 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
1281 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num} @gol
1282 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision @gol
1283 -mno-recip-precision @gol
1284 -mveclibabi=@var{type}  -mfriz  -mno-friz @gol
1285 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions @gol
1286 -msave-toc-indirect  -mno-save-toc-indirect @gol
1287 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector @gol
1288 -mcrypto  -mno-crypto  -mhtm  -mno-htm @gol
1289 -mquad-memory  -mno-quad-memory @gol
1290 -mquad-memory-atomic  -mno-quad-memory-atomic @gol
1291 -mcompat-align-parm  -mno-compat-align-parm @gol
1292 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware @gol
1293 -mgnu-attribute  -mno-gnu-attribute @gol
1294 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1295 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1296 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol
1297 -mprivileged -mno-privileged}
1299 @emph{RX Options}
1300 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
1301 -mcpu=@gol
1302 -mbig-endian-data  -mlittle-endian-data @gol
1303 -msmall-data @gol
1304 -msim  -mno-sim@gol
1305 -mas100-syntax  -mno-as100-syntax@gol
1306 -mrelax@gol
1307 -mmax-constant-size=@gol
1308 -mint-register=@gol
1309 -mpid@gol
1310 -mallow-string-insns  -mno-allow-string-insns@gol
1311 -mjsr@gol
1312 -mno-warn-multiple-fast-interrupts@gol
1313 -msave-acc-in-interrupts}
1315 @emph{S/390 and zSeries Options}
1316 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1317 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp @gol
1318 -mlong-double-64  -mlong-double-128 @gol
1319 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack @gol
1320 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
1321 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
1322 -mhtm  -mvx  -mzvector @gol
1323 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip @gol
1324 -mfused-madd  -mno-fused-madd @gol
1325 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard @gol
1326 -mhotpatch=@var{halfwords},@var{halfwords}}
1328 @emph{Score Options}
1329 @gccoptlist{-meb  -mel @gol
1330 -mnhwloop @gol
1331 -muls @gol
1332 -mmac @gol
1333 -mscore5  -mscore5u  -mscore7  -mscore7d}
1335 @emph{SH Options}
1336 @gccoptlist{-m1  -m2  -m2e @gol
1337 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a @gol
1338 -m3  -m3e @gol
1339 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
1340 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al @gol
1341 -mb  -ml  -mdalign  -mrelax @gol
1342 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave @gol
1343 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct @gol
1344 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy} @gol
1345 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range} @gol
1346 -maccumulate-outgoing-args @gol
1347 -matomic-model=@var{atomic-model} @gol
1348 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch @gol
1349 -mcbranch-force-delay-slot @gol
1350 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra @gol
1351 -mpretend-cmove  -mtas}
1353 @emph{Solaris 2 Options}
1354 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text @gol
1355 -pthreads}
1357 @emph{SPARC Options}
1358 @gccoptlist{-mcpu=@var{cpu-type} @gol
1359 -mtune=@var{cpu-type} @gol
1360 -mcmodel=@var{code-model} @gol
1361 -mmemory-model=@var{mem-model} @gol
1362 -m32  -m64  -mapp-regs  -mno-app-regs @gol
1363 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
1364 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1365 -mhard-quad-float  -msoft-quad-float @gol
1366 -mstack-bias  -mno-stack-bias @gol
1367 -mstd-struct-return  -mno-std-struct-return @gol
1368 -munaligned-doubles  -mno-unaligned-doubles @gol
1369 -muser-mode  -mno-user-mode @gol
1370 -mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
1371 -mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
1372 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b @gol
1373 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld  @gol
1374 -mpopc  -mno-popc  -msubxc  -mno-subxc @gol
1375 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc @gol
1376 -mlra  -mno-lra}
1378 @emph{System V Options}
1379 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1381 @emph{V850 Options}
1382 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
1383 -mprolog-function  -mno-prolog-function  -mspace @gol
1384 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
1385 -mapp-regs  -mno-app-regs @gol
1386 -mdisable-callt  -mno-disable-callt @gol
1387 -mv850e2v3  -mv850e2  -mv850e1  -mv850es @gol
1388 -mv850e  -mv850  -mv850e3v5 @gol
1389 -mloop @gol
1390 -mrelax @gol
1391 -mlong-jumps @gol
1392 -msoft-float @gol
1393 -mhard-float @gol
1394 -mgcc-abi @gol
1395 -mrh850-abi @gol
1396 -mbig-switch}
1398 @emph{VAX Options}
1399 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1401 @emph{Visium Options}
1402 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1403 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1405 @emph{VMS Options}
1406 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64 @gol
1407 -mpointer-size=@var{size}}
1409 @emph{VxWorks Options}
1410 @gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
1411 -Xbind-lazy  -Xbind-now}
1413 @emph{x86 Options}
1414 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1415 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default @gol
1416 -mfpmath=@var{unit} @gol
1417 -masm=@var{dialect}  -mno-fancy-math-387 @gol
1418 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float @gol
1419 -mno-wide-multiply  -mrtd  -malign-double @gol
1420 -mpreferred-stack-boundary=@var{num} @gol
1421 -mincoming-stack-boundary=@var{num} @gol
1422 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait @gol
1423 -mrecip  -mrecip=@var{opt} @gol
1424 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt} @gol
1425 -mmove-max=@var{bits} -mstore-max=@var{bits} @gol
1426 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx @gol
1427 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl @gol
1428 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes @gol
1429 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd  @gol
1430 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves @gol
1431 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
1432 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp @gol
1433 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg @gol
1434 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call @gol
1435 -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1436 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq @gol
1437 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid @gol
1438 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1439 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni@gol
1440 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert @gol
1441 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
1442 -minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
1443 -mkl -mwidekl @gol
1444 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
1445 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
1446 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128 @gol
1447 -mregparm=@var{num}  -msseregparm @gol
1448 -mveclibabi=@var{type}  -mvect8-ret-in-mem @gol
1449 -mpc32  -mpc64  -mpc80  -mstackrealign @gol
1450 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs @gol
1451 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode} @gol
1452 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num} @gol
1453 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
1454 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1455 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
1456 -malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
1457 -mstack-protector-guard-reg=@var{reg} @gol
1458 -mstack-protector-guard-offset=@var{offset} @gol
1459 -mstack-protector-guard-symbol=@var{symbol} @gol
1460 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop @gol
1461 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice} @gol
1462 -mindirect-branch-register -mharden-sls=@var{choice} @gol
1463 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access}
1465 @emph{x86 Windows Options}
1466 @gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
1467 -mnop-fun-dllimport  -mthread @gol
1468 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1470 @emph{Xstormy16 Options}
1471 @gccoptlist{-msim}
1473 @emph{Xtensa Options}
1474 @gccoptlist{-mconst16  -mno-const16 @gol
1475 -mfused-madd  -mno-fused-madd @gol
1476 -mforce-no-pic @gol
1477 -mserialize-volatile  -mno-serialize-volatile @gol
1478 -mtext-section-literals  -mno-text-section-literals @gol
1479 -mauto-litpools  -mno-auto-litpools @gol
1480 -mtarget-align  -mno-target-align @gol
1481 -mlongcalls  -mno-longcalls @gol
1482 -mabi=@var{abi-type} @gol
1483 -mextra-l32r-costs=@var{cycles}}
1485 @emph{zSeries Options}
1486 See S/390 and zSeries Options.
1487 @end table
1490 @node Overall Options
1491 @section Options Controlling the Kind of Output
1493 Compilation can involve up to four stages: preprocessing, compilation
1494 proper, assembly and linking, always in that order.  GCC is capable of
1495 preprocessing and compiling several files either into several
1496 assembler input files, or into one assembler input file; then each
1497 assembler input file produces an object file, and linking combines all
1498 the object files (those newly compiled, and those specified as input)
1499 into an executable file.
1501 @cindex file name suffix
1502 For any given input file, the file name suffix determines what kind of
1503 compilation is done:
1505 @table @gcctabopt
1506 @item @var{file}.c
1507 C source code that must be preprocessed.
1509 @item @var{file}.i
1510 C source code that should not be preprocessed.
1512 @item @var{file}.ii
1513 C++ source code that should not be preprocessed.
1515 @item @var{file}.m
1516 Objective-C source code.  Note that you must link with the @file{libobjc}
1517 library to make an Objective-C program work.
1519 @item @var{file}.mi
1520 Objective-C source code that should not be preprocessed.
1522 @item @var{file}.mm
1523 @itemx @var{file}.M
1524 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1525 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1526 to a literal capital M@.
1528 @item @var{file}.mii
1529 Objective-C++ source code that should not be preprocessed.
1531 @item @var{file}.h
1532 C, C++, Objective-C or Objective-C++ header file to be turned into a
1533 precompiled header (default), or C, C++ header file to be turned into an
1534 Ada spec (via the @option{-fdump-ada-spec} switch).
1536 @item @var{file}.cc
1537 @itemx @var{file}.cp
1538 @itemx @var{file}.cxx
1539 @itemx @var{file}.cpp
1540 @itemx @var{file}.CPP
1541 @itemx @var{file}.c++
1542 @itemx @var{file}.C
1543 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1544 the last two letters must both be literally @samp{x}.  Likewise,
1545 @samp{.C} refers to a literal capital C@.
1547 @item @var{file}.mm
1548 @itemx @var{file}.M
1549 Objective-C++ source code that must be preprocessed.
1551 @item @var{file}.mii
1552 Objective-C++ source code that should not be preprocessed.
1554 @item @var{file}.hh
1555 @itemx @var{file}.H
1556 @itemx @var{file}.hp
1557 @itemx @var{file}.hxx
1558 @itemx @var{file}.hpp
1559 @itemx @var{file}.HPP
1560 @itemx @var{file}.h++
1561 @itemx @var{file}.tcc
1562 C++ header file to be turned into a precompiled header or Ada spec.
1564 @item @var{file}.f
1565 @itemx @var{file}.for
1566 @itemx @var{file}.ftn
1567 Fixed form Fortran source code that should not be preprocessed.
1569 @item @var{file}.F
1570 @itemx @var{file}.FOR
1571 @itemx @var{file}.fpp
1572 @itemx @var{file}.FPP
1573 @itemx @var{file}.FTN
1574 Fixed form Fortran source code that must be preprocessed (with the traditional
1575 preprocessor).
1577 @item @var{file}.f90
1578 @itemx @var{file}.f95
1579 @itemx @var{file}.f03
1580 @itemx @var{file}.f08
1581 Free form Fortran source code that should not be preprocessed.
1583 @item @var{file}.F90
1584 @itemx @var{file}.F95
1585 @itemx @var{file}.F03
1586 @itemx @var{file}.F08
1587 Free form Fortran source code that must be preprocessed (with the
1588 traditional preprocessor).
1590 @item @var{file}.go
1591 Go source code.
1593 @item @var{file}.d
1594 D source code.
1596 @item @var{file}.di
1597 D interface file.
1599 @item @var{file}.dd
1600 D documentation code (Ddoc).
1602 @item @var{file}.ads
1603 Ada source code file that contains a library unit declaration (a
1604 declaration of a package, subprogram, or generic, or a generic
1605 instantiation), or a library unit renaming declaration (a package,
1606 generic, or subprogram renaming declaration).  Such files are also
1607 called @dfn{specs}.
1609 @item @var{file}.adb
1610 Ada source code file containing a library unit body (a subprogram or
1611 package body).  Such files are also called @dfn{bodies}.
1613 @c GCC also knows about some suffixes for languages not yet included:
1614 @c Ratfor:
1615 @c @var{file}.r
1617 @item @var{file}.s
1618 Assembler code.
1620 @item @var{file}.S
1621 @itemx @var{file}.sx
1622 Assembler code that must be preprocessed.
1624 @item @var{other}
1625 An object file to be fed straight into linking.
1626 Any file name with no recognized suffix is treated this way.
1627 @end table
1629 @opindex x
1630 You can specify the input language explicitly with the @option{-x} option:
1632 @table @gcctabopt
1633 @item -x @var{language}
1634 Specify explicitly the @var{language} for the following input files
1635 (rather than letting the compiler choose a default based on the file
1636 name suffix).  This option applies to all following input files until
1637 the next @option{-x} option.  Possible values for @var{language} are:
1638 @smallexample
1639 c  c-header  cpp-output
1640 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1641 objective-c  objective-c-header  objective-c-cpp-output
1642 objective-c++ objective-c++-header objective-c++-cpp-output
1643 assembler  assembler-with-cpp
1646 f77  f77-cpp-input f95  f95-cpp-input
1648 @end smallexample
1650 @item -x none
1651 Turn off any specification of a language, so that subsequent files are
1652 handled according to their file name suffixes (as they are if @option{-x}
1653 has not been used at all).
1654 @end table
1656 If you only want some of the stages of compilation, you can use
1657 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1658 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1659 @command{gcc} is to stop.  Note that some combinations (for example,
1660 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1662 @table @gcctabopt
1663 @item -c
1664 @opindex c
1665 Compile or assemble the source files, but do not link.  The linking
1666 stage simply is not done.  The ultimate output is in the form of an
1667 object file for each source file.
1669 By default, the object file name for a source file is made by replacing
1670 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1672 Unrecognized input files, not requiring compilation or assembly, are
1673 ignored.
1675 @item -S
1676 @opindex S
1677 Stop after the stage of compilation proper; do not assemble.  The output
1678 is in the form of an assembler code file for each non-assembler input
1679 file specified.
1681 By default, the assembler file name for a source file is made by
1682 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1684 Input files that don't require compilation are ignored.
1686 @item -E
1687 @opindex E
1688 Stop after the preprocessing stage; do not run the compiler proper.  The
1689 output is in the form of preprocessed source code, which is sent to the
1690 standard output.
1692 Input files that don't require preprocessing are ignored.
1694 @cindex output file option
1695 @item -o @var{file}
1696 @opindex o
1697 Place the primary output in file @var{file}.  This applies to whatever
1698 sort of output is being produced, whether it be an executable file, an
1699 object file, an assembler file or preprocessed C code.
1701 If @option{-o} is not specified, the default is to put an executable
1702 file in @file{a.out}, the object file for
1703 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1704 assembler file in @file{@var{source}.s}, a precompiled header file in
1705 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1706 standard output.
1708 Though @option{-o} names only the primary output, it also affects the
1709 naming of auxiliary and dump outputs.  See the examples below.  Unless
1710 overridden, both auxiliary outputs and dump outputs are placed in the
1711 same directory as the primary output.  In auxiliary outputs, the suffix
1712 of the input file is replaced with that of the auxiliary output file
1713 type; in dump outputs, the suffix of the dump file is appended to the
1714 input file suffix.  In compilation commands, the base name of both
1715 auxiliary and dump outputs is that of the primary output; in compile and
1716 link commands, the primary output name, minus the executable suffix, is
1717 combined with the input file name.  If both share the same base name,
1718 disregarding the suffix, the result of the combination is that base
1719 name, otherwise, they are concatenated, separated by a dash.
1721 @smallexample
1722 gcc -c foo.c ...
1723 @end smallexample
1725 will use @file{foo.o} as the primary output, and place aux outputs and
1726 dumps next to it, e.g., aux file @file{foo.dwo} for
1727 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1728 @option{-fdump-rtl-final}.
1730 If a non-linker output file is explicitly specified, aux and dump files
1731 by default take the same base name:
1733 @smallexample
1734 gcc -c foo.c -o dir/foobar.o ...
1735 @end smallexample
1737 will name aux outputs @file{dir/foobar.*} and dump outputs
1738 @file{dir/foobar.c.*}.
1740 A linker output will instead prefix aux and dump outputs:
1742 @smallexample
1743 gcc foo.c bar.c -o dir/foobar ...
1744 @end smallexample
1746 will generally name aux outputs @file{dir/foobar-foo.*} and
1747 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1748 @file{dir/foobar-bar.c.*}.
1750 The one exception to the above is when the executable shares the base
1751 name with the single input:
1753 @smallexample
1754 gcc foo.c -o dir/foo ...
1755 @end smallexample
1757 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1758 named @file{dir/foo.c.*}.
1760 The location and the names of auxiliary and dump outputs can be adjusted
1761 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1762 @option{-dumpdir}, @option{-save-temps=cwd}, and
1763 @option{-save-temps=obj}.
1766 @item -dumpbase @var{dumpbase}
1767 @opindex dumpbase
1768 This option sets the base name for auxiliary and dump output files.  It
1769 does not affect the name of the primary output file.  Intermediate
1770 outputs, when preserved, are not regarded as primary outputs, but as
1771 auxiliary outputs:
1773 @smallexample
1774 gcc -save-temps -S foo.c
1775 @end smallexample
1777 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1778 then compiles to the (implied) output file @file{foo.s}, whereas:
1780 @smallexample
1781 gcc -save-temps -dumpbase save-foo -c foo.c
1782 @end smallexample
1784 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1785 an intermediate, thus auxiliary output), and then assembles to the
1786 (implied) output file @file{foo.o}.
1788 Absent this option, dump and aux files take their names from the input
1789 file, or from the (non-linker) output file, if one is explicitly
1790 specified: dump output files (e.g. those requested by @option{-fdump-*}
1791 options) with the input name suffix, and aux output files (those
1792 requested by other non-dump options, e.g. @code{-save-temps},
1793 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1795 Similar suffix differentiation of dump and aux outputs can be attained
1796 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1797 @option{-dumpbase-ext .suf}.
1799 If @var{dumpbase} is explicitly specified with any directory component,
1800 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1801 @option{-save-temps=*}) is ignored, and instead of appending to it,
1802 @var{dumpbase} fully overrides it:
1804 @smallexample
1805 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1806   -dumpdir pfx- -save-temps=cwd ...
1807 @end smallexample
1809 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1810 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1811 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1813 When @option{-dumpbase} is specified in a command that compiles multiple
1814 inputs, or that compiles and then links, it may be combined with
1815 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1816 file is compiled using the combined @var{dumppfx}, and default values
1817 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1818 file:
1820 @smallexample
1821 gcc foo.c bar.c -c -dumpbase main ...
1822 @end smallexample
1824 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1825 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1826 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1827 and @file{main-bar.*}.
1829 An empty string specified as @var{dumpbase} avoids the influence of the
1830 output basename in the naming of auxiliary and dump outputs during
1831 compilation, computing default values :
1833 @smallexample
1834 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1835 @end smallexample
1837 will name aux outputs @file{dir/foo.*} and dump outputs
1838 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1839 name, but the directory still defaults to that of the output.
1841 The empty-string dumpbase does not prevent the use of the output
1842 basename for outputs during linking:
1844 @smallexample
1845 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1846 @end smallexample
1848 The compilation of the source files will name auxiliary outputs
1849 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1850 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1851 linking will use @file{dir/foobar.} as the prefix for dumps and
1852 auxiliary files.
1855 @item -dumpbase-ext @var{auxdropsuf}
1856 @opindex dumpbase-ext
1857 When forming the name of an auxiliary (but not a dump) output file, drop
1858 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1859 suffixes.  If not specified, this option defaults to the suffix of a
1860 default @var{dumpbase}, i.e., the suffix of the input file when
1861 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1862 is combined with @var{dumppfx}.
1864 @smallexample
1865 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1866 @end smallexample
1868 creates @file{dir/foo.o} as the main output, and generates auxiliary
1869 outputs in @file{dir/x-foo.*}, taking the location of the primary
1870 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1871 outputs retain the suffix: @file{dir/x-foo.c.*}.
1873 This option is disregarded if it does not match the suffix of a
1874 specified @var{dumpbase}, except as an alternative to the executable
1875 suffix when appending the linker output base name to @var{dumppfx}, as
1876 specified below:
1878 @smallexample
1879 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1880 @end smallexample
1882 creates @file{main.out} as the primary output, and avoids overwriting
1883 the auxiliary and dump outputs by using the executable name minus
1884 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1885 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1886 @file{main-foo.c.*} and @file{main-bar.c.*}.
1889 @item -dumpdir @var{dumppfx}
1890 @opindex dumpdir
1891 When forming the name of an auxiliary or dump output file, use
1892 @var{dumppfx} as a prefix:
1894 @smallexample
1895 gcc -dumpdir pfx- -c foo.c ...
1896 @end smallexample
1898 creates @file{foo.o} as the primary output, and auxiliary outputs named
1899 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1900 @var{dumpbase} derived from the default primary output, derived in turn
1901 from the input name.  Dump outputs also take the input name suffix:
1902 @file{pfx-foo.c.*}.
1904 If @var{dumppfx} is to be used as a directory name, it must end with a
1905 directory separator:
1907 @smallexample
1908 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1909 @end smallexample
1911 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1912 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1913 default @var{dumpbase} derived from the primary output name.  Dump
1914 outputs also take the input name suffix: @file{dir/bar.c.*}.
1916 It defaults to the location of the output file, unless the output
1917 file is a special file like @code{/dev/null}. Options
1918 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1919 default, just like an explicit @option{-dumpdir} option.  In case
1920 multiple such options are given, the last one prevails:
1922 @smallexample
1923 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1924 @end smallexample
1926 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1927 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1928 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1929 default for @option{-save-temps}, nor that the output directory is
1930 implicitly the current directory.  Dump outputs are named
1931 @file{foo.c.*}.
1933 When compiling from multiple input files, if @option{-dumpbase} is
1934 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1935 are appended to (or override, if containing any directory components) an
1936 explicit or defaulted @var{dumppfx}, so that each of the multiple
1937 compilations gets differently-named aux and dump outputs.
1939 @smallexample
1940 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1941 @end smallexample
1943 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1944 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1945 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1946 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1947 single-input compilation:
1949 @smallexample
1950 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1951 @end smallexample
1953 that, applying @option{-dumpbase} to a single source, does not compute
1954 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1955 dump outputs go in @file{dir/pfx-main.*}.
1957 When compiling and then linking from multiple input files, a defaulted
1958 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1959 transformation above (e.g. the compilation of @file{foo.c} and
1960 @file{bar.c} above, but without @option{-c}).  If neither
1961 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1962 base name, minus @var{auxdropsuf}, if specified, or the executable
1963 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1964 instead.  Note, however, that unlike earlier cases of linking:
1966 @smallexample
1967 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1968 @end smallexample
1970 does not append the output name @file{main} to @var{dumppfx}, because
1971 @option{-dumpdir} is explicitly specified.  The goal is that the
1972 explicitly-specified @var{dumppfx} may contain the specified output name
1973 as part of the prefix, if desired; only an explicitly-specified
1974 @option{-dumpbase} would be combined with it, in order to avoid simply
1975 discarding a meaningful option.
1977 When compiling and then linking from a single input file, the linker
1978 output base name will only be appended to the default @var{dumppfx} as
1979 above if it does not share the base name with the single input file
1980 name.  This has been covered in single-input linking cases above, but
1981 not with an explicit @option{-dumpdir} that inhibits the combination,
1982 even if overridden by @option{-save-temps=*}:
1984 @smallexample
1985 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1986 @end smallexample
1988 Auxiliary outputs are named @file{foo.*}, and dump outputs
1989 @file{foo.c.*}, in the current working directory as ultimately requested
1990 by @option{-save-temps=cwd}.
1992 Summing it all up for an intuitive though slightly imprecise data flow:
1993 the primary output name is broken into a directory part and a basename
1994 part; @var{dumppfx} is set to the former, unless overridden by
1995 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1996 to the latter, unless overriden by @option{-dumpbase}.  If there are
1997 multiple inputs or linking, this @var{dumpbase} may be combined with
1998 @var{dumppfx} and taken from each input file.  Auxiliary output names
1999 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
2000 minus suffix, and the auxiliary output suffix; dump output names are
2001 only different in that the suffix from @var{dumpbase} is retained.
2003 When it comes to auxiliary and dump outputs created during LTO
2004 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2005 given or as derived from the linker output name but not from inputs,
2006 even in cases in which this combination would not otherwise be used as
2007 such, is passed down with a trailing period replacing the compiler-added
2008 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2009 being involved in linking, this program does not normally get any
2010 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2012 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2013 names to the received @var{dumppfx}, ensures it contains a directory
2014 component so that it overrides any @option{-dumpdir}, and passes that as
2015 @option{-dumpbase} to sub-compilers.
2017 @item -v
2018 @opindex v
2019 Print (on standard error output) the commands executed to run the stages
2020 of compilation.  Also print the version number of the compiler driver
2021 program and of the preprocessor and the compiler proper.
2023 @item -###
2024 @opindex ###
2025 Like @option{-v} except the commands are not executed and arguments
2026 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2027 This is useful for shell scripts to capture the driver-generated command lines.
2029 @item --help
2030 @opindex help
2031 Print (on the standard output) a description of the command-line options
2032 understood by @command{gcc}.  If the @option{-v} option is also specified
2033 then @option{--help} is also passed on to the various processes
2034 invoked by @command{gcc}, so that they can display the command-line options
2035 they accept.  If the @option{-Wextra} option has also been specified
2036 (prior to the @option{--help} option), then command-line options that
2037 have no documentation associated with them are also displayed.
2039 @item --target-help
2040 @opindex target-help
2041 Print (on the standard output) a description of target-specific command-line
2042 options for each tool.  For some targets extra target-specific
2043 information may also be printed.
2045 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2046 Print (on the standard output) a description of the command-line
2047 options understood by the compiler that fit into all specified classes
2048 and qualifiers.  These are the supported classes:
2050 @table @asis
2051 @item @samp{optimizers}
2052 Display all of the optimization options supported by the
2053 compiler.
2055 @item @samp{warnings}
2056 Display all of the options controlling warning messages
2057 produced by the compiler.
2059 @item @samp{target}
2060 Display target-specific options.  Unlike the
2061 @option{--target-help} option however, target-specific options of the
2062 linker and assembler are not displayed.  This is because those
2063 tools do not currently support the extended @option{--help=} syntax.
2065 @item @samp{params}
2066 Display the values recognized by the @option{--param}
2067 option.
2069 @item @var{language}
2070 Display the options supported for @var{language}, where
2071 @var{language} is the name of one of the languages supported in this
2072 version of GCC@.  If an option is supported by all languages, one needs
2073 to select @samp{common} class.
2075 @item @samp{common}
2076 Display the options that are common to all languages.
2077 @end table
2079 These are the supported qualifiers:
2081 @table @asis
2082 @item @samp{undocumented}
2083 Display only those options that are undocumented.
2085 @item @samp{joined}
2086 Display options taking an argument that appears after an equal
2087 sign in the same continuous piece of text, such as:
2088 @samp{--help=target}.
2090 @item @samp{separate}
2091 Display options taking an argument that appears as a separate word
2092 following the original option, such as: @samp{-o output-file}.
2093 @end table
2095 Thus for example to display all the undocumented target-specific
2096 switches supported by the compiler, use:
2098 @smallexample
2099 --help=target,undocumented
2100 @end smallexample
2102 The sense of a qualifier can be inverted by prefixing it with the
2103 @samp{^} character, so for example to display all binary warning
2104 options (i.e., ones that are either on or off and that do not take an
2105 argument) that have a description, use:
2107 @smallexample
2108 --help=warnings,^joined,^undocumented
2109 @end smallexample
2111 The argument to @option{--help=} should not consist solely of inverted
2112 qualifiers.
2114 Combining several classes is possible, although this usually
2115 restricts the output so much that there is nothing to display.  One
2116 case where it does work, however, is when one of the classes is
2117 @var{target}.  For example, to display all the target-specific
2118 optimization options, use:
2120 @smallexample
2121 --help=target,optimizers
2122 @end smallexample
2124 The @option{--help=} option can be repeated on the command line.  Each
2125 successive use displays its requested class of options, skipping
2126 those that have already been displayed.  If @option{--help} is also
2127 specified anywhere on the command line then this takes precedence
2128 over any @option{--help=} option.
2130 If the @option{-Q} option appears on the command line before the
2131 @option{--help=} option, then the descriptive text displayed by
2132 @option{--help=} is changed.  Instead of describing the displayed
2133 options, an indication is given as to whether the option is enabled,
2134 disabled or set to a specific value (assuming that the compiler
2135 knows this at the point where the @option{--help=} option is used).
2137 Here is a truncated example from the ARM port of @command{gcc}:
2139 @smallexample
2140   % gcc -Q -mabi=2 --help=target -c
2141   The following options are target specific:
2142   -mabi=                                2
2143   -mabort-on-noreturn                   [disabled]
2144   -mapcs                                [disabled]
2145 @end smallexample
2147 The output is sensitive to the effects of previous command-line
2148 options, so for example it is possible to find out which optimizations
2149 are enabled at @option{-O2} by using:
2151 @smallexample
2152 -Q -O2 --help=optimizers
2153 @end smallexample
2155 Alternatively you can discover which binary optimizations are enabled
2156 by @option{-O3} by using:
2158 @smallexample
2159 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2160 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2161 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2162 @end smallexample
2164 @item --version
2165 @opindex version
2166 Display the version number and copyrights of the invoked GCC@.
2168 @item -pass-exit-codes
2169 @opindex pass-exit-codes
2170 Normally the @command{gcc} program exits with the code of 1 if any
2171 phase of the compiler returns a non-success return code.  If you specify
2172 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2173 the numerically highest error produced by any phase returning an error
2174 indication.  The C, C++, and Fortran front ends return 4 if an internal
2175 compiler error is encountered.
2177 @item -pipe
2178 @opindex pipe
2179 Use pipes rather than temporary files for communication between the
2180 various stages of compilation.  This fails to work on some systems where
2181 the assembler is unable to read from a pipe; but the GNU assembler has
2182 no trouble.
2184 @item -specs=@var{file}
2185 @opindex specs
2186 Process @var{file} after the compiler reads in the standard @file{specs}
2187 file, in order to override the defaults which the @command{gcc} driver
2188 program uses when determining what switches to pass to @command{cc1},
2189 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2190 @option{-specs=@var{file}} can be specified on the command line, and they
2191 are processed in order, from left to right.  @xref{Spec Files}, for
2192 information about the format of the @var{file}.
2194 @item -wrapper
2195 @opindex wrapper
2196 Invoke all subcommands under a wrapper program.  The name of the
2197 wrapper program and its parameters are passed as a comma separated
2198 list.
2200 @smallexample
2201 gcc -c t.c -wrapper gdb,--args
2202 @end smallexample
2204 @noindent
2205 This invokes all subprograms of @command{gcc} under
2206 @samp{gdb --args}, thus the invocation of @command{cc1} is
2207 @samp{gdb --args cc1 @dots{}}.
2209 @item -ffile-prefix-map=@var{old}=@var{new}
2210 @opindex ffile-prefix-map
2211 When compiling files residing in directory @file{@var{old}}, record
2212 any references to them in the result of the compilation as if the
2213 files resided in directory @file{@var{new}} instead.  Specifying this
2214 option is equivalent to specifying all the individual
2215 @option{-f*-prefix-map} options.  This can be used to make reproducible
2216 builds that are location independent.  See also
2217 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map} and
2218 @option{-fprofile-prefix-map}.
2220 @item -fplugin=@var{name}.so
2221 @opindex fplugin
2222 Load the plugin code in file @var{name}.so, assumed to be a
2223 shared object to be dlopen'd by the compiler.  The base name of
2224 the shared object file is used to identify the plugin for the
2225 purposes of argument parsing (See
2226 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2227 Each plugin should define the callback functions specified in the
2228 Plugins API.
2230 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2231 @opindex fplugin-arg
2232 Define an argument called @var{key} with a value of @var{value}
2233 for the plugin called @var{name}.
2235 @item -fdump-ada-spec@r{[}-slim@r{]}
2236 @opindex fdump-ada-spec
2237 For C and C++ source and include files, generate corresponding Ada specs.
2238 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2239 GNAT User's Guide}, which provides detailed documentation on this feature.
2241 @item -fada-spec-parent=@var{unit}
2242 @opindex fada-spec-parent
2243 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2244 Ada specs as child units of parent @var{unit}.
2246 @item -fdump-go-spec=@var{file}
2247 @opindex fdump-go-spec
2248 For input files in any language, generate corresponding Go
2249 declarations in @var{file}.  This generates Go @code{const},
2250 @code{type}, @code{var}, and @code{func} declarations which may be a
2251 useful way to start writing a Go interface to code written in some
2252 other language.
2254 @include @value{srcdir}/../libiberty/at-file.texi
2255 @end table
2257 @node Invoking G++
2258 @section Compiling C++ Programs
2260 @cindex suffixes for C++ source
2261 @cindex C++ source file suffixes
2262 C++ source files conventionally use one of the suffixes @samp{.C},
2263 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2264 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2265 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2266 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2267 files with these names and compiles them as C++ programs even if you
2268 call the compiler the same way as for compiling C programs (usually
2269 with the name @command{gcc}).
2271 @findex g++
2272 @findex c++
2273 However, the use of @command{gcc} does not add the C++ library.
2274 @command{g++} is a program that calls GCC and automatically specifies linking
2275 against the C++ library.  It treats @samp{.c},
2276 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2277 files unless @option{-x} is used.  This program is also useful when
2278 precompiling a C header file with a @samp{.h} extension for use in C++
2279 compilations.  On many systems, @command{g++} is also installed with
2280 the name @command{c++}.
2282 @cindex invoking @command{g++}
2283 When you compile C++ programs, you may specify many of the same
2284 command-line options that you use for compiling programs in any
2285 language; or command-line options meaningful for C and related
2286 languages; or options that are meaningful only for C++ programs.
2287 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2288 explanations of options for languages related to C@.
2289 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2290 explanations of options that are meaningful only for C++ programs.
2292 @node C Dialect Options
2293 @section Options Controlling C Dialect
2294 @cindex dialect options
2295 @cindex language dialect options
2296 @cindex options, dialect
2298 The following options control the dialect of C (or languages derived
2299 from C, such as C++, Objective-C and Objective-C++) that the compiler
2300 accepts:
2302 @table @gcctabopt
2303 @cindex ANSI support
2304 @cindex ISO support
2305 @item -ansi
2306 @opindex ansi
2307 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2308 equivalent to @option{-std=c++98}.
2310 This turns off certain features of GCC that are incompatible with ISO
2311 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2312 such as the @code{asm} and @code{typeof} keywords, and
2313 predefined macros such as @code{unix} and @code{vax} that identify the
2314 type of system you are using.  It also enables the undesirable and
2315 rarely used ISO trigraph feature.  For the C compiler,
2316 it disables recognition of C++ style @samp{//} comments as well as
2317 the @code{inline} keyword.
2319 The alternate keywords @code{__asm__}, @code{__extension__},
2320 @code{__inline__} and @code{__typeof__} continue to work despite
2321 @option{-ansi}.  You would not want to use them in an ISO C program, of
2322 course, but it is useful to put them in header files that might be included
2323 in compilations done with @option{-ansi}.  Alternate predefined macros
2324 such as @code{__unix__} and @code{__vax__} are also available, with or
2325 without @option{-ansi}.
2327 The @option{-ansi} option does not cause non-ISO programs to be
2328 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2329 addition to @option{-ansi}.  @xref{Warning Options}.
2331 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2332 option is used.  Some header files may notice this macro and refrain
2333 from declaring certain functions or defining certain macros that the
2334 ISO standard doesn't call for; this is to avoid interfering with any
2335 programs that might use these names for other things.
2337 Functions that are normally built in but do not have semantics
2338 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2339 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2340 built-in functions provided by GCC}, for details of the functions
2341 affected.
2343 @item -std=
2344 @opindex std
2345 Determine the language standard. @xref{Standards,,Language Standards
2346 Supported by GCC}, for details of these standard versions.  This option
2347 is currently only supported when compiling C or C++.
2349 The compiler can accept several base standards, such as @samp{c90} or
2350 @samp{c++98}, and GNU dialects of those standards, such as
2351 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2352 compiler accepts all programs following that standard plus those
2353 using GNU extensions that do not contradict it.  For example,
2354 @option{-std=c90} turns off certain features of GCC that are
2355 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2356 keywords, but not other GNU extensions that do not have a meaning in
2357 ISO C90, such as omitting the middle term of a @code{?:}
2358 expression. On the other hand, when a GNU dialect of a standard is
2359 specified, all features supported by the compiler are enabled, even when
2360 those features change the meaning of the base standard.  As a result, some
2361 strict-conforming programs may be rejected.  The particular standard
2362 is used by @option{-Wpedantic} to identify which features are GNU
2363 extensions given that version of the standard. For example
2364 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2365 comments, while @option{-std=gnu99 -Wpedantic} does not.
2367 A value for this option must be provided; possible values are
2369 @table @samp
2370 @item c90
2371 @itemx c89
2372 @itemx iso9899:1990
2373 Support all ISO C90 programs (certain GNU extensions that conflict
2374 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2376 @item iso9899:199409
2377 ISO C90 as modified in amendment 1.
2379 @item c99
2380 @itemx c9x
2381 @itemx iso9899:1999
2382 @itemx iso9899:199x
2383 ISO C99.  This standard is substantially completely supported, modulo
2384 bugs and floating-point issues
2385 (mainly but not entirely relating to optional C99 features from
2386 Annexes F and G).  See
2387 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2388 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2390 @item c11
2391 @itemx c1x
2392 @itemx iso9899:2011
2393 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2394 substantially completely supported, modulo bugs, floating-point issues
2395 (mainly but not entirely relating to optional C11 features from
2396 Annexes F and G) and the optional Annexes K (Bounds-checking
2397 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2399 @item c17
2400 @itemx c18
2401 @itemx iso9899:2017
2402 @itemx iso9899:2018
2403 ISO C17, the 2017 revision of the ISO C standard
2404 (published in 2018).  This standard is
2405 same as C11 except for corrections of defects (all of which are also
2406 applied with @option{-std=c11}) and a new value of
2407 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2409 @item c2x
2410 The next version of the ISO C standard, still under development.  The
2411 support for this version is experimental and incomplete.
2413 @item gnu90
2414 @itemx gnu89
2415 GNU dialect of ISO C90 (including some C99 features).
2417 @item gnu99
2418 @itemx gnu9x
2419 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2421 @item gnu11
2422 @itemx gnu1x
2423 GNU dialect of ISO C11.
2424 The name @samp{gnu1x} is deprecated.
2426 @item gnu17
2427 @itemx gnu18
2428 GNU dialect of ISO C17.  This is the default for C code.
2430 @item gnu2x
2431 The next version of the ISO C standard, still under development, plus
2432 GNU extensions.  The support for this version is experimental and
2433 incomplete.
2435 @item c++98
2436 @itemx c++03
2437 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2438 additional defect reports. Same as @option{-ansi} for C++ code.
2440 @item gnu++98
2441 @itemx gnu++03
2442 GNU dialect of @option{-std=c++98}.
2444 @item c++11
2445 @itemx c++0x
2446 The 2011 ISO C++ standard plus amendments.
2447 The name @samp{c++0x} is deprecated.
2449 @item gnu++11
2450 @itemx gnu++0x
2451 GNU dialect of @option{-std=c++11}.
2452 The name @samp{gnu++0x} is deprecated.
2454 @item c++14
2455 @itemx c++1y
2456 The 2014 ISO C++ standard plus amendments.
2457 The name @samp{c++1y} is deprecated.
2459 @item gnu++14
2460 @itemx gnu++1y
2461 GNU dialect of @option{-std=c++14}.
2462 The name @samp{gnu++1y} is deprecated.
2464 @item c++17
2465 @itemx c++1z
2466 The 2017 ISO C++ standard plus amendments.
2467 The name @samp{c++1z} is deprecated.
2469 @item gnu++17
2470 @itemx gnu++1z
2471 GNU dialect of @option{-std=c++17}.
2472 This is the default for C++ code.
2473 The name @samp{gnu++1z} is deprecated.
2475 @item c++20
2476 @itemx c++2a
2477 The 2020 ISO C++ standard plus amendments.
2478 Support is experimental, and could change in incompatible ways in
2479 future releases.
2480 The name @samp{c++2a} is deprecated.
2482 @item gnu++20
2483 @itemx gnu++2a
2484 GNU dialect of @option{-std=c++20}.
2485 Support is experimental, and could change in incompatible ways in
2486 future releases.
2487 The name @samp{gnu++2a} is deprecated.
2489 @item c++2b
2490 @itemx c++23
2491 The next revision of the ISO C++ standard, planned for
2492 2023.  Support is highly experimental, and will almost certainly
2493 change in incompatible ways in future releases.
2495 @item gnu++2b
2496 @itemx gnu++23
2497 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2498 and will almost certainly change in incompatible ways in future
2499 releases.
2500 @end table
2502 @item -aux-info @var{filename}
2503 @opindex aux-info
2504 Output to the given filename prototyped declarations for all functions
2505 declared and/or defined in a translation unit, including those in header
2506 files.  This option is silently ignored in any language other than C@.
2508 Besides declarations, the file indicates, in comments, the origin of
2509 each declaration (source file and line), whether the declaration was
2510 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2511 @samp{O} for old, respectively, in the first character after the line
2512 number and the colon), and whether it came from a declaration or a
2513 definition (@samp{C} or @samp{F}, respectively, in the following
2514 character).  In the case of function definitions, a K&R-style list of
2515 arguments followed by their declarations is also provided, inside
2516 comments, after the declaration.
2518 @item -fno-asm
2519 @opindex fno-asm
2520 @opindex fasm
2521 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2522 keyword, so that code can use these words as identifiers.  You can use
2523 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2524 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2526 In C++, @code{inline} is a standard keyword and is not affected by
2527 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2528 instead, which disables @code{typeof} but not @code{asm} and
2529 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2530 this switch only affects the @code{asm} and @code{typeof} keywords,
2531 since @code{inline} is a standard keyword in ISO C99.  In C2X mode
2532 (@option{-std=c2x} or @option{-std=gnu2x}), this switch only affects
2533 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2534 ISO C2X.
2536 @item -fno-builtin
2537 @itemx -fno-builtin-@var{function}
2538 @opindex fno-builtin
2539 @opindex fbuiltin
2540 @cindex built-in functions
2541 Don't recognize built-in functions that do not begin with
2542 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2543 functions provided by GCC}, for details of the functions affected,
2544 including those which are not built-in functions when @option{-ansi} or
2545 @option{-std} options for strict ISO C conformance are used because they
2546 do not have an ISO standard meaning.
2548 GCC normally generates special code to handle certain built-in functions
2549 more efficiently; for instance, calls to @code{alloca} may become single
2550 instructions which adjust the stack directly, and calls to @code{memcpy}
2551 may become inline copy loops.  The resulting code is often both smaller
2552 and faster, but since the function calls no longer appear as such, you
2553 cannot set a breakpoint on those calls, nor can you change the behavior
2554 of the functions by linking with a different library.  In addition,
2555 when a function is recognized as a built-in function, GCC may use
2556 information about that function to warn about problems with calls to
2557 that function, or to generate more efficient code, even if the
2558 resulting code still contains calls to that function.  For example,
2559 warnings are given with @option{-Wformat} for bad calls to
2560 @code{printf} when @code{printf} is built in and @code{strlen} is
2561 known not to modify global memory.
2563 With the @option{-fno-builtin-@var{function}} option
2564 only the built-in function @var{function} is
2565 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2566 function is named that is not built-in in this version of GCC, this
2567 option is ignored.  There is no corresponding
2568 @option{-fbuiltin-@var{function}} option; if you wish to enable
2569 built-in functions selectively when using @option{-fno-builtin} or
2570 @option{-ffreestanding}, you may define macros such as:
2572 @smallexample
2573 #define abs(n)          __builtin_abs ((n))
2574 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2575 @end smallexample
2577 @item -fcond-mismatch
2578 @opindex fcond-mismatch
2579 Allow conditional expressions with mismatched types in the second and
2580 third arguments.  The value of such an expression is void.  This option
2581 is not supported for C++.
2583 @item -ffreestanding
2584 @opindex ffreestanding
2585 @cindex hosted environment
2587 Assert that compilation targets a freestanding environment.  This
2588 implies @option{-fno-builtin}.  A freestanding environment
2589 is one in which the standard library may not exist, and program startup may
2590 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2591 This is equivalent to @option{-fno-hosted}.
2593 @xref{Standards,,Language Standards Supported by GCC}, for details of
2594 freestanding and hosted environments.
2596 @item -fgimple
2597 @opindex fgimple
2599 Enable parsing of function definitions marked with @code{__GIMPLE}.
2600 This is an experimental feature that allows unit testing of GIMPLE
2601 passes.
2603 @item -fgnu-tm
2604 @opindex fgnu-tm
2605 When the option @option{-fgnu-tm} is specified, the compiler
2606 generates code for the Linux variant of Intel's current Transactional
2607 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2608 an experimental feature whose interface may change in future versions
2609 of GCC, as the official specification changes.  Please note that not
2610 all architectures are supported for this feature.
2612 For more information on GCC's support for transactional memory,
2613 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2614 Transactional Memory Library}.
2616 Note that the transactional memory feature is not supported with
2617 non-call exceptions (@option{-fnon-call-exceptions}).
2619 @item -fgnu89-inline
2620 @opindex fgnu89-inline
2621 The option @option{-fgnu89-inline} tells GCC to use the traditional
2622 GNU semantics for @code{inline} functions when in C99 mode.
2623 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2624 Using this option is roughly equivalent to adding the
2625 @code{gnu_inline} function attribute to all inline functions
2626 (@pxref{Function Attributes}).
2628 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2629 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2630 specifies the default behavior).
2631 This option is not supported in @option{-std=c90} or
2632 @option{-std=gnu90} mode.
2634 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2635 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2636 in effect for @code{inline} functions.  @xref{Common Predefined
2637 Macros,,,cpp,The C Preprocessor}.
2639 @item -fhosted
2640 @opindex fhosted
2641 @cindex hosted environment
2643 Assert that compilation targets a hosted environment.  This implies
2644 @option{-fbuiltin}.  A hosted environment is one in which the
2645 entire standard library is available, and in which @code{main} has a return
2646 type of @code{int}.  Examples are nearly everything except a kernel.
2647 This is equivalent to @option{-fno-freestanding}.
2649 @item -flax-vector-conversions
2650 @opindex flax-vector-conversions
2651 Allow implicit conversions between vectors with differing numbers of
2652 elements and/or incompatible element types.  This option should not be
2653 used for new code.
2655 @item -fms-extensions
2656 @opindex fms-extensions
2657 Accept some non-standard constructs used in Microsoft header files.
2659 In C++ code, this allows member names in structures to be similar
2660 to previous types declarations.
2662 @smallexample
2663 typedef int UOW;
2664 struct ABC @{
2665   UOW UOW;
2667 @end smallexample
2669 Some cases of unnamed fields in structures and unions are only
2670 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2671 fields within structs/unions}, for details.
2673 Note that this option is off for all targets except for x86
2674 targets using ms-abi.
2676 @item -foffload=disable
2677 @itemx -foffload=default
2678 @itemx -foffload=@var{target-list}
2679 @opindex foffload
2680 @cindex Offloading targets
2681 @cindex OpenACC offloading targets
2682 @cindex OpenMP offloading targets
2683 Specify for which OpenMP and OpenACC offload targets code should be generated.
2684 The default behavior, equivalent to @option{-foffload=default}, is to generate
2685 code for all supported offload targets.  The @option{-foffload=disable} form
2686 generates code only for the host fallback, while
2687 @option{-foffload=@var{target-list}} generates code only for the specified
2688 comma-separated list of offload targets.
2690 Offload targets are specified in GCC's internal target-triplet format. You can
2691 run the compiler with @option{-v} to show the list of configured offload targets
2692 under @code{OFFLOAD_TARGET_NAMES}.
2694 @item -foffload-options=@var{options}
2695 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2696 @opindex foffload-options
2697 @cindex Offloading options
2698 @cindex OpenACC offloading options
2699 @cindex OpenMP offloading options
2701 With @option{-foffload-options=@var{options}}, GCC passes the specified
2702 @var{options} to the compilers for all enabled offloading targets.  You can
2703 specify options that apply only to a specific target or targets by using
2704 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2705 @var{target-list} is a comma-separated list in the same format as for the
2706 @option{-foffload=} option.
2708 Typical command lines are
2710 @smallexample
2711 -foffload-options=-lgfortran -foffload-options=-lm
2712 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2713 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2714 @end smallexample
2716 @item -fopenacc
2717 @opindex fopenacc
2718 @cindex OpenACC accelerator programming
2719 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2720 @code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2721 compiler generates accelerated code according to the OpenACC Application
2722 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2723 implies @option{-pthread}, and thus is only supported on targets that
2724 have support for @option{-pthread}.
2726 @item -fopenacc-dim=@var{geom}
2727 @opindex fopenacc-dim
2728 @cindex OpenACC accelerator programming
2729 Specify default compute dimensions for parallel offload regions that do
2730 not explicitly specify.  The @var{geom} value is a triple of
2731 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2732 can be omitted, to use a target-specific default value.
2734 @item -fopenmp
2735 @opindex fopenmp
2736 @cindex OpenMP parallel
2737 Enable handling of OpenMP directives @code{#pragma omp} in C/C++,
2738 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++ and
2739 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2740 compiler generates parallel code according to the OpenMP Application
2741 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2742 implies @option{-pthread}, and thus is only supported on targets that
2743 have support for @option{-pthread}. @option{-fopenmp} implies
2744 @option{-fopenmp-simd}.
2746 @item -fopenmp-simd
2747 @opindex fopenmp-simd
2748 @cindex OpenMP SIMD
2749 @cindex SIMD
2750 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2751 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan},
2752 @code{loop} directives and combined or composite directives with
2753 @code{simd} as constituent with @code{#pragma omp} in C/C++,
2754 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++
2755 and @code{!$omp} in Fortran.  Other OpenMP directives are ignored.
2757 @item -fpermitted-flt-eval-methods=@var{style}
2758 @opindex fpermitted-flt-eval-methods
2759 @opindex fpermitted-flt-eval-methods=c11
2760 @opindex fpermitted-flt-eval-methods=ts-18661-3
2761 ISO/IEC TS 18661-3 defines new permissible values for
2762 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2763 a semantic type that is an interchange or extended format should be
2764 evaluated to the precision and range of that type.  These new values are
2765 a superset of those permitted under C99/C11, which does not specify the
2766 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2767 conforming to C11 may not have been written expecting the possibility of
2768 the new values.
2770 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2771 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2772 or the extended set of values specified in ISO/IEC TS 18661-3.
2774 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2776 The default when in a standards compliant mode (@option{-std=c11} or similar)
2777 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2778 dialect (@option{-std=gnu11} or similar) is
2779 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2781 @item -fplan9-extensions
2782 @opindex fplan9-extensions
2783 Accept some non-standard constructs used in Plan 9 code.
2785 This enables @option{-fms-extensions}, permits passing pointers to
2786 structures with anonymous fields to functions that expect pointers to
2787 elements of the type of the field, and permits referring to anonymous
2788 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2789 struct/union fields within structs/unions}, for details.  This is only
2790 supported for C, not C++.
2792 @item -fsigned-bitfields
2793 @itemx -funsigned-bitfields
2794 @itemx -fno-signed-bitfields
2795 @itemx -fno-unsigned-bitfields
2796 @opindex fsigned-bitfields
2797 @opindex funsigned-bitfields
2798 @opindex fno-signed-bitfields
2799 @opindex fno-unsigned-bitfields
2800 These options control whether a bit-field is signed or unsigned, when the
2801 declaration does not use either @code{signed} or @code{unsigned}.  By
2802 default, such a bit-field is signed, because this is consistent: the
2803 basic integer types such as @code{int} are signed types.
2805 @item -fsigned-char
2806 @opindex fsigned-char
2807 Let the type @code{char} be signed, like @code{signed char}.
2809 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2810 the negative form of @option{-funsigned-char}.  Likewise, the option
2811 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2813 @item -funsigned-char
2814 @opindex funsigned-char
2815 Let the type @code{char} be unsigned, like @code{unsigned char}.
2817 Each kind of machine has a default for what @code{char} should
2818 be.  It is either like @code{unsigned char} by default or like
2819 @code{signed char} by default.
2821 Ideally, a portable program should always use @code{signed char} or
2822 @code{unsigned char} when it depends on the signedness of an object.
2823 But many programs have been written to use plain @code{char} and
2824 expect it to be signed, or expect it to be unsigned, depending on the
2825 machines they were written for.  This option, and its inverse, let you
2826 make such a program work with the opposite default.
2828 The type @code{char} is always a distinct type from each of
2829 @code{signed char} or @code{unsigned char}, even though its behavior
2830 is always just like one of those two.
2832 @item -fstrict-flex-arrays
2833 @opindex fstrict-flex-arrays
2834 @opindex fno-strict-flex-arrays
2835 Control when to treat the trailing array of a structure as a flexible array
2836 member for the purpose of accessing the elements of such an array.
2837 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2838 strictest.  A trailing array is treated as a flexible array member only when it
2839 is declared as a flexible array member per C99 standard onwards.
2840 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2841 least strict.  All trailing arrays of structures are treated as flexible array
2842 members.
2844 @item -fstrict-flex-arrays=@var{level}
2845 @opindex fstrict-flex-arrays=@var{level}
2846 Control when to treat the trailing array of a structure as a flexible array
2847 member for the purpose of accessing the elements of such an array.  The value
2848 of @var{level} controls the level of strictness.
2850 The possible values of @var{level} are the same as for the
2851 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2853 You can control this behavior for a specific trailing array field of a
2854 structure by using the variable attribute @code{strict_flex_array} attribute
2855 (@pxref{Variable Attributes}).
2857 @item -fsso-struct=@var{endianness}
2858 @opindex fsso-struct
2859 Set the default scalar storage order of structures and unions to the
2860 specified endianness.  The accepted values are @samp{big-endian},
2861 @samp{little-endian} and @samp{native} for the native endianness of
2862 the target (the default).  This option is not supported for C++.
2864 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2865 code that is not binary compatible with code generated without it if the
2866 specified endianness is not the native endianness of the target.
2867 @end table
2869 @node C++ Dialect Options
2870 @section Options Controlling C++ Dialect
2872 @cindex compiler options, C++
2873 @cindex C++ options, command-line
2874 @cindex options, C++
2875 This section describes the command-line options that are only meaningful
2876 for C++ programs.  You can also use most of the GNU compiler options
2877 regardless of what language your program is in.  For example, you
2878 might compile a file @file{firstClass.C} like this:
2880 @smallexample
2881 g++ -g -fstrict-enums -O -c firstClass.C
2882 @end smallexample
2884 @noindent
2885 In this example, only @option{-fstrict-enums} is an option meant
2886 only for C++ programs; you can use the other options with any
2887 language supported by GCC@.
2889 Some options for compiling C programs, such as @option{-std}, are also
2890 relevant for C++ programs.
2891 @xref{C Dialect Options,,Options Controlling C Dialect}.
2893 Here is a list of options that are @emph{only} for compiling C++ programs:
2895 @table @gcctabopt
2897 @item -fabi-version=@var{n}
2898 @opindex fabi-version
2899 Use version @var{n} of the C++ ABI@.  The default is version 0.
2901 Version 0 refers to the version conforming most closely to
2902 the C++ ABI specification.  Therefore, the ABI obtained using version 0
2903 will change in different versions of G++ as ABI bugs are fixed.
2905 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2907 Version 2 is the version of the C++ ABI that first appeared in G++
2908 3.4, and was the default through G++ 4.9.
2910 Version 3 corrects an error in mangling a constant address as a
2911 template argument.
2913 Version 4, which first appeared in G++ 4.5, implements a standard
2914 mangling for vector types.
2916 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2917 attribute const/volatile on function pointer types, decltype of a
2918 plain decl, and use of a function parameter in the declaration of
2919 another parameter.
2921 Version 6, which first appeared in G++ 4.7, corrects the promotion
2922 behavior of C++11 scoped enums and the mangling of template argument
2923 packs, const/static_cast, prefix ++ and --, and a class scope function
2924 used as a template argument.
2926 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2927 builtin type and corrects the mangling of lambdas in default argument
2928 scope.
2930 Version 8, which first appeared in G++ 4.9, corrects the substitution
2931 behavior of function types with function-cv-qualifiers.
2933 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2934 @code{nullptr_t}.
2936 Version 10, which first appeared in G++ 6.1, adds mangling of
2937 attributes that affect type identity, such as ia32 calling convention
2938 attributes (e.g.@: @samp{stdcall}).
2940 Version 11, which first appeared in G++ 7, corrects the mangling of
2941 sizeof... expressions and operator names.  For multiple entities with
2942 the same name within a function, that are declared in different scopes,
2943 the mangling now changes starting with the twelfth occurrence.  It also
2944 implies @option{-fnew-inheriting-ctors}.
2946 Version 12, which first appeared in G++ 8, corrects the calling
2947 conventions for empty classes on the x86_64 target and for classes
2948 with only deleted copy/move constructors.  It accidentally changes the
2949 calling convention for classes with a deleted copy constructor and a
2950 trivial move constructor.
2952 Version 13, which first appeared in G++ 8.2, fixes the accidental
2953 change in version 12.
2955 Version 14, which first appeared in G++ 10, corrects the mangling of
2956 the nullptr expression.
2958 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
2959 tag regression.
2961 Version 16, which first appeared in G++ 11, changes the mangling of
2962 @code{__alignof__} to be distinct from that of @code{alignof}, and
2963 dependent operator names.
2965 Version 17, which first appeared in G++ 12, fixes layout of classes
2966 that inherit from aggregate classes with default member initializers
2967 in C++14 and up.
2969 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
2970 that have additional context.
2972 See also @option{-Wabi}.
2974 @item -fabi-compat-version=@var{n}
2975 @opindex fabi-compat-version
2976 On targets that support strong aliases, G++
2977 works around mangling changes by creating an alias with the correct
2978 mangled name when defining a symbol with an incorrect mangled name.
2979 This switch specifies which ABI version to use for the alias.
2981 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
2982 compatibility).  If another ABI version is explicitly selected, this
2983 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
2984 use @option{-fabi-compat-version=2}.
2986 If this option is not provided but @option{-Wabi=@var{n}} is, that
2987 version is used for compatibility aliases.  If this option is provided
2988 along with @option{-Wabi} (without the version), the version from this
2989 option is used for the warning.
2991 @item -fno-access-control
2992 @opindex fno-access-control
2993 @opindex faccess-control
2994 Turn off all access checking.  This switch is mainly useful for working
2995 around bugs in the access control code.
2997 @item -faligned-new
2998 @opindex faligned-new
2999 Enable support for C++17 @code{new} of types that require more
3000 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3001 numeric argument such as @code{-faligned-new=32} can be used to
3002 specify how much alignment (in bytes) is provided by that function,
3003 but few users will need to override the default of
3004 @code{alignof(std::max_align_t)}.
3006 This flag is enabled by default for @option{-std=c++17}.
3008 @item -fchar8_t
3009 @itemx -fno-char8_t
3010 @opindex fchar8_t
3011 @opindex fno-char8_t
3012 Enable support for @code{char8_t} as adopted for C++20.  This includes
3013 the addition of a new @code{char8_t} fundamental type, changes to the
3014 types of UTF-8 string and character literals, new signatures for
3015 user-defined literals, associated standard library updates, and new
3016 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3018 This option enables functions to be overloaded for ordinary and UTF-8
3019 strings:
3021 @smallexample
3022 int f(const char *);    // #1
3023 int f(const char8_t *); // #2
3024 int v1 = f("text");     // Calls #1
3025 int v2 = f(u8"text");   // Calls #2
3026 @end smallexample
3028 @noindent
3029 and introduces new signatures for user-defined literals:
3031 @smallexample
3032 int operator""_udl1(char8_t);
3033 int v3 = u8'x'_udl1;
3034 int operator""_udl2(const char8_t*, std::size_t);
3035 int v4 = u8"text"_udl2;
3036 template<typename T, T...> int operator""_udl3();
3037 int v5 = u8"text"_udl3;
3038 @end smallexample
3040 @noindent
3041 The change to the types of UTF-8 string and character literals introduces
3042 incompatibilities with ISO C++11 and later standards.  For example, the
3043 following code is well-formed under ISO C++11, but is ill-formed when
3044 @option{-fchar8_t} is specified.
3046 @smallexample
3047 char ca[] = u8"xx";     // error: char-array initialized from wide
3048                         //        string
3049 const char *cp = u8"xx";// error: invalid conversion from
3050                         //        `const char8_t*' to `const char*'
3051 int f(const char*);
3052 auto v = f(u8"xx");     // error: invalid conversion from
3053                         //        `const char8_t*' to `const char*'
3054 std::string s@{u8"xx"@};  // error: no matching function for call to
3055                         //        `std::basic_string<char>::basic_string()'
3056 using namespace std::literals;
3057 s = u8"xx"s;            // error: conversion from
3058                         //        `basic_string<char8_t>' to non-scalar
3059                         //        type `basic_string<char>' requested
3060 @end smallexample
3062 @item -fcheck-new
3063 @opindex fcheck-new
3064 Check that the pointer returned by @code{operator new} is non-null
3065 before attempting to modify the storage allocated.  This check is
3066 normally unnecessary because the C++ standard specifies that
3067 @code{operator new} only returns @code{0} if it is declared
3068 @code{throw()}, in which case the compiler always checks the
3069 return value even without this option.  In all other cases, when
3070 @code{operator new} has a non-empty exception specification, memory
3071 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3072 @samp{new (nothrow)}.
3074 @item -fconcepts
3075 @itemx -fconcepts-ts
3076 @opindex fconcepts
3077 @opindex fconcepts-ts
3078 Enable support for the C++ Concepts feature for constraining template
3079 arguments.  With @option{-std=c++20} and above, Concepts are part of
3080 the language standard, so @option{-fconcepts} defaults to on.
3082 Some constructs that were allowed by the earlier C++ Extensions for
3083 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3084 into the standard, can additionally be enabled by
3085 @option{-fconcepts-ts}.
3087 @item -fconstexpr-depth=@var{n}
3088 @opindex fconstexpr-depth
3089 Set the maximum nested evaluation depth for C++11 constexpr functions
3090 to @var{n}.  A limit is needed to detect endless recursion during
3091 constant expression evaluation.  The minimum specified by the standard
3092 is 512.
3094 @item -fconstexpr-cache-depth=@var{n}
3095 @opindex fconstexpr-cache-depth
3096 Set the maximum level of nested evaluation depth for C++11 constexpr
3097 functions that will be cached to @var{n}.  This is a heuristic that
3098 trades off compilation speed (when the cache avoids repeated
3099 calculations) against memory consumption (when the cache grows very
3100 large from highly recursive evaluations).  The default is 8.  Very few
3101 users are likely to want to adjust it, but if your code does heavy
3102 constexpr calculations you might want to experiment to find which
3103 value works best for you.
3105 @item -fconstexpr-fp-except
3106 @opindex fconstexpr-fp-except
3107 Annex F of the C standard specifies that IEC559 floating point
3108 exceptions encountered at compile time should not stop compilation.
3109 C++ compilers have historically not followed this guidance, instead
3110 treating floating point division by zero as non-constant even though
3111 it has a well defined value.  This flag tells the compiler to give
3112 Annex F priority over other rules saying that a particular operation
3113 is undefined.
3115 @smallexample
3116 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3117 @end smallexample
3119 @item -fconstexpr-loop-limit=@var{n}
3120 @opindex fconstexpr-loop-limit
3121 Set the maximum number of iterations for a loop in C++14 constexpr functions
3122 to @var{n}.  A limit is needed to detect infinite loops during
3123 constant expression evaluation.  The default is 262144 (1<<18).
3125 @item -fconstexpr-ops-limit=@var{n}
3126 @opindex fconstexpr-ops-limit
3127 Set the maximum number of operations during a single constexpr evaluation.
3128 Even when number of iterations of a single loop is limited with the above limit,
3129 if there are several nested loops and each of them has many iterations but still
3130 smaller than the above limit, or if in a body of some loop or even outside
3131 of a loop too many expressions need to be evaluated, the resulting constexpr
3132 evaluation might take too long.
3133 The default is 33554432 (1<<25).
3135 @item -fcoroutines
3136 @opindex fcoroutines
3137 Enable support for the C++ coroutines extension (experimental).
3139 @item -fno-elide-constructors
3140 @opindex fno-elide-constructors
3141 @opindex felide-constructors
3142 The C++ standard allows an implementation to omit creating a temporary
3143 that is only used to initialize another object of the same type.
3144 Specifying this option disables that optimization, and forces G++ to
3145 call the copy constructor in all cases.  This option also causes G++
3146 to call trivial member functions which otherwise would be expanded inline.
3148 In C++17, the compiler is required to omit these temporaries, but this
3149 option still affects trivial member functions.
3151 @item -fno-enforce-eh-specs
3152 @opindex fno-enforce-eh-specs
3153 @opindex fenforce-eh-specs
3154 Don't generate code to check for violation of exception specifications
3155 at run time.  This option violates the C++ standard, but may be useful
3156 for reducing code size in production builds, much like defining
3157 @code{NDEBUG}.  This does not give user code permission to throw
3158 exceptions in violation of the exception specifications; the compiler
3159 still optimizes based on the specifications, so throwing an
3160 unexpected exception results in undefined behavior at run time.
3162 @item -fextern-tls-init
3163 @itemx -fno-extern-tls-init
3164 @opindex fextern-tls-init
3165 @opindex fno-extern-tls-init
3166 The C++11 and OpenMP standards allow @code{thread_local} and
3167 @code{threadprivate} variables to have dynamic (runtime)
3168 initialization.  To support this, any use of such a variable goes
3169 through a wrapper function that performs any necessary initialization.
3170 When the use and definition of the variable are in the same
3171 translation unit, this overhead can be optimized away, but when the
3172 use is in a different translation unit there is significant overhead
3173 even if the variable doesn't actually need dynamic initialization.  If
3174 the programmer can be sure that no use of the variable in a
3175 non-defining TU needs to trigger dynamic initialization (either
3176 because the variable is statically initialized, or a use of the
3177 variable in the defining TU will be executed before any uses in
3178 another TU), they can avoid this overhead with the
3179 @option{-fno-extern-tls-init} option.
3181 On targets that support symbol aliases, the default is
3182 @option{-fextern-tls-init}.  On targets that do not support symbol
3183 aliases, the default is @option{-fno-extern-tls-init}.
3185 @item -ffold-simple-inlines
3186 @itemx -fno-fold-simple-inlines
3187 @opindex ffold-simple-inlines
3188 @opindex fno-fold-simple-inlines
3189 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3190 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3191 means no debug information will be generated for such calls.  Since these
3192 functions are rarely interesting to debug, this flag is enabled by default
3193 unless @option{-fno-inline} is active.
3195 @item -fno-gnu-keywords
3196 @opindex fno-gnu-keywords
3197 @opindex fgnu-keywords
3198 Do not recognize @code{typeof} as a keyword, so that code can use this
3199 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3200 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3201 @option{-std=c++98}, @option{-std=c++11}, etc.
3203 @item -fimplicit-constexpr
3204 @opindex fimplicit-constexpr
3205 Make inline functions implicitly constexpr, if they satisfy the
3206 requirements for a constexpr function.  This option can be used in
3207 C++14 mode or later.  This can result in initialization changing from
3208 dynamic to static and other optimizations.
3210 @item -fno-implicit-templates
3211 @opindex fno-implicit-templates
3212 @opindex fimplicit-templates
3213 Never emit code for non-inline templates that are instantiated
3214 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3215 If you use this option, you must take care to structure your code to
3216 include all the necessary explicit instantiations to avoid getting
3217 undefined symbols at link time.
3218 @xref{Template Instantiation}, for more information.
3220 @item -fno-implicit-inline-templates
3221 @opindex fno-implicit-inline-templates
3222 @opindex fimplicit-inline-templates
3223 Don't emit code for implicit instantiations of inline templates, either.
3224 The default is to handle inlines differently so that compiles with and
3225 without optimization need the same set of explicit instantiations.
3227 @item -fno-implement-inlines
3228 @opindex fno-implement-inlines
3229 @opindex fimplement-inlines
3230 To save space, do not emit out-of-line copies of inline functions
3231 controlled by @code{#pragma implementation}.  This causes linker
3232 errors if these functions are not inlined everywhere they are called.
3234 @item -fmodules-ts
3235 @itemx -fno-modules-ts
3236 @opindex fmodules-ts
3237 @opindex fno-modules-ts
3238 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3239 @option{-fno-modules-ts} is usually not needed, as that is the
3240 default.  Even though this is a C++20 feature, it is not currently
3241 implicitly enabled by selecting that standard version.
3243 @item -fmodule-header
3244 @itemx -fmodule-header=user
3245 @itemx -fmodule-header=system
3246 @opindex fmodule-header
3247 Compile a header file to create an importable header unit.
3249 @item -fmodule-implicit-inline
3250 @opindex fmodule-implicit-inline
3251 Member functions defined in their class definitions are not implicitly
3252 inline for modular code.  This is different to traditional C++
3253 behavior, for good reasons.  However, it may result in a difficulty
3254 during code porting.  This option makes such function definitions
3255 implicitly inline.  It does however generate an ABI incompatibility,
3256 so you must use it everywhere or nowhere.  (Such definitions outside
3257 of a named module remain implicitly inline, regardless.)
3259 @item -fno-module-lazy
3260 @opindex fno-module-lazy
3261 @opindex fmodule-lazy
3262 Disable lazy module importing and module mapper creation.
3264 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3265 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3266 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3267 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3268 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3269 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3270 @vindex CXX_MODULE_MAPPER @r{environment variable}
3271 @opindex fmodule-mapper
3272 An oracle to query for module name to filename mappings.  If
3273 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3274 and if that is unset, an in-process default is provided.
3276 @item -fmodule-only
3277 @opindex fmodule-only
3278 Only emit the Compiled Module Interface, inhibiting any object file.
3280 @item -fms-extensions
3281 @opindex fms-extensions
3282 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3283 int and getting a pointer to member function via non-standard syntax.
3285 @item -fnew-inheriting-ctors
3286 @opindex fnew-inheriting-ctors
3287 Enable the P0136 adjustment to the semantics of C++11 constructor
3288 inheritance.  This is part of C++17 but also considered to be a Defect
3289 Report against C++11 and C++14.  This flag is enabled by default
3290 unless @option{-fabi-version=10} or lower is specified.
3292 @item -fnew-ttp-matching
3293 @opindex fnew-ttp-matching
3294 Enable the P0522 resolution to Core issue 150, template template
3295 parameters and default arguments: this allows a template with default
3296 template arguments as an argument for a template template parameter
3297 with fewer template parameters.  This flag is enabled by default for
3298 @option{-std=c++17}.
3300 @item -fno-nonansi-builtins
3301 @opindex fno-nonansi-builtins
3302 @opindex fnonansi-builtins
3303 Disable built-in declarations of functions that are not mandated by
3304 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3305 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3307 @item -fnothrow-opt
3308 @opindex fnothrow-opt
3309 Treat a @code{throw()} exception specification as if it were a
3310 @code{noexcept} specification to reduce or eliminate the text size
3311 overhead relative to a function with no exception specification.  If
3312 the function has local variables of types with non-trivial
3313 destructors, the exception specification actually makes the
3314 function smaller because the EH cleanups for those variables can be
3315 optimized away.  The semantic effect is that an exception thrown out of
3316 a function with such an exception specification results in a call
3317 to @code{terminate} rather than @code{unexpected}.
3319 @item -fno-operator-names
3320 @opindex fno-operator-names
3321 @opindex foperator-names
3322 Do not treat the operator name keywords @code{and}, @code{bitand},
3323 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3324 synonyms as keywords.
3326 @item -fno-optional-diags
3327 @opindex fno-optional-diags
3328 @opindex foptional-diags
3329 Disable diagnostics that the standard says a compiler does not need to
3330 issue.  Currently, the only such diagnostic issued by G++ is the one for
3331 a name having multiple meanings within a class.
3333 @item -fpermissive
3334 @opindex fpermissive
3335 Downgrade some diagnostics about nonconformant code from errors to
3336 warnings.  Thus, using @option{-fpermissive} allows some
3337 nonconforming code to compile.
3339 @item -fno-pretty-templates
3340 @opindex fno-pretty-templates
3341 @opindex fpretty-templates
3342 When an error message refers to a specialization of a function
3343 template, the compiler normally prints the signature of the
3344 template followed by the template arguments and any typedefs or
3345 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3346 rather than @code{void f(int)}) so that it's clear which template is
3347 involved.  When an error message refers to a specialization of a class
3348 template, the compiler omits any template arguments that match
3349 the default template arguments for that template.  If either of these
3350 behaviors make it harder to understand the error message rather than
3351 easier, you can use @option{-fno-pretty-templates} to disable them.
3353 @item -fno-rtti
3354 @opindex fno-rtti
3355 @opindex frtti
3356 Disable generation of information about every class with virtual
3357 functions for use by the C++ run-time type identification features
3358 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3359 of the language, you can save some space by using this flag.  Note that
3360 exception handling uses the same information, but G++ generates it as
3361 needed. The @code{dynamic_cast} operator can still be used for casts that
3362 do not require run-time type information, i.e.@: casts to @code{void *} or to
3363 unambiguous base classes.
3365 Mixing code compiled with @option{-frtti} with that compiled with
3366 @option{-fno-rtti} may not work.  For example, programs may
3367 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3368 for a class compiled with @option{-frtti}.  
3370 @item -fsized-deallocation
3371 @opindex fsized-deallocation
3372 Enable the built-in global declarations
3373 @smallexample
3374 void operator delete (void *, std::size_t) noexcept;
3375 void operator delete[] (void *, std::size_t) noexcept;
3376 @end smallexample
3377 as introduced in C++14.  This is useful for user-defined replacement
3378 deallocation functions that, for example, use the size of the object
3379 to make deallocation faster.  Enabled by default under
3380 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3381 warns about places that might want to add a definition.
3383 @item -fstrict-enums
3384 @opindex fstrict-enums
3385 Allow the compiler to optimize using the assumption that a value of
3386 enumerated type can only be one of the values of the enumeration (as
3387 defined in the C++ standard; basically, a value that can be
3388 represented in the minimum number of bits needed to represent all the
3389 enumerators).  This assumption may not be valid if the program uses a
3390 cast to convert an arbitrary integer value to the enumerated type.
3392 @item -fstrong-eval-order
3393 @opindex fstrong-eval-order
3394 Evaluate member access, array subscripting, and shift expressions in
3395 left-to-right order, and evaluate assignment in right-to-left order,
3396 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3397 @option{-fstrong-eval-order=some} enables just the ordering of member
3398 access and shift expressions, and is the default without
3399 @option{-std=c++17}.
3401 @item -ftemplate-backtrace-limit=@var{n}
3402 @opindex ftemplate-backtrace-limit
3403 Set the maximum number of template instantiation notes for a single
3404 warning or error to @var{n}.  The default value is 10.
3406 @item -ftemplate-depth=@var{n}
3407 @opindex ftemplate-depth
3408 Set the maximum instantiation depth for template classes to @var{n}.
3409 A limit on the template instantiation depth is needed to detect
3410 endless recursions during template class instantiation.  ANSI/ISO C++
3411 conforming programs must not rely on a maximum depth greater than 17
3412 (changed to 1024 in C++11).  The default value is 900, as the compiler
3413 can run out of stack space before hitting 1024 in some situations.
3415 @item -fno-threadsafe-statics
3416 @opindex fno-threadsafe-statics
3417 @opindex fthreadsafe-statics
3418 Do not emit the extra code to use the routines specified in the C++
3419 ABI for thread-safe initialization of local statics.  You can use this
3420 option to reduce code size slightly in code that doesn't need to be
3421 thread-safe.
3423 @item -fuse-cxa-atexit
3424 @opindex fuse-cxa-atexit
3425 Register destructors for objects with static storage duration with the
3426 @code{__cxa_atexit} function rather than the @code{atexit} function.
3427 This option is required for fully standards-compliant handling of static
3428 destructors, but only works if your C library supports
3429 @code{__cxa_atexit}.
3431 @item -fno-use-cxa-get-exception-ptr
3432 @opindex fno-use-cxa-get-exception-ptr
3433 @opindex fuse-cxa-get-exception-ptr
3434 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3435 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3436 if the runtime routine is not available.
3438 @item -fvisibility-inlines-hidden
3439 @opindex fvisibility-inlines-hidden
3440 This switch declares that the user does not attempt to compare
3441 pointers to inline functions or methods where the addresses of the two functions
3442 are taken in different shared objects.
3444 The effect of this is that GCC may, effectively, mark inline methods with
3445 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3446 appear in the export table of a DSO and do not require a PLT indirection
3447 when used within the DSO@.  Enabling this option can have a dramatic effect
3448 on load and link times of a DSO as it massively reduces the size of the
3449 dynamic export table when the library makes heavy use of templates.
3451 The behavior of this switch is not quite the same as marking the
3452 methods as hidden directly, because it does not affect static variables
3453 local to the function or cause the compiler to deduce that
3454 the function is defined in only one shared object.
3456 You may mark a method as having a visibility explicitly to negate the
3457 effect of the switch for that method.  For example, if you do want to
3458 compare pointers to a particular inline method, you might mark it as
3459 having default visibility.  Marking the enclosing class with explicit
3460 visibility has no effect.
3462 Explicitly instantiated inline methods are unaffected by this option
3463 as their linkage might otherwise cross a shared library boundary.
3464 @xref{Template Instantiation}.
3466 @item -fvisibility-ms-compat
3467 @opindex fvisibility-ms-compat
3468 This flag attempts to use visibility settings to make GCC's C++
3469 linkage model compatible with that of Microsoft Visual Studio.
3471 The flag makes these changes to GCC's linkage model:
3473 @enumerate
3474 @item
3475 It sets the default visibility to @code{hidden}, like
3476 @option{-fvisibility=hidden}.
3478 @item
3479 Types, but not their members, are not hidden by default.
3481 @item
3482 The One Definition Rule is relaxed for types without explicit
3483 visibility specifications that are defined in more than one
3484 shared object: those declarations are permitted if they are
3485 permitted when this option is not used.
3486 @end enumerate
3488 In new code it is better to use @option{-fvisibility=hidden} and
3489 export those classes that are intended to be externally visible.
3490 Unfortunately it is possible for code to rely, perhaps accidentally,
3491 on the Visual Studio behavior.
3493 Among the consequences of these changes are that static data members
3494 of the same type with the same name but defined in different shared
3495 objects are different, so changing one does not change the other;
3496 and that pointers to function members defined in different shared
3497 objects may not compare equal.  When this flag is given, it is a
3498 violation of the ODR to define types with the same name differently.
3500 @item -fno-weak
3501 @opindex fno-weak
3502 @opindex fweak
3503 Do not use weak symbol support, even if it is provided by the linker.
3504 By default, G++ uses weak symbols if they are available.  This
3505 option exists only for testing, and should not be used by end-users;
3506 it results in inferior code and has no benefits.  This option may
3507 be removed in a future release of G++.
3509 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3510 @opindex fext-numeric-literals
3511 @opindex fno-ext-numeric-literals
3512 Accept imaginary, fixed-point, or machine-defined
3513 literal number suffixes as GNU extensions.
3514 When this option is turned off these suffixes are treated
3515 as C++11 user-defined literal numeric suffixes.
3516 This is on by default for all pre-C++11 dialects and all GNU dialects:
3517 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3518 @option{-std=gnu++14}.
3519 This option is off by default
3520 for ISO C++11 onwards (@option{-std=c++11}, ...).
3522 @item -nostdinc++
3523 @opindex nostdinc++
3524 Do not search for header files in the standard directories specific to
3525 C++, but do still search the other standard directories.  (This option
3526 is used when building the C++ library.)
3528 @item -flang-info-include-translate
3529 @itemx -flang-info-include-translate-not
3530 @itemx -flang-info-include-translate=@var{header}
3531 @opindex flang-info-include-translate
3532 @opindex flang-info-include-translate-not
3533 Inform of include translation events.  The first will note accepted
3534 include translations, the second will note declined include
3535 translations.  The @var{header} form will inform of include
3536 translations relating to that specific header.  If @var{header} is of
3537 the form @code{"user"} or @code{<system>} it will be resolved to a
3538 specific user or system header using the include path.
3540 @item -flang-info-module-cmi
3541 @itemx -flang-info-module-cmi=@var{module}
3542 @opindex flang-info-module-cmi
3543 Inform of Compiled Module Interface pathnames.  The first will note
3544 all read CMI pathnames.  The @var{module} form will not reading a
3545 specific module's CMI.  @var{module} may be a named module or a
3546 header-unit (the latter indicated by either being a pathname containing
3547 directory separators or enclosed in @code{<>} or @code{""}).
3549 @item -stdlib=@var{libstdc++,libc++}
3550 @opindex stdlib
3551 When G++ is configured to support this option, it allows specification of
3552 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3553 (the default, native C++ runtime for G++) and @var{libc++} which is the
3554 C++ runtime installed on some operating systems (e.g. Darwin versions from
3555 Darwin11 onwards).  The option switches G++ to use the headers from the
3556 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3557 when a C++ runtime is required for linking.
3558 @end table
3560 In addition, these warning options have meanings only for C++ programs:
3562 @table @gcctabopt
3563 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3564 @opindex Wabi-tag
3565 Warn when a type with an ABI tag is used in a context that does not
3566 have that ABI tag.  See @ref{C++ Attributes} for more information
3567 about ABI tags.
3569 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3570 @opindex Wcomma-subscript
3571 @opindex Wno-comma-subscript
3572 Warn about uses of a comma expression within a subscripting expression.
3573 This usage was deprecated in C++20 and is going to be removed in C++23.
3574 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3576 @smallexample
3577 @group
3578 void f(int *a, int b, int c) @{
3579     a[b,c];     // deprecated in C++20, invalid in C++23
3580     a[(b,c)];   // OK
3582 @end group
3583 @end smallexample
3585 In C++23 it is valid to have comma separated expressions in a subscript
3586 when an overloaded subscript operator is found and supports the right
3587 number and types of arguments.  G++ will accept the formerly valid syntax
3588 for code that is not valid in C++23 but used to be valid but deprecated
3589 in C++20 with a pedantic warning that can be disabled with
3590 @option{-Wno-comma-subscript}.
3592 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3593 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3595 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3596 @opindex Wctad-maybe-unsupported
3597 @opindex Wno-ctad-maybe-unsupported
3598 Warn when performing class template argument deduction (CTAD) on a type with
3599 no explicitly written deduction guides.  This warning will point out cases
3600 where CTAD succeeded only because the compiler synthesized the implicit
3601 deduction guides, which might not be what the programmer intended.  Certain
3602 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3603 types that are designed to support CTAD.  This warning can be suppressed with
3604 the following pattern:
3606 @smallexample
3607 struct allow_ctad_t; // any name works
3608 template <typename T> struct S @{
3609   S(T) @{ @}
3611 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
3612 @end smallexample
3614 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3615 @opindex Wctor-dtor-privacy
3616 @opindex Wno-ctor-dtor-privacy
3617 Warn when a class seems unusable because all the constructors or
3618 destructors in that class are private, and it has neither friends nor
3619 public static member functions.  Also warn if there are no non-private
3620 methods, and there's at least one private member function that isn't
3621 a constructor or destructor.
3623 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3624 @opindex Wdangling-reference
3625 @opindex Wno-dangling-reference
3626 Warn when a reference is bound to a temporary whose lifetime has ended.
3627 For example:
3629 @smallexample
3630 int n = 1;
3631 const int& r = std::max(n - 1, n + 1); // r is dangling
3632 @end smallexample
3634 In the example above, two temporaries are created, one for each
3635 argument, and a reference to one of the temporaries is returned.
3636 However, both temporaries are destroyed at the end of the full
3637 expression, so the reference @code{r} is dangling.  This warning
3638 also detects dangling references in member initializer lists:
3640 @smallexample
3641 const int& f(const int& i) @{ return i; @}
3642 struct S @{
3643   const int &r; // r is dangling
3644   S() : r(f(10)) @{ @}
3646 @end smallexample
3648 Member functions are checked as well, but only their object argument:
3650 @smallexample
3651 struct S @{
3652    const S& self () @{ return *this; @}
3654 const S& s = S().self(); // s is dangling
3655 @end smallexample
3657 Certain functions are safe in this respect, for example @code{std::use_facet}:
3658 they take and return a reference, but they don't return one of its arguments,
3659 which can fool the warning.  Such functions can be excluded from the warning
3660 by wrapping them in a @code{#pragma}:
3662 @smallexample
3663 #pragma GCC diagnostic push
3664 #pragma GCC diagnostic ignored "-Wdangling-reference"
3665 const T& foo (const T&) @{ @dots{} @}
3666 #pragma GCC diagnostic pop
3667 @end smallexample
3669 This warning is enabled by @option{-Wall}.
3671 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3672 @opindex Wdelete-non-virtual-dtor
3673 @opindex Wno-delete-non-virtual-dtor
3674 Warn when @code{delete} is used to destroy an instance of a class that
3675 has virtual functions and non-virtual destructor. It is unsafe to delete
3676 an instance of a derived class through a pointer to a base class if the
3677 base class does not have a virtual destructor.  This warning is enabled
3678 by @option{-Wall}.
3680 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3681 @opindex Wdeprecated-copy
3682 @opindex Wno-deprecated-copy
3683 Warn that the implicit declaration of a copy constructor or copy
3684 assignment operator is deprecated if the class has a user-provided
3685 copy constructor or copy assignment operator, in C++11 and up.  This
3686 warning is enabled by @option{-Wextra}.  With
3687 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3688 user-provided destructor.
3690 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3691 @opindex Wdeprecated-enum-enum-conversion
3692 @opindex Wno-deprecated-enum-enum-conversion
3693 Disable the warning about the case when the usual arithmetic conversions
3694 are applied on operands where one is of enumeration type and the other is
3695 of a different enumeration type.  This conversion was deprecated in C++20.
3696 For example:
3698 @smallexample
3699 enum E1 @{ e @};
3700 enum E2 @{ f @};
3701 int k = f - e;
3702 @end smallexample
3704 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3705 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3706 by @option{-Wenum-conversion}.
3708 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3709 @opindex Wdeprecated-enum-float-conversion
3710 @opindex Wno-deprecated-enum-float-conversion
3711 Disable the warning about the case when the usual arithmetic conversions
3712 are applied on operands where one is of enumeration type and the other is
3713 of a floating-point type.  This conversion was deprecated in C++20.  For
3714 example:
3716 @smallexample
3717 enum E1 @{ e @};
3718 enum E2 @{ f @};
3719 bool b = e <= 3.7;
3720 @end smallexample
3722 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3723 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3724 by @option{-Wenum-conversion}.
3726 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3727 @opindex Winit-list-lifetime
3728 @opindex Wno-init-list-lifetime
3729 Do not warn about uses of @code{std::initializer_list} that are likely
3730 to result in dangling pointers.  Since the underlying array for an
3731 @code{initializer_list} is handled like a normal C++ temporary object,
3732 it is easy to inadvertently keep a pointer to the array past the end
3733 of the array's lifetime.  For example:
3735 @itemize @bullet
3736 @item
3737 If a function returns a temporary @code{initializer_list}, or a local
3738 @code{initializer_list} variable, the array's lifetime ends at the end
3739 of the return statement, so the value returned has a dangling pointer.
3741 @item
3742 If a new-expression creates an @code{initializer_list}, the array only
3743 lives until the end of the enclosing full-expression, so the
3744 @code{initializer_list} in the heap has a dangling pointer.
3746 @item
3747 When an @code{initializer_list} variable is assigned from a
3748 brace-enclosed initializer list, the temporary array created for the
3749 right side of the assignment only lives until the end of the
3750 full-expression, so at the next statement the @code{initializer_list}
3751 variable has a dangling pointer.
3753 @smallexample
3754 // li's initial underlying array lives as long as li
3755 std::initializer_list<int> li = @{ 1,2,3 @};
3756 // assignment changes li to point to a temporary array
3757 li = @{ 4, 5 @};
3758 // now the temporary is gone and li has a dangling pointer
3759 int i = li.begin()[0] // undefined behavior
3760 @end smallexample
3762 @item
3763 When a list constructor stores the @code{begin} pointer from the
3764 @code{initializer_list} argument, this doesn't extend the lifetime of
3765 the array, so if a class variable is constructed from a temporary
3766 @code{initializer_list}, the pointer is left dangling by the end of
3767 the variable declaration statement.
3769 @end itemize
3771 @item -Winvalid-imported-macros
3772 @opindex Winvalid-imported-macros
3773 @opindex Wno-invalid-imported-macros
3774 Verify all imported macro definitions are valid at the end of
3775 compilation.  This is not enabled by default, as it requires
3776 additional processing to determine.  It may be useful when preparing
3777 sets of header-units to ensure consistent macros.
3779 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3780 @opindex Wliteral-suffix
3781 @opindex Wno-literal-suffix
3782 Do not warn when a string or character literal is followed by a
3783 ud-suffix which does not begin with an underscore.  As a conforming
3784 extension, GCC treats such suffixes as separate preprocessing tokens
3785 in order to maintain backwards compatibility with code that uses
3786 formatting macros from @code{<inttypes.h>}.  For example:
3788 @smallexample
3789 #define __STDC_FORMAT_MACROS
3790 #include <inttypes.h>
3791 #include <stdio.h>
3793 int main() @{
3794   int64_t i64 = 123;
3795   printf("My int64: %" PRId64"\n", i64);
3797 @end smallexample
3799 In this case, @code{PRId64} is treated as a separate preprocessing token.
3801 This option also controls warnings when a user-defined literal
3802 operator is declared with a literal suffix identifier that doesn't
3803 begin with an underscore. Literal suffix identifiers that don't begin
3804 with an underscore are reserved for future standardization.
3806 These warnings are enabled by default.
3808 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3809 @opindex Wnarrowing
3810 @opindex Wno-narrowing
3811 For C++11 and later standards, narrowing conversions are diagnosed by default,
3812 as required by the standard.  A narrowing conversion from a constant produces
3813 an error, and a narrowing conversion from a non-constant produces a warning,
3814 but @option{-Wno-narrowing} suppresses the diagnostic.
3815 Note that this does not affect the meaning of well-formed code;
3816 narrowing conversions are still considered ill-formed in SFINAE contexts.
3818 With @option{-Wnarrowing} in C++98, warn when a narrowing
3819 conversion prohibited by C++11 occurs within
3820 @samp{@{ @}}, e.g.
3822 @smallexample
3823 int i = @{ 2.2 @}; // error: narrowing from double to int
3824 @end smallexample
3826 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3828 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3829 @opindex Wnoexcept
3830 @opindex Wno-noexcept
3831 Warn when a noexcept-expression evaluates to false because of a call
3832 to a function that does not have a non-throwing exception
3833 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3834 the compiler to never throw an exception.
3836 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3837 @opindex Wnoexcept-type
3838 @opindex Wno-noexcept-type
3839 Warn if the C++17 feature making @code{noexcept} part of a function
3840 type changes the mangled name of a symbol relative to C++14.  Enabled
3841 by @option{-Wabi} and @option{-Wc++17-compat}.
3843 As an example:
3845 @smallexample
3846 template <class T> void f(T t) @{ t(); @};
3847 void g() noexcept;
3848 void h() @{ f(g); @} 
3849 @end smallexample
3851 @noindent
3852 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3853 C++17 it calls @code{f<void(*)()noexcept>}.
3855 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3856 @opindex Wclass-memaccess
3857 @opindex Wno-class-memaccess
3858 Warn when the destination of a call to a raw memory function such as
3859 @code{memset} or @code{memcpy} is an object of class type, and when writing
3860 into such an object might bypass the class non-trivial or deleted constructor
3861 or copy assignment, violate const-correctness or encapsulation, or corrupt
3862 virtual table pointers.  Modifying the representation of such objects may
3863 violate invariants maintained by member functions of the class.  For example,
3864 the call to @code{memset} below is undefined because it modifies a non-trivial
3865 class object and is, therefore, diagnosed.  The safe way to either initialize
3866 or clear the storage of objects of such types is by using the appropriate
3867 constructor or assignment operator, if one is available.
3868 @smallexample
3869 std::string str = "abc";
3870 memset (&str, 0, sizeof str);
3871 @end smallexample
3872 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3873 Explicitly casting the pointer to the class object to @code{void *} or
3874 to a type that can be safely accessed by the raw memory function suppresses
3875 the warning.
3877 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3878 @opindex Wnon-virtual-dtor
3879 @opindex Wno-non-virtual-dtor
3880 Warn when a class has virtual functions and an accessible non-virtual
3881 destructor itself or in an accessible polymorphic base class, in which
3882 case it is possible but unsafe to delete an instance of a derived
3883 class through a pointer to the class itself or base class.  This
3884 warning is automatically enabled if @option{-Weffc++} is specified.
3886 @item -Wregister @r{(C++ and Objective-C++ only)}
3887 @opindex Wregister
3888 @opindex Wno-register
3889 Warn on uses of the @code{register} storage class specifier, except
3890 when it is part of the GNU @ref{Explicit Register Variables} extension.
3891 The use of the @code{register} keyword as storage class specifier has
3892 been deprecated in C++11 and removed in C++17.
3893 Enabled by default with @option{-std=c++17}.
3895 @item -Wreorder @r{(C++ and Objective-C++ only)}
3896 @opindex Wreorder
3897 @opindex Wno-reorder
3898 @cindex reordering, warning
3899 @cindex warning for reordering of member initializers
3900 Warn when the order of member initializers given in the code does not
3901 match the order in which they must be executed.  For instance:
3903 @smallexample
3904 struct A @{
3905   int i;
3906   int j;
3907   A(): j (0), i (1) @{ @}
3909 @end smallexample
3911 @noindent
3912 The compiler rearranges the member initializers for @code{i}
3913 and @code{j} to match the declaration order of the members, emitting
3914 a warning to that effect.  This warning is enabled by @option{-Wall}.
3916 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3917 @opindex Wpessimizing-move
3918 @opindex Wno-pessimizing-move
3919 This warning warns when a call to @code{std::move} prevents copy
3920 elision.  A typical scenario when copy elision can occur is when returning in
3921 a function with a class return type, when the expression being returned is the
3922 name of a non-volatile automatic object, and is not a function parameter, and
3923 has the same type as the function return type.
3925 @smallexample
3926 struct T @{
3927 @dots{}
3929 T fn()
3931   T t;
3932   @dots{}
3933   return std::move (t);
3935 @end smallexample
3937 But in this example, the @code{std::move} call prevents copy elision.
3939 This warning is enabled by @option{-Wall}.
3941 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3942 @opindex Wredundant-move
3943 @opindex Wno-redundant-move
3944 This warning warns about redundant calls to @code{std::move}; that is, when
3945 a move operation would have been performed even without the @code{std::move}
3946 call.  This happens because the compiler is forced to treat the object as if
3947 it were an rvalue in certain situations such as returning a local variable,
3948 where copy elision isn't applicable.  Consider:
3950 @smallexample
3951 struct T @{
3952 @dots{}
3954 T fn(T t)
3956   @dots{}
3957   return std::move (t);
3959 @end smallexample
3961 Here, the @code{std::move} call is redundant.  Because G++ implements Core
3962 Issue 1579, another example is:
3964 @smallexample
3965 struct T @{ // convertible to U
3966 @dots{}
3968 struct U @{
3969 @dots{}
3971 U fn()
3973   T t;
3974   @dots{}
3975   return std::move (t);
3977 @end smallexample
3978 In this example, copy elision isn't applicable because the type of the
3979 expression being returned and the function return type differ, yet G++
3980 treats the return value as if it were designated by an rvalue.
3982 This warning is enabled by @option{-Wextra}.
3984 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
3985 @opindex Wrange-loop-construct
3986 @opindex Wno-range-loop-construct
3987 This warning warns when a C++ range-based for-loop is creating an unnecessary
3988 copy.  This can happen when the range declaration is not a reference, but
3989 probably should be.  For example:
3991 @smallexample
3992 struct S @{ char arr[128]; @};
3993 void fn () @{
3994   S arr[5];
3995   for (const auto x : arr) @{ @dots{} @}
3997 @end smallexample
3999 It does not warn when the type being copied is a trivially-copyable type whose
4000 size is less than 64 bytes.
4002 This warning also warns when a loop variable in a range-based for-loop is
4003 initialized with a value of a different type resulting in a copy.  For example:
4005 @smallexample
4006 void fn() @{
4007   int arr[10];
4008   for (const double &x : arr) @{ @dots{} @}
4010 @end smallexample
4012 In the example above, in every iteration of the loop a temporary value of
4013 type @code{double} is created and destroyed, to which the reference
4014 @code{const double &} is bound.
4016 This warning is enabled by @option{-Wall}.
4018 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4019 @opindex Wredundant-tags
4020 @opindex Wno-redundant-tags
4021 Warn about redundant class-key and enum-key in references to class types
4022 and enumerated types in contexts where the key can be eliminated without
4023 causing an ambiguity.  For example:
4025 @smallexample
4026 struct foo;
4027 struct foo *p;   // warn that keyword struct can be eliminated
4028 @end smallexample
4030 @noindent
4031 On the other hand, in this example there is no warning:
4033 @smallexample
4034 struct foo;
4035 void foo ();   // "hides" struct foo
4036 void bar (struct foo&);  // no warning, keyword struct is necessary
4037 @end smallexample
4039 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4040 @opindex Wsubobject-linkage
4041 @opindex Wno-subobject-linkage
4042 Do not warn
4043 if a class type has a base or a field whose type uses the anonymous
4044 namespace or depends on a type with no linkage.  If a type A depends on
4045 a type B with no or internal linkage, defining it in multiple
4046 translation units would be an ODR violation because the meaning of B
4047 is different in each translation unit.  If A only appears in a single
4048 translation unit, the best way to silence the warning is to give it
4049 internal linkage by putting it in an anonymous namespace as well.  The
4050 compiler doesn't give this warning for types defined in the main .C
4051 file, as those are unlikely to have multiple definitions.
4052 @option{-Wsubobject-linkage} is enabled by default.
4054 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4055 @opindex Weffc++
4056 @opindex Wno-effc++
4057 Warn about violations of the following style guidelines from Scott Meyers'
4058 @cite{Effective C++} series of books:
4060 @itemize @bullet
4061 @item
4062 Define a copy constructor and an assignment operator for classes
4063 with dynamically-allocated memory.
4065 @item
4066 Prefer initialization to assignment in constructors.
4068 @item
4069 Have @code{operator=} return a reference to @code{*this}.
4071 @item
4072 Don't try to return a reference when you must return an object.
4074 @item
4075 Distinguish between prefix and postfix forms of increment and
4076 decrement operators.
4078 @item
4079 Never overload @code{&&}, @code{||}, or @code{,}.
4081 @end itemize
4083 This option also enables @option{-Wnon-virtual-dtor}, which is also
4084 one of the effective C++ recommendations.  However, the check is
4085 extended to warn about the lack of virtual destructor in accessible
4086 non-polymorphic bases classes too.
4088 When selecting this option, be aware that the standard library
4089 headers do not obey all of these guidelines; use @samp{grep -v}
4090 to filter out those warnings.
4092 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4093 @opindex Wexceptions
4094 @opindex Wno-exceptions
4095 Disable the warning about the case when an exception handler is shadowed by
4096 another handler, which can point out a wrong ordering of exception handlers.
4098 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4099 @opindex Wstrict-null-sentinel
4100 @opindex Wno-strict-null-sentinel
4101 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4102 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4103 to @code{__null}.  Although it is a null pointer constant rather than a
4104 null pointer, it is guaranteed to be of the same size as a pointer.
4105 But this use is not portable across different compilers.
4107 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4108 @opindex Wno-non-template-friend
4109 @opindex Wnon-template-friend
4110 Disable warnings when non-template friend functions are declared
4111 within a template.  In very old versions of GCC that predate implementation
4112 of the ISO standard, declarations such as 
4113 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4114 could be interpreted as a particular specialization of a template
4115 function; the warning exists to diagnose compatibility problems, 
4116 and is enabled by default.
4118 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4119 @opindex Wold-style-cast
4120 @opindex Wno-old-style-cast
4121 Warn if an old-style (C-style) cast to a non-void type is used within
4122 a C++ program.  The new-style casts (@code{dynamic_cast},
4123 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4124 less vulnerable to unintended effects and much easier to search for.
4126 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4127 @itemx -Woverloaded-virtual=@var{n}
4128 @opindex Woverloaded-virtual
4129 @opindex Wno-overloaded-virtual
4130 @cindex overloaded virtual function, warning
4131 @cindex warning for overloaded virtual function
4132 Warn when a function declaration hides virtual functions from a
4133 base class.  For example, in:
4135 @smallexample
4136 struct A @{
4137   virtual void f();
4140 struct B: public A @{
4141   void f(int); // does not override
4143 @end smallexample
4145 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4146 like:
4148 @smallexample
4149 B* b;
4150 b->f();
4151 @end smallexample
4153 @noindent
4154 fails to compile.
4156 The optional level suffix controls the behavior when all the
4157 declarations in the derived class override virtual functions in the
4158 base class, even if not all of the base functions are overridden:
4160 @smallexample
4161 struct C @{
4162   virtual void f();
4163   virtual void f(int);
4166 struct D: public C @{
4167   void f(int); // does override
4169 @end smallexample
4171 This pattern is less likely to be a mistake; if D is only used
4172 virtually, the user might have decided that the base class semantics
4173 for some of the overloads are fine.
4175 At level 1, this case does not warn; at level 2, it does.
4176 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4177 included in @option{-Wall}.
4179 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4180 @opindex Wno-pmf-conversions
4181 @opindex Wpmf-conversions
4182 Disable the diagnostic for converting a bound pointer to member function
4183 to a plain pointer.
4185 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4186 @opindex Wsign-promo
4187 @opindex Wno-sign-promo
4188 Warn when overload resolution chooses a promotion from unsigned or
4189 enumerated type to a signed type, over a conversion to an unsigned type of
4190 the same size.  Previous versions of G++ tried to preserve
4191 unsignedness, but the standard mandates the current behavior.
4193 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4194 @opindex Wtemplates
4195 @opindex Wno-templates
4196 Warn when a primary template declaration is encountered.  Some coding
4197 rules disallow templates, and this may be used to enforce that rule.
4198 The warning is inactive inside a system header file, such as the STL, so
4199 one can still use the STL.  One may also instantiate or specialize
4200 templates.
4202 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4203 @opindex Wmismatched-new-delete
4204 @opindex Wno-mismatched-new-delete
4205 Warn for mismatches between calls to @code{operator new} or @code{operator
4206 delete} and the corresponding call to the allocation or deallocation function.
4207 This includes invocations of C++ @code{operator delete} with pointers
4208 returned from either mismatched forms of @code{operator new}, or from other
4209 functions that allocate objects for which the @code{operator delete} isn't
4210 a suitable deallocator, as well as calls to other deallocation functions
4211 with pointers returned from @code{operator new} for which the deallocation
4212 function isn't suitable.
4214 For example, the @code{delete} expression in the function below is diagnosed
4215 because it doesn't match the array form of the @code{new} expression
4216 the pointer argument was returned from.  Similarly, the call to @code{free}
4217 is also diagnosed.
4219 @smallexample
4220 void f ()
4222   int *a = new int[n];
4223   delete a;   // warning: mismatch in array forms of expressions
4225   char *p = new char[n];
4226   free (p);   // warning: mismatch between new and free
4228 @end smallexample
4230 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4231 involving allocation and deallocation functions other than @code{operator
4232 new} and @code{operator delete}.
4234 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4236 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4237 @opindex Wmismatched-tags
4238 @opindex Wno-mismatched-tags
4239 Warn for declarations of structs, classes, and class templates and their
4240 specializations with a class-key that does not match either the definition
4241 or the first declaration if no definition is provided.
4243 For example, the declaration of @code{struct Object} in the argument list
4244 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4245 class-key @code{struct} or replace it with @code{class} to match its definition.
4246 @smallexample
4247 class Object @{
4248 public:
4249   virtual ~Object () = 0;
4251 void draw (struct Object*);
4252 @end smallexample
4254 It is not wrong to declare a class with the class-key @code{struct} as
4255 the example above shows.  The @option{-Wmismatched-tags} option is intended
4256 to help achieve a consistent style of class declarations.  In code that is
4257 intended to be portable to Windows-based compilers the warning helps prevent
4258 unresolved references due to the difference in the mangling of symbols
4259 declared with different class-keys.  The option can be used either on its
4260 own or in conjunction with @option{-Wredundant-tags}.
4262 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4263 @opindex Wmultiple-inheritance
4264 @opindex Wno-multiple-inheritance
4265 Warn when a class is defined with multiple direct base classes.  Some
4266 coding rules disallow multiple inheritance, and this may be used to
4267 enforce that rule.  The warning is inactive inside a system header file,
4268 such as the STL, so one can still use the STL.  One may also define
4269 classes that indirectly use multiple inheritance.
4271 @item -Wvirtual-inheritance
4272 @opindex Wvirtual-inheritance
4273 @opindex Wno-virtual-inheritance
4274 Warn when a class is defined with a virtual direct base class.  Some
4275 coding rules disallow multiple inheritance, and this may be used to
4276 enforce that rule.  The warning is inactive inside a system header file,
4277 such as the STL, so one can still use the STL.  One may also define
4278 classes that indirectly use virtual inheritance.
4280 @item -Wno-virtual-move-assign
4281 @opindex Wvirtual-move-assign
4282 @opindex Wno-virtual-move-assign
4283 Suppress warnings about inheriting from a virtual base with a
4284 non-trivial C++11 move assignment operator.  This is dangerous because
4285 if the virtual base is reachable along more than one path, it is
4286 moved multiple times, which can mean both objects end up in the
4287 moved-from state.  If the move assignment operator is written to avoid
4288 moving from a moved-from object, this warning can be disabled.
4290 @item -Wnamespaces
4291 @opindex Wnamespaces
4292 @opindex Wno-namespaces
4293 Warn when a namespace definition is opened.  Some coding rules disallow
4294 namespaces, and this may be used to enforce that rule.  The warning is
4295 inactive inside a system header file, such as the STL, so one can still
4296 use the STL.  One may also use using directives and qualified names.
4298 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4299 @opindex Wterminate
4300 @opindex Wno-terminate
4301 Disable the warning about a throw-expression that will immediately
4302 result in a call to @code{terminate}.
4304 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4305 @opindex Wvexing-parse
4306 @opindex Wno-vexing-parse
4307 Warn about the most vexing parse syntactic ambiguity.  This warns about
4308 the cases when a declaration looks like a variable definition, but the
4309 C++ language requires it to be interpreted as a function declaration.
4310 For instance:
4312 @smallexample
4313 void f(double a) @{
4314   int i();        // extern int i (void);
4315   int n(int(a));  // extern int n (int);
4317 @end smallexample
4319 Another example:
4321 @smallexample
4322 struct S @{ S(int); @};
4323 void f(double a) @{
4324   S x(int(a));   // extern struct S x (int);
4325   S y(int());    // extern struct S y (int (*) (void));
4326   S z();         // extern struct S z (void);
4328 @end smallexample
4330 The warning will suggest options how to deal with such an ambiguity; e.g.,
4331 it can suggest removing the parentheses or using braces instead.
4333 This warning is enabled by default.
4335 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4336 @opindex Wno-class-conversion
4337 @opindex Wclass-conversion
4338 Do not warn when a conversion function converts an
4339 object to the same type, to a base class of that type, or to void; such
4340 a conversion function will never be called.
4342 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4343 @opindex Wvolatile
4344 @opindex Wno-volatile
4345 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4346 postfix and prefix @code{++} and @code{--} expressions of
4347 @code{volatile}-qualified types, using simple assignments where the left
4348 operand is a @code{volatile}-qualified non-class type for their value,
4349 compound assignments where the left operand is a @code{volatile}-qualified
4350 non-class type, @code{volatile}-qualified function return type,
4351 @code{volatile}-qualified parameter type, and structured bindings of a
4352 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4354 Enabled by default with @option{-std=c++20}.
4356 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4357 @opindex Wzero-as-null-pointer-constant
4358 @opindex Wno-zero-as-null-pointer-constant
4359 Warn when a literal @samp{0} is used as null pointer constant.  This can
4360 be useful to facilitate the conversion to @code{nullptr} in C++11.
4362 @item -Waligned-new
4363 @opindex Waligned-new
4364 @opindex Wno-aligned-new
4365 Warn about a new-expression of a type that requires greater alignment
4366 than the @code{alignof(std::max_align_t)} but uses an allocation
4367 function without an explicit alignment parameter. This option is
4368 enabled by @option{-Wall}.
4370 Normally this only warns about global allocation functions, but
4371 @option{-Waligned-new=all} also warns about class member allocation
4372 functions.
4374 @item -Wno-placement-new
4375 @itemx -Wplacement-new=@var{n}
4376 @opindex Wplacement-new
4377 @opindex Wno-placement-new
4378 Warn about placement new expressions with undefined behavior, such as
4379 constructing an object in a buffer that is smaller than the type of
4380 the object.  For example, the placement new expression below is diagnosed
4381 because it attempts to construct an array of 64 integers in a buffer only
4382 64 bytes large.
4383 @smallexample
4384 char buf [64];
4385 new (buf) int[64];
4386 @end smallexample
4387 This warning is enabled by default.
4389 @table @gcctabopt
4390 @item -Wplacement-new=1
4391 This is the default warning level of @option{-Wplacement-new}.  At this
4392 level the warning is not issued for some strictly undefined constructs that
4393 GCC allows as extensions for compatibility with legacy code.  For example,
4394 the following @code{new} expression is not diagnosed at this level even
4395 though it has undefined behavior according to the C++ standard because
4396 it writes past the end of the one-element array.
4397 @smallexample
4398 struct S @{ int n, a[1]; @};
4399 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4400 new (s->a)int [32]();
4401 @end smallexample
4403 @item -Wplacement-new=2
4404 At this level, in addition to diagnosing all the same constructs as at level
4405 1, a diagnostic is also issued for placement new expressions that construct
4406 an object in the last member of structure whose type is an array of a single
4407 element and whose size is less than the size of the object being constructed.
4408 While the previous example would be diagnosed, the following construct makes
4409 use of the flexible member array extension to avoid the warning at level 2.
4410 @smallexample
4411 struct S @{ int n, a[]; @};
4412 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4413 new (s->a)int [32]();
4414 @end smallexample
4416 @end table
4418 @item -Wcatch-value
4419 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4420 @opindex Wcatch-value
4421 @opindex Wno-catch-value
4422 Warn about catch handlers that do not catch via reference.
4423 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4424 warn about polymorphic class types that are caught by value.
4425 With @option{-Wcatch-value=2} warn about all class types that are caught
4426 by value. With @option{-Wcatch-value=3} warn about all types that are
4427 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4429 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4430 @opindex Wconditionally-supported
4431 @opindex Wno-conditionally-supported
4432 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4434 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4435 @opindex Wdelete-incomplete
4436 @opindex Wno-delete-incomplete
4437 Do not warn when deleting a pointer to incomplete type, which may cause
4438 undefined behavior at runtime.  This warning is enabled by default.
4440 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4441 @opindex Wextra-semi
4442 @opindex Wno-extra-semi
4443 Warn about redundant semicolons after in-class function definitions.
4445 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4446 @opindex Winaccessible-base
4447 @opindex Wno-inaccessible-base
4448 This option controls warnings
4449 when a base class is inaccessible in a class derived from it due to
4450 ambiguity.  The warning is enabled by default.
4451 Note that the warning for ambiguous virtual
4452 bases is enabled by the @option{-Wextra} option.
4453 @smallexample
4454 @group
4455 struct A @{ int a; @};
4457 struct B : A @{ @};
4459 struct C : B, A @{ @};
4460 @end group
4461 @end smallexample
4463 @item -Wno-inherited-variadic-ctor
4464 @opindex Winherited-variadic-ctor
4465 @opindex Wno-inherited-variadic-ctor
4466 Suppress warnings about use of C++11 inheriting constructors when the
4467 base class inherited from has a C variadic constructor; the warning is
4468 on by default because the ellipsis is not inherited.
4470 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4471 @opindex Wno-invalid-offsetof
4472 @opindex Winvalid-offsetof
4473 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4474 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4475 to a non-standard-layout type is undefined.  In existing C++ implementations,
4476 however, @code{offsetof} typically gives meaningful results.
4477 This flag is for users who are aware that they are
4478 writing nonportable code and who have deliberately chosen to ignore the
4479 warning about it.
4481 The restrictions on @code{offsetof} may be relaxed in a future version
4482 of the C++ standard.
4484 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4485 @opindex Wsized-deallocation
4486 @opindex Wno-sized-deallocation
4487 Warn about a definition of an unsized deallocation function
4488 @smallexample
4489 void operator delete (void *) noexcept;
4490 void operator delete[] (void *) noexcept;
4491 @end smallexample
4492 without a definition of the corresponding sized deallocation function
4493 @smallexample
4494 void operator delete (void *, std::size_t) noexcept;
4495 void operator delete[] (void *, std::size_t) noexcept;
4496 @end smallexample
4497 or vice versa.  Enabled by @option{-Wextra} along with
4498 @option{-fsized-deallocation}.
4500 @item -Wsuggest-final-types
4501 @opindex Wno-suggest-final-types
4502 @opindex Wsuggest-final-types
4503 Warn about types with virtual methods where code quality would be improved
4504 if the type were declared with the C++11 @code{final} specifier,
4505 or, if possible,
4506 declared in an anonymous namespace. This allows GCC to more aggressively
4507 devirtualize the polymorphic calls. This warning is more effective with
4508 link-time optimization,
4509 where the information about the class hierarchy graph is
4510 more complete.
4512 @item -Wsuggest-final-methods
4513 @opindex Wno-suggest-final-methods
4514 @opindex Wsuggest-final-methods
4515 Warn about virtual methods where code quality would be improved if the method
4516 were declared with the C++11 @code{final} specifier,
4517 or, if possible, its type were
4518 declared in an anonymous namespace or with the @code{final} specifier.
4519 This warning is
4520 more effective with link-time optimization, where the information about the
4521 class hierarchy graph is more complete. It is recommended to first consider
4522 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4523 annotations.
4525 @item -Wsuggest-override
4526 @opindex Wsuggest-override
4527 @opindex Wno-suggest-override
4528 Warn about overriding virtual functions that are not marked with the
4529 @code{override} keyword.
4531 @item -Wuse-after-free
4532 @itemx -Wuse-after-free=@var{n}
4533 @opindex Wuse-after-free
4534 @opindex Wno-use-after-free
4535 Warn about uses of pointers to dynamically allocated objects that have
4536 been rendered indeterminate by a call to a deallocation function.
4537 The warning is enabled at all optimization levels but may yield different
4538 results with optimization than without.
4540 @table @gcctabopt
4541 @item -Wuse-after-free=1
4542 At level 1 the warning attempts to diagnose only unconditional uses
4543 of pointers made indeterminate by a deallocation call or a successful
4544 call to @code{realloc}, regardless of whether or not the call resulted
4545 in an actual reallocatio of memory.  This includes double-@code{free}
4546 calls as well as uses in arithmetic and relational expressions.  Although
4547 undefined, uses of indeterminate pointers in equality (or inequality)
4548 expressions are not diagnosed at this level.
4549 @item -Wuse-after-free=2
4550 At level 2, in addition to unconditional uses, the warning also diagnoses
4551 conditional uses of pointers made indeterminate by a deallocation call.
4552 As at level 2, uses in equality (or inequality) expressions are not
4553 diagnosed.  For example, the second call to @code{free} in the following
4554 function is diagnosed at this level:
4555 @smallexample
4556 struct A @{ int refcount; void *data; @};
4558 void release (struct A *p)
4560   int refcount = --p->refcount;
4561   free (p);
4562   if (refcount == 0)
4563     free (p->data);   // warning: p may be used after free
4565 @end smallexample
4566 @item -Wuse-after-free=3
4567 At level 3, the warning also diagnoses uses of indeterminate pointers in
4568 equality expressions.  All uses of indeterminate pointers are undefined
4569 but equality tests sometimes appear after calls to @code{realloc} as
4570 an attempt to determine whether the call resulted in relocating the object
4571 to a different address.  They are diagnosed at a separate level to aid
4572 legacy code gradually transition to safe alternatives.  For example,
4573 the equality test in the function below is diagnosed at this level:
4574 @smallexample
4575 void adjust_pointers (int**, int);
4577 void grow (int **p, int n)
4579   int **q = (int**)realloc (p, n *= 2);
4580   if (q == p)
4581     return;
4582   adjust_pointers ((int**)q, n);
4584 @end smallexample
4585 To avoid the warning at this level, store offsets into allocated memory
4586 instead of pointers.  This approach obviates needing to adjust the stored
4587 pointers after reallocation.
4588 @end table
4590 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4592 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4593 @opindex Wuseless-cast
4594 @opindex Wno-useless-cast
4595 Warn when an expression is cast to its own type.  This warning does not
4596 occur when a class object is converted to a non-reference type as that
4597 is a way to create a temporary:
4599 @smallexample
4600 struct S @{ @};
4601 void g (S&&);
4602 void f (S&& arg)
4604   g (S(arg)); // make arg prvalue so that it can bind to S&&
4606 @end smallexample
4608 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4609 @opindex Wconversion-null
4610 @opindex Wno-conversion-null
4611 Do not warn for conversions between @code{NULL} and non-pointer
4612 types. @option{-Wconversion-null} is enabled by default.
4614 @end table
4616 @node Objective-C and Objective-C++ Dialect Options
4617 @section Options Controlling Objective-C and Objective-C++ Dialects
4619 @cindex compiler options, Objective-C and Objective-C++
4620 @cindex Objective-C and Objective-C++ options, command-line
4621 @cindex options, Objective-C and Objective-C++
4622 (NOTE: This manual does not describe the Objective-C and Objective-C++
4623 languages themselves.  @xref{Standards,,Language Standards
4624 Supported by GCC}, for references.)
4626 This section describes the command-line options that are only meaningful
4627 for Objective-C and Objective-C++ programs.  You can also use most of
4628 the language-independent GNU compiler options.
4629 For example, you might compile a file @file{some_class.m} like this:
4631 @smallexample
4632 gcc -g -fgnu-runtime -O -c some_class.m
4633 @end smallexample
4635 @noindent
4636 In this example, @option{-fgnu-runtime} is an option meant only for
4637 Objective-C and Objective-C++ programs; you can use the other options with
4638 any language supported by GCC@.
4640 Note that since Objective-C is an extension of the C language, Objective-C
4641 compilations may also use options specific to the C front-end (e.g.,
4642 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4643 C++-specific options (e.g., @option{-Wabi}).
4645 Here is a list of options that are @emph{only} for compiling Objective-C
4646 and Objective-C++ programs:
4648 @table @gcctabopt
4649 @item -fconstant-string-class=@var{class-name}
4650 @opindex fconstant-string-class
4651 Use @var{class-name} as the name of the class to instantiate for each
4652 literal string specified with the syntax @code{@@"@dots{}"}.  The default
4653 class name is @code{NXConstantString} if the GNU runtime is being used, and
4654 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
4655 @option{-fconstant-cfstrings} option, if also present, overrides the
4656 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4657 to be laid out as constant CoreFoundation strings.
4659 @item -fgnu-runtime
4660 @opindex fgnu-runtime
4661 Generate object code compatible with the standard GNU Objective-C
4662 runtime.  This is the default for most types of systems.
4664 @item -fnext-runtime
4665 @opindex fnext-runtime
4666 Generate output compatible with the NeXT runtime.  This is the default
4667 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
4668 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4669 used.
4671 @item -fno-nil-receivers
4672 @opindex fno-nil-receivers
4673 @opindex fnil-receivers
4674 Assume that all Objective-C message dispatches (@code{[receiver
4675 message:arg]}) in this translation unit ensure that the receiver is
4676 not @code{nil}.  This allows for more efficient entry points in the
4677 runtime to be used.  This option is only available in conjunction with
4678 the NeXT runtime and ABI version 0 or 1.
4680 @item -fobjc-abi-version=@var{n}
4681 @opindex fobjc-abi-version
4682 Use version @var{n} of the Objective-C ABI for the selected runtime.
4683 This option is currently supported only for the NeXT runtime.  In that
4684 case, Version 0 is the traditional (32-bit) ABI without support for
4685 properties and other Objective-C 2.0 additions.  Version 1 is the
4686 traditional (32-bit) ABI with support for properties and other
4687 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4688 nothing is specified, the default is Version 0 on 32-bit target
4689 machines, and Version 2 on 64-bit target machines.
4691 @item -fobjc-call-cxx-cdtors
4692 @opindex fobjc-call-cxx-cdtors
4693 For each Objective-C class, check if any of its instance variables is a
4694 C++ object with a non-trivial default constructor.  If so, synthesize a
4695 special @code{- (id) .cxx_construct} instance method which runs
4696 non-trivial default constructors on any such instance variables, in order,
4697 and then return @code{self}.  Similarly, check if any instance variable
4698 is a C++ object with a non-trivial destructor, and if so, synthesize a
4699 special @code{- (void) .cxx_destruct} method which runs
4700 all such default destructors, in reverse order.
4702 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4703 methods thusly generated only operate on instance variables
4704 declared in the current Objective-C class, and not those inherited
4705 from superclasses.  It is the responsibility of the Objective-C
4706 runtime to invoke all such methods in an object's inheritance
4707 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4708 by the runtime immediately after a new object instance is allocated;
4709 the @code{- (void) .cxx_destruct} methods are invoked immediately
4710 before the runtime deallocates an object instance.
4712 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4713 support for invoking the @code{- (id) .cxx_construct} and
4714 @code{- (void) .cxx_destruct} methods.
4716 @item -fobjc-direct-dispatch
4717 @opindex fobjc-direct-dispatch
4718 Allow fast jumps to the message dispatcher.  On Darwin this is
4719 accomplished via the comm page.
4721 @item -fobjc-exceptions
4722 @opindex fobjc-exceptions
4723 Enable syntactic support for structured exception handling in
4724 Objective-C, similar to what is offered by C++.  This option
4725 is required to use the Objective-C keywords @code{@@try},
4726 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4727 @code{@@synchronized}.  This option is available with both the GNU
4728 runtime and the NeXT runtime (but not available in conjunction with
4729 the NeXT runtime on Mac OS X 10.2 and earlier).
4731 @item -fobjc-gc
4732 @opindex fobjc-gc
4733 Enable garbage collection (GC) in Objective-C and Objective-C++
4734 programs.  This option is only available with the NeXT runtime; the
4735 GNU runtime has a different garbage collection implementation that
4736 does not require special compiler flags.
4738 @item -fobjc-nilcheck
4739 @opindex fobjc-nilcheck
4740 For the NeXT runtime with version 2 of the ABI, check for a nil
4741 receiver in method invocations before doing the actual method call.
4742 This is the default and can be disabled using
4743 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
4744 checked for nil in this way no matter what this flag is set to.
4745 Currently this flag does nothing when the GNU runtime, or an older
4746 version of the NeXT runtime ABI, is used.
4748 @item -fobjc-std=objc1
4749 @opindex fobjc-std
4750 Conform to the language syntax of Objective-C 1.0, the language
4751 recognized by GCC 4.0.  This only affects the Objective-C additions to
4752 the C/C++ language; it does not affect conformance to C/C++ standards,
4753 which is controlled by the separate C/C++ dialect option flags.  When
4754 this option is used with the Objective-C or Objective-C++ compiler,
4755 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4756 This is useful if you need to make sure that your Objective-C code can
4757 be compiled with older versions of GCC@.
4759 @item -freplace-objc-classes
4760 @opindex freplace-objc-classes
4761 Emit a special marker instructing @command{ld(1)} not to statically link in
4762 the resulting object file, and allow @command{dyld(1)} to load it in at
4763 run time instead.  This is used in conjunction with the Fix-and-Continue
4764 debugging mode, where the object file in question may be recompiled and
4765 dynamically reloaded in the course of program execution, without the need
4766 to restart the program itself.  Currently, Fix-and-Continue functionality
4767 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4768 and later.
4770 @item -fzero-link
4771 @opindex fzero-link
4772 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4773 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4774 compile time) with static class references that get initialized at load time,
4775 which improves run-time performance.  Specifying the @option{-fzero-link} flag
4776 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4777 to be retained.  This is useful in Zero-Link debugging mode, since it allows
4778 for individual class implementations to be modified during program execution.
4779 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4780 regardless of command-line options.
4782 @item -fno-local-ivars
4783 @opindex fno-local-ivars
4784 @opindex flocal-ivars
4785 By default instance variables in Objective-C can be accessed as if
4786 they were local variables from within the methods of the class they're
4787 declared in.  This can lead to shadowing between instance variables
4788 and other variables declared either locally inside a class method or
4789 globally with the same name.  Specifying the @option{-fno-local-ivars}
4790 flag disables this behavior thus avoiding variable shadowing issues.
4792 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4793 @opindex fivar-visibility
4794 Set the default instance variable visibility to the specified option
4795 so that instance variables declared outside the scope of any access
4796 modifier directives default to the specified visibility.
4798 @item -gen-decls
4799 @opindex gen-decls
4800 Dump interface declarations for all classes seen in the source file to a
4801 file named @file{@var{sourcename}.decl}.
4803 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4804 @opindex Wassign-intercept
4805 @opindex Wno-assign-intercept
4806 Warn whenever an Objective-C assignment is being intercepted by the
4807 garbage collector.
4809 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4810 @opindex Wproperty-assign-default
4811 @opindex Wno-property-assign-default
4812 Do not warn if a property for an Objective-C object has no assign
4813 semantics specified.
4815 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4816 @opindex Wno-protocol
4817 @opindex Wprotocol
4818 If a class is declared to implement a protocol, a warning is issued for
4819 every method in the protocol that is not implemented by the class.  The
4820 default behavior is to issue a warning for every method not explicitly
4821 implemented in the class, even if a method implementation is inherited
4822 from the superclass.  If you use the @option{-Wno-protocol} option, then
4823 methods inherited from the superclass are considered to be implemented,
4824 and no warning is issued for them.
4826 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4827 @opindex Wobjc-root-class
4828 Warn if a class interface lacks a superclass. Most classes will inherit
4829 from @code{NSObject} (or @code{Object}) for example.  When declaring
4830 classes intended to be root classes, the warning can be suppressed by
4831 marking their interfaces with @code{__attribute__((objc_root_class))}.
4833 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4834 @opindex Wselector
4835 @opindex Wno-selector
4836 Warn if multiple methods of different types for the same selector are
4837 found during compilation.  The check is performed on the list of methods
4838 in the final stage of compilation.  Additionally, a check is performed
4839 for each selector appearing in a @code{@@selector(@dots{})}
4840 expression, and a corresponding method for that selector has been found
4841 during compilation.  Because these checks scan the method table only at
4842 the end of compilation, these warnings are not produced if the final
4843 stage of compilation is not reached, for example because an error is
4844 found during compilation, or because the @option{-fsyntax-only} option is
4845 being used.
4847 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4848 @opindex Wstrict-selector-match
4849 @opindex Wno-strict-selector-match
4850 Warn if multiple methods with differing argument and/or return types are
4851 found for a given selector when attempting to send a message using this
4852 selector to a receiver of type @code{id} or @code{Class}.  When this flag
4853 is off (which is the default behavior), the compiler omits such warnings
4854 if any differences found are confined to types that share the same size
4855 and alignment.
4857 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4858 @opindex Wundeclared-selector
4859 @opindex Wno-undeclared-selector
4860 Warn if a @code{@@selector(@dots{})} expression referring to an
4861 undeclared selector is found.  A selector is considered undeclared if no
4862 method with that name has been declared before the
4863 @code{@@selector(@dots{})} expression, either explicitly in an
4864 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4865 an @code{@@implementation} section.  This option always performs its
4866 checks as soon as a @code{@@selector(@dots{})} expression is found,
4867 while @option{-Wselector} only performs its checks in the final stage of
4868 compilation.  This also enforces the coding style convention
4869 that methods and selectors must be declared before being used.
4871 @item -print-objc-runtime-info
4872 @opindex print-objc-runtime-info
4873 Generate C header describing the largest structure that is passed by
4874 value, if any.
4876 @end table
4878 @node Diagnostic Message Formatting Options
4879 @section Options to Control Diagnostic Messages Formatting
4880 @cindex options to control diagnostics formatting
4881 @cindex diagnostic messages
4882 @cindex message formatting
4884 Traditionally, diagnostic messages have been formatted irrespective of
4885 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
4886 options described below
4887 to control the formatting algorithm for diagnostic messages, 
4888 e.g.@: how many characters per line, how often source location
4889 information should be reported.  Note that some language front ends may not
4890 honor these options.
4892 @table @gcctabopt
4893 @item -fmessage-length=@var{n}
4894 @opindex fmessage-length
4895 Try to format error messages so that they fit on lines of about
4896 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
4897 done; each error message appears on a single line.  This is the
4898 default for all front ends.
4900 Note - this option also affects the display of the @samp{#error} and
4901 @samp{#warning} pre-processor directives, and the @samp{deprecated}
4902 function/type/variable attribute.  It does not however affect the
4903 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
4905 @item -fdiagnostics-plain-output
4906 This option requests that diagnostic output look as plain as possible, which
4907 may be useful when running @command{dejagnu} or other utilities that need to
4908 parse diagnostics output and prefer that it remain more stable over time.
4909 @option{-fdiagnostics-plain-output} is currently equivalent to the following
4910 options:
4911 @gccoptlist{-fno-diagnostics-show-caret @gol
4912 -fno-diagnostics-show-line-numbers @gol
4913 -fdiagnostics-color=never @gol
4914 -fdiagnostics-urls=never @gol
4915 -fdiagnostics-path-format=separate-events}
4916 In the future, if GCC changes the default appearance of its diagnostics, the
4917 corresponding option to disable the new behavior will be added to this list.
4919 @item -fdiagnostics-show-location=once
4920 @opindex fdiagnostics-show-location
4921 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
4922 reporter to emit source location information @emph{once}; that is, in
4923 case the message is too long to fit on a single physical line and has to
4924 be wrapped, the source location won't be emitted (as prefix) again,
4925 over and over, in subsequent continuation lines.  This is the default
4926 behavior.
4928 @item -fdiagnostics-show-location=every-line
4929 Only meaningful in line-wrapping mode.  Instructs the diagnostic
4930 messages reporter to emit the same source location information (as
4931 prefix) for physical lines that result from the process of breaking
4932 a message which is too long to fit on a single line.
4934 @item -fdiagnostics-color[=@var{WHEN}]
4935 @itemx -fno-diagnostics-color
4936 @opindex fdiagnostics-color
4937 @cindex highlight, color
4938 @vindex GCC_COLORS @r{environment variable}
4939 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
4940 or @samp{auto}.  The default depends on how the compiler has been configured,
4941 it can be any of the above @var{WHEN} options or also @samp{never}
4942 if @env{GCC_COLORS} environment variable isn't present in the environment,
4943 and @samp{auto} otherwise.
4944 @samp{auto} makes GCC use color only when the standard error is a terminal,
4945 and when not executing in an emacs shell.
4946 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4947 aliases for @option{-fdiagnostics-color=always} and
4948 @option{-fdiagnostics-color=never}, respectively.
4950 The colors are defined by the environment variable @env{GCC_COLORS}.
4951 Its value is a colon-separated list of capabilities and Select Graphic
4952 Rendition (SGR) substrings. SGR commands are interpreted by the
4953 terminal or terminal emulator.  (See the section in the documentation
4954 of your text terminal for permitted values and their meanings as
4955 character attributes.)  These substring values are integers in decimal
4956 representation and can be concatenated with semicolons.
4957 Common values to concatenate include
4958 @samp{1} for bold,
4959 @samp{4} for underline,
4960 @samp{5} for blink,
4961 @samp{7} for inverse,
4962 @samp{39} for default foreground color,
4963 @samp{30} to @samp{37} for foreground colors,
4964 @samp{90} to @samp{97} for 16-color mode foreground colors,
4965 @samp{38;5;0} to @samp{38;5;255}
4966 for 88-color and 256-color modes foreground colors,
4967 @samp{49} for default background color,
4968 @samp{40} to @samp{47} for background colors,
4969 @samp{100} to @samp{107} for 16-color mode background colors,
4970 and @samp{48;5;0} to @samp{48;5;255}
4971 for 88-color and 256-color modes background colors.
4973 The default @env{GCC_COLORS} is
4974 @smallexample
4975 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4976 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4977 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4978 type-diff=01;32:fnname=01;32:targs=35
4979 @end smallexample
4980 @noindent
4981 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4982 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4983 @samp{01} is bold, and @samp{31} is red.
4984 Setting @env{GCC_COLORS} to the empty string disables colors.
4985 Supported capabilities are as follows.
4987 @table @code
4988 @item error=
4989 @vindex error GCC_COLORS @r{capability}
4990 SGR substring for error: markers.
4992 @item warning=
4993 @vindex warning GCC_COLORS @r{capability}
4994 SGR substring for warning: markers.
4996 @item note=
4997 @vindex note GCC_COLORS @r{capability}
4998 SGR substring for note: markers.
5000 @item path=
5001 @vindex path GCC_COLORS @r{capability}
5002 SGR substring for colorizing paths of control-flow events as printed
5003 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5004 individual events and lines indicating interprocedural calls and returns.
5006 @item range1=
5007 @vindex range1 GCC_COLORS @r{capability}
5008 SGR substring for first additional range.
5010 @item range2=
5011 @vindex range2 GCC_COLORS @r{capability}
5012 SGR substring for second additional range.
5014 @item locus=
5015 @vindex locus GCC_COLORS @r{capability}
5016 SGR substring for location information, @samp{file:line} or
5017 @samp{file:line:column} etc.
5019 @item quote=
5020 @vindex quote GCC_COLORS @r{capability}
5021 SGR substring for information printed within quotes.
5023 @item fnname=
5024 @vindex fnname GCC_COLORS @r{capability}
5025 SGR substring for names of C++ functions.
5027 @item targs=
5028 @vindex targs GCC_COLORS @r{capability}
5029 SGR substring for C++ function template parameter bindings.
5031 @item fixit-insert=
5032 @vindex fixit-insert GCC_COLORS @r{capability}
5033 SGR substring for fix-it hints suggesting text to
5034 be inserted or replaced.
5036 @item fixit-delete=
5037 @vindex fixit-delete GCC_COLORS @r{capability}
5038 SGR substring for fix-it hints suggesting text to
5039 be deleted.
5041 @item diff-filename=
5042 @vindex diff-filename GCC_COLORS @r{capability}
5043 SGR substring for filename headers within generated patches.
5045 @item diff-hunk=
5046 @vindex diff-hunk GCC_COLORS @r{capability}
5047 SGR substring for the starts of hunks within generated patches.
5049 @item diff-delete=
5050 @vindex diff-delete GCC_COLORS @r{capability}
5051 SGR substring for deleted lines within generated patches.
5053 @item diff-insert=
5054 @vindex diff-insert GCC_COLORS @r{capability}
5055 SGR substring for inserted lines within generated patches.
5057 @item type-diff=
5058 @vindex type-diff GCC_COLORS @r{capability}
5059 SGR substring for highlighting mismatching types within template
5060 arguments in the C++ frontend.
5061 @end table
5063 @item -fdiagnostics-urls[=@var{WHEN}]
5064 @opindex fdiagnostics-urls
5065 @cindex urls
5066 @vindex GCC_URLS @r{environment variable}
5067 @vindex TERM_URLS @r{environment variable}
5068 Use escape sequences to embed URLs in diagnostics.  For example, when
5069 @option{-fdiagnostics-show-option} emits text showing the command-line
5070 option controlling a diagnostic, embed a URL for documentation of that
5071 option.
5073 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5074 @samp{auto} makes GCC use URL escape sequences only when the standard error
5075 is a terminal, and when not executing in an emacs shell or any graphical
5076 terminal which is known to be incompatible with this feature, see below.
5078 The default depends on how the compiler has been configured.
5079 It can be any of the above @var{WHEN} options.
5081 GCC can also be configured (via the
5082 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5083 so that the default is affected by environment variables.
5084 Under such a configuration, GCC defaults to using @samp{auto}
5085 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5086 present and non-empty in the environment of the compiler, or @samp{never}
5087 if neither are.
5089 However, even with @option{-fdiagnostics-urls=always} the behavior is
5090 dependent on those environment variables:
5091 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5092 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
5093 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5094 Any other non-empty value enables the feature.
5095 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5096 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5097 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5099 At this time GCC tries to detect also a few terminals that are known to
5100 not implement the URL feature, and have bugs or at least had bugs in
5101 some versions that are still in use, where the URL escapes are likely
5102 to misbehave, i.e. print garbage on the screen.
5103 That list is currently xfce4-terminal, certain known to be buggy
5104 gnome-terminal versions, the linux console, and mingw.
5105 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5107 @item -fno-diagnostics-show-option
5108 @opindex fno-diagnostics-show-option
5109 @opindex fdiagnostics-show-option
5110 By default, each diagnostic emitted includes text indicating the
5111 command-line option that directly controls the diagnostic (if such an
5112 option is known to the diagnostic machinery).  Specifying the
5113 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5115 @item -fno-diagnostics-show-caret
5116 @opindex fno-diagnostics-show-caret
5117 @opindex fdiagnostics-show-caret
5118 By default, each diagnostic emitted includes the original source line
5119 and a caret @samp{^} indicating the column.  This option suppresses this
5120 information.  The source line is truncated to @var{n} characters, if
5121 the @option{-fmessage-length=n} option is given.  When the output is done
5122 to the terminal, the width is limited to the width given by the
5123 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5125 @item -fno-diagnostics-show-labels
5126 @opindex fno-diagnostics-show-labels
5127 @opindex fdiagnostics-show-labels
5128 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5129 diagnostics can label ranges of source code with pertinent information, such
5130 as the types of expressions:
5132 @smallexample
5133     printf ("foo %s bar", long_i + long_j);
5134                  ~^       ~~~~~~~~~~~~~~~
5135                   |              |
5136                   char *         long int
5137 @end smallexample
5139 This option suppresses the printing of these labels (in the example above,
5140 the vertical bars and the ``char *'' and ``long int'' text).
5142 @item -fno-diagnostics-show-cwe
5143 @opindex fno-diagnostics-show-cwe
5144 @opindex fdiagnostics-show-cwe
5145 Diagnostic messages can optionally have an associated
5146 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5147 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5148 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
5149 By default, if this information is present, it will be printed with
5150 the diagnostic.  This option suppresses the printing of this metadata.
5152 @item -fno-diagnostics-show-rules
5153 @opindex fno-diagnostics-show-rules
5154 @opindex fdiagnostics-show-rules
5155 Diagnostic messages can optionally have rules associated with them, such
5156 as from a coding standard, or a specification.
5157 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5158 By default, if this information is present, it will be printed with
5159 the diagnostic.  This option suppresses the printing of this metadata.
5161 @item -fno-diagnostics-show-line-numbers
5162 @opindex fno-diagnostics-show-line-numbers
5163 @opindex fdiagnostics-show-line-numbers
5164 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5165 a left margin is printed, showing line numbers.  This option suppresses this
5166 left margin.
5168 @item -fdiagnostics-minimum-margin-width=@var{width}
5169 @opindex fdiagnostics-minimum-margin-width
5170 This option controls the minimum width of the left margin printed by
5171 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
5173 @item -fdiagnostics-parseable-fixits
5174 @opindex fdiagnostics-parseable-fixits
5175 Emit fix-it hints in a machine-parseable format, suitable for consumption
5176 by IDEs.  For each fix-it, a line will be printed after the relevant
5177 diagnostic, starting with the string ``fix-it:''.  For example:
5179 @smallexample
5180 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5181 @end smallexample
5183 The location is expressed as a half-open range, expressed as a count of
5184 bytes, starting at byte 1 for the initial column.  In the above example,
5185 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5186 given string:
5188 @smallexample
5189 00000000011111111112222222222
5190 12345678901234567890123456789
5191   gtk_widget_showall (dlg);
5192   ^^^^^^^^^^^^^^^^^^
5193   gtk_widget_show_all
5194 @end smallexample
5196 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5197 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5198 (e.g. vertical tab as ``\013'').
5200 An empty replacement string indicates that the given range is to be removed.
5201 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5202 be inserted at the given position.
5204 @item -fdiagnostics-generate-patch
5205 @opindex fdiagnostics-generate-patch
5206 Print fix-it hints to stderr in unified diff format, after any diagnostics
5207 are printed.  For example:
5209 @smallexample
5210 --- test.c
5211 +++ test.c
5212 @@ -42,5 +42,5 @@
5214  void show_cb(GtkDialog *dlg)
5215  @{
5216 -  gtk_widget_showall(dlg);
5217 +  gtk_widget_show_all(dlg);
5218  @}
5220 @end smallexample
5222 The diff may or may not be colorized, following the same rules
5223 as for diagnostics (see @option{-fdiagnostics-color}).
5225 @item -fdiagnostics-show-template-tree
5226 @opindex fdiagnostics-show-template-tree
5228 In the C++ frontend, when printing diagnostics showing mismatching
5229 template types, such as:
5231 @smallexample
5232   could not convert 'std::map<int, std::vector<double> >()'
5233     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5234 @end smallexample
5236 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5237 tree-like structure showing the common and differing parts of the types,
5238 such as:
5240 @smallexample
5241   map<
5242     [...],
5243     vector<
5244       [double != float]>>
5245 @end smallexample
5247 The parts that differ are highlighted with color (``double'' and
5248 ``float'' in this case).
5250 @item -fno-elide-type
5251 @opindex fno-elide-type
5252 @opindex felide-type
5253 By default when the C++ frontend prints diagnostics showing mismatching
5254 template types, common parts of the types are printed as ``[...]'' to
5255 simplify the error message.  For example:
5257 @smallexample
5258   could not convert 'std::map<int, std::vector<double> >()'
5259     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5260 @end smallexample
5262 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5263 This flag also affects the output of the
5264 @option{-fdiagnostics-show-template-tree} flag.
5266 @item -fdiagnostics-path-format=@var{KIND}
5267 @opindex fdiagnostics-path-format
5268 Specify how to print paths of control-flow events for diagnostics that
5269 have such a path associated with them.
5271 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5272 the default.
5274 @samp{none} means to not print diagnostic paths.
5276 @samp{separate-events} means to print a separate ``note'' diagnostic for
5277 each event within the diagnostic.  For example:
5279 @smallexample
5280 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5281 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5282 test.c:27:3: note: (2) when 'i < count'
5283 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5284 @end smallexample
5286 @samp{inline-events} means to print the events ``inline'' within the source
5287 code.  This view attempts to consolidate the events into runs of
5288 sufficiently-close events, printing them as labelled ranges within the source.
5290 For example, the same events as above might be printed as:
5292 @smallexample
5293   'test': events 1-3
5294     |
5295     |   25 |   list = PyList_New(0);
5296     |      |          ^~~~~~~~~~~~~
5297     |      |          |
5298     |      |          (1) when 'PyList_New' fails, returning NULL
5299     |   26 |
5300     |   27 |   for (i = 0; i < count; i++) @{
5301     |      |   ~~~
5302     |      |   |
5303     |      |   (2) when 'i < count'
5304     |   28 |     item = PyLong_FromLong(random());
5305     |   29 |     PyList_Append(list, item);
5306     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
5307     |      |     |
5308     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5309     |
5310 @end smallexample
5312 Interprocedural control flow is shown by grouping the events by stack frame,
5313 and using indentation to show how stack frames are nested, pushed, and popped.
5315 For example:
5317 @smallexample
5318   'test': events 1-2
5319     |
5320     |  133 | @{
5321     |      | ^
5322     |      | |
5323     |      | (1) entering 'test'
5324     |  134 |   boxed_int *obj = make_boxed_int (i);
5325     |      |                    ~~~~~~~~~~~~~~~~~~
5326     |      |                    |
5327     |      |                    (2) calling 'make_boxed_int'
5328     |
5329     +--> 'make_boxed_int': events 3-4
5330            |
5331            |  120 | @{
5332            |      | ^
5333            |      | |
5334            |      | (3) entering 'make_boxed_int'
5335            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5336            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5337            |      |                                    |
5338            |      |                                    (4) calling 'wrapped_malloc'
5339            |
5340            +--> 'wrapped_malloc': events 5-6
5341                   |
5342                   |    7 | @{
5343                   |      | ^
5344                   |      | |
5345                   |      | (5) entering 'wrapped_malloc'
5346                   |    8 |   return malloc (size);
5347                   |      |          ~~~~~~~~~~~~~
5348                   |      |          |
5349                   |      |          (6) calling 'malloc'
5350                   |
5351     <-------------+
5352     |
5353  'test': event 7
5354     |
5355     |  138 |   free_boxed_int (obj);
5356     |      |   ^~~~~~~~~~~~~~~~~~~~
5357     |      |   |
5358     |      |   (7) calling 'free_boxed_int'
5359     |
5360 (etc)
5361 @end smallexample
5363 @item -fdiagnostics-show-path-depths
5364 @opindex fdiagnostics-show-path-depths
5365 This option provides additional information when printing control-flow paths
5366 associated with a diagnostic.
5368 If this is option is provided then the stack depth will be printed for
5369 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5370 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5371 the stack depth and function declaration will be appended when printing
5372 each event.
5374 This is intended for use by GCC developers and plugin developers when
5375 debugging diagnostics that report interprocedural control flow.
5377 @item -fno-show-column
5378 @opindex fno-show-column
5379 @opindex fshow-column
5380 Do not print column numbers in diagnostics.  This may be necessary if
5381 diagnostics are being scanned by a program that does not understand the
5382 column numbers, such as @command{dejagnu}.
5384 @item -fdiagnostics-column-unit=@var{UNIT}
5385 @opindex fdiagnostics-column-unit
5386 Select the units for the column number.  This affects traditional diagnostics
5387 (in the absence of @option{-fno-show-column}), as well as JSON format
5388 diagnostics if requested.
5390 The default @var{UNIT}, @samp{display}, considers the number of display
5391 columns occupied by each character.  This may be larger than the number
5392 of bytes required to encode the character, in the case of tab
5393 characters, or it may be smaller, in the case of multibyte characters.
5394 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5395 display column, and its UTF-8 encoding requires two bytes; the character
5396 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5397 its UTF-8 encoding requires four bytes.
5399 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5400 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5402 @item -fdiagnostics-column-origin=@var{ORIGIN}
5403 @opindex fdiagnostics-column-origin
5404 Select the origin for column numbers, i.e. the column number assigned to the
5405 first column.  The default value of 1 corresponds to traditional GCC
5406 behavior and to the GNU style guide.  Some utilities may perform better with an
5407 origin of 0; any non-negative value may be specified.
5409 @item -fdiagnostics-escape-format=@var{FORMAT}
5410 @opindex fdiagnostics-escape-format
5411 When GCC prints pertinent source lines for a diagnostic it normally attempts
5412 to print the source bytes directly.  However, some diagnostics relate to encoding
5413 issues in the source file, such as malformed UTF-8, or issues with Unicode
5414 normalization.  These diagnostics are flagged so that GCC will escape bytes
5415 that are not printable ASCII when printing their pertinent source lines.
5417 This option controls how such bytes should be escaped.
5419 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5420 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5421 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5422 displayed as hexadecimal in the form @samp{<XX>}.
5424 For example, a source line containing the string @samp{before} followed by the
5425 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5426 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5427 the string @samp{after} will be printed for such a diagnostic as:
5429 @smallexample
5430  before<U+03C0><BF>after
5431 @end smallexample
5433 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5434 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5435 Unicode characters.  For the example above, the following will be printed:
5437 @smallexample
5438  before<CF><80><BF>after
5439 @end smallexample
5441 @item -fdiagnostics-format=@var{FORMAT}
5442 @opindex fdiagnostics-format
5443 Select a different format for printing diagnostics.
5444 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5445 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5447 The default is @samp{text}.
5449 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5450 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5451 named @file{@var{source}.sarif}, respectively.
5453 The @samp{json} format is a synonym for @samp{json-stderr}.
5454 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5455 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5456 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5458 The emitted JSON consists of a top-level JSON array containing JSON objects
5459 representing the diagnostics.  The JSON is emitted as one line, without
5460 formatting; the examples below have been formatted for clarity.
5462 Diagnostics can have child diagnostics.  For example, this error and note:
5464 @smallexample
5465 misleading-indentation.c:15:3: warning: this 'if' clause does not
5466   guard... [-Wmisleading-indentation]
5467    15 |   if (flag)
5468       |   ^~
5469 misleading-indentation.c:17:5: note: ...this statement, but the latter
5470   is misleadingly indented as if it were guarded by the 'if'
5471    17 |     y = 2;
5472       |     ^
5473 @end smallexample
5475 @noindent
5476 might be printed in JSON form (after formatting) like this:
5478 @smallexample
5480     @{
5481         "kind": "warning",
5482         "locations": [
5483             @{
5484                 "caret": @{
5485                     "display-column": 3,
5486                     "byte-column": 3,
5487                     "column": 3,
5488                     "file": "misleading-indentation.c",
5489                     "line": 15
5490                 @},
5491                 "finish": @{
5492                     "display-column": 4,
5493                     "byte-column": 4,
5494                     "column": 4,
5495                     "file": "misleading-indentation.c",
5496                     "line": 15
5497                 @}
5498             @}
5499         ],
5500         "message": "this \u2018if\u2019 clause does not guard...",
5501         "option": "-Wmisleading-indentation",
5502         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5503         "children": [
5504             @{
5505                 "kind": "note",
5506                 "locations": [
5507                     @{
5508                         "caret": @{
5509                             "display-column": 5,
5510                             "byte-column": 5,
5511                             "column": 5,
5512                             "file": "misleading-indentation.c",
5513                             "line": 17
5514                         @}
5515                     @}
5516                 ],
5517                 "escape-source": false,
5518                 "message": "...this statement, but the latter is @dots{}"
5519             @}
5520         ]
5521         "escape-source": false,
5522         "column-origin": 1,
5523     @}
5525 @end smallexample
5527 @noindent
5528 where the @code{note} is a child of the @code{warning}.
5530 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5531 an @code{option} key describing the command-line option controlling the
5532 warning.
5534 A diagnostic can contain zero or more locations.  Each location has an
5535 optional @code{label} string and up to three positions within it: a
5536 @code{caret} position and optional @code{start} and @code{finish} positions.
5537 A position is described by a @code{file} name, a @code{line} number, and
5538 three numbers indicating a column position:
5539 @itemize @bullet
5541 @item
5542 @code{display-column} counts display columns, accounting for tabs and
5543 multibyte characters.
5545 @item
5546 @code{byte-column} counts raw bytes.
5548 @item
5549 @code{column} is equal to one of
5550 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5551 option.
5553 @end itemize
5554 All three columns are relative to the origin specified by
5555 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5556 be set, for instance, to 0 for compatibility with other utilities that
5557 number columns from 0.  The column origin is recorded in the JSON output in
5558 the @code{column-origin} tag.  In the remaining examples below, the extra
5559 column number outputs have been omitted for brevity.
5561 For example, this error:
5563 @smallexample
5564 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5565    'struct s'@} and 'T' @{aka 'struct t'@})
5566    64 |   return callee_4a () + callee_4b ();
5567       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5568       |          |              |
5569       |          |              T @{aka struct t@}
5570       |          S @{aka struct s@}
5571 @end smallexample
5573 @noindent
5574 has three locations.  Its primary location is at the ``+'' token at column
5575 23.  It has two secondary locations, describing the left and right-hand sides
5576 of the expression, which have labels.  It might be printed in JSON form as:
5578 @smallexample
5579     @{
5580         "children": [],
5581         "kind": "error",
5582         "locations": [
5583             @{
5584                 "caret": @{
5585                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5586                 @}
5587             @},
5588             @{
5589                 "caret": @{
5590                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5591                 @},
5592                 "finish": @{
5593                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5594                 @},
5595                 "label": "S @{aka struct s@}"
5596             @},
5597             @{
5598                 "caret": @{
5599                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5600                 @},
5601                 "finish": @{
5602                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5603                 @},
5604                 "label": "T @{aka struct t@}"
5605             @}
5606         ],
5607         "escape-source": false,
5608         "message": "invalid operands to binary + @dots{}"
5609     @}
5610 @end smallexample
5612 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5613 consisting of half-open intervals, similar to the output of
5614 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5615 with a replacement fix-it hint:
5617 @smallexample
5618 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5619   mean 'color'?
5620     8 |   return ptr->colour;
5621       |               ^~~~~~
5622       |               color
5623 @end smallexample
5625 @noindent
5626 might be printed in JSON form as:
5628 @smallexample
5629     @{
5630         "children": [],
5631         "fixits": [
5632             @{
5633                 "next": @{
5634                     "column": 21,
5635                     "file": "demo.c",
5636                     "line": 8
5637                 @},
5638                 "start": @{
5639                     "column": 15,
5640                     "file": "demo.c",
5641                     "line": 8
5642                 @},
5643                 "string": "color"
5644             @}
5645         ],
5646         "kind": "error",
5647         "locations": [
5648             @{
5649                 "caret": @{
5650                     "column": 15,
5651                     "file": "demo.c",
5652                     "line": 8
5653                 @},
5654                 "finish": @{
5655                     "column": 20,
5656                     "file": "demo.c",
5657                     "line": 8
5658                 @}
5659             @}
5660         ],
5661         "escape-source": false,
5662         "message": "\u2018struct s\u2019 has no member named @dots{}"
5663     @}
5664 @end smallexample
5666 @noindent
5667 where the fix-it hint suggests replacing the text from @code{start} up
5668 to but not including @code{next} with @code{string}'s value.  Deletions
5669 are expressed via an empty value for @code{string}, insertions by
5670 having @code{start} equal @code{next}.
5672 If the diagnostic has a path of control-flow events associated with it,
5673 it has a @code{path} array of objects representing the events.  Each
5674 event object has a @code{description} string, a @code{location} object,
5675 along with a @code{function} string and a @code{depth} number for
5676 representing interprocedural paths.  The @code{function} represents the
5677 current function at that event, and the @code{depth} represents the
5678 stack depth relative to some baseline: the higher, the more frames are
5679 within the stack.
5681 For example, the intraprocedural example shown for
5682 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5684 @smallexample
5685     "path": [
5686         @{
5687             "depth": 0,
5688             "description": "when 'PyList_New' fails, returning NULL",
5689             "function": "test",
5690             "location": @{
5691                 "column": 10,
5692                 "file": "test.c",
5693                 "line": 25
5694             @}
5695         @},
5696         @{
5697             "depth": 0,
5698             "description": "when 'i < count'",
5699             "function": "test",
5700             "location": @{
5701                 "column": 3,
5702                 "file": "test.c",
5703                 "line": 27
5704             @}
5705         @},
5706         @{
5707             "depth": 0,
5708             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5709             "function": "test",
5710             "location": @{
5711                 "column": 5,
5712                 "file": "test.c",
5713                 "line": 29
5714             @}
5715         @}
5716     ]
5717 @end smallexample
5719 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5720 non-ASCII bytes should be escaped when printing the pertinent lines of
5721 source code (@code{true} for diagnostics involving source encoding issues).
5723 @end table
5725 @node Warning Options
5726 @section Options to Request or Suppress Warnings
5727 @cindex options to control warnings
5728 @cindex warning messages
5729 @cindex messages, warning
5730 @cindex suppressing warnings
5732 Warnings are diagnostic messages that report constructions that
5733 are not inherently erroneous but that are risky or suggest there
5734 may have been an error.
5736 The following language-independent options do not enable specific
5737 warnings but control the kinds of diagnostics produced by GCC@.
5739 @table @gcctabopt
5740 @cindex syntax checking
5741 @item -fsyntax-only
5742 @opindex fsyntax-only
5743 Check the code for syntax errors, but don't do anything beyond that.
5745 @item -fmax-errors=@var{n}
5746 @opindex fmax-errors
5747 Limits the maximum number of error messages to @var{n}, at which point
5748 GCC bails out rather than attempting to continue processing the source
5749 code.  If @var{n} is 0 (the default), there is no limit on the number
5750 of error messages produced.  If @option{-Wfatal-errors} is also
5751 specified, then @option{-Wfatal-errors} takes precedence over this
5752 option.
5754 @item -w
5755 @opindex w
5756 Inhibit all warning messages.
5758 @item -Werror
5759 @opindex Werror
5760 @opindex Wno-error
5761 Make all warnings into errors.
5763 @item -Werror=
5764 @opindex Werror=
5765 @opindex Wno-error=
5766 Make the specified warning into an error.  The specifier for a warning
5767 is appended; for example @option{-Werror=switch} turns the warnings
5768 controlled by @option{-Wswitch} into errors.  This switch takes a
5769 negative form, to be used to negate @option{-Werror} for specific
5770 warnings; for example @option{-Wno-error=switch} makes
5771 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5772 is in effect.
5774 The warning message for each controllable warning includes the
5775 option that controls the warning.  That option can then be used with
5776 @option{-Werror=} and @option{-Wno-error=} as described above.
5777 (Printing of the option in the warning message can be disabled using the
5778 @option{-fno-diagnostics-show-option} flag.)
5780 Note that specifying @option{-Werror=}@var{foo} automatically implies
5781 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
5782 imply anything.
5784 @item -Wfatal-errors
5785 @opindex Wfatal-errors
5786 @opindex Wno-fatal-errors
5787 This option causes the compiler to abort compilation on the first error
5788 occurred rather than trying to keep going and printing further error
5789 messages.
5791 @end table
5793 You can request many specific warnings with options beginning with
5794 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5795 implicit declarations.  Each of these specific warning options also
5796 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5797 example, @option{-Wno-implicit}.  This manual lists only one of the
5798 two forms, whichever is not the default.  For further
5799 language-specific options also refer to @ref{C++ Dialect Options} and
5800 @ref{Objective-C and Objective-C++ Dialect Options}.
5801 Additional warnings can be produced by enabling the static analyzer;
5802 @xref{Static Analyzer Options}.
5804 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5805 options, such as @option{-Wunused}, which may turn on further options,
5806 such as @option{-Wunused-value}. The combined effect of positive and
5807 negative forms is that more specific options have priority over less
5808 specific ones, independently of their position in the command-line. For
5809 options of the same specificity, the last one takes effect. Options
5810 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5811 as if they appeared at the end of the command-line.
5813 When an unrecognized warning option is requested (e.g.,
5814 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5815 that the option is not recognized.  However, if the @option{-Wno-} form
5816 is used, the behavior is slightly different: no diagnostic is
5817 produced for @option{-Wno-unknown-warning} unless other diagnostics
5818 are being produced.  This allows the use of new @option{-Wno-} options
5819 with old compilers, but if something goes wrong, the compiler
5820 warns that an unrecognized option is present.
5822 The effectiveness of some warnings depends on optimizations also being
5823 enabled. For example @option{-Wsuggest-final-types} is more effective
5824 with link-time optimization and some instances of other warnings may
5825 not be issued at all unless optimization is enabled.  While optimization
5826 in general improves the efficacy of control and data flow sensitive
5827 warnings, in some cases it may also cause false positives.
5829 @table @gcctabopt
5830 @item -Wpedantic
5831 @itemx -pedantic
5832 @opindex pedantic
5833 @opindex Wpedantic
5834 @opindex Wno-pedantic
5835 Issue all the warnings demanded by strict ISO C and ISO C++;
5836 reject all programs that use forbidden extensions, and some other
5837 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
5838 version of the ISO C standard specified by any @option{-std} option used.
5840 Valid ISO C and ISO C++ programs should compile properly with or without
5841 this option (though a rare few require @option{-ansi} or a
5842 @option{-std} option specifying the required version of ISO C)@.  However,
5843 without this option, certain GNU extensions and traditional C and C++
5844 features are supported as well.  With this option, they are rejected.
5846 @option{-Wpedantic} does not cause warning messages for use of the
5847 alternate keywords whose names begin and end with @samp{__}.  This alternate
5848 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5849 i.e. @samp{__intN__}.
5850 Pedantic warnings are also disabled in the expression that follows
5851 @code{__extension__}.  However, only system header files should use
5852 these escape routes; application programs should avoid them.
5853 @xref{Alternate Keywords}.
5855 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5856 C conformance.  They soon find that it does not do quite what they want:
5857 it finds some non-ISO practices, but not all---only those for which
5858 ISO C @emph{requires} a diagnostic, and some others for which
5859 diagnostics have been added.
5861 A feature to report any failure to conform to ISO C might be useful in
5862 some instances, but would require considerable additional work and would
5863 be quite different from @option{-Wpedantic}.  We don't have plans to
5864 support such a feature in the near future.
5866 Where the standard specified with @option{-std} represents a GNU
5867 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5868 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5869 extended dialect is based.  Warnings from @option{-Wpedantic} are given
5870 where they are required by the base standard.  (It does not make sense
5871 for such warnings to be given only for features not in the specified GNU
5872 C dialect, since by definition the GNU dialects of C include all
5873 features the compiler supports with the given option, and there would be
5874 nothing to warn about.)
5876 @item -pedantic-errors
5877 @opindex pedantic-errors
5878 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
5879 requires a diagnostic, in some cases where there is undefined behavior
5880 at compile-time and in some other cases that do not prevent compilation
5881 of programs that are valid according to the standard. This is not
5882 equivalent to @option{-Werror=pedantic}, since there are errors enabled
5883 by this option and not enabled by the latter and vice versa.
5885 @item -Wall
5886 @opindex Wall
5887 @opindex Wno-all
5888 This enables all the warnings about constructions that some users
5889 consider questionable, and that are easy to avoid (or modify to
5890 prevent the warning), even in conjunction with macros.  This also
5891 enables some language-specific warnings described in @ref{C++ Dialect
5892 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
5894 @option{-Wall} turns on the following warning flags:
5896 @gccoptlist{-Waddress   @gol
5897 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}  @gol
5898 -Warray-compare @gol
5899 -Warray-parameter=2 @r{(C and Objective-C only)} @gol
5900 -Wbool-compare  @gol
5901 -Wbool-operation  @gol
5902 -Wc++11-compat  -Wc++14-compat  @gol
5903 -Wcatch-value @r{(C++ and Objective-C++ only)}  @gol
5904 -Wchar-subscripts  @gol
5905 -Wcomment  @gol
5906 -Wdangling-pointer=2  @gol
5907 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
5908 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
5909 -Wenum-int-mismatch @r{(C and Objective-C only)} @gol
5910 -Wformat   @gol
5911 -Wformat-overflow  @gol
5912 -Wformat-truncation  @gol
5913 -Wint-in-bool-context  @gol
5914 -Wimplicit @r{(C and Objective-C only)} @gol
5915 -Wimplicit-int @r{(C and Objective-C only)} @gol
5916 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
5917 -Winit-self @r{(only for C++)} @gol
5918 -Wlogical-not-parentheses @gol
5919 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
5920 -Wmaybe-uninitialized @gol
5921 -Wmemset-elt-size @gol
5922 -Wmemset-transposed-args @gol
5923 -Wmisleading-indentation @r{(only for C/C++)} @gol
5924 -Wmismatched-dealloc @gol
5925 -Wmismatched-new-delete @r{(only for C/C++)} @gol
5926 -Wmissing-attributes @gol
5927 -Wmissing-braces @r{(only for C/ObjC)} @gol
5928 -Wmultistatement-macros  @gol
5929 -Wnarrowing @r{(only for C++)}  @gol
5930 -Wnonnull  @gol
5931 -Wnonnull-compare  @gol
5932 -Wopenmp-simd @gol
5933 -Wparentheses  @gol
5934 -Wpessimizing-move @r{(only for C++)}  @gol
5935 -Wpointer-sign  @gol
5936 -Wrange-loop-construct @r{(only for C++)}  @gol
5937 -Wreorder   @gol
5938 -Wrestrict   @gol
5939 -Wreturn-type  @gol
5940 -Wself-move @r{(only for C++)}  @gol
5941 -Wsequence-point  @gol
5942 -Wsign-compare @r{(only in C++)}  @gol
5943 -Wsizeof-array-div @gol
5944 -Wsizeof-pointer-div @gol
5945 -Wsizeof-pointer-memaccess @gol
5946 -Wstrict-aliasing  @gol
5947 -Wstrict-overflow=1  @gol
5948 -Wswitch  @gol
5949 -Wtautological-compare  @gol
5950 -Wtrigraphs  @gol
5951 -Wuninitialized  @gol
5952 -Wunknown-pragmas  @gol
5953 -Wunused-function  @gol
5954 -Wunused-label     @gol
5955 -Wunused-value     @gol
5956 -Wunused-variable  @gol
5957 -Wuse-after-free=3  @gol
5958 -Wvla-parameter @r{(C and Objective-C only)} @gol
5959 -Wvolatile-register-var  @gol
5960 -Wzero-length-bounds}
5962 Note that some warning flags are not implied by @option{-Wall}.  Some of
5963 them warn about constructions that users generally do not consider
5964 questionable, but which occasionally you might wish to check for;
5965 others warn about constructions that are necessary or hard to avoid in
5966 some cases, and there is no simple way to modify the code to suppress
5967 the warning. Some of them are enabled by @option{-Wextra} but many of
5968 them must be enabled individually.
5970 @item -Wextra
5971 @opindex W
5972 @opindex Wextra
5973 @opindex Wno-extra
5974 This enables some extra warning flags that are not enabled by
5975 @option{-Wall}. (This option used to be called @option{-W}.  The older
5976 name is still supported, but the newer name is more descriptive.)
5978 @gccoptlist{-Wclobbered  @gol
5979 -Wcast-function-type  @gol
5980 -Wdeprecated-copy @r{(C++ only)} @gol
5981 -Wempty-body  @gol
5982 -Wenum-conversion @r{(C only)} @gol
5983 -Wignored-qualifiers @gol
5984 -Wimplicit-fallthrough=3 @gol
5985 -Wmissing-field-initializers  @gol
5986 -Wmissing-parameter-type @r{(C only)}  @gol
5987 -Wold-style-declaration @r{(C only)}  @gol
5988 -Woverride-init  @gol
5989 -Wsign-compare @r{(C only)} @gol
5990 -Wstring-compare @gol
5991 -Wredundant-move @r{(only for C++)}  @gol
5992 -Wtype-limits  @gol
5993 -Wuninitialized  @gol
5994 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}  @gol
5995 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
5996 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
5999 The option @option{-Wextra} also prints warning messages for the
6000 following cases:
6002 @itemize @bullet
6004 @item
6005 A pointer is compared against integer zero with @code{<}, @code{<=},
6006 @code{>}, or @code{>=}.
6008 @item
6009 (C++ only) An enumerator and a non-enumerator both appear in a
6010 conditional expression.
6012 @item
6013 (C++ only) Ambiguous virtual bases.
6015 @item
6016 (C++ only) Subscripting an array that has been declared @code{register}.
6018 @item
6019 (C++ only) Taking the address of a variable that has been declared
6020 @code{register}.
6022 @item
6023 (C++ only) A base class is not initialized in the copy constructor
6024 of a derived class.
6026 @end itemize
6028 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6029 @opindex Wabi
6030 @opindex Wno-abi
6032 Warn about code affected by ABI changes.  This includes code that may
6033 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6034 for the particular target.
6036 Since G++ now defaults to updating the ABI with each major release,
6037 normally @option{-Wabi} warns only about C++ ABI compatibility
6038 problems if there is a check added later in a release series for an
6039 ABI issue discovered since the initial release.  @option{-Wabi} warns
6040 about more things if an older ABI version is selected (with
6041 @option{-fabi-version=@var{n}}).
6043 @option{-Wabi} can also be used with an explicit version number to
6044 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6045 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6046 @option{-fabi-version=2}.
6048 If an explicit version number is provided and
6049 @option{-fabi-compat-version} is not specified, the version number
6050 from this option is used for compatibility aliases.  If no explicit
6051 version number is provided with this option, but
6052 @option{-fabi-compat-version} is specified, that version number is
6053 used for C++ ABI warnings.
6055 Although an effort has been made to warn about
6056 all such cases, there are probably some cases that are not warned about,
6057 even though G++ is generating incompatible code.  There may also be
6058 cases where warnings are emitted even though the code that is generated
6059 is compatible.
6061 You should rewrite your code to avoid these warnings if you are
6062 concerned about the fact that code generated by G++ may not be binary
6063 compatible with code generated by other compilers.
6065 Known incompatibilities in @option{-fabi-version=2} (which was the
6066 default from GCC 3.4 to 4.9) include:
6068 @itemize @bullet
6070 @item
6071 A template with a non-type template parameter of reference type was
6072 mangled incorrectly:
6073 @smallexample
6074 extern int N;
6075 template <int &> struct S @{@};
6076 void n (S<N>) @{2@}
6077 @end smallexample
6079 This was fixed in @option{-fabi-version=3}.
6081 @item
6082 SIMD vector types declared using @code{__attribute ((vector_size))} were
6083 mangled in a non-standard way that does not allow for overloading of
6084 functions taking vectors of different sizes.
6086 The mangling was changed in @option{-fabi-version=4}.
6088 @item
6089 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6090 qualifiers, and @code{decltype} of a plain declaration was folded away.
6092 These mangling issues were fixed in @option{-fabi-version=5}.
6094 @item
6095 Scoped enumerators passed as arguments to a variadic function are
6096 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6097 On most targets this does not actually affect the parameter passing
6098 ABI, as there is no way to pass an argument smaller than @code{int}.
6100 Also, the ABI changed the mangling of template argument packs,
6101 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6102 a class scope function used as a template argument.
6104 These issues were corrected in @option{-fabi-version=6}.
6106 @item
6107 Lambdas in default argument scope were mangled incorrectly, and the
6108 ABI changed the mangling of @code{nullptr_t}.
6110 These issues were corrected in @option{-fabi-version=7}.
6112 @item
6113 When mangling a function type with function-cv-qualifiers, the
6114 un-qualified function type was incorrectly treated as a substitution
6115 candidate.
6117 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6119 @item
6120 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6121 unaligned accesses.  Note that this did not affect the ABI of a
6122 function with a @code{nullptr_t} parameter, as parameters have a
6123 minimum alignment.
6125 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6127 @item
6128 Target-specific attributes that affect the identity of a type, such as
6129 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6130 did not affect the mangled name, leading to name collisions when
6131 function pointers were used as template arguments.
6133 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6135 @end itemize
6137 This option also enables warnings about psABI-related changes.
6138 The known psABI changes at this point include:
6140 @itemize @bullet
6142 @item
6143 For SysV/x86-64, unions with @code{long double} members are
6144 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6145 the case.  For example:
6147 @smallexample
6148 union U @{
6149   long double ld;
6150   int i;
6152 @end smallexample
6154 @noindent
6155 @code{union U} is now always passed in memory.
6157 @end itemize
6159 @item -Wchar-subscripts
6160 @opindex Wchar-subscripts
6161 @opindex Wno-char-subscripts
6162 Warn if an array subscript has type @code{char}.  This is a common cause
6163 of error, as programmers often forget that this type is signed on some
6164 machines.
6165 This warning is enabled by @option{-Wall}.
6167 @item -Wno-coverage-mismatch
6168 @opindex Wno-coverage-mismatch
6169 @opindex Wcoverage-mismatch
6170 Warn if feedback profiles do not match when using the
6171 @option{-fprofile-use} option.
6172 If a source file is changed between compiling with @option{-fprofile-generate}
6173 and with @option{-fprofile-use}, the files with the profile feedback can fail
6174 to match the source file and GCC cannot use the profile feedback
6175 information.  By default, this warning is enabled and is treated as an
6176 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6177 warning or @option{-Wno-error=coverage-mismatch} can be used to
6178 disable the error.  Disabling the error for this warning can result in
6179 poorly optimized code and is useful only in the
6180 case of very minor changes such as bug fixes to an existing code-base.
6181 Completely disabling the warning is not recommended.
6183 @item -Wno-coverage-invalid-line-number
6184 @opindex Wno-coverage-invalid-line-number
6185 @opindex Wcoverage-invalid-line-number
6186 Warn in case a function ends earlier than it begins due
6187 to an invalid linenum macros.  The warning is emitted only
6188 with @option{--coverage} enabled.
6190 By default, this warning is enabled and is treated as an
6191 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6192 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6193 disable the error.
6195 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6196 @opindex Wno-cpp
6197 @opindex Wcpp
6198 Suppress warning messages emitted by @code{#warning} directives.
6200 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6201 @opindex Wdouble-promotion
6202 @opindex Wno-double-promotion
6203 Give a warning when a value of type @code{float} is implicitly
6204 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6205 floating-point unit implement @code{float} in hardware, but emulate
6206 @code{double} in software.  On such a machine, doing computations
6207 using @code{double} values is much more expensive because of the
6208 overhead required for software emulation.
6210 It is easy to accidentally do computations with @code{double} because
6211 floating-point literals are implicitly of type @code{double}.  For
6212 example, in:
6213 @smallexample
6214 @group
6215 float area(float radius)
6217    return 3.14159 * radius * radius;
6219 @end group
6220 @end smallexample
6221 the compiler performs the entire computation with @code{double}
6222 because the floating-point literal is a @code{double}.
6224 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6225 @opindex Wduplicate-decl-specifier
6226 @opindex Wno-duplicate-decl-specifier
6227 Warn if a declaration has duplicate @code{const}, @code{volatile},
6228 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6229 @option{-Wall}.
6231 @item -Wformat
6232 @itemx -Wformat=@var{n}
6233 @opindex Wformat
6234 @opindex Wno-format
6235 @opindex ffreestanding
6236 @opindex fno-builtin
6237 @opindex Wformat=
6238 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6239 the arguments supplied have types appropriate to the format string
6240 specified, and that the conversions specified in the format string make
6241 sense.  This includes standard functions, and others specified by format
6242 attributes (@pxref{Function Attributes}), in the @code{printf},
6243 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6244 not in the C standard) families (or other target-specific families).
6245 Which functions are checked without format attributes having been
6246 specified depends on the standard version selected, and such checks of
6247 functions without the attribute specified are disabled by
6248 @option{-ffreestanding} or @option{-fno-builtin}.
6250 The formats are checked against the format features supported by GNU
6251 libc version 2.2.  These include all ISO C90 and C99 features, as well
6252 as features from the Single Unix Specification and some BSD and GNU
6253 extensions.  Other library implementations may not support all these
6254 features; GCC does not support warning about features that go beyond a
6255 particular library's limitations.  However, if @option{-Wpedantic} is used
6256 with @option{-Wformat}, warnings are given about format features not
6257 in the selected standard version (but not for @code{strfmon} formats,
6258 since those are not in any version of the C standard).  @xref{C Dialect
6259 Options,,Options Controlling C Dialect}.
6261 @table @gcctabopt
6262 @item -Wformat=1
6263 @itemx -Wformat
6264 @opindex Wformat
6265 @opindex Wformat=1
6266 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6267 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6268 @option{-Wformat} also checks for null format arguments for several
6269 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6270 aspects of this level of format checking can be disabled by the
6271 options: @option{-Wno-format-contains-nul},
6272 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6273 @option{-Wformat} is enabled by @option{-Wall}.
6275 @item -Wformat=2
6276 @opindex Wformat=2
6277 Enable @option{-Wformat} plus additional format checks.  Currently
6278 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6279 -Wformat-y2k}.
6280 @end table
6282 @item -Wno-format-contains-nul
6283 @opindex Wno-format-contains-nul
6284 @opindex Wformat-contains-nul
6285 If @option{-Wformat} is specified, do not warn about format strings that
6286 contain NUL bytes.
6288 @item -Wno-format-extra-args
6289 @opindex Wno-format-extra-args
6290 @opindex Wformat-extra-args
6291 If @option{-Wformat} is specified, do not warn about excess arguments to a
6292 @code{printf} or @code{scanf} format function.  The C standard specifies
6293 that such arguments are ignored.
6295 Where the unused arguments lie between used arguments that are
6296 specified with @samp{$} operand number specifications, normally
6297 warnings are still given, since the implementation could not know what
6298 type to pass to @code{va_arg} to skip the unused arguments.  However,
6299 in the case of @code{scanf} formats, this option suppresses the
6300 warning if the unused arguments are all pointers, since the Single
6301 Unix Specification says that such unused arguments are allowed.
6303 @item -Wformat-overflow
6304 @itemx -Wformat-overflow=@var{level}
6305 @opindex Wformat-overflow
6306 @opindex Wno-format-overflow
6307 Warn about calls to formatted input/output functions such as @code{sprintf}
6308 and @code{vsprintf} that might overflow the destination buffer.  When the
6309 exact number of bytes written by a format directive cannot be determined
6310 at compile-time it is estimated based on heuristics that depend on the
6311 @var{level} argument and on optimization.  While enabling optimization
6312 will in most cases improve the accuracy of the warning, it may also
6313 result in false positives.
6315 @table @gcctabopt
6316 @item -Wformat-overflow
6317 @itemx -Wformat-overflow=1
6318 @opindex Wformat-overflow
6319 @opindex Wno-format-overflow
6320 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6321 employs a conservative approach that warns only about calls that most
6322 likely overflow the buffer.  At this level, numeric arguments to format
6323 directives with unknown values are assumed to have the value of one, and
6324 strings of unknown length to be empty.  Numeric arguments that are known
6325 to be bounded to a subrange of their type, or string arguments whose output
6326 is bounded either by their directive's precision or by a finite set of
6327 string literals, are assumed to take on the value within the range that
6328 results in the most bytes on output.  For example, the call to @code{sprintf}
6329 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6330 the terminating NUL character (@code{'\0'}) appended by the function
6331 to the destination buffer will be written past its end.  Increasing
6332 the size of the buffer by a single byte is sufficient to avoid the
6333 warning, though it may not be sufficient to avoid the overflow.
6335 @smallexample
6336 void f (int a, int b)
6338   char buf [13];
6339   sprintf (buf, "a = %i, b = %i\n", a, b);
6341 @end smallexample
6343 @item -Wformat-overflow=2
6344 Level @var{2} warns also about calls that might overflow the destination
6345 buffer given an argument of sufficient length or magnitude.  At level
6346 @var{2}, unknown numeric arguments are assumed to have the minimum
6347 representable value for signed types with a precision greater than 1, and
6348 the maximum representable value otherwise.  Unknown string arguments whose
6349 length cannot be assumed to be bounded either by the directive's precision,
6350 or by a finite set of string literals they may evaluate to, or the character
6351 array they may point to, are assumed to be 1 character long.
6353 At level @var{2}, the call in the example above is again diagnosed, but
6354 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6355 @code{%i} directive will write some of its digits beyond the end of
6356 the destination buffer.  To make the call safe regardless of the values
6357 of the two variables, the size of the destination buffer must be increased
6358 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6359 an informational note following the warning.
6361 An alternative to increasing the size of the destination buffer is to
6362 constrain the range of formatted values.  The maximum length of string
6363 arguments can be bounded by specifying the precision in the format
6364 directive.  When numeric arguments of format directives can be assumed
6365 to be bounded by less than the precision of their type, choosing
6366 an appropriate length modifier to the format specifier will reduce
6367 the required buffer size.  For example, if @var{a} and @var{b} in the
6368 example above can be assumed to be within the precision of
6369 the @code{short int} type then using either the @code{%hi} format
6370 directive or casting the argument to @code{short} reduces the maximum
6371 required size of the buffer to 24 bytes.
6373 @smallexample
6374 void f (int a, int b)
6376   char buf [23];
6377   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6379 @end smallexample
6380 @end table
6382 @item -Wno-format-zero-length
6383 @opindex Wno-format-zero-length
6384 @opindex Wformat-zero-length
6385 If @option{-Wformat} is specified, do not warn about zero-length formats.
6386 The C standard specifies that zero-length formats are allowed.
6388 @item -Wformat-nonliteral
6389 @opindex Wformat-nonliteral
6390 @opindex Wno-format-nonliteral
6391 If @option{-Wformat} is specified, also warn if the format string is not a
6392 string literal and so cannot be checked, unless the format function
6393 takes its format arguments as a @code{va_list}.
6395 @item -Wformat-security
6396 @opindex Wformat-security
6397 @opindex Wno-format-security
6398 If @option{-Wformat} is specified, also warn about uses of format
6399 functions that represent possible security problems.  At present, this
6400 warns about calls to @code{printf} and @code{scanf} functions where the
6401 format string is not a string literal and there are no format arguments,
6402 as in @code{printf (foo);}.  This may be a security hole if the format
6403 string came from untrusted input and contains @samp{%n}.  (This is
6404 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6405 in future warnings may be added to @option{-Wformat-security} that are not
6406 included in @option{-Wformat-nonliteral}.)
6408 @item -Wformat-signedness
6409 @opindex Wformat-signedness
6410 @opindex Wno-format-signedness
6411 If @option{-Wformat} is specified, also warn if the format string
6412 requires an unsigned argument and the argument is signed and vice versa.
6414 @item -Wformat-truncation
6415 @itemx -Wformat-truncation=@var{level}
6416 @opindex Wformat-truncation
6417 @opindex Wno-format-truncation
6418 Warn about calls to formatted input/output functions such as @code{snprintf}
6419 and @code{vsnprintf} that might result in output truncation.  When the exact
6420 number of bytes written by a format directive cannot be determined at
6421 compile-time it is estimated based on heuristics that depend on
6422 the @var{level} argument and on optimization.  While enabling optimization
6423 will in most cases improve the accuracy of the warning, it may also result
6424 in false positives.  Except as noted otherwise, the option uses the same
6425 logic @option{-Wformat-overflow}.
6427 @table @gcctabopt
6428 @item -Wformat-truncation
6429 @itemx -Wformat-truncation=1
6430 @opindex Wformat-truncation
6431 @opindex Wno-format-truncation
6432 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6433 employs a conservative approach that warns only about calls to bounded
6434 functions whose return value is unused and that will most likely result
6435 in output truncation.
6437 @item -Wformat-truncation=2
6438 Level @var{2} warns also about calls to bounded functions whose return
6439 value is used and that might result in truncation given an argument of
6440 sufficient length or magnitude.
6441 @end table
6443 @item -Wformat-y2k
6444 @opindex Wformat-y2k
6445 @opindex Wno-format-y2k
6446 If @option{-Wformat} is specified, also warn about @code{strftime}
6447 formats that may yield only a two-digit year.
6449 @item -Wnonnull
6450 @opindex Wnonnull
6451 @opindex Wno-nonnull
6452 Warn about passing a null pointer for arguments marked as
6453 requiring a non-null value by the @code{nonnull} function attribute.
6455 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6456 can be disabled with the @option{-Wno-nonnull} option.
6458 @item -Wnonnull-compare
6459 @opindex Wnonnull-compare
6460 @opindex Wno-nonnull-compare
6461 Warn when comparing an argument marked with the @code{nonnull}
6462 function attribute against null inside the function.
6464 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6465 can be disabled with the @option{-Wno-nonnull-compare} option.
6467 @item -Wnull-dereference
6468 @opindex Wnull-dereference
6469 @opindex Wno-null-dereference
6470 Warn if the compiler detects paths that trigger erroneous or
6471 undefined behavior due to dereferencing a null pointer.  This option
6472 is only active when @option{-fdelete-null-pointer-checks} is active,
6473 which is enabled by optimizations in most targets.  The precision of
6474 the warnings depends on the optimization options used.
6476 @item -Winfinite-recursion
6477 @opindex Winfinite-recursion
6478 @opindex Wno-infinite-recursion
6479 Warn about infinitely recursive calls.  The warning is effective at all
6480 optimization levels but requires optimization in order to detect infinite
6481 recursion in calls between two or more functions.
6482 @option{-Winfinite-recursion} is included in @option{-Wall}.
6484 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6485 @opindex Winit-self
6486 @opindex Wno-init-self
6487 Warn about uninitialized variables that are initialized with themselves.
6488 Note this option can only be used with the @option{-Wuninitialized} option.
6490 For example, GCC warns about @code{i} being uninitialized in the
6491 following snippet only when @option{-Winit-self} has been specified:
6492 @smallexample
6493 @group
6494 int f()
6496   int i = i;
6497   return i;
6499 @end group
6500 @end smallexample
6502 This warning is enabled by @option{-Wall} in C++.
6504 @item -Wno-implicit-int @r{(C and Objective-C only)}
6505 @opindex Wimplicit-int
6506 @opindex Wno-implicit-int
6507 This option controls warnings when a declaration does not specify a type.
6508 This warning is enabled by default in C99 and later dialects of C,
6509 and also by @option{-Wall}.
6511 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6512 @opindex Wimplicit-function-declaration
6513 @opindex Wno-implicit-function-declaration
6514 This option controls warnings when a function is used before being declared.
6515 This warning is enabled by default in C99 and later dialects of C,
6516 and also by @option{-Wall}.
6517 The warning is made into an error by @option{-pedantic-errors}.
6519 @item -Wimplicit @r{(C and Objective-C only)}
6520 @opindex Wimplicit
6521 @opindex Wno-implicit
6522 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6523 This warning is enabled by @option{-Wall}.
6525 @item -Wimplicit-fallthrough
6526 @opindex Wimplicit-fallthrough
6527 @opindex Wno-implicit-fallthrough
6528 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6529 and @option{-Wno-implicit-fallthrough} is the same as
6530 @option{-Wimplicit-fallthrough=0}.
6532 @item -Wimplicit-fallthrough=@var{n}
6533 @opindex Wimplicit-fallthrough=
6534 Warn when a switch case falls through.  For example:
6536 @smallexample
6537 @group
6538 switch (cond)
6539   @{
6540   case 1:
6541     a = 1;
6542     break;
6543   case 2:
6544     a = 2;
6545   case 3:
6546     a = 3;
6547     break;
6548   @}
6549 @end group
6550 @end smallexample
6552 This warning does not warn when the last statement of a case cannot
6553 fall through, e.g. when there is a return statement or a call to function
6554 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6555 also takes into account control flow statements, such as ifs, and only
6556 warns when appropriate.  E.g.@:
6558 @smallexample
6559 @group
6560 switch (cond)
6561   @{
6562   case 1:
6563     if (i > 3) @{
6564       bar (5);
6565       break;
6566     @} else if (i < 1) @{
6567       bar (0);
6568     @} else
6569       return;
6570   default:
6571     @dots{}
6572   @}
6573 @end group
6574 @end smallexample
6576 Since there are occasions where a switch case fall through is desirable,
6577 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6578 to be used along with a null statement to suppress this warning that
6579 would normally occur:
6581 @smallexample
6582 @group
6583 switch (cond)
6584   @{
6585   case 1:
6586     bar (0);
6587     __attribute__ ((fallthrough));
6588   default:
6589     @dots{}
6590   @}
6591 @end group
6592 @end smallexample
6594 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6595 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
6596 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6597 Instead of these attributes, it is also possible to add a fallthrough comment
6598 to silence the warning.  The whole body of the C or C++ style comment should
6599 match the given regular expressions listed below.  The option argument @var{n}
6600 specifies what kind of comments are accepted:
6602 @itemize @bullet
6604 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6606 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6607 expression, any comment is used as fallthrough comment.
6609 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6610 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6612 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6613 following regular expressions:
6615 @itemize @bullet
6617 @item @code{-fallthrough}
6619 @item @code{@@fallthrough@@}
6621 @item @code{lint -fallthrough[ \t]*}
6623 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6625 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6627 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6629 @end itemize
6631 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6632 following regular expressions:
6634 @itemize @bullet
6636 @item @code{-fallthrough}
6638 @item @code{@@fallthrough@@}
6640 @item @code{lint -fallthrough[ \t]*}
6642 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6644 @end itemize
6646 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6647 fallthrough comments, only attributes disable the warning.
6649 @end itemize
6651 The comment needs to be followed after optional whitespace and other comments
6652 by @code{case} or @code{default} keywords or by a user label that precedes some
6653 @code{case} or @code{default} label.
6655 @smallexample
6656 @group
6657 switch (cond)
6658   @{
6659   case 1:
6660     bar (0);
6661     /* FALLTHRU */
6662   default:
6663     @dots{}
6664   @}
6665 @end group
6666 @end smallexample
6668 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6670 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6671 @opindex Wif-not-aligned
6672 @opindex Wno-if-not-aligned
6673 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6674 should be issued.  These warnings are enabled by default.
6676 @item -Wignored-qualifiers @r{(C and C++ only)}
6677 @opindex Wignored-qualifiers
6678 @opindex Wno-ignored-qualifiers
6679 Warn if the return type of a function has a type qualifier
6680 such as @code{const}.  For ISO C such a type qualifier has no effect,
6681 since the value returned by a function is not an lvalue.
6682 For C++, the warning is only emitted for scalar types or @code{void}.
6683 ISO C prohibits qualified @code{void} return types on function
6684 definitions, so such return types always receive a warning
6685 even without this option.
6687 This warning is also enabled by @option{-Wextra}.
6689 @item -Wno-ignored-attributes @r{(C and C++ only)}
6690 @opindex Wignored-attributes
6691 @opindex Wno-ignored-attributes
6692 This option controls warnings when an attribute is ignored.
6693 This is different from the
6694 @option{-Wattributes} option in that it warns whenever the compiler decides
6695 to drop an attribute, not that the attribute is either unknown, used in a
6696 wrong place, etc.  This warning is enabled by default.
6698 @item -Wmain
6699 @opindex Wmain
6700 @opindex Wno-main
6701 Warn if the type of @code{main} is suspicious.  @code{main} should be
6702 a function with external linkage, returning int, taking either zero
6703 arguments, two, or three arguments of appropriate types.  This warning
6704 is enabled by default in C++ and is enabled by either @option{-Wall}
6705 or @option{-Wpedantic}.
6707 @item -Wmisleading-indentation @r{(C and C++ only)}
6708 @opindex Wmisleading-indentation
6709 @opindex Wno-misleading-indentation
6710 Warn when the indentation of the code does not reflect the block structure.
6711 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6712 @code{for} clauses with a guarded statement that does not use braces,
6713 followed by an unguarded statement with the same indentation.
6715 In the following example, the call to ``bar'' is misleadingly indented as
6716 if it were guarded by the ``if'' conditional.
6718 @smallexample
6719   if (some_condition ())
6720     foo ();
6721     bar ();  /* Gotcha: this is not guarded by the "if".  */
6722 @end smallexample
6724 In the case of mixed tabs and spaces, the warning uses the
6725 @option{-ftabstop=} option to determine if the statements line up
6726 (defaulting to 8).
6728 The warning is not issued for code involving multiline preprocessor logic
6729 such as the following example.
6731 @smallexample
6732   if (flagA)
6733     foo (0);
6734 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6735   if (flagB)
6736 #endif
6737     foo (1);
6738 @end smallexample
6740 The warning is not issued after a @code{#line} directive, since this
6741 typically indicates autogenerated code, and no assumptions can be made
6742 about the layout of the file that the directive references.
6744 This warning is enabled by @option{-Wall} in C and C++.
6746 @item -Wmissing-attributes
6747 @opindex Wmissing-attributes
6748 @opindex Wno-missing-attributes
6749 Warn when a declaration of a function is missing one or more attributes
6750 that a related function is declared with and whose absence may adversely
6751 affect the correctness or efficiency of generated code.  For example,
6752 the warning is issued for declarations of aliases that use attributes
6753 to specify less restrictive requirements than those of their targets.
6754 This typically represents a potential optimization opportunity.
6755 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6756 issued when the alias is more restrictive than the target, which could
6757 lead to incorrect code generation.
6758 Attributes considered include @code{alloc_align}, @code{alloc_size},
6759 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6760 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6761 @code{returns_nonnull}, and @code{returns_twice}.
6763 In C++, the warning is issued when an explicit specialization of a primary
6764 template declared with attribute @code{alloc_align}, @code{alloc_size},
6765 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6766 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
6767 @code{error}, and @code{warning} suppress the warning.
6768 (@pxref{Function Attributes}).
6770 You can use the @code{copy} attribute to apply the same
6771 set of attributes to a declaration as that on another declaration without
6772 explicitly enumerating the attributes. This attribute can be applied
6773 to declarations of functions (@pxref{Common Function Attributes}),
6774 variables (@pxref{Common Variable Attributes}), or types
6775 (@pxref{Common Type Attributes}).
6777 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6779 For example, since the declaration of the primary function template
6780 below makes use of both attribute @code{malloc} and @code{alloc_size}
6781 the declaration of the explicit specialization of the template is
6782 diagnosed because it is missing one of the attributes.
6784 @smallexample
6785 template <class T>
6786 T* __attribute__ ((malloc, alloc_size (1)))
6787 allocate (size_t);
6789 template <>
6790 void* __attribute__ ((malloc))   // missing alloc_size
6791 allocate<void> (size_t);
6792 @end smallexample
6794 @item -Wmissing-braces
6795 @opindex Wmissing-braces
6796 @opindex Wno-missing-braces
6797 Warn if an aggregate or union initializer is not fully bracketed.  In
6798 the following example, the initializer for @code{a} is not fully
6799 bracketed, but that for @code{b} is fully bracketed.
6801 @smallexample
6802 int a[2][2] = @{ 0, 1, 2, 3 @};
6803 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6804 @end smallexample
6806 This warning is enabled by @option{-Wall}.
6808 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
6809 @opindex Wmissing-include-dirs
6810 @opindex Wno-missing-include-dirs
6811 Warn if a user-supplied include directory does not exist. This opions is disabled
6812 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
6813 enabled by default by warning for -I and -J, only.
6815 @item -Wno-missing-profile
6816 @opindex Wmissing-profile
6817 @opindex Wno-missing-profile
6818 This option controls warnings if feedback profiles are missing when using the
6819 @option{-fprofile-use} option.
6820 This option diagnoses those cases where a new function or a new file is added
6821 between compiling with @option{-fprofile-generate} and with
6822 @option{-fprofile-use}, without regenerating the profiles.
6823 In these cases, the profile feedback data files do not contain any
6824 profile feedback information for
6825 the newly added function or file respectively.  Also, in the case when profile
6826 count data (.gcda) files are removed, GCC cannot use any profile feedback
6827 information.  In all these cases, warnings are issued to inform you that a
6828 profile generation step is due.
6829 Ignoring the warning can result in poorly optimized code.
6830 @option{-Wno-missing-profile} can be used to
6831 disable the warning, but this is not recommended and should be done only
6832 when non-existent profile data is justified.
6834 @item -Wmismatched-dealloc
6835 @opindex Wmismatched-dealloc
6836 @opindex Wno-mismatched-dealloc
6838 Warn for calls to deallocation functions with pointer arguments returned
6839 from from allocations functions for which the former isn't a suitable
6840 deallocator.  A pair of functions can be associated as matching allocators
6841 and deallocators by use of attribute @code{malloc}.  Unless disabled by
6842 the @option{-fno-builtin} option the standard functions @code{calloc},
6843 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
6844 forms of C++ @code{operator new} and @code{operator delete} are implicitly
6845 associated as matching allocators and deallocators.  In the following
6846 example @code{mydealloc} is the deallocator for pointers returned from
6847 @code{myalloc}.
6849 @smallexample
6850 void mydealloc (void*);
6852 __attribute__ ((malloc (mydealloc, 1))) void*
6853 myalloc (size_t);
6855 void f (void)
6857   void *p = myalloc (32);
6858   // @dots{}use p@dots{}
6859   free (p);   // warning: not a matching deallocator for myalloc
6860   mydealloc (p);   // ok
6862 @end smallexample
6864 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
6865 mismatches involving either @code{operator new} or @code{operator delete}.
6867 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
6869 @item -Wmultistatement-macros
6870 @opindex Wmultistatement-macros
6871 @opindex Wno-multistatement-macros
6872 Warn about unsafe multiple statement macros that appear to be guarded
6873 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
6874 @code{while}, in which only the first statement is actually guarded after
6875 the macro is expanded.
6877 For example:
6879 @smallexample
6880 #define DOIT x++; y++
6881 if (c)
6882   DOIT;
6883 @end smallexample
6885 will increment @code{y} unconditionally, not just when @code{c} holds.
6886 The can usually be fixed by wrapping the macro in a do-while loop:
6887 @smallexample
6888 #define DOIT do @{ x++; y++; @} while (0)
6889 if (c)
6890   DOIT;
6891 @end smallexample
6893 This warning is enabled by @option{-Wall} in C and C++.
6895 @item -Wparentheses
6896 @opindex Wparentheses
6897 @opindex Wno-parentheses
6898 Warn if parentheses are omitted in certain contexts, such
6899 as when there is an assignment in a context where a truth value
6900 is expected, or when operators are nested whose precedence people
6901 often get confused about.
6903 Also warn if a comparison like @code{x<=y<=z} appears; this is
6904 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
6905 interpretation from that of ordinary mathematical notation.
6907 Also warn for dangerous uses of the GNU extension to
6908 @code{?:} with omitted middle operand. When the condition
6909 in the @code{?}: operator is a boolean expression, the omitted value is
6910 always 1.  Often programmers expect it to be a value computed
6911 inside the conditional expression instead.
6913 For C++ this also warns for some cases of unnecessary parentheses in
6914 declarations, which can indicate an attempt at a function call instead
6915 of a declaration:
6916 @smallexample
6918   // Declares a local variable called mymutex.
6919   std::unique_lock<std::mutex> (mymutex);
6920   // User meant std::unique_lock<std::mutex> lock (mymutex);
6922 @end smallexample
6924 This warning is enabled by @option{-Wall}.
6926 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
6927 @opindex Wself-move
6928 @opindex Wno-self-move
6929 This warning warns when a value is moved to itself with @code{std::move}.
6930 Such a @code{std::move} typically has no effect.
6932 @smallexample
6933 struct T @{
6934 @dots{}
6936 void fn()
6938   T t;
6939   @dots{}
6940   t = std::move (t);
6942 @end smallexample
6944 This warning is enabled by @option{-Wall}.
6946 @item -Wsequence-point
6947 @opindex Wsequence-point
6948 @opindex Wno-sequence-point
6949 Warn about code that may have undefined semantics because of violations
6950 of sequence point rules in the C and C++ standards.
6952 The C and C++ standards define the order in which expressions in a C/C++
6953 program are evaluated in terms of @dfn{sequence points}, which represent
6954 a partial ordering between the execution of parts of the program: those
6955 executed before the sequence point, and those executed after it.  These
6956 occur after the evaluation of a full expression (one which is not part
6957 of a larger expression), after the evaluation of the first operand of a
6958 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
6959 function is called (but after the evaluation of its arguments and the
6960 expression denoting the called function), and in certain other places.
6961 Other than as expressed by the sequence point rules, the order of
6962 evaluation of subexpressions of an expression is not specified.  All
6963 these rules describe only a partial order rather than a total order,
6964 since, for example, if two functions are called within one expression
6965 with no sequence point between them, the order in which the functions
6966 are called is not specified.  However, the standards committee have
6967 ruled that function calls do not overlap.
6969 It is not specified when between sequence points modifications to the
6970 values of objects take effect.  Programs whose behavior depends on this
6971 have undefined behavior; the C and C++ standards specify that ``Between
6972 the previous and next sequence point an object shall have its stored
6973 value modified at most once by the evaluation of an expression.
6974 Furthermore, the prior value shall be read only to determine the value
6975 to be stored.''.  If a program breaks these rules, the results on any
6976 particular implementation are entirely unpredictable.
6978 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
6979 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
6980 diagnosed by this option, and it may give an occasional false positive
6981 result, but in general it has been found fairly effective at detecting
6982 this sort of problem in programs.
6984 The C++17 standard will define the order of evaluation of operands in
6985 more cases: in particular it requires that the right-hand side of an
6986 assignment be evaluated before the left-hand side, so the above
6987 examples are no longer undefined.  But this option will still warn
6988 about them, to help people avoid writing code that is undefined in C
6989 and earlier revisions of C++.
6991 The standard is worded confusingly, therefore there is some debate
6992 over the precise meaning of the sequence point rules in subtle cases.
6993 Links to discussions of the problem, including proposed formal
6994 definitions, may be found on the GCC readings page, at
6995 @uref{https://gcc.gnu.org/@/readings.html}.
6997 This warning is enabled by @option{-Wall} for C and C++.
6999 @item -Wno-return-local-addr
7000 @opindex Wno-return-local-addr
7001 @opindex Wreturn-local-addr
7002 Do not warn about returning a pointer (or in C++, a reference) to a
7003 variable that goes out of scope after the function returns.
7005 @item -Wreturn-type
7006 @opindex Wreturn-type
7007 @opindex Wno-return-type
7008 Warn whenever a function is defined with a return type that defaults
7009 to @code{int}.  Also warn about any @code{return} statement with no
7010 return value in a function whose return type is not @code{void}
7011 (falling off the end of the function body is considered returning
7012 without a value).
7014 For C only, warn about a @code{return} statement with an expression in a
7015 function whose return type is @code{void}, unless the expression type is
7016 also @code{void}.  As a GNU extension, the latter case is accepted
7017 without a warning unless @option{-Wpedantic} is used.  Attempting
7018 to use the return value of a non-@code{void} function other than @code{main}
7019 that flows off the end by reaching the closing curly brace that terminates
7020 the function is undefined.
7022 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7023 than @code{main} results in undefined behavior even when the value of
7024 the function is not used.
7026 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7028 @item -Wno-shift-count-negative
7029 @opindex Wshift-count-negative
7030 @opindex Wno-shift-count-negative
7031 Controls warnings if a shift count is negative.
7032 This warning is enabled by default.
7034 @item -Wno-shift-count-overflow
7035 @opindex Wshift-count-overflow
7036 @opindex Wno-shift-count-overflow
7037 Controls warnings if a shift count is greater than or equal to the bit width
7038 of the type.  This warning is enabled by default.
7040 @item -Wshift-negative-value
7041 @opindex Wshift-negative-value
7042 @opindex Wno-shift-negative-value
7043 Warn if left shifting a negative value.  This warning is enabled by
7044 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7046 @item -Wno-shift-overflow
7047 @itemx -Wshift-overflow=@var{n}
7048 @opindex Wshift-overflow
7049 @opindex Wno-shift-overflow
7050 These options control warnings about left shift overflows.
7052 @table @gcctabopt
7053 @item -Wshift-overflow=1
7054 This is the warning level of @option{-Wshift-overflow} and is enabled
7055 by default in C99 and C++11 modes (and newer).  This warning level does
7056 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7057 an overflow is still rejected in contexts where an integer constant expression
7058 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7059 shifts always wrap.
7061 @item -Wshift-overflow=2
7062 This warning level also warns about left-shifting 1 into the sign bit,
7063 unless C++14 mode (or newer) is active.
7064 @end table
7066 @item -Wswitch
7067 @opindex Wswitch
7068 @opindex Wno-switch
7069 Warn whenever a @code{switch} statement has an index of enumerated type
7070 and lacks a @code{case} for one or more of the named codes of that
7071 enumeration.  (The presence of a @code{default} label prevents this
7072 warning.)  @code{case} labels outside the enumeration range also
7073 provoke warnings when this option is used (even if there is a
7074 @code{default} label).
7075 This warning is enabled by @option{-Wall}.
7077 @item -Wswitch-default
7078 @opindex Wswitch-default
7079 @opindex Wno-switch-default
7080 Warn whenever a @code{switch} statement does not have a @code{default}
7081 case.
7083 @item -Wswitch-enum
7084 @opindex Wswitch-enum
7085 @opindex Wno-switch-enum
7086 Warn whenever a @code{switch} statement has an index of enumerated type
7087 and lacks a @code{case} for one or more of the named codes of that
7088 enumeration.  @code{case} labels outside the enumeration range also
7089 provoke warnings when this option is used.  The only difference
7090 between @option{-Wswitch} and this option is that this option gives a
7091 warning about an omitted enumeration code even if there is a
7092 @code{default} label.
7094 @item -Wno-switch-bool
7095 @opindex Wswitch-bool
7096 @opindex Wno-switch-bool
7097 Do not warn when a @code{switch} statement has an index of boolean type
7098 and the case values are outside the range of a boolean type.
7099 It is possible to suppress this warning by casting the controlling
7100 expression to a type other than @code{bool}.  For example:
7101 @smallexample
7102 @group
7103 switch ((int) (a == 4))
7104   @{
7105   @dots{}
7106   @}
7107 @end group
7108 @end smallexample
7109 This warning is enabled by default for C and C++ programs.
7111 @item -Wno-switch-outside-range
7112 @opindex Wswitch-outside-range
7113 @opindex Wno-switch-outside-range
7114 This option controls warnings when a @code{switch} case has a value
7115 that is outside of its
7116 respective type range.  This warning is enabled by default for
7117 C and C++ programs.
7119 @item -Wno-switch-unreachable
7120 @opindex Wswitch-unreachable
7121 @opindex Wno-switch-unreachable
7122 Do not warn when a @code{switch} statement contains statements between the
7123 controlling expression and the first case label, which will never be
7124 executed.  For example:
7125 @smallexample
7126 @group
7127 switch (cond)
7128   @{
7129    i = 15;
7130   @dots{}
7131    case 5:
7132   @dots{}
7133   @}
7134 @end group
7135 @end smallexample
7136 @option{-Wswitch-unreachable} does not warn if the statement between the
7137 controlling expression and the first case label is just a declaration:
7138 @smallexample
7139 @group
7140 switch (cond)
7141   @{
7142    int i;
7143   @dots{}
7144    case 5:
7145    i = 5;
7146   @dots{}
7147   @}
7148 @end group
7149 @end smallexample
7150 This warning is enabled by default for C and C++ programs.
7152 @item -Wsync-nand @r{(C and C++ only)}
7153 @opindex Wsync-nand
7154 @opindex Wno-sync-nand
7155 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7156 built-in functions are used.  These functions changed semantics in GCC 4.4.
7158 @item -Wtrivial-auto-var-init
7159 @opindex Wtrivial-auto-var-init
7160 @opindex Wno-trivial-auto-var-init
7161 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7162 variable.  A common situation is an automatic variable that is declared
7163 between the controlling expression and the first case label of a @code{switch}
7164 statement.
7166 @item -Wunused-but-set-parameter
7167 @opindex Wunused-but-set-parameter
7168 @opindex Wno-unused-but-set-parameter
7169 Warn whenever a function parameter is assigned to, but otherwise unused
7170 (aside from its declaration).
7172 To suppress this warning use the @code{unused} attribute
7173 (@pxref{Variable Attributes}).
7175 This warning is also enabled by @option{-Wunused} together with
7176 @option{-Wextra}.
7178 @item -Wunused-but-set-variable
7179 @opindex Wunused-but-set-variable
7180 @opindex Wno-unused-but-set-variable
7181 Warn whenever a local variable is assigned to, but otherwise unused
7182 (aside from its declaration).
7183 This warning is enabled by @option{-Wall}.
7185 To suppress this warning use the @code{unused} attribute
7186 (@pxref{Variable Attributes}).
7188 This warning is also enabled by @option{-Wunused}, which is enabled
7189 by @option{-Wall}.
7191 @item -Wunused-function
7192 @opindex Wunused-function
7193 @opindex Wno-unused-function
7194 Warn whenever a static function is declared but not defined or a
7195 non-inline static function is unused.
7196 This warning is enabled by @option{-Wall}.
7198 @item -Wunused-label
7199 @opindex Wunused-label
7200 @opindex Wno-unused-label
7201 Warn whenever a label is declared but not used.
7202 This warning is enabled by @option{-Wall}.
7204 To suppress this warning use the @code{unused} attribute
7205 (@pxref{Variable Attributes}).
7207 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7208 @opindex Wunused-local-typedefs
7209 @opindex Wno-unused-local-typedefs
7210 Warn when a typedef locally defined in a function is not used.
7211 This warning is enabled by @option{-Wall}.
7213 @item -Wunused-parameter
7214 @opindex Wunused-parameter
7215 @opindex Wno-unused-parameter
7216 Warn whenever a function parameter is unused aside from its declaration.
7218 To suppress this warning use the @code{unused} attribute
7219 (@pxref{Variable Attributes}).
7221 @item -Wno-unused-result
7222 @opindex Wunused-result
7223 @opindex Wno-unused-result
7224 Do not warn if a caller of a function marked with attribute
7225 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7226 its return value. The default is @option{-Wunused-result}.
7228 @item -Wunused-variable
7229 @opindex Wunused-variable
7230 @opindex Wno-unused-variable
7231 Warn whenever a local or static variable is unused aside from its
7232 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7233 but not for C++. This warning is enabled by @option{-Wall}.
7235 To suppress this warning use the @code{unused} attribute
7236 (@pxref{Variable Attributes}).
7238 @item -Wunused-const-variable
7239 @itemx -Wunused-const-variable=@var{n}
7240 @opindex Wunused-const-variable
7241 @opindex Wno-unused-const-variable
7242 Warn whenever a constant static variable is unused aside from its declaration.
7243 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7244 for C, but not for C++. In C this declares variable storage, but in C++ this
7245 is not an error since const variables take the place of @code{#define}s.
7247 To suppress this warning use the @code{unused} attribute
7248 (@pxref{Variable Attributes}).
7250 @table @gcctabopt
7251 @item -Wunused-const-variable=1
7252 This is the warning level that is enabled by @option{-Wunused-variable} for
7253 C.  It warns only about unused static const variables defined in the main
7254 compilation unit, but not about static const variables declared in any
7255 header included.
7257 @item -Wunused-const-variable=2
7258 This warning level also warns for unused constant static variables in
7259 headers (excluding system headers).  This is the warning level of
7260 @option{-Wunused-const-variable} and must be explicitly requested since
7261 in C++ this isn't an error and in C it might be harder to clean up all
7262 headers included.
7263 @end table
7265 @item -Wunused-value
7266 @opindex Wunused-value
7267 @opindex Wno-unused-value
7268 Warn whenever a statement computes a result that is explicitly not
7269 used. To suppress this warning cast the unused expression to
7270 @code{void}. This includes an expression-statement or the left-hand
7271 side of a comma expression that contains no side effects. For example,
7272 an expression such as @code{x[i,j]} causes a warning, while
7273 @code{x[(void)i,j]} does not.
7275 This warning is enabled by @option{-Wall}.
7277 @item -Wunused
7278 @opindex Wunused
7279 @opindex Wno-unused
7280 All the above @option{-Wunused} options combined.
7282 In order to get a warning about an unused function parameter, you must
7283 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7284 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7286 @item -Wuninitialized
7287 @opindex Wuninitialized
7288 @opindex Wno-uninitialized
7289 Warn if an object with automatic or allocated storage duration is used
7290 without having been initialized.  In C++, also warn if a non-static
7291 reference or non-static @code{const} member appears in a class without
7292 constructors.
7294 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7295 object to a @code{const}-qualified argument of a built-in function known to
7296 read the object is also diagnosed by this warning.
7297 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7299 If you want to warn about code that uses the uninitialized value of the
7300 variable in its own initializer, use the @option{-Winit-self} option.
7302 These warnings occur for individual uninitialized elements of
7303 structure, union or array variables as well as for variables that are
7304 uninitialized as a whole.  They do not occur for variables or elements
7305 declared @code{volatile}.  Because these warnings depend on
7306 optimization, the exact variables or elements for which there are
7307 warnings depend on the precise optimization options and version of GCC
7308 used.
7310 Note that there may be no warning about a variable that is used only
7311 to compute a value that itself is never used, because such
7312 computations may be deleted by data flow analysis before the warnings
7313 are printed.
7315 In C++, this warning also warns about using uninitialized objects in
7316 member-initializer-lists.  For example, GCC warns about @code{b} being
7317 uninitialized in the following snippet:
7319 @smallexample
7320 struct A @{
7321   int a;
7322   int b;
7323   A() : a(b) @{ @}
7325 @end smallexample
7327 @item -Wno-invalid-memory-model
7328 @opindex Winvalid-memory-model
7329 @opindex Wno-invalid-memory-model
7330 This option controls warnings
7331 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7332 and the C11 atomic generic functions with a memory consistency argument
7333 that is either invalid for the operation or outside the range of values
7334 of the @code{memory_order} enumeration.  For example, since the
7335 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7336 defined for the relaxed, release, and sequentially consistent memory
7337 orders the following code is diagnosed:
7339 @smallexample
7340 void store (int *i)
7342   __atomic_store_n (i, 0, memory_order_consume);
7344 @end smallexample
7346 @option{-Winvalid-memory-model} is enabled by default.
7348 @item -Wmaybe-uninitialized
7349 @opindex Wmaybe-uninitialized
7350 @opindex Wno-maybe-uninitialized
7351 For an object with automatic or allocated storage duration, if there exists
7352 a path from the function entry to a use of the object that is initialized,
7353 but there exist some other paths for which the object is not initialized,
7354 the compiler emits a warning if it cannot prove the uninitialized paths
7355 are not executed at run time.
7357 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7358 object to a @code{const}-qualified function argument is also diagnosed by
7359 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7360 known to read the object.)  Annotating the function with attribute
7361 @code{access (none)} indicates that the argument isn't used to access
7362 the object and avoids the warning (@pxref{Common Function Attributes}).
7364 These warnings are only possible in optimizing compilation, because otherwise
7365 GCC does not keep track of the state of variables.
7367 These warnings are made optional because GCC may not be able to determine when
7368 the code is correct in spite of appearing to have an error.  Here is one
7369 example of how this can happen:
7371 @smallexample
7372 @group
7374   int x;
7375   switch (y)
7376     @{
7377     case 1: x = 1;
7378       break;
7379     case 2: x = 4;
7380       break;
7381     case 3: x = 5;
7382     @}
7383   foo (x);
7385 @end group
7386 @end smallexample
7388 @noindent
7389 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7390 always initialized, but GCC doesn't know this. To suppress the
7391 warning, you need to provide a default case with assert(0) or
7392 similar code.
7394 @cindex @code{longjmp} warnings
7395 This option also warns when a non-volatile automatic variable might be
7396 changed by a call to @code{longjmp}.
7397 The compiler sees only the calls to @code{setjmp}.  It cannot know
7398 where @code{longjmp} will be called; in fact, a signal handler could
7399 call it at any point in the code.  As a result, you may get a warning
7400 even when there is in fact no problem because @code{longjmp} cannot
7401 in fact be called at the place that would cause a problem.
7403 Some spurious warnings can be avoided if you declare all the functions
7404 you use that never return as @code{noreturn}.  @xref{Function
7405 Attributes}.
7407 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7409 @item -Wunknown-pragmas
7410 @opindex Wunknown-pragmas
7411 @opindex Wno-unknown-pragmas
7412 @cindex warning for unknown pragmas
7413 @cindex unknown pragmas, warning
7414 @cindex pragmas, warning of unknown
7415 Warn when a @code{#pragma} directive is encountered that is not understood by 
7416 GCC@.  If this command-line option is used, warnings are even issued
7417 for unknown pragmas in system header files.  This is not the case if
7418 the warnings are only enabled by the @option{-Wall} command-line option.
7420 @item -Wno-pragmas
7421 @opindex Wno-pragmas
7422 @opindex Wpragmas
7423 Do not warn about misuses of pragmas, such as incorrect parameters,
7424 invalid syntax, or conflicts between pragmas.  See also
7425 @option{-Wunknown-pragmas}.
7427 @item -Wno-prio-ctor-dtor
7428 @opindex Wno-prio-ctor-dtor
7429 @opindex Wprio-ctor-dtor
7430 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7431 The use of constructor and destructor attributes allow you to assign a
7432 priority to the constructor/destructor to control its order of execution
7433 before @code{main} is called or after it returns.  The priority values must be
7434 greater than 100 as the compiler reserves priority values between 0--100 for
7435 the implementation.
7437 @item -Wstrict-aliasing
7438 @opindex Wstrict-aliasing
7439 @opindex Wno-strict-aliasing
7440 This option is only active when @option{-fstrict-aliasing} is active.
7441 It warns about code that might break the strict aliasing rules that the
7442 compiler is using for optimization.  The warning does not catch all
7443 cases, but does attempt to catch the more common pitfalls.  It is
7444 included in @option{-Wall}.
7445 It is equivalent to @option{-Wstrict-aliasing=3}
7447 @item -Wstrict-aliasing=n
7448 @opindex Wstrict-aliasing=n
7449 This option is only active when @option{-fstrict-aliasing} is active.
7450 It warns about code that might break the strict aliasing rules that the
7451 compiler is using for optimization.
7452 Higher levels correspond to higher accuracy (fewer false positives).
7453 Higher levels also correspond to more effort, similar to the way @option{-O} 
7454 works.
7455 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7457 Level 1: Most aggressive, quick, least accurate.
7458 Possibly useful when higher levels
7459 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7460 false negatives.  However, it has many false positives.
7461 Warns for all pointer conversions between possibly incompatible types,
7462 even if never dereferenced.  Runs in the front end only.
7464 Level 2: Aggressive, quick, not too precise.
7465 May still have many false positives (not as many as level 1 though),
7466 and few false negatives (but possibly more than level 1).
7467 Unlike level 1, it only warns when an address is taken.  Warns about
7468 incomplete types.  Runs in the front end only.
7470 Level 3 (default for @option{-Wstrict-aliasing}):
7471 Should have very few false positives and few false
7472 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7473 Takes care of the common pun+dereference pattern in the front end:
7474 @code{*(int*)&some_float}.
7475 If optimization is enabled, it also runs in the back end, where it deals
7476 with multiple statement cases using flow-sensitive points-to information.
7477 Only warns when the converted pointer is dereferenced.
7478 Does not warn about incomplete types.
7480 @item -Wstrict-overflow
7481 @itemx -Wstrict-overflow=@var{n}
7482 @opindex Wstrict-overflow
7483 @opindex Wno-strict-overflow
7484 This option is only active when signed overflow is undefined.
7485 It warns about cases where the compiler optimizes based on the
7486 assumption that signed overflow does not occur.  Note that it does not
7487 warn about all cases where the code might overflow: it only warns
7488 about cases where the compiler implements some optimization.  Thus
7489 this warning depends on the optimization level.
7491 An optimization that assumes that signed overflow does not occur is
7492 perfectly safe if the values of the variables involved are such that
7493 overflow never does, in fact, occur.  Therefore this warning can
7494 easily give a false positive: a warning about code that is not
7495 actually a problem.  To help focus on important issues, several
7496 warning levels are defined.  No warnings are issued for the use of
7497 undefined signed overflow when estimating how many iterations a loop
7498 requires, in particular when determining whether a loop will be
7499 executed at all.
7501 @table @gcctabopt
7502 @item -Wstrict-overflow=1
7503 Warn about cases that are both questionable and easy to avoid.  For
7504 example the compiler simplifies
7505 @code{x + 1 > x} to @code{1}.  This level of
7506 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7507 are not, and must be explicitly requested.
7509 @item -Wstrict-overflow=2
7510 Also warn about other cases where a comparison is simplified to a
7511 constant.  For example: @code{abs (x) >= 0}.  This can only be
7512 simplified when signed integer overflow is undefined, because
7513 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7514 zero.  @option{-Wstrict-overflow} (with no level) is the same as
7515 @option{-Wstrict-overflow=2}.
7517 @item -Wstrict-overflow=3
7518 Also warn about other cases where a comparison is simplified.  For
7519 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7521 @item -Wstrict-overflow=4
7522 Also warn about other simplifications not covered by the above cases.
7523 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7525 @item -Wstrict-overflow=5
7526 Also warn about cases where the compiler reduces the magnitude of a
7527 constant involved in a comparison.  For example: @code{x + 2 > y} is
7528 simplified to @code{x + 1 >= y}.  This is reported only at the
7529 highest warning level because this simplification applies to many
7530 comparisons, so this warning level gives a very large number of
7531 false positives.
7532 @end table
7534 @item -Wstring-compare
7535 @opindex Wstring-compare
7536 @opindex Wno-string-compare
7537 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7538 determined to be either zero or non-zero in tests for such equality
7539 owing to the length of one argument being greater than the size of
7540 the array the other argument is stored in (or the bound in the case
7541 of @code{strncmp}).  Such calls could be mistakes.  For example,
7542 the call to @code{strcmp} below is diagnosed because its result is
7543 necessarily non-zero irrespective of the contents of the array @code{a}.
7545 @smallexample
7546 extern char a[4];
7547 void f (char *d)
7549   strcpy (d, "string");
7550   @dots{}
7551   if (0 == strcmp (a, d))   // cannot be true
7552     puts ("a and d are the same");
7554 @end smallexample
7556 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7558 @item -Wno-stringop-overflow
7559 @item -Wstringop-overflow
7560 @itemx -Wstringop-overflow=@var{type}
7561 @opindex Wstringop-overflow
7562 @opindex Wno-stringop-overflow
7563 Warn for calls to string manipulation functions such as @code{memcpy} and
7564 @code{strcpy} that are determined to overflow the destination buffer.  The
7565 optional argument is one greater than the type of Object Size Checking to
7566 perform to determine the size of the destination.  @xref{Object Size Checking}.
7567 The argument is meaningful only for functions that operate on character arrays
7568 but not for raw memory functions like @code{memcpy} which always make use
7569 of Object Size type-0.  The option also warns for calls that specify a size
7570 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7571 The option produces the best results with optimization enabled but can detect
7572 a small subset of simple buffer overflows even without optimization in
7573 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7574 correspond to the standard functions.  In any case, the option warns about
7575 just a subset of buffer overflows detected by the corresponding overflow
7576 checking built-ins.  For example, the option issues a warning for
7577 the @code{strcpy} call below because it copies at least 5 characters
7578 (the string @code{"blue"} including the terminating NUL) into the buffer
7579 of size 4.
7581 @smallexample
7582 enum Color @{ blue, purple, yellow @};
7583 const char* f (enum Color clr)
7585   static char buf [4];
7586   const char *str;
7587   switch (clr)
7588     @{
7589       case blue: str = "blue"; break;
7590       case purple: str = "purple"; break;
7591       case yellow: str = "yellow"; break;
7592     @}
7594   return strcpy (buf, str);   // warning here
7596 @end smallexample
7598 Option @option{-Wstringop-overflow=2} is enabled by default.
7600 @table @gcctabopt
7601 @item -Wstringop-overflow
7602 @itemx -Wstringop-overflow=1
7603 @opindex Wstringop-overflow
7604 @opindex Wno-stringop-overflow
7605 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7606 to determine the sizes of destination objects.  At this setting the option
7607 does not warn for writes past the end of subobjects of larger objects accessed
7608 by pointers unless the size of the largest surrounding object is known.  When
7609 the destination may be one of several objects it is assumed to be the largest
7610 one of them.  On Linux systems, when optimization is enabled at this setting
7611 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7612 is defined to a non-zero value.
7614 @item -Wstringop-overflow=2
7615 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7616 to determine the sizes of destination objects.  At this setting the option
7617 warns about overflows when writing to members of the largest complete
7618 objects whose exact size is known.  However, it does not warn for excessive
7619 writes to the same members of unknown objects referenced by pointers since
7620 they may point to arrays containing unknown numbers of elements.  This is
7621 the default setting of the option.
7623 @item -Wstringop-overflow=3
7624 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7625 to determine the sizes of destination objects.  At this setting the option
7626 warns about overflowing the smallest object or data member.  This is the
7627 most restrictive setting of the option that may result in warnings for safe
7628 code.
7630 @item -Wstringop-overflow=4
7631 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7632 to determine the sizes of destination objects.  At this setting the option
7633 warns about overflowing any data members, and when the destination is
7634 one of several objects it uses the size of the largest of them to decide
7635 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
7636 setting of the option may result in warnings for benign code.
7637 @end table
7639 @item -Wno-stringop-overread
7640 @opindex Wstringop-overread
7641 @opindex Wno-stringop-overread
7642 Warn for calls to string manipulation functions such as @code{memchr}, or
7643 @code{strcpy} that are determined to read past the end of the source
7644 sequence.
7646 Option @option{-Wstringop-overread} is enabled by default.
7648 @item -Wno-stringop-truncation
7649 @opindex Wstringop-truncation
7650 @opindex Wno-stringop-truncation
7651 Do not warn for calls to bounded string manipulation functions
7652 such as @code{strncat},
7653 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7654 or leave the destination unchanged.
7656 In the following example, the call to @code{strncat} specifies a bound that
7657 is less than the length of the source string.  As a result, the copy of
7658 the source will be truncated and so the call is diagnosed.  To avoid the
7659 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7661 @smallexample
7662 void append (char *buf, size_t bufsize)
7664   strncat (buf, ".txt", 3);
7666 @end smallexample
7668 As another example, the following call to @code{strncpy} results in copying
7669 to @code{d} just the characters preceding the terminating NUL, without
7670 appending the NUL to the end.  Assuming the result of @code{strncpy} is
7671 necessarily a NUL-terminated string is a common mistake, and so the call
7672 is diagnosed.  To avoid the warning when the result is not expected to be
7673 NUL-terminated, call @code{memcpy} instead.
7675 @smallexample
7676 void copy (char *d, const char *s)
7678   strncpy (d, s, strlen (s));
7680 @end smallexample
7682 In the following example, the call to @code{strncpy} specifies the size
7683 of the destination buffer as the bound.  If the length of the source
7684 string is equal to or greater than this size the result of the copy will
7685 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
7686 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7687 element of the buffer to @code{NUL}.
7689 @smallexample
7690 void copy (const char *s)
7692   char buf[80];
7693   strncpy (buf, s, sizeof buf);
7694   @dots{}
7696 @end smallexample
7698 In situations where a character array is intended to store a sequence
7699 of bytes with no terminating @code{NUL} such an array may be annotated
7700 with attribute @code{nonstring} to avoid this warning.  Such arrays,
7701 however, are not suitable arguments to functions that expect
7702 @code{NUL}-terminated strings.  To help detect accidental misuses of
7703 such arrays GCC issues warnings unless it can prove that the use is
7704 safe.  @xref{Common Variable Attributes}.
7706 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7707 @opindex Wsuggest-attribute=
7708 @opindex Wno-suggest-attribute=
7709 Warn for cases where adding an attribute may be beneficial. The
7710 attributes currently supported are listed below.
7712 @table @gcctabopt
7713 @item -Wsuggest-attribute=pure
7714 @itemx -Wsuggest-attribute=const
7715 @itemx -Wsuggest-attribute=noreturn
7716 @itemx -Wmissing-noreturn
7717 @itemx -Wsuggest-attribute=malloc
7718 @opindex Wsuggest-attribute=pure
7719 @opindex Wno-suggest-attribute=pure
7720 @opindex Wsuggest-attribute=const
7721 @opindex Wno-suggest-attribute=const
7722 @opindex Wsuggest-attribute=noreturn
7723 @opindex Wno-suggest-attribute=noreturn
7724 @opindex Wmissing-noreturn
7725 @opindex Wno-missing-noreturn
7726 @opindex Wsuggest-attribute=malloc
7727 @opindex Wno-suggest-attribute=malloc
7729 Warn about functions that might be candidates for attributes
7730 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7731 only warns for functions visible in other compilation units or (in the case of
7732 @code{pure} and @code{const}) if it cannot prove that the function returns
7733 normally. A function returns normally if it doesn't contain an infinite loop or
7734 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
7735 requires option @option{-fipa-pure-const}, which is enabled by default at
7736 @option{-O} and higher.  Higher optimization levels improve the accuracy
7737 of the analysis.
7739 @item -Wsuggest-attribute=format
7740 @itemx -Wmissing-format-attribute
7741 @opindex Wsuggest-attribute=format
7742 @opindex Wmissing-format-attribute
7743 @opindex Wno-suggest-attribute=format
7744 @opindex Wno-missing-format-attribute
7745 @opindex Wformat
7746 @opindex Wno-format
7748 Warn about function pointers that might be candidates for @code{format}
7749 attributes.  Note these are only possible candidates, not absolute ones.
7750 GCC guesses that function pointers with @code{format} attributes that
7751 are used in assignment, initialization, parameter passing or return
7752 statements should have a corresponding @code{format} attribute in the
7753 resulting type.  I.e.@: the left-hand side of the assignment or
7754 initialization, the type of the parameter variable, or the return type
7755 of the containing function respectively should also have a @code{format}
7756 attribute to avoid the warning.
7758 GCC also warns about function definitions that might be
7759 candidates for @code{format} attributes.  Again, these are only
7760 possible candidates.  GCC guesses that @code{format} attributes
7761 might be appropriate for any function that calls a function like
7762 @code{vprintf} or @code{vscanf}, but this might not always be the
7763 case, and some functions for which @code{format} attributes are
7764 appropriate may not be detected.
7766 @item -Wsuggest-attribute=cold
7767 @opindex Wsuggest-attribute=cold
7768 @opindex Wno-suggest-attribute=cold
7770 Warn about functions that might be candidates for @code{cold} attribute.  This
7771 is based on static detection and generally only warns about functions which
7772 always leads to a call to another @code{cold} function such as wrappers of
7773 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7774 @end table
7776 @item -Walloc-zero
7777 @opindex Wno-alloc-zero
7778 @opindex Walloc-zero
7779 Warn about calls to allocation functions decorated with attribute
7780 @code{alloc_size} that specify zero bytes, including those to the built-in
7781 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7782 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
7783 when called with a zero size differs among implementations (and in the case
7784 of @code{realloc} has been deprecated) relying on it may result in subtle
7785 portability bugs and should be avoided.
7787 @item -Walloc-size-larger-than=@var{byte-size}
7788 @opindex Walloc-size-larger-than=
7789 @opindex Wno-alloc-size-larger-than
7790 Warn about calls to functions decorated with attribute @code{alloc_size}
7791 that attempt to allocate objects larger than the specified number of bytes,
7792 or where the result of the size computation in an integer type with infinite
7793 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7794 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7795 Warnings controlled by the option can be disabled either by specifying
7796 @var{byte-size} of @samp{SIZE_MAX} or more or by
7797 @option{-Wno-alloc-size-larger-than}.
7798 @xref{Function Attributes}.
7800 @item -Wno-alloc-size-larger-than
7801 @opindex Wno-alloc-size-larger-than
7802 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
7803 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7804 larger.
7806 @item -Walloca
7807 @opindex Wno-alloca
7808 @opindex Walloca
7809 This option warns on all uses of @code{alloca} in the source.
7811 @item -Walloca-larger-than=@var{byte-size}
7812 @opindex Walloca-larger-than=
7813 @opindex Wno-alloca-larger-than
7814 This option warns on calls to @code{alloca} with an integer argument whose
7815 value is either zero, or that is not bounded by a controlling predicate
7816 that limits its value to at most @var{byte-size}.  It also warns for calls
7817 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
7818 types are considered unbounded even if they appear to be constrained to
7819 the expected range.
7821 For example, a bounded case of @code{alloca} could be:
7823 @smallexample
7824 void func (size_t n)
7826   void *p;
7827   if (n <= 1000)
7828     p = alloca (n);
7829   else
7830     p = malloc (n);
7831   f (p);
7833 @end smallexample
7835 In the above example, passing @code{-Walloca-larger-than=1000} would not
7836 issue a warning because the call to @code{alloca} is known to be at most
7837 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
7838 the compiler would emit a warning.
7840 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7841 controlling predicate constraining its integer argument.  For example:
7843 @smallexample
7844 void func ()
7846   void *p = alloca (n);
7847   f (p);
7849 @end smallexample
7851 If @code{-Walloca-larger-than=500} were passed, the above would trigger
7852 a warning, but this time because of the lack of bounds checking.
7854 Note, that even seemingly correct code involving signed integers could
7855 cause a warning:
7857 @smallexample
7858 void func (signed int n)
7860   if (n < 500)
7861     @{
7862       p = alloca (n);
7863       f (p);
7864     @}
7866 @end smallexample
7868 In the above example, @var{n} could be negative, causing a larger than
7869 expected argument to be implicitly cast into the @code{alloca} call.
7871 This option also warns when @code{alloca} is used in a loop.
7873 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
7874 but is usually only effective  when @option{-ftree-vrp} is active (default
7875 for @option{-O2} and above).
7877 See also @option{-Wvla-larger-than=}@samp{byte-size}.
7879 @item -Wno-alloca-larger-than
7880 @opindex Wno-alloca-larger-than
7881 Disable @option{-Walloca-larger-than=} warnings.  The option is
7882 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
7884 @item -Warith-conversion
7885 @opindex Warith-conversion
7886 @opindex Wno-arith-conversion
7887 Do warn about implicit conversions from arithmetic operations even
7888 when conversion of the operands to the same type cannot change their
7889 values.  This affects warnings from @option{-Wconversion},
7890 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
7892 @smallexample
7893 @group
7894 void f (char c, int i)
7896   c = c + i; // warns with @option{-Wconversion}
7897   c = c + 1; // only warns with @option{-Warith-conversion}
7899 @end group
7900 @end smallexample
7902 @item -Warray-bounds
7903 @itemx -Warray-bounds=@var{n}
7904 @opindex Wno-array-bounds
7905 @opindex Warray-bounds
7906 Warn about out of bounds subscripts or offsets into arrays.  This warning
7907 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
7908 is active (the default for @option{-O2} and above) but a subset of instances
7909 are issued even without optimization.
7911 @table @gcctabopt
7912 @item -Warray-bounds=1
7913 This is the default warning level of @option{-Warray-bounds} and is enabled
7914 by @option{-Wall}; higher levels are not, and must be explicitly requested.
7916 @item -Warray-bounds=2
7917 This warning level also warns about out of bounds accesses to trailing
7918 struct members of one-element array types (@pxref{Zero Length}) and about
7919 the intermediate results of pointer arithmetic that may yield out of bounds
7920 values.  This warning level may give a larger number of false positives and
7921 is deactivated by default.
7922 @end table
7924 @item -Warray-compare
7925 @opindex Warray-compare
7926 @opindex Wno-array-compare
7927 Warn about equality and relational comparisons between two operands of array
7928 type.  This comparison was deprecated in C++20.  For example:
7930 @smallexample
7931 int arr1[5];
7932 int arr2[5];
7933 bool same = arr1 == arr2;
7934 @end smallexample
7936 @option{-Warray-compare} is enabled by @option{-Wall}.
7938 @item -Warray-parameter
7939 @itemx -Warray-parameter=@var{n}
7940 @opindex Wno-array-parameter
7941 Warn about redeclarations of functions involving arguments of array or
7942 pointer types of inconsistent kinds or forms, and enable the detection
7943 of out-of-bounds accesses to such parameters by warnings such as
7944 @option{-Warray-bounds}.
7946 If the first function declaration uses the array form the bound specified
7947 in the array is assumed to be the minimum number of elements expected to
7948 be provided in calls to the function and the maximum number of elements
7949 accessed by it.  Failing to provide arguments of sufficient size or accessing
7950 more than the maximum number of elements may be diagnosed by warnings such
7951 as @option{-Warray-bounds}.  At level 1 the warning diagnoses inconsistencies
7952 involving array parameters declared using the @code{T[static N]} form.
7954 For example, the warning triggers for the following redeclarations because
7955 the first one allows an array of any size to be passed to @code{f} while
7956 the second one with the keyword @code{static} specifies that the array
7957 argument must have at least four elements.
7959 @smallexample
7960 void f (int[static 4]);
7961 void f (int[]);           // warning (inconsistent array form)
7963 void g (void)
7965   int *p = (int *)malloc (4);
7966   f (p);                  // warning (array too small)
7967   @dots{}
7969 @end smallexample
7971 At level 2 the warning also triggers for redeclarations involving any other
7972 inconsistency in array or pointer argument forms denoting array sizes.
7973 Pointers and arrays of unspecified bound are considered equivalent and do
7974 not trigger a warning.
7976 @smallexample
7977 void g (int*);
7978 void g (int[]);     // no warning
7979 void g (int[8]);    // warning (inconsistent array bound)
7980 @end smallexample
7982 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
7983 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
7984 involving Variable Length Array arguments.
7986 @item -Wattribute-alias=@var{n}
7987 @itemx -Wno-attribute-alias
7988 @opindex Wattribute-alias
7989 @opindex Wno-attribute-alias
7990 Warn about declarations using the @code{alias} and similar attributes whose
7991 target is incompatible with the type of the alias.
7992 @xref{Function Attributes,,Declaring Attributes of Functions}.
7994 @table @gcctabopt
7995 @item -Wattribute-alias=1
7996 The default warning level of the @option{-Wattribute-alias} option diagnoses
7997 incompatibilities between the type of the alias declaration and that of its
7998 target.  Such incompatibilities are typically indicative of bugs.
8000 @item -Wattribute-alias=2
8002 At this level @option{-Wattribute-alias} also diagnoses cases where
8003 the attributes of the alias declaration are more restrictive than the
8004 attributes applied to its target.  These mismatches can potentially
8005 result in incorrect code generation.  In other cases they may be
8006 benign and could be resolved simply by adding the missing attribute to
8007 the target.  For comparison, see the @option{-Wmissing-attributes}
8008 option, which controls diagnostics when the alias declaration is less
8009 restrictive than the target, rather than more restrictive.
8011 Attributes considered include @code{alloc_align}, @code{alloc_size},
8012 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8013 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8014 @code{returns_nonnull}, and @code{returns_twice}.
8015 @end table
8017 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8018 This is the default.  You can disable these warnings with either
8019 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8021 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8022 @opindex Wbidi-chars=
8023 @opindex Wbidi-chars
8024 @opindex Wno-bidi-chars
8025 Warn about possibly misleading UTF-8 bidirectional control characters in
8026 comments, string literals, character constants, and identifiers.  Such
8027 characters can change left-to-right writing direction into right-to-left
8028 (and vice versa), which can cause confusion between the logical order and
8029 visual order.  This may be dangerous; for instance, it may seem that a piece
8030 of code is not commented out, whereas it in fact is.
8032 There are three levels of warning supported by GCC@.  The default is
8033 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8034 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8035 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8036 characters.
8038 By default, this warning does not warn about UCNs.  It is, however, possible
8039 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8040 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8041 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8042 @option{-Wbidi-chars=any} was specified.
8044 @item -Wbool-compare
8045 @opindex Wno-bool-compare
8046 @opindex Wbool-compare
8047 Warn about boolean expression compared with an integer value different from
8048 @code{true}/@code{false}.  For instance, the following comparison is
8049 always false:
8050 @smallexample
8051 int n = 5;
8052 @dots{}
8053 if ((n > 1) == 2) @{ @dots{} @}
8054 @end smallexample
8055 This warning is enabled by @option{-Wall}.
8057 @item -Wbool-operation
8058 @opindex Wno-bool-operation
8059 @opindex Wbool-operation
8060 Warn about suspicious operations on expressions of a boolean type.  For
8061 instance, bitwise negation of a boolean is very likely a bug in the program.
8062 For C, this warning also warns about incrementing or decrementing a boolean,
8063 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8064 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8066 This warning is enabled by @option{-Wall}.
8068 @item -Wduplicated-branches
8069 @opindex Wno-duplicated-branches
8070 @opindex Wduplicated-branches
8071 Warn when an if-else has identical branches.  This warning detects cases like
8072 @smallexample
8073 if (p != NULL)
8074   return 0;
8075 else
8076   return 0;
8077 @end smallexample
8078 It doesn't warn when both branches contain just a null statement.  This warning
8079 also warn for conditional operators:
8080 @smallexample
8081   int i = x ? *p : *p;
8082 @end smallexample
8084 @item -Wduplicated-cond
8085 @opindex Wno-duplicated-cond
8086 @opindex Wduplicated-cond
8087 Warn about duplicated conditions in an if-else-if chain.  For instance,
8088 warn for the following code:
8089 @smallexample
8090 if (p->q != NULL) @{ @dots{} @}
8091 else if (p->q != NULL) @{ @dots{} @}
8092 @end smallexample
8094 @item -Wframe-address
8095 @opindex Wno-frame-address
8096 @opindex Wframe-address
8097 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8098 is called with an argument greater than 0.  Such calls may return indeterminate
8099 values or crash the program.  The warning is included in @option{-Wall}.
8101 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8102 @opindex Wno-discarded-qualifiers
8103 @opindex Wdiscarded-qualifiers
8104 Do not warn if type qualifiers on pointers are being discarded.
8105 Typically, the compiler warns if a @code{const char *} variable is
8106 passed to a function that takes a @code{char *} parameter.  This option
8107 can be used to suppress such a warning.
8109 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8110 @opindex Wno-discarded-array-qualifiers
8111 @opindex Wdiscarded-array-qualifiers
8112 Do not warn if type qualifiers on arrays which are pointer targets
8113 are being discarded.  Typically, the compiler warns if a
8114 @code{const int (*)[]} variable is passed to a function that
8115 takes a @code{int (*)[]} parameter.  This option can be used to
8116 suppress such a warning.
8118 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8119 @opindex Wno-incompatible-pointer-types
8120 @opindex Wincompatible-pointer-types
8121 Do not warn when there is a conversion between pointers that have incompatible
8122 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8123 which warns for pointer argument passing or assignment with different
8124 signedness.
8126 @item -Wno-int-conversion @r{(C and Objective-C only)}
8127 @opindex Wno-int-conversion
8128 @opindex Wint-conversion
8129 Do not warn about incompatible integer to pointer and pointer to integer
8130 conversions.  This warning is about implicit conversions; for explicit
8131 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8132 @option{-Wno-pointer-to-int-cast} may be used.
8134 @item -Wzero-length-bounds
8135 @opindex Wzero-length-bounds
8136 @opindex Wzero-length-bounds
8137 Warn about accesses to elements of zero-length array members that might
8138 overlap other members of the same object.  Declaring interior zero-length
8139 arrays is discouraged because accesses to them are undefined.  See
8140 @xref{Zero Length}.
8142 For example, the first two stores in function @code{bad} are diagnosed
8143 because the array elements overlap the subsequent members @code{b} and
8144 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8145 because it is beyond the bounds of the enclosing object.
8147 @smallexample
8148 struct X @{ int a[0]; int b, c; @};
8149 struct X x;
8151 void bad (void)
8153   x.a[0] = 0;   // -Wzero-length-bounds
8154   x.a[1] = 1;   // -Wzero-length-bounds
8155   x.a[2] = 2;   // -Warray-bounds
8157 @end smallexample
8159 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8161 @item -Wno-div-by-zero
8162 @opindex Wno-div-by-zero
8163 @opindex Wdiv-by-zero
8164 Do not warn about compile-time integer division by zero.  Floating-point
8165 division by zero is not warned about, as it can be a legitimate way of
8166 obtaining infinities and NaNs.
8168 @item -Wsystem-headers
8169 @opindex Wsystem-headers
8170 @opindex Wno-system-headers
8171 @cindex warnings from system headers
8172 @cindex system headers, warnings from
8173 Print warning messages for constructs found in system header files.
8174 Warnings from system headers are normally suppressed, on the assumption
8175 that they usually do not indicate real problems and would only make the
8176 compiler output harder to read.  Using this command-line option tells
8177 GCC to emit warnings from system headers as if they occurred in user
8178 code.  However, note that using @option{-Wall} in conjunction with this
8179 option does @emph{not} warn about unknown pragmas in system
8180 headers---for that, @option{-Wunknown-pragmas} must also be used.
8182 @item -Wtautological-compare
8183 @opindex Wtautological-compare
8184 @opindex Wno-tautological-compare
8185 Warn if a self-comparison always evaluates to true or false.  This
8186 warning detects various mistakes such as:
8187 @smallexample
8188 int i = 1;
8189 @dots{}
8190 if (i > i) @{ @dots{} @}
8191 @end smallexample
8193 This warning also warns about bitwise comparisons that always evaluate
8194 to true or false, for instance:
8195 @smallexample
8196 if ((a & 16) == 10) @{ @dots{} @}
8197 @end smallexample
8198 will always be false.
8200 This warning is enabled by @option{-Wall}.
8202 @item -Wtrampolines
8203 @opindex Wtrampolines
8204 @opindex Wno-trampolines
8205 Warn about trampolines generated for pointers to nested functions.
8206 A trampoline is a small piece of data or code that is created at run
8207 time on the stack when the address of a nested function is taken, and is
8208 used to call the nested function indirectly.  For some targets, it is
8209 made up of data only and thus requires no special treatment.  But, for
8210 most targets, it is made up of code and thus requires the stack to be
8211 made executable in order for the program to work properly.
8213 @item -Wfloat-equal
8214 @opindex Wfloat-equal
8215 @opindex Wno-float-equal
8216 Warn if floating-point values are used in equality comparisons.
8218 The idea behind this is that sometimes it is convenient (for the
8219 programmer) to consider floating-point values as approximations to
8220 infinitely precise real numbers.  If you are doing this, then you need
8221 to compute (by analyzing the code, or in some other way) the maximum or
8222 likely maximum error that the computation introduces, and allow for it
8223 when performing comparisons (and when producing output, but that's a
8224 different problem).  In particular, instead of testing for equality, you
8225 should check to see whether the two values have ranges that overlap; and
8226 this is done with the relational operators, so equality comparisons are
8227 probably mistaken.
8229 @item -Wtraditional @r{(C and Objective-C only)}
8230 @opindex Wtraditional
8231 @opindex Wno-traditional
8232 Warn about certain constructs that behave differently in traditional and
8233 ISO C@.  Also warn about ISO C constructs that have no traditional C
8234 equivalent, and/or problematic constructs that should be avoided.
8236 @itemize @bullet
8237 @item
8238 Macro parameters that appear within string literals in the macro body.
8239 In traditional C macro replacement takes place within string literals,
8240 but in ISO C it does not.
8242 @item
8243 In traditional C, some preprocessor directives did not exist.
8244 Traditional preprocessors only considered a line to be a directive
8245 if the @samp{#} appeared in column 1 on the line.  Therefore
8246 @option{-Wtraditional} warns about directives that traditional C
8247 understands but ignores because the @samp{#} does not appear as the
8248 first character on the line.  It also suggests you hide directives like
8249 @code{#pragma} not understood by traditional C by indenting them.  Some
8250 traditional implementations do not recognize @code{#elif}, so this option
8251 suggests avoiding it altogether.
8253 @item
8254 A function-like macro that appears without arguments.
8256 @item
8257 The unary plus operator.
8259 @item
8260 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8261 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8262 constants.)  Note, these suffixes appear in macros defined in the system
8263 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8264 Use of these macros in user code might normally lead to spurious
8265 warnings, however GCC's integrated preprocessor has enough context to
8266 avoid warning in these cases.
8268 @item
8269 A function declared external in one block and then used after the end of
8270 the block.
8272 @item
8273 A @code{switch} statement has an operand of type @code{long}.
8275 @item
8276 A non-@code{static} function declaration follows a @code{static} one.
8277 This construct is not accepted by some traditional C compilers.
8279 @item
8280 The ISO type of an integer constant has a different width or
8281 signedness from its traditional type.  This warning is only issued if
8282 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8283 typically represent bit patterns, are not warned about.
8285 @item
8286 Usage of ISO string concatenation is detected.
8288 @item
8289 Initialization of automatic aggregates.
8291 @item
8292 Identifier conflicts with labels.  Traditional C lacks a separate
8293 namespace for labels.
8295 @item
8296 Initialization of unions.  If the initializer is zero, the warning is
8297 omitted.  This is done under the assumption that the zero initializer in
8298 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8299 initializer warnings and relies on default initialization to zero in the
8300 traditional C case.
8302 @item
8303 Conversions by prototypes between fixed/floating-point values and vice
8304 versa.  The absence of these prototypes when compiling with traditional
8305 C causes serious problems.  This is a subset of the possible
8306 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8308 @item
8309 Use of ISO C style function definitions.  This warning intentionally is
8310 @emph{not} issued for prototype declarations or variadic functions
8311 because these ISO C features appear in your code when using
8312 libiberty's traditional C compatibility macros, @code{PARAMS} and
8313 @code{VPARAMS}.  This warning is also bypassed for nested functions
8314 because that feature is already a GCC extension and thus not relevant to
8315 traditional C compatibility.
8316 @end itemize
8318 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8319 @opindex Wtraditional-conversion
8320 @opindex Wno-traditional-conversion
8321 Warn if a prototype causes a type conversion that is different from what
8322 would happen to the same argument in the absence of a prototype.  This
8323 includes conversions of fixed point to floating and vice versa, and
8324 conversions changing the width or signedness of a fixed-point argument
8325 except when the same as the default promotion.
8327 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8328 @opindex Wdeclaration-after-statement
8329 @opindex Wno-declaration-after-statement
8330 Warn when a declaration is found after a statement in a block.  This
8331 construct, known from C++, was introduced with ISO C99 and is by default
8332 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8334 @item -Wshadow
8335 @opindex Wshadow
8336 @opindex Wno-shadow
8337 Warn whenever a local variable or type declaration shadows another
8338 variable, parameter, type, class member (in C++), or instance variable
8339 (in Objective-C) or whenever a built-in function is shadowed.  Note
8340 that in C++, the compiler warns if a local variable shadows an
8341 explicit typedef, but not if it shadows a struct/class/enum.
8342 If this warning is enabled, it includes also all instances of
8343 local shadowing.  This means that @option{-Wno-shadow=local}
8344 and @option{-Wno-shadow=compatible-local} are ignored when
8345 @option{-Wshadow} is used.
8346 Same as @option{-Wshadow=global}.
8348 @item -Wno-shadow-ivar @r{(Objective-C only)}
8349 @opindex Wno-shadow-ivar
8350 @opindex Wshadow-ivar
8351 Do not warn whenever a local variable shadows an instance variable in an
8352 Objective-C method.
8354 @item -Wshadow=global
8355 @opindex Wshadow=global
8356 Warn for any shadowing.
8357 Same as @option{-Wshadow}.
8359 @item -Wshadow=local
8360 @opindex Wshadow=local
8361 Warn when a local variable shadows another local variable or parameter.
8363 @item -Wshadow=compatible-local
8364 @opindex Wshadow=compatible-local
8365 Warn when a local variable shadows another local variable or parameter
8366 whose type is compatible with that of the shadowing variable.  In C++,
8367 type compatibility here means the type of the shadowing variable can be
8368 converted to that of the shadowed variable.  The creation of this flag
8369 (in addition to @option{-Wshadow=local}) is based on the idea that when
8370 a local variable shadows another one of incompatible type, it is most
8371 likely intentional, not a bug or typo, as shown in the following example:
8373 @smallexample
8374 @group
8375 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8377   for (int i = 0; i < N; ++i)
8378   @{
8379     ...
8380   @}
8381   ...
8383 @end group
8384 @end smallexample
8386 Since the two variable @code{i} in the example above have incompatible types,
8387 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8388 Because their types are incompatible, if a programmer accidentally uses one
8389 in place of the other, type checking is expected to catch that and emit an
8390 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
8391 possibly reduce the number of warnings triggered by intentional shadowing.
8392 Note that this also means that shadowing @code{const char *i} by
8393 @code{char *i} does not emit a warning.
8395 This warning is also enabled by @option{-Wshadow=local}.
8397 @item -Wlarger-than=@var{byte-size}
8398 @opindex Wlarger-than=
8399 @opindex Wlarger-than-@var{byte-size}
8400 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8401 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8402 Warnings controlled by the option can be disabled either by specifying
8403 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8405 Also warn for calls to bounded functions such as @code{memchr} or
8406 @code{strnlen} that specify a bound greater than the largest possible
8407 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
8408 can only be disabled by @option{-Wno-larger-than}.
8410 @item -Wno-larger-than
8411 @opindex Wno-larger-than
8412 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
8413 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8415 @item -Wframe-larger-than=@var{byte-size}
8416 @opindex Wframe-larger-than=
8417 @opindex Wno-frame-larger-than
8418 Warn if the size of a function frame exceeds @var{byte-size}.
8419 The computation done to determine the stack frame size is approximate
8420 and not conservative.
8421 The actual requirements may be somewhat greater than @var{byte-size}
8422 even if you do not get a warning.  In addition, any space allocated
8423 via @code{alloca}, variable-length arrays, or related constructs
8424 is not included by the compiler when determining
8425 whether or not to issue a warning.
8426 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8427 Warnings controlled by the option can be disabled either by specifying
8428 @var{byte-size} of @samp{SIZE_MAX} or more or by
8429 @option{-Wno-frame-larger-than}.
8431 @item -Wno-frame-larger-than
8432 @opindex Wno-frame-larger-than
8433 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
8434 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8436 @item -Wfree-nonheap-object
8437 @opindex Wfree-nonheap-object
8438 @opindex Wno-free-nonheap-object
8439 Warn when attempting to deallocate an object that was either not allocated
8440 on the heap, or by using a pointer that was not returned from a prior call
8441 to the corresponding allocation function.  For example, because the call
8442 to @code{stpcpy} returns a pointer to the terminating nul character and
8443 not to the beginning of the object, the call to @code{free} below is
8444 diagnosed.
8446 @smallexample
8447 void f (char *p)
8449   p = stpcpy (p, "abc");
8450   // ...
8451   free (p);   // warning
8453 @end smallexample
8455 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8457 @item -Wstack-usage=@var{byte-size}
8458 @opindex Wstack-usage
8459 @opindex Wno-stack-usage
8460 Warn if the stack usage of a function might exceed @var{byte-size}.
8461 The computation done to determine the stack usage is conservative.
8462 Any space allocated via @code{alloca}, variable-length arrays, or related
8463 constructs is included by the compiler when determining whether or not to
8464 issue a warning.
8466 The message is in keeping with the output of @option{-fstack-usage}.
8468 @itemize
8469 @item
8470 If the stack usage is fully static but exceeds the specified amount, it's:
8472 @smallexample
8473   warning: stack usage is 1120 bytes
8474 @end smallexample
8475 @item
8476 If the stack usage is (partly) dynamic but bounded, it's:
8478 @smallexample
8479   warning: stack usage might be 1648 bytes
8480 @end smallexample
8481 @item
8482 If the stack usage is (partly) dynamic and not bounded, it's:
8484 @smallexample
8485   warning: stack usage might be unbounded
8486 @end smallexample
8487 @end itemize
8489 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8490 Warnings controlled by the option can be disabled either by specifying
8491 @var{byte-size} of @samp{SIZE_MAX} or more or by
8492 @option{-Wno-stack-usage}.
8494 @item -Wno-stack-usage
8495 @opindex Wno-stack-usage
8496 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
8497 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8499 @item -Wunsafe-loop-optimizations
8500 @opindex Wunsafe-loop-optimizations
8501 @opindex Wno-unsafe-loop-optimizations
8502 Warn if the loop cannot be optimized because the compiler cannot
8503 assume anything on the bounds of the loop indices.  With
8504 @option{-funsafe-loop-optimizations} warn if the compiler makes
8505 such assumptions.
8507 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8508 @opindex Wno-pedantic-ms-format
8509 @opindex Wpedantic-ms-format
8510 When used in combination with @option{-Wformat}
8511 and @option{-pedantic} without GNU extensions, this option
8512 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8513 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8514 which depend on the MS runtime.
8516 @item -Wpointer-arith
8517 @opindex Wpointer-arith
8518 @opindex Wno-pointer-arith
8519 Warn about anything that depends on the ``size of'' a function type or
8520 of @code{void}.  GNU C assigns these types a size of 1, for
8521 convenience in calculations with @code{void *} pointers and pointers
8522 to functions.  In C++, warn also when an arithmetic operation involves
8523 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
8525 @item -Wno-pointer-compare
8526 @opindex Wpointer-compare
8527 @opindex Wno-pointer-compare
8528 Do not warn if a pointer is compared with a zero character constant.
8529 This usually
8530 means that the pointer was meant to be dereferenced.  For example:
8532 @smallexample
8533 const char *p = foo ();
8534 if (p == '\0')
8535   return 42;
8536 @end smallexample
8538 Note that the code above is invalid in C++11.
8540 This warning is enabled by default.
8542 @item -Wtsan
8543 @opindex Wtsan
8544 @opindex Wno-tsan
8545 Warn about unsupported features in ThreadSanitizer.
8547 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8548 can report false positives.
8550 This warning is enabled by default.
8552 @item -Wtype-limits
8553 @opindex Wtype-limits
8554 @opindex Wno-type-limits
8555 Warn if a comparison is always true or always false due to the limited
8556 range of the data type, but do not warn for constant expressions.  For
8557 example, warn if an unsigned variable is compared against zero with
8558 @code{<} or @code{>=}.  This warning is also enabled by
8559 @option{-Wextra}.
8561 @item -Wabsolute-value @r{(C and Objective-C only)}
8562 @opindex Wabsolute-value
8563 @opindex Wno-absolute-value
8564 Warn for calls to standard functions that compute the absolute value
8565 of an argument when a more appropriate standard function is available.
8566 For example, calling @code{abs(3.14)} triggers the warning because the
8567 appropriate function to call to compute the absolute value of a double
8568 argument is @code{fabs}.  The option also triggers warnings when the
8569 argument in a call to such a function has an unsigned type.  This
8570 warning can be suppressed with an explicit type cast and it is also
8571 enabled by @option{-Wextra}.
8573 @include cppwarnopts.texi
8575 @item -Wbad-function-cast @r{(C and Objective-C only)}
8576 @opindex Wbad-function-cast
8577 @opindex Wno-bad-function-cast
8578 Warn when a function call is cast to a non-matching type.
8579 For example, warn if a call to a function returning an integer type 
8580 is cast to a pointer type.
8582 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8583 @opindex Wc90-c99-compat
8584 @opindex Wno-c90-c99-compat
8585 Warn about features not present in ISO C90, but present in ISO C99.
8586 For instance, warn about use of variable length arrays, @code{long long}
8587 type, @code{bool} type, compound literals, designated initializers, and so
8588 on.  This option is independent of the standards mode.  Warnings are disabled
8589 in the expression that follows @code{__extension__}.
8591 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8592 @opindex Wc99-c11-compat
8593 @opindex Wno-c99-c11-compat
8594 Warn about features not present in ISO C99, but present in ISO C11.
8595 For instance, warn about use of anonymous structures and unions,
8596 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8597 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8598 and so on.  This option is independent of the standards mode.  Warnings are
8599 disabled in the expression that follows @code{__extension__}.
8601 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8602 @opindex Wc11-c2x-compat
8603 @opindex Wno-c11-c2x-compat
8604 Warn about features not present in ISO C11, but present in ISO C2X.
8605 For instance, warn about omitting the string in @code{_Static_assert},
8606 use of @samp{[[]]} syntax for attributes, use of decimal
8607 floating-point types, and so on.  This option is independent of the
8608 standards mode.  Warnings are disabled in the expression that follows
8609 @code{__extension__}.
8611 @item -Wc++-compat @r{(C and Objective-C only)}
8612 @opindex Wc++-compat
8613 @opindex Wno-c++-compat
8614 Warn about ISO C constructs that are outside of the common subset of
8615 ISO C and ISO C++, e.g.@: request for implicit conversion from
8616 @code{void *} to a pointer to non-@code{void} type.
8618 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8619 @opindex Wc++11-compat
8620 @opindex Wno-c++11-compat
8621 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8622 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8623 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
8624 enabled by @option{-Wall}.
8626 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8627 @opindex Wc++14-compat
8628 @opindex Wno-c++14-compat
8629 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8630 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
8632 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8633 @opindex Wc++17-compat
8634 @opindex Wno-c++17-compat
8635 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8636 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
8638 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8639 @opindex Wc++20-compat
8640 @opindex Wno-c++20-compat
8641 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8642 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
8644 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8645 @opindex Wc++11-extensions
8646 @opindex Wno-c++11-extensions
8647 Do not warn about C++11 constructs in code being compiled using
8648 an older C++ standard.  Even without this option, some C++11 constructs
8649 will only be diagnosed if @option{-Wpedantic} is used.
8651 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8652 @opindex Wc++14-extensions
8653 @opindex Wno-c++14-extensions
8654 Do not warn about C++14 constructs in code being compiled using
8655 an older C++ standard.  Even without this option, some C++14 constructs
8656 will only be diagnosed if @option{-Wpedantic} is used.
8658 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8659 @opindex Wc++17-extensions
8660 @opindex Wno-c++17-extensions
8661 Do not warn about C++17 constructs in code being compiled using
8662 an older C++ standard.  Even without this option, some C++17 constructs
8663 will only be diagnosed if @option{-Wpedantic} is used.
8665 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8666 @opindex Wc++20-extensions
8667 @opindex Wno-c++20-extensions
8668 Do not warn about C++20 constructs in code being compiled using
8669 an older C++ standard.  Even without this option, some C++20 constructs
8670 will only be diagnosed if @option{-Wpedantic} is used.
8672 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8673 @opindex Wc++23-extensions
8674 @opindex Wno-c++23-extensions
8675 Do not warn about C++23 constructs in code being compiled using
8676 an older C++ standard.  Even without this option, some C++23 constructs
8677 will only be diagnosed if @option{-Wpedantic} is used.
8679 @item -Wcast-qual
8680 @opindex Wcast-qual
8681 @opindex Wno-cast-qual
8682 Warn whenever a pointer is cast so as to remove a type qualifier from
8683 the target type.  For example, warn if a @code{const char *} is cast
8684 to an ordinary @code{char *}.
8686 Also warn when making a cast that introduces a type qualifier in an
8687 unsafe way.  For example, casting @code{char **} to @code{const char **}
8688 is unsafe, as in this example:
8690 @smallexample
8691   /* p is char ** value.  */
8692   const char **q = (const char **) p;
8693   /* Assignment of readonly string to const char * is OK.  */
8694   *q = "string";
8695   /* Now char** pointer points to read-only memory.  */
8696   **p = 'b';
8697 @end smallexample
8699 @item -Wcast-align
8700 @opindex Wcast-align
8701 @opindex Wno-cast-align
8702 Warn whenever a pointer is cast such that the required alignment of the
8703 target is increased.  For example, warn if a @code{char *} is cast to
8704 an @code{int *} on machines where integers can only be accessed at
8705 two- or four-byte boundaries.
8707 @item -Wcast-align=strict
8708 @opindex Wcast-align=strict
8709 Warn whenever a pointer is cast such that the required alignment of the
8710 target is increased.  For example, warn if a @code{char *} is cast to
8711 an @code{int *} regardless of the target machine.
8713 @item -Wcast-function-type
8714 @opindex Wcast-function-type
8715 @opindex Wno-cast-function-type
8716 Warn when a function pointer is cast to an incompatible function pointer.
8717 In a cast involving function types with a variable argument list only
8718 the types of initial arguments that are provided are considered.
8719 Any parameter of pointer-type matches any other pointer-type.  Any benign
8720 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8721 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
8722 type @code{void (*) (void)} is special and matches everything, which can
8723 be used to suppress this warning.
8724 In a cast involving pointer to member types this warning warns whenever
8725 the type cast is changing the pointer to member type.
8726 This warning is enabled by @option{-Wextra}.
8728 @item -Wwrite-strings
8729 @opindex Wwrite-strings
8730 @opindex Wno-write-strings
8731 When compiling C, give string constants the type @code{const
8732 char[@var{length}]} so that copying the address of one into a
8733 non-@code{const} @code{char *} pointer produces a warning.  These
8734 warnings help you find at compile time code that can try to write
8735 into a string constant, but only if you have been very careful about
8736 using @code{const} in declarations and prototypes.  Otherwise, it is
8737 just a nuisance. This is why we did not make @option{-Wall} request
8738 these warnings.
8740 When compiling C++, warn about the deprecated conversion from string
8741 literals to @code{char *}.  This warning is enabled by default for C++
8742 programs.
8744 @item -Wclobbered
8745 @opindex Wclobbered
8746 @opindex Wno-clobbered
8747 Warn for variables that might be changed by @code{longjmp} or
8748 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
8750 @item -Wconversion
8751 @opindex Wconversion
8752 @opindex Wno-conversion
8753 Warn for implicit conversions that may alter a value. This includes
8754 conversions between real and integer, like @code{abs (x)} when
8755 @code{x} is @code{double}; conversions between signed and unsigned,
8756 like @code{unsigned ui = -1}; and conversions to smaller types, like
8757 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8758 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8759 changed by the conversion like in @code{abs (2.0)}.  Warnings about
8760 conversions between signed and unsigned integers can be disabled by
8761 using @option{-Wno-sign-conversion}.
8763 For C++, also warn for confusing overload resolution for user-defined
8764 conversions; and conversions that never use a type conversion
8765 operator: conversions to @code{void}, the same type, a base class or a
8766 reference to them. Warnings about conversions between signed and
8767 unsigned integers are disabled by default in C++ unless
8768 @option{-Wsign-conversion} is explicitly enabled.
8770 Warnings about conversion from arithmetic on a small type back to that
8771 type are only given with @option{-Warith-conversion}.
8773 @item -Wdangling-else
8774 @opindex Wdangling-else
8775 @opindex Wno-dangling-else
8776 Warn about constructions where there may be confusion to which
8777 @code{if} statement an @code{else} branch belongs.  Here is an example of
8778 such a case:
8780 @smallexample
8781 @group
8783   if (a)
8784     if (b)
8785       foo ();
8786   else
8787     bar ();
8789 @end group
8790 @end smallexample
8792 In C/C++, every @code{else} branch belongs to the innermost possible
8793 @code{if} statement, which in this example is @code{if (b)}.  This is
8794 often not what the programmer expected, as illustrated in the above
8795 example by indentation the programmer chose.  When there is the
8796 potential for this confusion, GCC issues a warning when this flag
8797 is specified.  To eliminate the warning, add explicit braces around
8798 the innermost @code{if} statement so there is no way the @code{else}
8799 can belong to the enclosing @code{if}.  The resulting code
8800 looks like this:
8802 @smallexample
8803 @group
8805   if (a)
8806     @{
8807       if (b)
8808         foo ();
8809       else
8810         bar ();
8811     @}
8813 @end group
8814 @end smallexample
8816 This warning is enabled by @option{-Wparentheses}.
8818 @item -Wdangling-pointer
8819 @itemx -Wdangling-pointer=@var{n}
8820 @opindex Wdangling-pointer
8821 @opindex Wno-dangling-pointer
8822 Warn about uses of pointers (or C++ references) to objects with automatic
8823 storage duration after their lifetime has ended.  This includes local
8824 variables declared in nested blocks, compound literals and other unnamed
8825 temporary objects.  In addition, warn about storing the address of such
8826 objects in escaped pointers.  The warning is enabled at all optimization
8827 levels but may yield different results with optimization than without.
8829 @table @gcctabopt
8830 @item -Wdangling-pointer=1
8831 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
8832 For example
8833 @smallexample
8834 int f (int c1, int c2, x)
8836   char *p = strchr ((char[])@{ c1, c2 @}, c3);
8837   return p ? *p : 'x';   // warning: dangling pointer to a compound literal
8839 @end smallexample
8840 In the following function the store of the address of the local variable
8841 @code{x} in the escaped pointer @code{*p} also triggers the warning.
8842 @smallexample
8843 void g (int **p)
8845   int x = 7;
8846   *p = &x;   // warning: storing the address of a local variable in *p
8848 @end smallexample
8850 @item -Wdangling-pointer=2
8851 At level 2, in addition to unconditional uses the warning also diagnoses
8852 conditional uses of dangling pointers.
8854 For example, because the array @var{a} in the following function is out of
8855 scope when the pointer @var{s} that was set to point is used, the warning
8856 triggers at this level.
8858 @smallexample
8859 void f (char *s)
8861   if (!s)
8862     @{
8863       char a[12] = "tmpname";
8864       s = a;
8865     @}
8866   strcat (s, ".tmp");   // warning: dangling pointer to a may be used
8867   ...
8869 @end smallexample
8870 @end table
8872 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
8874 @item -Wdate-time
8875 @opindex Wdate-time
8876 @opindex Wno-date-time
8877 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
8878 are encountered as they might prevent bit-wise-identical reproducible
8879 compilations.
8881 @item -Wempty-body
8882 @opindex Wempty-body
8883 @opindex Wno-empty-body
8884 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
8885 while} statement.  This warning is also enabled by @option{-Wextra}.
8887 @item -Wno-endif-labels
8888 @opindex Wendif-labels
8889 @opindex Wno-endif-labels
8890 Do not warn about stray tokens after @code{#else} and @code{#endif}.
8892 @item -Wenum-compare
8893 @opindex Wenum-compare
8894 @opindex Wno-enum-compare
8895 Warn about a comparison between values of different enumerated types.
8896 In C++ enumerated type mismatches in conditional expressions are also
8897 diagnosed and the warning is enabled by default.  In C this warning is 
8898 enabled by @option{-Wall}.
8900 @item -Wenum-conversion
8901 @opindex Wenum-conversion
8902 @opindex Wno-enum-conversion
8903 Warn when a value of enumerated type is implicitly converted to a 
8904 different enumerated type.  This warning is enabled by @option{-Wextra}
8905 in C@.
8907 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
8908 @opindex Wenum-int-mismatch
8909 @opindex Wno-enum-int-mismatch
8910 Warn about mismatches between an enumerated type and an integer type in
8911 declarations.  For example:
8913 @smallexample
8914 enum E @{ l = -1, z = 0, g = 1 @};
8915 int foo(void);
8916 enum E foo(void);
8917 @end smallexample
8919 In C, an enumerated type is compatible with @code{char}, a signed
8920 integer type, or an unsigned integer type.  However, since the choice
8921 of the underlying type of an enumerated type is implementation-defined,
8922 such mismatches may cause portability issues.  In C++, such mismatches
8923 are an error.  In C, this warning is enabled by @option{-Wall} and
8924 @option{-Wc++-compat}.
8926 @item -Wjump-misses-init @r{(C, Objective-C only)}
8927 @opindex Wjump-misses-init
8928 @opindex Wno-jump-misses-init
8929 Warn if a @code{goto} statement or a @code{switch} statement jumps
8930 forward across the initialization of a variable, or jumps backward to a
8931 label after the variable has been initialized.  This only warns about
8932 variables that are initialized when they are declared.  This warning is
8933 only supported for C and Objective-C; in C++ this sort of branch is an
8934 error in any case.
8936 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
8937 can be disabled with the @option{-Wno-jump-misses-init} option.
8939 @item -Wsign-compare
8940 @opindex Wsign-compare
8941 @opindex Wno-sign-compare
8942 @cindex warning for comparison of signed and unsigned values
8943 @cindex comparison of signed and unsigned values, warning
8944 @cindex signed and unsigned values, comparison warning
8945 Warn when a comparison between signed and unsigned values could produce
8946 an incorrect result when the signed value is converted to unsigned.
8947 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
8948 also enabled by @option{-Wextra}.
8950 @item -Wsign-conversion
8951 @opindex Wsign-conversion
8952 @opindex Wno-sign-conversion
8953 Warn for implicit conversions that may change the sign of an integer
8954 value, like assigning a signed integer expression to an unsigned
8955 integer variable. An explicit cast silences the warning. In C, this
8956 option is enabled also by @option{-Wconversion}.
8958 @item -Wfloat-conversion
8959 @opindex Wfloat-conversion
8960 @opindex Wno-float-conversion
8961 Warn for implicit conversions that reduce the precision of a real value.
8962 This includes conversions from real to integer, and from higher precision
8963 real to lower precision real values.  This option is also enabled by
8964 @option{-Wconversion}.
8966 @item -Wno-scalar-storage-order
8967 @opindex Wno-scalar-storage-order
8968 @opindex Wscalar-storage-order
8969 Do not warn on suspicious constructs involving reverse scalar storage order.
8971 @item -Wsizeof-array-div
8972 @opindex Wsizeof-array-div
8973 @opindex Wno-sizeof-array-div
8974 Warn about divisions of two sizeof operators when the first one is applied
8975 to an array and the divisor does not equal the size of the array element.
8976 In such a case, the computation will not yield the number of elements in the
8977 array, which is likely what the user intended.  This warning warns e.g. about
8978 @smallexample
8979 int fn ()
8981   int arr[10];
8982   return sizeof (arr) / sizeof (short);
8984 @end smallexample
8986 This warning is enabled by @option{-Wall}.
8988 @item -Wsizeof-pointer-div
8989 @opindex Wsizeof-pointer-div
8990 @opindex Wno-sizeof-pointer-div
8991 Warn for suspicious divisions of two sizeof expressions that divide
8992 the pointer size by the element size, which is the usual way to compute
8993 the array size but won't work out correctly with pointers.  This warning
8994 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
8995 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
8997 @item -Wsizeof-pointer-memaccess
8998 @opindex Wsizeof-pointer-memaccess
8999 @opindex Wno-sizeof-pointer-memaccess
9000 Warn for suspicious length parameters to certain string and memory built-in
9001 functions if the argument uses @code{sizeof}.  This warning triggers for
9002 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9003 an array, but a pointer, and suggests a possible fix, or about
9004 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9005 also warns about calls to bounded string copy functions like @code{strncat}
9006 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9007 the source array.  For example, in the following function the call to
9008 @code{strncat} specifies the size of the source string as the bound.  That
9009 is almost certainly a mistake and so the call is diagnosed.
9010 @smallexample
9011 void make_file (const char *name)
9013   char path[PATH_MAX];
9014   strncpy (path, name, sizeof path - 1);
9015   strncat (path, ".text", sizeof ".text");
9016   @dots{}
9018 @end smallexample
9020 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9022 @item -Wno-sizeof-array-argument
9023 @opindex Wsizeof-array-argument
9024 @opindex Wno-sizeof-array-argument
9025 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9026 declared as an array in a function definition.  This warning is enabled by
9027 default for C and C++ programs.
9029 @item -Wmemset-elt-size
9030 @opindex Wmemset-elt-size
9031 @opindex Wno-memset-elt-size
9032 Warn for suspicious calls to the @code{memset} built-in function, if the
9033 first argument references an array, and the third argument is a number
9034 equal to the number of elements, but not equal to the size of the array
9035 in memory.  This indicates that the user has omitted a multiplication by
9036 the element size.  This warning is enabled by @option{-Wall}.
9038 @item -Wmemset-transposed-args
9039 @opindex Wmemset-transposed-args
9040 @opindex Wno-memset-transposed-args
9041 Warn for suspicious calls to the @code{memset} built-in function where
9042 the second argument is not zero and the third argument is zero.  For
9043 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9044 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9045 is only emitted if the third argument is a literal zero.  Otherwise, if
9046 it is an expression that is folded to zero, or a cast of zero to some
9047 type, it is far less likely that the arguments have been mistakenly
9048 transposed and no warning is emitted.  This warning is enabled
9049 by @option{-Wall}.
9051 @item -Waddress
9052 @opindex Waddress
9053 @opindex Wno-address
9054 Warn about suspicious uses of address expressions. These include comparing
9055 the address of a function or a declared object to the null pointer constant
9056 such as in
9057 @smallexample
9058 void f (void);
9059 void g (void)
9061   if (!f)   // warning: expression evaluates to false
9062     abort ();
9064 @end smallexample
9065 comparisons of a pointer to a string literal, such as in
9066 @smallexample
9067 void f (const char *x)
9069   if (x == "abc")   // warning: expression evaluates to false
9070     puts ("equal");
9072 @end smallexample
9073 and tests of the results of pointer addition or subtraction for equality
9074 to null, such as in
9075 @smallexample
9076 void f (const int *p, int i)
9078   return p + i == NULL;
9080 @end smallexample
9081 Such uses typically indicate a programmer error: the address of most
9082 functions and objects necessarily evaluates to true (the exception are
9083 weak symbols), so their use in a conditional might indicate missing
9084 parentheses in a function call or a missing dereference in an array
9085 expression.  The subset of the warning for object pointers can be
9086 suppressed by casting the pointer operand to an integer type such
9087 as @code{intptr_t} or @code{uintptr_t}.
9088 Comparisons against string literals result in unspecified behavior
9089 and are not portable, and suggest the intent was to call @code{strcmp}.
9090 The warning is suppressed if the suspicious expression is the result
9091 of macro expansion.
9092 @option{-Waddress} warning is enabled by @option{-Wall}.
9094 @item -Wno-address-of-packed-member
9095 @opindex Waddress-of-packed-member
9096 @opindex Wno-address-of-packed-member
9097 Do not warn when the address of packed member of struct or union is taken,
9098 which usually results in an unaligned pointer value.  This is
9099 enabled by default.
9101 @item -Wlogical-op
9102 @opindex Wlogical-op
9103 @opindex Wno-logical-op
9104 Warn about suspicious uses of logical operators in expressions.
9105 This includes using logical operators in contexts where a
9106 bit-wise operator is likely to be expected.  Also warns when
9107 the operands of a logical operator are the same:
9108 @smallexample
9109 extern int a;
9110 if (a < 0 && a < 0) @{ @dots{} @}
9111 @end smallexample
9113 @item -Wlogical-not-parentheses
9114 @opindex Wlogical-not-parentheses
9115 @opindex Wno-logical-not-parentheses
9116 Warn about logical not used on the left hand side operand of a comparison.
9117 This option does not warn if the right operand is considered to be a boolean
9118 expression.  Its purpose is to detect suspicious code like the following:
9119 @smallexample
9120 int a;
9121 @dots{}
9122 if (!a > 1) @{ @dots{} @}
9123 @end smallexample
9125 It is possible to suppress the warning by wrapping the LHS into
9126 parentheses:
9127 @smallexample
9128 if ((!a) > 1) @{ @dots{} @}
9129 @end smallexample
9131 This warning is enabled by @option{-Wall}.
9133 @item -Waggregate-return
9134 @opindex Waggregate-return
9135 @opindex Wno-aggregate-return
9136 Warn if any functions that return structures or unions are defined or
9137 called.  (In languages where you can return an array, this also elicits
9138 a warning.)
9140 @item -Wno-aggressive-loop-optimizations
9141 @opindex Wno-aggressive-loop-optimizations
9142 @opindex Waggressive-loop-optimizations
9143 Warn if in a loop with constant number of iterations the compiler detects
9144 undefined behavior in some statement during one or more of the iterations.
9146 @item -Wno-attributes
9147 @opindex Wno-attributes
9148 @opindex Wattributes
9149 Do not warn if an unexpected @code{__attribute__} is used, such as
9150 unrecognized attributes, function attributes applied to variables,
9151 etc.  This does not stop errors for incorrect use of supported
9152 attributes.
9154 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9155 warnings about unknown scoped attributes (in C++11 and C2X).  For example,
9156 @option{-Wno-attributes=vendor::attr} disables warning about the following
9157 declaration:
9159 @smallexample
9160 [[vendor::attr]] void f();
9161 @end smallexample
9163 It is also possible to disable warning about all attributes in a namespace
9164 using @option{-Wno-attributes=vendor::} which prevents warning about both
9165 of these declarations:
9167 @smallexample
9168 [[vendor::safe]] void f();
9169 [[vendor::unsafe]] void f2();
9170 @end smallexample
9172 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9174 @item -Wno-builtin-declaration-mismatch
9175 @opindex Wno-builtin-declaration-mismatch
9176 @opindex Wbuiltin-declaration-mismatch
9177 Warn if a built-in function is declared with an incompatible signature
9178 or as a non-function, or when a built-in function declared with a type
9179 that does not include a prototype is called with arguments whose promoted
9180 types do not match those expected by the function.  When @option{-Wextra}
9181 is specified, also warn when a built-in function that takes arguments is
9182 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9183 warning is enabled by default.  To avoid the warning include the appropriate
9184 header to bring the prototypes of built-in functions into scope.
9186 For example, the call to @code{memset} below is diagnosed by the warning
9187 because the function expects a value of type @code{size_t} as its argument
9188 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9189 the declaration of the function is diagnosed as well.
9190 @smallexample
9191 extern void* memset ();
9192 void f (void *d)
9194   memset (d, '\0', 32);
9196 @end smallexample
9198 @item -Wno-builtin-macro-redefined
9199 @opindex Wno-builtin-macro-redefined
9200 @opindex Wbuiltin-macro-redefined
9201 Do not warn if certain built-in macros are redefined.  This suppresses
9202 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9203 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9205 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9206 @opindex Wstrict-prototypes
9207 @opindex Wno-strict-prototypes
9208 Warn if a function is declared or defined without specifying the
9209 argument types.  (An old-style function definition is permitted without
9210 a warning if preceded by a declaration that specifies the argument
9211 types.)
9213 @item -Wold-style-declaration @r{(C and Objective-C only)}
9214 @opindex Wold-style-declaration
9215 @opindex Wno-old-style-declaration
9216 Warn for obsolescent usages, according to the C Standard, in a
9217 declaration. For example, warn if storage-class specifiers like
9218 @code{static} are not the first things in a declaration.  This warning
9219 is also enabled by @option{-Wextra}.
9221 @item -Wold-style-definition @r{(C and Objective-C only)}
9222 @opindex Wold-style-definition
9223 @opindex Wno-old-style-definition
9224 Warn if an old-style function definition is used.  A warning is given
9225 even if there is a previous prototype.  A definition using @samp{()}
9226 is not considered an old-style definition in C2X mode, because it is
9227 equivalent to @samp{(void)} in that case, but is considered an
9228 old-style definition for older standards.
9230 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9231 @opindex Wmissing-parameter-type
9232 @opindex Wno-missing-parameter-type
9233 A function parameter is declared without a type specifier in K&R-style
9234 functions:
9236 @smallexample
9237 void foo(bar) @{ @}
9238 @end smallexample
9240 This warning is also enabled by @option{-Wextra}.
9242 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9243 @opindex Wmissing-prototypes
9244 @opindex Wno-missing-prototypes
9245 Warn if a global function is defined without a previous prototype
9246 declaration.  This warning is issued even if the definition itself
9247 provides a prototype.  Use this option to detect global functions
9248 that do not have a matching prototype declaration in a header file.
9249 This option is not valid for C++ because all function declarations
9250 provide prototypes and a non-matching declaration declares an
9251 overload rather than conflict with an earlier declaration.
9252 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9254 @item -Wmissing-declarations
9255 @opindex Wmissing-declarations
9256 @opindex Wno-missing-declarations
9257 Warn if a global function is defined without a previous declaration.
9258 Do so even if the definition itself provides a prototype.
9259 Use this option to detect global functions that are not declared in
9260 header files.  In C, no warnings are issued for functions with previous
9261 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9262 missing prototypes.  In C++, no warnings are issued for function templates,
9263 or for inline functions, or for functions in anonymous namespaces.
9265 @item -Wmissing-field-initializers
9266 @opindex Wmissing-field-initializers
9267 @opindex Wno-missing-field-initializers
9268 @opindex W
9269 @opindex Wextra
9270 @opindex Wno-extra
9271 Warn if a structure's initializer has some fields missing.  For
9272 example, the following code causes such a warning, because
9273 @code{x.h} is implicitly zero:
9275 @smallexample
9276 struct s @{ int f, g, h; @};
9277 struct s x = @{ 3, 4 @};
9278 @end smallexample
9280 This option does not warn about designated initializers, so the following
9281 modification does not trigger a warning:
9283 @smallexample
9284 struct s @{ int f, g, h; @};
9285 struct s x = @{ .f = 3, .g = 4 @};
9286 @end smallexample
9288 In C this option does not warn about the universal zero initializer
9289 @samp{@{ 0 @}}:
9291 @smallexample
9292 struct s @{ int f, g, h; @};
9293 struct s x = @{ 0 @};
9294 @end smallexample
9296 Likewise, in C++ this option does not warn about the empty @{ @}
9297 initializer, for example:
9299 @smallexample
9300 struct s @{ int f, g, h; @};
9301 s x = @{ @};
9302 @end smallexample
9304 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
9305 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9307 @item -Wno-missing-requires
9308 @opindex Wmissing-requires
9309 @opindex Wno-missing-requires
9311 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9313 @smallexample
9314 bool satisfied = requires @{ C<T> @};
9315 @end smallexample
9317 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9318 expression, which it is for all T.  Presumably the user meant to write
9320 @smallexample
9321 bool satisfied = requires @{ requires C<T> @};
9322 @end smallexample
9324 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9325 type @samp{T}.
9327 This warning can be disabled with @option{-Wno-missing-requires}.
9329 @item -Wno-missing-template-keyword
9330 @opindex Wmissing-template-keyword
9331 @opindex Wno-missing-template-keyword
9333 The member access tokens ., -> and :: must be followed by the @code{template}
9334 keyword if the parent object is dependent and the member being named is a
9335 template.
9337 @smallexample
9338 template <class X>
9339 void DoStuff (X x)
9341   x.template DoSomeOtherStuff<X>(); // Good.
9342   x.DoMoreStuff<X>(); // Warning, x is dependent.
9344 @end smallexample
9346 In rare cases it is possible to get false positives. To silence this, wrap
9347 the expression in parentheses. For example, the following is treated as a
9348 template, even where m and N are integers:
9350 @smallexample
9351 void NotATemplate (my_class t)
9353   int N = 5;
9355   bool test = t.m < N > (0); // Treated as a template.
9356   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9358 @end smallexample
9360 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9362 @item -Wno-multichar
9363 @opindex Wno-multichar
9364 @opindex Wmultichar
9365 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9366 Usually they indicate a typo in the user's code, as they have
9367 implementation-defined values, and should not be used in portable code.
9369 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9370 @opindex Wnormalized=
9371 @opindex Wnormalized
9372 @opindex Wno-normalized
9373 @cindex NFC
9374 @cindex NFKC
9375 @cindex character set, input normalization
9376 In ISO C and ISO C++, two identifiers are different if they are
9377 different sequences of characters.  However, sometimes when characters
9378 outside the basic ASCII character set are used, you can have two
9379 different character sequences that look the same.  To avoid confusion,
9380 the ISO 10646 standard sets out some @dfn{normalization rules} which
9381 when applied ensure that two sequences that look the same are turned into
9382 the same sequence.  GCC can warn you if you are using identifiers that
9383 have not been normalized; this option controls that warning.
9385 There are four levels of warning supported by GCC@.  The default is
9386 @option{-Wnormalized=nfc}, which warns about any identifier that is
9387 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
9388 recommended form for most uses.  It is equivalent to
9389 @option{-Wnormalized}.
9391 Unfortunately, there are some characters allowed in identifiers by
9392 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
9393 identifiers.  That is, there's no way to use these symbols in portable
9394 ISO C or C++ and have all your identifiers in NFC@.
9395 @option{-Wnormalized=id} suppresses the warning for these characters.
9396 It is hoped that future versions of the standards involved will correct
9397 this, which is why this option is not the default.
9399 You can switch the warning off for all characters by writing
9400 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
9401 only do this if you are using some other normalization scheme (like
9402 ``D''), because otherwise you can easily create bugs that are
9403 literally impossible to see.
9405 Some characters in ISO 10646 have distinct meanings but look identical
9406 in some fonts or display methodologies, especially once formatting has
9407 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9408 LETTER N'', displays just like a regular @code{n} that has been
9409 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
9410 normalization scheme to convert all these into a standard form as
9411 well, and GCC warns if your code is not in NFKC if you use
9412 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
9413 about every identifier that contains the letter O because it might be
9414 confused with the digit 0, and so is not the default, but may be
9415 useful as a local coding convention if the programming environment 
9416 cannot be fixed to display these characters distinctly.
9418 @item -Wno-attribute-warning
9419 @opindex Wno-attribute-warning
9420 @opindex Wattribute-warning
9421 Do not warn about usage of functions (@pxref{Function Attributes})
9422 declared with @code{warning} attribute.  By default, this warning is
9423 enabled.  @option{-Wno-attribute-warning} can be used to disable the
9424 warning or @option{-Wno-error=attribute-warning} can be used to
9425 disable the error when compiled with @option{-Werror} flag.
9427 @item -Wno-deprecated
9428 @opindex Wno-deprecated
9429 @opindex Wdeprecated
9430 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
9432 @item -Wno-deprecated-declarations
9433 @opindex Wno-deprecated-declarations
9434 @opindex Wdeprecated-declarations
9435 Do not warn about uses of functions (@pxref{Function Attributes}),
9436 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9437 Attributes}) marked as deprecated by using the @code{deprecated}
9438 attribute.
9440 @item -Wno-overflow
9441 @opindex Wno-overflow
9442 @opindex Woverflow
9443 Do not warn about compile-time overflow in constant expressions.
9445 @item -Wno-odr
9446 @opindex Wno-odr
9447 @opindex Wodr
9448 Warn about One Definition Rule violations during link-time optimization.
9449 Enabled by default.
9451 @item -Wopenacc-parallelism
9452 @opindex Wopenacc-parallelism
9453 @opindex Wno-openacc-parallelism
9454 @cindex OpenACC accelerator programming
9455 Warn about potentially suboptimal choices related to OpenACC parallelism.
9457 @item -Wopenmp-simd
9458 @opindex Wopenmp-simd
9459 @opindex Wno-openmp-simd
9460 Warn if the vectorizer cost model overrides the OpenMP
9461 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
9462 option can be used to relax the cost model.
9464 @item -Woverride-init @r{(C and Objective-C only)}
9465 @opindex Woverride-init
9466 @opindex Wno-override-init
9467 @opindex W
9468 @opindex Wextra
9469 @opindex Wno-extra
9470 Warn if an initialized field without side effects is overridden when
9471 using designated initializers (@pxref{Designated Inits, , Designated
9472 Initializers}).
9474 This warning is included in @option{-Wextra}.  To get other
9475 @option{-Wextra} warnings without this one, use @option{-Wextra
9476 -Wno-override-init}.
9478 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9479 @opindex Woverride-init-side-effects
9480 @opindex Wno-override-init-side-effects
9481 Do not warn if an initialized field with side effects is overridden when
9482 using designated initializers (@pxref{Designated Inits, , Designated
9483 Initializers}).  This warning is enabled by default.
9485 @item -Wpacked
9486 @opindex Wpacked
9487 @opindex Wno-packed
9488 Warn if a structure is given the packed attribute, but the packed
9489 attribute has no effect on the layout or size of the structure.
9490 Such structures may be mis-aligned for little benefit.  For
9491 instance, in this code, the variable @code{f.x} in @code{struct bar}
9492 is misaligned even though @code{struct bar} does not itself
9493 have the packed attribute:
9495 @smallexample
9496 @group
9497 struct foo @{
9498   int x;
9499   char a, b, c, d;
9500 @} __attribute__((packed));
9501 struct bar @{
9502   char z;
9503   struct foo f;
9505 @end group
9506 @end smallexample
9508 @item -Wnopacked-bitfield-compat
9509 @opindex Wpacked-bitfield-compat
9510 @opindex Wno-packed-bitfield-compat
9511 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9512 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
9513 the change can lead to differences in the structure layout.  GCC
9514 informs you when the offset of such a field has changed in GCC 4.4.
9515 For example there is no longer a 4-bit padding between field @code{a}
9516 and @code{b} in this structure:
9518 @smallexample
9519 struct foo
9521   char a:4;
9522   char b:8;
9523 @} __attribute__ ((packed));
9524 @end smallexample
9526 This warning is enabled by default.  Use
9527 @option{-Wno-packed-bitfield-compat} to disable this warning.
9529 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9530 @opindex Wpacked-not-aligned
9531 @opindex Wno-packed-not-aligned
9532 Warn if a structure field with explicitly specified alignment in a
9533 packed struct or union is misaligned.  For example, a warning will
9534 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9535 'struct S' is less than 8}, in this code:
9537 @smallexample
9538 @group
9539 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9540 struct __attribute__ ((packed)) S @{
9541   struct S8 s8;
9543 @end group
9544 @end smallexample
9546 This warning is enabled by @option{-Wall}.
9548 @item -Wpadded
9549 @opindex Wpadded
9550 @opindex Wno-padded
9551 Warn if padding is included in a structure, either to align an element
9552 of the structure or to align the whole structure.  Sometimes when this
9553 happens it is possible to rearrange the fields of the structure to
9554 reduce the padding and so make the structure smaller.
9556 @item -Wredundant-decls
9557 @opindex Wredundant-decls
9558 @opindex Wno-redundant-decls
9559 Warn if anything is declared more than once in the same scope, even in
9560 cases where multiple declaration is valid and changes nothing.
9562 @item -Wrestrict
9563 @opindex Wrestrict
9564 @opindex Wno-restrict
9565 Warn when an object referenced by a @code{restrict}-qualified parameter
9566 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9567 argument, or when copies between such objects overlap.  For example,
9568 the call to the @code{strcpy} function below attempts to truncate the string
9569 by replacing its initial characters with the last four.  However, because
9570 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9571 the call is diagnosed.
9573 @smallexample
9574 void foo (void)
9576   char a[] = "abcd1234";
9577   strcpy (a, a + 4);
9578   @dots{}
9580 @end smallexample
9581 The @option{-Wrestrict} option detects some instances of simple overlap
9582 even without optimization but works best at @option{-O2} and above.  It
9583 is included in @option{-Wall}.
9585 @item -Wnested-externs @r{(C and Objective-C only)}
9586 @opindex Wnested-externs
9587 @opindex Wno-nested-externs
9588 Warn if an @code{extern} declaration is encountered within a function.
9590 @item -Winline
9591 @opindex Winline
9592 @opindex Wno-inline
9593 Warn if a function that is declared as inline cannot be inlined.
9594 Even with this option, the compiler does not warn about failures to
9595 inline functions declared in system headers.
9597 The compiler uses a variety of heuristics to determine whether or not
9598 to inline a function.  For example, the compiler takes into account
9599 the size of the function being inlined and the amount of inlining
9600 that has already been done in the current function.  Therefore,
9601 seemingly insignificant changes in the source program can cause the
9602 warnings produced by @option{-Winline} to appear or disappear.
9604 @item -Winterference-size
9605 @opindex Winterference-size
9606 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9607 without specifying its value with @option{--param destructive-interference-size}.
9608 Also warn about questionable values for that option.
9610 This variable is intended to be used for controlling class layout, to
9611 avoid false sharing in concurrent code:
9613 @smallexample
9614 struct independent_fields @{
9615   alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
9616   alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
9618 @end smallexample
9620 Here @samp{one} and @samp{two} are intended to be far enough apart
9621 that stores to one won't require accesses to the other to reload the
9622 cache line.
9624 By default, @option{--param destructive-interference-size} and
9625 @option{--param constructive-interference-size} are set based on the
9626 current @option{-mtune} option, typically to the L1 cache line size
9627 for the particular target CPU, sometimes to a range if tuning for a
9628 generic target.  So all translation units that depend on ABI
9629 compatibility for the use of these variables must be compiled with
9630 the same @option{-mtune} (or @option{-mcpu}).
9632 If ABI stability is important, such as if the use is in a header for a
9633 library, you should probably not use the hardware interference size
9634 variables at all.  Alternatively, you can force a particular value
9635 with @option{--param}.
9637 If you are confident that your use of the variable does not affect ABI
9638 outside a single build of your project, you can turn off the warning
9639 with @option{-Wno-interference-size}.
9641 @item -Wint-in-bool-context
9642 @opindex Wint-in-bool-context
9643 @opindex Wno-int-in-bool-context
9644 Warn for suspicious use of integer values where boolean values are expected,
9645 such as conditional expressions (?:) using non-boolean integer constants in
9646 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
9647 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
9648 for all kinds of multiplications regardless of the data type.
9649 This warning is enabled by @option{-Wall}.
9651 @item -Wno-int-to-pointer-cast
9652 @opindex Wno-int-to-pointer-cast
9653 @opindex Wint-to-pointer-cast
9654 Suppress warnings from casts to pointer type of an integer of a
9655 different size. In C++, casting to a pointer type of smaller size is
9656 an error. @option{Wint-to-pointer-cast} is enabled by default.
9659 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9660 @opindex Wno-pointer-to-int-cast
9661 @opindex Wpointer-to-int-cast
9662 Suppress warnings from casts from a pointer to an integer type of a
9663 different size.
9665 @item -Winvalid-pch
9666 @opindex Winvalid-pch
9667 @opindex Wno-invalid-pch
9668 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9669 the search path but cannot be used.
9671 @item -Winvalid-utf8
9672 @opindex Winvalid-utf8
9673 @opindex Wno-invalid-utf8
9674 Warn if an invalid UTF-8 character is found.
9675 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
9676 is used and turned into error with @option{-pedantic-errors}.
9678 @item -Wno-unicode
9679 @opindex Wunicode
9680 @opindex Wno-unicode
9681 Don't diagnose invalid forms of delimited or named escape sequences which are
9682 treated as separate tokens.  @option{Wunicode} is enabled by default.
9684 @item -Wlong-long
9685 @opindex Wlong-long
9686 @opindex Wno-long-long
9687 Warn if @code{long long} type is used.  This is enabled by either
9688 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9689 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
9691 @item -Wvariadic-macros
9692 @opindex Wvariadic-macros
9693 @opindex Wno-variadic-macros
9694 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9695 alternate syntax is used in ISO C99 mode.  This is enabled by either
9696 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
9697 messages, use @option{-Wno-variadic-macros}.
9699 @item -Wno-varargs
9700 @opindex Wvarargs
9701 @opindex Wno-varargs
9702 Do not warn upon questionable usage of the macros used to handle variable
9703 arguments like @code{va_start}.  These warnings are enabled by default.
9705 @item -Wvector-operation-performance
9706 @opindex Wvector-operation-performance
9707 @opindex Wno-vector-operation-performance
9708 Warn if vector operation is not implemented via SIMD capabilities of the
9709 architecture.  Mainly useful for the performance tuning.
9710 Vector operation can be implemented @code{piecewise}, which means that the
9711 scalar operation is performed on every vector element; 
9712 @code{in parallel}, which means that the vector operation is implemented
9713 using scalars of wider type, which normally is more performance efficient;
9714 and @code{as a single scalar}, which means that vector fits into a
9715 scalar type.
9717 @item -Wvla
9718 @opindex Wvla
9719 @opindex Wno-vla
9720 Warn if a variable-length array is used in the code.
9721 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9722 the variable-length array.
9724 @item -Wvla-larger-than=@var{byte-size}
9725 @opindex Wvla-larger-than=
9726 @opindex Wno-vla-larger-than
9727 If this option is used, the compiler warns for declarations of
9728 variable-length arrays whose size is either unbounded, or bounded
9729 by an argument that allows the array size to exceed @var{byte-size}
9730 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9731 works, but with variable-length arrays.
9733 Note that GCC may optimize small variable-length arrays of a known
9734 value into plain arrays, so this warning may not get triggered for
9735 such arrays.
9737 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9738 is typically only effective when @option{-ftree-vrp} is active (default
9739 for @option{-O2} and above).
9741 See also @option{-Walloca-larger-than=@var{byte-size}}.
9743 @item -Wno-vla-larger-than
9744 @opindex Wno-vla-larger-than
9745 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
9746 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9748 @item -Wvla-parameter
9749 @opindex Wno-vla-parameter
9750 Warn about redeclarations of functions involving arguments of Variable
9751 Length Array types of inconsistent kinds or forms, and enable the detection
9752 of out-of-bounds accesses to such parameters by warnings such as
9753 @option{-Warray-bounds}.
9755 If the first function declaration uses the VLA form the bound specified
9756 in the array is assumed to be the minimum number of elements expected to
9757 be provided in calls to the function and the maximum number of elements
9758 accessed by it.  Failing to provide arguments of sufficient size or
9759 accessing more than the maximum number of elements may be diagnosed.
9761 For example, the warning triggers for the following redeclarations because
9762 the first one allows an array of any size to be passed to @code{f} while
9763 the second one specifies that the array argument must have at least @code{n}
9764 elements.  In addition, calling @code{f} with the associated VLA bound
9765 parameter in excess of the actual VLA bound triggers a warning as well.
9767 @smallexample
9768 void f (int n, int[n]);
9769 void f (int, int[]);     // warning: argument 2 previously declared as a VLA
9771 void g (int n)
9773     if (n > 4)
9774       return;
9775     int a[n];
9776     f (sizeof a, a);     // warning: access to a by f may be out of bounds
9777   @dots{}
9780 @end smallexample
9782 @option{-Wvla-parameter} is included in @option{-Wall}.  The
9783 @option{-Warray-parameter} option triggers warnings for similar problems
9784 involving ordinary array arguments.
9786 @item -Wvolatile-register-var
9787 @opindex Wvolatile-register-var
9788 @opindex Wno-volatile-register-var
9789 Warn if a register variable is declared volatile.  The volatile
9790 modifier does not inhibit all optimizations that may eliminate reads
9791 and/or writes to register variables.  This warning is enabled by
9792 @option{-Wall}.
9794 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
9795 @opindex Wxor-used-as-pow
9796 @opindex Wno-xor-used-as-pow
9797 Warn about uses of @code{^}, the exclusive or operator, where it appears
9798 the user meant exponentiation.  Specifically, the warning occurs when the
9799 left-hand side is the decimal constant 2 or 10 and the right-hand side
9800 is also a decimal constant.
9802 In C and C++, @code{^} means exclusive or, whereas in some other languages
9803 (e.g. TeX and some versions of BASIC) it means exponentiation.
9805 This warning is enabled by default.  It can be silenced by converting one
9806 of the operands to hexadecimal.
9808 @item -Wdisabled-optimization
9809 @opindex Wdisabled-optimization
9810 @opindex Wno-disabled-optimization
9811 Warn if a requested optimization pass is disabled.  This warning does
9812 not generally indicate that there is anything wrong with your code; it
9813 merely indicates that GCC's optimizers are unable to handle the code
9814 effectively.  Often, the problem is that your code is too big or too
9815 complex; GCC refuses to optimize programs when the optimization
9816 itself is likely to take inordinate amounts of time.
9818 @item -Wpointer-sign @r{(C and Objective-C only)}
9819 @opindex Wpointer-sign
9820 @opindex Wno-pointer-sign
9821 Warn for pointer argument passing or assignment with different signedness.
9822 This option is only supported for C and Objective-C@.  It is implied by
9823 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9824 @option{-Wno-pointer-sign}.
9826 @item -Wstack-protector
9827 @opindex Wstack-protector
9828 @opindex Wno-stack-protector
9829 This option is only active when @option{-fstack-protector} is active.  It
9830 warns about functions that are not protected against stack smashing.
9832 @item -Woverlength-strings
9833 @opindex Woverlength-strings
9834 @opindex Wno-overlength-strings
9835 Warn about string constants that are longer than the ``minimum
9836 maximum'' length specified in the C standard.  Modern compilers
9837 generally allow string constants that are much longer than the
9838 standard's minimum limit, but very portable programs should avoid
9839 using longer strings.
9841 The limit applies @emph{after} string constant concatenation, and does
9842 not count the trailing NUL@.  In C90, the limit was 509 characters; in
9843 C99, it was raised to 4095.  C++98 does not specify a normative
9844 minimum maximum, so we do not diagnose overlength strings in C++@.
9846 This option is implied by @option{-Wpedantic}, and can be disabled with
9847 @option{-Wno-overlength-strings}.
9849 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
9850 @opindex Wunsuffixed-float-constants
9851 @opindex Wno-unsuffixed-float-constants
9853 Issue a warning for any floating constant that does not have
9854 a suffix.  When used together with @option{-Wsystem-headers} it
9855 warns about such constants in system header files.  This can be useful
9856 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
9857 from the decimal floating-point extension to C99.
9859 @item -Wno-lto-type-mismatch
9860 @opindex Wlto-type-mismatch
9861 @opindex Wno-lto-type-mismatch
9863 During the link-time optimization, do not warn about type mismatches in
9864 global declarations from different compilation units.
9865 Requires @option{-flto} to be enabled.  Enabled by default.
9867 @item -Wno-designated-init @r{(C and Objective-C only)}
9868 @opindex Wdesignated-init
9869 @opindex Wno-designated-init
9870 Suppress warnings when a positional initializer is used to initialize
9871 a structure that has been marked with the @code{designated_init}
9872 attribute.
9874 @end table
9876 @node Static Analyzer Options
9877 @section Options That Control Static Analysis
9879 @table @gcctabopt
9880 @item -fanalyzer
9881 @opindex analyzer
9882 @opindex fanalyzer
9883 @opindex fno-analyzer
9884 This option enables an static analysis of program flow which looks
9885 for ``interesting'' interprocedural paths through the
9886 code, and issues warnings for problems found on them.
9888 This analysis is much more expensive than other GCC warnings.
9890 Enabling this option effectively enables the following warnings:
9892 @gccoptlist{ @gol
9893 -Wanalyzer-allocation-size @gol
9894 -Wanalyzer-double-fclose @gol
9895 -Wanalyzer-double-free @gol
9896 -Wanalyzer-exposure-through-output-file @gol
9897 -Wanalyzer-exposure-through-uninit-copy @gol
9898 -Wanalyzer-fd-access-mode-mismatch @gol
9899 -Wanalyzer-fd-double-close @gol
9900 -Wanalyzer-fd-leak @gol
9901 -Wanalyzer-fd-use-after-close @gol
9902 -Wanalyzer-fd-use-without-check @gol
9903 -Wanalyzer-file-leak @gol
9904 -Wanalyzer-free-of-non-heap @gol
9905 -Wanalyzer-imprecise-fp-arithmetic @gol
9906 -Wanalyzer-jump-through-null @gol
9907 -Wanalyzer-malloc-leak @gol
9908 -Wanalyzer-mismatching-deallocation @gol
9909 -Wanalyzer-null-argument @gol
9910 -Wanalyzer-null-dereference @gol
9911 -Wanalyzer-out-of-bounds @gol
9912 -Wanalyzer-possible-null-argument @gol
9913 -Wanalyzer-possible-null-dereference @gol
9914 -Wanalyzer-putenv-of-auto-var @gol
9915 -Wanalyzer-shift-count-negative @gol
9916 -Wanalyzer-shift-count-overflow @gol
9917 -Wanalyzer-stale-setjmp-buffer @gol
9918 -Wanalyzer-unsafe-call-within-signal-handler @gol
9919 -Wanalyzer-use-after-free @gol
9920 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
9921 -Wanalyzer-use-of-uninitialized-value @gol
9922 -Wanalyzer-va-arg-type-mismatch @gol
9923 -Wanalyzer-va-list-exhausted @gol
9924 -Wanalyzer-va-list-leak @gol
9925 -Wanalyzer-va-list-use-after-va-end @gol
9926 -Wanalyzer-write-to-const @gol
9927 -Wanalyzer-write-to-string-literal @gol
9929 @ignore
9930 -Wanalyzer-tainted-allocation-size @gol
9931 -Wanalyzer-tainted-array-index @gol
9932 -Wanalyzer-tainted-divisor @gol
9933 -Wanalyzer-tainted-offset @gol
9934 -Wanalyzer-tainted-size @gol
9935 @end ignore
9937 This option is only available if GCC was configured with analyzer
9938 support enabled.
9940 @item -Wanalyzer-too-complex
9941 @opindex Wanalyzer-too-complex
9942 @opindex Wno-analyzer-too-complex
9943 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
9944 to attempt to explore the control flow and data flow in the program,
9945 but these can be defeated by sufficiently complicated code.
9947 By default, the analysis silently stops if the code is too
9948 complicated for the analyzer to fully explore and it reaches an internal
9949 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
9951 @item -Wno-analyzer-allocation-size
9952 @opindex Wanalyzer-allocation-size
9953 @opindex Wno-analyzer-allocation-size
9954 This warning requires @option{-fanalyzer}, which enables it; use
9955 @option{-Wno-analyzer-allocation-size}
9956 to disable it.
9958 This diagnostic warns for paths through the code in which a pointer to
9959 a buffer is assigned to point at a buffer with a size that is not a
9960 multiple of @code{sizeof (*pointer)}.
9962 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
9964 @item -Wno-analyzer-double-fclose
9965 @opindex Wanalyzer-double-fclose
9966 @opindex Wno-analyzer-double-fclose
9967 This warning requires @option{-fanalyzer}, which enables it; use
9968 @option{-Wno-analyzer-double-fclose} to disable it.
9970 This diagnostic warns for paths through the code in which a @code{FILE *}
9971 can have @code{fclose} called on it more than once.
9973 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
9975 @item -Wno-analyzer-double-free
9976 @opindex Wanalyzer-double-free
9977 @opindex Wno-analyzer-double-free
9978 This warning requires @option{-fanalyzer}, which enables it; use
9979 @option{-Wno-analyzer-double-free} to disable it.
9981 This diagnostic warns for paths through the code in which a pointer
9982 can have a deallocator called on it more than once, either @code{free},
9983 or a deallocator referenced by attribute @code{malloc}.
9985 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
9987 @item -Wno-analyzer-exposure-through-output-file
9988 @opindex Wanalyzer-exposure-through-output-file
9989 @opindex Wno-analyzer-exposure-through-output-file
9990 This warning requires @option{-fanalyzer}, which enables it; use
9991 @option{-Wno-analyzer-exposure-through-output-file}
9992 to disable it.
9994 This diagnostic warns for paths through the code in which a
9995 security-sensitive value is written to an output file
9996 (such as writing a password to a log file).
9998 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10000 @item -Wanalyzer-exposure-through-uninit-copy
10001 @opindex Wanalyzer-exposure-through-uninit-copy
10002 @opindex Wno-analyzer-exposure-through-uninit-copy
10003 This warning requires both @option{-fanalyzer} and the use of a plugin
10004 to specify a function that copies across a ``trust boundary''.  Use
10005 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10007 This diagnostic warns for ``infoleaks'' - paths through the code in which
10008 uninitialized values are copied across a security boundary
10009 (such as code within an OS kernel that copies a partially-initialized
10010 struct on the stack to user space).
10012 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10014 @item -Wno-analyzer-fd-access-mode-mismatch
10015 @opindex Wanalyzer-fd-access-mode-mismatch
10016 @opindex Wno-analyzer-fd-access-mode-mismatch
10017 This warning requires @option{-fanalyzer}, which enables it; use
10018 @option{-Wno-analyzer-fd-access-mode-mismatch}
10019 to disable it.
10021 This diagnostic warns for paths through code in which a
10022 @code{read} on a write-only file descriptor is attempted, or vice versa.
10024 This diagnostic also warns for code paths in a which a function with attribute
10025 @code{fd_arg_read (N)} is called with a file descriptor opened with
10026 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10027 @code{fd_arg_write (N)} is called with a file descriptor opened with
10028 @code{O_RDONLY} at referenced argument @var{N}.
10030 @item -Wno-analyzer-fd-double-close
10031 @opindex Wanalyzer-fd-double-close
10032 @opindex Wno-analyzer-fd-double-close
10033 This warning requires @option{-fanalyzer}, which enables it; use
10034 @option{-Wno-analyzer-fd-double-close}
10035 to disable it.
10037 This diagnostic warns for paths through code in which a
10038 file descriptor can be closed more than once.
10040 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10042 @item -Wno-analyzer-fd-leak
10043 @opindex Wanalyzer-fd-leak
10044 @opindex Wno-analyzer-fd-leak
10045 This warning requires @option{-fanalyzer}, which enables it; use
10046 @option{-Wno-analyzer-fd-leak}
10047 to disable it.
10049 This diagnostic warns for paths through code in which an
10050 open file descriptor is leaked.
10052 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10054 @item -Wno-analyzer-fd-use-after-close
10055 @opindex Wanalyzer-fd-use-after-close
10056 @opindex Wno-analyzer-fd-use-after-close
10057 This warning requires @option{-fanalyzer}, which enables it; use
10058 @option{-Wno-analyzer-fd-use-after-close}
10059 to disable it.
10061 This diagnostic warns for paths through code in which a
10062 read or write is called on a closed file descriptor.
10064 This diagnostic also warns for paths through code in which
10065 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10066 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10067 referenced argument @code{N}.
10069 @item -Wno-analyzer-fd-use-without-check
10070 @opindex Wanalyzer-fd-use-without-check
10071 @opindex Wno-analyzer-fd-use-without-check
10072 This warning requires @option{-fanalyzer}, which enables it; use
10073 @option{-Wno-analyzer-fd-use-without-check}
10074 to disable it.
10076 This diagnostic warns for paths through code in which a
10077 file descriptor is used without being checked for validity.
10079 This diagnostic also warns for paths through code in which
10080 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10081 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10082 argument @code{N}, without being checked for validity.
10084 @item -Wno-analyzer-file-leak
10085 @opindex Wanalyzer-file-leak
10086 @opindex Wno-analyzer-file-leak
10087 This warning requires @option{-fanalyzer}, which enables it; use
10088 @option{-Wno-analyzer-file-leak}
10089 to disable it.
10091 This diagnostic warns for paths through the code in which a
10092 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10094 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10096 @item -Wno-analyzer-free-of-non-heap
10097 @opindex Wanalyzer-free-of-non-heap
10098 @opindex Wno-analyzer-free-of-non-heap
10099 This warning requires @option{-fanalyzer}, which enables it; use
10100 @option{-Wno-analyzer-free-of-non-heap}
10101 to disable it.
10103 This diagnostic warns for paths through the code in which @code{free}
10104 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10106 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10108 @item -Wno-analyzer-imprecise-fp-arithmetic
10109 @opindex Wanalyzer-imprecise-fp-arithmetic
10110 @opindex Wno-analyzer-imprecise-fp-arithmetic
10111 This warning requires @option{-fanalyzer}, which enables it; use
10112 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10113 to disable it.
10115 This diagnostic warns for paths through the code in which floating-point
10116 arithmetic is used in locations where precise computation is needed.  This
10117 diagnostic only warns on use of floating-point operands inside the
10118 calculation of an allocation size at the moment.
10120 @item -Wno-analyzer-jump-through-null
10121 @opindex Wanalyzer-jump-through-null
10122 @opindex Wno-analyzer-jump-through-null
10123 This warning requires @option{-fanalyzer}, which enables it; use
10124 @option{-Wno-analyzer-jump-through-null}
10125 to disable it.
10127 This diagnostic warns for paths through the code in which a @code{NULL}
10128 function pointer is called.
10130 @item -Wno-analyzer-malloc-leak
10131 @opindex Wanalyzer-malloc-leak
10132 @opindex Wno-analyzer-malloc-leak
10133 This warning requires @option{-fanalyzer}, which enables it; use
10134 @option{-Wno-analyzer-malloc-leak}
10135 to disable it.
10137 This diagnostic warns for paths through the code in which a
10138 pointer allocated via an allocator is leaked: either @code{malloc},
10139 or a function marked with attribute @code{malloc}.
10141 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10143 @item -Wno-analyzer-mismatching-deallocation
10144 @opindex Wanalyzer-mismatching-deallocation
10145 @opindex Wno-analyzer-mismatching-deallocation
10146 This warning requires @option{-fanalyzer}, which enables it; use
10147 @option{-Wno-analyzer-mismatching-deallocation}
10148 to disable it.
10150 This diagnostic warns for paths through the code in which the
10151 wrong deallocation function is called on a pointer value, based on
10152 which function was used to allocate the pointer value.  The diagnostic
10153 will warn about mismatches between @code{free}, scalar @code{delete}
10154 and vector @code{delete[]}, and those marked as allocator/deallocator
10155 pairs using attribute @code{malloc}.
10157 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10159 @item -Wno-analyzer-out-of-bounds
10160 @opindex Wanalyzer-out-of-bounds
10161 @opindex Wno-analyzer-out-of-bounds
10162 This warning requires @option{-fanalyzer} to enable it; use
10163 @option{-Wno-analyzer-out-of-bounds} to disable it.
10165 This diagnostic warns for path through the code in which a buffer is
10166 definitely read or written out-of-bounds.  The diagnostic applies for
10167 cases where the analyzer is able to determine a constant offset and for
10168 accesses past the end of a buffer, also a constant capacity.  Further,
10169 the diagnostic does limited checking for accesses past the end when the
10170 offset as well as the capacity is symbolic.
10172 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10174 @item -Wno-analyzer-possible-null-argument
10175 @opindex Wanalyzer-possible-null-argument
10176 @opindex Wno-analyzer-possible-null-argument
10177 This warning requires @option{-fanalyzer}, which enables it; use
10178 @option{-Wno-analyzer-possible-null-argument} to disable it.
10180 This diagnostic warns for paths through the code in which a
10181 possibly-NULL value is passed to a function argument marked
10182 with @code{__attribute__((nonnull))} as requiring a non-NULL
10183 value.
10185 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10187 @item -Wno-analyzer-possible-null-dereference
10188 @opindex Wanalyzer-possible-null-dereference
10189 @opindex Wno-analyzer-possible-null-dereference
10190 This warning requires @option{-fanalyzer}, which enables it; use
10191 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10193 This diagnostic warns for paths through the code in which a
10194 possibly-NULL value is dereferenced.
10196 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10198 @item -Wno-analyzer-null-argument
10199 @opindex Wanalyzer-null-argument
10200 @opindex Wno-analyzer-null-argument
10201 This warning requires @option{-fanalyzer}, which enables it; use
10202 @option{-Wno-analyzer-null-argument} to disable it.
10204 This diagnostic warns for paths through the code in which a
10205 value known to be NULL is passed to a function argument marked
10206 with @code{__attribute__((nonnull))} as requiring a non-NULL
10207 value.
10209 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10211 @item -Wno-analyzer-null-dereference
10212 @opindex Wanalyzer-null-dereference
10213 @opindex Wno-analyzer-null-dereference
10214 This warning requires @option{-fanalyzer}, which enables it; use
10215 @option{-Wno-analyzer-null-dereference} to disable it.
10217 This diagnostic warns for paths through the code in which a
10218 value known to be NULL is dereferenced.
10220 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10222 @item -Wno-analyzer-putenv-of-auto-var
10223 @opindex Wanalyzer-putenv-of-auto-var
10224 @opindex Wno-analyzer-putenv-of-auto-var
10225 This warning requires @option{-fanalyzer}, which enables it; use
10226 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10228 This diagnostic warns for paths through the code in which a
10229 call to @code{putenv} is passed a pointer to an automatic variable
10230 or an on-stack buffer.
10232 See @uref{https://wiki.sei.cmu.edu/confluence/x/6NYxBQ, POS34-C. Do not call putenv() with a pointer to an automatic variable as the argument}.
10234 @item -Wno-analyzer-shift-count-negative
10235 @opindex Wanalyzer-shift-count-negative
10236 @opindex Wno-analyzer-shift-count-negative
10237 This warning requires @option{-fanalyzer}, which enables it; use
10238 @option{-Wno-analyzer-shift-count-negative} to disable it.
10240 This diagnostic warns for paths through the code in which a
10241 shift is attempted with a negative count.  It is analogous to
10242 the @option{-Wshift-count-negative} diagnostic implemented in
10243 the C/C++ front ends, but is implemented based on analyzing
10244 interprocedural paths, rather than merely parsing the syntax tree.
10245 However, the analyzer does not prioritize detection of such paths, so
10246 false negatives are more likely relative to other warnings.
10248 @item -Wno-analyzer-shift-count-overflow
10249 @opindex Wanalyzer-shift-count-overflow
10250 @opindex Wno-analyzer-shift-count-overflow
10251 This warning requires @option{-fanalyzer}, which enables it; use
10252 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10254 This diagnostic warns for paths through the code in which a
10255 shift is attempted with a count greater than or equal to the
10256 precision of the operand's type.  It is analogous to
10257 the @option{-Wshift-count-overflow} diagnostic implemented in
10258 the C/C++ front ends, but is implemented based on analyzing
10259 interprocedural paths, rather than merely parsing the syntax tree.
10260 However, the analyzer does not prioritize detection of such paths, so
10261 false negatives are more likely relative to other warnings.
10263 @item -Wno-analyzer-stale-setjmp-buffer
10264 @opindex Wanalyzer-stale-setjmp-buffer
10265 @opindex Wno-analyzer-stale-setjmp-buffer
10266 This warning requires @option{-fanalyzer}, which enables it; use
10267 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10269 This diagnostic warns for paths through the code in which
10270 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10271 to a @code{setjmp} call in a function that has returned.
10273 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10274 location, it records the stack frame.  The stack frame becomes invalid
10275 when the function containing the @code{setjmp} call returns.  Attempting
10276 to rewind to it via @code{longjmp} would reference a stack frame that
10277 no longer exists, and likely lead to a crash (or worse).
10279 @item -Wno-analyzer-tainted-allocation-size
10280 @opindex Wanalyzer-tainted-allocation-size
10281 @opindex Wno-analyzer-tainted-allocation-size
10282 This warning requires both @option{-fanalyzer} and
10283 @option{-fanalyzer-checker=taint} to enable it;
10284 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10286 This diagnostic warns for paths through the code in which a value
10287 that could be under an attacker's control is used as the size
10288 of an allocation without being sanitized, so that an attacker could
10289 inject an excessively large allocation and potentially cause a denial
10290 of service attack.
10292 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10294 @item -Wno-analyzer-tainted-array-index
10295 @opindex Wanalyzer-tainted-array-index
10296 @opindex Wno-analyzer-tainted-array-index
10297 This warning requires both @option{-fanalyzer} and
10298 @option{-fanalyzer-checker=taint} to enable it;
10299 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10301 This diagnostic warns for paths through the code in which a value
10302 that could be under an attacker's control is used as the index
10303 of an array access without being sanitized, so that an attacker
10304 could inject an out-of-bounds access.
10306 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10308 @item -Wno-analyzer-tainted-divisor
10309 @opindex Wanalyzer-tainted-divisor
10310 @opindex Wno-analyzer-tainted-divisor
10311 This warning requires both @option{-fanalyzer} and
10312 @option{-fanalyzer-checker=taint} to enable it;
10313 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10315 This diagnostic warns for paths through the code in which a value
10316 that could be under an attacker's control is used as the divisor
10317 in a division or modulus operation without being sanitized, so that
10318 an attacker could inject a division-by-zero.
10320 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10322 @item -Wno-analyzer-tainted-offset
10323 @opindex Wanalyzer-tainted-offset
10324 @opindex Wno-analyzer-tainted-offset
10325 This warning requires both @option{-fanalyzer} and
10326 @option{-fanalyzer-checker=taint} to enable it;
10327 use @option{-Wno-analyzer-tainted-offset} to disable it.
10329 This diagnostic warns for paths through the code in which a value
10330 that could be under an attacker's control is used as a pointer offset
10331 without being sanitized, so that an attacker could inject an out-of-bounds
10332 access.
10334 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10336 @item -Wno-analyzer-tainted-size
10337 @opindex Wanalyzer-tainted-size
10338 @opindex Wno-analyzer-tainted-size
10339 This warning requires both @option{-fanalyzer} and
10340 @option{-fanalyzer-checker=taint} to enable it;
10341 use @option{-Wno-analyzer-tainted-size} to disable it.
10343 This diagnostic warns for paths through the code in which a value
10344 that could be under an attacker's control is used as the size of
10345 an operation such as @code{memset} without being sanitized, so that an
10346 attacker could inject an out-of-bounds access.
10348 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10350 @item -Wno-analyzer-unsafe-call-within-signal-handler
10351 @opindex Wanalyzer-unsafe-call-within-signal-handler
10352 @opindex Wno-analyzer-unsafe-call-within-signal-handler
10353 This warning requires @option{-fanalyzer}, which enables it; use
10354 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
10356 This diagnostic warns for paths through the code in which a
10357 function known to be async-signal-unsafe (such as @code{fprintf}) is
10358 called from a signal handler.
10360 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
10362 @item -Wno-analyzer-use-after-free
10363 @opindex Wanalyzer-use-after-free
10364 @opindex Wno-analyzer-use-after-free
10365 This warning requires @option{-fanalyzer}, which enables it; use
10366 @option{-Wno-analyzer-use-after-free} to disable it.
10368 This diagnostic warns for paths through the code in which a
10369 pointer is used after a deallocator is called on it: either @code{free},
10370 or a deallocator referenced by attribute @code{malloc}.
10372 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
10374 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
10375 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
10376 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
10377 This warning requires @option{-fanalyzer}, which enables it; use
10378 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
10379 to disable it.
10381 This diagnostic warns for paths through the code in which a pointer
10382 is dereferenced that points to a variable in a stale stack frame.
10384 @item -Wno-analyzer-va-arg-type-mismatch
10385 @opindex Wanalyzer-va-arg-type-mismatch
10386 @opindex Wno-analyzer-va-arg-type-mismatch
10387 This warning requires @option{-fanalyzer}, which enables it; use
10388 @option{-Wno-analyzer-va-arg-type-mismatch}
10389 to disable it.
10391 This diagnostic warns for interprocedural paths through the code for which
10392 the analyzer detects an attempt to use @code{va_arg} to extract a value
10393 passed to a variadic call, but uses a type that does not match that of
10394 the expression passed to the call.
10396 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
10398 @item -Wno-analyzer-va-list-exhausted
10399 @opindex Wanalyzer-va-list-exhausted
10400 @opindex Wno-analyzer-va-list-exhausted
10401 This warning requires @option{-fanalyzer}, which enables it; use
10402 @option{-Wno-analyzer-va-list-exhausted}
10403 to disable it.
10405 This diagnostic warns for interprocedural paths through the code for which
10406 the analyzer detects an attempt to use @code{va_arg} to access the next
10407 value passed to a variadic call, but all of the values in the
10408 @code{va_list} have already been consumed.
10410 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
10412 @item -Wno-analyzer-va-list-leak
10413 @opindex Wanalyzer-va-list-leak
10414 @opindex Wno-analyzer-va-list-leak
10415 This warning requires @option{-fanalyzer}, which enables it; use
10416 @option{-Wno-analyzer-va-list-leak}
10417 to disable it.
10419 This diagnostic warns for interprocedural paths through the code for which
10420 the analyzer detects that @code{va_start} or @code{va_copy} has been called
10421 on a @code{va_list} without a corresponding call to @code{va_end}.
10423 @item -Wno-analyzer-va-list-use-after-va-end
10424 @opindex Wanalyzer-va-list-use-after-va-end
10425 @opindex Wno-analyzer-va-list-use-after-va-end
10426 This warning requires @option{-fanalyzer}, which enables it; use
10427 @option{-Wno-analyzer-va-list-use-after-va-end}
10428 to disable it.
10430 This diagnostic warns for interprocedural paths through the code for which
10431 the analyzer detects an attempt to use a @code{va_list}  after
10432 @code{va_end} has been called on it.
10433 @code{va_list}.
10435 @item -Wno-analyzer-write-to-const
10436 @opindex Wanalyzer-write-to-const
10437 @opindex Wno-analyzer-write-to-const
10438 This warning requires @option{-fanalyzer}, which enables it; use
10439 @option{-Wno-analyzer-write-to-const}
10440 to disable it.
10442 This diagnostic warns for paths through the code in which the analyzer
10443 detects an attempt to write through a pointer to a @code{const} object.
10444 However, the analyzer does not prioritize detection of such paths, so
10445 false negatives are more likely relative to other warnings.
10447 @item -Wno-analyzer-write-to-string-literal
10448 @opindex Wanalyzer-write-to-string-literal
10449 @opindex Wno-analyzer-write-to-string-literal
10450 This warning requires @option{-fanalyzer}, which enables it; use
10451 @option{-Wno-analyzer-write-to-string-literal}
10452 to disable it.
10454 This diagnostic warns for paths through the code in which the analyzer
10455 detects an attempt to write through a pointer to a string literal.
10456 However, the analyzer does not prioritize detection of such paths, so
10457 false negatives are more likely relative to other warnings.
10459 @item -Wno-analyzer-use-of-uninitialized-value
10460 @opindex Wanalyzer-use-of-uninitialized-value
10461 @opindex Wno-analyzer-use-of-uninitialized-value
10462 This warning requires @option{-fanalyzer}, which enables it; use
10463 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
10465 This diagnostic warns for paths through the code in which an uninitialized
10466 value is used.
10468 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
10470 @end table
10472 The analyzer has hardcoded knowledge about the behavior of the following
10473 memory-management functions:
10475 @itemize @bullet
10476 @item @code{alloca}
10477 @item The built-in functions @code{__builtin_alloc},
10478 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
10479 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
10480 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
10481 @code{__builtin_memset_chk}, @code{__builtin_realloc},
10482 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
10483 @item @code{calloc}
10484 @item @code{free}
10485 @item @code{malloc}
10486 @item @code{memset}
10487 @item @code{operator delete}
10488 @item @code{operator delete []}
10489 @item @code{operator new}
10490 @item @code{operator new []}
10491 @item @code{realloc}
10492 @item @code{strdup}
10493 @item @code{strndup}
10494 @end itemize
10496 of the following functions for working with file descriptors:
10498 @itemize @bullet
10499 @item @code{open}
10500 @item @code{close}
10501 @item @code{creat}
10502 @item @code{dup}, @code{dup2} and @code{dup3}
10503 @item @code{pipe}, and @code{pipe2}
10504 @item @code{read}
10505 @item @code{write}
10506 @end itemize
10508 of the following functions for working with @code{<stdio.h>} streams:
10509 @itemize @bullet
10510 @item The built-in functions @code{__builtin_fprintf},
10511 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
10512 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
10513 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
10514 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
10515 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
10516 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
10517 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
10518 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
10519 @code{__builtin_vprintf}
10520 @item @code{fopen}
10521 @item @code{fclose}
10522 @item @code{fgets}
10523 @item @code{fgets_unlocked}
10524 @item @code{fread}
10525 @item @code{getchar}
10526 @item @code{fprintf}
10527 @item @code{printf}
10528 @item @code{fwrite}
10529 @end itemize
10531 and of the following functions:
10533 @itemize @bullet
10534 @item The built-in functions @code{__builtin_expect},
10535 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
10536 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
10537 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
10538 @code{__builtin_va_start}
10539 @item The GNU extensions @code{error} and @code{error_at_line}
10540 @item @code{getpass}
10541 @item @code{longjmp}
10542 @item @code{putenv}
10543 @item @code{setjmp}
10544 @item @code{siglongjmp}
10545 @item @code{signal}
10546 @item @code{sigsetjmp}
10547 @item @code{strchr}
10548 @item @code{strlen}
10549 @end itemize
10551 In addition, various functions with an @code{__analyzer_} prefix have
10552 special meaning to the analyzer, described in the GCC Internals manual.
10554 Pertinent parameters for controlling the exploration are:
10555 @option{--param analyzer-bb-explosion-factor=@var{value}},
10556 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
10557 @option{--param analyzer-max-recursion-depth=@var{value}}, and
10558 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
10560 The following options control the analyzer.
10562 @table @gcctabopt
10564 @item -fanalyzer-call-summaries
10565 @opindex fanalyzer-call-summaries
10566 @opindex fno-analyzer-call-summaries
10567 Simplify interprocedural analysis by computing the effect of certain calls,
10568 rather than exploring all paths through the function from callsite to each
10569 possible return.
10571 If enabled, call summaries are only used for functions with more than one
10572 call site, and that are sufficiently complicated (as per
10573 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
10575 @item -fanalyzer-checker=@var{name}
10576 @opindex fanalyzer-checker
10577 Restrict the analyzer to run just the named checker, and enable it.
10579 Some checkers are disabled by default (even with @option{-fanalyzer}),
10580 such as the @code{taint} checker that implements
10581 @option{-Wanalyzer-tainted-array-index}, and this option is required
10582 to enable them.
10584 @emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
10585 following warnings from @option{-fanalyzer}:
10587 @gccoptlist{ @gol
10588 -Wanalyzer-double-fclose @gol
10589 -Wanalyzer-double-free @gol
10590 -Wanalyzer-exposure-through-output-file @gol
10591 -Wanalyzer-fd-access-mode-mismatch @gol
10592 -Wanalyzer-fd-double-close @gol
10593 -Wanalyzer-fd-leak @gol
10594 -Wanalyzer-fd-use-after-close @gol
10595 -Wanalyzer-fd-use-without-check @gol
10596 -Wanalyzer-file-leak @gol
10597 -Wanalyzer-free-of-non-heap @gol
10598 -Wanalyzer-malloc-leak @gol
10599 -Wanalyzer-mismatching-deallocation @gol
10600 -Wanalyzer-null-argument @gol
10601 -Wanalyzer-null-dereference @gol
10602 -Wanalyzer-possible-null-argument @gol
10603 -Wanalyzer-possible-null-dereference @gol
10604 -Wanalyzer-unsafe-call-within-signal-handler @gol
10605 -Wanalyzer-use-after-free @gol
10606 -Wanalyzer-va-list-leak @gol
10607 -Wanalyzer-va-list-use-after-va-end @gol
10610 @item -fno-analyzer-feasibility
10611 @opindex fanalyzer-feasibility
10612 @opindex fno-analyzer-feasibility
10613 This option is intended for analyzer developers.
10615 By default the analyzer verifies that there is a feasible control flow path
10616 for each diagnostic it emits: that the conditions that hold are not mutually
10617 exclusive.  Diagnostics for which no feasible path can be found are rejected.
10618 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
10619 debugging issues in this code.
10621 @item -fanalyzer-fine-grained
10622 @opindex fanalyzer-fine-grained
10623 @opindex fno-analyzer-fine-grained
10624 This option is intended for analyzer developers.
10626 Internally the analyzer builds an ``exploded graph'' that combines
10627 control flow graphs with data flow information.
10629 By default, an edge in this graph can contain the effects of a run
10630 of multiple statements within a basic block.  With
10631 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
10633 @item -fanalyzer-show-duplicate-count
10634 @opindex fanalyzer-show-duplicate-count
10635 @opindex fno-analyzer-show-duplicate-count
10636 This option is intended for analyzer developers: if multiple diagnostics
10637 have been detected as being duplicates of each other, it emits a note when
10638 reporting the best diagnostic, giving the number of additional diagnostics
10639 that were suppressed by the deduplication logic.
10641 @item -fno-analyzer-state-merge
10642 @opindex fanalyzer-state-merge
10643 @opindex fno-analyzer-state-merge
10644 This option is intended for analyzer developers.
10646 By default the analyzer attempts to simplify analysis by merging
10647 sufficiently similar states at each program point as it builds its
10648 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
10649 merging can be suppressed, for debugging state-handling issues.
10651 @item -fno-analyzer-state-purge
10652 @opindex fanalyzer-state-purge
10653 @opindex fno-analyzer-state-purge
10654 This option is intended for analyzer developers.
10656 By default the analyzer attempts to simplify analysis by purging
10657 aspects of state at a program point that appear to no longer be relevant
10658 e.g. the values of locals that aren't accessed later in the function
10659 and which aren't relevant to leak analysis.
10661 With @option{-fno-analyzer-state-purge} this purging of state can
10662 be suppressed, for debugging state-handling issues.
10664 @item -fanalyzer-transitivity
10665 @opindex fanalyzer-transitivity
10666 @opindex fno-analyzer-transitivity
10667 This option enables transitivity of constraints within the analyzer.
10669 @item -fno-analyzer-undo-inlining
10670 @opindex fanalyzer-undo-inlining
10671 @opindex fno-analyzer-undo-inlining
10672 This option is intended for analyzer developers.
10674 @option{-fanalyzer} runs relatively late compared to other code analysis
10675 tools, and some optimizations have already been applied to the code.  In
10676 particular function inlining may have occurred, leading to the
10677 interprocedural execution paths emitted by the analyzer containing
10678 function frames that don't correspond to those in the original source
10679 code.
10681 By default the analyzer attempts to reconstruct the original function
10682 frames, and to emit events showing the inlined calls.
10684 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
10685 the original frame information can be be disabled, which may be of help
10686 when debugging issues in the analyzer.
10688 @item -fanalyzer-verbose-edges
10689 This option is intended for analyzer developers.  It enables more
10690 verbose, lower-level detail in the descriptions of control flow
10691 within diagnostic paths.
10693 @item -fanalyzer-verbose-state-changes
10694 This option is intended for analyzer developers.  It enables more
10695 verbose, lower-level detail in the descriptions of events relating
10696 to state machines within diagnostic paths.
10698 @item -fanalyzer-verbosity=@var{level}
10699 This option controls the complexity of the control flow paths that are
10700 emitted for analyzer diagnostics.
10702 The @var{level} can be one of:
10704 @table @samp
10705 @item 0
10706 At this level, interprocedural call and return events are displayed,
10707 along with the most pertinent state-change events relating to
10708 a diagnostic.  For example, for a double-@code{free} diagnostic,
10709 both calls to @code{free} will be shown.
10711 @item 1
10712 As per the previous level, but also show events for the entry
10713 to each function.
10715 @item 2
10716 As per the previous level, but also show events relating to
10717 control flow that are significant to triggering the issue
10718 (e.g. ``true path taken'' at a conditional).
10720 This level is the default.
10722 @item 3
10723 As per the previous level, but show all control flow events, not
10724 just significant ones.
10726 @item 4
10727 This level is intended for analyzer developers; it adds various
10728 other events intended for debugging the analyzer.
10730 @end table
10732 @item -fdump-analyzer
10733 @opindex fdump-analyzer
10734 Dump internal details about what the analyzer is doing to
10735 @file{@var{file}.analyzer.txt}.
10736 This option is overridden by @option{-fdump-analyzer-stderr}.
10738 @item -fdump-analyzer-stderr
10739 @opindex fdump-analyzer-stderr
10740 Dump internal details about what the analyzer is doing to stderr.
10741 This option overrides @option{-fdump-analyzer}.
10743 @item -fdump-analyzer-callgraph
10744 @opindex fdump-analyzer-callgraph
10745 Dump a representation of the call graph suitable for viewing with
10746 GraphViz to @file{@var{file}.callgraph.dot}.
10748 @item -fdump-analyzer-exploded-graph
10749 @opindex fdump-analyzer-exploded-graph
10750 Dump a representation of the ``exploded graph'' suitable for viewing with
10751 GraphViz to @file{@var{file}.eg.dot}.
10752 Nodes are color-coded based on state-machine states to emphasize
10753 state changes.
10755 @item -fdump-analyzer-exploded-nodes
10756 @opindex dump-analyzer-exploded-nodes
10757 Emit diagnostics showing where nodes in the ``exploded graph'' are
10758 in relation to the program source.
10760 @item -fdump-analyzer-exploded-nodes-2
10761 @opindex dump-analyzer-exploded-nodes-2
10762 Dump a textual representation of the ``exploded graph'' to
10763 @file{@var{file}.eg.txt}.
10765 @item -fdump-analyzer-exploded-nodes-3
10766 @opindex dump-analyzer-exploded-nodes-3
10767 Dump a textual representation of the ``exploded graph'' to
10768 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
10769 This is typically a large number of dump files.
10771 @item -fdump-analyzer-exploded-paths
10772 @opindex fdump-analyzer-exploded-paths
10773 Dump a textual representation of the ``exploded path'' for each
10774 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
10776 @item -fdump-analyzer-feasibility
10777 @opindex dump-analyzer-feasibility
10778 Dump internal details about the analyzer's search for feasible paths.
10779 The details are written in a form suitable for viewing with GraphViz
10780 to filenames of the form @file{@var{file}.*.fg.dot},
10781 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
10783 @item -fdump-analyzer-json
10784 @opindex fdump-analyzer-json
10785 Dump a compressed JSON representation of analyzer internals to
10786 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
10787 to change.
10789 @item -fdump-analyzer-state-purge
10790 @opindex fdump-analyzer-state-purge
10791 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
10792 ``supergraph'' suitable for viewing with GraphViz, but annotate the
10793 graph with information on what state will be purged at each node.
10794 The graph is written to @file{@var{file}.state-purge.dot}.
10796 @item -fdump-analyzer-supergraph
10797 @opindex fdump-analyzer-supergraph
10798 Dump representations of the ``supergraph'' suitable for viewing with
10799 GraphViz to @file{@var{file}.supergraph.dot} and to
10800 @file{@var{file}.supergraph-eg.dot}.  These show all of the
10801 control flow graphs in the program, with interprocedural edges for
10802 calls and returns.  The second dump contains annotations showing nodes
10803 in the ``exploded graph'' and diagnostics associated with them.
10805 @item -fdump-analyzer-untracked
10806 @opindex fdump-analyzer-untracked
10807 Emit custom warnings with internal details intended for analyzer developers.
10809 @end table
10811 @node Debugging Options
10812 @section Options for Debugging Your Program
10813 @cindex options, debugging
10814 @cindex debugging information options
10816 To tell GCC to emit extra information for use by a debugger, in almost 
10817 all cases you need only to add @option{-g} to your other options.  Some debug
10818 formats can co-exist (like DWARF with CTF) when each of them is enabled
10819 explicitly by adding the respective command line option to your other options.
10821 GCC allows you to use @option{-g} with
10822 @option{-O}.  The shortcuts taken by optimized code may occasionally
10823 be surprising: some variables you declared may not exist
10824 at all; flow of control may briefly move where you did not expect it;
10825 some statements may not be executed because they compute constant
10826 results or their values are already at hand; some statements may
10827 execute in different places because they have been moved out of loops.
10828 Nevertheless it is possible to debug optimized output.  This makes
10829 it reasonable to use the optimizer for programs that might have bugs.
10831 If you are not using some other optimization option, consider
10832 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
10833 With no @option{-O} option at all, some compiler passes that collect
10834 information useful for debugging do not run at all, so that
10835 @option{-Og} may result in a better debugging experience.
10837 @table @gcctabopt
10838 @item -g
10839 @opindex g
10840 Produce debugging information in the operating system's native format
10841 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
10842 information.
10844 On most systems that use stabs format, @option{-g} enables use of extra
10845 debugging information that only GDB can use; this extra information
10846 makes debugging work better in GDB but probably makes other debuggers
10847 crash or refuse to read the program.  If you want to control for certain whether
10848 to generate the extra information, use @option{-gvms} (see below).
10850 @item -ggdb
10851 @opindex ggdb
10852 Produce debugging information for use by GDB@.  This means to use the
10853 most expressive format available (DWARF, stabs, or the native format
10854 if neither of those are supported), including GDB extensions if at all
10855 possible.
10857 @item -gdwarf
10858 @itemx -gdwarf-@var{version}
10859 @opindex gdwarf
10860 Produce debugging information in DWARF format (if that is supported).
10861 The value of @var{version} may be either 2, 3, 4 or 5; the default
10862 version for most targets is 5 (with the exception of VxWorks, TPF and
10863 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
10864 to version 4).
10866 Note that with DWARF Version 2, some ports require and always
10867 use some non-conflicting DWARF 3 extensions in the unwind tables.
10869 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
10870 for maximum benefit. Version 5 requires GDB 8.0 or higher.
10872 GCC no longer supports DWARF Version 1, which is substantially
10873 different than Version 2 and later.  For historical reasons, some
10874 other DWARF-related options such as
10875 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
10876 in their names, but apply to all currently-supported versions of DWARF.
10878 @item -gbtf
10879 @opindex gbtf
10880 Request BTF debug information.  BTF is the default debugging format for the
10881 eBPF target.  On other targets, like x86, BTF debug information can be
10882 generated along with DWARF debug information when both of the debug formats are
10883 enabled explicitly via their respective command line options.
10885 @item -gctf
10886 @itemx -gctf@var{level}
10887 @opindex gctf
10888 Request CTF debug information and use level to specify how much CTF debug
10889 information should be produced.  If @option{-gctf} is specified
10890 without a value for level, the default level of CTF debug information is 2.
10892 CTF debug information can be generated along with DWARF debug information when
10893 both of the debug formats are enabled explicitly via their respective command
10894 line options.
10896 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
10897 negates @option{-gctf}.
10899 Level 1 produces CTF information for tracebacks only.  This includes callsite
10900 information, but does not include type information.
10902 Level 2 produces type information for entities (functions, data objects etc.)
10903 at file-scope or global-scope only.
10905 @item -gvms
10906 @opindex gvms
10907 Produce debugging information in Alpha/VMS debug format (if that is
10908 supported).  This is the format used by DEBUG on Alpha/VMS systems.
10910 @item -g@var{level}
10911 @itemx -ggdb@var{level}
10912 @itemx -gvms@var{level}
10913 Request debugging information and also use @var{level} to specify how
10914 much information.  The default level is 2.
10916 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
10917 @option{-g}.
10919 Level 1 produces minimal information, enough for making backtraces in
10920 parts of the program that you don't plan to debug.  This includes
10921 descriptions of functions and external variables, and line number
10922 tables, but no information about local variables.
10924 Level 3 includes extra information, such as all the macro definitions
10925 present in the program.  Some debuggers support macro expansion when
10926 you use @option{-g3}.
10928 If you use multiple @option{-g} options, with or without level numbers,
10929 the last such option is the one that is effective.
10931 @option{-gdwarf} does not accept a concatenated debug level, to avoid
10932 confusion with @option{-gdwarf-@var{level}}.
10933 Instead use an additional @option{-g@var{level}} option to change the
10934 debug level for DWARF.
10936 @item -fno-eliminate-unused-debug-symbols
10937 @opindex feliminate-unused-debug-symbols
10938 @opindex fno-eliminate-unused-debug-symbols
10939 By default, no debug information is produced for symbols that are not actually
10940 used. Use this option if you want debug information for all symbols.
10942 @item -femit-class-debug-always
10943 @opindex femit-class-debug-always
10944 Instead of emitting debugging information for a C++ class in only one
10945 object file, emit it in all object files using the class.  This option
10946 should be used only with debuggers that are unable to handle the way GCC
10947 normally emits debugging information for classes because using this
10948 option increases the size of debugging information by as much as a
10949 factor of two.
10951 @item -fno-merge-debug-strings
10952 @opindex fmerge-debug-strings
10953 @opindex fno-merge-debug-strings
10954 Direct the linker to not merge together strings in the debugging
10955 information that are identical in different object files.  Merging is
10956 not supported by all assemblers or linkers.  Merging decreases the size
10957 of the debug information in the output file at the cost of increasing
10958 link processing time.  Merging is enabled by default.
10960 @item -fdebug-prefix-map=@var{old}=@var{new}
10961 @opindex fdebug-prefix-map
10962 When compiling files residing in directory @file{@var{old}}, record
10963 debugging information describing them as if the files resided in
10964 directory @file{@var{new}} instead.  This can be used to replace a
10965 build-time path with an install-time path in the debug info.  It can
10966 also be used to change an absolute path to a relative path by using
10967 @file{.} for @var{new}.  This can give more reproducible builds, which
10968 are location independent, but may require an extra command to tell GDB
10969 where to find the source files. See also @option{-ffile-prefix-map}.
10971 @item -fvar-tracking
10972 @opindex fvar-tracking
10973 Run variable tracking pass.  It computes where variables are stored at each
10974 position in code.  Better debugging information is then generated
10975 (if the debugging information format supports this information).
10977 It is enabled by default when compiling with optimization (@option{-Os},
10978 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
10979 the debug info format supports it.
10981 @item -fvar-tracking-assignments
10982 @opindex fvar-tracking-assignments
10983 @opindex fno-var-tracking-assignments
10984 Annotate assignments to user variables early in the compilation and
10985 attempt to carry the annotations over throughout the compilation all the
10986 way to the end, in an attempt to improve debug information while
10987 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
10989 It can be enabled even if var-tracking is disabled, in which case
10990 annotations are created and maintained, but discarded at the end.
10991 By default, this flag is enabled together with @option{-fvar-tracking},
10992 except when selective scheduling is enabled.
10994 @item -gsplit-dwarf
10995 @opindex gsplit-dwarf
10996 If DWARF debugging information is enabled, separate as much debugging
10997 information as possible into a separate output file with the extension
10998 @file{.dwo}.  This option allows the build system to avoid linking files with
10999 debug information.  To be useful, this option requires a debugger capable of
11000 reading @file{.dwo} files.
11002 @item -gdwarf32
11003 @itemx -gdwarf64
11004 @opindex gdwarf32
11005 @opindex gdwarf64
11006 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11007 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11008 DWARF format.  The default is target specific, on most targets it is
11009 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
11010 can't support more than 2GiB of debug information in any of the DWARF
11011 debug information sections.  The 64-bit DWARF format allows larger debug
11012 information and might not be well supported by all consumers yet.
11014 @item -gdescribe-dies
11015 @opindex gdescribe-dies
11016 Add description attributes to some DWARF DIEs that have no name attribute,
11017 such as artificial variables, external references and call site
11018 parameter DIEs.
11020 @item -gpubnames
11021 @opindex gpubnames
11022 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11024 @item -ggnu-pubnames
11025 @opindex ggnu-pubnames
11026 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11027 suitable for conversion into a GDB@ index.  This option is only useful
11028 with a linker that can produce GDB@ index version 7.
11030 @item -fdebug-types-section
11031 @opindex fdebug-types-section
11032 @opindex fno-debug-types-section
11033 When using DWARF Version 4 or higher, type DIEs can be put into
11034 their own @code{.debug_types} section instead of making them part of the
11035 @code{.debug_info} section.  It is more efficient to put them in a separate
11036 comdat section since the linker can then remove duplicates.
11037 But not all DWARF consumers support @code{.debug_types} sections yet
11038 and on some objects @code{.debug_types} produces larger instead of smaller
11039 debugging information.
11041 @item -grecord-gcc-switches
11042 @itemx -gno-record-gcc-switches
11043 @opindex grecord-gcc-switches
11044 @opindex gno-record-gcc-switches
11045 This switch causes the command-line options used to invoke the
11046 compiler that may affect code generation to be appended to the
11047 DW_AT_producer attribute in DWARF debugging information.  The options
11048 are concatenated with spaces separating them from each other and from
11049 the compiler version.  
11050 It is enabled by default.
11051 See also @option{-frecord-gcc-switches} for another
11052 way of storing compiler options into the object file.  
11054 @item -gstrict-dwarf
11055 @opindex gstrict-dwarf
11056 Disallow using extensions of later DWARF standard version than selected
11057 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
11058 DWARF extensions from later standard versions is allowed.
11060 @item -gno-strict-dwarf
11061 @opindex gno-strict-dwarf
11062 Allow using extensions of later DWARF standard version than selected with
11063 @option{-gdwarf-@var{version}}.
11065 @item -gas-loc-support
11066 @opindex gas-loc-support
11067 Inform the compiler that the assembler supports @code{.loc} directives.
11068 It may then use them for the assembler to generate DWARF2+ line number
11069 tables.
11071 This is generally desirable, because assembler-generated line-number
11072 tables are a lot more compact than those the compiler can generate
11073 itself.
11075 This option will be enabled by default if, at GCC configure time, the
11076 assembler was found to support such directives.
11078 @item -gno-as-loc-support
11079 @opindex gno-as-loc-support
11080 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11081 line number tables are to be generated.
11083 @item -gas-locview-support
11084 @opindex gas-locview-support
11085 Inform the compiler that the assembler supports @code{view} assignment
11086 and reset assertion checking in @code{.loc} directives.
11088 This option will be enabled by default if, at GCC configure time, the
11089 assembler was found to support them.
11091 @item -gno-as-locview-support
11092 Force GCC to assign view numbers internally, if
11093 @option{-gvariable-location-views} are explicitly requested.
11095 @item -gcolumn-info
11096 @itemx -gno-column-info
11097 @opindex gcolumn-info
11098 @opindex gno-column-info
11099 Emit location column information into DWARF debugging information, rather
11100 than just file and line.
11101 This option is enabled by default.
11103 @item -gstatement-frontiers
11104 @itemx -gno-statement-frontiers
11105 @opindex gstatement-frontiers
11106 @opindex gno-statement-frontiers
11107 This option causes GCC to create markers in the internal representation
11108 at the beginning of statements, and to keep them roughly in place
11109 throughout compilation, using them to guide the output of @code{is_stmt}
11110 markers in the line number table.  This is enabled by default when
11111 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11112 @dots{}), and outputting DWARF 2 debug information at the normal level.
11114 @item -gvariable-location-views
11115 @itemx -gvariable-location-views=incompat5
11116 @itemx -gno-variable-location-views
11117 @opindex gvariable-location-views
11118 @opindex gvariable-location-views=incompat5
11119 @opindex gno-variable-location-views
11120 Augment variable location lists with progressive view numbers implied
11121 from the line number table.  This enables debug information consumers to
11122 inspect state at certain points of the program, even if no instructions
11123 associated with the corresponding source locations are present at that
11124 point.  If the assembler lacks support for view numbers in line number
11125 tables, this will cause the compiler to emit the line number table,
11126 which generally makes them somewhat less compact.  The augmented line
11127 number tables and location lists are fully backward-compatible, so they
11128 can be consumed by debug information consumers that are not aware of
11129 these augmentations, but they won't derive any benefit from them either.
11131 This is enabled by default when outputting DWARF 2 debug information at
11132 the normal level, as long as there is assembler support,
11133 @option{-fvar-tracking-assignments} is enabled and
11134 @option{-gstrict-dwarf} is not.  When assembler support is not
11135 available, this may still be enabled, but it will force GCC to output
11136 internal line number tables, and if
11137 @option{-ginternal-reset-location-views} is not enabled, that will most
11138 certainly lead to silently mismatching location views.
11140 There is a proposed representation for view numbers that is not backward
11141 compatible with the location list format introduced in DWARF 5, that can
11142 be enabled with @option{-gvariable-location-views=incompat5}.  This
11143 option may be removed in the future, is only provided as a reference
11144 implementation of the proposed representation.  Debug information
11145 consumers are not expected to support this extended format, and they
11146 would be rendered unable to decode location lists using it.
11148 @item -ginternal-reset-location-views
11149 @itemx -gno-internal-reset-location-views
11150 @opindex ginternal-reset-location-views
11151 @opindex gno-internal-reset-location-views
11152 Attempt to determine location views that can be omitted from location
11153 view lists.  This requires the compiler to have very accurate insn
11154 length estimates, which isn't always the case, and it may cause
11155 incorrect view lists to be generated silently when using an assembler
11156 that does not support location view lists.  The GNU assembler will flag
11157 any such error as a @code{view number mismatch}.  This is only enabled
11158 on ports that define a reliable estimation function.
11160 @item -ginline-points
11161 @itemx -gno-inline-points
11162 @opindex ginline-points
11163 @opindex gno-inline-points
11164 Generate extended debug information for inlined functions.  Location
11165 view tracking markers are inserted at inlined entry points, so that
11166 address and view numbers can be computed and output in debug
11167 information.  This can be enabled independently of location views, in
11168 which case the view numbers won't be output, but it can only be enabled
11169 along with statement frontiers, and it is only enabled by default if
11170 location views are enabled.
11172 @item -gz@r{[}=@var{type}@r{]}
11173 @opindex gz
11174 Produce compressed debug sections in DWARF format, if that is supported.
11175 If @var{type} is not given, the default type depends on the capabilities
11176 of the assembler and linker used.  @var{type} may be one of
11177 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11178 compression in ELF gABI format).  If the linker doesn't support writing
11179 compressed debug sections, the option is rejected.  Otherwise, if the
11180 assembler does not support them, @option{-gz} is silently ignored when
11181 producing object files.
11183 @item -femit-struct-debug-baseonly
11184 @opindex femit-struct-debug-baseonly
11185 Emit debug information for struct-like types
11186 only when the base name of the compilation source file
11187 matches the base name of file in which the struct is defined.
11189 This option substantially reduces the size of debugging information,
11190 but at significant potential loss in type information to the debugger.
11191 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11192 See @option{-femit-struct-debug-detailed} for more detailed control.
11194 This option works only with DWARF debug output.
11196 @item -femit-struct-debug-reduced
11197 @opindex femit-struct-debug-reduced
11198 Emit debug information for struct-like types
11199 only when the base name of the compilation source file
11200 matches the base name of file in which the type is defined,
11201 unless the struct is a template or defined in a system header.
11203 This option significantly reduces the size of debugging information,
11204 with some potential loss in type information to the debugger.
11205 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11206 See @option{-femit-struct-debug-detailed} for more detailed control.
11208 This option works only with DWARF debug output.
11210 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11211 @opindex femit-struct-debug-detailed
11212 Specify the struct-like types
11213 for which the compiler generates debug information.
11214 The intent is to reduce duplicate struct debug information
11215 between different object files within the same program.
11217 This option is a detailed version of
11218 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11219 which serves for most needs.
11221 A specification has the syntax@*
11222 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11224 The optional first word limits the specification to
11225 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11226 A struct type is used directly when it is the type of a variable, member.
11227 Indirect uses arise through pointers to structs.
11228 That is, when use of an incomplete struct is valid, the use is indirect.
11229 An example is
11230 @samp{struct one direct; struct two * indirect;}.
11232 The optional second word limits the specification to
11233 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11234 Generic structs are a bit complicated to explain.
11235 For C++, these are non-explicit specializations of template classes,
11236 or non-template classes within the above.
11237 Other programming languages have generics,
11238 but @option{-femit-struct-debug-detailed} does not yet implement them.
11240 The third word specifies the source files for those
11241 structs for which the compiler should emit debug information.
11242 The values @samp{none} and @samp{any} have the normal meaning.
11243 The value @samp{base} means that
11244 the base of name of the file in which the type declaration appears
11245 must match the base of the name of the main compilation file.
11246 In practice, this means that when compiling @file{foo.c}, debug information
11247 is generated for types declared in that file and @file{foo.h},
11248 but not other header files.
11249 The value @samp{sys} means those types satisfying @samp{base}
11250 or declared in system or compiler headers.
11252 You may need to experiment to determine the best settings for your application.
11254 The default is @option{-femit-struct-debug-detailed=all}.
11256 This option works only with DWARF debug output.
11258 @item -fno-dwarf2-cfi-asm
11259 @opindex fdwarf2-cfi-asm
11260 @opindex fno-dwarf2-cfi-asm
11261 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11262 instead of using GAS @code{.cfi_*} directives.
11264 @item -fno-eliminate-unused-debug-types
11265 @opindex feliminate-unused-debug-types
11266 @opindex fno-eliminate-unused-debug-types
11267 Normally, when producing DWARF output, GCC avoids producing debug symbol 
11268 output for types that are nowhere used in the source file being compiled.
11269 Sometimes it is useful to have GCC emit debugging
11270 information for all types declared in a compilation
11271 unit, regardless of whether or not they are actually used
11272 in that compilation unit, for example 
11273 if, in the debugger, you want to cast a value to a type that is
11274 not actually used in your program (but is declared).  More often,
11275 however, this results in a significant amount of wasted space.
11276 @end table
11278 @node Optimize Options
11279 @section Options That Control Optimization
11280 @cindex optimize options
11281 @cindex options, optimization
11283 These options control various sorts of optimizations.
11285 Without any optimization option, the compiler's goal is to reduce the
11286 cost of compilation and to make debugging produce the expected
11287 results.  Statements are independent: if you stop the program with a
11288 breakpoint between statements, you can then assign a new value to any
11289 variable or change the program counter to any other statement in the
11290 function and get exactly the results you expect from the source
11291 code.
11293 Turning on optimization flags makes the compiler attempt to improve
11294 the performance and/or code size at the expense of compilation time
11295 and possibly the ability to debug the program.
11297 The compiler performs optimization based on the knowledge it has of the
11298 program.  Compiling multiple files at once to a single output file mode allows
11299 the compiler to use information gained from all of the files when compiling
11300 each of them.
11302 Not all optimizations are controlled directly by a flag.  Only
11303 optimizations that have a flag are listed in this section.
11305 Most optimizations are completely disabled at @option{-O0} or if an
11306 @option{-O} level is not set on the command line, even if individual
11307 optimization flags are specified.  Similarly, @option{-Og} suppresses
11308 many optimization passes.
11310 Depending on the target and how GCC was configured, a slightly different
11311 set of optimizations may be enabled at each @option{-O} level than
11312 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
11313 to find out the exact set of optimizations that are enabled at each level.
11314 @xref{Overall Options}, for examples.
11316 @table @gcctabopt
11317 @item -O
11318 @itemx -O1
11319 @opindex O
11320 @opindex O1
11321 Optimize.  Optimizing compilation takes somewhat more time, and a lot
11322 more memory for a large function.
11324 With @option{-O}, the compiler tries to reduce code size and execution
11325 time, without performing any optimizations that take a great deal of
11326 compilation time.
11328 @c Note that in addition to the default_options_table list in opts.cc,
11329 @c several optimization flags default to true but control optimization
11330 @c passes that are explicitly disabled at -O0.
11332 @option{-O} turns on the following optimization flags:
11334 @c Please keep the following list alphabetized.
11335 @gccoptlist{-fauto-inc-dec @gol
11336 -fbranch-count-reg @gol
11337 -fcombine-stack-adjustments @gol
11338 -fcompare-elim @gol
11339 -fcprop-registers @gol
11340 -fdce @gol
11341 -fdefer-pop @gol
11342 -fdelayed-branch @gol
11343 -fdse @gol
11344 -fforward-propagate @gol
11345 -fguess-branch-probability @gol
11346 -fif-conversion @gol
11347 -fif-conversion2 @gol
11348 -finline-functions-called-once @gol
11349 -fipa-modref @gol
11350 -fipa-profile @gol
11351 -fipa-pure-const @gol
11352 -fipa-reference @gol
11353 -fipa-reference-addressable @gol
11354 -fmerge-constants @gol
11355 -fmove-loop-invariants @gol
11356 -fmove-loop-stores@gol
11357 -fomit-frame-pointer @gol
11358 -freorder-blocks @gol
11359 -fshrink-wrap @gol
11360 -fshrink-wrap-separate @gol
11361 -fsplit-wide-types @gol
11362 -fssa-backprop @gol
11363 -fssa-phiopt @gol
11364 -ftree-bit-ccp @gol
11365 -ftree-ccp @gol
11366 -ftree-ch @gol
11367 -ftree-coalesce-vars @gol
11368 -ftree-copy-prop @gol
11369 -ftree-dce @gol
11370 -ftree-dominator-opts @gol
11371 -ftree-dse @gol
11372 -ftree-forwprop @gol
11373 -ftree-fre @gol
11374 -ftree-phiprop @gol
11375 -ftree-pta @gol
11376 -ftree-scev-cprop @gol
11377 -ftree-sink @gol
11378 -ftree-slsr @gol
11379 -ftree-sra @gol
11380 -ftree-ter @gol
11381 -funit-at-a-time}
11383 @item -O2
11384 @opindex O2
11385 Optimize even more.  GCC performs nearly all supported optimizations
11386 that do not involve a space-speed tradeoff.
11387 As compared to @option{-O}, this option increases both compilation time
11388 and the performance of the generated code.
11390 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
11391 also turns on the following optimization flags:
11393 @c Please keep the following list alphabetized!
11394 @gccoptlist{-falign-functions  -falign-jumps @gol
11395 -falign-labels  -falign-loops @gol
11396 -fcaller-saves @gol
11397 -fcode-hoisting @gol
11398 -fcrossjumping @gol
11399 -fcse-follow-jumps  -fcse-skip-blocks @gol
11400 -fdelete-null-pointer-checks @gol
11401 -fdevirtualize  -fdevirtualize-speculatively @gol
11402 -fexpensive-optimizations @gol
11403 -ffinite-loops @gol
11404 -fgcse  -fgcse-lm  @gol
11405 -fhoist-adjacent-loads @gol
11406 -finline-functions @gol
11407 -finline-small-functions @gol
11408 -findirect-inlining @gol
11409 -fipa-bit-cp  -fipa-cp  -fipa-icf @gol
11410 -fipa-ra  -fipa-sra  -fipa-vrp @gol
11411 -fisolate-erroneous-paths-dereference @gol
11412 -flra-remat @gol
11413 -foptimize-sibling-calls @gol
11414 -foptimize-strlen @gol
11415 -fpartial-inlining @gol
11416 -fpeephole2 @gol
11417 -freorder-blocks-algorithm=stc @gol
11418 -freorder-blocks-and-partition  -freorder-functions @gol
11419 -frerun-cse-after-loop  @gol
11420 -fschedule-insns  -fschedule-insns2 @gol
11421 -fsched-interblock  -fsched-spec @gol
11422 -fstore-merging @gol
11423 -fstrict-aliasing @gol
11424 -fthread-jumps @gol
11425 -ftree-builtin-call-dce @gol
11426 -ftree-loop-vectorize @gol
11427 -ftree-pre @gol
11428 -ftree-slp-vectorize @gol
11429 -ftree-switch-conversion  -ftree-tail-merge @gol
11430 -ftree-vrp @gol
11431 -fvect-cost-model=very-cheap}
11433 Please note the warning under @option{-fgcse} about
11434 invoking @option{-O2} on programs that use computed gotos.
11436 @item -O3
11437 @opindex O3
11438 Optimize yet more.  @option{-O3} turns on all optimizations specified
11439 by @option{-O2} and also turns on the following optimization flags:
11441 @c Please keep the following list alphabetized!
11442 @gccoptlist{-fgcse-after-reload @gol
11443 -fipa-cp-clone
11444 -floop-interchange @gol
11445 -floop-unroll-and-jam @gol
11446 -fpeel-loops @gol
11447 -fpredictive-commoning @gol
11448 -fsplit-loops @gol
11449 -fsplit-paths @gol
11450 -ftree-loop-distribution @gol
11451 -ftree-partial-pre @gol
11452 -funswitch-loops @gol
11453 -fvect-cost-model=dynamic @gol
11454 -fversion-loops-for-strides}
11456 @item -O0
11457 @opindex O0
11458 Reduce compilation time and make debugging produce the expected
11459 results.  This is the default.
11461 @item -Os
11462 @opindex Os
11463 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
11464 except those that often increase code size:
11466 @gccoptlist{-falign-functions  -falign-jumps @gol
11467 -falign-labels  -falign-loops @gol
11468 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
11470 It also enables @option{-finline-functions}, causes the compiler to tune for
11471 code size rather than execution speed, and performs further optimizations
11472 designed to reduce code size.
11474 @item -Ofast
11475 @opindex Ofast
11476 Disregard strict standards compliance.  @option{-Ofast} enables all
11477 @option{-O3} optimizations.  It also enables optimizations that are not
11478 valid for all standard-compliant programs.
11479 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
11480 and the Fortran-specific @option{-fstack-arrays}, unless
11481 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
11482 It turns off @option{-fsemantic-interposition}.
11484 @item -Og
11485 @opindex Og
11486 Optimize debugging experience.  @option{-Og} should be the optimization
11487 level of choice for the standard edit-compile-debug cycle, offering
11488 a reasonable level of optimization while maintaining fast compilation
11489 and a good debugging experience.  It is a better choice than @option{-O0}
11490 for producing debuggable code because some compiler passes
11491 that collect debug information are disabled at @option{-O0}.
11493 Like @option{-O0}, @option{-Og} completely disables a number of 
11494 optimization passes so that individual options controlling them have
11495 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
11496 optimization flags except for those that may interfere with debugging:
11498 @gccoptlist{-fbranch-count-reg  -fdelayed-branch @gol
11499 -fdse  -fif-conversion  -fif-conversion2  @gol
11500 -finline-functions-called-once @gol
11501 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt @gol
11502 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
11504 @item -Oz
11505 @opindex Oz
11506 Optimize aggressively for size rather than speed.  This may increase
11507 the number of instructions executed if those instructions require
11508 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
11509 including enabling most @option{-O2} optimizations.
11511 @end table
11513 If you use multiple @option{-O} options, with or without level numbers,
11514 the last such option is the one that is effective.
11516 Options of the form @option{-f@var{flag}} specify machine-independent
11517 flags.  Most flags have both positive and negative forms; the negative
11518 form of @option{-ffoo} is @option{-fno-foo}.  In the table
11519 below, only one of the forms is listed---the one you typically 
11520 use.  You can figure out the other form by either removing @samp{no-}
11521 or adding it.
11523 The following options control specific optimizations.  They are either
11524 activated by @option{-O} options or are related to ones that are.  You
11525 can use the following flags in the rare cases when ``fine-tuning'' of
11526 optimizations to be performed is desired.
11528 @table @gcctabopt
11529 @item -fno-defer-pop
11530 @opindex fno-defer-pop
11531 @opindex fdefer-pop
11532 For machines that must pop arguments after a function call, always pop 
11533 the arguments as soon as each function returns.  
11534 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
11535 this allows the compiler to let arguments accumulate on the stack for several
11536 function calls and pop them all at once.
11538 @item -fforward-propagate
11539 @opindex fforward-propagate
11540 Perform a forward propagation pass on RTL@.  The pass tries to combine two
11541 instructions and checks if the result can be simplified.  If loop unrolling
11542 is active, two passes are performed and the second is scheduled after
11543 loop unrolling.
11545 This option is enabled by default at optimization levels @option{-O1},
11546 @option{-O2}, @option{-O3}, @option{-Os}.
11548 @item -ffp-contract=@var{style}
11549 @opindex ffp-contract
11550 @option{-ffp-contract=off} disables floating-point expression contraction.
11551 @option{-ffp-contract=fast} enables floating-point expression contraction
11552 such as forming of fused multiply-add operations if the target has
11553 native support for them.
11554 @option{-ffp-contract=on} enables floating-point expression contraction
11555 if allowed by the language standard.  This is currently not implemented
11556 and treated equal to @option{-ffp-contract=off}.
11558 The default is @option{-ffp-contract=fast}.
11560 @item -fomit-frame-pointer
11561 @opindex fomit-frame-pointer
11562 Omit the frame pointer in functions that don't need one.  This avoids the
11563 instructions to save, set up and restore the frame pointer; on many targets
11564 it also makes an extra register available.
11566 On some targets this flag has no effect because the standard calling sequence
11567 always uses a frame pointer, so it cannot be omitted.
11569 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
11570 is used in all functions.  Several targets always omit the frame pointer in
11571 leaf functions.
11573 Enabled by default at @option{-O1} and higher.
11575 @item -foptimize-sibling-calls
11576 @opindex foptimize-sibling-calls
11577 Optimize sibling and tail recursive calls.
11579 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11581 @item -foptimize-strlen
11582 @opindex foptimize-strlen
11583 Optimize various standard C string functions (e.g.@: @code{strlen},
11584 @code{strchr} or @code{strcpy}) and
11585 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
11587 Enabled at levels @option{-O2}, @option{-O3}.
11589 @item -fno-inline
11590 @opindex fno-inline
11591 @opindex finline
11592 Do not expand any functions inline apart from those marked with
11593 the @code{always_inline} attribute.  This is the default when not
11594 optimizing.
11596 Single functions can be exempted from inlining by marking them
11597 with the @code{noinline} attribute.
11599 @item -finline-small-functions
11600 @opindex finline-small-functions
11601 Integrate functions into their callers when their body is smaller than expected
11602 function call code (so overall size of program gets smaller).  The compiler
11603 heuristically decides which functions are simple enough to be worth integrating
11604 in this way.  This inlining applies to all functions, even those not declared
11605 inline.
11607 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11609 @item -findirect-inlining
11610 @opindex findirect-inlining
11611 Inline also indirect calls that are discovered to be known at compile
11612 time thanks to previous inlining.  This option has any effect only
11613 when inlining itself is turned on by the @option{-finline-functions}
11614 or @option{-finline-small-functions} options.
11616 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11618 @item -finline-functions
11619 @opindex finline-functions
11620 Consider all functions for inlining, even if they are not declared inline.
11621 The compiler heuristically decides which functions are worth integrating
11622 in this way.
11624 If all calls to a given function are integrated, and the function is
11625 declared @code{static}, then the function is normally not output as
11626 assembler code in its own right.
11628 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
11629 by @option{-fprofile-use} and @option{-fauto-profile}.
11631 @item -finline-functions-called-once
11632 @opindex finline-functions-called-once
11633 Consider all @code{static} functions called once for inlining into their
11634 caller even if they are not marked @code{inline}.  If a call to a given
11635 function is integrated, then the function is not output as assembler code
11636 in its own right.
11638 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
11639 but not @option{-Og}.
11641 @item -fearly-inlining
11642 @opindex fearly-inlining
11643 Inline functions marked by @code{always_inline} and functions whose body seems
11644 smaller than the function call overhead early before doing
11645 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
11646 makes profiling significantly cheaper and usually inlining faster on programs
11647 having large chains of nested wrapper functions.
11649 Enabled by default.
11651 @item -fipa-sra
11652 @opindex fipa-sra
11653 Perform interprocedural scalar replacement of aggregates, removal of
11654 unused parameters and replacement of parameters passed by reference
11655 by parameters passed by value.
11657 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
11659 @item -finline-limit=@var{n}
11660 @opindex finline-limit
11661 By default, GCC limits the size of functions that can be inlined.  This flag
11662 allows coarse control of this limit.  @var{n} is the size of functions that
11663 can be inlined in number of pseudo instructions.
11665 Inlining is actually controlled by a number of parameters, which may be
11666 specified individually by using @option{--param @var{name}=@var{value}}.
11667 The @option{-finline-limit=@var{n}} option sets some of these parameters
11668 as follows:
11670 @table @gcctabopt
11671 @item max-inline-insns-single
11672 is set to @var{n}/2.
11673 @item max-inline-insns-auto
11674 is set to @var{n}/2.
11675 @end table
11677 See below for a documentation of the individual
11678 parameters controlling inlining and for the defaults of these parameters.
11680 @emph{Note:} there may be no value to @option{-finline-limit} that results
11681 in default behavior.
11683 @emph{Note:} pseudo instruction represents, in this particular context, an
11684 abstract measurement of function's size.  In no way does it represent a count
11685 of assembly instructions and as such its exact meaning might change from one
11686 release to an another.
11688 @item -fno-keep-inline-dllexport
11689 @opindex fno-keep-inline-dllexport
11690 @opindex fkeep-inline-dllexport
11691 This is a more fine-grained version of @option{-fkeep-inline-functions},
11692 which applies only to functions that are declared using the @code{dllexport}
11693 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
11694 Functions}.
11696 @item -fkeep-inline-functions
11697 @opindex fkeep-inline-functions
11698 In C, emit @code{static} functions that are declared @code{inline}
11699 into the object file, even if the function has been inlined into all
11700 of its callers.  This switch does not affect functions using the
11701 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
11702 inline functions into the object file.
11704 @item -fkeep-static-functions
11705 @opindex fkeep-static-functions
11706 Emit @code{static} functions into the object file, even if the function
11707 is never used.
11709 @item -fkeep-static-consts
11710 @opindex fkeep-static-consts
11711 Emit variables declared @code{static const} when optimization isn't turned
11712 on, even if the variables aren't referenced.
11714 GCC enables this option by default.  If you want to force the compiler to
11715 check if a variable is referenced, regardless of whether or not
11716 optimization is turned on, use the @option{-fno-keep-static-consts} option.
11718 @item -fmerge-constants
11719 @opindex fmerge-constants
11720 Attempt to merge identical constants (string constants and floating-point
11721 constants) across compilation units.
11723 This option is the default for optimized compilation if the assembler and
11724 linker support it.  Use @option{-fno-merge-constants} to inhibit this
11725 behavior.
11727 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
11729 @item -fmerge-all-constants
11730 @opindex fmerge-all-constants
11731 Attempt to merge identical constants and identical variables.
11733 This option implies @option{-fmerge-constants}.  In addition to
11734 @option{-fmerge-constants} this considers e.g.@: even constant initialized
11735 arrays or initialized constant variables with integral or floating-point
11736 types.  Languages like C or C++ require each variable, including multiple
11737 instances of the same variable in recursive calls, to have distinct locations,
11738 so using this option results in non-conforming
11739 behavior.
11741 @item -fmodulo-sched
11742 @opindex fmodulo-sched
11743 Perform swing modulo scheduling immediately before the first scheduling
11744 pass.  This pass looks at innermost loops and reorders their
11745 instructions by overlapping different iterations.
11747 @item -fmodulo-sched-allow-regmoves
11748 @opindex fmodulo-sched-allow-regmoves
11749 Perform more aggressive SMS-based modulo scheduling with register moves
11750 allowed.  By setting this flag certain anti-dependences edges are
11751 deleted, which triggers the generation of reg-moves based on the
11752 life-range analysis.  This option is effective only with
11753 @option{-fmodulo-sched} enabled.
11755 @item -fno-branch-count-reg
11756 @opindex fno-branch-count-reg
11757 @opindex fbranch-count-reg
11758 Disable the optimization pass that scans for opportunities to use 
11759 ``decrement and branch'' instructions on a count register instead of
11760 instruction sequences that decrement a register, compare it against zero, and
11761 then branch based upon the result.  This option is only meaningful on
11762 architectures that support such instructions, which include x86, PowerPC,
11763 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
11764 doesn't remove the decrement and branch instructions from the generated
11765 instruction stream introduced by other optimization passes.
11767 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
11768 except for @option{-Og}.
11770 @item -fno-function-cse
11771 @opindex fno-function-cse
11772 @opindex ffunction-cse
11773 Do not put function addresses in registers; make each instruction that
11774 calls a constant function contain the function's address explicitly.
11776 This option results in less efficient code, but some strange hacks
11777 that alter the assembler output may be confused by the optimizations
11778 performed when this option is not used.
11780 The default is @option{-ffunction-cse}
11782 @item -fno-zero-initialized-in-bss
11783 @opindex fno-zero-initialized-in-bss
11784 @opindex fzero-initialized-in-bss
11785 If the target supports a BSS section, GCC by default puts variables that
11786 are initialized to zero into BSS@.  This can save space in the resulting
11787 code.
11789 This option turns off this behavior because some programs explicitly
11790 rely on variables going to the data section---e.g., so that the
11791 resulting executable can find the beginning of that section and/or make
11792 assumptions based on that.
11794 The default is @option{-fzero-initialized-in-bss}.
11796 @item -fthread-jumps
11797 @opindex fthread-jumps
11798 Perform optimizations that check to see if a jump branches to a
11799 location where another comparison subsumed by the first is found.  If
11800 so, the first branch is redirected to either the destination of the
11801 second branch or a point immediately following it, depending on whether
11802 the condition is known to be true or false.
11804 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
11806 @item -fsplit-wide-types
11807 @opindex fsplit-wide-types
11808 When using a type that occupies multiple registers, such as @code{long
11809 long} on a 32-bit system, split the registers apart and allocate them
11810 independently.  This normally generates better code for those types,
11811 but may make debugging more difficult.
11813 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
11814 @option{-Os}.
11816 @item -fsplit-wide-types-early
11817 @opindex fsplit-wide-types-early
11818 Fully split wide types early, instead of very late.
11819 This option has no effect unless @option{-fsplit-wide-types} is turned on.
11821 This is the default on some targets.
11823 @item -fcse-follow-jumps
11824 @opindex fcse-follow-jumps
11825 In common subexpression elimination (CSE), scan through jump instructions
11826 when the target of the jump is not reached by any other path.  For
11827 example, when CSE encounters an @code{if} statement with an
11828 @code{else} clause, CSE follows the jump when the condition
11829 tested is false.
11831 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11833 @item -fcse-skip-blocks
11834 @opindex fcse-skip-blocks
11835 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
11836 follow jumps that conditionally skip over blocks.  When CSE
11837 encounters a simple @code{if} statement with no else clause,
11838 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
11839 body of the @code{if}.
11841 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11843 @item -frerun-cse-after-loop
11844 @opindex frerun-cse-after-loop
11845 Re-run common subexpression elimination after loop optimizations are
11846 performed.
11848 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11850 @item -fgcse
11851 @opindex fgcse
11852 Perform a global common subexpression elimination pass.
11853 This pass also performs global constant and copy propagation.
11855 @emph{Note:} When compiling a program using computed gotos, a GCC
11856 extension, you may get better run-time performance if you disable
11857 the global common subexpression elimination pass by adding
11858 @option{-fno-gcse} to the command line.
11860 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11862 @item -fgcse-lm
11863 @opindex fgcse-lm
11864 When @option{-fgcse-lm} is enabled, global common subexpression elimination
11865 attempts to move loads that are only killed by stores into themselves.  This
11866 allows a loop containing a load/store sequence to be changed to a load outside
11867 the loop, and a copy/store within the loop.
11869 Enabled by default when @option{-fgcse} is enabled.
11871 @item -fgcse-sm
11872 @opindex fgcse-sm
11873 When @option{-fgcse-sm} is enabled, a store motion pass is run after
11874 global common subexpression elimination.  This pass attempts to move
11875 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
11876 loops containing a load/store sequence can be changed to a load before
11877 the loop and a store after the loop.
11879 Not enabled at any optimization level.
11881 @item -fgcse-las
11882 @opindex fgcse-las
11883 When @option{-fgcse-las} is enabled, the global common subexpression
11884 elimination pass eliminates redundant loads that come after stores to the
11885 same memory location (both partial and full redundancies).
11887 Not enabled at any optimization level.
11889 @item -fgcse-after-reload
11890 @opindex fgcse-after-reload
11891 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
11892 pass is performed after reload.  The purpose of this pass is to clean up
11893 redundant spilling.
11895 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
11897 @item -faggressive-loop-optimizations
11898 @opindex faggressive-loop-optimizations
11899 This option tells the loop optimizer to use language constraints to
11900 derive bounds for the number of iterations of a loop.  This assumes that
11901 loop code does not invoke undefined behavior by for example causing signed
11902 integer overflows or out-of-bound array accesses.  The bounds for the
11903 number of iterations of a loop are used to guide loop unrolling and peeling
11904 and loop exit test optimizations.
11905 This option is enabled by default.
11907 @item -funconstrained-commons
11908 @opindex funconstrained-commons
11909 This option tells the compiler that variables declared in common blocks
11910 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
11911 prevents certain optimizations that depend on knowing the array bounds.
11913 @item -fcrossjumping
11914 @opindex fcrossjumping
11915 Perform cross-jumping transformation.
11916 This transformation unifies equivalent code and saves code size.  The
11917 resulting code may or may not perform better than without cross-jumping.
11919 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11921 @item -fauto-inc-dec
11922 @opindex fauto-inc-dec
11923 Combine increments or decrements of addresses with memory accesses.
11924 This pass is always skipped on architectures that do not have
11925 instructions to support this.  Enabled by default at @option{-O1} and
11926 higher on architectures that support this.
11928 @item -fdce
11929 @opindex fdce
11930 Perform dead code elimination (DCE) on RTL@.
11931 Enabled by default at @option{-O1} and higher.
11933 @item -fdse
11934 @opindex fdse
11935 Perform dead store elimination (DSE) on RTL@.
11936 Enabled by default at @option{-O1} and higher.
11938 @item -fif-conversion
11939 @opindex fif-conversion
11940 Attempt to transform conditional jumps into branch-less equivalents.  This
11941 includes use of conditional moves, min, max, set flags and abs instructions, and
11942 some tricks doable by standard arithmetics.  The use of conditional execution
11943 on chips where it is available is controlled by @option{-fif-conversion2}.
11945 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
11946 not with @option{-Og}.
11948 @item -fif-conversion2
11949 @opindex fif-conversion2
11950 Use conditional execution (where available) to transform conditional jumps into
11951 branch-less equivalents.
11953 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
11954 not with @option{-Og}.
11956 @item -fdeclone-ctor-dtor
11957 @opindex fdeclone-ctor-dtor
11958 The C++ ABI requires multiple entry points for constructors and
11959 destructors: one for a base subobject, one for a complete object, and
11960 one for a virtual destructor that calls operator delete afterwards.
11961 For a hierarchy with virtual bases, the base and complete variants are
11962 clones, which means two copies of the function.  With this option, the
11963 base and complete variants are changed to be thunks that call a common
11964 implementation.
11966 Enabled by @option{-Os}.
11968 @item -fdelete-null-pointer-checks
11969 @opindex fdelete-null-pointer-checks
11970 Assume that programs cannot safely dereference null pointers, and that
11971 no code or data element resides at address zero.
11972 This option enables simple constant
11973 folding optimizations at all optimization levels.  In addition, other
11974 optimization passes in GCC use this flag to control global dataflow
11975 analyses that eliminate useless checks for null pointers; these assume
11976 that a memory access to address zero always results in a trap, so
11977 that if a pointer is checked after it has already been dereferenced,
11978 it cannot be null.
11980 Note however that in some environments this assumption is not true.
11981 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
11982 for programs that depend on that behavior.
11984 This option is enabled by default on most targets.  On Nios II ELF, it
11985 defaults to off.  On AVR and MSP430, this option is completely disabled.
11987 Passes that use the dataflow information
11988 are enabled independently at different optimization levels.
11990 @item -fdevirtualize
11991 @opindex fdevirtualize
11992 Attempt to convert calls to virtual functions to direct calls.  This
11993 is done both within a procedure and interprocedurally as part of
11994 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
11995 propagation (@option{-fipa-cp}).
11996 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11998 @item -fdevirtualize-speculatively
11999 @opindex fdevirtualize-speculatively
12000 Attempt to convert calls to virtual functions to speculative direct calls.
12001 Based on the analysis of the type inheritance graph, determine for a given call
12002 the set of likely targets. If the set is small, preferably of size 1, change
12003 the call into a conditional deciding between direct and indirect calls.  The
12004 speculative calls enable more optimizations, such as inlining.  When they seem
12005 useless after further optimization, they are converted back into original form.
12007 @item -fdevirtualize-at-ltrans
12008 @opindex fdevirtualize-at-ltrans
12009 Stream extra information needed for aggressive devirtualization when running
12010 the link-time optimizer in local transformation mode.  
12011 This option enables more devirtualization but
12012 significantly increases the size of streamed data. For this reason it is
12013 disabled by default.
12015 @item -fexpensive-optimizations
12016 @opindex fexpensive-optimizations
12017 Perform a number of minor optimizations that are relatively expensive.
12019 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12021 @item -free
12022 @opindex free
12023 Attempt to remove redundant extension instructions.  This is especially
12024 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12025 registers after writing to their lower 32-bit half.
12027 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
12028 @option{-O3}, @option{-Os}.
12030 @item -fno-lifetime-dse
12031 @opindex fno-lifetime-dse
12032 @opindex flifetime-dse
12033 In C++ the value of an object is only affected by changes within its
12034 lifetime: when the constructor begins, the object has an indeterminate
12035 value, and any changes during the lifetime of the object are dead when
12036 the object is destroyed.  Normally dead store elimination will take
12037 advantage of this; if your code relies on the value of the object
12038 storage persisting beyond the lifetime of the object, you can use this
12039 flag to disable this optimization.  To preserve stores before the
12040 constructor starts (e.g.@: because your operator new clears the object
12041 storage) but still treat the object as dead after the destructor, you
12042 can use @option{-flifetime-dse=1}.  The default behavior can be
12043 explicitly selected with @option{-flifetime-dse=2}.
12044 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12046 @item -flive-range-shrinkage
12047 @opindex flive-range-shrinkage
12048 Attempt to decrease register pressure through register live range
12049 shrinkage.  This is helpful for fast processors with small or moderate
12050 size register sets.
12052 @item -fira-algorithm=@var{algorithm}
12053 @opindex fira-algorithm
12054 Use the specified coloring algorithm for the integrated register
12055 allocator.  The @var{algorithm} argument can be @samp{priority}, which
12056 specifies Chow's priority coloring, or @samp{CB}, which specifies
12057 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
12058 for all architectures, but for those targets that do support it, it is
12059 the default because it generates better code.
12061 @item -fira-region=@var{region}
12062 @opindex fira-region
12063 Use specified regions for the integrated register allocator.  The
12064 @var{region} argument should be one of the following:
12066 @table @samp
12068 @item all
12069 Use all loops as register allocation regions.
12070 This can give the best results for machines with a small and/or
12071 irregular register set.
12073 @item mixed
12074 Use all loops except for loops with small register pressure 
12075 as the regions.  This value usually gives
12076 the best results in most cases and for most architectures,
12077 and is enabled by default when compiling with optimization for speed
12078 (@option{-O}, @option{-O2}, @dots{}).
12080 @item one
12081 Use all functions as a single region.  
12082 This typically results in the smallest code size, and is enabled by default for
12083 @option{-Os} or @option{-O0}.
12085 @end table
12087 @item -fira-hoist-pressure
12088 @opindex fira-hoist-pressure
12089 Use IRA to evaluate register pressure in the code hoisting pass for
12090 decisions to hoist expressions.  This option usually results in smaller
12091 code, but it can slow the compiler down.
12093 This option is enabled at level @option{-Os} for all targets.
12095 @item -fira-loop-pressure
12096 @opindex fira-loop-pressure
12097 Use IRA to evaluate register pressure in loops for decisions to move
12098 loop invariants.  This option usually results in generation
12099 of faster and smaller code on machines with large register files (>= 32
12100 registers), but it can slow the compiler down.
12102 This option is enabled at level @option{-O3} for some targets.
12104 @item -fno-ira-share-save-slots
12105 @opindex fno-ira-share-save-slots
12106 @opindex fira-share-save-slots
12107 Disable sharing of stack slots used for saving call-used hard
12108 registers living through a call.  Each hard register gets a
12109 separate stack slot, and as a result function stack frames are
12110 larger.
12112 @item -fno-ira-share-spill-slots
12113 @opindex fno-ira-share-spill-slots
12114 @opindex fira-share-spill-slots
12115 Disable sharing of stack slots allocated for pseudo-registers.  Each
12116 pseudo-register that does not get a hard register gets a separate
12117 stack slot, and as a result function stack frames are larger.
12119 @item -flra-remat
12120 @opindex flra-remat
12121 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
12122 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12123 values if it is profitable.
12125 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12127 @item -fdelayed-branch
12128 @opindex fdelayed-branch
12129 If supported for the target machine, attempt to reorder instructions
12130 to exploit instruction slots available after delayed branch
12131 instructions.
12133 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12134 but not at @option{-Og}.
12136 @item -fschedule-insns
12137 @opindex fschedule-insns
12138 If supported for the target machine, attempt to reorder instructions to
12139 eliminate execution stalls due to required data being unavailable.  This
12140 helps machines that have slow floating point or memory load instructions
12141 by allowing other instructions to be issued until the result of the load
12142 or floating-point instruction is required.
12144 Enabled at levels @option{-O2}, @option{-O3}.
12146 @item -fschedule-insns2
12147 @opindex fschedule-insns2
12148 Similar to @option{-fschedule-insns}, but requests an additional pass of
12149 instruction scheduling after register allocation has been done.  This is
12150 especially useful on machines with a relatively small number of
12151 registers and where memory load instructions take more than one cycle.
12153 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12155 @item -fno-sched-interblock
12156 @opindex fno-sched-interblock
12157 @opindex fsched-interblock
12158 Disable instruction scheduling across basic blocks, which
12159 is normally enabled when scheduling before register allocation, i.e.@:
12160 with @option{-fschedule-insns} or at @option{-O2} or higher.
12162 @item -fno-sched-spec
12163 @opindex fno-sched-spec
12164 @opindex fsched-spec
12165 Disable speculative motion of non-load instructions, which
12166 is normally enabled when scheduling before register allocation, i.e.@:
12167 with @option{-fschedule-insns} or at @option{-O2} or higher.
12169 @item -fsched-pressure
12170 @opindex fsched-pressure
12171 Enable register pressure sensitive insn scheduling before register
12172 allocation.  This only makes sense when scheduling before register
12173 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12174 @option{-O2} or higher.  Usage of this option can improve the
12175 generated code and decrease its size by preventing register pressure
12176 increase above the number of available hard registers and subsequent
12177 spills in register allocation.
12179 @item -fsched-spec-load
12180 @opindex fsched-spec-load
12181 Allow speculative motion of some load instructions.  This only makes
12182 sense when scheduling before register allocation, i.e.@: with
12183 @option{-fschedule-insns} or at @option{-O2} or higher.
12185 @item -fsched-spec-load-dangerous
12186 @opindex fsched-spec-load-dangerous
12187 Allow speculative motion of more load instructions.  This only makes
12188 sense when scheduling before register allocation, i.e.@: with
12189 @option{-fschedule-insns} or at @option{-O2} or higher.
12191 @item -fsched-stalled-insns
12192 @itemx -fsched-stalled-insns=@var{n}
12193 @opindex fsched-stalled-insns
12194 Define how many insns (if any) can be moved prematurely from the queue
12195 of stalled insns into the ready list during the second scheduling pass.
12196 @option{-fno-sched-stalled-insns} means that no insns are moved
12197 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12198 on how many queued insns can be moved prematurely.
12199 @option{-fsched-stalled-insns} without a value is equivalent to
12200 @option{-fsched-stalled-insns=1}.
12202 @item -fsched-stalled-insns-dep
12203 @itemx -fsched-stalled-insns-dep=@var{n}
12204 @opindex fsched-stalled-insns-dep
12205 Define how many insn groups (cycles) are examined for a dependency
12206 on a stalled insn that is a candidate for premature removal from the queue
12207 of stalled insns.  This has an effect only during the second scheduling pass,
12208 and only if @option{-fsched-stalled-insns} is used.
12209 @option{-fno-sched-stalled-insns-dep} is equivalent to
12210 @option{-fsched-stalled-insns-dep=0}.
12211 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12212 @option{-fsched-stalled-insns-dep=1}.
12214 @item -fsched2-use-superblocks
12215 @opindex fsched2-use-superblocks
12216 When scheduling after register allocation, use superblock scheduling.
12217 This allows motion across basic block boundaries,
12218 resulting in faster schedules.  This option is experimental, as not all machine
12219 descriptions used by GCC model the CPU closely enough to avoid unreliable
12220 results from the algorithm.
12222 This only makes sense when scheduling after register allocation, i.e.@: with
12223 @option{-fschedule-insns2} or at @option{-O2} or higher.
12225 @item -fsched-group-heuristic
12226 @opindex fsched-group-heuristic
12227 Enable the group heuristic in the scheduler.  This heuristic favors
12228 the instruction that belongs to a schedule group.  This is enabled
12229 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12230 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12232 @item -fsched-critical-path-heuristic
12233 @opindex fsched-critical-path-heuristic
12234 Enable the critical-path heuristic in the scheduler.  This heuristic favors
12235 instructions on the critical path.  This is enabled by default when
12236 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12237 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12239 @item -fsched-spec-insn-heuristic
12240 @opindex fsched-spec-insn-heuristic
12241 Enable the speculative instruction heuristic in the scheduler.  This
12242 heuristic favors speculative instructions with greater dependency weakness.
12243 This is enabled by default when scheduling is enabled, i.e.@:
12244 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12245 or at @option{-O2} or higher.
12247 @item -fsched-rank-heuristic
12248 @opindex fsched-rank-heuristic
12249 Enable the rank heuristic in the scheduler.  This heuristic favors
12250 the instruction belonging to a basic block with greater size or frequency.
12251 This is enabled by default when scheduling is enabled, i.e.@:
12252 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12253 at @option{-O2} or higher.
12255 @item -fsched-last-insn-heuristic
12256 @opindex fsched-last-insn-heuristic
12257 Enable the last-instruction heuristic in the scheduler.  This heuristic
12258 favors the instruction that is less dependent on the last instruction
12259 scheduled.  This is enabled by default when scheduling is enabled,
12260 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12261 at @option{-O2} or higher.
12263 @item -fsched-dep-count-heuristic
12264 @opindex fsched-dep-count-heuristic
12265 Enable the dependent-count heuristic in the scheduler.  This heuristic
12266 favors the instruction that has more instructions depending on it.
12267 This is enabled by default when scheduling is enabled, i.e.@:
12268 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12269 at @option{-O2} or higher.
12271 @item -freschedule-modulo-scheduled-loops
12272 @opindex freschedule-modulo-scheduled-loops
12273 Modulo scheduling is performed before traditional scheduling.  If a loop
12274 is modulo scheduled, later scheduling passes may change its schedule.  
12275 Use this option to control that behavior.
12277 @item -fselective-scheduling
12278 @opindex fselective-scheduling
12279 Schedule instructions using selective scheduling algorithm.  Selective
12280 scheduling runs instead of the first scheduler pass.
12282 @item -fselective-scheduling2
12283 @opindex fselective-scheduling2
12284 Schedule instructions using selective scheduling algorithm.  Selective
12285 scheduling runs instead of the second scheduler pass.
12287 @item -fsel-sched-pipelining
12288 @opindex fsel-sched-pipelining
12289 Enable software pipelining of innermost loops during selective scheduling.
12290 This option has no effect unless one of @option{-fselective-scheduling} or
12291 @option{-fselective-scheduling2} is turned on.
12293 @item -fsel-sched-pipelining-outer-loops
12294 @opindex fsel-sched-pipelining-outer-loops
12295 When pipelining loops during selective scheduling, also pipeline outer loops.
12296 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
12298 @item -fsemantic-interposition
12299 @opindex fsemantic-interposition
12300 Some object formats, like ELF, allow interposing of symbols by the 
12301 dynamic linker.
12302 This means that for symbols exported from the DSO, the compiler cannot perform
12303 interprocedural propagation, inlining and other optimizations in anticipation
12304 that the function or variable in question may change. While this feature is
12305 useful, for example, to rewrite memory allocation functions by a debugging
12306 implementation, it is expensive in the terms of code quality.
12307 With @option{-fno-semantic-interposition} the compiler assumes that 
12308 if interposition happens for functions the overwriting function will have 
12309 precisely the same semantics (and side effects). 
12310 Similarly if interposition happens
12311 for variables, the constructor of the variable will be the same. The flag
12312 has no effect for functions explicitly declared inline 
12313 (where it is never allowed for interposition to change semantics) 
12314 and for symbols explicitly declared weak.
12316 @item -fshrink-wrap
12317 @opindex fshrink-wrap
12318 Emit function prologues only before parts of the function that need it,
12319 rather than at the top of the function.  This flag is enabled by default at
12320 @option{-O} and higher.
12322 @item -fshrink-wrap-separate
12323 @opindex fshrink-wrap-separate
12324 Shrink-wrap separate parts of the prologue and epilogue separately, so that
12325 those parts are only executed when needed.
12326 This option is on by default, but has no effect unless @option{-fshrink-wrap}
12327 is also turned on and the target supports this.
12329 @item -fcaller-saves
12330 @opindex fcaller-saves
12331 Enable allocation of values to registers that are clobbered by
12332 function calls, by emitting extra instructions to save and restore the
12333 registers around such calls.  Such allocation is done only when it
12334 seems to result in better code.
12336 This option is always enabled by default on certain machines, usually
12337 those which have no call-preserved registers to use instead.
12339 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12341 @item -fcombine-stack-adjustments
12342 @opindex fcombine-stack-adjustments
12343 Tracks stack adjustments (pushes and pops) and stack memory references
12344 and then tries to find ways to combine them.
12346 Enabled by default at @option{-O1} and higher.
12348 @item -fipa-ra
12349 @opindex fipa-ra
12350 Use caller save registers for allocation if those registers are not used by
12351 any called function.  In that case it is not necessary to save and restore
12352 them around calls.  This is only possible if called functions are part of
12353 same compilation unit as current function and they are compiled before it.
12355 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
12356 is disabled if generated code will be instrumented for profiling
12357 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
12358 exactly (this happens on targets that do not expose prologues
12359 and epilogues in RTL).
12361 @item -fconserve-stack
12362 @opindex fconserve-stack
12363 Attempt to minimize stack usage.  The compiler attempts to use less
12364 stack space, even if that makes the program slower.  This option
12365 implies setting the @option{large-stack-frame} parameter to 100
12366 and the @option{large-stack-frame-growth} parameter to 400.
12368 @item -ftree-reassoc
12369 @opindex ftree-reassoc
12370 Perform reassociation on trees.  This flag is enabled by default
12371 at @option{-O1} and higher.
12373 @item -fcode-hoisting
12374 @opindex fcode-hoisting
12375 Perform code hoisting.  Code hoisting tries to move the
12376 evaluation of expressions executed on all paths to the function exit
12377 as early as possible.  This is especially useful as a code size
12378 optimization, but it often helps for code speed as well.
12379 This flag is enabled by default at @option{-O2} and higher.
12381 @item -ftree-pre
12382 @opindex ftree-pre
12383 Perform partial redundancy elimination (PRE) on trees.  This flag is
12384 enabled by default at @option{-O2} and @option{-O3}.
12386 @item -ftree-partial-pre
12387 @opindex ftree-partial-pre
12388 Make partial redundancy elimination (PRE) more aggressive.  This flag is
12389 enabled by default at @option{-O3}.
12391 @item -ftree-forwprop
12392 @opindex ftree-forwprop
12393 Perform forward propagation on trees.  This flag is enabled by default
12394 at @option{-O1} and higher.
12396 @item -ftree-fre
12397 @opindex ftree-fre
12398 Perform full redundancy elimination (FRE) on trees.  The difference
12399 between FRE and PRE is that FRE only considers expressions
12400 that are computed on all paths leading to the redundant computation.
12401 This analysis is faster than PRE, though it exposes fewer redundancies.
12402 This flag is enabled by default at @option{-O1} and higher.
12404 @item -ftree-phiprop
12405 @opindex ftree-phiprop
12406 Perform hoisting of loads from conditional pointers on trees.  This
12407 pass is enabled by default at @option{-O1} and higher.
12409 @item -fhoist-adjacent-loads
12410 @opindex fhoist-adjacent-loads
12411 Speculatively hoist loads from both branches of an if-then-else if the
12412 loads are from adjacent locations in the same structure and the target
12413 architecture has a conditional move instruction.  This flag is enabled
12414 by default at @option{-O2} and higher.
12416 @item -ftree-copy-prop
12417 @opindex ftree-copy-prop
12418 Perform copy propagation on trees.  This pass eliminates unnecessary
12419 copy operations.  This flag is enabled by default at @option{-O1} and
12420 higher.
12422 @item -fipa-pure-const
12423 @opindex fipa-pure-const
12424 Discover which functions are pure or constant.
12425 Enabled by default at @option{-O1} and higher.
12427 @item -fipa-reference
12428 @opindex fipa-reference
12429 Discover which static variables do not escape the
12430 compilation unit.
12431 Enabled by default at @option{-O1} and higher.
12433 @item -fipa-reference-addressable
12434 @opindex fipa-reference-addressable
12435 Discover read-only, write-only and non-addressable static variables.
12436 Enabled by default at @option{-O1} and higher.
12438 @item -fipa-stack-alignment
12439 @opindex fipa-stack-alignment
12440 Reduce stack alignment on call sites if possible.
12441 Enabled by default.
12443 @item -fipa-pta
12444 @opindex fipa-pta
12445 Perform interprocedural pointer analysis and interprocedural modification
12446 and reference analysis.  This option can cause excessive memory and
12447 compile-time usage on large compilation units.  It is not enabled by
12448 default at any optimization level.
12450 @item -fipa-profile
12451 @opindex fipa-profile
12452 Perform interprocedural profile propagation.  The functions called only from
12453 cold functions are marked as cold. Also functions executed once (such as
12454 @code{cold}, @code{noreturn}, static constructors or destructors) are
12455 identified. Cold functions and loop less parts of functions executed once are
12456 then optimized for size.
12457 Enabled by default at @option{-O1} and higher.
12459 @item -fipa-modref
12460 @opindex fipa-modref
12461 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
12462 effects of functions (memory locations that are modified or referenced) and
12463 enables better optimization across the function call boundary.  This flag is
12464 enabled by default at @option{-O1} and higher.
12466 @item -fipa-cp
12467 @opindex fipa-cp
12468 Perform interprocedural constant propagation.
12469 This optimization analyzes the program to determine when values passed
12470 to functions are constants and then optimizes accordingly.
12471 This optimization can substantially increase performance
12472 if the application has constants passed to functions.
12473 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
12474 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12476 @item -fipa-cp-clone
12477 @opindex fipa-cp-clone
12478 Perform function cloning to make interprocedural constant propagation stronger.
12479 When enabled, interprocedural constant propagation performs function cloning
12480 when externally visible function can be called with constant arguments.
12481 Because this optimization can create multiple copies of functions,
12482 it may significantly increase code size
12483 (see @option{--param ipa-cp-unit-growth=@var{value}}).
12484 This flag is enabled by default at @option{-O3}.
12485 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12487 @item -fipa-bit-cp
12488 @opindex fipa-bit-cp
12489 When enabled, perform interprocedural bitwise constant
12490 propagation. This flag is enabled by default at @option{-O2} and
12491 by @option{-fprofile-use} and @option{-fauto-profile}.
12492 It requires that @option{-fipa-cp} is enabled.  
12494 @item -fipa-vrp
12495 @opindex fipa-vrp
12496 When enabled, perform interprocedural propagation of value
12497 ranges. This flag is enabled by default at @option{-O2}. It requires
12498 that @option{-fipa-cp} is enabled.
12500 @item -fipa-icf
12501 @opindex fipa-icf
12502 Perform Identical Code Folding for functions and read-only variables.
12503 The optimization reduces code size and may disturb unwind stacks by replacing
12504 a function by equivalent one with a different name. The optimization works
12505 more effectively with link-time optimization enabled.
12507 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
12508 works on different levels and thus the optimizations are not same - there are
12509 equivalences that are found only by GCC and equivalences found only by Gold.
12511 This flag is enabled by default at @option{-O2} and @option{-Os}.
12513 @item -flive-patching=@var{level}
12514 @opindex flive-patching
12515 Control GCC's optimizations to produce output suitable for live-patching.
12517 If the compiler's optimization uses a function's body or information extracted
12518 from its body to optimize/change another function, the latter is called an
12519 impacted function of the former.  If a function is patched, its impacted
12520 functions should be patched too.
12522 The impacted functions are determined by the compiler's interprocedural
12523 optimizations.  For example, a caller is impacted when inlining a function
12524 into its caller,
12525 cloning a function and changing its caller to call this new clone,
12526 or extracting a function's pureness/constness information to optimize
12527 its direct or indirect callers, etc.
12529 Usually, the more IPA optimizations enabled, the larger the number of
12530 impacted functions for each function.  In order to control the number of
12531 impacted functions and more easily compute the list of impacted function,
12532 IPA optimizations can be partially enabled at two different levels.
12534 The @var{level} argument should be one of the following:
12536 @table @samp
12538 @item inline-clone
12540 Only enable inlining and cloning optimizations, which includes inlining,
12541 cloning, interprocedural scalar replacement of aggregates and partial inlining.
12542 As a result, when patching a function, all its callers and its clones'
12543 callers are impacted, therefore need to be patched as well.
12545 @option{-flive-patching=inline-clone} disables the following optimization flags:
12546 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra @gol
12547 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables @gol
12548 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const  -fipa-reference-addressable @gol
12549 -fipa-stack-alignment -fipa-modref}
12551 @item inline-only-static
12553 Only enable inlining of static functions.
12554 As a result, when patching a static function, all its callers are impacted
12555 and so need to be patched as well.
12557 In addition to all the flags that @option{-flive-patching=inline-clone}
12558 disables,
12559 @option{-flive-patching=inline-only-static} disables the following additional
12560 optimization flags:
12561 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
12563 @end table
12565 When @option{-flive-patching} is specified without any value, the default value
12566 is @var{inline-clone}.
12568 This flag is disabled by default.
12570 Note that @option{-flive-patching} is not supported with link-time optimization
12571 (@option{-flto}).
12573 @item -fisolate-erroneous-paths-dereference
12574 @opindex fisolate-erroneous-paths-dereference
12575 Detect paths that trigger erroneous or undefined behavior due to
12576 dereferencing a null pointer.  Isolate those paths from the main control
12577 flow and turn the statement with erroneous or undefined behavior into a trap.
12578 This flag is enabled by default at @option{-O2} and higher and depends on
12579 @option{-fdelete-null-pointer-checks} also being enabled.
12581 @item -fisolate-erroneous-paths-attribute
12582 @opindex fisolate-erroneous-paths-attribute
12583 Detect paths that trigger erroneous or undefined behavior due to a null value
12584 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
12585 attribute.  Isolate those paths from the main control flow and turn the
12586 statement with erroneous or undefined behavior into a trap.  This is not
12587 currently enabled, but may be enabled by @option{-O2} in the future.
12589 @item -ftree-sink
12590 @opindex ftree-sink
12591 Perform forward store motion on trees.  This flag is
12592 enabled by default at @option{-O1} and higher.
12594 @item -ftree-bit-ccp
12595 @opindex ftree-bit-ccp
12596 Perform sparse conditional bit constant propagation on trees and propagate
12597 pointer alignment information.
12598 This pass only operates on local scalar variables and is enabled by default
12599 at @option{-O1} and higher, except for @option{-Og}.
12600 It requires that @option{-ftree-ccp} is enabled.
12602 @item -ftree-ccp
12603 @opindex ftree-ccp
12604 Perform sparse conditional constant propagation (CCP) on trees.  This
12605 pass only operates on local scalar variables and is enabled by default
12606 at @option{-O1} and higher.
12608 @item -fssa-backprop
12609 @opindex fssa-backprop
12610 Propagate information about uses of a value up the definition chain
12611 in order to simplify the definitions.  For example, this pass strips
12612 sign operations if the sign of a value never matters.  The flag is
12613 enabled by default at @option{-O1} and higher.
12615 @item -fssa-phiopt
12616 @opindex fssa-phiopt
12617 Perform pattern matching on SSA PHI nodes to optimize conditional
12618 code.  This pass is enabled by default at @option{-O1} and higher,
12619 except for @option{-Og}.
12621 @item -ftree-switch-conversion
12622 @opindex ftree-switch-conversion
12623 Perform conversion of simple initializations in a switch to
12624 initializations from a scalar array.  This flag is enabled by default
12625 at @option{-O2} and higher.
12627 @item -ftree-tail-merge
12628 @opindex ftree-tail-merge
12629 Look for identical code sequences.  When found, replace one with a jump to the
12630 other.  This optimization is known as tail merging or cross jumping.  This flag
12631 is enabled by default at @option{-O2} and higher.  The compilation time
12632 in this pass can
12633 be limited using @option{max-tail-merge-comparisons} parameter and
12634 @option{max-tail-merge-iterations} parameter.
12636 @item -ftree-dce
12637 @opindex ftree-dce
12638 Perform dead code elimination (DCE) on trees.  This flag is enabled by
12639 default at @option{-O1} and higher.
12641 @item -ftree-builtin-call-dce
12642 @opindex ftree-builtin-call-dce
12643 Perform conditional dead code elimination (DCE) for calls to built-in functions
12644 that may set @code{errno} but are otherwise free of side effects.  This flag is
12645 enabled by default at @option{-O2} and higher if @option{-Os} is not also
12646 specified.
12648 @item -ffinite-loops
12649 @opindex ffinite-loops
12650 @opindex fno-finite-loops
12651 Assume that a loop with an exit will eventually take the exit and not loop
12652 indefinitely.  This allows the compiler to remove loops that otherwise have
12653 no side-effects, not considering eventual endless looping as such.
12655 This option is enabled by default at @option{-O2} for C++ with -std=c++11
12656 or higher.
12658 @item -ftree-dominator-opts
12659 @opindex ftree-dominator-opts
12660 Perform a variety of simple scalar cleanups (constant/copy
12661 propagation, redundancy elimination, range propagation and expression
12662 simplification) based on a dominator tree traversal.  This also
12663 performs jump threading (to reduce jumps to jumps). This flag is
12664 enabled by default at @option{-O1} and higher.
12666 @item -ftree-dse
12667 @opindex ftree-dse
12668 Perform dead store elimination (DSE) on trees.  A dead store is a store into
12669 a memory location that is later overwritten by another store without
12670 any intervening loads.  In this case the earlier store can be deleted.  This
12671 flag is enabled by default at @option{-O1} and higher.
12673 @item -ftree-ch
12674 @opindex ftree-ch
12675 Perform loop header copying on trees.  This is beneficial since it increases
12676 effectiveness of code motion optimizations.  It also saves one jump.  This flag
12677 is enabled by default at @option{-O1} and higher.  It is not enabled
12678 for @option{-Os}, since it usually increases code size.
12680 @item -ftree-loop-optimize
12681 @opindex ftree-loop-optimize
12682 Perform loop optimizations on trees.  This flag is enabled by default
12683 at @option{-O1} and higher.
12685 @item -ftree-loop-linear
12686 @itemx -floop-strip-mine
12687 @itemx -floop-block
12688 @opindex ftree-loop-linear
12689 @opindex floop-strip-mine
12690 @opindex floop-block
12691 Perform loop nest optimizations.  Same as
12692 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
12693 to be configured with @option{--with-isl} to enable the Graphite loop
12694 transformation infrastructure.
12696 @item -fgraphite-identity
12697 @opindex fgraphite-identity
12698 Enable the identity transformation for graphite.  For every SCoP we generate
12699 the polyhedral representation and transform it back to gimple.  Using
12700 @option{-fgraphite-identity} we can check the costs or benefits of the
12701 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
12702 are also performed by the code generator isl, like index splitting and
12703 dead code elimination in loops.
12705 @item -floop-nest-optimize
12706 @opindex floop-nest-optimize
12707 Enable the isl based loop nest optimizer.  This is a generic loop nest
12708 optimizer based on the Pluto optimization algorithms.  It calculates a loop
12709 structure optimized for data-locality and parallelism.  This option
12710 is experimental.
12712 @item -floop-parallelize-all
12713 @opindex floop-parallelize-all
12714 Use the Graphite data dependence analysis to identify loops that can
12715 be parallelized.  Parallelize all the loops that can be analyzed to
12716 not contain loop carried dependences without checking that it is
12717 profitable to parallelize the loops.
12719 @item -ftree-coalesce-vars
12720 @opindex ftree-coalesce-vars
12721 While transforming the program out of the SSA representation, attempt to
12722 reduce copying by coalescing versions of different user-defined
12723 variables, instead of just compiler temporaries.  This may severely
12724 limit the ability to debug an optimized program compiled with
12725 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
12726 prevents SSA coalescing of user variables.  This option is enabled by
12727 default if optimization is enabled, and it does very little otherwise.
12729 @item -ftree-loop-if-convert
12730 @opindex ftree-loop-if-convert
12731 Attempt to transform conditional jumps in the innermost loops to
12732 branch-less equivalents.  The intent is to remove control-flow from
12733 the innermost loops in order to improve the ability of the
12734 vectorization pass to handle these loops.  This is enabled by default
12735 if vectorization is enabled.
12737 @item -ftree-loop-distribution
12738 @opindex ftree-loop-distribution
12739 Perform loop distribution.  This flag can improve cache performance on
12740 big loop bodies and allow further loop optimizations, like
12741 parallelization or vectorization, to take place.  For example, the loop
12742 @smallexample
12743 DO I = 1, N
12744   A(I) = B(I) + C
12745   D(I) = E(I) * F
12746 ENDDO
12747 @end smallexample
12748 is transformed to
12749 @smallexample
12750 DO I = 1, N
12751    A(I) = B(I) + C
12752 ENDDO
12753 DO I = 1, N
12754    D(I) = E(I) * F
12755 ENDDO
12756 @end smallexample
12757 This flag is enabled by default at @option{-O3}.
12758 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12760 @item -ftree-loop-distribute-patterns
12761 @opindex ftree-loop-distribute-patterns
12762 Perform loop distribution of patterns that can be code generated with
12763 calls to a library.  This flag is enabled by default at @option{-O2} and
12764 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
12766 This pass distributes the initialization loops and generates a call to
12767 memset zero.  For example, the loop
12768 @smallexample
12769 DO I = 1, N
12770   A(I) = 0
12771   B(I) = A(I) + I
12772 ENDDO
12773 @end smallexample
12774 is transformed to
12775 @smallexample
12776 DO I = 1, N
12777    A(I) = 0
12778 ENDDO
12779 DO I = 1, N
12780    B(I) = A(I) + I
12781 ENDDO
12782 @end smallexample
12783 and the initialization loop is transformed into a call to memset zero.
12784 This flag is enabled by default at @option{-O3}.
12785 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12787 @item -floop-interchange
12788 @opindex floop-interchange
12789 Perform loop interchange outside of graphite.  This flag can improve cache
12790 performance on loop nest and allow further loop optimizations, like
12791 vectorization, to take place.  For example, the loop
12792 @smallexample
12793 for (int i = 0; i < N; i++)
12794   for (int j = 0; j < N; j++)
12795     for (int k = 0; k < N; k++)
12796       c[i][j] = c[i][j] + a[i][k]*b[k][j];
12797 @end smallexample
12798 is transformed to
12799 @smallexample
12800 for (int i = 0; i < N; i++)
12801   for (int k = 0; k < N; k++)
12802     for (int j = 0; j < N; j++)
12803       c[i][j] = c[i][j] + a[i][k]*b[k][j];
12804 @end smallexample
12805 This flag is enabled by default at @option{-O3}.
12806 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12808 @item -floop-unroll-and-jam
12809 @opindex floop-unroll-and-jam
12810 Apply unroll and jam transformations on feasible loops.  In a loop
12811 nest this unrolls the outer loop by some factor and fuses the resulting
12812 multiple inner loops.  This flag is enabled by default at @option{-O3}.
12813 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12815 @item -ftree-loop-im
12816 @opindex ftree-loop-im
12817 Perform loop invariant motion on trees.  This pass moves only invariants that
12818 are hard to handle at RTL level (function calls, operations that expand to
12819 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
12820 operands of conditions that are invariant out of the loop, so that we can use
12821 just trivial invariantness analysis in loop unswitching.  The pass also includes
12822 store motion.
12824 @item -ftree-loop-ivcanon
12825 @opindex ftree-loop-ivcanon
12826 Create a canonical counter for number of iterations in loops for which
12827 determining number of iterations requires complicated analysis.  Later
12828 optimizations then may determine the number easily.  Useful especially
12829 in connection with unrolling.
12831 @item -ftree-scev-cprop
12832 @opindex ftree-scev-cprop
12833 Perform final value replacement.  If a variable is modified in a loop
12834 in such a way that its value when exiting the loop can be determined using
12835 only its initial value and the number of loop iterations, replace uses of
12836 the final value by such a computation, provided it is sufficiently cheap.
12837 This reduces data dependencies and may allow further simplifications.
12838 Enabled by default at @option{-O1} and higher.
12840 @item -fivopts
12841 @opindex fivopts
12842 Perform induction variable optimizations (strength reduction, induction
12843 variable merging and induction variable elimination) on trees.
12845 @item -ftree-parallelize-loops=n
12846 @opindex ftree-parallelize-loops
12847 Parallelize loops, i.e., split their iteration space to run in n threads.
12848 This is only possible for loops whose iterations are independent
12849 and can be arbitrarily reordered.  The optimization is only
12850 profitable on multiprocessor machines, for loops that are CPU-intensive,
12851 rather than constrained e.g.@: by memory bandwidth.  This option
12852 implies @option{-pthread}, and thus is only supported on targets
12853 that have support for @option{-pthread}.
12855 @item -ftree-pta
12856 @opindex ftree-pta
12857 Perform function-local points-to analysis on trees.  This flag is
12858 enabled by default at @option{-O1} and higher, except for @option{-Og}.
12860 @item -ftree-sra
12861 @opindex ftree-sra
12862 Perform scalar replacement of aggregates.  This pass replaces structure
12863 references with scalars to prevent committing structures to memory too
12864 early.  This flag is enabled by default at @option{-O1} and higher,
12865 except for @option{-Og}.
12867 @item -fstore-merging
12868 @opindex fstore-merging
12869 Perform merging of narrow stores to consecutive memory addresses.  This pass
12870 merges contiguous stores of immediate values narrower than a word into fewer
12871 wider stores to reduce the number of instructions.  This is enabled by default
12872 at @option{-O2} and higher as well as @option{-Os}.
12874 @item -ftree-ter
12875 @opindex ftree-ter
12876 Perform temporary expression replacement during the SSA->normal phase.  Single
12877 use/single def temporaries are replaced at their use location with their
12878 defining expression.  This results in non-GIMPLE code, but gives the expanders
12879 much more complex trees to work on resulting in better RTL generation.  This is
12880 enabled by default at @option{-O1} and higher.
12882 @item -ftree-slsr
12883 @opindex ftree-slsr
12884 Perform straight-line strength reduction on trees.  This recognizes related
12885 expressions involving multiplications and replaces them by less expensive
12886 calculations when possible.  This is enabled by default at @option{-O1} and
12887 higher.
12889 @item -ftree-vectorize
12890 @opindex ftree-vectorize
12891 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
12892 and @option{-ftree-slp-vectorize} if not explicitly specified.
12894 @item -ftree-loop-vectorize
12895 @opindex ftree-loop-vectorize
12896 Perform loop vectorization on trees. This flag is enabled by default at
12897 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
12898 and @option{-fauto-profile}.
12900 @item -ftree-slp-vectorize
12901 @opindex ftree-slp-vectorize
12902 Perform basic block vectorization on trees. This flag is enabled by default at
12903 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
12904 and @option{-fauto-profile}.
12906 @item -ftrivial-auto-var-init=@var{choice}
12907 @opindex ftrivial-auto-var-init
12908 Initialize automatic variables with either a pattern or with zeroes to increase
12909 the security and predictability of a program by preventing uninitialized memory
12910 disclosure and use.
12911 GCC still considers an automatic variable that doesn't have an explicit
12912 initializer as uninitialized, @option{-Wuninitialized} and
12913 @option{-Wanalyzer-use-of-uninitialized-value} will still report
12914 warning messages on such automatic variables.
12915 With this option, GCC will also initialize any padding of automatic variables
12916 that have structure or union types to zeroes.
12917 However, the current implementation cannot initialize automatic variables that
12918 are declared between the controlling expression and the first case of a
12919 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
12920 such cases.
12922 The three values of @var{choice} are:
12924 @itemize @bullet
12925 @item
12926 @samp{uninitialized} doesn't initialize any automatic variables.
12927 This is C and C++'s default.
12929 @item
12930 @samp{pattern} Initialize automatic variables with values which will likely
12931 transform logic bugs into crashes down the line, are easily recognized in a
12932 crash dump and without being values that programmers can rely on for useful
12933 program semantics.
12934 The current value is byte-repeatable pattern with byte "0xFE".
12935 The values used for pattern initialization might be changed in the future.
12937 @item
12938 @samp{zero} Initialize automatic variables with zeroes.
12939 @end itemize
12941 The default is @samp{uninitialized}.
12943 You can control this behavior for a specific variable by using the variable
12944 attribute @code{uninitialized} (@pxref{Variable Attributes}).
12946 @item -fvect-cost-model=@var{model}
12947 @opindex fvect-cost-model
12948 Alter the cost model used for vectorization.  The @var{model} argument
12949 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
12950 @samp{very-cheap}.
12951 With the @samp{unlimited} model the vectorized code-path is assumed
12952 to be profitable while with the @samp{dynamic} model a runtime check
12953 guards the vectorized code-path to enable it only for iteration
12954 counts that will likely execute faster than when executing the original
12955 scalar loop.  The @samp{cheap} model disables vectorization of
12956 loops where doing so would be cost prohibitive for example due to
12957 required runtime checks for data dependence or alignment but otherwise
12958 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
12959 allows vectorization if the vector code would entirely replace the
12960 scalar code that is being vectorized.  For example, if each iteration
12961 of a vectorized loop would only be able to handle exactly four iterations
12962 of the scalar loop, the @samp{very-cheap} model would only allow
12963 vectorization if the scalar iteration count is known to be a multiple
12964 of four.
12966 The default cost model depends on other optimization flags and is
12967 either @samp{dynamic} or @samp{cheap}.
12969 @item -fsimd-cost-model=@var{model}
12970 @opindex fsimd-cost-model
12971 Alter the cost model used for vectorization of loops marked with the OpenMP
12972 simd directive.  The @var{model} argument should be one of
12973 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
12974 have the same meaning as described in @option{-fvect-cost-model} and by
12975 default a cost model defined with @option{-fvect-cost-model} is used.
12977 @item -ftree-vrp
12978 @opindex ftree-vrp
12979 Perform Value Range Propagation on trees.  This is similar to the
12980 constant propagation pass, but instead of values, ranges of values are
12981 propagated.  This allows the optimizers to remove unnecessary range
12982 checks like array bound checks and null pointer checks.  This is
12983 enabled by default at @option{-O2} and higher.  Null pointer check
12984 elimination is only done if @option{-fdelete-null-pointer-checks} is
12985 enabled.
12987 @item -fsplit-paths
12988 @opindex fsplit-paths
12989 Split paths leading to loop backedges.  This can improve dead code
12990 elimination and common subexpression elimination.  This is enabled by
12991 default at @option{-O3} and above.
12993 @item -fsplit-ivs-in-unroller
12994 @opindex fsplit-ivs-in-unroller
12995 Enables expression of values of induction variables in later iterations
12996 of the unrolled loop using the value in the first iteration.  This breaks
12997 long dependency chains, thus improving efficiency of the scheduling passes.
12999 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13000 same effect.  However, that is not reliable in cases where the loop body
13001 is more complicated than a single basic block.  It also does not work at all
13002 on some architectures due to restrictions in the CSE pass.
13004 This optimization is enabled by default.
13006 @item -fvariable-expansion-in-unroller
13007 @opindex fvariable-expansion-in-unroller
13008 With this option, the compiler creates multiple copies of some
13009 local variables when unrolling a loop, which can result in superior code.
13011 This optimization is enabled by default for PowerPC targets, but disabled
13012 by default otherwise.
13014 @item -fpartial-inlining
13015 @opindex fpartial-inlining
13016 Inline parts of functions.  This option has any effect only
13017 when inlining itself is turned on by the @option{-finline-functions}
13018 or @option{-finline-small-functions} options.
13020 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13022 @item -fpredictive-commoning
13023 @opindex fpredictive-commoning
13024 Perform predictive commoning optimization, i.e., reusing computations
13025 (especially memory loads and stores) performed in previous
13026 iterations of loops.
13028 This option is enabled at level @option{-O3}.
13029 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13031 @item -fprefetch-loop-arrays
13032 @opindex fprefetch-loop-arrays
13033 If supported by the target machine, generate instructions to prefetch
13034 memory to improve the performance of loops that access large arrays.
13036 This option may generate better or worse code; results are highly
13037 dependent on the structure of loops within the source code.
13039 Disabled at level @option{-Os}.
13041 @item -fno-printf-return-value
13042 @opindex fno-printf-return-value
13043 @opindex fprintf-return-value
13044 Do not substitute constants for known return value of formatted output
13045 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13046 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
13047 transformation allows GCC to optimize or even eliminate branches based
13048 on the known return value of these functions called with arguments that
13049 are either constant, or whose values are known to be in a range that
13050 makes determining the exact return value possible.  For example, when
13051 @option{-fprintf-return-value} is in effect, both the branch and the
13052 body of the @code{if} statement (but not the call to @code{snprint})
13053 can be optimized away when @code{i} is a 32-bit or smaller integer
13054 because the return value is guaranteed to be at most 8.
13056 @smallexample
13057 char buf[9];
13058 if (snprintf (buf, "%08x", i) >= sizeof buf)
13059   @dots{}
13060 @end smallexample
13062 The @option{-fprintf-return-value} option relies on other optimizations
13063 and yields best results with @option{-O2} and above.  It works in tandem
13064 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13065 options.  The @option{-fprintf-return-value} option is enabled by default.
13067 @item -fno-peephole
13068 @itemx -fno-peephole2
13069 @opindex fno-peephole
13070 @opindex fpeephole
13071 @opindex fno-peephole2
13072 @opindex fpeephole2
13073 Disable any machine-specific peephole optimizations.  The difference
13074 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13075 are implemented in the compiler; some targets use one, some use the
13076 other, a few use both.
13078 @option{-fpeephole} is enabled by default.
13079 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13081 @item -fno-guess-branch-probability
13082 @opindex fno-guess-branch-probability
13083 @opindex fguess-branch-probability
13084 Do not guess branch probabilities using heuristics.
13086 GCC uses heuristics to guess branch probabilities if they are
13087 not provided by profiling feedback (@option{-fprofile-arcs}).  These
13088 heuristics are based on the control flow graph.  If some branch probabilities
13089 are specified by @code{__builtin_expect}, then the heuristics are
13090 used to guess branch probabilities for the rest of the control flow graph,
13091 taking the @code{__builtin_expect} info into account.  The interactions
13092 between the heuristics and @code{__builtin_expect} can be complex, and in
13093 some cases, it may be useful to disable the heuristics so that the effects
13094 of @code{__builtin_expect} are easier to understand.
13096 It is also possible to specify expected probability of the expression
13097 with @code{__builtin_expect_with_probability} built-in function.
13099 The default is @option{-fguess-branch-probability} at levels
13100 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13102 @item -freorder-blocks
13103 @opindex freorder-blocks
13104 Reorder basic blocks in the compiled function in order to reduce number of
13105 taken branches and improve code locality.
13107 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13109 @item -freorder-blocks-algorithm=@var{algorithm}
13110 @opindex freorder-blocks-algorithm
13111 Use the specified algorithm for basic block reordering.  The
13112 @var{algorithm} argument can be @samp{simple}, which does not increase
13113 code size (except sometimes due to secondary effects like alignment),
13114 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13115 put all often executed code together, minimizing the number of branches
13116 executed by making extra copies of code.
13118 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13119 @samp{stc} at levels @option{-O2}, @option{-O3}.
13121 @item -freorder-blocks-and-partition
13122 @opindex freorder-blocks-and-partition
13123 In addition to reordering basic blocks in the compiled function, in order
13124 to reduce number of taken branches, partitions hot and cold basic blocks
13125 into separate sections of the assembly and @file{.o} files, to improve
13126 paging and cache locality performance.
13128 This optimization is automatically turned off in the presence of
13129 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13130 section attribute and on any architecture that does not support named
13131 sections.  When @option{-fsplit-stack} is used this option is not
13132 enabled by default (to avoid linker errors), but may be enabled
13133 explicitly (if using a working linker).
13135 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13137 @item -freorder-functions
13138 @opindex freorder-functions
13139 Reorder functions in the object file in order to
13140 improve code locality.  This is implemented by using special
13141 subsections @code{.text.hot} for most frequently executed functions and
13142 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
13143 the linker so object file format must support named sections and linker must
13144 place them in a reasonable way.
13146 This option isn't effective unless you either provide profile feedback
13147 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
13148 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13150 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13152 @item -fstrict-aliasing
13153 @opindex fstrict-aliasing
13154 Allow the compiler to assume the strictest aliasing rules applicable to
13155 the language being compiled.  For C (and C++), this activates
13156 optimizations based on the type of expressions.  In particular, an
13157 object of one type is assumed never to reside at the same address as an
13158 object of a different type, unless the types are almost the same.  For
13159 example, an @code{unsigned int} can alias an @code{int}, but not a
13160 @code{void*} or a @code{double}.  A character type may alias any other
13161 type.
13163 @anchor{Type-punning}Pay special attention to code like this:
13164 @smallexample
13165 union a_union @{
13166   int i;
13167   double d;
13170 int f() @{
13171   union a_union t;
13172   t.d = 3.0;
13173   return t.i;
13175 @end smallexample
13176 The practice of reading from a different union member than the one most
13177 recently written to (called ``type-punning'') is common.  Even with
13178 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13179 is accessed through the union type.  So, the code above works as
13180 expected.  @xref{Structures unions enumerations and bit-fields
13181 implementation}.  However, this code might not:
13182 @smallexample
13183 int f() @{
13184   union a_union t;
13185   int* ip;
13186   t.d = 3.0;
13187   ip = &t.i;
13188   return *ip;
13190 @end smallexample
13192 Similarly, access by taking the address, casting the resulting pointer
13193 and dereferencing the result has undefined behavior, even if the cast
13194 uses a union type, e.g.:
13195 @smallexample
13196 int f() @{
13197   double d = 3.0;
13198   return ((union a_union *) &d)->i;
13200 @end smallexample
13202 The @option{-fstrict-aliasing} option is enabled at levels
13203 @option{-O2}, @option{-O3}, @option{-Os}.
13205 @item -fipa-strict-aliasing
13206 @opindex fipa-strict-aliasing
13207 Controls whether rules of @option{-fstrict-aliasing} are applied across
13208 function boundaries.  Note that if multiple functions gets inlined into a
13209 single function the memory accesses are no longer considered to be crossing a
13210 function boundary.
13212 The @option{-fipa-strict-aliasing} option is enabled by default and is
13213 effective only in combination with @option{-fstrict-aliasing}.
13215 @item -falign-functions
13216 @itemx -falign-functions=@var{n}
13217 @itemx -falign-functions=@var{n}:@var{m}
13218 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13219 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13220 @opindex falign-functions
13221 Align the start of functions to the next power-of-two greater than or
13222 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
13223 least the first @var{m} bytes of the function can be fetched by the CPU
13224 without crossing an @var{n}-byte alignment boundary.
13226 If @var{m} is not specified, it defaults to @var{n}.
13228 Examples: @option{-falign-functions=32} aligns functions to the next
13229 32-byte boundary, @option{-falign-functions=24} aligns to the next
13230 32-byte boundary only if this can be done by skipping 23 bytes or less,
13231 @option{-falign-functions=32:7} aligns to the next
13232 32-byte boundary only if this can be done by skipping 6 bytes or less.
13234 The second pair of @var{n2}:@var{m2} values allows you to specify
13235 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13236 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13237 otherwise aligns to the next 32-byte boundary if this can be done
13238 by skipping 2 bytes or less.
13239 If @var{m2} is not specified, it defaults to @var{n2}.
13241 Some assemblers only support this flag when @var{n} is a power of two;
13242 in that case, it is rounded up.
13244 @option{-fno-align-functions} and @option{-falign-functions=1} are
13245 equivalent and mean that functions are not aligned.
13247 If @var{n} is not specified or is zero, use a machine-dependent default.
13248 The maximum allowed @var{n} option value is 65536.
13250 Enabled at levels @option{-O2}, @option{-O3}.
13252 @item -flimit-function-alignment
13253 If this option is enabled, the compiler tries to avoid unnecessarily
13254 overaligning functions. It attempts to instruct the assembler to align
13255 by the amount specified by @option{-falign-functions}, but not to
13256 skip more bytes than the size of the function.
13258 @item -falign-labels
13259 @itemx -falign-labels=@var{n}
13260 @itemx -falign-labels=@var{n}:@var{m}
13261 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13262 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13263 @opindex falign-labels
13264 Align all branch targets to a power-of-two boundary.
13266 Parameters of this option are analogous to the @option{-falign-functions} option.
13267 @option{-fno-align-labels} and @option{-falign-labels=1} are
13268 equivalent and mean that labels are not aligned.
13270 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13271 are greater than this value, then their values are used instead.
13273 If @var{n} is not specified or is zero, use a machine-dependent default
13274 which is very likely to be @samp{1}, meaning no alignment.
13275 The maximum allowed @var{n} option value is 65536.
13277 Enabled at levels @option{-O2}, @option{-O3}.
13279 @item -falign-loops
13280 @itemx -falign-loops=@var{n}
13281 @itemx -falign-loops=@var{n}:@var{m}
13282 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
13283 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
13284 @opindex falign-loops
13285 Align loops to a power-of-two boundary.  If the loops are executed
13286 many times, this makes up for any execution of the dummy padding
13287 instructions.
13289 If @option{-falign-labels} is greater than this value, then its value
13290 is used instead.
13292 Parameters of this option are analogous to the @option{-falign-functions} option.
13293 @option{-fno-align-loops} and @option{-falign-loops=1} are
13294 equivalent and mean that loops are not aligned.
13295 The maximum allowed @var{n} option value is 65536.
13297 If @var{n} is not specified or is zero, use a machine-dependent default.
13299 Enabled at levels @option{-O2}, @option{-O3}.
13301 @item -falign-jumps
13302 @itemx -falign-jumps=@var{n}
13303 @itemx -falign-jumps=@var{n}:@var{m}
13304 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
13305 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
13306 @opindex falign-jumps
13307 Align branch targets to a power-of-two boundary, for branch targets
13308 where the targets can only be reached by jumping.  In this case,
13309 no dummy operations need be executed.
13311 If @option{-falign-labels} is greater than this value, then its value
13312 is used instead.
13314 Parameters of this option are analogous to the @option{-falign-functions} option.
13315 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
13316 equivalent and mean that loops are not aligned.
13318 If @var{n} is not specified or is zero, use a machine-dependent default.
13319 The maximum allowed @var{n} option value is 65536.
13321 Enabled at levels @option{-O2}, @option{-O3}.
13323 @item -fno-allocation-dce
13324 @opindex fno-allocation-dce
13325 Do not remove unused C++ allocations in dead code elimination.
13327 @item -fallow-store-data-races
13328 @opindex fallow-store-data-races
13329 Allow the compiler to perform optimizations that may introduce new data races
13330 on stores, without proving that the variable cannot be concurrently accessed
13331 by other threads.  Does not affect optimization of local data.  It is safe to
13332 use this option if it is known that global data will not be accessed by
13333 multiple threads.
13335 Examples of optimizations enabled by @option{-fallow-store-data-races} include
13336 hoisting or if-conversions that may cause a value that was already in memory
13337 to be re-written with that same value.  Such re-writing is safe in a single
13338 threaded context but may be unsafe in a multi-threaded context.  Note that on
13339 some processors, if-conversions may be required in order to enable
13340 vectorization.
13342 Enabled at level @option{-Ofast}.
13344 @item -funit-at-a-time
13345 @opindex funit-at-a-time
13346 This option is left for compatibility reasons. @option{-funit-at-a-time}
13347 has no effect, while @option{-fno-unit-at-a-time} implies
13348 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
13350 Enabled by default.
13352 @item -fno-toplevel-reorder
13353 @opindex fno-toplevel-reorder
13354 @opindex ftoplevel-reorder
13355 Do not reorder top-level functions, variables, and @code{asm}
13356 statements.  Output them in the same order that they appear in the
13357 input file.  When this option is used, unreferenced static variables
13358 are not removed.  This option is intended to support existing code
13359 that relies on a particular ordering.  For new code, it is better to
13360 use attributes when possible.
13362 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
13363 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
13364 Additionally @option{-fno-toplevel-reorder} implies
13365 @option{-fno-section-anchors}.
13367 @item -funreachable-traps
13368 @opindex funreachable-traps
13369 With this option, the compiler turns calls to
13370 @code{__builtin_unreachable} into traps, instead of using them for
13371 optimization.  This also affects any such calls implicitly generated
13372 by the compiler.
13374 This option has the same effect as @option{-fsanitize=unreachable
13375 -fsanitize-trap=unreachable}, but does not affect the values of those
13376 options.  If @option{-fsanitize=unreachable} is enabled, that option
13377 takes priority over this one.
13379 This option is enabled by default at @option{-O0} and @option{-Og}.
13381 @item -fweb
13382 @opindex fweb
13383 Constructs webs as commonly used for register allocation purposes and assign
13384 each web individual pseudo register.  This allows the register allocation pass
13385 to operate on pseudos directly, but also strengthens several other optimization
13386 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
13387 however, make debugging impossible, since variables no longer stay in a
13388 ``home register''.
13390 Enabled by default with @option{-funroll-loops}.
13392 @item -fwhole-program
13393 @opindex fwhole-program
13394 Assume that the current compilation unit represents the whole program being
13395 compiled.  All public functions and variables with the exception of @code{main}
13396 and those merged by attribute @code{externally_visible} become static functions
13397 and in effect are optimized more aggressively by interprocedural optimizers.
13399 This option should not be used in combination with @option{-flto}.
13400 Instead relying on a linker plugin should provide safer and more precise
13401 information.
13403 @item -flto[=@var{n}]
13404 @opindex flto
13405 This option runs the standard link-time optimizer.  When invoked
13406 with source code, it generates GIMPLE (one of GCC's internal
13407 representations) and writes it to special ELF sections in the object
13408 file.  When the object files are linked together, all the function
13409 bodies are read from these ELF sections and instantiated as if they
13410 had been part of the same translation unit.
13412 To use the link-time optimizer, @option{-flto} and optimization
13413 options should be specified at compile time and during the final link.
13414 It is recommended that you compile all the files participating in the
13415 same link with the same options and also specify those options at
13416 link time.  
13417 For example:
13419 @smallexample
13420 gcc -c -O2 -flto foo.c
13421 gcc -c -O2 -flto bar.c
13422 gcc -o myprog -flto -O2 foo.o bar.o
13423 @end smallexample
13425 The first two invocations to GCC save a bytecode representation
13426 of GIMPLE into special ELF sections inside @file{foo.o} and
13427 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
13428 @file{foo.o} and @file{bar.o}, merges the two files into a single
13429 internal image, and compiles the result as usual.  Since both
13430 @file{foo.o} and @file{bar.o} are merged into a single image, this
13431 causes all the interprocedural analyses and optimizations in GCC to
13432 work across the two files as if they were a single one.  This means,
13433 for example, that the inliner is able to inline functions in
13434 @file{bar.o} into functions in @file{foo.o} and vice-versa.
13436 Another (simpler) way to enable link-time optimization is:
13438 @smallexample
13439 gcc -o myprog -flto -O2 foo.c bar.c
13440 @end smallexample
13442 The above generates bytecode for @file{foo.c} and @file{bar.c},
13443 merges them together into a single GIMPLE representation and optimizes
13444 them as usual to produce @file{myprog}.
13446 The important thing to keep in mind is that to enable link-time
13447 optimizations you need to use the GCC driver to perform the link step.
13448 GCC automatically performs link-time optimization if any of the
13449 objects involved were compiled with the @option{-flto} command-line option.  
13450 You can always override
13451 the automatic decision to do link-time optimization
13452 by passing @option{-fno-lto} to the link command.
13454 To make whole program optimization effective, it is necessary to make
13455 certain whole program assumptions.  The compiler needs to know
13456 what functions and variables can be accessed by libraries and runtime
13457 outside of the link-time optimized unit.  When supported by the linker,
13458 the linker plugin (see @option{-fuse-linker-plugin}) passes information
13459 to the compiler about used and externally visible symbols.  When
13460 the linker plugin is not available, @option{-fwhole-program} should be
13461 used to allow the compiler to make these assumptions, which leads
13462 to more aggressive optimization decisions.
13464 When a file is compiled with @option{-flto} without
13465 @option{-fuse-linker-plugin}, the generated object file is larger than
13466 a regular object file because it contains GIMPLE bytecodes and the usual
13467 final code (see @option{-ffat-lto-objects}).  This means that
13468 object files with LTO information can be linked as normal object
13469 files; if @option{-fno-lto} is passed to the linker, no
13470 interprocedural optimizations are applied.  Note that when
13471 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
13472 but you cannot perform a regular, non-LTO link on them.
13474 When producing the final binary, GCC only
13475 applies link-time optimizations to those files that contain bytecode.
13476 Therefore, you can mix and match object files and libraries with
13477 GIMPLE bytecodes and final object code.  GCC automatically selects
13478 which files to optimize in LTO mode and which files to link without
13479 further processing.
13481 Generally, options specified at link time override those
13482 specified at compile time, although in some cases GCC attempts to infer
13483 link-time options from the settings used to compile the input files.
13485 If you do not specify an optimization level option @option{-O} at
13486 link time, then GCC uses the highest optimization level 
13487 used when compiling the object files.  Note that it is generally 
13488 ineffective to specify an optimization level option only at link time and 
13489 not at compile time, for two reasons.  First, compiling without 
13490 optimization suppresses compiler passes that gather information 
13491 needed for effective optimization at link time.  Second, some early
13492 optimization passes can be performed only at compile time and 
13493 not at link time.
13495 There are some code generation flags preserved by GCC when
13496 generating bytecodes, as they need to be used during the final link.
13497 Currently, the following options and their settings are taken from
13498 the first object file that explicitly specifies them: 
13499 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
13500 @option{-fgnu-tm} and all the @option{-m} target flags.
13502 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
13503 @option{-fPIE} are combined based on the following scheme:
13505 @smallexample
13506 @option{-fPIC} + @option{-fpic} = @option{-fpic}
13507 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
13508 @option{-fpic/-fPIC} + (no option) = (no option)
13509 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
13510 @option{-fpic} + @option{-fPIE} = @option{-fpie}
13511 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
13512 @end smallexample
13514 Certain ABI-changing flags are required to match in all compilation units,
13515 and trying to override this at link time with a conflicting value
13516 is ignored.  This includes options such as @option{-freg-struct-return}
13517 and @option{-fpcc-struct-return}. 
13519 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
13520 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
13521 are passed through to the link stage and merged conservatively for
13522 conflicting translation units.  Specifically
13523 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
13524 precedence; and for example @option{-ffp-contract=off} takes precedence
13525 over @option{-ffp-contract=fast}.  You can override them at link time.
13527 Diagnostic options such as @option{-Wstringop-overflow} are passed
13528 through to the link stage and their setting matches that of the
13529 compile-step at function granularity.  Note that this matters only
13530 for diagnostics emitted during optimization.  Note that code
13531 transforms such as inlining can lead to warnings being enabled
13532 or disabled for regions if code not consistent with the setting
13533 at compile time.
13535 When you need to pass options to the assembler via @option{-Wa} or
13536 @option{-Xassembler} make sure to either compile such translation
13537 units with @option{-fno-lto} or consistently use the same assembler
13538 options on all translation units.  You can alternatively also
13539 specify assembler options at LTO link time.
13541 To enable debug info generation you need to supply @option{-g} at
13542 compile time.  If any of the input files at link time were built
13543 with debug info generation enabled the link will enable debug info
13544 generation as well.  Any elaborate debug info settings
13545 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
13546 at the linker command line and mixing different settings in different
13547 translation units is discouraged.
13549 If LTO encounters objects with C linkage declared with incompatible
13550 types in separate translation units to be linked together (undefined
13551 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
13552 issued.  The behavior is still undefined at run time.  Similar
13553 diagnostics may be raised for other languages.
13555 Another feature of LTO is that it is possible to apply interprocedural
13556 optimizations on files written in different languages:
13558 @smallexample
13559 gcc -c -flto foo.c
13560 g++ -c -flto bar.cc
13561 gfortran -c -flto baz.f90
13562 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
13563 @end smallexample
13565 Notice that the final link is done with @command{g++} to get the C++
13566 runtime libraries and @option{-lgfortran} is added to get the Fortran
13567 runtime libraries.  In general, when mixing languages in LTO mode, you
13568 should use the same link command options as when mixing languages in a
13569 regular (non-LTO) compilation.
13571 If object files containing GIMPLE bytecode are stored in a library archive, say
13572 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
13573 are using a linker with plugin support.  To create static libraries suitable
13574 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
13575 and @command{ranlib}; 
13576 to show the symbols of object files with GIMPLE bytecode, use
13577 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
13578 and @command{nm} have been compiled with plugin support.  At link time, use the
13579 flag @option{-fuse-linker-plugin} to ensure that the library participates in
13580 the LTO optimization process:
13582 @smallexample
13583 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
13584 @end smallexample
13586 With the linker plugin enabled, the linker extracts the needed
13587 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
13588 to make them part of the aggregated GIMPLE image to be optimized.
13590 If you are not using a linker with plugin support and/or do not
13591 enable the linker plugin, then the objects inside @file{libfoo.a}
13592 are extracted and linked as usual, but they do not participate
13593 in the LTO optimization process.  In order to make a static library suitable
13594 for both LTO optimization and usual linkage, compile its object files with
13595 @option{-flto} @option{-ffat-lto-objects}.
13597 Link-time optimizations do not require the presence of the whole program to
13598 operate.  If the program does not require any symbols to be exported, it is
13599 possible to combine @option{-flto} and @option{-fwhole-program} to allow
13600 the interprocedural optimizers to use more aggressive assumptions which may
13601 lead to improved optimization opportunities.
13602 Use of @option{-fwhole-program} is not needed when linker plugin is
13603 active (see @option{-fuse-linker-plugin}).
13605 The current implementation of LTO makes no
13606 attempt to generate bytecode that is portable between different
13607 types of hosts.  The bytecode files are versioned and there is a
13608 strict version check, so bytecode files generated in one version of
13609 GCC do not work with an older or newer version of GCC.
13611 Link-time optimization does not work well with generation of debugging
13612 information on systems other than those using a combination of ELF and
13613 DWARF.
13615 If you specify the optional @var{n}, the optimization and code
13616 generation done at link time is executed in parallel using @var{n}
13617 parallel jobs by utilizing an installed @command{make} program.  The
13618 environment variable @env{MAKE} may be used to override the program
13619 used.
13621 You can also specify @option{-flto=jobserver} to use GNU make's
13622 job server mode to determine the number of parallel jobs. This
13623 is useful when the Makefile calling GCC is already executing in parallel.
13624 You must prepend a @samp{+} to the command recipe in the parent Makefile
13625 for this to work.  This option likely only works if @env{MAKE} is
13626 GNU make.  Even without the option value, GCC tries to automatically
13627 detect a running GNU make's job server.
13629 Use @option{-flto=auto} to use GNU make's job server, if available,
13630 or otherwise fall back to autodetection of the number of CPU threads
13631 present in your system.
13633 @item -flto-partition=@var{alg}
13634 @opindex flto-partition
13635 Specify the partitioning algorithm used by the link-time optimizer.
13636 The value is either @samp{1to1} to specify a partitioning mirroring
13637 the original source files or @samp{balanced} to specify partitioning
13638 into equally sized chunks (whenever possible) or @samp{max} to create
13639 new partition for every symbol where possible.  Specifying @samp{none}
13640 as an algorithm disables partitioning and streaming completely. 
13641 The default value is @samp{balanced}. While @samp{1to1} can be used
13642 as an workaround for various code ordering issues, the @samp{max}
13643 partitioning is intended for internal testing only.
13644 The value @samp{one} specifies that exactly one partition should be
13645 used while the value @samp{none} bypasses partitioning and executes
13646 the link-time optimization step directly from the WPA phase.
13648 @item -flto-compression-level=@var{n}
13649 @opindex flto-compression-level
13650 This option specifies the level of compression used for intermediate
13651 language written to LTO object files, and is only meaningful in
13652 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
13653 LTO compression algorithms. For zstd, valid values are 0 (no compression)
13654 to 19 (maximum compression), while zlib supports values from 0 to 9.
13655 Values outside this range are clamped to either minimum or maximum
13656 of the supported values.  If the option is not given,
13657 a default balanced compression setting is used.
13659 @item -fuse-linker-plugin
13660 @opindex fuse-linker-plugin
13661 Enables the use of a linker plugin during link-time optimization.  This
13662 option relies on plugin support in the linker, which is available in gold
13663 or in GNU ld 2.21 or newer.
13665 This option enables the extraction of object files with GIMPLE bytecode out
13666 of library archives. This improves the quality of optimization by exposing
13667 more code to the link-time optimizer.  This information specifies what
13668 symbols can be accessed externally (by non-LTO object or during dynamic
13669 linking).  Resulting code quality improvements on binaries (and shared
13670 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
13671 See @option{-flto} for a description of the effect of this flag and how to
13672 use it.
13674 This option is enabled by default when LTO support in GCC is enabled
13675 and GCC was configured for use with
13676 a linker supporting plugins (GNU ld 2.21 or newer or gold).
13678 @item -ffat-lto-objects
13679 @opindex ffat-lto-objects
13680 Fat LTO objects are object files that contain both the intermediate language
13681 and the object code. This makes them usable for both LTO linking and normal
13682 linking. This option is effective only when compiling with @option{-flto}
13683 and is ignored at link time.
13685 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
13686 requires the complete toolchain to be aware of LTO. It requires a linker with
13687 linker plugin support for basic functionality.  Additionally,
13688 @command{nm}, @command{ar} and @command{ranlib}
13689 need to support linker plugins to allow a full-featured build environment
13690 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
13691 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
13692 to these tools. With non fat LTO makefiles need to be modified to use them.
13694 Note that modern binutils provide plugin auto-load mechanism.
13695 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
13696 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
13697 @command{gcc-ranlib}).
13699 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
13700 support.
13702 @item -fcompare-elim
13703 @opindex fcompare-elim
13704 After register allocation and post-register allocation instruction splitting,
13705 identify arithmetic instructions that compute processor flags similar to a
13706 comparison operation based on that arithmetic.  If possible, eliminate the
13707 explicit comparison operation.
13709 This pass only applies to certain targets that cannot explicitly represent
13710 the comparison operation before register allocation is complete.
13712 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13714 @item -fcprop-registers
13715 @opindex fcprop-registers
13716 After register allocation and post-register allocation instruction splitting,
13717 perform a copy-propagation pass to try to reduce scheduling dependencies
13718 and occasionally eliminate the copy.
13720 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13722 @item -fprofile-correction
13723 @opindex fprofile-correction
13724 Profiles collected using an instrumented binary for multi-threaded programs may
13725 be inconsistent due to missed counter updates. When this option is specified,
13726 GCC uses heuristics to correct or smooth out such inconsistencies. By
13727 default, GCC emits an error message when an inconsistent profile is detected.
13729 This option is enabled by @option{-fauto-profile}.
13731 @item -fprofile-partial-training
13732 @opindex fprofile-partial-training
13733 With @code{-fprofile-use} all portions of programs not executed during train
13734 run are optimized agressively for size rather than speed.  In some cases it is
13735 not practical to train all possible hot paths in the program. (For
13736 example, program may contain functions specific for a given hardware and
13737 trianing may not cover all hardware configurations program is run on.)  With
13738 @code{-fprofile-partial-training} profile feedback will be ignored for all
13739 functions not executed during the train run leading them to be optimized as if
13740 they were compiled without profile feedback. This leads to better performance
13741 when train run is not representative but also leads to significantly bigger
13742 code.
13744 @item -fprofile-use
13745 @itemx -fprofile-use=@var{path}
13746 @opindex fprofile-use
13747 Enable profile feedback-directed optimizations, 
13748 and the following optimizations, many of which
13749 are generally profitable only with profile feedback available:
13751 @gccoptlist{-fbranch-probabilities  -fprofile-values @gol
13752 -funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
13753 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
13754 -fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
13755 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
13756 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
13757 -fprofile-reorder-functions}
13759 Before you can use this option, you must first generate profiling information.
13760 @xref{Instrumentation Options}, for information about the
13761 @option{-fprofile-generate} option.
13763 By default, GCC emits an error message if the feedback profiles do not
13764 match the source code.  This error can be turned into a warning by using
13765 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
13766 optimized code.  Additionally, by default, GCC also emits a warning message if
13767 the feedback profiles do not exist (see @option{-Wmissing-profile}).
13769 If @var{path} is specified, GCC looks at the @var{path} to find
13770 the profile feedback data files. See @option{-fprofile-dir}.
13772 @item -fauto-profile
13773 @itemx -fauto-profile=@var{path}
13774 @opindex fauto-profile
13775 Enable sampling-based feedback-directed optimizations, 
13776 and the following optimizations,
13777 many of which are generally profitable only with profile feedback available:
13779 @gccoptlist{-fbranch-probabilities  -fprofile-values @gol
13780 -funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
13781 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
13782 -fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
13783 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
13784 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
13785 -fprofile-correction}
13787 @var{path} is the name of a file containing AutoFDO profile information.
13788 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
13790 Producing an AutoFDO profile data file requires running your program
13791 with the @command{perf} utility on a supported GNU/Linux target system.
13792 For more information, see @uref{https://perf.wiki.kernel.org/}.
13794 E.g.
13795 @smallexample
13796 perf record -e br_inst_retired:near_taken -b -o perf.data \
13797     -- your_program
13798 @end smallexample
13800 Then use the @command{create_gcov} tool to convert the raw profile data
13801 to a format that can be used by GCC.@  You must also supply the 
13802 unstripped binary for your program to this tool.  
13803 See @uref{https://github.com/google/autofdo}.
13805 E.g.
13806 @smallexample
13807 create_gcov --binary=your_program.unstripped --profile=perf.data \
13808     --gcov=profile.afdo
13809 @end smallexample
13810 @end table
13812 The following options control compiler behavior regarding floating-point 
13813 arithmetic.  These options trade off between speed and
13814 correctness.  All must be specifically enabled.
13816 @table @gcctabopt
13817 @item -ffloat-store
13818 @opindex ffloat-store
13819 Do not store floating-point variables in registers, and inhibit other
13820 options that might change whether a floating-point value is taken from a
13821 register or memory.
13823 @cindex floating-point precision
13824 This option prevents undesirable excess precision on machines such as
13825 the 68000 where the floating registers (of the 68881) keep more
13826 precision than a @code{double} is supposed to have.  Similarly for the
13827 x86 architecture.  For most programs, the excess precision does only
13828 good, but a few programs rely on the precise definition of IEEE floating
13829 point.  Use @option{-ffloat-store} for such programs, after modifying
13830 them to store all pertinent intermediate computations into variables.
13832 @item -fexcess-precision=@var{style}
13833 @opindex fexcess-precision
13834 This option allows further control over excess precision on machines
13835 where floating-point operations occur in a format with more precision or
13836 range than the IEEE standard and interchange floating-point types.  By
13837 default, @option{-fexcess-precision=fast} is in effect; this means that
13838 operations may be carried out in a wider precision than the types specified
13839 in the source if that would result in faster code, and it is unpredictable
13840 when rounding to the types specified in the source code takes place.
13841 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
13842 then excess precision follows the rules specified in ISO C99 or C++; in particular,
13843 both casts and assignments cause values to be rounded to their
13844 semantic types (whereas @option{-ffloat-store} only affects
13845 assignments).  This option is enabled by default for C or C++ if a strict
13846 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
13847 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
13848 regardless of whether a strict conformance option is used.
13850 @opindex mfpmath
13851 @option{-fexcess-precision=standard} is not implemented for languages
13852 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
13853 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
13854 semantics apply without excess precision, and in the latter, rounding
13855 is unpredictable.
13857 @item -ffast-math
13858 @opindex ffast-math
13859 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
13860 @option{-ffinite-math-only}, @option{-fno-rounding-math},
13861 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
13862 @option{-fexcess-precision=fast}.
13864 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
13866 This option is not turned on by any @option{-O} option besides
13867 @option{-Ofast} since it can result in incorrect output for programs
13868 that depend on an exact implementation of IEEE or ISO rules/specifications
13869 for math functions. It may, however, yield faster code for programs
13870 that do not require the guarantees of these specifications.
13872 @item -fno-math-errno
13873 @opindex fno-math-errno
13874 @opindex fmath-errno
13875 Do not set @code{errno} after calling math functions that are executed
13876 with a single instruction, e.g., @code{sqrt}.  A program that relies on
13877 IEEE exceptions for math error handling may want to use this flag
13878 for speed while maintaining IEEE arithmetic compatibility.
13880 This option is not turned on by any @option{-O} option since
13881 it can result in incorrect output for programs that depend on
13882 an exact implementation of IEEE or ISO rules/specifications for
13883 math functions. It may, however, yield faster code for programs
13884 that do not require the guarantees of these specifications.
13886 The default is @option{-fmath-errno}.
13888 On Darwin systems, the math library never sets @code{errno}.  There is
13889 therefore no reason for the compiler to consider the possibility that
13890 it might, and @option{-fno-math-errno} is the default.
13892 @item -funsafe-math-optimizations
13893 @opindex funsafe-math-optimizations
13895 Allow optimizations for floating-point arithmetic that (a) assume
13896 that arguments and results are valid and (b) may violate IEEE or
13897 ANSI standards.  When used at link time, it may include libraries
13898 or startup files that change the default FPU control word or other
13899 similar optimizations.
13901 This option is not turned on by any @option{-O} option since
13902 it can result in incorrect output for programs that depend on
13903 an exact implementation of IEEE or ISO rules/specifications for
13904 math functions. It may, however, yield faster code for programs
13905 that do not require the guarantees of these specifications.
13906 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
13907 @option{-fassociative-math} and @option{-freciprocal-math}.
13909 The default is @option{-fno-unsafe-math-optimizations}.
13911 @item -fassociative-math
13912 @opindex fassociative-math
13914 Allow re-association of operands in series of floating-point operations.
13915 This violates the ISO C and C++ language standard by possibly changing
13916 computation result.  NOTE: re-ordering may change the sign of zero as
13917 well as ignore NaNs and inhibit or create underflow or overflow (and
13918 thus cannot be used on code that relies on rounding behavior like
13919 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
13920 and thus may not be used when ordered comparisons are required.
13921 This option requires that both @option{-fno-signed-zeros} and
13922 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
13923 much sense with @option{-frounding-math}. For Fortran the option
13924 is automatically enabled when both @option{-fno-signed-zeros} and
13925 @option{-fno-trapping-math} are in effect.
13927 The default is @option{-fno-associative-math}.
13929 @item -freciprocal-math
13930 @opindex freciprocal-math
13932 Allow the reciprocal of a value to be used instead of dividing by
13933 the value if this enables optimizations.  For example @code{x / y}
13934 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
13935 is subject to common subexpression elimination.  Note that this loses
13936 precision and increases the number of flops operating on the value.
13938 The default is @option{-fno-reciprocal-math}.
13940 @item -ffinite-math-only
13941 @opindex ffinite-math-only
13942 Allow optimizations for floating-point arithmetic that assume
13943 that arguments and results are not NaNs or +-Infs.
13945 This option is not turned on by any @option{-O} option since
13946 it can result in incorrect output for programs that depend on
13947 an exact implementation of IEEE or ISO rules/specifications for
13948 math functions. It may, however, yield faster code for programs
13949 that do not require the guarantees of these specifications.
13951 The default is @option{-fno-finite-math-only}.
13953 @item -fno-signed-zeros
13954 @opindex fno-signed-zeros
13955 @opindex fsigned-zeros
13956 Allow optimizations for floating-point arithmetic that ignore the
13957 signedness of zero.  IEEE arithmetic specifies the behavior of
13958 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
13959 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
13960 This option implies that the sign of a zero result isn't significant.
13962 The default is @option{-fsigned-zeros}.
13964 @item -fno-trapping-math
13965 @opindex fno-trapping-math
13966 @opindex ftrapping-math
13967 Compile code assuming that floating-point operations cannot generate
13968 user-visible traps.  These traps include division by zero, overflow,
13969 underflow, inexact result and invalid operation.  This option requires
13970 that @option{-fno-signaling-nans} be in effect.  Setting this option may
13971 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
13973 This option should never be turned on by any @option{-O} option since
13974 it can result in incorrect output for programs that depend on
13975 an exact implementation of IEEE or ISO rules/specifications for
13976 math functions.
13978 The default is @option{-ftrapping-math}.
13980 Future versions of GCC may provide finer control of this setting
13981 using C99's @code{FENV_ACCESS} pragma.  This command-line option
13982 will be used along with @option{-frounding-math} to specify the
13983 default state for @code{FENV_ACCESS}.
13985 @item -frounding-math
13986 @opindex frounding-math
13987 Disable transformations and optimizations that assume default floating-point
13988 rounding behavior.  This is round-to-zero for all floating point
13989 to integer conversions, and round-to-nearest for all other arithmetic
13990 truncations.  This option should be specified for programs that change
13991 the FP rounding mode dynamically, or that may be executed with a
13992 non-default rounding mode.  This option disables constant folding of
13993 floating-point expressions at compile time (which may be affected by
13994 rounding mode) and arithmetic transformations that are unsafe in the
13995 presence of sign-dependent rounding modes.
13997 The default is @option{-fno-rounding-math}.
13999 This option is experimental and does not currently guarantee to
14000 disable all GCC optimizations that are affected by rounding mode.
14001 Future versions of GCC may provide finer control of this setting
14002 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14003 will be used along with @option{-ftrapping-math} to specify the
14004 default state for @code{FENV_ACCESS}.
14006 @item -fsignaling-nans
14007 @opindex fsignaling-nans
14008 Compile code assuming that IEEE signaling NaNs may generate user-visible
14009 traps during floating-point operations.  Setting this option disables
14010 optimizations that may change the number of exceptions visible with
14011 signaling NaNs.  This option implies @option{-ftrapping-math}.
14013 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14014 be defined.
14016 The default is @option{-fno-signaling-nans}.
14018 This option is experimental and does not currently guarantee to
14019 disable all GCC optimizations that affect signaling NaN behavior.
14021 @item -fno-fp-int-builtin-inexact
14022 @opindex fno-fp-int-builtin-inexact
14023 @opindex ffp-int-builtin-inexact
14024 Do not allow the built-in functions @code{ceil}, @code{floor},
14025 @code{round} and @code{trunc}, and their @code{float} and @code{long
14026 double} variants, to generate code that raises the ``inexact''
14027 floating-point exception for noninteger arguments.  ISO C99 and C11
14028 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14029 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14030 ISO C2X, does not allow these functions to do so.
14032 The default is @option{-ffp-int-builtin-inexact}, allowing the
14033 exception to be raised, unless C2X or a later C standard is selected.
14034 This option does nothing unless @option{-ftrapping-math} is in effect.
14036 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14037 generate a call to a library function then the ``inexact'' exception
14038 may be raised if the library implementation does not follow TS 18661.
14040 @item -fsingle-precision-constant
14041 @opindex fsingle-precision-constant
14042 Treat floating-point constants as single precision instead of
14043 implicitly converting them to double-precision constants.
14045 @item -fcx-limited-range
14046 @opindex fcx-limited-range
14047 When enabled, this option states that a range reduction step is not
14048 needed when performing complex division.  Also, there is no checking
14049 whether the result of a complex multiplication or division is @code{NaN
14050 + I*NaN}, with an attempt to rescue the situation in that case.  The
14051 default is @option{-fno-cx-limited-range}, but is enabled by
14052 @option{-ffast-math}.
14054 This option controls the default setting of the ISO C99
14055 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
14056 all languages.
14058 @item -fcx-fortran-rules
14059 @opindex fcx-fortran-rules
14060 Complex multiplication and division follow Fortran rules.  Range
14061 reduction is done as part of complex division, but there is no checking
14062 whether the result of a complex multiplication or division is @code{NaN
14063 + I*NaN}, with an attempt to rescue the situation in that case.
14065 The default is @option{-fno-cx-fortran-rules}.
14067 @end table
14069 The following options control optimizations that may improve
14070 performance, but are not enabled by any @option{-O} options.  This
14071 section includes experimental options that may produce broken code.
14073 @table @gcctabopt
14074 @item -fbranch-probabilities
14075 @opindex fbranch-probabilities
14076 After running a program compiled with @option{-fprofile-arcs}
14077 (@pxref{Instrumentation Options}),
14078 you can compile it a second time using
14079 @option{-fbranch-probabilities}, to improve optimizations based on
14080 the number of times each branch was taken.  When a program
14081 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14082 counts to a file called @file{@var{sourcename}.gcda} for each source
14083 file.  The information in this data file is very dependent on the
14084 structure of the generated code, so you must use the same source code
14085 and the same optimization options for both compilations.
14086 See details about the file naming in @option{-fprofile-arcs}.
14088 With @option{-fbranch-probabilities}, GCC puts a
14089 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14090 These can be used to improve optimization.  Currently, they are only
14091 used in one place: in @file{reorg.cc}, instead of guessing which path a
14092 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14093 exactly determine which path is taken more often.
14095 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14097 @item -fprofile-values
14098 @opindex fprofile-values
14099 If combined with @option{-fprofile-arcs}, it adds code so that some
14100 data about values of expressions in the program is gathered.
14102 With @option{-fbranch-probabilities}, it reads back the data gathered
14103 from profiling values of expressions for usage in optimizations.
14105 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14106 @option{-fauto-profile}.
14108 @item -fprofile-reorder-functions
14109 @opindex fprofile-reorder-functions
14110 Function reordering based on profile instrumentation collects
14111 first time of execution of a function and orders these functions
14112 in ascending order.
14114 Enabled with @option{-fprofile-use}.
14116 @item -fvpt
14117 @opindex fvpt
14118 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14119 to add code to gather information about values of expressions.
14121 With @option{-fbranch-probabilities}, it reads back the data gathered
14122 and actually performs the optimizations based on them.
14123 Currently the optimizations include specialization of division operations
14124 using the knowledge about the value of the denominator.
14126 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14128 @item -frename-registers
14129 @opindex frename-registers
14130 Attempt to avoid false dependencies in scheduled code by making use
14131 of registers left over after register allocation.  This optimization
14132 most benefits processors with lots of registers.  Depending on the
14133 debug information format adopted by the target, however, it can
14134 make debugging impossible, since variables no longer stay in
14135 a ``home register''.
14137 Enabled by default with @option{-funroll-loops}.
14139 @item -fschedule-fusion
14140 @opindex fschedule-fusion
14141 Performs a target dependent pass over the instruction stream to schedule
14142 instructions of same type together because target machine can execute them
14143 more efficiently if they are adjacent to each other in the instruction flow.
14145 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14147 @item -ftracer
14148 @opindex ftracer
14149 Perform tail duplication to enlarge superblock size.  This transformation
14150 simplifies the control flow of the function allowing other optimizations to do
14151 a better job.
14153 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14155 @item -funroll-loops
14156 @opindex funroll-loops
14157 Unroll loops whose number of iterations can be determined at compile time or
14158 upon entry to the loop.  @option{-funroll-loops} implies
14159 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14160 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14161 a small constant number of iterations).  This option makes code larger, and may
14162 or may not make it run faster.
14164 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14166 @item -funroll-all-loops
14167 @opindex funroll-all-loops
14168 Unroll all loops, even if their number of iterations is uncertain when
14169 the loop is entered.  This usually makes programs run more slowly.
14170 @option{-funroll-all-loops} implies the same options as
14171 @option{-funroll-loops}.
14173 @item -fpeel-loops
14174 @opindex fpeel-loops
14175 Peels loops for which there is enough information that they do not
14176 roll much (from profile feedback or static analysis).  It also turns on
14177 complete loop peeling (i.e.@: complete removal of loops with small constant
14178 number of iterations).
14180 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14182 @item -fmove-loop-invariants
14183 @opindex fmove-loop-invariants
14184 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
14185 at level @option{-O1} and higher, except for @option{-Og}.
14187 @item -fmove-loop-stores
14188 @opindex fmove-loop-stores
14189 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
14190 moves invariant stores to after the end of the loop in exchange for
14191 carrying the stored value in a register across the iteration.
14192 Note for this option to have an effect @option{-ftree-loop-im} has to
14193 be enabled as well.  Enabled at level @option{-O1} and higher, except
14194 for @option{-Og}.
14196 @item -fsplit-loops
14197 @opindex fsplit-loops
14198 Split a loop into two if it contains a condition that's always true
14199 for one side of the iteration space and false for the other.
14201 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14203 @item -funswitch-loops
14204 @opindex funswitch-loops
14205 Move branches with loop invariant conditions out of the loop, with duplicates
14206 of the loop on both branches (modified according to result of the condition).
14208 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14210 @item -fversion-loops-for-strides
14211 @opindex fversion-loops-for-strides
14212 If a loop iterates over an array with a variable stride, create another
14213 version of the loop that assumes the stride is always one.  For example:
14215 @smallexample
14216 for (int i = 0; i < n; ++i)
14217   x[i * stride] = @dots{};
14218 @end smallexample
14220 becomes:
14222 @smallexample
14223 if (stride == 1)
14224   for (int i = 0; i < n; ++i)
14225     x[i] = @dots{};
14226 else
14227   for (int i = 0; i < n; ++i)
14228     x[i * stride] = @dots{};
14229 @end smallexample
14231 This is particularly useful for assumed-shape arrays in Fortran where
14232 (for example) it allows better vectorization assuming contiguous accesses.
14233 This flag is enabled by default at @option{-O3}.
14234 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14236 @item -ffunction-sections
14237 @itemx -fdata-sections
14238 @opindex ffunction-sections
14239 @opindex fdata-sections
14240 Place each function or data item into its own section in the output
14241 file if the target supports arbitrary sections.  The name of the
14242 function or the name of the data item determines the section's name
14243 in the output file.
14245 Use these options on systems where the linker can perform optimizations to
14246 improve locality of reference in the instruction space.  Most systems using the
14247 ELF object format have linkers with such optimizations.  On AIX, the linker
14248 rearranges sections (CSECTs) based on the call graph.  The performance impact
14249 varies.
14251 Together with a linker garbage collection (linker @option{--gc-sections}
14252 option) these options may lead to smaller statically-linked executables (after
14253 stripping).
14255 On ELF/DWARF systems these options do not degenerate the quality of the debug
14256 information.  There could be issues with other object files/debug info formats.
14258 Only use these options when there are significant benefits from doing so.  When
14259 you specify these options, the assembler and linker create larger object and
14260 executable files and are also slower.  These options affect code generation.
14261 They prevent optimizations by the compiler and assembler using relative
14262 locations inside a translation unit since the locations are unknown until
14263 link time.  An example of such an optimization is relaxing calls to short call
14264 instructions.
14266 @item -fstdarg-opt
14267 @opindex fstdarg-opt
14268 Optimize the prologue of variadic argument functions with respect to usage of
14269 those arguments.
14271 @item -fsection-anchors
14272 @opindex fsection-anchors
14273 Try to reduce the number of symbolic address calculations by using
14274 shared ``anchor'' symbols to address nearby objects.  This transformation
14275 can help to reduce the number of GOT entries and GOT accesses on some
14276 targets.
14278 For example, the implementation of the following function @code{foo}:
14280 @smallexample
14281 static int a, b, c;
14282 int foo (void) @{ return a + b + c; @}
14283 @end smallexample
14285 @noindent
14286 usually calculates the addresses of all three variables, but if you
14287 compile it with @option{-fsection-anchors}, it accesses the variables
14288 from a common anchor point instead.  The effect is similar to the
14289 following pseudocode (which isn't valid C):
14291 @smallexample
14292 int foo (void)
14294   register int *xr = &x;
14295   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
14297 @end smallexample
14299 Not all targets support this option.
14301 @item -fzero-call-used-regs=@var{choice}
14302 @opindex fzero-call-used-regs
14303 Zero call-used registers at function return to increase program
14304 security by either mitigating Return-Oriented Programming (ROP)
14305 attacks or preventing information leakage through registers.
14307 The possible values of @var{choice} are the same as for the
14308 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
14309 The default is @samp{skip}.
14311 You can control this behavior for a specific function by using the function
14312 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
14314 @item --param @var{name}=@var{value}
14315 @opindex param
14316 In some places, GCC uses various constants to control the amount of
14317 optimization that is done.  For example, GCC does not inline functions
14318 that contain more than a certain number of instructions.  You can
14319 control some of these constants on the command line using the
14320 @option{--param} option.
14322 The names of specific parameters, and the meaning of the values, are
14323 tied to the internals of the compiler, and are subject to change
14324 without notice in future releases.
14326 In order to get minimal, maximal and default value of a parameter,
14327 one can use @option{--help=param -Q} options.
14329 In each case, the @var{value} is an integer.  The following choices
14330 of @var{name} are recognized for all targets:
14332 @table @gcctabopt
14333 @item predictable-branch-outcome
14334 When branch is predicted to be taken with probability lower than this threshold
14335 (in percent), then it is considered well predictable.
14337 @item max-rtl-if-conversion-insns
14338 RTL if-conversion tries to remove conditional branches around a block and
14339 replace them with conditionally executed instructions.  This parameter
14340 gives the maximum number of instructions in a block which should be
14341 considered for if-conversion.  The compiler will
14342 also use other heuristics to decide whether if-conversion is likely to be
14343 profitable.
14345 @item max-rtl-if-conversion-predictable-cost
14346 RTL if-conversion will try to remove conditional branches around a block
14347 and replace them with conditionally executed instructions.  These parameters
14348 give the maximum permissible cost for the sequence that would be generated
14349 by if-conversion depending on whether the branch is statically determined
14350 to be predictable or not.  The units for this parameter are the same as
14351 those for the GCC internal seq_cost metric.  The compiler will try to
14352 provide a reasonable default for this parameter using the BRANCH_COST
14353 target macro.
14355 @item max-crossjump-edges
14356 The maximum number of incoming edges to consider for cross-jumping.
14357 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
14358 the number of edges incoming to each block.  Increasing values mean
14359 more aggressive optimization, making the compilation time increase with
14360 probably small improvement in executable size.
14362 @item min-crossjump-insns
14363 The minimum number of instructions that must be matched at the end
14364 of two blocks before cross-jumping is performed on them.  This
14365 value is ignored in the case where all instructions in the block being
14366 cross-jumped from are matched.
14368 @item max-grow-copy-bb-insns
14369 The maximum code size expansion factor when copying basic blocks
14370 instead of jumping.  The expansion is relative to a jump instruction.
14372 @item max-goto-duplication-insns
14373 The maximum number of instructions to duplicate to a block that jumps
14374 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
14375 passes, GCC factors computed gotos early in the compilation process,
14376 and unfactors them as late as possible.  Only computed jumps at the
14377 end of a basic blocks with no more than max-goto-duplication-insns are
14378 unfactored.
14380 @item max-delay-slot-insn-search
14381 The maximum number of instructions to consider when looking for an
14382 instruction to fill a delay slot.  If more than this arbitrary number of
14383 instructions are searched, the time savings from filling the delay slot
14384 are minimal, so stop searching.  Increasing values mean more
14385 aggressive optimization, making the compilation time increase with probably
14386 small improvement in execution time.
14388 @item max-delay-slot-live-search
14389 When trying to fill delay slots, the maximum number of instructions to
14390 consider when searching for a block with valid live register
14391 information.  Increasing this arbitrarily chosen value means more
14392 aggressive optimization, increasing the compilation time.  This parameter
14393 should be removed when the delay slot code is rewritten to maintain the
14394 control-flow graph.
14396 @item max-gcse-memory
14397 The approximate maximum amount of memory in @code{kB} that can be allocated in
14398 order to perform the global common subexpression elimination
14399 optimization.  If more memory than specified is required, the
14400 optimization is not done.
14402 @item max-gcse-insertion-ratio
14403 If the ratio of expression insertions to deletions is larger than this value
14404 for any expression, then RTL PRE inserts or removes the expression and thus
14405 leaves partially redundant computations in the instruction stream.
14407 @item max-pending-list-length
14408 The maximum number of pending dependencies scheduling allows
14409 before flushing the current state and starting over.  Large functions
14410 with few branches or calls can create excessively large lists which
14411 needlessly consume memory and resources.
14413 @item max-modulo-backtrack-attempts
14414 The maximum number of backtrack attempts the scheduler should make
14415 when modulo scheduling a loop.  Larger values can exponentially increase
14416 compilation time.
14418 @item max-inline-functions-called-once-loop-depth
14419 Maximal loop depth of a call considered by inline heuristics that tries to
14420 inline all functions called once.
14422 @item max-inline-functions-called-once-insns
14423 Maximal estimated size of functions produced while inlining functions called
14424 once.
14426 @item max-inline-insns-single
14427 Several parameters control the tree inliner used in GCC@.  This number sets the
14428 maximum number of instructions (counted in GCC's internal representation) in a
14429 single function that the tree inliner considers for inlining.  This only
14430 affects functions declared inline and methods implemented in a class
14431 declaration (C++). 
14434 @item max-inline-insns-auto
14435 When you use @option{-finline-functions} (included in @option{-O3}),
14436 a lot of functions that would otherwise not be considered for inlining
14437 by the compiler are investigated.  To those functions, a different
14438 (more restrictive) limit compared to functions declared inline can
14439 be applied (@option{--param max-inline-insns-auto}).
14441 @item max-inline-insns-small
14442 This is bound applied to calls which are considered relevant with
14443 @option{-finline-small-functions}.
14445 @item max-inline-insns-size
14446 This is bound applied to calls which are optimized for size. Small growth
14447 may be desirable to anticipate optimization oppurtunities exposed by inlining.
14449 @item uninlined-function-insns
14450 Number of instructions accounted by inliner for function overhead such as
14451 function prologue and epilogue.
14453 @item uninlined-function-time
14454 Extra time accounted by inliner for function overhead such as time needed to
14455 execute function prologue and epilogue.
14457 @item inline-heuristics-hint-percent
14458 The scale (in percents) applied to @option{inline-insns-single},
14459 @option{inline-insns-single-O2}, @option{inline-insns-auto}
14460 when inline heuristics hints that inlining is
14461 very profitable (will enable later optimizations).
14463 @item uninlined-thunk-insns
14464 @item uninlined-thunk-time
14465 Same as @option{--param uninlined-function-insns} and
14466 @option{--param uninlined-function-time} but applied to function thunks.
14468 @item inline-min-speedup
14469 When estimated performance improvement of caller + callee runtime exceeds this
14470 threshold (in percent), the function can be inlined regardless of the limit on
14471 @option{--param max-inline-insns-single} and @option{--param
14472 max-inline-insns-auto}.
14474 @item large-function-insns
14475 The limit specifying really large functions.  For functions larger than this
14476 limit after inlining, inlining is constrained by
14477 @option{--param large-function-growth}.  This parameter is useful primarily
14478 to avoid extreme compilation time caused by non-linear algorithms used by the
14479 back end.
14481 @item large-function-growth
14482 Specifies maximal growth of large function caused by inlining in percents.
14483 For example, parameter value 100 limits large function growth to 2.0 times
14484 the original size.
14486 @item large-unit-insns
14487 The limit specifying large translation unit.  Growth caused by inlining of
14488 units larger than this limit is limited by @option{--param inline-unit-growth}.
14489 For small units this might be too tight.
14490 For example, consider a unit consisting of function A
14491 that is inline and B that just calls A three times.  If B is small relative to
14492 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
14493 large units consisting of small inlineable functions, however, the overall unit
14494 growth limit is needed to avoid exponential explosion of code size.  Thus for
14495 smaller units, the size is increased to @option{--param large-unit-insns}
14496 before applying @option{--param inline-unit-growth}.
14498 @item lazy-modules
14499 Maximum number of concurrently open C++ module files when lazy loading.
14501 @item inline-unit-growth
14502 Specifies maximal overall growth of the compilation unit caused by inlining.
14503 For example, parameter value 20 limits unit growth to 1.2 times the original
14504 size. Cold functions (either marked cold via an attribute or by profile
14505 feedback) are not accounted into the unit size.
14507 @item ipa-cp-unit-growth
14508 Specifies maximal overall growth of the compilation unit caused by
14509 interprocedural constant propagation.  For example, parameter value 10 limits
14510 unit growth to 1.1 times the original size.
14512 @item ipa-cp-large-unit-insns
14513 The size of translation unit that IPA-CP pass considers large.
14515 @item large-stack-frame
14516 The limit specifying large stack frames.  While inlining the algorithm is trying
14517 to not grow past this limit too much.
14519 @item large-stack-frame-growth
14520 Specifies maximal growth of large stack frames caused by inlining in percents.
14521 For example, parameter value 1000 limits large stack frame growth to 11 times
14522 the original size.
14524 @item max-inline-insns-recursive
14525 @itemx max-inline-insns-recursive-auto
14526 Specifies the maximum number of instructions an out-of-line copy of a
14527 self-recursive inline
14528 function can grow into by performing recursive inlining.
14530 @option{--param max-inline-insns-recursive} applies to functions
14531 declared inline.
14532 For functions not declared inline, recursive inlining
14533 happens only when @option{-finline-functions} (included in @option{-O3}) is
14534 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
14536 @item max-inline-recursive-depth
14537 @itemx max-inline-recursive-depth-auto
14538 Specifies the maximum recursion depth used for recursive inlining.
14540 @option{--param max-inline-recursive-depth} applies to functions
14541 declared inline.  For functions not declared inline, recursive inlining
14542 happens only when @option{-finline-functions} (included in @option{-O3}) is
14543 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
14545 @item min-inline-recursive-probability
14546 Recursive inlining is profitable only for function having deep recursion
14547 in average and can hurt for function having little recursion depth by
14548 increasing the prologue size or complexity of function body to other
14549 optimizers.
14551 When profile feedback is available (see @option{-fprofile-generate}) the actual
14552 recursion depth can be guessed from the probability that function recurses
14553 via a given call expression.  This parameter limits inlining only to call
14554 expressions whose probability exceeds the given threshold (in percents).
14556 @item early-inlining-insns
14557 Specify growth that the early inliner can make.  In effect it increases
14558 the amount of inlining for code having a large abstraction penalty.
14560 @item max-early-inliner-iterations
14561 Limit of iterations of the early inliner.  This basically bounds
14562 the number of nested indirect calls the early inliner can resolve.
14563 Deeper chains are still handled by late inlining.
14565 @item comdat-sharing-probability
14566 Probability (in percent) that C++ inline function with comdat visibility
14567 are shared across multiple compilation units.
14569 @item modref-max-bases
14570 @item modref-max-refs
14571 @item modref-max-accesses
14572 Specifies the maximal number of base pointers, references and accesses stored
14573 for a single function by mod/ref analysis.
14575 @item modref-max-tests
14576 Specifies the maxmal number of tests alias oracle can perform to disambiguate
14577 memory locations using the mod/ref information.  This parameter ought to be
14578 bigger than @option{--param modref-max-bases} and @option{--param
14579 modref-max-refs}.
14581 @item modref-max-depth
14582 Specifies the maximum depth of DFS walk used by modref escape analysis.
14583 Setting to 0 disables the analysis completely.
14585 @item modref-max-escape-points
14586 Specifies the maximum number of escape points tracked by modref per SSA-name.
14588 @item modref-max-adjustments
14589 Specifies the maximum number the access range is enlarged during modref dataflow
14590 analysis.
14592 @item profile-func-internal-id
14593 A parameter to control whether to use function internal id in profile
14594 database lookup. If the value is 0, the compiler uses an id that
14595 is based on function assembler name and filename, which makes old profile
14596 data more tolerant to source changes such as function reordering etc.
14598 @item min-vect-loop-bound
14599 The minimum number of iterations under which loops are not vectorized
14600 when @option{-ftree-vectorize} is used.  The number of iterations after
14601 vectorization needs to be greater than the value specified by this option
14602 to allow vectorization.
14604 @item gcse-cost-distance-ratio
14605 Scaling factor in calculation of maximum distance an expression
14606 can be moved by GCSE optimizations.  This is currently supported only in the
14607 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
14608 is with simple expressions, i.e., the expressions that have cost
14609 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
14610 hoisting of simple expressions.
14612 @item gcse-unrestricted-cost
14613 Cost, roughly measured as the cost of a single typical machine
14614 instruction, at which GCSE optimizations do not constrain
14615 the distance an expression can travel.  This is currently
14616 supported only in the code hoisting pass.  The lesser the cost,
14617 the more aggressive code hoisting is.  Specifying 0 
14618 allows all expressions to travel unrestricted distances.
14620 @item max-hoist-depth
14621 The depth of search in the dominator tree for expressions to hoist.
14622 This is used to avoid quadratic behavior in hoisting algorithm.
14623 The value of 0 does not limit on the search, but may slow down compilation
14624 of huge functions.
14626 @item max-tail-merge-comparisons
14627 The maximum amount of similar bbs to compare a bb with.  This is used to
14628 avoid quadratic behavior in tree tail merging.
14630 @item max-tail-merge-iterations
14631 The maximum amount of iterations of the pass over the function.  This is used to
14632 limit compilation time in tree tail merging.
14634 @item store-merging-allow-unaligned
14635 Allow the store merging pass to introduce unaligned stores if it is legal to
14636 do so.
14638 @item max-stores-to-merge
14639 The maximum number of stores to attempt to merge into wider stores in the store
14640 merging pass.
14642 @item max-store-chains-to-track
14643 The maximum number of store chains to track at the same time in the attempt
14644 to merge them into wider stores in the store merging pass.
14646 @item max-stores-to-track
14647 The maximum number of stores to track at the same time in the attemt to
14648 to merge them into wider stores in the store merging pass.
14650 @item max-unrolled-insns
14651 The maximum number of instructions that a loop may have to be unrolled.
14652 If a loop is unrolled, this parameter also determines how many times
14653 the loop code is unrolled.
14655 @item max-average-unrolled-insns
14656 The maximum number of instructions biased by probabilities of their execution
14657 that a loop may have to be unrolled.  If a loop is unrolled,
14658 this parameter also determines how many times the loop code is unrolled.
14660 @item max-unroll-times
14661 The maximum number of unrollings of a single loop.
14663 @item max-peeled-insns
14664 The maximum number of instructions that a loop may have to be peeled.
14665 If a loop is peeled, this parameter also determines how many times
14666 the loop code is peeled.
14668 @item max-peel-times
14669 The maximum number of peelings of a single loop.
14671 @item max-peel-branches
14672 The maximum number of branches on the hot path through the peeled sequence.
14674 @item max-completely-peeled-insns
14675 The maximum number of insns of a completely peeled loop.
14677 @item max-completely-peel-times
14678 The maximum number of iterations of a loop to be suitable for complete peeling.
14680 @item max-completely-peel-loop-nest-depth
14681 The maximum depth of a loop nest suitable for complete peeling.
14683 @item max-unswitch-insns
14684 The maximum number of insns of an unswitched loop.
14686 @item lim-expensive
14687 The minimum cost of an expensive expression in the loop invariant motion.
14689 @item min-loop-cond-split-prob
14690 When FDO profile information is available, @option{min-loop-cond-split-prob}
14691 specifies minimum threshold for probability of semi-invariant condition
14692 statement to trigger loop split.
14694 @item iv-consider-all-candidates-bound
14695 Bound on number of candidates for induction variables, below which
14696 all candidates are considered for each use in induction variable
14697 optimizations.  If there are more candidates than this,
14698 only the most relevant ones are considered to avoid quadratic time complexity.
14700 @item iv-max-considered-uses
14701 The induction variable optimizations give up on loops that contain more
14702 induction variable uses.
14704 @item iv-always-prune-cand-set-bound
14705 If the number of candidates in the set is smaller than this value,
14706 always try to remove unnecessary ivs from the set
14707 when adding a new one.
14709 @item avg-loop-niter
14710 Average number of iterations of a loop.
14712 @item dse-max-object-size
14713 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
14714 Larger values may result in larger compilation times.
14716 @item dse-max-alias-queries-per-store
14717 Maximum number of queries into the alias oracle per store.
14718 Larger values result in larger compilation times and may result in more
14719 removed dead stores.
14721 @item scev-max-expr-size
14722 Bound on size of expressions used in the scalar evolutions analyzer.
14723 Large expressions slow the analyzer.
14725 @item scev-max-expr-complexity
14726 Bound on the complexity of the expressions in the scalar evolutions analyzer.
14727 Complex expressions slow the analyzer.
14729 @item max-tree-if-conversion-phi-args
14730 Maximum number of arguments in a PHI supported by TREE if conversion
14731 unless the loop is marked with simd pragma.
14733 @item vect-max-layout-candidates
14734 The maximum number of possible vector layouts (such as permutations)
14735 to consider when optimizing to-be-vectorized code.
14737 @item vect-max-version-for-alignment-checks
14738 The maximum number of run-time checks that can be performed when
14739 doing loop versioning for alignment in the vectorizer.
14741 @item vect-max-version-for-alias-checks
14742 The maximum number of run-time checks that can be performed when
14743 doing loop versioning for alias in the vectorizer.
14745 @item vect-max-peeling-for-alignment
14746 The maximum number of loop peels to enhance access alignment
14747 for vectorizer. Value -1 means no limit.
14749 @item max-iterations-to-track
14750 The maximum number of iterations of a loop the brute-force algorithm
14751 for analysis of the number of iterations of the loop tries to evaluate.
14753 @item hot-bb-count-fraction
14754 The denominator n of fraction 1/n of the maximal execution count of a
14755 basic block in the entire program that a basic block needs to at least
14756 have in order to be considered hot.  The default is 10000, which means
14757 that a basic block is considered hot if its execution count is greater
14758 than 1/10000 of the maximal execution count.  0 means that it is never
14759 considered hot.  Used in non-LTO mode.
14761 @item hot-bb-count-ws-permille
14762 The number of most executed permilles, ranging from 0 to 1000, of the
14763 profiled execution of the entire program to which the execution count
14764 of a basic block must be part of in order to be considered hot.  The
14765 default is 990, which means that a basic block is considered hot if
14766 its execution count contributes to the upper 990 permilles, or 99.0%,
14767 of the profiled execution of the entire program.  0 means that it is
14768 never considered hot.  Used in LTO mode.
14770 @item hot-bb-frequency-fraction
14771 The denominator n of fraction 1/n of the execution frequency of the
14772 entry block of a function that a basic block of this function needs
14773 to at least have in order to be considered hot.  The default is 1000,
14774 which means that a basic block is considered hot in a function if it
14775 is executed more frequently than 1/1000 of the frequency of the entry
14776 block of the function.  0 means that it is never considered hot.
14778 @item unlikely-bb-count-fraction
14779 The denominator n of fraction 1/n of the number of profiled runs of
14780 the entire program below which the execution count of a basic block
14781 must be in order for the basic block to be considered unlikely executed.
14782 The default is 20, which means that a basic block is considered unlikely
14783 executed if it is executed in fewer than 1/20, or 5%, of the runs of
14784 the program.  0 means that it is always considered unlikely executed.
14786 @item max-predicted-iterations
14787 The maximum number of loop iterations we predict statically.  This is useful
14788 in cases where a function contains a single loop with known bound and
14789 another loop with unknown bound.
14790 The known number of iterations is predicted correctly, while
14791 the unknown number of iterations average to roughly 10.  This means that the
14792 loop without bounds appears artificially cold relative to the other one.
14794 @item builtin-expect-probability
14795 Control the probability of the expression having the specified value. This
14796 parameter takes a percentage (i.e.@: 0 ... 100) as input.
14798 @item builtin-string-cmp-inline-length
14799 The maximum length of a constant string for a builtin string cmp call 
14800 eligible for inlining.
14802 @item align-threshold
14804 Select fraction of the maximal frequency of executions of a basic block in
14805 a function to align the basic block.
14807 @item align-loop-iterations
14809 A loop expected to iterate at least the selected number of iterations is
14810 aligned.
14812 @item tracer-dynamic-coverage
14813 @itemx tracer-dynamic-coverage-feedback
14815 This value is used to limit superblock formation once the given percentage of
14816 executed instructions is covered.  This limits unnecessary code size
14817 expansion.
14819 The @option{tracer-dynamic-coverage-feedback} parameter
14820 is used only when profile
14821 feedback is available.  The real profiles (as opposed to statically estimated
14822 ones) are much less balanced allowing the threshold to be larger value.
14824 @item tracer-max-code-growth
14825 Stop tail duplication once code growth has reached given percentage.  This is
14826 a rather artificial limit, as most of the duplicates are eliminated later in
14827 cross jumping, so it may be set to much higher values than is the desired code
14828 growth.
14830 @item tracer-min-branch-ratio
14832 Stop reverse growth when the reverse probability of best edge is less than this
14833 threshold (in percent).
14835 @item tracer-min-branch-probability
14836 @itemx tracer-min-branch-probability-feedback
14838 Stop forward growth if the best edge has probability lower than this
14839 threshold.
14841 Similarly to @option{tracer-dynamic-coverage} two parameters are
14842 provided.  @option{tracer-min-branch-probability-feedback} is used for
14843 compilation with profile feedback and @option{tracer-min-branch-probability}
14844 compilation without.  The value for compilation with profile feedback
14845 needs to be more conservative (higher) in order to make tracer
14846 effective.
14848 @item stack-clash-protection-guard-size
14849 Specify the size of the operating system provided stack guard as
14850 2 raised to @var{num} bytes.  Higher values may reduce the
14851 number of explicit probes, but a value larger than the operating system
14852 provided guard will leave code vulnerable to stack clash style attacks.
14854 @item stack-clash-protection-probe-interval
14855 Stack clash protection involves probing stack space as it is allocated.  This
14856 param controls the maximum distance between probes into the stack as 2 raised
14857 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
14858 larger than the operating system provided guard will leave code vulnerable to
14859 stack clash style attacks.
14861 @item max-cse-path-length
14863 The maximum number of basic blocks on path that CSE considers.
14865 @item max-cse-insns
14866 The maximum number of instructions CSE processes before flushing.
14868 @item ggc-min-expand
14870 GCC uses a garbage collector to manage its own memory allocation.  This
14871 parameter specifies the minimum percentage by which the garbage
14872 collector's heap should be allowed to expand between collections.
14873 Tuning this may improve compilation speed; it has no effect on code
14874 generation.
14876 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
14877 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
14878 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
14879 GCC is not able to calculate RAM on a particular platform, the lower
14880 bound of 30% is used.  Setting this parameter and
14881 @option{ggc-min-heapsize} to zero causes a full collection to occur at
14882 every opportunity.  This is extremely slow, but can be useful for
14883 debugging.
14885 @item ggc-min-heapsize
14887 Minimum size of the garbage collector's heap before it begins bothering
14888 to collect garbage.  The first collection occurs after the heap expands
14889 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
14890 tuning this may improve compilation speed, and has no effect on code
14891 generation.
14893 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
14894 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
14895 with a lower bound of 4096 (four megabytes) and an upper bound of
14896 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
14897 particular platform, the lower bound is used.  Setting this parameter
14898 very large effectively disables garbage collection.  Setting this
14899 parameter and @option{ggc-min-expand} to zero causes a full collection
14900 to occur at every opportunity.
14902 @item max-reload-search-insns
14903 The maximum number of instruction reload should look backward for equivalent
14904 register.  Increasing values mean more aggressive optimization, making the
14905 compilation time increase with probably slightly better performance.
14907 @item max-cselib-memory-locations
14908 The maximum number of memory locations cselib should take into account.
14909 Increasing values mean more aggressive optimization, making the compilation time
14910 increase with probably slightly better performance.
14912 @item max-sched-ready-insns
14913 The maximum number of instructions ready to be issued the scheduler should
14914 consider at any given time during the first scheduling pass.  Increasing
14915 values mean more thorough searches, making the compilation time increase
14916 with probably little benefit.
14918 @item max-sched-region-blocks
14919 The maximum number of blocks in a region to be considered for
14920 interblock scheduling.
14922 @item max-pipeline-region-blocks
14923 The maximum number of blocks in a region to be considered for
14924 pipelining in the selective scheduler.
14926 @item max-sched-region-insns
14927 The maximum number of insns in a region to be considered for
14928 interblock scheduling.
14930 @item max-pipeline-region-insns
14931 The maximum number of insns in a region to be considered for
14932 pipelining in the selective scheduler.
14934 @item min-spec-prob
14935 The minimum probability (in percents) of reaching a source block
14936 for interblock speculative scheduling.
14938 @item max-sched-extend-regions-iters
14939 The maximum number of iterations through CFG to extend regions.
14940 A value of 0 disables region extensions.
14942 @item max-sched-insn-conflict-delay
14943 The maximum conflict delay for an insn to be considered for speculative motion.
14945 @item sched-spec-prob-cutoff
14946 The minimal probability of speculation success (in percents), so that
14947 speculative insns are scheduled.
14949 @item sched-state-edge-prob-cutoff
14950 The minimum probability an edge must have for the scheduler to save its
14951 state across it.
14953 @item sched-mem-true-dep-cost
14954 Minimal distance (in CPU cycles) between store and load targeting same
14955 memory locations.
14957 @item selsched-max-lookahead
14958 The maximum size of the lookahead window of selective scheduling.  It is a
14959 depth of search for available instructions.
14961 @item selsched-max-sched-times
14962 The maximum number of times that an instruction is scheduled during
14963 selective scheduling.  This is the limit on the number of iterations
14964 through which the instruction may be pipelined.
14966 @item selsched-insns-to-rename
14967 The maximum number of best instructions in the ready list that are considered
14968 for renaming in the selective scheduler.
14970 @item sms-min-sc
14971 The minimum value of stage count that swing modulo scheduler
14972 generates.
14974 @item max-last-value-rtl
14975 The maximum size measured as number of RTLs that can be recorded in an expression
14976 in combiner for a pseudo register as last known value of that register.
14978 @item max-combine-insns
14979 The maximum number of instructions the RTL combiner tries to combine.
14981 @item integer-share-limit
14982 Small integer constants can use a shared data structure, reducing the
14983 compiler's memory usage and increasing its speed.  This sets the maximum
14984 value of a shared integer constant.
14986 @item ssp-buffer-size
14987 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
14988 protection when @option{-fstack-protector} is used.
14990 @item min-size-for-stack-sharing
14991 The minimum size of variables taking part in stack slot sharing when not
14992 optimizing.
14994 @item max-jump-thread-duplication-stmts
14995 Maximum number of statements allowed in a block that needs to be
14996 duplicated when threading jumps.
14998 @item max-jump-thread-paths
14999 The maximum number of paths to consider when searching for jump threading
15000 opportunities.  When arriving at a block, incoming edges are only considered
15001 if the number of paths to be searched so far multiplied by the number of
15002 incoming edges does not exhaust the specified maximum number of paths to
15003 consider.
15005 @item max-fields-for-field-sensitive
15006 Maximum number of fields in a structure treated in
15007 a field sensitive manner during pointer analysis.
15009 @item prefetch-latency
15010 Estimate on average number of instructions that are executed before
15011 prefetch finishes.  The distance prefetched ahead is proportional
15012 to this constant.  Increasing this number may also lead to less
15013 streams being prefetched (see @option{simultaneous-prefetches}).
15015 @item simultaneous-prefetches
15016 Maximum number of prefetches that can run at the same time.
15018 @item l1-cache-line-size
15019 The size of cache line in L1 data cache, in bytes.
15021 @item l1-cache-size
15022 The size of L1 data cache, in kilobytes.
15024 @item l2-cache-size
15025 The size of L2 data cache, in kilobytes.
15027 @item prefetch-dynamic-strides
15028 Whether the loop array prefetch pass should issue software prefetch hints
15029 for strides that are non-constant.  In some cases this may be
15030 beneficial, though the fact the stride is non-constant may make it
15031 hard to predict when there is clear benefit to issuing these hints.
15033 Set to 1 if the prefetch hints should be issued for non-constant
15034 strides.  Set to 0 if prefetch hints should be issued only for strides that
15035 are known to be constant and below @option{prefetch-minimum-stride}.
15037 @item prefetch-minimum-stride
15038 Minimum constant stride, in bytes, to start using prefetch hints for.  If
15039 the stride is less than this threshold, prefetch hints will not be issued.
15041 This setting is useful for processors that have hardware prefetchers, in
15042 which case there may be conflicts between the hardware prefetchers and
15043 the software prefetchers.  If the hardware prefetchers have a maximum
15044 stride they can handle, it should be used here to improve the use of
15045 software prefetchers.
15047 A value of -1 means we don't have a threshold and therefore
15048 prefetch hints can be issued for any constant stride.
15050 This setting is only useful for strides that are known and constant.
15052 @item destructive-interference-size
15053 @item constructive-interference-size
15054 The values for the C++17 variables
15055 @code{std::hardware_destructive_interference_size} and
15056 @code{std::hardware_constructive_interference_size}.  The destructive
15057 interference size is the minimum recommended offset between two
15058 independent concurrently-accessed objects; the constructive
15059 interference size is the maximum recommended size of contiguous memory
15060 accessed together.  Typically both will be the size of an L1 cache
15061 line for the target, in bytes.  For a generic target covering a range of L1
15062 cache line sizes, typically the constructive interference size will be
15063 the small end of the range and the destructive size will be the large
15064 end.
15066 The destructive interference size is intended to be used for layout,
15067 and thus has ABI impact.  The default value is not expected to be
15068 stable, and on some targets varies with @option{-mtune}, so use of
15069 this variable in a context where ABI stability is important, such as
15070 the public interface of a library, is strongly discouraged; if it is
15071 used in that context, users can stabilize the value using this
15072 option.
15074 The constructive interference size is less sensitive, as it is
15075 typically only used in a @samp{static_assert} to make sure that a type
15076 fits within a cache line.
15078 See also @option{-Winterference-size}.
15080 @item loop-interchange-max-num-stmts
15081 The maximum number of stmts in a loop to be interchanged.
15083 @item loop-interchange-stride-ratio
15084 The minimum ratio between stride of two loops for interchange to be profitable.
15086 @item min-insn-to-prefetch-ratio
15087 The minimum ratio between the number of instructions and the
15088 number of prefetches to enable prefetching in a loop.
15090 @item prefetch-min-insn-to-mem-ratio
15091 The minimum ratio between the number of instructions and the
15092 number of memory references to enable prefetching in a loop.
15094 @item use-canonical-types
15095 Whether the compiler should use the ``canonical'' type system.
15096 Should always be 1, which uses a more efficient internal
15097 mechanism for comparing types in C++ and Objective-C++.  However, if
15098 bugs in the canonical type system are causing compilation failures,
15099 set this value to 0 to disable canonical types.
15101 @item switch-conversion-max-branch-ratio
15102 Switch initialization conversion refuses to create arrays that are
15103 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15104 branches in the switch.
15106 @item max-partial-antic-length
15107 Maximum length of the partial antic set computed during the tree
15108 partial redundancy elimination optimization (@option{-ftree-pre}) when
15109 optimizing at @option{-O3} and above.  For some sorts of source code
15110 the enhanced partial redundancy elimination optimization can run away,
15111 consuming all of the memory available on the host machine.  This
15112 parameter sets a limit on the length of the sets that are computed,
15113 which prevents the runaway behavior.  Setting a value of 0 for
15114 this parameter allows an unlimited set length.
15116 @item rpo-vn-max-loop-depth
15117 Maximum loop depth that is value-numbered optimistically.
15118 When the limit hits the innermost
15119 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15120 loop nest are value-numbered optimistically and the remaining ones not.
15122 @item sccvn-max-alias-queries-per-access
15123 Maximum number of alias-oracle queries we perform when looking for
15124 redundancies for loads and stores.  If this limit is hit the search
15125 is aborted and the load or store is not considered redundant.  The
15126 number of queries is algorithmically limited to the number of
15127 stores on all paths from the load to the function entry.
15129 @item ira-max-loops-num
15130 IRA uses regional register allocation by default.  If a function
15131 contains more loops than the number given by this parameter, only at most
15132 the given number of the most frequently-executed loops form regions
15133 for regional register allocation.
15135 @item ira-max-conflict-table-size 
15136 Although IRA uses a sophisticated algorithm to compress the conflict
15137 table, the table can still require excessive amounts of memory for
15138 huge functions.  If the conflict table for a function could be more
15139 than the size in MB given by this parameter, the register allocator
15140 instead uses a faster, simpler, and lower-quality
15141 algorithm that does not require building a pseudo-register conflict table.  
15143 @item ira-loop-reserved-regs
15144 IRA can be used to evaluate more accurate register pressure in loops
15145 for decisions to move loop invariants (see @option{-O3}).  The number
15146 of available registers reserved for some other purposes is given
15147 by this parameter.  Default of the parameter
15148 is the best found from numerous experiments.
15150 @item ira-consider-dup-in-all-alts
15151 Make IRA to consider matching constraint (duplicated operand number)
15152 heavily in all available alternatives for preferred register class.
15153 If it is set as zero, it means IRA only respects the matching
15154 constraint when it's in the only available alternative with an
15155 appropriate register class.  Otherwise, it means IRA will check all
15156 available alternatives for preferred register class even if it has
15157 found some choice with an appropriate register class and respect the
15158 found qualified matching constraint.
15160 @item lra-inheritance-ebb-probability-cutoff
15161 LRA tries to reuse values reloaded in registers in subsequent insns.
15162 This optimization is called inheritance.  EBB is used as a region to
15163 do this optimization.  The parameter defines a minimal fall-through
15164 edge probability in percentage used to add BB to inheritance EBB in
15165 LRA.  The default value was chosen
15166 from numerous runs of SPEC2000 on x86-64.
15168 @item loop-invariant-max-bbs-in-loop
15169 Loop invariant motion can be very expensive, both in compilation time and
15170 in amount of needed compile-time memory, with very large loops.  Loops
15171 with more basic blocks than this parameter won't have loop invariant
15172 motion optimization performed on them.
15174 @item loop-max-datarefs-for-datadeps
15175 Building data dependencies is expensive for very large loops.  This
15176 parameter limits the number of data references in loops that are
15177 considered for data dependence analysis.  These large loops are no
15178 handled by the optimizations using loop data dependencies.
15180 @item max-vartrack-size
15181 Sets a maximum number of hash table slots to use during variable
15182 tracking dataflow analysis of any function.  If this limit is exceeded
15183 with variable tracking at assignments enabled, analysis for that
15184 function is retried without it, after removing all debug insns from
15185 the function.  If the limit is exceeded even without debug insns, var
15186 tracking analysis is completely disabled for the function.  Setting
15187 the parameter to zero makes it unlimited.
15189 @item max-vartrack-expr-depth
15190 Sets a maximum number of recursion levels when attempting to map
15191 variable names or debug temporaries to value expressions.  This trades
15192 compilation time for more complete debug information.  If this is set too
15193 low, value expressions that are available and could be represented in
15194 debug information may end up not being used; setting this higher may
15195 enable the compiler to find more complex debug expressions, but compile
15196 time and memory use may grow.
15198 @item max-debug-marker-count
15199 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15200 markers) to avoid complexity explosion at inlining or expanding to RTL.
15201 If a function has more such gimple stmts than the set limit, such stmts
15202 will be dropped from the inlined copy of a function, and from its RTL
15203 expansion.
15205 @item min-nondebug-insn-uid
15206 Use uids starting at this parameter for nondebug insns.  The range below
15207 the parameter is reserved exclusively for debug insns created by
15208 @option{-fvar-tracking-assignments}, but debug insns may get
15209 (non-overlapping) uids above it if the reserved range is exhausted.
15211 @item ipa-sra-ptr-growth-factor
15212 IPA-SRA replaces a pointer to an aggregate with one or more new
15213 parameters only when their cumulative size is less or equal to
15214 @option{ipa-sra-ptr-growth-factor} times the size of the original
15215 pointer parameter.
15217 @item ipa-sra-max-replacements
15218 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
15219 consequence, it is also the maximum number of replacements of a formal
15220 parameter.
15222 @item sra-max-scalarization-size-Ospeed
15223 @itemx sra-max-scalarization-size-Osize
15224 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15225 replace scalar parts of aggregates with uses of independent scalar
15226 variables.  These parameters control the maximum size, in storage units,
15227 of aggregate which is considered for replacement when compiling for
15228 speed
15229 (@option{sra-max-scalarization-size-Ospeed}) or size
15230 (@option{sra-max-scalarization-size-Osize}) respectively.
15232 @item sra-max-propagations
15233 The maximum number of artificial accesses that Scalar Replacement of
15234 Aggregates (SRA) will track, per one local variable, in order to
15235 facilitate copy propagation.
15237 @item tm-max-aggregate-size
15238 When making copies of thread-local variables in a transaction, this
15239 parameter specifies the size in bytes after which variables are
15240 saved with the logging functions as opposed to save/restore code
15241 sequence pairs.  This option only applies when using
15242 @option{-fgnu-tm}.
15244 @item graphite-max-nb-scop-params
15245 To avoid exponential effects in the Graphite loop transforms, the
15246 number of parameters in a Static Control Part (SCoP) is bounded.
15247 A value of zero can be used to lift
15248 the bound.  A variable whose value is unknown at compilation time and
15249 defined outside a SCoP is a parameter of the SCoP.
15251 @item loop-block-tile-size
15252 Loop blocking or strip mining transforms, enabled with
15253 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
15254 loop in the loop nest by a given number of iterations.  The strip
15255 length can be changed using the @option{loop-block-tile-size}
15256 parameter.
15258 @item ipa-jump-function-lookups
15259 Specifies number of statements visited during jump function offset discovery.
15261 @item ipa-cp-value-list-size
15262 IPA-CP attempts to track all possible values and types passed to a function's
15263 parameter in order to propagate them and perform devirtualization.
15264 @option{ipa-cp-value-list-size} is the maximum number of values and types it
15265 stores per one formal parameter of a function.
15267 @item ipa-cp-eval-threshold
15268 IPA-CP calculates its own score of cloning profitability heuristics
15269 and performs those cloning opportunities with scores that exceed
15270 @option{ipa-cp-eval-threshold}.
15272 @item ipa-cp-max-recursive-depth
15273 Maximum depth of recursive cloning for self-recursive function.
15275 @item ipa-cp-min-recursive-probability
15276 Recursive cloning only when the probability of call being executed exceeds
15277 the parameter.
15279 @item ipa-cp-profile-count-base
15280 When using @option{-fprofile-use} option, IPA-CP will consider the measured
15281 execution count of a call graph edge at this percentage position in their
15282 histogram as the basis for its heuristics calculation.
15284 @item ipa-cp-recursive-freq-factor
15285 The number of times interprocedural copy propagation expects recursive
15286 functions to call themselves.
15288 @item ipa-cp-recursion-penalty
15289 Percentage penalty the recursive functions will receive when they
15290 are evaluated for cloning.
15292 @item ipa-cp-single-call-penalty
15293 Percentage penalty functions containing a single call to another
15294 function will receive when they are evaluated for cloning.
15296 @item ipa-max-agg-items
15297 IPA-CP is also capable to propagate a number of scalar values passed
15298 in an aggregate. @option{ipa-max-agg-items} controls the maximum
15299 number of such values per one parameter.
15301 @item ipa-cp-loop-hint-bonus
15302 When IPA-CP determines that a cloning candidate would make the number
15303 of iterations of a loop known, it adds a bonus of
15304 @option{ipa-cp-loop-hint-bonus} to the profitability score of
15305 the candidate.
15307 @item ipa-max-loop-predicates
15308 The maximum number of different predicates IPA will use to describe when
15309 loops in a function have known properties.
15311 @item ipa-max-aa-steps
15312 During its analysis of function bodies, IPA-CP employs alias analysis
15313 in order to track values pointed to by function parameters.  In order
15314 not spend too much time analyzing huge functions, it gives up and
15315 consider all memory clobbered after examining
15316 @option{ipa-max-aa-steps} statements modifying memory.
15318 @item ipa-max-switch-predicate-bounds
15319 Maximal number of boundary endpoints of case ranges of switch statement.
15320 For switch exceeding this limit, IPA-CP will not construct cloning cost
15321 predicate, which is used to estimate cloning benefit, for default case
15322 of the switch statement.
15324 @item ipa-max-param-expr-ops
15325 IPA-CP will analyze conditional statement that references some function
15326 parameter to estimate benefit for cloning upon certain constant value.
15327 But if number of operations in a parameter expression exceeds
15328 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
15329 one, and is not handled by IPA analysis.
15331 @item lto-partitions
15332 Specify desired number of partitions produced during WHOPR compilation.
15333 The number of partitions should exceed the number of CPUs used for compilation.
15335 @item lto-min-partition
15336 Size of minimal partition for WHOPR (in estimated instructions).
15337 This prevents expenses of splitting very small programs into too many
15338 partitions.
15340 @item lto-max-partition
15341 Size of max partition for WHOPR (in estimated instructions).
15342 to provide an upper bound for individual size of partition.
15343 Meant to be used only with balanced partitioning.
15345 @item lto-max-streaming-parallelism
15346 Maximal number of parallel processes used for LTO streaming.
15348 @item cxx-max-namespaces-for-diagnostic-help
15349 The maximum number of namespaces to consult for suggestions when C++
15350 name lookup fails for an identifier.
15352 @item sink-frequency-threshold
15353 The maximum relative execution frequency (in percents) of the target block
15354 relative to a statement's original block to allow statement sinking of a
15355 statement.  Larger numbers result in more aggressive statement sinking.
15356 A small positive adjustment is applied for
15357 statements with memory operands as those are even more profitable so sink.
15359 @item max-stores-to-sink
15360 The maximum number of conditional store pairs that can be sunk.  Set to 0
15361 if either vectorization (@option{-ftree-vectorize}) or if-conversion
15362 (@option{-ftree-loop-if-convert}) is disabled.
15364 @item case-values-threshold
15365 The smallest number of different values for which it is best to use a
15366 jump-table instead of a tree of conditional branches.  If the value is
15367 0, use the default for the machine.
15369 @item jump-table-max-growth-ratio-for-size
15370 The maximum code size growth ratio when expanding
15371 into a jump table (in percent).  The parameter is used when
15372 optimizing for size.
15374 @item jump-table-max-growth-ratio-for-speed
15375 The maximum code size growth ratio when expanding
15376 into a jump table (in percent).  The parameter is used when
15377 optimizing for speed.
15379 @item tree-reassoc-width
15380 Set the maximum number of instructions executed in parallel in
15381 reassociated tree. This parameter overrides target dependent
15382 heuristics used by default if has non zero value.
15384 @item sched-pressure-algorithm
15385 Choose between the two available implementations of
15386 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
15387 and is the more likely to prevent instructions from being reordered.
15388 Algorithm 2 was designed to be a compromise between the relatively
15389 conservative approach taken by algorithm 1 and the rather aggressive
15390 approach taken by the default scheduler.  It relies more heavily on
15391 having a regular register file and accurate register pressure classes.
15392 See @file{haifa-sched.cc} in the GCC sources for more details.
15394 The default choice depends on the target.
15396 @item max-slsr-cand-scan
15397 Set the maximum number of existing candidates that are considered when
15398 seeking a basis for a new straight-line strength reduction candidate.
15400 @item asan-globals
15401 Enable buffer overflow detection for global objects.  This kind
15402 of protection is enabled by default if you are using
15403 @option{-fsanitize=address} option.
15404 To disable global objects protection use @option{--param asan-globals=0}.
15406 @item asan-stack
15407 Enable buffer overflow detection for stack objects.  This kind of
15408 protection is enabled by default when using @option{-fsanitize=address}.
15409 To disable stack protection use @option{--param asan-stack=0} option.
15411 @item asan-instrument-reads
15412 Enable buffer overflow detection for memory reads.  This kind of
15413 protection is enabled by default when using @option{-fsanitize=address}.
15414 To disable memory reads protection use
15415 @option{--param asan-instrument-reads=0}.
15417 @item asan-instrument-writes
15418 Enable buffer overflow detection for memory writes.  This kind of
15419 protection is enabled by default when using @option{-fsanitize=address}.
15420 To disable memory writes protection use
15421 @option{--param asan-instrument-writes=0} option.
15423 @item asan-memintrin
15424 Enable detection for built-in functions.  This kind of protection
15425 is enabled by default when using @option{-fsanitize=address}.
15426 To disable built-in functions protection use
15427 @option{--param asan-memintrin=0}.
15429 @item asan-use-after-return
15430 Enable detection of use-after-return.  This kind of protection
15431 is enabled by default when using the @option{-fsanitize=address} option.
15432 To disable it use @option{--param asan-use-after-return=0}.
15434 Note: By default the check is disabled at run time.  To enable it,
15435 add @code{detect_stack_use_after_return=1} to the environment variable
15436 @env{ASAN_OPTIONS}.
15438 @item asan-instrumentation-with-call-threshold
15439 If number of memory accesses in function being instrumented
15440 is greater or equal to this number, use callbacks instead of inline checks.
15441 E.g. to disable inline code use
15442 @option{--param asan-instrumentation-with-call-threshold=0}.
15444 @item hwasan-instrument-stack
15445 Enable hwasan instrumentation of statically sized stack-allocated variables.
15446 This kind of instrumentation is enabled by default when using
15447 @option{-fsanitize=hwaddress} and disabled by default when using
15448 @option{-fsanitize=kernel-hwaddress}.
15449 To disable stack instrumentation use
15450 @option{--param hwasan-instrument-stack=0}, and to enable it use
15451 @option{--param hwasan-instrument-stack=1}.
15453 @item hwasan-random-frame-tag
15454 When using stack instrumentation, decide tags for stack variables using a
15455 deterministic sequence beginning at a random tag for each frame.  With this
15456 parameter unset tags are chosen using the same sequence but beginning from 1.
15457 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
15458 for @option{-fsanitize=kernel-hwaddress}.
15459 To disable it use @option{--param hwasan-random-frame-tag=0}.
15461 @item hwasan-instrument-allocas
15462 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
15463 This kind of instrumentation is enabled by default when using
15464 @option{-fsanitize=hwaddress} and disabled by default when using
15465 @option{-fsanitize=kernel-hwaddress}.
15466 To disable instrumentation of such variables use
15467 @option{--param hwasan-instrument-allocas=0}, and to enable it use
15468 @option{--param hwasan-instrument-allocas=1}.
15470 @item hwasan-instrument-reads
15471 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
15472 default for both @option{-fsanitize=hwaddress} and
15473 @option{-fsanitize=kernel-hwaddress}.
15474 To disable checking memory reads use
15475 @option{--param hwasan-instrument-reads=0}.
15477 @item hwasan-instrument-writes
15478 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
15479 default for both @option{-fsanitize=hwaddress} and
15480 @option{-fsanitize=kernel-hwaddress}.
15481 To disable checking memory writes use
15482 @option{--param hwasan-instrument-writes=0}.
15484 @item hwasan-instrument-mem-intrinsics
15485 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
15486 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
15487 and @option{-fsanitize=kernel-hwaddress}.
15488 To disable instrumentation of builtin functions use
15489 @option{--param hwasan-instrument-mem-intrinsics=0}.
15491 @item use-after-scope-direct-emission-threshold
15492 If the size of a local variable in bytes is smaller or equal to this
15493 number, directly poison (or unpoison) shadow memory instead of using
15494 run-time callbacks.
15496 @item tsan-distinguish-volatile
15497 Emit special instrumentation for accesses to volatiles.
15499 @item tsan-instrument-func-entry-exit
15500 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
15502 @item max-fsm-thread-path-insns
15503 Maximum number of instructions to copy when duplicating blocks on a
15504 finite state automaton jump thread path.
15506 @item threader-debug
15507 threader-debug=[none|all] Enables verbose dumping of the threader solver.
15509 @item parloops-chunk-size
15510 Chunk size of omp schedule for loops parallelized by parloops.
15512 @item parloops-schedule
15513 Schedule type of omp schedule for loops parallelized by parloops (static,
15514 dynamic, guided, auto, runtime).
15516 @item parloops-min-per-thread
15517 The minimum number of iterations per thread of an innermost parallelized
15518 loop for which the parallelized variant is preferred over the single threaded
15519 one.  Note that for a parallelized loop nest the
15520 minimum number of iterations of the outermost loop per thread is two.
15522 @item max-ssa-name-query-depth
15523 Maximum depth of recursion when querying properties of SSA names in things
15524 like fold routines.  One level of recursion corresponds to following a
15525 use-def chain.
15527 @item max-speculative-devirt-maydefs
15528 The maximum number of may-defs we analyze when looking for a must-def
15529 specifying the dynamic type of an object that invokes a virtual call
15530 we may be able to devirtualize speculatively.
15532 @item max-vrp-switch-assertions
15533 The maximum number of assertions to add along the default edge of a switch
15534 statement during VRP.
15536 @item evrp-sparse-threshold
15537 Maximum number of basic blocks before EVRP uses a sparse cache.
15539 @item vrp1-mode
15540 Specifies the mode VRP pass 1 should operate in.
15542 @item vrp2-mode
15543 Specifies the mode VRP pass 2 should operate in.
15545 @item ranger-debug
15546 Specifies the type of debug output to be issued for ranges.
15548 @item evrp-switch-limit
15549 Specifies the maximum number of switch cases before EVRP ignores a switch.
15551 @item unroll-jam-min-percent
15552 The minimum percentage of memory references that must be optimized
15553 away for the unroll-and-jam transformation to be considered profitable.
15555 @item unroll-jam-max-unroll
15556 The maximum number of times the outer loop should be unrolled by
15557 the unroll-and-jam transformation.
15559 @item max-rtl-if-conversion-unpredictable-cost
15560 Maximum permissible cost for the sequence that would be generated
15561 by the RTL if-conversion pass for a branch that is considered unpredictable.
15563 @item max-variable-expansions-in-unroller
15564 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
15565 of times that an individual variable will be expanded during loop unrolling.
15567 @item partial-inlining-entry-probability
15568 Maximum probability of the entry BB of split region
15569 (in percent relative to entry BB of the function)
15570 to make partial inlining happen.
15572 @item max-tracked-strlens
15573 Maximum number of strings for which strlen optimization pass will
15574 track string lengths.
15576 @item gcse-after-reload-partial-fraction
15577 The threshold ratio for performing partial redundancy
15578 elimination after reload.
15580 @item gcse-after-reload-critical-fraction
15581 The threshold ratio of critical edges execution count that
15582 permit performing redundancy elimination after reload.
15584 @item max-loop-header-insns
15585 The maximum number of insns in loop header duplicated
15586 by the copy loop headers pass.
15588 @item vect-epilogues-nomask
15589 Enable loop epilogue vectorization using smaller vector size.
15591 @item vect-partial-vector-usage
15592 Controls when the loop vectorizer considers using partial vector loads
15593 and stores as an alternative to falling back to scalar code.  0 stops
15594 the vectorizer from ever using partial vector loads and stores.  1 allows
15595 partial vector loads and stores if vectorization removes the need for the
15596 code to iterate.  2 allows partial vector loads and stores in all loops.
15597 The parameter only has an effect on targets that support partial
15598 vector loads and stores.
15600 @item vect-inner-loop-cost-factor
15601 The maximum factor which the loop vectorizer applies to the cost of statements
15602 in an inner loop relative to the loop being vectorized.  The factor applied
15603 is the maximum of the estimated number of iterations of the inner loop and
15604 this parameter.  The default value of this parameter is 50.
15606 @item vect-induction-float
15607 Enable loop vectorization of floating point inductions.
15609 @item avoid-fma-max-bits
15610 Maximum number of bits for which we avoid creating FMAs.
15612 @item sms-loop-average-count-threshold
15613 A threshold on the average loop count considered by the swing modulo scheduler.
15615 @item sms-dfa-history
15616 The number of cycles the swing modulo scheduler considers when checking
15617 conflicts using DFA.
15619 @item graphite-allow-codegen-errors
15620 Whether codegen errors should be ICEs when @option{-fchecking}.
15622 @item sms-max-ii-factor
15623 A factor for tuning the upper bound that swing modulo scheduler
15624 uses for scheduling a loop.
15626 @item lra-max-considered-reload-pseudos
15627 The max number of reload pseudos which are considered during
15628 spilling a non-reload pseudo.
15630 @item max-pow-sqrt-depth
15631 Maximum depth of sqrt chains to use when synthesizing exponentiation
15632 by a real constant.
15634 @item max-dse-active-local-stores
15635 Maximum number of active local stores in RTL dead store elimination.
15637 @item asan-instrument-allocas
15638 Enable asan allocas/VLAs protection.
15640 @item max-iterations-computation-cost
15641 Bound on the cost of an expression to compute the number of iterations.
15643 @item max-isl-operations
15644 Maximum number of isl operations, 0 means unlimited.
15646 @item graphite-max-arrays-per-scop
15647 Maximum number of arrays per scop.
15649 @item max-vartrack-reverse-op-size
15650 Max. size of loc list for which reverse ops should be added.
15652 @item fsm-scale-path-stmts
15653 Scale factor to apply to the number of statements in a threading path
15654 when comparing to the number of (scaled) blocks.
15656 @item uninit-control-dep-attempts
15657 Maximum number of nested calls to search for control dependencies
15658 during uninitialized variable analysis.
15660 @item fsm-scale-path-blocks
15661 Scale factor to apply to the number of blocks in a threading path
15662 when comparing to the number of (scaled) statements.
15664 @item sched-autopref-queue-depth
15665 Hardware autoprefetcher scheduler model control flag.
15666 Number of lookahead cycles the model looks into; at '
15667 ' only enable instruction sorting heuristic.
15669 @item loop-versioning-max-inner-insns
15670 The maximum number of instructions that an inner loop can have
15671 before the loop versioning pass considers it too big to copy.
15673 @item loop-versioning-max-outer-insns
15674 The maximum number of instructions that an outer loop can have
15675 before the loop versioning pass considers it too big to copy,
15676 discounting any instructions in inner loops that directly benefit
15677 from versioning.
15679 @item ssa-name-def-chain-limit
15680 The maximum number of SSA_NAME assignments to follow in determining
15681 a property of a variable such as its value.  This limits the number
15682 of iterations or recursive calls GCC performs when optimizing certain
15683 statements or when determining their validity prior to issuing
15684 diagnostics.
15686 @item store-merging-max-size
15687 Maximum size of a single store merging region in bytes.
15689 @item hash-table-verification-limit
15690 The number of elements for which hash table verification is done
15691 for each searched element.
15693 @item max-find-base-term-values
15694 Maximum number of VALUEs handled during a single find_base_term call.
15696 @item analyzer-max-enodes-per-program-point
15697 The maximum number of exploded nodes per program point within
15698 the analyzer, before terminating analysis of that point.
15700 @item analyzer-max-constraints
15701 The maximum number of constraints per state.
15703 @item analyzer-min-snodes-for-call-summary
15704 The minimum number of supernodes within a function for the
15705 analyzer to consider summarizing its effects at call sites.
15707 @item analyzer-max-enodes-for-full-dump
15708 The maximum depth of exploded nodes that should appear in a dot dump
15709 before switching to a less verbose format.
15711 @item analyzer-max-recursion-depth
15712 The maximum number of times a callsite can appear in a call stack
15713 within the analyzer, before terminating analysis of a call that would
15714 recurse deeper.
15716 @item analyzer-max-svalue-depth
15717 The maximum depth of a symbolic value, before approximating
15718 the value as unknown.
15720 @item analyzer-max-infeasible-edges
15721 The maximum number of infeasible edges to reject before declaring
15722 a diagnostic as infeasible.
15724 @item gimple-fe-computed-hot-bb-threshold
15725 The number of executions of a basic block which is considered hot.
15726 The parameter is used only in GIMPLE FE.
15728 @item analyzer-bb-explosion-factor
15729 The maximum number of 'after supernode' exploded nodes within the analyzer
15730 per supernode, before terminating analysis.
15732 @item ranger-logical-depth
15733 Maximum depth of logical expression evaluation ranger will look through
15734 when evaluating outgoing edge ranges.
15736 @item relation-block-limit
15737 Maximum number of relations the oracle will register in a basic block.
15739 @item min-pagesize
15740 Minimum page size for warning purposes.
15742 @item openacc-kernels
15743 Specify mode of OpenACC `kernels' constructs handling.
15744 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
15745 constructs are decomposed into parts, a sequence of compute
15746 constructs, each then handled individually.
15747 This is work in progress.
15748 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
15749 constructs are handled by the @samp{parloops} pass, en bloc.
15750 This is the current default.
15752 @item openacc-privatization
15753 Specify mode of OpenACC privatization diagnostics for
15754 @option{-fopt-info-omp-note} and applicable
15755 @option{-fdump-tree-*-details}.
15756 With @option{--param=openacc-privatization=quiet}, don't diagnose.
15757 This is the current default.
15758 With @option{--param=openacc-privatization=noisy}, do diagnose.
15760 @end table
15762 The following choices of @var{name} are available on AArch64 targets:
15764 @table @gcctabopt
15765 @item aarch64-sve-compare-costs
15766 When vectorizing for SVE, consider using ``unpacked'' vectors for
15767 smaller elements and use the cost model to pick the cheapest approach.
15768 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
15770 Using unpacked vectors includes storing smaller elements in larger
15771 containers and accessing elements with extending loads and truncating
15772 stores.
15774 @item aarch64-float-recp-precision
15775 The number of Newton iterations for calculating the reciprocal for float type.
15776 The precision of division is proportional to this param when division
15777 approximation is enabled.  The default value is 1.
15779 @item aarch64-double-recp-precision
15780 The number of Newton iterations for calculating the reciprocal for double type.
15781 The precision of division is propotional to this param when division
15782 approximation is enabled.  The default value is 2.
15784 @item aarch64-autovec-preference
15785 Force an ISA selection strategy for auto-vectorization.  Accepts values from
15786 0 to 4, inclusive.
15787 @table @samp
15788 @item 0
15789 Use the default heuristics.
15790 @item 1
15791 Use only Advanced SIMD for auto-vectorization.
15792 @item 2
15793 Use only SVE for auto-vectorization.
15794 @item 3
15795 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
15796 deemed equal.
15797 @item 4
15798 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
15799 @end table
15800 The default value is 0.
15802 @item aarch64-loop-vect-issue-rate-niters
15803 The tuning for some AArch64 CPUs tries to take both latencies and issue
15804 rates into account when deciding whether a loop should be vectorized
15805 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
15806 If this parameter is set to @var{n}, GCC will not use this heuristic
15807 for loops that are known to execute in fewer than @var{n} Advanced
15808 SIMD iterations.
15810 @item aarch64-vect-unroll-limit
15811 The vectorizer will use available tuning information to determine whether it
15812 would be beneficial to unroll the main vectorized loop and by how much.  This
15813 parameter set's the upper bound of how much the vectorizer will unroll the main
15814 loop.  The default value is four.
15816 @end table
15818 The following choices of @var{name} are available on i386 and x86_64 targets:
15820 @table @gcctabopt
15821 @item x86-stlf-window-ninsns
15822 Instructions number above which STFL stall penalty can be compensated.
15824 @end table
15826 @end table
15828 @node Instrumentation Options
15829 @section Program Instrumentation Options
15830 @cindex instrumentation options
15831 @cindex program instrumentation options
15832 @cindex run-time error checking options
15833 @cindex profiling options
15834 @cindex options, program instrumentation
15835 @cindex options, run-time error checking
15836 @cindex options, profiling
15838 GCC supports a number of command-line options that control adding
15839 run-time instrumentation to the code it normally generates.  
15840 For example, one purpose of instrumentation is collect profiling
15841 statistics for use in finding program hot spots, code coverage
15842 analysis, or profile-guided optimizations.
15843 Another class of program instrumentation is adding run-time checking 
15844 to detect programming errors like invalid pointer
15845 dereferences or out-of-bounds array accesses, as well as deliberately
15846 hostile attacks such as stack smashing or C++ vtable hijacking.
15847 There is also a general hook which can be used to implement other
15848 forms of tracing or function-level instrumentation for debug or
15849 program analysis purposes.
15851 @table @gcctabopt
15852 @cindex @command{prof}
15853 @cindex @command{gprof}
15854 @item -p
15855 @itemx -pg
15856 @opindex p
15857 @opindex pg
15858 Generate extra code to write profile information suitable for the
15859 analysis program @command{prof} (for @option{-p}) or @command{gprof}
15860 (for @option{-pg}).  You must use this option when compiling
15861 the source files you want data about, and you must also use it when
15862 linking.
15864 You can use the function attribute @code{no_instrument_function} to
15865 suppress profiling of individual functions when compiling with these options.
15866 @xref{Common Function Attributes}.
15868 @item -fprofile-arcs
15869 @opindex fprofile-arcs
15870 Add code so that program flow @dfn{arcs} are instrumented.  During
15871 execution the program records how many times each branch and call is
15872 executed and how many times it is taken or returns.  On targets that support
15873 constructors with priority support, profiling properly handles constructors,
15874 destructors and C++ constructors (and destructors) of classes which are used
15875 as a type of a global variable.
15877 When the compiled
15878 program exits it saves this data to a file called
15879 @file{@var{auxname}.gcda} for each source file.  The data may be used for
15880 profile-directed optimizations (@option{-fbranch-probabilities}), or for
15881 test coverage analysis (@option{-ftest-coverage}).  Each object file's
15882 @var{auxname} is generated from the name of the output file, if
15883 explicitly specified and it is not the final executable, otherwise it is
15884 the basename of the source file.  In both cases any suffix is removed
15885 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
15886 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
15888 Note that if a command line directly links source files, the corresponding
15889 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
15890 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
15891 @file{binary-b.gcda} files.
15893 @xref{Cross-profiling}.
15895 @cindex @command{gcov}
15896 @item --coverage
15897 @opindex coverage
15899 This option is used to compile and link code instrumented for coverage
15900 analysis.  The option is a synonym for @option{-fprofile-arcs}
15901 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
15902 linking).  See the documentation for those options for more details.
15904 @itemize
15906 @item
15907 Compile the source files with @option{-fprofile-arcs} plus optimization
15908 and code generation options.  For test coverage analysis, use the
15909 additional @option{-ftest-coverage} option.  You do not need to profile
15910 every source file in a program.
15912 @item
15913 Compile the source files additionally with @option{-fprofile-abs-path}
15914 to create absolute path names in the @file{.gcno} files.  This allows
15915 @command{gcov} to find the correct sources in projects where compilations
15916 occur with different working directories.
15918 @item
15919 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
15920 (the latter implies the former).
15922 @item
15923 Run the program on a representative workload to generate the arc profile
15924 information.  This may be repeated any number of times.  You can run
15925 concurrent instances of your program, and provided that the file system
15926 supports locking, the data files will be correctly updated.  Unless
15927 a strict ISO C dialect option is in effect, @code{fork} calls are
15928 detected and correctly handled without double counting.
15930 Moreover, an object file can be recompiled multiple times
15931 and the corresponding @file{.gcda} file merges as long as
15932 the source file and the compiler options are unchanged.
15934 @item
15935 For profile-directed optimizations, compile the source files again with
15936 the same optimization and code generation options plus
15937 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
15938 Control Optimization}).
15940 @item
15941 For test coverage analysis, use @command{gcov} to produce human readable
15942 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
15943 @command{gcov} documentation for further information.
15945 @end itemize
15947 With @option{-fprofile-arcs}, for each function of your program GCC
15948 creates a program flow graph, then finds a spanning tree for the graph.
15949 Only arcs that are not on the spanning tree have to be instrumented: the
15950 compiler adds code to count the number of times that these arcs are
15951 executed.  When an arc is the only exit or only entrance to a block, the
15952 instrumentation code can be added to the block; otherwise, a new basic
15953 block must be created to hold the instrumentation code.
15955 @need 2000
15956 @item -ftest-coverage
15957 @opindex ftest-coverage
15958 Produce a notes file that the @command{gcov} code-coverage utility
15959 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
15960 show program coverage.  Each source file's note file is called
15961 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
15962 above for a description of @var{auxname} and instructions on how to
15963 generate test coverage data.  Coverage data matches the source files
15964 more closely if you do not optimize.
15966 @item -fprofile-abs-path
15967 @opindex fprofile-abs-path
15968 Automatically convert relative source file names to absolute path names
15969 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
15970 sources in projects where compilations occur with different working
15971 directories.
15973 @item -fprofile-dir=@var{path}
15974 @opindex fprofile-dir
15976 Set the directory to search for the profile data files in to @var{path}.
15977 This option affects only the profile data generated by
15978 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
15979 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
15980 and its related options.  Both absolute and relative paths can be used.
15981 By default, GCC uses the current directory as @var{path}, thus the
15982 profile data file appears in the same directory as the object file.
15983 In order to prevent the file name clashing, if the object file name is
15984 not an absolute path, we mangle the absolute path of the
15985 @file{@var{sourcename}.gcda} file and use it as the file name of a
15986 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
15987 See similar option @option{-fprofile-note}.
15989 When an executable is run in a massive parallel environment, it is recommended
15990 to save profile to different folders.  That can be done with variables
15991 in @var{path} that are exported during run-time:
15993 @table @gcctabopt
15995 @item %p
15996 process ID.
15998 @item %q@{VAR@}
15999 value of environment variable @var{VAR}
16001 @end table
16003 @item -fprofile-generate
16004 @itemx -fprofile-generate=@var{path}
16005 @opindex fprofile-generate
16007 Enable options usually used for instrumenting application to produce
16008 profile useful for later recompilation with profile feedback based
16009 optimization.  You must use @option{-fprofile-generate} both when
16010 compiling and when linking your program.
16012 The following options are enabled:
16013 @option{-fprofile-arcs}, @option{-fprofile-values},
16014 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16016 If @var{path} is specified, GCC looks at the @var{path} to find
16017 the profile feedback data files. See @option{-fprofile-dir}.
16019 To optimize the program based on the collected profile information, use
16020 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
16022 @item -fprofile-info-section
16023 @itemx -fprofile-info-section=@var{name}
16024 @opindex fprofile-info-section
16026 Register the profile information in the specified section instead of using a
16027 constructor/destructor.  The section name is @var{name} if it is specified,
16028 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
16029 profile information generated by @option{-fprofile-arcs} is placed in the
16030 specified section for each translation unit.  This option disables the profile
16031 information registration through a constructor and it disables the profile
16032 information processing through a destructor.  This option is not intended to be
16033 used in hosted environments such as GNU/Linux.  It targets freestanding
16034 environments (for example embedded systems) with limited resources which do not
16035 support constructors/destructors or the C library file I/O.
16037 The linker could collect the input sections in a continuous memory block and
16038 define start and end symbols.  A GNU linker script example which defines a
16039 linker output section follows:
16041 @smallexample
16042   .gcov_info      :
16043   @{
16044     PROVIDE (__gcov_info_start = .);
16045     KEEP (*(.gcov_info))
16046     PROVIDE (__gcov_info_end = .);
16047   @}
16048 @end smallexample
16050 The program could dump the profiling information registered in this linker set
16051 for example like this:
16053 @smallexample
16054 #include <gcov.h>
16055 #include <stdio.h>
16056 #include <stdlib.h>
16058 extern const struct gcov_info *const __gcov_info_start[];
16059 extern const struct gcov_info *const __gcov_info_end[];
16061 static void
16062 dump (const void *d, unsigned n, void *arg)
16064   const unsigned char *c = d;
16066   for (unsigned i = 0; i < n; ++i)
16067     printf ("%02x", c[i]);
16070 static void
16071 filename (const char *f, void *arg)
16073   __gcov_filename_to_gcfn (f, dump, arg );
16076 static void *
16077 allocate (unsigned length, void *arg)
16079   return malloc (length);
16082 static void
16083 dump_gcov_info (void)
16085   const struct gcov_info *const *info = __gcov_info_start;
16086   const struct gcov_info *const *end = __gcov_info_end;
16088   /* Obfuscate variable to prevent compiler optimizations.  */
16089   __asm__ ("" : "+r" (info));
16091   while (info != end)
16092   @{
16093     void *arg = NULL;
16094     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16095     putchar ('\n');
16096     ++info;
16097   @}
16101 main (void)
16103   dump_gcov_info ();
16104   return 0;
16106 @end smallexample
16108 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16109 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16110 @code{__gcov_info_to_gcda} functions and merge the profile information into
16111 @file{.gcda} files on the host filesystem.
16113 @item -fprofile-note=@var{path}
16114 @opindex fprofile-note
16116 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16117 location.  If you combine the option with multiple source files,
16118 the @file{.gcno} file will be overwritten.
16120 @item -fprofile-prefix-path=@var{path}
16121 @opindex fprofile-prefix-path
16123 This option can be used in combination with
16124 @option{profile-generate=}@var{profile_dir} and
16125 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16126 directory of built source tree.  By default @var{profile_dir} will contain
16127 files with mangled absolute paths of all object files in the built project.
16128 This is not desirable when directory used to build the instrumented binary
16129 differs from the directory used to build the binary optimized with profile
16130 feedback because the profile data will not be found during the optimized build.
16131 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16132 pointing to the base directory of the build can be used to strip the irrelevant
16133 part of the path and keep all file names relative to the main build directory.
16135 @item -fprofile-prefix-map=@var{old}=@var{new}
16136 @opindex fprofile-prefix-map
16137 When compiling files residing in directory @file{@var{old}}, record
16138 profiling information (with @option{--coverage})
16139 describing them as if the files resided in
16140 directory @file{@var{new}} instead.
16141 See also @option{-ffile-prefix-map}.
16143 @item -fprofile-update=@var{method}
16144 @opindex fprofile-update
16146 Alter the update method for an application instrumented for profile
16147 feedback based optimization.  The @var{method} argument should be one of
16148 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16149 The first one is useful for single-threaded applications,
16150 while the second one prevents profile corruption by emitting thread-safe code.
16152 @strong{Warning:} When an application does not properly join all threads
16153 (or creates an detached thread), a profile file can be still corrupted.
16155 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16156 when supported by a target, or to @samp{single} otherwise.  The GCC driver
16157 automatically selects @samp{prefer-atomic} when @option{-pthread}
16158 is present in the command line.
16160 @item -fprofile-filter-files=@var{regex}
16161 @opindex fprofile-filter-files
16163 Instrument only functions from files whose name matches
16164 any of the regular expressions (separated by semi-colons).
16166 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16167 only @file{main.c} and all C files starting with 'module'.
16169 @item -fprofile-exclude-files=@var{regex}
16170 @opindex fprofile-exclude-files
16172 Instrument only functions from files whose name does not match
16173 any of the regular expressions (separated by semi-colons).
16175 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16176 of all files that are located in the @file{/usr/} folder.
16178 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16179 @opindex fprofile-reproducible
16180 Control level of reproducibility of profile gathered by
16181 @code{-fprofile-generate}.  This makes it possible to rebuild program
16182 with same outcome which is useful, for example, for distribution
16183 packages.
16185 With @option{-fprofile-reproducible=serial} the profile gathered by
16186 @option{-fprofile-generate} is reproducible provided the trained program
16187 behaves the same at each invocation of the train run, it is not
16188 multi-threaded and profile data streaming is always done in the same
16189 order.  Note that profile streaming happens at the end of program run but
16190 also before @code{fork} function is invoked.
16192 Note that it is quite common that execution counts of some part of
16193 programs depends, for example, on length of temporary file names or
16194 memory space randomization (that may affect hash-table collision rate).
16195 Such non-reproducible part of programs may be annotated by
16196 @code{no_instrument_function} function attribute. @command{gcov-dump} with
16197 @option{-l} can be used to dump gathered data and verify that they are
16198 indeed reproducible.
16200 With @option{-fprofile-reproducible=parallel-runs} collected profile
16201 stays reproducible regardless the order of streaming of the data into
16202 gcda files.  This setting makes it possible to run multiple instances of
16203 instrumented program in parallel (such as with @code{make -j}). This
16204 reduces quality of gathered data, in particular of indirect call
16205 profiling.
16207 @item -fsanitize=address
16208 @opindex fsanitize=address
16209 Enable AddressSanitizer, a fast memory error detector.
16210 Memory access instructions are instrumented to detect
16211 out-of-bounds and use-after-free bugs.
16212 The option enables @option{-fsanitize-address-use-after-scope}.
16213 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
16214 more details.  The run-time behavior can be influenced using the
16215 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
16216 the available options are shown at startup of the instrumented program.  See
16217 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
16218 for a list of supported options.
16219 The option cannot be combined with @option{-fsanitize=thread} or
16220 @option{-fsanitize=hwaddress}.  Note that the only target
16221 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
16223 @item -fsanitize=kernel-address
16224 @opindex fsanitize=kernel-address
16225 Enable AddressSanitizer for Linux kernel.
16226 See @uref{https://github.com/google/kasan} for more details.
16228 @item -fsanitize=hwaddress
16229 @opindex fsanitize=hwaddress
16230 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
16231 ignore the top byte of a pointer to allow the detection of memory errors with
16232 a low memory overhead.
16233 Memory access instructions are instrumented to detect out-of-bounds and
16234 use-after-free bugs.
16235 The option enables @option{-fsanitize-address-use-after-scope}.
16237 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
16238 for more details.  The run-time behavior can be influenced using the
16239 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
16240 the available options are shown at startup of the instrumented program.
16241 The option cannot be combined with @option{-fsanitize=thread} or
16242 @option{-fsanitize=address}, and is currently only available on AArch64.
16244 @item -fsanitize=kernel-hwaddress
16245 @opindex fsanitize=kernel-hwaddress
16246 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
16247 Similar to @option{-fsanitize=kernel-address} but using an alternate
16248 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
16249 instrumentation differences necessary for compiling the Linux kernel.
16250 These differences are to avoid hwasan library initialization calls and to
16251 account for the stack pointer having a different value in its top byte.
16253 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
16254 Instrumenting the stack and alloca calls are not on by default but are still
16255 possible by specifying the command-line options
16256 @option{--param hwasan-instrument-stack=1} and
16257 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
16258 tag is not implemented for kernel instrumentation.
16260 @item -fsanitize=pointer-compare
16261 @opindex fsanitize=pointer-compare
16262 Instrument comparison operation (<, <=, >, >=) with pointer operands.
16263 The option must be combined with either @option{-fsanitize=kernel-address} or
16264 @option{-fsanitize=address}
16265 The option cannot be combined with @option{-fsanitize=thread}.
16266 Note: By default the check is disabled at run time.  To enable it,
16267 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16268 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16269 invalid operation only when both pointers are non-null.
16271 @item -fsanitize=pointer-subtract
16272 @opindex fsanitize=pointer-subtract
16273 Instrument subtraction with pointer operands.
16274 The option must be combined with either @option{-fsanitize=kernel-address} or
16275 @option{-fsanitize=address}
16276 The option cannot be combined with @option{-fsanitize=thread}.
16277 Note: By default the check is disabled at run time.  To enable it,
16278 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16279 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16280 invalid operation only when both pointers are non-null.
16282 @item -fsanitize=shadow-call-stack
16283 @opindex fsanitize=shadow-call-stack
16284 Enable ShadowCallStack, a security enhancement mechanism used to protect
16285 programs against return address overwrites (e.g. stack buffer overflows.)
16286 It works by saving a function's return address to a separately allocated
16287 shadow call stack in the function prologue and restoring the return address
16288 from the shadow call stack in the function epilogue.  Instrumentation only
16289 occurs in functions that need to save the return address to the stack.
16291 Currently it only supports the aarch64 platform.  It is specifically
16292 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
16293 For the user space programs, runtime support is not currently provided
16294 in libc and libgcc.  Users who want to use this feature in user space need
16295 to provide their own support for the runtime.  It should be noted that
16296 this may cause the ABI rules to be broken.
16298 On aarch64, the instrumentation makes use of the platform register @code{x18}.
16299 This generally means that any code that may run on the same thread as code
16300 compiled with ShadowCallStack must be compiled with the flag
16301 @option{-ffixed-x18}, otherwise functions compiled without
16302 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
16303 stack pointer.
16305 Also, because there is no userspace runtime support, code compiled with
16306 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
16307 to turn off exceptions.
16309 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
16310 details.
16312 @item -fsanitize=thread
16313 @opindex fsanitize=thread
16314 Enable ThreadSanitizer, a fast data race detector.
16315 Memory access instructions are instrumented to detect
16316 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
16317 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
16318 environment variable; see
16319 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
16320 supported options.
16321 The option cannot be combined with @option{-fsanitize=address},
16322 @option{-fsanitize=leak}.
16324 Note that sanitized atomic builtins cannot throw exceptions when
16325 operating on invalid memory addresses with non-call exceptions
16326 (@option{-fnon-call-exceptions}).
16328 @item -fsanitize=leak
16329 @opindex fsanitize=leak
16330 Enable LeakSanitizer, a memory leak detector.
16331 This option only matters for linking of executables and
16332 the executable is linked against a library that overrides @code{malloc}
16333 and other allocator functions.  See
16334 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
16335 details.  The run-time behavior can be influenced using the
16336 @env{LSAN_OPTIONS} environment variable.
16337 The option cannot be combined with @option{-fsanitize=thread}.
16339 @item -fsanitize=undefined
16340 @opindex fsanitize=undefined
16341 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
16342 Various computations are instrumented to detect undefined behavior
16343 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
16344 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
16346 @table @gcctabopt
16348 @item -fsanitize=shift
16349 @opindex fsanitize=shift
16350 This option enables checking that the result of a shift operation is
16351 not undefined.  Note that what exactly is considered undefined differs
16352 slightly between C and C++, as well as between ISO C90 and C99, etc.
16353 This option has two suboptions, @option{-fsanitize=shift-base} and
16354 @option{-fsanitize=shift-exponent}.
16356 @item -fsanitize=shift-exponent
16357 @opindex fsanitize=shift-exponent
16358 This option enables checking that the second argument of a shift operation
16359 is not negative and is smaller than the precision of the promoted first
16360 argument.
16362 @item -fsanitize=shift-base
16363 @opindex fsanitize=shift-base
16364 If the second argument of a shift operation is within range, check that the
16365 result of a shift operation is not undefined.  Note that what exactly is
16366 considered undefined differs slightly between C and C++, as well as between
16367 ISO C90 and C99, etc.
16369 @item -fsanitize=integer-divide-by-zero
16370 @opindex fsanitize=integer-divide-by-zero
16371 Detect integer division by zero.
16373 @item -fsanitize=unreachable
16374 @opindex fsanitize=unreachable
16375 With this option, the compiler turns the @code{__builtin_unreachable}
16376 call into a diagnostics message call instead.  When reaching the
16377 @code{__builtin_unreachable} call, the behavior is undefined.
16379 @item -fsanitize=vla-bound
16380 @opindex fsanitize=vla-bound
16381 This option instructs the compiler to check that the size of a variable
16382 length array is positive.
16384 @item -fsanitize=null
16385 @opindex fsanitize=null
16386 This option enables pointer checking.  Particularly, the application
16387 built with this option turned on will issue an error message when it
16388 tries to dereference a NULL pointer, or if a reference (possibly an
16389 rvalue reference) is bound to a NULL pointer, or if a method is invoked
16390 on an object pointed by a NULL pointer.
16392 @item -fsanitize=return
16393 @opindex fsanitize=return
16394 This option enables return statement checking.  Programs
16395 built with this option turned on will issue an error message
16396 when the end of a non-void function is reached without actually
16397 returning a value.  This option works in C++ only.
16399 @item -fsanitize=signed-integer-overflow
16400 @opindex fsanitize=signed-integer-overflow
16401 This option enables signed integer overflow checking.  We check that
16402 the result of @code{+}, @code{*}, and both unary and binary @code{-}
16403 does not overflow in the signed arithmetics.  This also detects
16404 @code{INT_MIN / -1} signed division.  Note, integer promotion
16405 rules must be taken into account.  That is, the following is not an
16406 overflow:
16407 @smallexample
16408 signed char a = SCHAR_MAX;
16409 a++;
16410 @end smallexample
16412 @item -fsanitize=bounds
16413 @opindex fsanitize=bounds
16414 This option enables instrumentation of array bounds.  Various out of bounds
16415 accesses are detected.  Flexible array members, flexible array member-like
16416 arrays, and initializers of variables with static storage are not instrumented.
16418 @item -fsanitize=bounds-strict
16419 @opindex fsanitize=bounds-strict
16420 This option enables strict instrumentation of array bounds.  Most out of bounds
16421 accesses are detected, including flexible array members and flexible array
16422 member-like arrays.  Initializers of variables with static storage are not
16423 instrumented.
16425 @item -fsanitize=alignment
16426 @opindex fsanitize=alignment
16428 This option enables checking of alignment of pointers when they are
16429 dereferenced, or when a reference is bound to insufficiently aligned target,
16430 or when a method or constructor is invoked on insufficiently aligned object.
16432 @item -fsanitize=object-size
16433 @opindex fsanitize=object-size
16434 This option enables instrumentation of memory references using the
16435 @code{__builtin_object_size} function.  Various out of bounds pointer
16436 accesses are detected.
16438 @item -fsanitize=float-divide-by-zero
16439 @opindex fsanitize=float-divide-by-zero
16440 Detect floating-point division by zero.  Unlike other similar options,
16441 @option{-fsanitize=float-divide-by-zero} is not enabled by
16442 @option{-fsanitize=undefined}, since floating-point division by zero can
16443 be a legitimate way of obtaining infinities and NaNs.
16445 @item -fsanitize=float-cast-overflow
16446 @opindex fsanitize=float-cast-overflow
16447 This option enables floating-point type to integer conversion checking.
16448 We check that the result of the conversion does not overflow.
16449 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
16450 not enabled by @option{-fsanitize=undefined}.
16451 This option does not work well with @code{FE_INVALID} exceptions enabled.
16453 @item -fsanitize=nonnull-attribute
16454 @opindex fsanitize=nonnull-attribute
16456 This option enables instrumentation of calls, checking whether null values
16457 are not passed to arguments marked as requiring a non-null value by the
16458 @code{nonnull} function attribute.
16460 @item -fsanitize=returns-nonnull-attribute
16461 @opindex fsanitize=returns-nonnull-attribute
16463 This option enables instrumentation of return statements in functions
16464 marked with @code{returns_nonnull} function attribute, to detect returning
16465 of null values from such functions.
16467 @item -fsanitize=bool
16468 @opindex fsanitize=bool
16470 This option enables instrumentation of loads from bool.  If a value other
16471 than 0/1 is loaded, a run-time error is issued.
16473 @item -fsanitize=enum
16474 @opindex fsanitize=enum
16476 This option enables instrumentation of loads from an enum type.  If
16477 a value outside the range of values for the enum type is loaded,
16478 a run-time error is issued.
16480 @item -fsanitize=vptr
16481 @opindex fsanitize=vptr
16483 This option enables instrumentation of C++ member function calls, member
16484 accesses and some conversions between pointers to base and derived classes,
16485 to verify the referenced object has the correct dynamic type.
16487 @item -fsanitize=pointer-overflow
16488 @opindex fsanitize=pointer-overflow
16490 This option enables instrumentation of pointer arithmetics.  If the pointer
16491 arithmetics overflows, a run-time error is issued.
16493 @item -fsanitize=builtin
16494 @opindex fsanitize=builtin
16496 This option enables instrumentation of arguments to selected builtin
16497 functions.  If an invalid value is passed to such arguments, a run-time
16498 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
16499 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
16500 by this option.
16502 @end table
16504 Note the enabled sanitizer options tend to increase a false-positive rate
16505 of selected warnings, most notably @option{-Wmaybe-uninitialized}.
16506 And thus we recommend to disable @option{-Werror}.
16508 While @option{-ftrapv} causes traps for signed overflows to be emitted,
16509 @option{-fsanitize=undefined} gives a diagnostic message.
16510 This currently works only for the C family of languages.
16512 @item -fno-sanitize=all
16513 @opindex fno-sanitize=all
16515 This option disables all previously enabled sanitizers.
16516 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
16517 together.
16519 @item -fasan-shadow-offset=@var{number}
16520 @opindex fasan-shadow-offset
16521 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
16522 It is useful for experimenting with different shadow memory layouts in
16523 Kernel AddressSanitizer.
16525 @item -fsanitize-sections=@var{s1},@var{s2},...
16526 @opindex fsanitize-sections
16527 Sanitize global variables in selected user-defined sections.  @var{si} may
16528 contain wildcards.
16530 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
16531 @opindex fsanitize-recover
16532 @opindex fno-sanitize-recover
16533 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
16534 mentioned in comma-separated list of @var{opts}.  Enabling this option
16535 for a sanitizer component causes it to attempt to continue
16536 running the program as if no error happened.  This means multiple
16537 runtime errors can be reported in a single program run, and the exit
16538 code of the program may indicate success even when errors
16539 have been reported.  The @option{-fno-sanitize-recover=} option
16540 can be used to alter
16541 this behavior: only the first detected error is reported
16542 and program then exits with a non-zero exit code.
16544 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
16545 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
16546 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
16547 @option{-fsanitize=bounds-strict},
16548 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
16549 For these sanitizers error recovery is turned on by default,
16550 except @option{-fsanitize=address}, for which this feature is experimental.
16551 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
16552 accepted, the former enables recovery for all sanitizers that support it,
16553 the latter disables recovery for all sanitizers that support it.
16555 Even if a recovery mode is turned on the compiler side, it needs to be also
16556 enabled on the runtime library side, otherwise the failures are still fatal.
16557 The runtime library defaults to @code{halt_on_error=0} for
16558 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
16559 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
16560 setting the @code{halt_on_error} flag in the corresponding environment variable.
16562 Syntax without an explicit @var{opts} parameter is deprecated.  It is
16563 equivalent to specifying an @var{opts} list of:
16565 @smallexample
16566 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
16567 @end smallexample
16569 @item -fsanitize-address-use-after-scope
16570 @opindex fsanitize-address-use-after-scope
16571 Enable sanitization of local variables to detect use-after-scope bugs.
16572 The option sets @option{-fstack-reuse} to @samp{none}.
16574 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
16575 @opindex fsanitize-trap
16576 @opindex fno-sanitize-trap
16577 The @option{-fsanitize-trap=} option instructs the compiler to
16578 report for sanitizers mentioned in comma-separated list of @var{opts}
16579 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
16580 library routine.  If this option is enabled for certain sanitizer,
16581 it takes precedence over the @option{-fsanitizer-recover=} for that
16582 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
16583 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
16585 The advantage of this is that the @code{libubsan} library is not needed
16586 and is not linked in, so this is usable even in freestanding environments.
16588 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
16589 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
16590 @option{-fsanitize=float-divide-by-zero} and
16591 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
16592 specified, which enables it for @code{undefined} suboptions,
16593 @option{-fsanitize=float-cast-overflow},
16594 @option{-fsanitize=float-divide-by-zero} and
16595 @option{-fsanitize=bounds-strict}.
16596 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
16597 and @code{-fsanitize=vptr} is enabled on the command line, the
16598 instrumentation is silently ignored as the instrumentation always needs
16599 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
16601 @item -fsanitize-undefined-trap-on-error
16602 @opindex fsanitize-undefined-trap-on-error
16603 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
16604 equivalent of @option{-fsanitize-trap=all}.
16606 @item -fsanitize-coverage=trace-pc
16607 @opindex fsanitize-coverage=trace-pc
16608 Enable coverage-guided fuzzing code instrumentation.
16609 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
16611 @item -fsanitize-coverage=trace-cmp
16612 @opindex fsanitize-coverage=trace-cmp
16613 Enable dataflow guided fuzzing code instrumentation.
16614 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
16615 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
16616 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
16617 variable or @code{__sanitizer_cov_trace_const_cmp1},
16618 @code{__sanitizer_cov_trace_const_cmp2},
16619 @code{__sanitizer_cov_trace_const_cmp4} or
16620 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
16621 operand constant, @code{__sanitizer_cov_trace_cmpf} or
16622 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
16623 @code{__sanitizer_cov_trace_switch} for switch statements.
16625 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
16626 @opindex fcf-protection
16627 Enable code instrumentation of control-flow transfers to increase
16628 program security by checking that target addresses of control-flow
16629 transfer instructions (such as indirect function call, function return,
16630 indirect jump) are valid.  This prevents diverting the flow of control
16631 to an unexpected target.  This is intended to protect against such
16632 threats as Return-oriented Programming (ROP), and similarly
16633 call/jmp-oriented programming (COP/JOP).
16635 The value @code{branch} tells the compiler to implement checking of
16636 validity of control-flow transfer at the point of indirect branch
16637 instructions, i.e.@: call/jmp instructions.  The value @code{return}
16638 implements checking of validity at the point of returning from a
16639 function.  The value @code{full} is an alias for specifying both
16640 @code{branch} and @code{return}. The value @code{none} turns off
16641 instrumentation.
16643 The value @code{check} is used for the final link with link-time
16644 optimization (LTO).  An error is issued if LTO object files are
16645 compiled with different @option{-fcf-protection} values.  The
16646 value @code{check} is ignored at the compile time.
16648 The macro @code{__CET__} is defined when @option{-fcf-protection} is
16649 used.  The first bit of @code{__CET__} is set to 1 for the value
16650 @code{branch} and the second bit of @code{__CET__} is set to 1 for
16651 the @code{return}.
16653 You can also use the @code{nocf_check} attribute to identify
16654 which functions and calls should be skipped from instrumentation
16655 (@pxref{Function Attributes}).
16657 Currently the x86 GNU/Linux target provides an implementation based
16658 on Intel Control-flow Enforcement Technology (CET) which works for
16659 i686 processor or newer.
16661 @item -fharden-compares
16662 @opindex fharden-compares
16663 For every logical test that survives gimple optimizations and is
16664 @emph{not} the condition in a conditional branch (for example,
16665 conditions tested for conditional moves, or to store in boolean
16666 variables), emit extra code to compute and verify the reversed
16667 condition, and to call @code{__builtin_trap} if the results do not
16668 match.  Use with @samp{-fharden-conditional-branches} to cover all
16669 conditionals.
16671 @item -fharden-conditional-branches
16672 @opindex fharden-conditional-branches
16673 For every non-vectorized conditional branch that survives gimple
16674 optimizations, emit extra code to compute and verify the reversed
16675 condition, and to call @code{__builtin_trap} if the result is
16676 unexpected.  Use with @samp{-fharden-compares} to cover all
16677 conditionals.
16679 @item -fstack-protector
16680 @opindex fstack-protector
16681 Emit extra code to check for buffer overflows, such as stack smashing
16682 attacks.  This is done by adding a guard variable to functions with
16683 vulnerable objects.  This includes functions that call @code{alloca}, and
16684 functions with buffers larger than or equal to 8 bytes.  The guards are
16685 initialized when a function is entered and then checked when the function
16686 exits.  If a guard check fails, an error message is printed and the program
16687 exits.  Only variables that are actually allocated on the stack are
16688 considered, optimized away variables or variables allocated in registers
16689 don't count.
16691 @item -fstack-protector-all
16692 @opindex fstack-protector-all
16693 Like @option{-fstack-protector} except that all functions are protected.
16695 @item -fstack-protector-strong
16696 @opindex fstack-protector-strong
16697 Like @option{-fstack-protector} but includes additional functions to
16698 be protected --- those that have local array definitions, or have
16699 references to local frame addresses.  Only variables that are actually
16700 allocated on the stack are considered, optimized away variables or variables
16701 allocated in registers don't count.
16703 @item -fstack-protector-explicit
16704 @opindex fstack-protector-explicit
16705 Like @option{-fstack-protector} but only protects those functions which
16706 have the @code{stack_protect} attribute.
16708 @item -fstack-check
16709 @opindex fstack-check
16710 Generate code to verify that you do not go beyond the boundary of the
16711 stack.  You should specify this flag if you are running in an
16712 environment with multiple threads, but you only rarely need to specify it in
16713 a single-threaded environment since stack overflow is automatically
16714 detected on nearly all systems if there is only one stack.
16716 Note that this switch does not actually cause checking to be done; the
16717 operating system or the language runtime must do that.  The switch causes
16718 generation of code to ensure that they see the stack being extended.
16720 You can additionally specify a string parameter: @samp{no} means no
16721 checking, @samp{generic} means force the use of old-style checking,
16722 @samp{specific} means use the best checking method and is equivalent
16723 to bare @option{-fstack-check}.
16725 Old-style checking is a generic mechanism that requires no specific
16726 target support in the compiler but comes with the following drawbacks:
16728 @enumerate
16729 @item
16730 Modified allocation strategy for large objects: they are always
16731 allocated dynamically if their size exceeds a fixed threshold.  Note this
16732 may change the semantics of some code.
16734 @item
16735 Fixed limit on the size of the static frame of functions: when it is
16736 topped by a particular function, stack checking is not reliable and
16737 a warning is issued by the compiler.
16739 @item
16740 Inefficiency: because of both the modified allocation strategy and the
16741 generic implementation, code performance is hampered.
16742 @end enumerate
16744 Note that old-style stack checking is also the fallback method for
16745 @samp{specific} if no target support has been added in the compiler.
16747 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
16748 and stack overflows.  @samp{specific} is an excellent choice when compiling
16749 Ada code.  It is not generally sufficient to protect against stack-clash
16750 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
16752 @item -fstack-clash-protection
16753 @opindex fstack-clash-protection
16754 Generate code to prevent stack clash style attacks.  When this option is
16755 enabled, the compiler will only allocate one page of stack space at a time
16756 and each page is accessed immediately after allocation.  Thus, it prevents
16757 allocations from jumping over any stack guard page provided by the
16758 operating system.
16760 Most targets do not fully support stack clash protection.  However, on
16761 those targets @option{-fstack-clash-protection} will protect dynamic stack
16762 allocations.  @option{-fstack-clash-protection} may also provide limited
16763 protection for static stack allocations if the target supports
16764 @option{-fstack-check=specific}.
16766 @item -fstack-limit-register=@var{reg}
16767 @itemx -fstack-limit-symbol=@var{sym}
16768 @itemx -fno-stack-limit
16769 @opindex fstack-limit-register
16770 @opindex fstack-limit-symbol
16771 @opindex fno-stack-limit
16772 Generate code to ensure that the stack does not grow beyond a certain value,
16773 either the value of a register or the address of a symbol.  If a larger
16774 stack is required, a signal is raised at run time.  For most targets,
16775 the signal is raised before the stack overruns the boundary, so
16776 it is possible to catch the signal without taking special precautions.
16778 For instance, if the stack starts at absolute address @samp{0x80000000}
16779 and grows downwards, you can use the flags
16780 @option{-fstack-limit-symbol=__stack_limit} and
16781 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
16782 of 128KB@.  Note that this may only work with the GNU linker.
16784 You can locally override stack limit checking by using the
16785 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
16787 @item -fsplit-stack
16788 @opindex fsplit-stack
16789 Generate code to automatically split the stack before it overflows.
16790 The resulting program has a discontiguous stack which can only
16791 overflow if the program is unable to allocate any more memory.  This
16792 is most useful when running threaded programs, as it is no longer
16793 necessary to calculate a good stack size to use for each thread.  This
16794 is currently only implemented for the x86 targets running
16795 GNU/Linux.
16797 When code compiled with @option{-fsplit-stack} calls code compiled
16798 without @option{-fsplit-stack}, there may not be much stack space
16799 available for the latter code to run.  If compiling all code,
16800 including library code, with @option{-fsplit-stack} is not an option,
16801 then the linker can fix up these calls so that the code compiled
16802 without @option{-fsplit-stack} always has a large stack.  Support for
16803 this is implemented in the gold linker in GNU binutils release 2.21
16804 and later.
16806 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
16807 @opindex fvtable-verify
16808 This option is only available when compiling C++ code.
16809 It turns on (or off, if using @option{-fvtable-verify=none}) the security
16810 feature that verifies at run time, for every virtual call, that
16811 the vtable pointer through which the call is made is valid for the type of
16812 the object, and has not been corrupted or overwritten.  If an invalid vtable
16813 pointer is detected at run time, an error is reported and execution of the
16814 program is immediately halted.
16816 This option causes run-time data structures to be built at program startup,
16817 which are used for verifying the vtable pointers.  
16818 The options @samp{std} and @samp{preinit}
16819 control the timing of when these data structures are built.  In both cases the
16820 data structures are built before execution reaches @code{main}.  Using
16821 @option{-fvtable-verify=std} causes the data structures to be built after
16822 shared libraries have been loaded and initialized.
16823 @option{-fvtable-verify=preinit} causes them to be built before shared
16824 libraries have been loaded and initialized.
16826 If this option appears multiple times in the command line with different
16827 values specified, @samp{none} takes highest priority over both @samp{std} and
16828 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
16830 @item -fvtv-debug
16831 @opindex fvtv-debug
16832 When used in conjunction with @option{-fvtable-verify=std} or 
16833 @option{-fvtable-verify=preinit}, causes debug versions of the 
16834 runtime functions for the vtable verification feature to be called.  
16835 This flag also causes the compiler to log information about which 
16836 vtable pointers it finds for each class.
16837 This information is written to a file named @file{vtv_set_ptr_data.log} 
16838 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
16839 if that is defined or the current working directory otherwise.
16841 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
16842 file, be sure to delete any existing one.
16844 @item -fvtv-counts
16845 @opindex fvtv-counts
16846 This is a debugging flag.  When used in conjunction with
16847 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
16848 causes the compiler to keep track of the total number of virtual calls
16849 it encounters and the number of verifications it inserts.  It also
16850 counts the number of calls to certain run-time library functions
16851 that it inserts and logs this information for each compilation unit.
16852 The compiler writes this information to a file named
16853 @file{vtv_count_data.log} in the directory named by the environment
16854 variable @env{VTV_LOGS_DIR} if that is defined or the current working
16855 directory otherwise.  It also counts the size of the vtable pointer sets
16856 for each class, and writes this information to @file{vtv_class_set_sizes.log}
16857 in the same directory.
16859 Note:  This feature @emph{appends} data to the log files.  To get fresh log
16860 files, be sure to delete any existing ones.
16862 @item -finstrument-functions
16863 @opindex finstrument-functions
16864 Generate instrumentation calls for entry and exit to functions.  Just
16865 after function entry and just before function exit, the following
16866 profiling functions are called with the address of the current
16867 function and its call site.  (On some platforms,
16868 @code{__builtin_return_address} does not work beyond the current
16869 function, so the call site information may not be available to the
16870 profiling functions otherwise.)
16872 @smallexample
16873 void __cyg_profile_func_enter (void *this_fn,
16874                                void *call_site);
16875 void __cyg_profile_func_exit  (void *this_fn,
16876                                void *call_site);
16877 @end smallexample
16879 The first argument is the address of the start of the current function,
16880 which may be looked up exactly in the symbol table.
16882 This instrumentation is also done for functions expanded inline in other
16883 functions.  The profiling calls indicate where, conceptually, the
16884 inline function is entered and exited.  This means that addressable
16885 versions of such functions must be available.  If all your uses of a
16886 function are expanded inline, this may mean an additional expansion of
16887 code size.  If you use @code{extern inline} in your C code, an
16888 addressable version of such functions must be provided.  (This is
16889 normally the case anyway, but if you get lucky and the optimizer always
16890 expands the functions inline, you might have gotten away without
16891 providing static copies.)
16893 A function may be given the attribute @code{no_instrument_function}, in
16894 which case this instrumentation is not done.  This can be used, for
16895 example, for the profiling functions listed above, high-priority
16896 interrupt routines, and any functions from which the profiling functions
16897 cannot safely be called (perhaps signal handlers, if the profiling
16898 routines generate output or allocate memory).
16899 @xref{Common Function Attributes}.
16901 @item -finstrument-functions-once
16902 @opindex -finstrument-functions-once
16903 This is similar to @option{-finstrument-functions}, but the profiling
16904 functions are called only once per instrumented function, i.e. the first
16905 profiling function is called after the first entry into the instrumented
16906 function and the second profiling function is called before the exit
16907 corresponding to this first entry.
16909 The definition of @code{once} for the purpose of this option is a little
16910 vague because the implementation is not protected against data races.
16911 As a result, the implementation only guarantees that the profiling
16912 functions are called at @emph{least} once per process and at @emph{most}
16913 once per thread, but the calls are always paired, that is to say, if a
16914 thread calls the first function, then it will call the second function,
16915 unless it never reaches the exit of the instrumented function.
16917 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
16918 @opindex finstrument-functions-exclude-file-list
16920 Set the list of functions that are excluded from instrumentation (see
16921 the description of @option{-finstrument-functions}).  If the file that
16922 contains a function definition matches with one of @var{file}, then
16923 that function is not instrumented.  The match is done on substrings:
16924 if the @var{file} parameter is a substring of the file name, it is
16925 considered to be a match.
16927 For example:
16929 @smallexample
16930 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
16931 @end smallexample
16933 @noindent
16934 excludes any inline function defined in files whose pathnames
16935 contain @file{/bits/stl} or @file{include/sys}.
16937 If, for some reason, you want to include letter @samp{,} in one of
16938 @var{sym}, write @samp{\,}. For example,
16939 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
16940 (note the single quote surrounding the option).
16942 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
16943 @opindex finstrument-functions-exclude-function-list
16945 This is similar to @option{-finstrument-functions-exclude-file-list},
16946 but this option sets the list of function names to be excluded from
16947 instrumentation.  The function name to be matched is its user-visible
16948 name, such as @code{vector<int> blah(const vector<int> &)}, not the
16949 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
16950 match is done on substrings: if the @var{sym} parameter is a substring
16951 of the function name, it is considered to be a match.  For C99 and C++
16952 extended identifiers, the function name must be given in UTF-8, not
16953 using universal character names.
16955 @item -fpatchable-function-entry=@var{N}[,@var{M}]
16956 @opindex fpatchable-function-entry
16957 Generate @var{N} NOPs right at the beginning
16958 of each function, with the function entry point before the @var{M}th NOP.
16959 If @var{M} is omitted, it defaults to @code{0} so the
16960 function entry points to the address just at the first NOP.
16961 The NOP instructions reserve extra space which can be used to patch in
16962 any desired instrumentation at run time, provided that the code segment
16963 is writable.  The amount of space is controllable indirectly via
16964 the number of NOPs; the NOP instruction used corresponds to the instruction
16965 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
16966 is target-specific and may also depend on the architecture variant and/or
16967 other compilation options.
16969 For run-time identification, the starting addresses of these areas,
16970 which correspond to their respective function entries minus @var{M},
16971 are additionally collected in the @code{__patchable_function_entries}
16972 section of the resulting binary.
16974 Note that the value of @code{__attribute__ ((patchable_function_entry
16975 (N,M)))} takes precedence over command-line option
16976 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
16977 the area size or to remove it completely on a single function.
16978 If @code{N=0}, no pad location is recorded.
16980 The NOP instructions are inserted at---and maybe before, depending on
16981 @var{M}---the function entry address, even before the prologue.  On
16982 PowerPC with the ELFv2 ABI, for a function with dual entry points,
16983 the local entry point is this function entry address.
16985 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
16986 ELFv2 ABI, for a function with dual entry points, the supported values
16987 for @var{M} are 0, 2, 6 and 14.
16988 @end table
16991 @node Preprocessor Options
16992 @section Options Controlling the Preprocessor
16993 @cindex preprocessor options
16994 @cindex options, preprocessor
16996 These options control the C preprocessor, which is run on each C source
16997 file before actual compilation.
16999 If you use the @option{-E} option, nothing is done except preprocessing.
17000 Some of these options make sense only together with @option{-E} because
17001 they cause the preprocessor output to be unsuitable for actual
17002 compilation.
17004 In addition to the options listed here, there are a number of options 
17005 to control search paths for include files documented in 
17006 @ref{Directory Options}.  
17007 Options to control preprocessor diagnostics are listed in 
17008 @ref{Warning Options}.
17010 @table @gcctabopt
17011 @include cppopts.texi
17013 @item -Wp,@var{option}
17014 @opindex Wp
17015 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17016 and pass @var{option} directly through to the preprocessor.  If
17017 @var{option} contains commas, it is split into multiple options at the
17018 commas.  However, many options are modified, translated or interpreted
17019 by the compiler driver before being passed to the preprocessor, and
17020 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
17021 interface is undocumented and subject to change, so whenever possible
17022 you should avoid using @option{-Wp} and let the driver handle the
17023 options instead.
17025 @item -Xpreprocessor @var{option}
17026 @opindex Xpreprocessor
17027 Pass @var{option} as an option to the preprocessor.  You can use this to
17028 supply system-specific preprocessor options that GCC does not 
17029 recognize.
17031 If you want to pass an option that takes an argument, you must use
17032 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17034 @item -no-integrated-cpp
17035 @opindex no-integrated-cpp
17036 Perform preprocessing as a separate pass before compilation.
17037 By default, GCC performs preprocessing as an integrated part of
17038 input tokenization and parsing.
17039 If this option is provided, the appropriate language front end
17040 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17041 and Objective-C, respectively) is instead invoked twice,
17042 once for preprocessing only and once for actual compilation
17043 of the preprocessed input.
17044 This option may be useful in conjunction with the @option{-B} or
17045 @option{-wrapper} options to specify an alternate preprocessor or
17046 perform additional processing of the program source between
17047 normal preprocessing and compilation.
17049 @item -flarge-source-files
17050 @opindex flarge-source-files
17051 Adjust GCC to expect large source files, at the expense of slower
17052 compilation and higher memory usage.
17054 Specifically, GCC normally tracks both column numbers and line numbers
17055 within source files and it normally prints both of these numbers in
17056 diagnostics.  However, once it has processed a certain number of source
17057 lines, it stops tracking column numbers and only tracks line numbers.
17058 This means that diagnostics for later lines do not include column numbers.
17059 It also means that options like @option{-Wmisleading-indentation} cease to work
17060 at that point, although the compiler prints a note if this happens.
17061 Passing @option{-flarge-source-files} significantly increases the number
17062 of source lines that GCC can process before it stops tracking columns.
17064 @end table
17066 @node Assembler Options
17067 @section Passing Options to the Assembler
17069 @c prevent bad page break with this line
17070 You can pass options to the assembler.
17072 @table @gcctabopt
17073 @item -Wa,@var{option}
17074 @opindex Wa
17075 Pass @var{option} as an option to the assembler.  If @var{option}
17076 contains commas, it is split into multiple options at the commas.
17078 @item -Xassembler @var{option}
17079 @opindex Xassembler
17080 Pass @var{option} as an option to the assembler.  You can use this to
17081 supply system-specific assembler options that GCC does not
17082 recognize.
17084 If you want to pass an option that takes an argument, you must use
17085 @option{-Xassembler} twice, once for the option and once for the argument.
17087 @end table
17089 @node Link Options
17090 @section Options for Linking
17091 @cindex link options
17092 @cindex options, linking
17094 These options come into play when the compiler links object files into
17095 an executable output file.  They are meaningless if the compiler is
17096 not doing a link step.
17098 @table @gcctabopt
17099 @cindex file names
17100 @item @var{object-file-name}
17101 A file name that does not end in a special recognized suffix is
17102 considered to name an object file or library.  (Object files are
17103 distinguished from libraries by the linker according to the file
17104 contents.)  If linking is done, these object files are used as input
17105 to the linker.
17107 @item -c
17108 @itemx -S
17109 @itemx -E
17110 @opindex c
17111 @opindex S
17112 @opindex E
17113 If any of these options is used, then the linker is not run, and
17114 object file names should not be used as arguments.  @xref{Overall
17115 Options}.
17117 @item -flinker-output=@var{type}
17118 @opindex flinker-output
17119 This option controls code generation of the link-time optimizer.  By
17120 default the linker output is automatically determined by the linker
17121 plugin.  For debugging the compiler and if incremental linking with a 
17122 non-LTO object file is desired, it may be useful to control the type
17123 manually.
17125 If @var{type} is @samp{exec}, code generation produces a static
17126 binary. In this case @option{-fpic} and @option{-fpie} are both
17127 disabled.
17129 If @var{type} is @samp{dyn}, code generation produces a shared
17130 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
17131 but not enabled automatically.  This allows to build shared libraries
17132 without position-independent code on architectures where this is
17133 possible, i.e.@: on x86.
17135 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
17136 executable. This results in similar optimizations as @samp{exec}
17137 except that @option{-fpie} is not disabled if specified at compilation
17138 time.
17140 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
17141 done.  The sections containing intermediate code for link-time optimization are
17142 merged, pre-optimized, and output to the resulting object file. In addition, if
17143 @option{-ffat-lto-objects} is specified, binary code is produced for future
17144 non-LTO linking. The object file produced by incremental linking is smaller
17145 than a static library produced from the same object files.  At link time the
17146 result of incremental linking also loads faster than a static
17147 library assuming that the majority of objects in the library are used.
17149 Finally @samp{nolto-rel} configures the compiler for incremental linking where
17150 code generation is forced, a final binary is produced, and the intermediate
17151 code for later link-time optimization is stripped. When multiple object files
17152 are linked together the resulting code is better optimized than with
17153 link-time optimizations disabled (for example, cross-module inlining 
17154 happens), but most of benefits of whole program optimizations are lost. 
17156 During the incremental link (by @option{-r}) the linker plugin defaults to
17157 @option{rel}. With current interfaces to GNU Binutils it is however not
17158 possible to incrementally link LTO objects and non-LTO objects into a single
17159 mixed object file.  If any of object files in incremental link cannot
17160 be used for link-time optimization, the linker plugin issues a warning and
17161 uses @samp{nolto-rel}. To maintain whole program optimization, it is
17162 recommended to link such objects into static library instead. Alternatively it
17163 is possible to use H.J. Lu's binutils with support for mixed objects.
17165 @item -fuse-ld=bfd
17166 @opindex fuse-ld=bfd
17167 Use the @command{bfd} linker instead of the default linker.
17169 @item -fuse-ld=gold
17170 @opindex fuse-ld=gold
17171 Use the @command{gold} linker instead of the default linker.
17173 @item -fuse-ld=lld
17174 @opindex fuse-ld=lld
17175 Use the LLVM @command{lld} linker instead of the default linker.
17177 @item -fuse-ld=mold
17178 @opindex fuse-ld=mold
17179 Use the Modern Linker (@command{mold}) instead of the default linker.
17181 @cindex Libraries
17182 @item -l@var{library}
17183 @itemx -l @var{library}
17184 @opindex l
17185 Search the library named @var{library} when linking.  (The second
17186 alternative with the library as a separate argument is only for
17187 POSIX compliance and is not recommended.)
17189 The @option{-l} option is passed directly to the linker by GCC.  Refer
17190 to your linker documentation for exact details.  The general
17191 description below applies to the GNU linker.  
17193 The linker searches a standard list of directories for the library.
17194 The directories searched include several standard system directories
17195 plus any that you specify with @option{-L}.
17197 Static libraries are archives of object files, and have file names
17198 like @file{lib@var{library}.a}.  Some targets also support shared
17199 libraries, which typically have names like @file{lib@var{library}.so}.
17200 If both static and shared libraries are found, the linker gives
17201 preference to linking with the shared library unless the
17202 @option{-static} option is used.
17204 It makes a difference where in the command you write this option; the
17205 linker searches and processes libraries and object files in the order they
17206 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
17207 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
17208 to functions in @samp{z}, those functions may not be loaded.
17210 @item -lobjc
17211 @opindex lobjc
17212 You need this special case of the @option{-l} option in order to
17213 link an Objective-C or Objective-C++ program.
17215 @item -nostartfiles
17216 @opindex nostartfiles
17217 Do not use the standard system startup files when linking.
17218 The standard system libraries are used normally, unless @option{-nostdlib},
17219 @option{-nolibc}, or @option{-nodefaultlibs} is used.
17221 @item -nodefaultlibs
17222 @opindex nodefaultlibs
17223 Do not use the standard system libraries when linking.
17224 Only the libraries you specify are passed to the linker, and options
17225 specifying linkage of the system libraries, such as @option{-static-libgcc}
17226 or @option{-shared-libgcc}, are ignored.  
17227 The standard startup files are used normally, unless @option{-nostartfiles}
17228 is used.  
17230 The compiler may generate calls to @code{memcmp},
17231 @code{memset}, @code{memcpy} and @code{memmove}.
17232 These entries are usually resolved by entries in
17233 libc.  These entry points should be supplied through some other
17234 mechanism when this option is specified.
17236 @item -nolibc
17237 @opindex nolibc
17238 Do not use the C library or system libraries tightly coupled with it when
17239 linking.  Still link with the startup files, @file{libgcc} or toolchain
17240 provided language support libraries such as @file{libgnat}, @file{libgfortran}
17241 or @file{libstdc++} unless options preventing their inclusion are used as
17242 well.  This typically removes @option{-lc} from the link command line, as well
17243 as system libraries that normally go with it and become meaningless when
17244 absence of a C library is assumed, for example @option{-lpthread} or
17245 @option{-lm} in some configurations.  This is intended for bare-board
17246 targets when there is indeed no C library available.
17248 @item -nostdlib
17249 @opindex nostdlib
17250 Do not use the standard system startup files or libraries when linking.
17251 No startup files and only the libraries you specify are passed to
17252 the linker, and options specifying linkage of the system libraries, such as
17253 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
17255 The compiler may generate calls to @code{memcmp}, @code{memset},
17256 @code{memcpy} and @code{memmove}.
17257 These entries are usually resolved by entries in
17258 libc.  These entry points should be supplied through some other
17259 mechanism when this option is specified.
17261 @cindex @option{-lgcc}, use with @option{-nostdlib}
17262 @cindex @option{-nostdlib} and unresolved references
17263 @cindex unresolved references and @option{-nostdlib}
17264 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
17265 @cindex @option{-nodefaultlibs} and unresolved references
17266 @cindex unresolved references and @option{-nodefaultlibs}
17267 One of the standard libraries bypassed by @option{-nostdlib} and
17268 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
17269 which GCC uses to overcome shortcomings of particular machines, or special
17270 needs for some languages.
17271 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
17272 Collection (GCC) Internals},
17273 for more discussion of @file{libgcc.a}.)
17274 In most cases, you need @file{libgcc.a} even when you want to avoid
17275 other standard libraries.  In other words, when you specify @option{-nostdlib}
17276 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
17277 This ensures that you have no unresolved references to internal GCC
17278 library subroutines.
17279 (An example of such an internal subroutine is @code{__main}, used to ensure C++
17280 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
17281 GNU Compiler Collection (GCC) Internals}.)
17283 @item -nostdlib++
17284 @opindex nostdlib++
17285 Do not implicitly link with standard C++ libraries.
17287 @item -e @var{entry}
17288 @itemx --entry=@var{entry}
17289 @opindex e
17290 @opindex entry
17292 Specify that the program entry point is @var{entry}.  The argument is
17293 interpreted by the linker; the GNU linker accepts either a symbol name
17294 or an address.
17296 @item -pie
17297 @opindex pie
17298 Produce a dynamically linked position independent executable on targets
17299 that support it.  For predictable results, you must also specify the same
17300 set of options used for compilation (@option{-fpie}, @option{-fPIE},
17301 or model suboptions) when you specify this linker option.
17303 @item -no-pie
17304 @opindex no-pie
17305 Don't produce a dynamically linked position independent executable.
17307 @item -static-pie
17308 @opindex static-pie
17309 Produce a static position independent executable on targets that support
17310 it.  A static position independent executable is similar to a static
17311 executable, but can be loaded at any address without a dynamic linker.
17312 For predictable results, you must also specify the same set of options
17313 used for compilation (@option{-fpie}, @option{-fPIE}, or model
17314 suboptions) when you specify this linker option.
17316 @item -pthread
17317 @opindex pthread
17318 Link with the POSIX threads library.  This option is supported on 
17319 GNU/Linux targets, most other Unix derivatives, and also on 
17320 x86 Cygwin and MinGW targets.  On some targets this option also sets 
17321 flags for the preprocessor, so it should be used consistently for both
17322 compilation and linking.
17324 @item -r
17325 @opindex r
17326 Produce a relocatable object as output.  This is also known as partial
17327 linking.
17329 @item -rdynamic
17330 @opindex rdynamic
17331 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
17332 that support it. This instructs the linker to add all symbols, not
17333 only used ones, to the dynamic symbol table. This option is needed
17334 for some uses of @code{dlopen} or to allow obtaining backtraces
17335 from within a program.
17337 @item -s
17338 @opindex s
17339 Remove all symbol table and relocation information from the executable.
17341 @item -static
17342 @opindex static
17343 On systems that support dynamic linking, this overrides @option{-pie}
17344 and prevents linking with the shared libraries.  On other systems, this
17345 option has no effect.
17347 @item -shared
17348 @opindex shared
17349 Produce a shared object which can then be linked with other objects to
17350 form an executable.  Not all systems support this option.  For predictable
17351 results, you must also specify the same set of options used for compilation
17352 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
17353 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
17354 needs to build supplementary stub code for constructors to work.  On
17355 multi-libbed systems, @samp{gcc -shared} must select the correct support
17356 libraries to link against.  Failing to supply the correct flags may lead
17357 to subtle defects.  Supplying them in cases where they are not necessary
17358 is innocuous.}
17360 @item -shared-libgcc
17361 @itemx -static-libgcc
17362 @opindex shared-libgcc
17363 @opindex static-libgcc
17364 On systems that provide @file{libgcc} as a shared library, these options
17365 force the use of either the shared or static version, respectively.
17366 If no shared version of @file{libgcc} was built when the compiler was
17367 configured, these options have no effect.
17369 There are several situations in which an application should use the
17370 shared @file{libgcc} instead of the static version.  The most common
17371 of these is when the application wishes to throw and catch exceptions
17372 across different shared libraries.  In that case, each of the libraries
17373 as well as the application itself should use the shared @file{libgcc}.
17375 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
17376 whenever you build a shared library or a main executable, because C++
17377 programs typically use exceptions, so this is the right thing to do.
17379 If, instead, you use the GCC driver to create shared libraries, you may
17380 find that they are not always linked with the shared @file{libgcc}.
17381 If GCC finds, at its configuration time, that you have a non-GNU linker
17382 or a GNU linker that does not support option @option{--eh-frame-hdr},
17383 it links the shared version of @file{libgcc} into shared libraries
17384 by default.  Otherwise, it takes advantage of the linker and optimizes
17385 away the linking with the shared version of @file{libgcc}, linking with
17386 the static version of libgcc by default.  This allows exceptions to
17387 propagate through such shared libraries, without incurring relocation
17388 costs at library load time.
17390 However, if a library or main executable is supposed to throw or catch
17391 exceptions, you must link it using the G++ driver, or using the option
17392 @option{-shared-libgcc}, such that it is linked with the shared
17393 @file{libgcc}.
17395 @item -static-libasan
17396 @opindex static-libasan
17397 When the @option{-fsanitize=address} option is used to link a program,
17398 the GCC driver automatically links against @option{libasan}.  If
17399 @file{libasan} is available as a shared library, and the @option{-static}
17400 option is not used, then this links against the shared version of
17401 @file{libasan}.  The @option{-static-libasan} option directs the GCC
17402 driver to link @file{libasan} statically, without necessarily linking
17403 other libraries statically.
17405 @item -static-libtsan
17406 @opindex static-libtsan
17407 When the @option{-fsanitize=thread} option is used to link a program,
17408 the GCC driver automatically links against @option{libtsan}.  If
17409 @file{libtsan} is available as a shared library, and the @option{-static}
17410 option is not used, then this links against the shared version of
17411 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
17412 driver to link @file{libtsan} statically, without necessarily linking
17413 other libraries statically.
17415 @item -static-liblsan
17416 @opindex static-liblsan
17417 When the @option{-fsanitize=leak} option is used to link a program,
17418 the GCC driver automatically links against @option{liblsan}.  If
17419 @file{liblsan} is available as a shared library, and the @option{-static}
17420 option is not used, then this links against the shared version of
17421 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
17422 driver to link @file{liblsan} statically, without necessarily linking
17423 other libraries statically.
17425 @item -static-libubsan
17426 @opindex static-libubsan
17427 When the @option{-fsanitize=undefined} option is used to link a program,
17428 the GCC driver automatically links against @option{libubsan}.  If
17429 @file{libubsan} is available as a shared library, and the @option{-static}
17430 option is not used, then this links against the shared version of
17431 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
17432 driver to link @file{libubsan} statically, without necessarily linking
17433 other libraries statically.
17435 @item -static-libstdc++
17436 @opindex static-libstdc++
17437 When the @command{g++} program is used to link a C++ program, it
17438 normally automatically links against @option{libstdc++}.  If
17439 @file{libstdc++} is available as a shared library, and the
17440 @option{-static} option is not used, then this links against the
17441 shared version of @file{libstdc++}.  That is normally fine.  However, it
17442 is sometimes useful to freeze the version of @file{libstdc++} used by
17443 the program without going all the way to a fully static link.  The
17444 @option{-static-libstdc++} option directs the @command{g++} driver to
17445 link @file{libstdc++} statically, without necessarily linking other
17446 libraries statically.
17448 @item -symbolic
17449 @opindex symbolic
17450 Bind references to global symbols when building a shared object.  Warn
17451 about any unresolved references (unless overridden by the link editor
17452 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
17453 this option.
17455 @item -T @var{script}
17456 @opindex T
17457 @cindex linker script
17458 Use @var{script} as the linker script.  This option is supported by most
17459 systems using the GNU linker.  On some targets, such as bare-board
17460 targets without an operating system, the @option{-T} option may be required
17461 when linking to avoid references to undefined symbols.
17463 @item -Xlinker @var{option}
17464 @opindex Xlinker
17465 Pass @var{option} as an option to the linker.  You can use this to
17466 supply system-specific linker options that GCC does not recognize.
17468 If you want to pass an option that takes a separate argument, you must use
17469 @option{-Xlinker} twice, once for the option and once for the argument.
17470 For example, to pass @option{-assert definitions}, you must write
17471 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
17472 @option{-Xlinker "-assert definitions"}, because this passes the entire
17473 string as a single argument, which is not what the linker expects.
17475 When using the GNU linker, it is usually more convenient to pass
17476 arguments to linker options using the @option{@var{option}=@var{value}}
17477 syntax than as separate arguments.  For example, you can specify
17478 @option{-Xlinker -Map=output.map} rather than
17479 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
17480 this syntax for command-line options.
17482 @item -Wl,@var{option}
17483 @opindex Wl
17484 Pass @var{option} as an option to the linker.  If @var{option} contains
17485 commas, it is split into multiple options at the commas.  You can use this
17486 syntax to pass an argument to the option.
17487 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
17488 linker.  When using the GNU linker, you can also get the same effect with
17489 @option{-Wl,-Map=output.map}.
17491 @item -u @var{symbol}
17492 @opindex u
17493 Pretend the symbol @var{symbol} is undefined, to force linking of
17494 library modules to define it.  You can use @option{-u} multiple times with
17495 different symbols to force loading of additional library modules.
17497 @item -z @var{keyword}
17498 @opindex z
17499 @option{-z} is passed directly on to the linker along with the keyword
17500 @var{keyword}. See the section in the documentation of your linker for
17501 permitted values and their meanings.
17502 @end table
17504 @node Directory Options
17505 @section Options for Directory Search
17506 @cindex directory options
17507 @cindex options, directory search
17508 @cindex search path
17510 These options specify directories to search for header files, for
17511 libraries and for parts of the compiler:
17513 @table @gcctabopt
17514 @include cppdiropts.texi
17516 @item -iplugindir=@var{dir}
17517 @opindex iplugindir=
17518 Set the directory to search for plugins that are passed
17519 by @option{-fplugin=@var{name}} instead of
17520 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
17521 to be used by the user, but only passed by the driver.
17523 @item -L@var{dir}
17524 @opindex L
17525 Add directory @var{dir} to the list of directories to be searched
17526 for @option{-l}.
17528 @item -B@var{prefix}
17529 @opindex B
17530 This option specifies where to find the executables, libraries,
17531 include files, and data files of the compiler itself.
17533 The compiler driver program runs one or more of the subprograms
17534 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
17535 @var{prefix} as a prefix for each program it tries to run, both with and
17536 without @samp{@var{machine}/@var{version}/} for the corresponding target
17537 machine and compiler version.
17539 For each subprogram to be run, the compiler driver first tries the
17540 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
17541 is not specified, the driver tries two standard prefixes, 
17542 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
17543 those results in a file name that is found, the unmodified program
17544 name is searched for using the directories specified in your
17545 @env{PATH} environment variable.
17547 The compiler checks to see if the path provided by @option{-B}
17548 refers to a directory, and if necessary it adds a directory
17549 separator character at the end of the path.
17551 @option{-B} prefixes that effectively specify directory names also apply
17552 to libraries in the linker, because the compiler translates these
17553 options into @option{-L} options for the linker.  They also apply to
17554 include files in the preprocessor, because the compiler translates these
17555 options into @option{-isystem} options for the preprocessor.  In this case,
17556 the compiler appends @samp{include} to the prefix.
17558 The runtime support file @file{libgcc.a} can also be searched for using
17559 the @option{-B} prefix, if needed.  If it is not found there, the two
17560 standard prefixes above are tried, and that is all.  The file is left
17561 out of the link if it is not found by those means.
17563 Another way to specify a prefix much like the @option{-B} prefix is to use
17564 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
17565 Variables}.
17567 As a special kludge, if the path provided by @option{-B} is
17568 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
17569 9, then it is replaced by @file{[dir/]include}.  This is to help
17570 with boot-strapping the compiler.
17572 @item -no-canonical-prefixes
17573 @opindex no-canonical-prefixes
17574 Do not expand any symbolic links, resolve references to @samp{/../}
17575 or @samp{/./}, or make the path absolute when generating a relative
17576 prefix.
17578 @item --sysroot=@var{dir}
17579 @opindex sysroot
17580 Use @var{dir} as the logical root directory for headers and libraries.
17581 For example, if the compiler normally searches for headers in
17582 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
17583 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
17585 If you use both this option and the @option{-isysroot} option, then
17586 the @option{--sysroot} option applies to libraries, but the
17587 @option{-isysroot} option applies to header files.
17589 The GNU linker (beginning with version 2.16) has the necessary support
17590 for this option.  If your linker does not support this option, the
17591 header file aspect of @option{--sysroot} still works, but the
17592 library aspect does not.
17594 @item --no-sysroot-suffix
17595 @opindex no-sysroot-suffix
17596 For some targets, a suffix is added to the root directory specified
17597 with @option{--sysroot}, depending on the other options used, so that
17598 headers may for example be found in
17599 @file{@var{dir}/@var{suffix}/usr/include} instead of
17600 @file{@var{dir}/usr/include}.  This option disables the addition of
17601 such a suffix.
17603 @end table
17605 @node Code Gen Options
17606 @section Options for Code Generation Conventions
17607 @cindex code generation conventions
17608 @cindex options, code generation
17609 @cindex run-time options
17611 These machine-independent options control the interface conventions
17612 used in code generation.
17614 Most of them have both positive and negative forms; the negative form
17615 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
17616 one of the forms is listed---the one that is not the default.  You
17617 can figure out the other form by either removing @samp{no-} or adding
17620 @table @gcctabopt
17621 @item -fstack-reuse=@var{reuse-level}
17622 @opindex fstack_reuse
17623 This option controls stack space reuse for user declared local/auto variables
17624 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
17625 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
17626 local variables and temporaries, @samp{named_vars} enables the reuse only for
17627 user defined local variables with names, and @samp{none} disables stack reuse
17628 completely. The default value is @samp{all}. The option is needed when the
17629 program extends the lifetime of a scoped local variable or a compiler generated
17630 temporary beyond the end point defined by the language.  When a lifetime of
17631 a variable ends, and if the variable lives in memory, the optimizing compiler
17632 has the freedom to reuse its stack space with other temporaries or scoped
17633 local variables whose live range does not overlap with it. Legacy code extending
17634 local lifetime is likely to break with the stack reuse optimization.
17636 For example,
17638 @smallexample
17639    int *p;
17640    @{
17641      int local1;
17643      p = &local1;
17644      local1 = 10;
17645      ....
17646    @}
17647    @{
17648       int local2;
17649       local2 = 20;
17650       ...
17651    @}
17653    if (*p == 10)  // out of scope use of local1
17654      @{
17656      @}
17657 @end smallexample
17659 Another example:
17660 @smallexample
17662    struct A
17663    @{
17664        A(int k) : i(k), j(k) @{ @}
17665        int i;
17666        int j;
17667    @};
17669    A *ap;
17671    void foo(const A& ar)
17672    @{
17673       ap = &ar;
17674    @}
17676    void bar()
17677    @{
17678       foo(A(10)); // temp object's lifetime ends when foo returns
17680       @{
17681         A a(20);
17682         ....
17683       @}
17684       ap->i+= 10;  // ap references out of scope temp whose space
17685                    // is reused with a. What is the value of ap->i?
17686    @}
17688 @end smallexample
17690 The lifetime of a compiler generated temporary is well defined by the C++
17691 standard. When a lifetime of a temporary ends, and if the temporary lives
17692 in memory, the optimizing compiler has the freedom to reuse its stack
17693 space with other temporaries or scoped local variables whose live range
17694 does not overlap with it. However some of the legacy code relies on
17695 the behavior of older compilers in which temporaries' stack space is
17696 not reused, the aggressive stack reuse can lead to runtime errors. This
17697 option is used to control the temporary stack reuse optimization.
17699 @item -ftrapv
17700 @opindex ftrapv
17701 This option generates traps for signed overflow on addition, subtraction,
17702 multiplication operations.
17703 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
17704 @option{-ftrapv} @option{-fwrapv} on the command-line results in
17705 @option{-fwrapv} being effective.  Note that only active options override, so
17706 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
17707 results in @option{-ftrapv} being effective.
17709 @item -fwrapv
17710 @opindex fwrapv
17711 This option instructs the compiler to assume that signed arithmetic
17712 overflow of addition, subtraction and multiplication wraps around
17713 using twos-complement representation.  This flag enables some optimizations
17714 and disables others.
17715 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
17716 @option{-ftrapv} @option{-fwrapv} on the command-line results in
17717 @option{-fwrapv} being effective.  Note that only active options override, so
17718 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
17719 results in @option{-ftrapv} being effective.
17721 @item -fwrapv-pointer
17722 @opindex fwrapv-pointer
17723 This option instructs the compiler to assume that pointer arithmetic
17724 overflow on addition and subtraction wraps around using twos-complement
17725 representation.  This flag disables some optimizations which assume
17726 pointer overflow is invalid.
17728 @item -fstrict-overflow
17729 @opindex fstrict-overflow
17730 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
17731 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
17733 @item -fexceptions
17734 @opindex fexceptions
17735 Enable exception handling.  Generates extra code needed to propagate
17736 exceptions.  For some targets, this implies GCC generates frame
17737 unwind information for all functions, which can produce significant data
17738 size overhead, although it does not affect execution.  If you do not
17739 specify this option, GCC enables it by default for languages like
17740 C++ that normally require exception handling, and disables it for
17741 languages like C that do not normally require it.  However, you may need
17742 to enable this option when compiling C code that needs to interoperate
17743 properly with exception handlers written in C++.  You may also wish to
17744 disable this option if you are compiling older C++ programs that don't
17745 use exception handling.
17747 @item -fnon-call-exceptions
17748 @opindex fnon-call-exceptions
17749 Generate code that allows trapping instructions to throw exceptions.
17750 Note that this requires platform-specific runtime support that does
17751 not exist everywhere.  Moreover, it only allows @emph{trapping}
17752 instructions to throw exceptions, i.e.@: memory references or floating-point
17753 instructions.  It does not allow exceptions to be thrown from
17754 arbitrary signal handlers such as @code{SIGALRM}.  This enables
17755 @option{-fexceptions}.
17757 @item -fdelete-dead-exceptions
17758 @opindex fdelete-dead-exceptions
17759 Consider that instructions that may throw exceptions but don't otherwise
17760 contribute to the execution of the program can be optimized away.
17761 This does not affect calls to functions except those with the
17762 @code{pure} or @code{const} attributes.
17763 This option is enabled by default for the Ada and C++ compilers, as permitted by
17764 the language specifications.
17765 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
17767 @item -funwind-tables
17768 @opindex funwind-tables
17769 Similar to @option{-fexceptions}, except that it just generates any needed
17770 static data, but does not affect the generated code in any other way.
17771 You normally do not need to enable this option; instead, a language processor
17772 that needs this handling enables it on your behalf.
17774 @item -fasynchronous-unwind-tables
17775 @opindex fasynchronous-unwind-tables
17776 Generate unwind table in DWARF format, if supported by target machine.  The
17777 table is exact at each instruction boundary, so it can be used for stack
17778 unwinding from asynchronous events (such as debugger or garbage collector).
17780 @item -fno-gnu-unique
17781 @opindex fno-gnu-unique
17782 @opindex fgnu-unique
17783 On systems with recent GNU assembler and C library, the C++ compiler
17784 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
17785 of template static data members and static local variables in inline
17786 functions are unique even in the presence of @code{RTLD_LOCAL}; this
17787 is necessary to avoid problems with a library used by two different
17788 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
17789 therefore disagreeing with the other one about the binding of the
17790 symbol.  But this causes @code{dlclose} to be ignored for affected
17791 DSOs; if your program relies on reinitialization of a DSO via
17792 @code{dlclose} and @code{dlopen}, you can use
17793 @option{-fno-gnu-unique}.
17795 @item -fpcc-struct-return
17796 @opindex fpcc-struct-return
17797 Return ``short'' @code{struct} and @code{union} values in memory like
17798 longer ones, rather than in registers.  This convention is less
17799 efficient, but it has the advantage of allowing intercallability between
17800 GCC-compiled files and files compiled with other compilers, particularly
17801 the Portable C Compiler (pcc).
17803 The precise convention for returning structures in memory depends
17804 on the target configuration macros.
17806 Short structures and unions are those whose size and alignment match
17807 that of some integer type.
17809 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
17810 switch is not binary compatible with code compiled with the
17811 @option{-freg-struct-return} switch.
17812 Use it to conform to a non-default application binary interface.
17814 @item -freg-struct-return
17815 @opindex freg-struct-return
17816 Return @code{struct} and @code{union} values in registers when possible.
17817 This is more efficient for small structures than
17818 @option{-fpcc-struct-return}.
17820 If you specify neither @option{-fpcc-struct-return} nor
17821 @option{-freg-struct-return}, GCC defaults to whichever convention is
17822 standard for the target.  If there is no standard convention, GCC
17823 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
17824 the principal compiler.  In those cases, we can choose the standard, and
17825 we chose the more efficient register return alternative.
17827 @strong{Warning:} code compiled with the @option{-freg-struct-return}
17828 switch is not binary compatible with code compiled with the
17829 @option{-fpcc-struct-return} switch.
17830 Use it to conform to a non-default application binary interface.
17832 @item -fshort-enums
17833 @opindex fshort-enums
17834 Allocate to an @code{enum} type only as many bytes as it needs for the
17835 declared range of possible values.  Specifically, the @code{enum} type
17836 is equivalent to the smallest integer type that has enough room.
17838 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
17839 code that is not binary compatible with code generated without that switch.
17840 Use it to conform to a non-default application binary interface.
17842 @item -fshort-wchar
17843 @opindex fshort-wchar
17844 Override the underlying type for @code{wchar_t} to be @code{short
17845 unsigned int} instead of the default for the target.  This option is
17846 useful for building programs to run under WINE@.
17848 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
17849 code that is not binary compatible with code generated without that switch.
17850 Use it to conform to a non-default application binary interface.
17852 @item -fcommon
17853 @opindex fcommon
17854 @opindex fno-common
17855 @cindex tentative definitions
17856 In C code, this option controls the placement of global variables
17857 defined without an initializer, known as @dfn{tentative definitions}
17858 in the C standard.  Tentative definitions are distinct from declarations
17859 of a variable with the @code{extern} keyword, which do not allocate storage.
17861 The default is @option{-fno-common}, which specifies that the compiler places
17862 uninitialized global variables in the BSS section of the object file.
17863 This inhibits the merging of tentative definitions by the linker so you get a
17864 multiple-definition error if the same variable is accidentally defined in more
17865 than one compilation unit.
17867 The @option{-fcommon} places uninitialized global variables in a common block.
17868 This allows the linker to resolve all tentative definitions of the same variable
17869 in different compilation units to the same object, or to a non-tentative
17870 definition.  This behavior is inconsistent with C++, and on many targets implies
17871 a speed and code size penalty on global variable references.  It is mainly
17872 useful to enable legacy code to link without errors.
17874 @item -fno-ident
17875 @opindex fno-ident
17876 @opindex fident
17877 Ignore the @code{#ident} directive.
17879 @item -finhibit-size-directive
17880 @opindex finhibit-size-directive
17881 Don't output a @code{.size} assembler directive, or anything else that
17882 would cause trouble if the function is split in the middle, and the
17883 two halves are placed at locations far apart in memory.  This option is
17884 used when compiling @file{crtstuff.c}; you should not need to use it
17885 for anything else.
17887 @item -fverbose-asm
17888 @opindex fverbose-asm
17889 Put extra commentary information in the generated assembly code to
17890 make it more readable.  This option is generally only of use to those
17891 who actually need to read the generated assembly code (perhaps while
17892 debugging the compiler itself).
17894 @option{-fno-verbose-asm}, the default, causes the
17895 extra information to be omitted and is useful when comparing two assembler
17896 files.
17898 The added comments include:
17900 @itemize @bullet
17902 @item
17903 information on the compiler version and command-line options,
17905 @item
17906 the source code lines associated with the assembly instructions,
17907 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
17909 @item
17910 hints on which high-level expressions correspond to
17911 the various assembly instruction operands.
17913 @end itemize
17915 For example, given this C source file:
17917 @smallexample
17918 int test (int n)
17920   int i;
17921   int total = 0;
17923   for (i = 0; i < n; i++)
17924     total += i * i;
17926   return total;
17928 @end smallexample
17930 compiling to (x86_64) assembly via @option{-S} and emitting the result
17931 direct to stdout via @option{-o} @option{-}
17933 @smallexample
17934 gcc -S test.c -fverbose-asm -Os -o -
17935 @end smallexample
17937 gives output similar to this:
17939 @smallexample
17940         .file   "test.c"
17941 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
17942   [...snip...]
17943 # options passed:
17944   [...snip...]
17946         .text
17947         .globl  test
17948         .type   test, @@function
17949 test:
17950 .LFB0:
17951         .cfi_startproc
17952 # test.c:4:   int total = 0;
17953         xorl    %eax, %eax      # <retval>
17954 # test.c:6:   for (i = 0; i < n; i++)
17955         xorl    %edx, %edx      # i
17956 .L2:
17957 # test.c:6:   for (i = 0; i < n; i++)
17958         cmpl    %edi, %edx      # n, i
17959         jge     .L5     #,
17960 # test.c:7:     total += i * i;
17961         movl    %edx, %ecx      # i, tmp92
17962         imull   %edx, %ecx      # i, tmp92
17963 # test.c:6:   for (i = 0; i < n; i++)
17964         incl    %edx    # i
17965 # test.c:7:     total += i * i;
17966         addl    %ecx, %eax      # tmp92, <retval>
17967         jmp     .L2     #
17968 .L5:
17969 # test.c:10: @}
17970         ret
17971         .cfi_endproc
17972 .LFE0:
17973         .size   test, .-test
17974         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
17975         .section        .note.GNU-stack,"",@@progbits
17976 @end smallexample
17978 The comments are intended for humans rather than machines and hence the
17979 precise format of the comments is subject to change.
17981 @item -frecord-gcc-switches
17982 @opindex frecord-gcc-switches
17983 This switch causes the command line used to invoke the
17984 compiler to be recorded into the object file that is being created.
17985 This switch is only implemented on some targets and the exact format
17986 of the recording is target and binary file format dependent, but it
17987 usually takes the form of a section containing ASCII text.  This
17988 switch is related to the @option{-fverbose-asm} switch, but that
17989 switch only records information in the assembler output file as
17990 comments, so it never reaches the object file.
17991 See also @option{-grecord-gcc-switches} for another
17992 way of storing compiler options into the object file.
17994 @item -fpic
17995 @opindex fpic
17996 @cindex global offset table
17997 @cindex PIC
17998 Generate position-independent code (PIC) suitable for use in a shared
17999 library, if supported for the target machine.  Such code accesses all
18000 constant addresses through a global offset table (GOT)@.  The dynamic
18001 loader resolves the GOT entries when the program starts (the dynamic
18002 loader is not part of GCC; it is part of the operating system).  If
18003 the GOT size for the linked executable exceeds a machine-specific
18004 maximum size, you get an error message from the linker indicating that
18005 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18006 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18007 on the m68k and RS/6000.  The x86 has no such limit.)
18009 Position-independent code requires special support, and therefore works
18010 only on certain machines.  For the x86, GCC supports PIC for System V
18011 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
18012 position-independent.
18014 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18015 are defined to 1.
18017 @item -fPIC
18018 @opindex fPIC
18019 If supported for the target machine, emit position-independent code,
18020 suitable for dynamic linking and avoiding any limit on the size of the
18021 global offset table.  This option makes a difference on AArch64, m68k,
18022 PowerPC and SPARC@.
18024 Position-independent code requires special support, and therefore works
18025 only on certain machines.
18027 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18028 are defined to 2.
18030 @item -fpie
18031 @itemx -fPIE
18032 @opindex fpie
18033 @opindex fPIE
18034 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18035 generated position-independent code can be only linked into executables.
18036 Usually these options are used to compile code that will be linked using
18037 the @option{-pie} GCC option.
18039 @option{-fpie} and @option{-fPIE} both define the macros
18040 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
18041 for @option{-fpie} and 2 for @option{-fPIE}.
18043 @item -fno-plt
18044 @opindex fno-plt
18045 @opindex fplt
18046 Do not use the PLT for external function calls in position-independent code.
18047 Instead, load the callee address at call sites from the GOT and branch to it.
18048 This leads to more efficient code by eliminating PLT stubs and exposing
18049 GOT loads to optimizations.  On architectures such as 32-bit x86 where
18050 PLT stubs expect the GOT pointer in a specific register, this gives more
18051 register allocation freedom to the compiler.
18052 Lazy binding requires use of the PLT; 
18053 with @option{-fno-plt} all external symbols are resolved at load time.
18055 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18056 through the PLT for specific external functions.
18058 In position-dependent code, a few targets also convert calls to
18059 functions that are marked to not use the PLT to use the GOT instead.
18061 @item -fno-jump-tables
18062 @opindex fno-jump-tables
18063 @opindex fjump-tables
18064 Do not use jump tables for switch statements even where it would be
18065 more efficient than other code generation strategies.  This option is
18066 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18067 building code that forms part of a dynamic linker and cannot
18068 reference the address of a jump table.  On some targets, jump tables
18069 do not require a GOT and this option is not needed.
18071 @item -fno-bit-tests
18072 @opindex fno-bit-tests
18073 @opindex fbit-tests
18074 Do not use bit tests for switch statements even where it would be
18075 more efficient than other code generation strategies.
18077 @item -ffixed-@var{reg}
18078 @opindex ffixed
18079 Treat the register named @var{reg} as a fixed register; generated code
18080 should never refer to it (except perhaps as a stack pointer, frame
18081 pointer or in some other fixed role).
18083 @var{reg} must be the name of a register.  The register names accepted
18084 are machine-specific and are defined in the @code{REGISTER_NAMES}
18085 macro in the machine description macro file.
18087 This flag does not have a negative form, because it specifies a
18088 three-way choice.
18090 @item -fcall-used-@var{reg}
18091 @opindex fcall-used
18092 Treat the register named @var{reg} as an allocable register that is
18093 clobbered by function calls.  It may be allocated for temporaries or
18094 variables that do not live across a call.  Functions compiled this way
18095 do not save and restore the register @var{reg}.
18097 It is an error to use this flag with the frame pointer or stack pointer.
18098 Use of this flag for other registers that have fixed pervasive roles in
18099 the machine's execution model produces disastrous results.
18101 This flag does not have a negative form, because it specifies a
18102 three-way choice.
18104 @item -fcall-saved-@var{reg}
18105 @opindex fcall-saved
18106 Treat the register named @var{reg} as an allocable register saved by
18107 functions.  It may be allocated even for temporaries or variables that
18108 live across a call.  Functions compiled this way save and restore
18109 the register @var{reg} if they use it.
18111 It is an error to use this flag with the frame pointer or stack pointer.
18112 Use of this flag for other registers that have fixed pervasive roles in
18113 the machine's execution model produces disastrous results.
18115 A different sort of disaster results from the use of this flag for
18116 a register in which function values may be returned.
18118 This flag does not have a negative form, because it specifies a
18119 three-way choice.
18121 @item -fpack-struct[=@var{n}]
18122 @opindex fpack-struct
18123 Without a value specified, pack all structure members together without
18124 holes.  When a value is specified (which must be a small power of two), pack
18125 structure members according to this value, representing the maximum
18126 alignment (that is, objects with default alignment requirements larger than
18127 this are output potentially unaligned at the next fitting location.
18129 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18130 code that is not binary compatible with code generated without that switch.
18131 Additionally, it makes the code suboptimal.
18132 Use it to conform to a non-default application binary interface.
18134 @item -fleading-underscore
18135 @opindex fleading-underscore
18136 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18137 change the way C symbols are represented in the object file.  One use
18138 is to help link with legacy assembly code.
18140 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18141 generate code that is not binary compatible with code generated without that
18142 switch.  Use it to conform to a non-default application binary interface.
18143 Not all targets provide complete support for this switch.
18145 @item -ftls-model=@var{model}
18146 @opindex ftls-model
18147 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18148 The @var{model} argument should be one of @samp{global-dynamic},
18149 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
18150 Note that the choice is subject to optimization: the compiler may use
18151 a more efficient model for symbols not visible outside of the translation
18152 unit, or if @option{-fpic} is not given on the command line.
18154 The default without @option{-fpic} is @samp{initial-exec}; with
18155 @option{-fpic} the default is @samp{global-dynamic}.
18157 @item -ftrampolines
18158 @opindex ftrampolines
18159 For targets that normally need trampolines for nested functions, always
18160 generate them instead of using descriptors.  Otherwise, for targets that
18161 do not need them, like for example HP-PA or IA-64, do nothing.
18163 A trampoline is a small piece of code that is created at run time on the
18164 stack when the address of a nested function is taken, and is used to call
18165 the nested function indirectly.  Therefore, it requires the stack to be
18166 made executable in order for the program to work properly.
18168 @option{-fno-trampolines} is enabled by default on a language by language
18169 basis to let the compiler avoid generating them, if it computes that this
18170 is safe, and replace them with descriptors.  Descriptors are made up of data
18171 only, but the generated code must be prepared to deal with them.  As of this
18172 writing, @option{-fno-trampolines} is enabled by default only for Ada.
18174 Moreover, code compiled with @option{-ftrampolines} and code compiled with
18175 @option{-fno-trampolines} are not binary compatible if nested functions are
18176 present.  This option must therefore be used on a program-wide basis and be
18177 manipulated with extreme care.
18179 For languages other than Ada, the @code{-ftrampolines} and
18180 @code{-fno-trampolines} options currently have no effect, and
18181 trampolines are always generated on platforms that need them
18182 for nested functions.
18184 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
18185 @opindex fvisibility
18186 Set the default ELF image symbol visibility to the specified option---all
18187 symbols are marked with this unless overridden within the code.
18188 Using this feature can very substantially improve linking and
18189 load times of shared object libraries, produce more optimized
18190 code, provide near-perfect API export and prevent symbol clashes.
18191 It is @strong{strongly} recommended that you use this in any shared objects
18192 you distribute.
18194 Despite the nomenclature, @samp{default} always means public; i.e.,
18195 available to be linked against from outside the shared object.
18196 @samp{protected} and @samp{internal} are pretty useless in real-world
18197 usage so the only other commonly used option is @samp{hidden}.
18198 The default if @option{-fvisibility} isn't specified is
18199 @samp{default}, i.e., make every symbol public.
18201 A good explanation of the benefits offered by ensuring ELF
18202 symbols have the correct visibility is given by ``How To Write
18203 Shared Libraries'' by Ulrich Drepper (which can be found at
18204 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
18205 solution made possible by this option to marking things hidden when
18206 the default is public is to make the default hidden and mark things
18207 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
18208 and @code{__attribute__ ((visibility("default")))} instead of
18209 @code{__declspec(dllexport)} you get almost identical semantics with
18210 identical syntax.  This is a great boon to those working with
18211 cross-platform projects.
18213 For those adding visibility support to existing code, you may find
18214 @code{#pragma GCC visibility} of use.  This works by you enclosing
18215 the declarations you wish to set visibility for with (for example)
18216 @code{#pragma GCC visibility push(hidden)} and
18217 @code{#pragma GCC visibility pop}.
18218 Bear in mind that symbol visibility should be viewed @strong{as
18219 part of the API interface contract} and thus all new code should
18220 always specify visibility when it is not the default; i.e., declarations
18221 only for use within the local DSO should @strong{always} be marked explicitly
18222 as hidden as so to avoid PLT indirection overheads---making this
18223 abundantly clear also aids readability and self-documentation of the code.
18224 Note that due to ISO C++ specification requirements, @code{operator new} and
18225 @code{operator delete} must always be of default visibility.
18227 Be aware that headers from outside your project, in particular system
18228 headers and headers from any other library you use, may not be
18229 expecting to be compiled with visibility other than the default.  You
18230 may need to explicitly say @code{#pragma GCC visibility push(default)}
18231 before including any such headers.
18233 @code{extern} declarations are not affected by @option{-fvisibility}, so
18234 a lot of code can be recompiled with @option{-fvisibility=hidden} with
18235 no modifications.  However, this means that calls to @code{extern}
18236 functions with no explicit visibility use the PLT, so it is more
18237 effective to use @code{__attribute ((visibility))} and/or
18238 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
18239 declarations should be treated as hidden.
18241 Note that @option{-fvisibility} does affect C++ vague linkage
18242 entities. This means that, for instance, an exception class that is
18243 be thrown between DSOs must be explicitly marked with default
18244 visibility so that the @samp{type_info} nodes are unified between
18245 the DSOs.
18247 An overview of these techniques, their benefits and how to use them
18248 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
18250 @item -fstrict-volatile-bitfields
18251 @opindex fstrict-volatile-bitfields
18252 This option should be used if accesses to volatile bit-fields (or other
18253 structure fields, although the compiler usually honors those types
18254 anyway) should use a single access of the width of the
18255 field's type, aligned to a natural alignment if possible.  For
18256 example, targets with memory-mapped peripheral registers might require
18257 all such accesses to be 16 bits wide; with this flag you can
18258 declare all peripheral bit-fields as @code{unsigned short} (assuming short
18259 is 16 bits on these targets) to force GCC to use 16-bit accesses
18260 instead of, perhaps, a more efficient 32-bit access.
18262 If this option is disabled, the compiler uses the most efficient
18263 instruction.  In the previous example, that might be a 32-bit load
18264 instruction, even though that accesses bytes that do not contain
18265 any portion of the bit-field, or memory-mapped registers unrelated to
18266 the one being updated.
18268 In some cases, such as when the @code{packed} attribute is applied to a 
18269 structure field, it may not be possible to access the field with a single
18270 read or write that is correctly aligned for the target machine.  In this
18271 case GCC falls back to generating multiple accesses rather than code that 
18272 will fault or truncate the result at run time.
18274 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
18275 not allowed to touch non bit-field members.  It is therefore recommended
18276 to define all bits of the field's type as bit-field members.
18278 The default value of this option is determined by the application binary
18279 interface for the target processor.
18281 @item -fsync-libcalls
18282 @opindex fsync-libcalls
18283 This option controls whether any out-of-line instance of the @code{__sync}
18284 family of functions may be used to implement the C++11 @code{__atomic}
18285 family of functions.
18287 The default value of this option is enabled, thus the only useful form
18288 of the option is @option{-fno-sync-libcalls}.  This option is used in
18289 the implementation of the @file{libatomic} runtime library.
18291 @end table
18293 @node Developer Options
18294 @section GCC Developer Options
18295 @cindex developer options
18296 @cindex debugging GCC
18297 @cindex debug dump options
18298 @cindex dump options
18299 @cindex compilation statistics
18301 This section describes command-line options that are primarily of
18302 interest to GCC developers, including options to support compiler
18303 testing and investigation of compiler bugs and compile-time
18304 performance problems.  This includes options that produce debug dumps
18305 at various points in the compilation; that print statistics such as
18306 memory use and execution time; and that print information about GCC's
18307 configuration, such as where it searches for libraries.  You should
18308 rarely need to use any of these options for ordinary compilation and
18309 linking tasks.
18311 Many developer options that cause GCC to dump output to a file take an
18312 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
18313 or @samp{-} to dump to standard output, and @samp{stderr} for standard
18314 error.
18316 If @samp{=@var{filename}} is omitted, a default dump file name is
18317 constructed by concatenating the base dump file name, a pass number,
18318 phase letter, and pass name.  The base dump file name is the name of
18319 output file produced by the compiler if explicitly specified and not
18320 an executable; otherwise it is the source file name.
18321 The pass number is determined by the order passes are registered with
18322 the compiler's pass manager. 
18323 This is generally the same as the order of execution, but passes
18324 registered by plugins, target-specific passes, or passes that are
18325 otherwise registered late are numbered higher than the pass named
18326 @samp{final}, even if they are executed earlier.  The phase letter is
18327 one of @samp{i} (inter-procedural analysis), @samp{l}
18328 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
18329 The files are created in the directory of the output file. 
18331 @table @gcctabopt
18333 @item -fcallgraph-info
18334 @itemx -fcallgraph-info=@var{MARKERS}
18335 @opindex fcallgraph-info
18336 Makes the compiler output callgraph information for the program, on a
18337 per-object-file basis.  The information is generated in the common VCG
18338 format.  It can be decorated with additional, per-node and/or per-edge
18339 information, if a list of comma-separated markers is additionally
18340 specified.  When the @code{su} marker is specified, the callgraph is
18341 decorated with stack usage information; it is equivalent to
18342 @option{-fstack-usage}.  When the @code{da} marker is specified, the
18343 callgraph is decorated with information about dynamically allocated
18344 objects.
18346 When compiling with @option{-flto}, no callgraph information is output
18347 along with the object file.  At LTO link time, @option{-fcallgraph-info}
18348 may generate multiple callgraph information files next to intermediate
18349 LTO output files.
18351 @item -d@var{letters}
18352 @itemx -fdump-rtl-@var{pass}
18353 @itemx -fdump-rtl-@var{pass}=@var{filename}
18354 @opindex d
18355 @opindex fdump-rtl-@var{pass}
18356 Says to make debugging dumps during compilation at times specified by
18357 @var{letters}.  This is used for debugging the RTL-based passes of the
18358 compiler.
18360 Some @option{-d@var{letters}} switches have different meaning when
18361 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
18362 for information about preprocessor-specific dump options.
18364 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
18365 @option{-d} option @var{letters}.  Here are the possible
18366 letters for use in @var{pass} and @var{letters}, and their meanings:
18368 @table @gcctabopt
18370 @item -fdump-rtl-alignments
18371 @opindex fdump-rtl-alignments
18372 Dump after branch alignments have been computed.
18374 @item -fdump-rtl-asmcons
18375 @opindex fdump-rtl-asmcons
18376 Dump after fixing rtl statements that have unsatisfied in/out constraints.
18378 @item -fdump-rtl-auto_inc_dec
18379 @opindex fdump-rtl-auto_inc_dec
18380 Dump after auto-inc-dec discovery.  This pass is only run on
18381 architectures that have auto inc or auto dec instructions.
18383 @item -fdump-rtl-barriers
18384 @opindex fdump-rtl-barriers
18385 Dump after cleaning up the barrier instructions.
18387 @item -fdump-rtl-bbpart
18388 @opindex fdump-rtl-bbpart
18389 Dump after partitioning hot and cold basic blocks.
18391 @item -fdump-rtl-bbro
18392 @opindex fdump-rtl-bbro
18393 Dump after block reordering.
18395 @item -fdump-rtl-btl1
18396 @itemx -fdump-rtl-btl2
18397 @opindex fdump-rtl-btl2
18398 @opindex fdump-rtl-btl2
18399 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
18400 after the two branch
18401 target load optimization passes.
18403 @item -fdump-rtl-bypass
18404 @opindex fdump-rtl-bypass
18405 Dump after jump bypassing and control flow optimizations.
18407 @item -fdump-rtl-combine
18408 @opindex fdump-rtl-combine
18409 Dump after the RTL instruction combination pass.
18411 @item -fdump-rtl-compgotos
18412 @opindex fdump-rtl-compgotos
18413 Dump after duplicating the computed gotos.
18415 @item -fdump-rtl-ce1
18416 @itemx -fdump-rtl-ce2
18417 @itemx -fdump-rtl-ce3
18418 @opindex fdump-rtl-ce1
18419 @opindex fdump-rtl-ce2
18420 @opindex fdump-rtl-ce3
18421 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
18422 @option{-fdump-rtl-ce3} enable dumping after the three
18423 if conversion passes.
18425 @item -fdump-rtl-cprop_hardreg
18426 @opindex fdump-rtl-cprop_hardreg
18427 Dump after hard register copy propagation.
18429 @item -fdump-rtl-csa
18430 @opindex fdump-rtl-csa
18431 Dump after combining stack adjustments.
18433 @item -fdump-rtl-cse1
18434 @itemx -fdump-rtl-cse2
18435 @opindex fdump-rtl-cse1
18436 @opindex fdump-rtl-cse2
18437 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
18438 the two common subexpression elimination passes.
18440 @item -fdump-rtl-dce
18441 @opindex fdump-rtl-dce
18442 Dump after the standalone dead code elimination passes.
18444 @item -fdump-rtl-dbr
18445 @opindex fdump-rtl-dbr
18446 Dump after delayed branch scheduling.
18448 @item -fdump-rtl-dce1
18449 @itemx -fdump-rtl-dce2
18450 @opindex fdump-rtl-dce1
18451 @opindex fdump-rtl-dce2
18452 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
18453 the two dead store elimination passes.
18455 @item -fdump-rtl-eh
18456 @opindex fdump-rtl-eh
18457 Dump after finalization of EH handling code.
18459 @item -fdump-rtl-eh_ranges
18460 @opindex fdump-rtl-eh_ranges
18461 Dump after conversion of EH handling range regions.
18463 @item -fdump-rtl-expand
18464 @opindex fdump-rtl-expand
18465 Dump after RTL generation.
18467 @item -fdump-rtl-fwprop1
18468 @itemx -fdump-rtl-fwprop2
18469 @opindex fdump-rtl-fwprop1
18470 @opindex fdump-rtl-fwprop2
18471 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
18472 dumping after the two forward propagation passes.
18474 @item -fdump-rtl-gcse1
18475 @itemx -fdump-rtl-gcse2
18476 @opindex fdump-rtl-gcse1
18477 @opindex fdump-rtl-gcse2
18478 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
18479 after global common subexpression elimination.
18481 @item -fdump-rtl-init-regs
18482 @opindex fdump-rtl-init-regs
18483 Dump after the initialization of the registers.
18485 @item -fdump-rtl-initvals
18486 @opindex fdump-rtl-initvals
18487 Dump after the computation of the initial value sets.
18489 @item -fdump-rtl-into_cfglayout
18490 @opindex fdump-rtl-into_cfglayout
18491 Dump after converting to cfglayout mode.
18493 @item -fdump-rtl-ira
18494 @opindex fdump-rtl-ira
18495 Dump after iterated register allocation.
18497 @item -fdump-rtl-jump
18498 @opindex fdump-rtl-jump
18499 Dump after the second jump optimization.
18501 @item -fdump-rtl-loop2
18502 @opindex fdump-rtl-loop2
18503 @option{-fdump-rtl-loop2} enables dumping after the rtl
18504 loop optimization passes.
18506 @item -fdump-rtl-mach
18507 @opindex fdump-rtl-mach
18508 Dump after performing the machine dependent reorganization pass, if that
18509 pass exists.
18511 @item -fdump-rtl-mode_sw
18512 @opindex fdump-rtl-mode_sw
18513 Dump after removing redundant mode switches.
18515 @item -fdump-rtl-rnreg
18516 @opindex fdump-rtl-rnreg
18517 Dump after register renumbering.
18519 @item -fdump-rtl-outof_cfglayout
18520 @opindex fdump-rtl-outof_cfglayout
18521 Dump after converting from cfglayout mode.
18523 @item -fdump-rtl-peephole2
18524 @opindex fdump-rtl-peephole2
18525 Dump after the peephole pass.
18527 @item -fdump-rtl-postreload
18528 @opindex fdump-rtl-postreload
18529 Dump after post-reload optimizations.
18531 @item -fdump-rtl-pro_and_epilogue
18532 @opindex fdump-rtl-pro_and_epilogue
18533 Dump after generating the function prologues and epilogues.
18535 @item -fdump-rtl-sched1
18536 @itemx -fdump-rtl-sched2
18537 @opindex fdump-rtl-sched1
18538 @opindex fdump-rtl-sched2
18539 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
18540 after the basic block scheduling passes.
18542 @item -fdump-rtl-ree
18543 @opindex fdump-rtl-ree
18544 Dump after sign/zero extension elimination.
18546 @item -fdump-rtl-seqabstr
18547 @opindex fdump-rtl-seqabstr
18548 Dump after common sequence discovery.
18550 @item -fdump-rtl-shorten
18551 @opindex fdump-rtl-shorten
18552 Dump after shortening branches.
18554 @item -fdump-rtl-sibling
18555 @opindex fdump-rtl-sibling
18556 Dump after sibling call optimizations.
18558 @item -fdump-rtl-split1
18559 @itemx -fdump-rtl-split2
18560 @itemx -fdump-rtl-split3
18561 @itemx -fdump-rtl-split4
18562 @itemx -fdump-rtl-split5
18563 @opindex fdump-rtl-split1
18564 @opindex fdump-rtl-split2
18565 @opindex fdump-rtl-split3
18566 @opindex fdump-rtl-split4
18567 @opindex fdump-rtl-split5
18568 These options enable dumping after five rounds of
18569 instruction splitting.
18571 @item -fdump-rtl-sms
18572 @opindex fdump-rtl-sms
18573 Dump after modulo scheduling.  This pass is only run on some
18574 architectures.
18576 @item -fdump-rtl-stack
18577 @opindex fdump-rtl-stack
18578 Dump after conversion from GCC's ``flat register file'' registers to the
18579 x87's stack-like registers.  This pass is only run on x86 variants.
18581 @item -fdump-rtl-subreg1
18582 @itemx -fdump-rtl-subreg2
18583 @opindex fdump-rtl-subreg1
18584 @opindex fdump-rtl-subreg2
18585 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
18586 the two subreg expansion passes.
18588 @item -fdump-rtl-unshare
18589 @opindex fdump-rtl-unshare
18590 Dump after all rtl has been unshared.
18592 @item -fdump-rtl-vartrack
18593 @opindex fdump-rtl-vartrack
18594 Dump after variable tracking.
18596 @item -fdump-rtl-vregs
18597 @opindex fdump-rtl-vregs
18598 Dump after converting virtual registers to hard registers.
18600 @item -fdump-rtl-web
18601 @opindex fdump-rtl-web
18602 Dump after live range splitting.
18604 @item -fdump-rtl-regclass
18605 @itemx -fdump-rtl-subregs_of_mode_init
18606 @itemx -fdump-rtl-subregs_of_mode_finish
18607 @itemx -fdump-rtl-dfinit
18608 @itemx -fdump-rtl-dfinish
18609 @opindex fdump-rtl-regclass
18610 @opindex fdump-rtl-subregs_of_mode_init
18611 @opindex fdump-rtl-subregs_of_mode_finish
18612 @opindex fdump-rtl-dfinit
18613 @opindex fdump-rtl-dfinish
18614 These dumps are defined but always produce empty files.
18616 @item -da
18617 @itemx -fdump-rtl-all
18618 @opindex da
18619 @opindex fdump-rtl-all
18620 Produce all the dumps listed above.
18622 @item -dA
18623 @opindex dA
18624 Annotate the assembler output with miscellaneous debugging information.
18626 @item -dD
18627 @opindex dD
18628 Dump all macro definitions, at the end of preprocessing, in addition to
18629 normal output.
18631 @item -dH
18632 @opindex dH
18633 Produce a core dump whenever an error occurs.
18635 @item -dp
18636 @opindex dp
18637 Annotate the assembler output with a comment indicating which
18638 pattern and alternative is used.  The length and cost of each instruction are
18639 also printed.
18641 @item -dP
18642 @opindex dP
18643 Dump the RTL in the assembler output as a comment before each instruction.
18644 Also turns on @option{-dp} annotation.
18646 @item -dx
18647 @opindex dx
18648 Just generate RTL for a function instead of compiling it.  Usually used
18649 with @option{-fdump-rtl-expand}.
18650 @end table
18652 @item -fdump-debug
18653 @opindex fdump-debug
18654 Dump debugging information generated during the debug
18655 generation phase.
18657 @item -fdump-earlydebug
18658 @opindex fdump-earlydebug
18659 Dump debugging information generated during the early debug
18660 generation phase.
18662 @item -fdump-noaddr
18663 @opindex fdump-noaddr
18664 When doing debugging dumps, suppress address output.  This makes it more
18665 feasible to use diff on debugging dumps for compiler invocations with
18666 different compiler binaries and/or different
18667 text / bss / data / heap / stack / dso start locations.
18669 @item -freport-bug
18670 @opindex freport-bug
18671 Collect and dump debug information into a temporary file if an
18672 internal compiler error (ICE) occurs.
18674 @item -fdump-unnumbered
18675 @opindex fdump-unnumbered
18676 When doing debugging dumps, suppress instruction numbers and address output.
18677 This makes it more feasible to use diff on debugging dumps for compiler
18678 invocations with different options, in particular with and without
18679 @option{-g}.
18681 @item -fdump-unnumbered-links
18682 @opindex fdump-unnumbered-links
18683 When doing debugging dumps (see @option{-d} option above), suppress
18684 instruction numbers for the links to the previous and next instructions
18685 in a sequence.
18687 @item -fdump-ipa-@var{switch}
18688 @itemx -fdump-ipa-@var{switch}-@var{options}
18689 @opindex fdump-ipa
18690 Control the dumping at various stages of inter-procedural analysis
18691 language tree to a file.  The file name is generated by appending a
18692 switch specific suffix to the source file name, and the file is created
18693 in the same directory as the output file.  The following dumps are
18694 possible:
18696 @table @samp
18697 @item all
18698 Enables all inter-procedural analysis dumps.
18700 @item cgraph
18701 Dumps information about call-graph optimization, unused function removal,
18702 and inlining decisions.
18704 @item inline
18705 Dump after function inlining.
18707 @end table
18709 Additionally, the options @option{-optimized}, @option{-missed},
18710 @option{-note}, and @option{-all} can be provided, with the same meaning
18711 as for @option{-fopt-info}, defaulting to @option{-optimized}.
18713 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
18714 information on callsites that were inlined, along with callsites
18715 that were not inlined.
18717 By default, the dump will contain messages about successful
18718 optimizations (equivalent to @option{-optimized}) together with
18719 low-level details about the analysis.
18721 @item -fdump-lang
18722 @opindex fdump-lang
18723 Dump language-specific information.  The file name is made by appending
18724 @file{.lang} to the source file name.
18726 @item -fdump-lang-all
18727 @itemx -fdump-lang-@var{switch}
18728 @itemx -fdump-lang-@var{switch}-@var{options}
18729 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
18730 @opindex fdump-lang-all
18731 @opindex fdump-lang
18732 Control the dumping of language-specific information.  The @var{options}
18733 and @var{filename} portions behave as described in the
18734 @option{-fdump-tree} option.  The following @var{switch} values are
18735 accepted:
18737 @table @samp
18738 @item all
18740 Enable all language-specific dumps.
18742 @item class
18743 Dump class hierarchy information.  Virtual table information is emitted
18744 unless '@option{slim}' is specified.  This option is applicable to C++ only.
18746 @item module
18747 Dump module information.  Options @option{lineno} (locations),
18748 @option{graph} (reachability), @option{blocks} (clusters),
18749 @option{uid} (serialization), @option{alias} (mergeable),
18750 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
18751 (macros) may provide additional information.  This option is
18752 applicable to C++ only.
18754 @item raw
18755 Dump the raw internal tree data.  This option is applicable to C++ only.
18757 @end table
18759 @item -fdump-passes
18760 @opindex fdump-passes
18761 Print on @file{stderr} the list of optimization passes that are turned
18762 on and off by the current command-line options.
18764 @item -fdump-statistics-@var{option}
18765 @opindex fdump-statistics
18766 Enable and control dumping of pass statistics in a separate file.  The
18767 file name is generated by appending a suffix ending in
18768 @samp{.statistics} to the source file name, and the file is created in
18769 the same directory as the output file.  If the @samp{-@var{option}}
18770 form is used, @samp{-stats} causes counters to be summed over the
18771 whole compilation unit while @samp{-details} dumps every event as
18772 the passes generate them.  The default with no option is to sum
18773 counters for each function compiled.
18775 @item -fdump-tree-all
18776 @itemx -fdump-tree-@var{switch}
18777 @itemx -fdump-tree-@var{switch}-@var{options}
18778 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
18779 @opindex fdump-tree-all
18780 @opindex fdump-tree
18781 Control the dumping at various stages of processing the intermediate
18782 language tree to a file.  If the @samp{-@var{options}}
18783 form is used, @var{options} is a list of @samp{-} separated options
18784 which control the details of the dump.  Not all options are applicable
18785 to all dumps; those that are not meaningful are ignored.  The
18786 following options are available
18788 @table @samp
18789 @item address
18790 Print the address of each node.  Usually this is not meaningful as it
18791 changes according to the environment and source file.  Its primary use
18792 is for tying up a dump file with a debug environment.
18793 @item asmname
18794 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
18795 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
18796 use working backward from mangled names in the assembly file.
18797 @item slim
18798 When dumping front-end intermediate representations, inhibit dumping
18799 of members of a scope or body of a function merely because that scope
18800 has been reached.  Only dump such items when they are directly reachable
18801 by some other path.
18803 When dumping pretty-printed trees, this option inhibits dumping the
18804 bodies of control structures.
18806 When dumping RTL, print the RTL in slim (condensed) form instead of
18807 the default LISP-like representation.
18808 @item raw
18809 Print a raw representation of the tree.  By default, trees are
18810 pretty-printed into a C-like representation.
18811 @item details
18812 Enable more detailed dumps (not honored by every dump option). Also
18813 include information from the optimization passes.
18814 @item stats
18815 Enable dumping various statistics about the pass (not honored by every dump
18816 option).
18817 @item blocks
18818 Enable showing basic block boundaries (disabled in raw dumps).
18819 @item graph
18820 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
18821 dump a representation of the control flow graph suitable for viewing with
18822 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
18823 the file is pretty-printed as a subgraph, so that GraphViz can render them
18824 all in a single plot.
18826 This option currently only works for RTL dumps, and the RTL is always
18827 dumped in slim form.
18828 @item vops
18829 Enable showing virtual operands for every statement.
18830 @item lineno
18831 Enable showing line numbers for statements.
18832 @item uid
18833 Enable showing the unique ID (@code{DECL_UID}) for each variable.
18834 @item verbose
18835 Enable showing the tree dump for each statement.
18836 @item eh
18837 Enable showing the EH region number holding each statement.
18838 @item scev
18839 Enable showing scalar evolution analysis details.
18840 @item optimized
18841 Enable showing optimization information (only available in certain
18842 passes).
18843 @item missed
18844 Enable showing missed optimization information (only available in certain
18845 passes).
18846 @item note
18847 Enable other detailed optimization information (only available in
18848 certain passes).
18849 @item all
18850 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
18851 and @option{lineno}.
18852 @item optall
18853 Turn on all optimization options, i.e., @option{optimized},
18854 @option{missed}, and @option{note}.
18855 @end table
18857 To determine what tree dumps are available or find the dump for a pass
18858 of interest follow the steps below.
18860 @enumerate
18861 @item
18862 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
18863 look for a code that corresponds to the pass you are interested in.
18864 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
18865 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
18866 The number at the end distinguishes distinct invocations of the same pass.
18867 @item
18868 To enable the creation of the dump file, append the pass code to
18869 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
18870 to enable the dump from the Early Value Range Propagation pass, invoke
18871 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
18872 specify the name of the dump file.  If you don't specify one, GCC
18873 creates as described below.
18874 @item
18875 Find the pass dump in a file whose name is composed of three components
18876 separated by a period: the name of the source file GCC was invoked to
18877 compile, a numeric suffix indicating the pass number followed by the
18878 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
18879 and finally the pass code.  For example, the Early VRP pass dump might
18880 be in a file named @file{myfile.c.038t.evrp} in the current working
18881 directory.  Note that the numeric codes are not stable and may change
18882 from one version of GCC to another.
18883 @end enumerate
18885 @item -fopt-info
18886 @itemx -fopt-info-@var{options}
18887 @itemx -fopt-info-@var{options}=@var{filename}
18888 @opindex fopt-info
18889 Controls optimization dumps from various optimization passes. If the
18890 @samp{-@var{options}} form is used, @var{options} is a list of
18891 @samp{-} separated option keywords to select the dump details and
18892 optimizations.  
18894 The @var{options} can be divided into three groups:
18895 @enumerate
18896 @item
18897 options describing what kinds of messages should be emitted,
18898 @item
18899 options describing the verbosity of the dump, and
18900 @item
18901 options describing which optimizations should be included.
18902 @end enumerate
18903 The options from each group can be freely mixed as they are
18904 non-overlapping. However, in case of any conflicts,
18905 the later options override the earlier options on the command
18906 line. 
18908 The following options control which kinds of messages should be emitted:
18910 @table @samp
18911 @item optimized
18912 Print information when an optimization is successfully applied. It is
18913 up to a pass to decide which information is relevant. For example, the
18914 vectorizer passes print the source location of loops which are
18915 successfully vectorized.
18916 @item missed
18917 Print information about missed optimizations. Individual passes
18918 control which information to include in the output. 
18919 @item note
18920 Print verbose information about optimizations, such as certain
18921 transformations, more detailed messages about decisions etc.
18922 @item all
18923 Print detailed optimization information. This includes
18924 @samp{optimized}, @samp{missed}, and @samp{note}.
18925 @end table
18927 The following option controls the dump verbosity:
18929 @table @samp
18930 @item internals
18931 By default, only ``high-level'' messages are emitted. This option enables
18932 additional, more detailed, messages, which are likely to only be of interest
18933 to GCC developers.
18934 @end table
18936 One or more of the following option keywords can be used to describe a
18937 group of optimizations:
18939 @table @samp
18940 @item ipa
18941 Enable dumps from all interprocedural optimizations.
18942 @item loop
18943 Enable dumps from all loop optimizations.
18944 @item inline
18945 Enable dumps from all inlining optimizations.
18946 @item omp
18947 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
18948 @item vec
18949 Enable dumps from all vectorization optimizations.
18950 @item optall
18951 Enable dumps from all optimizations. This is a superset of
18952 the optimization groups listed above.
18953 @end table
18955 If @var{options} is
18956 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
18957 about successful optimizations from all the passes, omitting messages
18958 that are treated as ``internals''.
18960 If the @var{filename} is provided, then the dumps from all the
18961 applicable optimizations are concatenated into the @var{filename}.
18962 Otherwise the dump is output onto @file{stderr}. Though multiple
18963 @option{-fopt-info} options are accepted, only one of them can include
18964 a @var{filename}. If other filenames are provided then all but the
18965 first such option are ignored.
18967 Note that the output @var{filename} is overwritten
18968 in case of multiple translation units. If a combined output from
18969 multiple translation units is desired, @file{stderr} should be used
18970 instead.
18972 In the following example, the optimization info is output to
18973 @file{stderr}:
18975 @smallexample
18976 gcc -O3 -fopt-info
18977 @end smallexample
18979 This example:
18980 @smallexample
18981 gcc -O3 -fopt-info-missed=missed.all
18982 @end smallexample
18984 @noindent
18985 outputs missed optimization report from all the passes into
18986 @file{missed.all}, and this one:
18988 @smallexample
18989 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
18990 @end smallexample
18992 @noindent
18993 prints information about missed optimization opportunities from
18994 vectorization passes on @file{stderr}.  
18995 Note that @option{-fopt-info-vec-missed} is equivalent to 
18996 @option{-fopt-info-missed-vec}.  The order of the optimization group
18997 names and message types listed after @option{-fopt-info} does not matter.
18999 As another example,
19000 @smallexample
19001 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19002 @end smallexample
19004 @noindent
19005 outputs information about missed optimizations as well as
19006 optimized locations from all the inlining passes into
19007 @file{inline.txt}.
19009 Finally, consider:
19011 @smallexample
19012 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19013 @end smallexample
19015 @noindent
19016 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19017 in conflict since only one output file is allowed. In this case, only
19018 the first option takes effect and the subsequent options are
19019 ignored. Thus only @file{vec.miss} is produced which contains
19020 dumps from the vectorizer about missed opportunities.
19022 @item -fsave-optimization-record
19023 @opindex fsave-optimization-record
19024 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19025 were performed, for those optimizations that support @option{-fopt-info}.
19027 This option is experimental and the format of the data within the
19028 compressed JSON file is subject to change.
19030 It is roughly equivalent to a machine-readable version of
19031 @option{-fopt-info-all}, as a collection of messages with source file,
19032 line number and column number, with the following additional data for
19033 each message:
19035 @itemize @bullet
19037 @item
19038 the execution count of the code being optimized, along with metadata about
19039 whether this was from actual profile data, or just an estimate, allowing
19040 consumers to prioritize messages by code hotness,
19042 @item
19043 the function name of the code being optimized, where applicable,
19045 @item
19046 the ``inlining chain'' for the code being optimized, so that when
19047 a function is inlined into several different places (which might
19048 themselves be inlined), the reader can distinguish between the copies,
19050 @item
19051 objects identifying those parts of the message that refer to expressions,
19052 statements or symbol-table nodes, which of these categories they are, and,
19053 when available, their source code location,
19055 @item
19056 the GCC pass that emitted the message, and
19058 @item
19059 the location in GCC's own code from which the message was emitted
19061 @end itemize
19063 Additionally, some messages are logically nested within other
19064 messages, reflecting implementation details of the optimization
19065 passes.
19067 @item -fsched-verbose=@var{n}
19068 @opindex fsched-verbose
19069 On targets that use instruction scheduling, this option controls the
19070 amount of debugging output the scheduler prints to the dump files.
19072 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19073 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19074 For @var{n} greater than one, it also output basic block probabilities,
19075 detailed ready list information and unit/insn info.  For @var{n} greater
19076 than two, it includes RTL at abort point, control-flow and regions info.
19077 And for @var{n} over four, @option{-fsched-verbose} also includes
19078 dependence info.
19082 @item -fenable-@var{kind}-@var{pass}
19083 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
19084 @opindex fdisable-
19085 @opindex fenable-
19087 This is a set of options that are used to explicitly disable/enable
19088 optimization passes.  These options are intended for use for debugging GCC.
19089 Compiler users should use regular options for enabling/disabling
19090 passes instead.
19092 @table @gcctabopt
19094 @item -fdisable-ipa-@var{pass}
19095 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
19096 statically invoked in the compiler multiple times, the pass name should be
19097 appended with a sequential number starting from 1.
19099 @item -fdisable-rtl-@var{pass}
19100 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
19101 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19102 statically invoked in the compiler multiple times, the pass name should be
19103 appended with a sequential number starting from 1.  @var{range-list} is a 
19104 comma-separated list of function ranges or assembler names.  Each range is a number
19105 pair separated by a colon.  The range is inclusive in both ends.  If the range
19106 is trivial, the number pair can be simplified as a single number.  If the
19107 function's call graph node's @var{uid} falls within one of the specified ranges,
19108 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
19109 function header of a dump file, and the pass names can be dumped by using
19110 option @option{-fdump-passes}.
19112 @item -fdisable-tree-@var{pass}
19113 @itemx -fdisable-tree-@var{pass}=@var{range-list}
19114 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
19115 option arguments.
19117 @item -fenable-ipa-@var{pass}
19118 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19119 statically invoked in the compiler multiple times, the pass name should be
19120 appended with a sequential number starting from 1.
19122 @item -fenable-rtl-@var{pass}
19123 @itemx -fenable-rtl-@var{pass}=@var{range-list}
19124 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
19125 description and examples.
19127 @item -fenable-tree-@var{pass}
19128 @itemx -fenable-tree-@var{pass}=@var{range-list}
19129 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
19130 of option arguments.
19132 @end table
19134 Here are some examples showing uses of these options.
19136 @smallexample
19138 # disable ccp1 for all functions
19139    -fdisable-tree-ccp1
19140 # disable complete unroll for function whose cgraph node uid is 1
19141    -fenable-tree-cunroll=1
19142 # disable gcse2 for functions at the following ranges [1,1],
19143 # [300,400], and [400,1000]
19144 # disable gcse2 for functions foo and foo2
19145    -fdisable-rtl-gcse2=foo,foo2
19146 # disable early inlining
19147    -fdisable-tree-einline
19148 # disable ipa inlining
19149    -fdisable-ipa-inline
19150 # enable tree full unroll
19151    -fenable-tree-unroll
19153 @end smallexample
19155 @item -fchecking
19156 @itemx -fchecking=@var{n}
19157 @opindex fchecking
19158 @opindex fno-checking
19159 Enable internal consistency checking.  The default depends on
19160 the compiler configuration.  @option{-fchecking=2} enables further
19161 internal consistency checking that might affect code generation.
19163 @item -frandom-seed=@var{string}
19164 @opindex frandom-seed
19165 This option provides a seed that GCC uses in place of
19166 random numbers in generating certain symbol names
19167 that have to be different in every compiled file.  It is also used to
19168 place unique stamps in coverage data files and the object files that
19169 produce them.  You can use the @option{-frandom-seed} option to produce
19170 reproducibly identical object files.
19172 The @var{string} can either be a number (decimal, octal or hex) or an
19173 arbitrary string (in which case it's converted to a number by
19174 computing CRC32).
19176 The @var{string} should be different for every file you compile.
19178 @item -save-temps
19179 @opindex save-temps
19180 Store the usual ``temporary'' intermediate files permanently; name them
19181 as auxiliary output files, as specified described under
19182 @option{-dumpbase} and @option{-dumpdir}.
19184 When used in combination with the @option{-x} command-line option,
19185 @option{-save-temps} is sensible enough to avoid overwriting an
19186 input source file with the same extension as an intermediate file.
19187 The corresponding intermediate file may be obtained by renaming the
19188 source file before using @option{-save-temps}.
19190 @item -save-temps=cwd
19191 @opindex save-temps=cwd
19192 Equivalent to @option{-save-temps -dumpdir ./}.
19194 @item -save-temps=obj
19195 @opindex save-temps=obj
19196 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
19197 @file{outdir/} is the directory of the output file specified after the
19198 @option{-o} option, including any directory separators.  If the
19199 @option{-o} option is not used, the @option{-save-temps=obj} switch
19200 behaves like @option{-save-temps=cwd}.
19202 @item -time@r{[}=@var{file}@r{]}
19203 @opindex time
19204 Report the CPU time taken by each subprocess in the compilation
19205 sequence.  For C source files, this is the compiler proper and assembler
19206 (plus the linker if linking is done).
19208 Without the specification of an output file, the output looks like this:
19210 @smallexample
19211 # cc1 0.12 0.01
19212 # as 0.00 0.01
19213 @end smallexample
19215 The first number on each line is the ``user time'', that is time spent
19216 executing the program itself.  The second number is ``system time'',
19217 time spent executing operating system routines on behalf of the program.
19218 Both numbers are in seconds.
19220 With the specification of an output file, the output is appended to the
19221 named file, and it looks like this:
19223 @smallexample
19224 0.12 0.01 cc1 @var{options}
19225 0.00 0.01 as @var{options}
19226 @end smallexample
19228 The ``user time'' and the ``system time'' are moved before the program
19229 name, and the options passed to the program are displayed, so that one
19230 can later tell what file was being compiled, and with which options.
19232 @item -fdump-final-insns@r{[}=@var{file}@r{]}
19233 @opindex fdump-final-insns
19234 Dump the final internal representation (RTL) to @var{file}.  If the
19235 optional argument is omitted (or if @var{file} is @code{.}), the name
19236 of the dump file is determined by appending @code{.gkd} to the
19237 dump base name, see @option{-dumpbase}.
19239 @item -fcompare-debug@r{[}=@var{opts}@r{]}
19240 @opindex fcompare-debug
19241 @opindex fno-compare-debug
19242 If no error occurs during compilation, run the compiler a second time,
19243 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
19244 passed to the second compilation.  Dump the final internal
19245 representation in both compilations, and print an error if they differ.
19247 If the equal sign is omitted, the default @option{-gtoggle} is used.
19249 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
19250 and nonzero, implicitly enables @option{-fcompare-debug}.  If
19251 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
19252 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
19253 is used.
19255 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
19256 is equivalent to @option{-fno-compare-debug}, which disables the dumping
19257 of the final representation and the second compilation, preventing even
19258 @env{GCC_COMPARE_DEBUG} from taking effect.
19260 To verify full coverage during @option{-fcompare-debug} testing, set
19261 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
19262 which GCC rejects as an invalid option in any actual compilation
19263 (rather than preprocessing, assembly or linking).  To get just a
19264 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
19265 not overridden} will do.
19267 @item -fcompare-debug-second
19268 @opindex fcompare-debug-second
19269 This option is implicitly passed to the compiler for the second
19270 compilation requested by @option{-fcompare-debug}, along with options to
19271 silence warnings, and omitting other options that would cause the compiler
19272 to produce output to files or to standard output as a side effect.  Dump
19273 files and preserved temporary files are renamed so as to contain the
19274 @code{.gk} additional extension during the second compilation, to avoid
19275 overwriting those generated by the first.
19277 When this option is passed to the compiler driver, it causes the
19278 @emph{first} compilation to be skipped, which makes it useful for little
19279 other than debugging the compiler proper.
19281 @item -gtoggle
19282 @opindex gtoggle
19283 Turn off generation of debug info, if leaving out this option
19284 generates it, or turn it on at level 2 otherwise.  The position of this
19285 argument in the command line does not matter; it takes effect after all
19286 other options are processed, and it does so only once, no matter how
19287 many times it is given.  This is mainly intended to be used with
19288 @option{-fcompare-debug}.
19290 @item -fvar-tracking-assignments-toggle
19291 @opindex fvar-tracking-assignments-toggle
19292 @opindex fno-var-tracking-assignments-toggle
19293 Toggle @option{-fvar-tracking-assignments}, in the same way that
19294 @option{-gtoggle} toggles @option{-g}.
19296 @item -Q
19297 @opindex Q
19298 Makes the compiler print out each function name as it is compiled, and
19299 print some statistics about each pass when it finishes.
19301 @item -ftime-report
19302 @opindex ftime-report
19303 Makes the compiler print some statistics about the time consumed by each
19304 pass when it finishes.
19306 @item -ftime-report-details
19307 @opindex ftime-report-details
19308 Record the time consumed by infrastructure parts separately for each pass.
19310 @item -fira-verbose=@var{n}
19311 @opindex fira-verbose
19312 Control the verbosity of the dump file for the integrated register allocator.
19313 The default value is 5.  If the value @var{n} is greater or equal to 10,
19314 the dump output is sent to stderr using the same format as @var{n} minus 10.
19316 @item -flto-report
19317 @opindex flto-report
19318 Prints a report with internal details on the workings of the link-time
19319 optimizer.  The contents of this report vary from version to version.
19320 It is meant to be useful to GCC developers when processing object
19321 files in LTO mode (via @option{-flto}).
19323 Disabled by default.
19325 @item -flto-report-wpa
19326 @opindex flto-report-wpa
19327 Like @option{-flto-report}, but only print for the WPA phase of link-time
19328 optimization.
19330 @item -fmem-report
19331 @opindex fmem-report
19332 Makes the compiler print some statistics about permanent memory
19333 allocation when it finishes.
19335 @item -fmem-report-wpa
19336 @opindex fmem-report-wpa
19337 Makes the compiler print some statistics about permanent memory
19338 allocation for the WPA phase only.
19340 @item -fpre-ipa-mem-report
19341 @opindex fpre-ipa-mem-report
19342 @item -fpost-ipa-mem-report
19343 @opindex fpost-ipa-mem-report
19344 Makes the compiler print some statistics about permanent memory
19345 allocation before or after interprocedural optimization.
19347 @item -fprofile-report
19348 @opindex fprofile-report
19349 Makes the compiler print some statistics about consistency of the
19350 (estimated) profile and effect of individual passes.
19352 @item -fstack-usage
19353 @opindex fstack-usage
19354 Makes the compiler output stack usage information for the program, on a
19355 per-function basis.  The filename for the dump is made by appending
19356 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
19357 the output file, if explicitly specified and it is not an executable,
19358 otherwise it is the basename of the source file.  An entry is made up
19359 of three fields:
19361 @itemize
19362 @item
19363 The name of the function.
19364 @item
19365 A number of bytes.
19366 @item
19367 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
19368 @end itemize
19370 The qualifier @code{static} means that the function manipulates the stack
19371 statically: a fixed number of bytes are allocated for the frame on function
19372 entry and released on function exit; no stack adjustments are otherwise made
19373 in the function.  The second field is this fixed number of bytes.
19375 The qualifier @code{dynamic} means that the function manipulates the stack
19376 dynamically: in addition to the static allocation described above, stack
19377 adjustments are made in the body of the function, for example to push/pop
19378 arguments around function calls.  If the qualifier @code{bounded} is also
19379 present, the amount of these adjustments is bounded at compile time and
19380 the second field is an upper bound of the total amount of stack used by
19381 the function.  If it is not present, the amount of these adjustments is
19382 not bounded at compile time and the second field only represents the
19383 bounded part.
19385 @item -fstats
19386 @opindex fstats
19387 Emit statistics about front-end processing at the end of the compilation.
19388 This option is supported only by the C++ front end, and
19389 the information is generally only useful to the G++ development team.
19391 @item -fdbg-cnt-list
19392 @opindex fdbg-cnt-list
19393 Print the name and the counter upper bound for all debug counters.
19396 @item -fdbg-cnt=@var{counter-value-list}
19397 @opindex fdbg-cnt
19398 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
19399 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
19400 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
19401 the name of the counter and list of closed intervals.
19402 The @var{lower_bound} is optional and is zero
19403 initialized if not set.
19404 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
19405 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
19406 eleventh invocation.
19407 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
19409 @item -print-file-name=@var{library}
19410 @opindex print-file-name
19411 Print the full absolute name of the library file @var{library} that
19412 would be used when linking---and don't do anything else.  With this
19413 option, GCC does not compile or link anything; it just prints the
19414 file name.
19416 @item -print-multi-directory
19417 @opindex print-multi-directory
19418 Print the directory name corresponding to the multilib selected by any
19419 other switches present in the command line.  This directory is supposed
19420 to exist in @env{GCC_EXEC_PREFIX}.
19422 @item -print-multi-lib
19423 @opindex print-multi-lib
19424 Print the mapping from multilib directory names to compiler switches
19425 that enable them.  The directory name is separated from the switches by
19426 @samp{;}, and each switch starts with an @samp{@@} instead of the
19427 @samp{-}, without spaces between multiple switches.  This is supposed to
19428 ease shell processing.
19430 @item -print-multi-os-directory
19431 @opindex print-multi-os-directory
19432 Print the path to OS libraries for the selected
19433 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
19434 present in the @file{lib} subdirectory and no multilibs are used, this is
19435 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
19436 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
19437 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
19438 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
19440 @item -print-multiarch
19441 @opindex print-multiarch
19442 Print the path to OS libraries for the selected multiarch,
19443 relative to some @file{lib} subdirectory.
19445 @item -print-prog-name=@var{program}
19446 @opindex print-prog-name
19447 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
19449 @item -print-libgcc-file-name
19450 @opindex print-libgcc-file-name
19451 Same as @option{-print-file-name=libgcc.a}.
19453 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
19454 but you do want to link with @file{libgcc.a}.  You can do:
19456 @smallexample
19457 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
19458 @end smallexample
19460 @item -print-search-dirs
19461 @opindex print-search-dirs
19462 Print the name of the configured installation directory and a list of
19463 program and library directories @command{gcc} searches---and don't do anything else.
19465 This is useful when @command{gcc} prints the error message
19466 @samp{installation problem, cannot exec cpp0: No such file or directory}.
19467 To resolve this you either need to put @file{cpp0} and the other compiler
19468 components where @command{gcc} expects to find them, or you can set the environment
19469 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
19470 Don't forget the trailing @samp{/}.
19471 @xref{Environment Variables}.
19473 @item -print-sysroot
19474 @opindex print-sysroot
19475 Print the target sysroot directory that is used during
19476 compilation.  This is the target sysroot specified either at configure
19477 time or using the @option{--sysroot} option, possibly with an extra
19478 suffix that depends on compilation options.  If no target sysroot is
19479 specified, the option prints nothing.
19481 @item -print-sysroot-headers-suffix
19482 @opindex print-sysroot-headers-suffix
19483 Print the suffix added to the target sysroot when searching for
19484 headers, or give an error if the compiler is not configured with such
19485 a suffix---and don't do anything else.
19487 @item -dumpmachine
19488 @opindex dumpmachine
19489 Print the compiler's target machine (for example,
19490 @samp{i686-pc-linux-gnu})---and don't do anything else.
19492 @item -dumpversion
19493 @opindex dumpversion
19494 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
19495 anything else.  This is the compiler version used in filesystem paths and
19496 specs. Depending on how the compiler has been configured it can be just
19497 a single number (major version), two numbers separated by a dot (major and
19498 minor version) or three numbers separated by dots (major, minor and patchlevel
19499 version).
19501 @item -dumpfullversion
19502 @opindex dumpfullversion
19503 Print the full compiler version---and don't do anything else. The output is
19504 always three numbers separated by dots, major, minor and patchlevel version.
19506 @item -dumpspecs
19507 @opindex dumpspecs
19508 Print the compiler's built-in specs---and don't do anything else.  (This
19509 is used when GCC itself is being built.)  @xref{Spec Files}.
19510 @end table
19512 @node Submodel Options
19513 @section Machine-Dependent Options
19514 @cindex submodel options
19515 @cindex specifying hardware config
19516 @cindex hardware models and configurations, specifying
19517 @cindex target-dependent options
19518 @cindex machine-dependent options
19520 Each target machine supported by GCC can have its own options---for
19521 example, to allow you to compile for a particular processor variant or
19522 ABI, or to control optimizations specific to that machine.  By
19523 convention, the names of machine-specific options start with
19524 @samp{-m}.
19526 Some configurations of the compiler also support additional target-specific
19527 options, usually for compatibility with other compilers on the same
19528 platform.
19530 @c This list is ordered alphanumerically by subsection name.
19531 @c It should be the same order and spelling as these options are listed
19532 @c in Machine Dependent Options
19534 @menu
19535 * AArch64 Options::
19536 * Adapteva Epiphany Options::
19537 * AMD GCN Options::
19538 * ARC Options::
19539 * ARM Options::
19540 * AVR Options::
19541 * Blackfin Options::
19542 * C6X Options::
19543 * CRIS Options::
19544 * C-SKY Options::
19545 * Darwin Options::
19546 * DEC Alpha Options::
19547 * eBPF Options::
19548 * FR30 Options::
19549 * FT32 Options::
19550 * FRV Options::
19551 * GNU/Linux Options::
19552 * H8/300 Options::
19553 * HPPA Options::
19554 * IA-64 Options::
19555 * LM32 Options::
19556 * LoongArch Options::
19557 * M32C Options::
19558 * M32R/D Options::
19559 * M680x0 Options::
19560 * MCore Options::
19561 * MeP Options::
19562 * MicroBlaze Options::
19563 * MIPS Options::
19564 * MMIX Options::
19565 * MN10300 Options::
19566 * Moxie Options::
19567 * MSP430 Options::
19568 * NDS32 Options::
19569 * Nios II Options::
19570 * Nvidia PTX Options::
19571 * OpenRISC Options::
19572 * PDP-11 Options::
19573 * picoChip Options::
19574 * PowerPC Options::
19575 * PRU Options::
19576 * RISC-V Options::
19577 * RL78 Options::
19578 * RS/6000 and PowerPC Options::
19579 * RX Options::
19580 * S/390 and zSeries Options::
19581 * Score Options::
19582 * SH Options::
19583 * Solaris 2 Options::
19584 * SPARC Options::
19585 * System V Options::
19586 * V850 Options::
19587 * VAX Options::
19588 * Visium Options::
19589 * VMS Options::
19590 * VxWorks Options::
19591 * x86 Options::
19592 * x86 Windows Options::
19593 * Xstormy16 Options::
19594 * Xtensa Options::
19595 * zSeries Options::
19596 @end menu
19598 @node AArch64 Options
19599 @subsection AArch64 Options
19600 @cindex AArch64 Options
19602 These options are defined for AArch64 implementations:
19604 @table @gcctabopt
19606 @item -mabi=@var{name}
19607 @opindex mabi
19608 Generate code for the specified data model.  Permissible values
19609 are @samp{ilp32} for SysV-like data model where int, long int and pointers
19610 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
19611 but long int and pointers are 64 bits.
19613 The default depends on the specific target configuration.  Note that
19614 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
19615 entire program with the same ABI, and link with a compatible set of libraries.
19617 @item -mbig-endian
19618 @opindex mbig-endian
19619 Generate big-endian code.  This is the default when GCC is configured for an
19620 @samp{aarch64_be-*-*} target.
19622 @item -mgeneral-regs-only
19623 @opindex mgeneral-regs-only
19624 Generate code which uses only the general-purpose registers.  This will prevent
19625 the compiler from using floating-point and Advanced SIMD registers but will not
19626 impose any restrictions on the assembler.
19628 @item -mlittle-endian
19629 @opindex mlittle-endian
19630 Generate little-endian code.  This is the default when GCC is configured for an
19631 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
19633 @item -mcmodel=tiny
19634 @opindex mcmodel=tiny
19635 Generate code for the tiny code model.  The program and its statically defined
19636 symbols must be within 1MB of each other.  Programs can be statically or
19637 dynamically linked.
19639 @item -mcmodel=small
19640 @opindex mcmodel=small
19641 Generate code for the small code model.  The program and its statically defined
19642 symbols must be within 4GB of each other.  Programs can be statically or
19643 dynamically linked.  This is the default code model.
19645 @item -mcmodel=large
19646 @opindex mcmodel=large
19647 Generate code for the large code model.  This makes no assumptions about
19648 addresses and sizes of sections.  Programs can be statically linked only.  The
19649 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
19650 @option{-fpic} and @option{-fPIC}.
19652 @item -mstrict-align
19653 @itemx -mno-strict-align
19654 @opindex mstrict-align
19655 @opindex mno-strict-align
19656 Avoid or allow generating memory accesses that may not be aligned on a natural
19657 object boundary as described in the architecture specification.
19659 @item -momit-leaf-frame-pointer
19660 @itemx -mno-omit-leaf-frame-pointer
19661 @opindex momit-leaf-frame-pointer
19662 @opindex mno-omit-leaf-frame-pointer
19663 Omit or keep the frame pointer in leaf functions.  The former behavior is the
19664 default.
19666 @item -mstack-protector-guard=@var{guard}
19667 @itemx -mstack-protector-guard-reg=@var{reg}
19668 @itemx -mstack-protector-guard-offset=@var{offset}
19669 @opindex mstack-protector-guard
19670 @opindex mstack-protector-guard-reg
19671 @opindex mstack-protector-guard-offset
19672 Generate stack protection code using canary at @var{guard}.  Supported
19673 locations are @samp{global} for a global canary or @samp{sysreg} for a
19674 canary in an appropriate system register.
19676 With the latter choice the options
19677 @option{-mstack-protector-guard-reg=@var{reg}} and
19678 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
19679 which system register to use as base register for reading the canary,
19680 and from what offset from that base register. There is no default
19681 register or offset as this is entirely for use within the Linux
19682 kernel.
19684 @item -mtls-dialect=desc
19685 @opindex mtls-dialect=desc
19686 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
19687 of TLS variables.  This is the default.
19689 @item -mtls-dialect=traditional
19690 @opindex mtls-dialect=traditional
19691 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
19692 of TLS variables.
19694 @item -mtls-size=@var{size}
19695 @opindex mtls-size
19696 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
19697 This option requires binutils 2.26 or newer.
19699 @item -mfix-cortex-a53-835769
19700 @itemx -mno-fix-cortex-a53-835769
19701 @opindex mfix-cortex-a53-835769
19702 @opindex mno-fix-cortex-a53-835769
19703 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
19704 This involves inserting a NOP instruction between memory instructions and
19705 64-bit integer multiply-accumulate instructions.
19707 @item -mfix-cortex-a53-843419
19708 @itemx -mno-fix-cortex-a53-843419
19709 @opindex mfix-cortex-a53-843419
19710 @opindex mno-fix-cortex-a53-843419
19711 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
19712 This erratum workaround is made at link time and this will only pass the
19713 corresponding flag to the linker.
19715 @item -mlow-precision-recip-sqrt
19716 @itemx -mno-low-precision-recip-sqrt
19717 @opindex mlow-precision-recip-sqrt
19718 @opindex mno-low-precision-recip-sqrt
19719 Enable or disable the reciprocal square root approximation.
19720 This option only has an effect if @option{-ffast-math} or
19721 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
19722 precision of reciprocal square root results to about 16 bits for
19723 single precision and to 32 bits for double precision.
19725 @item -mlow-precision-sqrt
19726 @itemx -mno-low-precision-sqrt
19727 @opindex mlow-precision-sqrt
19728 @opindex mno-low-precision-sqrt
19729 Enable or disable the square root approximation.
19730 This option only has an effect if @option{-ffast-math} or
19731 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
19732 precision of square root results to about 16 bits for
19733 single precision and to 32 bits for double precision.
19734 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
19736 @item -mlow-precision-div
19737 @itemx -mno-low-precision-div
19738 @opindex mlow-precision-div
19739 @opindex mno-low-precision-div
19740 Enable or disable the division approximation.
19741 This option only has an effect if @option{-ffast-math} or
19742 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
19743 precision of division results to about 16 bits for
19744 single precision and to 32 bits for double precision.
19746 @item -mtrack-speculation
19747 @itemx -mno-track-speculation
19748 Enable or disable generation of additional code to track speculative
19749 execution through conditional branches.  The tracking state can then
19750 be used by the compiler when expanding calls to
19751 @code{__builtin_speculation_safe_copy} to permit a more efficient code
19752 sequence to be generated.
19754 @item -moutline-atomics
19755 @itemx -mno-outline-atomics
19756 Enable or disable calls to out-of-line helpers to implement atomic operations.
19757 These helpers will, at runtime, determine if the LSE instructions from
19758 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
19759 instructions that are present in the base ARMv8.0 ISA.
19761 This option is only applicable when compiling for the base ARMv8.0
19762 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
19763 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
19764 used directly.  The same applies when using @option{-mcpu=} when the
19765 selected cpu supports the @samp{lse} feature.
19766 This option is on by default.
19768 @item -march=@var{name}
19769 @opindex march
19770 Specify the name of the target architecture and, optionally, one or
19771 more feature modifiers.  This option has the form
19772 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
19774 The table below summarizes the permissible values for @var{arch}
19775 and the features that they enable by default:
19777 @multitable @columnfractions 0.20 0.20 0.60
19778 @headitem @var{arch} value @tab Architecture @tab Includes by default
19779 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
19780 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
19781 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
19782 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
19783 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
19784 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
19785 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
19786 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
19787 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
19788 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
19789 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
19790 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
19791 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
19792 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
19793 @end multitable
19795 The value @samp{native} is available on native AArch64 GNU/Linux and
19796 causes the compiler to pick the architecture of the host system.  This
19797 option has no effect if the compiler is unable to recognize the
19798 architecture of the host system,
19800 The permissible values for @var{feature} are listed in the sub-section
19801 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
19802 Feature Modifiers}.  Where conflicting feature modifiers are
19803 specified, the right-most feature is used.
19805 GCC uses @var{name} to determine what kind of instructions it can emit
19806 when generating assembly code.  If @option{-march} is specified
19807 without either of @option{-mtune} or @option{-mcpu} also being
19808 specified, the code is tuned to perform well across a range of target
19809 processors implementing the target architecture.
19811 @item -mtune=@var{name}
19812 @opindex mtune
19813 Specify the name of the target processor for which GCC should tune the
19814 performance of the code.  Permissible values for this option are:
19815 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
19816 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
19817 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
19818 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
19819 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
19820 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
19821 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
19822 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
19823 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
19824 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
19825 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
19826 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
19827 @samp{octeontx2f95mm},
19828 @samp{a64fx},
19829 @samp{thunderx}, @samp{thunderxt88},
19830 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
19831 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
19832 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
19833 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
19834 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
19835 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x2},
19836 @samp{cortex-a510}, @samp{cortex-a710}, @samp{ampere1}, @samp{native}.
19838 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
19839 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
19840 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
19841 should tune for a big.LITTLE system.
19843 The value @samp{neoverse-512tvb} specifies that GCC should tune
19844 for Neoverse cores that (a) implement SVE and (b) have a total vector
19845 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
19846 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
19847 instructions a cycle and that can execute an equivalent number of SVE
19848 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
19849 This is more general than tuning for a specific core like Neoverse V1
19850 but is more specific than the default tuning described below.
19852 Additionally on native AArch64 GNU/Linux systems the value
19853 @samp{native} tunes performance to the host system.  This option has no effect
19854 if the compiler is unable to recognize the processor of the host system.
19856 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
19857 are specified, the code is tuned to perform well across a range
19858 of target processors.
19860 This option cannot be suffixed by feature modifiers.
19862 @item -mcpu=@var{name}
19863 @opindex mcpu
19864 Specify the name of the target processor, optionally suffixed by one
19865 or more feature modifiers.  This option has the form
19866 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
19867 the permissible values for @var{cpu} are the same as those available
19868 for @option{-mtune}.  The permissible values for @var{feature} are
19869 documented in the sub-section on
19870 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
19871 Feature Modifiers}.  Where conflicting feature modifiers are
19872 specified, the right-most feature is used.
19874 GCC uses @var{name} to determine what kind of instructions it can emit when
19875 generating assembly code (as if by @option{-march}) and to determine
19876 the target processor for which to tune for performance (as if
19877 by @option{-mtune}).  Where this option is used in conjunction
19878 with @option{-march} or @option{-mtune}, those options take precedence
19879 over the appropriate part of this option.
19881 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
19882 to a specific core, but instead refers to all Neoverse cores that
19883 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
19884 a cycle.  Unless overridden by @option{-march},
19885 @option{-mcpu=neoverse-512tvb} generates code that can run on a
19886 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
19887 these properties.  Unless overridden by @option{-mtune},
19888 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
19889 @option{-mtune=neoverse-512tvb}.
19891 @item -moverride=@var{string}
19892 @opindex moverride
19893 Override tuning decisions made by the back-end in response to a
19894 @option{-mtune=} switch.  The syntax, semantics, and accepted values
19895 for @var{string} in this option are not guaranteed to be consistent
19896 across releases.
19898 This option is only intended to be useful when developing GCC.
19900 @item -mverbose-cost-dump
19901 @opindex mverbose-cost-dump
19902 Enable verbose cost model dumping in the debug dump files.  This option is
19903 provided for use in debugging the compiler.
19905 @item -mpc-relative-literal-loads
19906 @itemx -mno-pc-relative-literal-loads
19907 @opindex mpc-relative-literal-loads
19908 @opindex mno-pc-relative-literal-loads
19909 Enable or disable PC-relative literal loads.  With this option literal pools are
19910 accessed using a single instruction and emitted after each function.  This
19911 limits the maximum size of functions to 1MB.  This is enabled by default for
19912 @option{-mcmodel=tiny}.
19914 @item -msign-return-address=@var{scope}
19915 @opindex msign-return-address
19916 Select the function scope on which return address signing will be applied.
19917 Permissible values are @samp{none}, which disables return address signing,
19918 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
19919 functions, and @samp{all}, which enables pointer signing for all functions.  The
19920 default value is @samp{none}. This option has been deprecated by
19921 -mbranch-protection.
19923 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
19924 @opindex mbranch-protection
19925 Select the branch protection features to use.
19926 @samp{none} is the default and turns off all types of branch protection.
19927 @samp{standard} turns on all types of branch protection features.  If a feature
19928 has additional tuning options, then @samp{standard} sets it to its standard
19929 level.
19930 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
19931 level: signing functions that save the return address to memory (non-leaf
19932 functions will practically always do this) using the a-key.  The optional
19933 argument @samp{leaf} can be used to extend the signing to include leaf
19934 functions.  The optional argument @samp{b-key} can be used to sign the functions
19935 with the B-key instead of the A-key.
19936 @samp{bti} turns on branch target identification mechanism.
19938 @item -mharden-sls=@var{opts}
19939 @opindex mharden-sls
19940 Enable compiler hardening against straight line speculation (SLS).
19941 @var{opts} is a comma-separated list of the following options:
19942 @table @samp
19943 @item retbr
19944 @item blr
19945 @end table
19946 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
19947 @samp{-mharden-sls=none} disables all SLS hardening.
19949 @item -msve-vector-bits=@var{bits}
19950 @opindex msve-vector-bits
19951 Specify the number of bits in an SVE vector register.  This option only has
19952 an effect when SVE is enabled.
19954 GCC supports two forms of SVE code generation: ``vector-length
19955 agnostic'' output that works with any size of vector register and
19956 ``vector-length specific'' output that allows GCC to make assumptions
19957 about the vector length when it is useful for optimization reasons.
19958 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
19959 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
19960 Specifying @samp{scalable} selects vector-length agnostic
19961 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
19962 agnostic output for big-endian targets.  All other values generate
19963 vector-length specific code.  The behavior of these values may change
19964 in future releases and no value except @samp{scalable} should be
19965 relied on for producing code that is portable across different
19966 hardware SVE vector lengths.
19968 The default is @samp{-msve-vector-bits=scalable}, which produces
19969 vector-length agnostic code.
19970 @end table
19972 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
19973 @anchor{aarch64-feature-modifiers}
19974 @cindex @option{-march} feature modifiers
19975 @cindex @option{-mcpu} feature modifiers
19976 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
19977 the following and their inverses @option{no@var{feature}}:
19979 @table @samp
19980 @item crc
19981 Enable CRC extension.  This is on by default for
19982 @option{-march=armv8.1-a}.
19983 @item crypto
19984 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
19985 instructions.
19986 @item fp
19987 Enable floating-point instructions.  This is on by default for all possible
19988 values for options @option{-march} and @option{-mcpu}.
19989 @item simd
19990 Enable Advanced SIMD instructions.  This also enables floating-point
19991 instructions.  This is on by default for all possible values for options
19992 @option{-march} and @option{-mcpu}.
19993 @item sve
19994 Enable Scalable Vector Extension instructions.  This also enables Advanced
19995 SIMD and floating-point instructions.
19996 @item lse
19997 Enable Large System Extension instructions.  This is on by default for
19998 @option{-march=armv8.1-a}.
19999 @item rdma
20000 Enable Round Double Multiply Accumulate instructions.  This is on by default
20001 for @option{-march=armv8.1-a}.
20002 @item fp16
20003 Enable FP16 extension.  This also enables floating-point instructions.
20004 @item fp16fml
20005 Enable FP16 fmla extension.  This also enables FP16 extensions and
20006 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.
20008 @item rcpc
20009 Enable the RcPc extension.  This does not change code generation from GCC,
20010 but is passed on to the assembler, enabling inline asm statements to use
20011 instructions from the RcPc extension.
20012 @item dotprod
20013 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
20014 @item aes
20015 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
20016 SIMD instructions.
20017 @item sha2
20018 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
20019 @item sha3
20020 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
20021 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20022 @item sm4
20023 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
20024 Use of this option with architectures prior to Armv8.2-A is not supported.
20025 @item profile
20026 Enable the Statistical Profiling extension.  This option is only to enable the
20027 extension at the assembler level and does not affect code generation.
20028 @item rng
20029 Enable the Armv8.5-a Random Number instructions.  This option is only to
20030 enable the extension at the assembler level and does not affect code
20031 generation.
20032 @item memtag
20033 Enable the Armv8.5-a Memory Tagging Extensions.
20034 Use of this option with architectures prior to Armv8.5-A is not supported.
20035 @item sb
20036 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
20037 enable the extension at the assembler level and does not affect code
20038 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20039 @item ssbs
20040 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
20041 is only to enable the extension at the assembler level and does not affect code
20042 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20043 @item predres
20044 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
20045 This option is only to enable the extension at the assembler level and does
20046 not affect code generation.  This option is enabled by default for
20047 @option{-march=armv8.5-a}.
20048 @item sve2
20049 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
20050 instructions.
20051 @item sve2-bitperm
20052 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
20053 @item sve2-sm4
20054 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
20055 @item sve2-aes
20056 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
20057 @item sve2-sha3
20058 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
20059 @item tme
20060 Enable the Transactional Memory Extension.
20061 @item i8mm
20062 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
20063 Advanced SIMD and floating-point instructions.  This option is enabled by
20064 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20065 prior to Armv8.2-A is not supported.
20066 @item f32mm
20067 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
20068 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20069 not supported.
20070 @item f64mm
20071 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
20072 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20073 not supported.
20074 @item bf16
20075 Enable brain half-precision floating-point instructions.  This also enables
20076 Advanced SIMD and floating-point instructions.  This option is enabled by
20077 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20078 prior to Armv8.2-A is not supported.
20079 @item ls64
20080 Enable the 64-byte atomic load and store instructions for accelerators.
20081 This option is enabled by default for @option{-march=armv8.7-a}.
20082 @item mops
20083 Enable the instructions to accelerate memory operations like @code{memcpy},
20084 @code{memmove}, @code{memset}.  This option is enabled by default for
20085 @option{-march=armv8.8-a}
20086 @item flagm
20087 Enable the Flag Manipulation instructions Extension.
20088 @item pauth
20089 Enable the Pointer Authentication Extension.
20091 @end table
20093 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
20094 which implies @option{fp}.
20095 Conversely, @option{nofp} implies @option{nosimd}, which implies
20096 @option{nocrypto}, @option{noaes} and @option{nosha2}.
20098 @node Adapteva Epiphany Options
20099 @subsection Adapteva Epiphany Options
20101 These @samp{-m} options are defined for Adapteva Epiphany:
20103 @table @gcctabopt
20104 @item -mhalf-reg-file
20105 @opindex mhalf-reg-file
20106 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
20107 That allows code to run on hardware variants that lack these registers.
20109 @item -mprefer-short-insn-regs
20110 @opindex mprefer-short-insn-regs
20111 Preferentially allocate registers that allow short instruction generation.
20112 This can result in increased instruction count, so this may either reduce or
20113 increase overall code size.
20115 @item -mbranch-cost=@var{num}
20116 @opindex mbranch-cost
20117 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20118 This cost is only a heuristic and is not guaranteed to produce
20119 consistent results across releases.
20121 @item -mcmove
20122 @opindex mcmove
20123 Enable the generation of conditional moves.
20125 @item -mnops=@var{num}
20126 @opindex mnops
20127 Emit @var{num} NOPs before every other generated instruction.
20129 @item -mno-soft-cmpsf
20130 @opindex mno-soft-cmpsf
20131 @opindex msoft-cmpsf
20132 For single-precision floating-point comparisons, emit an @code{fsub} instruction
20133 and test the flags.  This is faster than a software comparison, but can
20134 get incorrect results in the presence of NaNs, or when two different small
20135 numbers are compared such that their difference is calculated as zero.
20136 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
20137 software comparisons.
20139 @item -mstack-offset=@var{num}
20140 @opindex mstack-offset
20141 Set the offset between the top of the stack and the stack pointer.
20142 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
20143 can be used by leaf functions without stack allocation.
20144 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
20145 Note also that this option changes the ABI; compiling a program with a
20146 different stack offset than the libraries have been compiled with
20147 generally does not work.
20148 This option can be useful if you want to evaluate if a different stack
20149 offset would give you better code, but to actually use a different stack
20150 offset to build working programs, it is recommended to configure the
20151 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
20153 @item -mno-round-nearest
20154 @opindex mno-round-nearest
20155 @opindex mround-nearest
20156 Make the scheduler assume that the rounding mode has been set to
20157 truncating.  The default is @option{-mround-nearest}.
20159 @item -mlong-calls
20160 @opindex mlong-calls
20161 If not otherwise specified by an attribute, assume all calls might be beyond
20162 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
20163 function address into a register before performing a (otherwise direct) call.
20164 This is the default.
20166 @item -mshort-calls
20167 @opindex short-calls
20168 If not otherwise specified by an attribute, assume all direct calls are
20169 in the range of the @code{b} / @code{bl} instructions, so use these instructions
20170 for direct calls.  The default is @option{-mlong-calls}.
20172 @item -msmall16
20173 @opindex msmall16
20174 Assume addresses can be loaded as 16-bit unsigned values.  This does not
20175 apply to function addresses for which @option{-mlong-calls} semantics
20176 are in effect.
20178 @item -mfp-mode=@var{mode}
20179 @opindex mfp-mode
20180 Set the prevailing mode of the floating-point unit.
20181 This determines the floating-point mode that is provided and expected
20182 at function call and return time.  Making this mode match the mode you
20183 predominantly need at function start can make your programs smaller and
20184 faster by avoiding unnecessary mode switches.
20186 @var{mode} can be set to one the following values:
20188 @table @samp
20189 @item caller
20190 Any mode at function entry is valid, and retained or restored when
20191 the function returns, and when it calls other functions.
20192 This mode is useful for compiling libraries or other compilation units
20193 you might want to incorporate into different programs with different
20194 prevailing FPU modes, and the convenience of being able to use a single
20195 object file outweighs the size and speed overhead for any extra
20196 mode switching that might be needed, compared with what would be needed
20197 with a more specific choice of prevailing FPU mode.
20199 @item truncate
20200 This is the mode used for floating-point calculations with
20201 truncating (i.e.@: round towards zero) rounding mode.  That includes
20202 conversion from floating point to integer.
20204 @item round-nearest
20205 This is the mode used for floating-point calculations with
20206 round-to-nearest-or-even rounding mode.
20208 @item int
20209 This is the mode used to perform integer calculations in the FPU, e.g.@:
20210 integer multiply, or integer multiply-and-accumulate.
20211 @end table
20213 The default is @option{-mfp-mode=caller}
20215 @item -mno-split-lohi
20216 @itemx -mno-postinc
20217 @itemx -mno-postmodify
20218 @opindex mno-split-lohi
20219 @opindex msplit-lohi
20220 @opindex mno-postinc
20221 @opindex mpostinc
20222 @opindex mno-postmodify
20223 @opindex mpostmodify
20224 Code generation tweaks that disable, respectively, splitting of 32-bit
20225 loads, generation of post-increment addresses, and generation of
20226 post-modify addresses.  The defaults are @option{msplit-lohi},
20227 @option{-mpost-inc}, and @option{-mpost-modify}.
20229 @item -mnovect-double
20230 @opindex mno-vect-double
20231 @opindex mvect-double
20232 Change the preferred SIMD mode to SImode.  The default is
20233 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
20235 @item -max-vect-align=@var{num}
20236 @opindex max-vect-align
20237 The maximum alignment for SIMD vector mode types.
20238 @var{num} may be 4 or 8.  The default is 8.
20239 Note that this is an ABI change, even though many library function
20240 interfaces are unaffected if they don't use SIMD vector modes
20241 in places that affect size and/or alignment of relevant types.
20243 @item -msplit-vecmove-early
20244 @opindex msplit-vecmove-early
20245 Split vector moves into single word moves before reload.  In theory this
20246 can give better register allocation, but so far the reverse seems to be
20247 generally the case.
20249 @item -m1reg-@var{reg}
20250 @opindex m1reg-
20251 Specify a register to hold the constant @minus{}1, which makes loading small negative
20252 constants and certain bitmasks faster.
20253 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
20254 which specify use of that register as a fixed register,
20255 and @samp{none}, which means that no register is used for this
20256 purpose.  The default is @option{-m1reg-none}.
20258 @end table
20260 @node AMD GCN Options
20261 @subsection AMD GCN Options
20262 @cindex AMD GCN Options
20264 These options are defined specifically for the AMD GCN port.
20266 @table @gcctabopt
20268 @item -march=@var{gpu}
20269 @opindex march
20270 @itemx -mtune=@var{gpu}
20271 @opindex mtune
20272 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
20275 @table @samp
20276 @item fiji
20277 Compile for GCN3 Fiji devices (gfx803).
20279 @item gfx900
20280 Compile for GCN5 Vega 10 devices (gfx900).
20282 @item gfx906
20283 Compile for GCN5 Vega 20 devices (gfx906).
20285 @item gfx908
20286 Compile for CDNA1 Instinct MI100 series devices (gfx908).
20288 @item gfx90a
20289 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
20291 @end table
20293 @item -msram-ecc=on
20294 @itemx -msram-ecc=off
20295 @itemx -msram-ecc=any
20296 @opindex msram-ecc
20297 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
20298 disabled, or either mode.  This feature can be enabled per-process on some
20299 devices.  The compiled code must match the device mode. The default is
20300 @samp{any}, for devices that support it.
20302 @item -mstack-size=@var{bytes}
20303 @opindex mstack-size
20304 Specify how many @var{bytes} of stack space will be requested for each GPU
20305 thread (wave-front).  Beware that there may be many threads and limited memory
20306 available.  The size of the stack allocation may also have an impact on
20307 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
20308 1MB otherwise.
20310 @item -mxnack
20311 @opindex mxnack
20312 Compile binaries suitable for devices with the XNACK feature enabled.  Some
20313 devices always require XNACK and some allow the user to configure XNACK.  The
20314 compiled code must match the device mode.  The default is @samp{-mno-xnack}.
20315 At present this option is a placeholder for support that is not yet
20316 implemented.
20318 @end table
20320 @node ARC Options
20321 @subsection ARC Options
20322 @cindex ARC options
20324 The following options control the architecture variant for which code
20325 is being compiled:
20327 @c architecture variants
20328 @table @gcctabopt
20330 @item -mbarrel-shifter
20331 @opindex mbarrel-shifter
20332 Generate instructions supported by barrel shifter.  This is the default
20333 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
20335 @item -mjli-always
20336 @opindex mjli-always
20337 Force to call a function using jli_s instruction.  This option is
20338 valid only for ARCv2 architecture.
20340 @item -mcpu=@var{cpu}
20341 @opindex mcpu
20342 Set architecture type, register usage, and instruction scheduling
20343 parameters for @var{cpu}.  There are also shortcut alias options
20344 available for backward compatibility and convenience.  Supported
20345 values for @var{cpu} are
20347 @table @samp
20348 @opindex mA6
20349 @opindex mARC600
20350 @item arc600
20351 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
20353 @item arc601
20354 @opindex mARC601
20355 Compile for ARC601.  Alias: @option{-mARC601}.
20357 @item arc700
20358 @opindex mA7
20359 @opindex mARC700
20360 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
20361 This is the default when configured with @option{--with-cpu=arc700}@.
20363 @item arcem
20364 Compile for ARC EM.
20366 @item archs
20367 Compile for ARC HS.
20369 @item em
20370 Compile for ARC EM CPU with no hardware extensions.
20372 @item em4
20373 Compile for ARC EM4 CPU.
20375 @item em4_dmips
20376 Compile for ARC EM4 DMIPS CPU.
20378 @item em4_fpus
20379 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
20380 extension.
20382 @item em4_fpuda
20383 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
20384 double assist instructions.
20386 @item hs
20387 Compile for ARC HS CPU with no hardware extensions except the atomic
20388 instructions.
20390 @item hs34
20391 Compile for ARC HS34 CPU.
20393 @item hs38
20394 Compile for ARC HS38 CPU.
20396 @item hs38_linux
20397 Compile for ARC HS38 CPU with all hardware extensions on.
20399 @item hs4x
20400 Compile for ARC HS4x CPU.
20402 @item hs4xd
20403 Compile for ARC HS4xD CPU.
20405 @item hs4x_rel31
20406 Compile for ARC HS4x CPU release 3.10a.
20408 @item arc600_norm
20409 Compile for ARC 600 CPU with @code{norm} instructions enabled.
20411 @item arc600_mul32x16
20412 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
20413 instructions enabled.
20415 @item arc600_mul64
20416 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
20417 instructions enabled.
20419 @item arc601_norm
20420 Compile for ARC 601 CPU with @code{norm} instructions enabled.
20422 @item arc601_mul32x16
20423 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
20424 instructions enabled.
20426 @item arc601_mul64
20427 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
20428 instructions enabled.
20430 @item nps400
20431 Compile for ARC 700 on NPS400 chip.
20433 @item em_mini
20434 Compile for ARC EM minimalist configuration featuring reduced register
20435 set.
20437 @end table
20439 @item -mdpfp
20440 @opindex mdpfp
20441 @itemx -mdpfp-compact
20442 @opindex mdpfp-compact
20443 Generate double-precision FPX instructions, tuned for the compact
20444 implementation.
20446 @item -mdpfp-fast
20447 @opindex mdpfp-fast
20448 Generate double-precision FPX instructions, tuned for the fast
20449 implementation.
20451 @item -mno-dpfp-lrsr
20452 @opindex mno-dpfp-lrsr
20453 Disable @code{lr} and @code{sr} instructions from using FPX extension
20454 aux registers.
20456 @item -mea
20457 @opindex mea
20458 Generate extended arithmetic instructions.  Currently only
20459 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
20460 supported.  Only valid for @option{-mcpu=ARC700}.
20462 @item -mno-mpy
20463 @opindex mno-mpy
20464 @opindex mmpy
20465 Do not generate @code{mpy}-family instructions for ARC700.  This option is
20466 deprecated.
20468 @item -mmul32x16
20469 @opindex mmul32x16
20470 Generate 32x16-bit multiply and multiply-accumulate instructions.
20472 @item -mmul64
20473 @opindex mmul64
20474 Generate @code{mul64} and @code{mulu64} instructions.  
20475 Only valid for @option{-mcpu=ARC600}.
20477 @item -mnorm
20478 @opindex mnorm
20479 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
20480 is in effect.
20482 @item -mspfp
20483 @opindex mspfp
20484 @itemx -mspfp-compact
20485 @opindex mspfp-compact
20486 Generate single-precision FPX instructions, tuned for the compact
20487 implementation.
20489 @item -mspfp-fast
20490 @opindex mspfp-fast
20491 Generate single-precision FPX instructions, tuned for the fast
20492 implementation.
20494 @item -msimd
20495 @opindex msimd
20496 Enable generation of ARC SIMD instructions via target-specific
20497 builtins.  Only valid for @option{-mcpu=ARC700}.
20499 @item -msoft-float
20500 @opindex msoft-float
20501 This option ignored; it is provided for compatibility purposes only.
20502 Software floating-point code is emitted by default, and this default
20503 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
20504 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
20505 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
20507 @item -mswap
20508 @opindex mswap
20509 Generate @code{swap} instructions.
20511 @item -matomic
20512 @opindex matomic
20513 This enables use of the locked load/store conditional extension to implement
20514 atomic memory built-in functions.  Not available for ARC 6xx or ARC
20515 EM cores.
20517 @item -mdiv-rem
20518 @opindex mdiv-rem
20519 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
20521 @item -mcode-density
20522 @opindex mcode-density
20523 Enable code density instructions for ARC EM.  
20524 This option is on by default for ARC HS.
20526 @item -mll64
20527 @opindex mll64
20528 Enable double load/store operations for ARC HS cores.
20530 @item -mtp-regno=@var{regno}
20531 @opindex mtp-regno
20532 Specify thread pointer register number.
20534 @item -mmpy-option=@var{multo}
20535 @opindex mmpy-option
20536 Compile ARCv2 code with a multiplier design option.  You can specify 
20537 the option using either a string or numeric value for @var{multo}.  
20538 @samp{wlh1} is the default value.  The recognized values are:
20540 @table @samp
20541 @item 0
20542 @itemx none
20543 No multiplier available.
20545 @item 1
20546 @itemx w
20547 16x16 multiplier, fully pipelined.
20548 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
20550 @item 2
20551 @itemx wlh1
20552 32x32 multiplier, fully
20553 pipelined (1 stage).  The following instructions are additionally
20554 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20556 @item 3
20557 @itemx wlh2
20558 32x32 multiplier, fully pipelined
20559 (2 stages).  The following instructions are additionally enabled: @code{mpy},
20560 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20562 @item 4
20563 @itemx wlh3
20564 Two 16x16 multipliers, blocking,
20565 sequential.  The following instructions are additionally enabled: @code{mpy},
20566 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20568 @item 5
20569 @itemx wlh4
20570 One 16x16 multiplier, blocking,
20571 sequential.  The following instructions are additionally enabled: @code{mpy},
20572 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20574 @item 6
20575 @itemx wlh5
20576 One 32x4 multiplier, blocking,
20577 sequential.  The following instructions are additionally enabled: @code{mpy},
20578 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20580 @item 7
20581 @itemx plus_dmpy
20582 ARC HS SIMD support.
20584 @item 8
20585 @itemx plus_macd
20586 ARC HS SIMD support.
20588 @item 9
20589 @itemx plus_qmacw
20590 ARC HS SIMD support.
20592 @end table
20594 This option is only available for ARCv2 cores@.
20596 @item -mfpu=@var{fpu}
20597 @opindex mfpu
20598 Enables support for specific floating-point hardware extensions for ARCv2
20599 cores.  Supported values for @var{fpu} are:
20601 @table @samp
20603 @item fpus
20604 Enables support for single-precision floating-point hardware
20605 extensions@.
20607 @item fpud
20608 Enables support for double-precision floating-point hardware
20609 extensions.  The single-precision floating-point extension is also
20610 enabled.  Not available for ARC EM@.
20612 @item fpuda
20613 Enables support for double-precision floating-point hardware
20614 extensions using double-precision assist instructions.  The single-precision
20615 floating-point extension is also enabled.  This option is
20616 only available for ARC EM@.
20618 @item fpuda_div
20619 Enables support for double-precision floating-point hardware
20620 extensions using double-precision assist instructions.
20621 The single-precision floating-point, square-root, and divide 
20622 extensions are also enabled.  This option is
20623 only available for ARC EM@.
20625 @item fpuda_fma
20626 Enables support for double-precision floating-point hardware
20627 extensions using double-precision assist instructions.
20628 The single-precision floating-point and fused multiply and add 
20629 hardware extensions are also enabled.  This option is
20630 only available for ARC EM@.
20632 @item fpuda_all
20633 Enables support for double-precision floating-point hardware
20634 extensions using double-precision assist instructions.
20635 All single-precision floating-point hardware extensions are also
20636 enabled.  This option is only available for ARC EM@.
20638 @item fpus_div
20639 Enables support for single-precision floating-point, square-root and divide 
20640 hardware extensions@.
20642 @item fpud_div
20643 Enables support for double-precision floating-point, square-root and divide 
20644 hardware extensions.  This option
20645 includes option @samp{fpus_div}. Not available for ARC EM@.
20647 @item fpus_fma
20648 Enables support for single-precision floating-point and 
20649 fused multiply and add hardware extensions@.
20651 @item fpud_fma
20652 Enables support for double-precision floating-point and 
20653 fused multiply and add hardware extensions.  This option
20654 includes option @samp{fpus_fma}.  Not available for ARC EM@.
20656 @item fpus_all
20657 Enables support for all single-precision floating-point hardware
20658 extensions@.
20660 @item fpud_all
20661 Enables support for all single- and double-precision floating-point
20662 hardware extensions.  Not available for ARC EM@.
20664 @end table
20666 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
20667 @opindex mirq-ctrl-saved
20668 Specifies general-purposes registers that the processor automatically
20669 saves/restores on interrupt entry and exit.  @var{register-range} is
20670 specified as two registers separated by a dash.  The register range
20671 always starts with @code{r0}, the upper limit is @code{fp} register.
20672 @var{blink} and @var{lp_count} are optional.  This option is only
20673 valid for ARC EM and ARC HS cores.
20675 @item -mrgf-banked-regs=@var{number}
20676 @opindex mrgf-banked-regs
20677 Specifies the number of registers replicated in second register bank
20678 on entry to fast interrupt.  Fast interrupts are interrupts with the
20679 highest priority level P0.  These interrupts save only PC and STATUS32
20680 registers to avoid memory transactions during interrupt entry and exit
20681 sequences.  Use this option when you are using fast interrupts in an
20682 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
20684 @item -mlpc-width=@var{width}
20685 @opindex mlpc-width
20686 Specify the width of the @code{lp_count} register.  Valid values for
20687 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
20688 fixed to 32 bits.  If the width is less than 32, the compiler does not
20689 attempt to transform loops in your program to use the zero-delay loop
20690 mechanism unless it is known that the @code{lp_count} register can
20691 hold the required loop-counter value.  Depending on the width
20692 specified, the compiler and run-time library might continue to use the
20693 loop mechanism for various needs.  This option defines macro
20694 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
20696 @item -mrf16
20697 @opindex mrf16
20698 This option instructs the compiler to generate code for a 16-entry
20699 register file.  This option defines the @code{__ARC_RF16__}
20700 preprocessor macro.
20702 @item -mbranch-index
20703 @opindex mbranch-index
20704 Enable use of @code{bi} or @code{bih} instructions to implement jump
20705 tables.
20707 @end table
20709 The following options are passed through to the assembler, and also
20710 define preprocessor macro symbols.
20712 @c Flags used by the assembler, but for which we define preprocessor
20713 @c macro symbols as well.
20714 @table @gcctabopt
20715 @item -mdsp-packa
20716 @opindex mdsp-packa
20717 Passed down to the assembler to enable the DSP Pack A extensions.
20718 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
20719 deprecated.
20721 @item -mdvbf
20722 @opindex mdvbf
20723 Passed down to the assembler to enable the dual Viterbi butterfly
20724 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
20725 option is deprecated.
20727 @c ARC700 4.10 extension instruction
20728 @item -mlock
20729 @opindex mlock
20730 Passed down to the assembler to enable the locked load/store
20731 conditional extension.  Also sets the preprocessor symbol
20732 @code{__Xlock}.
20734 @item -mmac-d16
20735 @opindex mmac-d16
20736 Passed down to the assembler.  Also sets the preprocessor symbol
20737 @code{__Xxmac_d16}.  This option is deprecated.
20739 @item -mmac-24
20740 @opindex mmac-24
20741 Passed down to the assembler.  Also sets the preprocessor symbol
20742 @code{__Xxmac_24}.  This option is deprecated.
20744 @c ARC700 4.10 extension instruction
20745 @item -mrtsc
20746 @opindex mrtsc
20747 Passed down to the assembler to enable the 64-bit time-stamp counter
20748 extension instruction.  Also sets the preprocessor symbol
20749 @code{__Xrtsc}.  This option is deprecated.
20751 @c ARC700 4.10 extension instruction
20752 @item -mswape
20753 @opindex mswape
20754 Passed down to the assembler to enable the swap byte ordering
20755 extension instruction.  Also sets the preprocessor symbol
20756 @code{__Xswape}.
20758 @item -mtelephony
20759 @opindex mtelephony
20760 Passed down to the assembler to enable dual- and single-operand
20761 instructions for telephony.  Also sets the preprocessor symbol
20762 @code{__Xtelephony}.  This option is deprecated.
20764 @item -mxy
20765 @opindex mxy
20766 Passed down to the assembler to enable the XY memory extension.  Also
20767 sets the preprocessor symbol @code{__Xxy}.
20769 @end table
20771 The following options control how the assembly code is annotated:
20773 @c Assembly annotation options
20774 @table @gcctabopt
20775 @item -misize
20776 @opindex misize
20777 Annotate assembler instructions with estimated addresses.
20779 @item -mannotate-align
20780 @opindex mannotate-align
20781 Explain what alignment considerations lead to the decision to make an
20782 instruction short or long.
20784 @end table
20786 The following options are passed through to the linker:
20788 @c options passed through to the linker
20789 @table @gcctabopt
20790 @item -marclinux
20791 @opindex marclinux
20792 Passed through to the linker, to specify use of the @code{arclinux} emulation.
20793 This option is enabled by default in tool chains built for
20794 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
20795 when profiling is not requested.
20797 @item -marclinux_prof
20798 @opindex marclinux_prof
20799 Passed through to the linker, to specify use of the
20800 @code{arclinux_prof} emulation.  This option is enabled by default in
20801 tool chains built for @w{@code{arc-linux-uclibc}} and
20802 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
20804 @end table
20806 The following options control the semantics of generated code:
20808 @c semantically relevant code generation options
20809 @table @gcctabopt
20810 @item -mlong-calls
20811 @opindex mlong-calls
20812 Generate calls as register indirect calls, thus providing access
20813 to the full 32-bit address range.
20815 @item -mmedium-calls
20816 @opindex mmedium-calls
20817 Don't use less than 25-bit addressing range for calls, which is the
20818 offset available for an unconditional branch-and-link
20819 instruction.  Conditional execution of function calls is suppressed, to
20820 allow use of the 25-bit range, rather than the 21-bit range with
20821 conditional branch-and-link.  This is the default for tool chains built
20822 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
20824 @item -G @var{num}
20825 @opindex G
20826 Put definitions of externally-visible data in a small data section if
20827 that data is no bigger than @var{num} bytes.  The default value of
20828 @var{num} is 4 for any ARC configuration, or 8 when we have double
20829 load/store operations.
20831 @item -mno-sdata
20832 @opindex mno-sdata
20833 @opindex msdata
20834 Do not generate sdata references.  This is the default for tool chains
20835 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
20836 targets.
20838 @item -mvolatile-cache
20839 @opindex mvolatile-cache
20840 Use ordinarily cached memory accesses for volatile references.  This is the
20841 default.
20843 @item -mno-volatile-cache
20844 @opindex mno-volatile-cache
20845 @opindex mvolatile-cache
20846 Enable cache bypass for volatile references.
20848 @end table
20850 The following options fine tune code generation:
20851 @c code generation tuning options
20852 @table @gcctabopt
20853 @item -malign-call
20854 @opindex malign-call
20855 Does nothing.  Preserved for backward compatibility.
20857 @item -mauto-modify-reg
20858 @opindex mauto-modify-reg
20859 Enable the use of pre/post modify with register displacement.
20861 @item -mbbit-peephole
20862 @opindex mbbit-peephole
20863 Enable bbit peephole2.
20865 @item -mno-brcc
20866 @opindex mno-brcc
20867 This option disables a target-specific pass in @file{arc_reorg} to
20868 generate compare-and-branch (@code{br@var{cc}}) instructions.  
20869 It has no effect on
20870 generation of these instructions driven by the combiner pass.
20872 @item -mcase-vector-pcrel
20873 @opindex mcase-vector-pcrel
20874 Use PC-relative switch case tables to enable case table shortening.
20875 This is the default for @option{-Os}.
20877 @item -mcompact-casesi
20878 @opindex mcompact-casesi
20879 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
20880 and only available for ARCv1 cores.  This option is deprecated.
20882 @item -mno-cond-exec
20883 @opindex mno-cond-exec
20884 Disable the ARCompact-specific pass to generate conditional 
20885 execution instructions.
20887 Due to delay slot scheduling and interactions between operand numbers,
20888 literal sizes, instruction lengths, and the support for conditional execution,
20889 the target-independent pass to generate conditional execution is often lacking,
20890 so the ARC port has kept a special pass around that tries to find more
20891 conditional execution generation opportunities after register allocation,
20892 branch shortening, and delay slot scheduling have been done.  This pass
20893 generally, but not always, improves performance and code size, at the cost of
20894 extra compilation time, which is why there is an option to switch it off.
20895 If you have a problem with call instructions exceeding their allowable
20896 offset range because they are conditionalized, you should consider using
20897 @option{-mmedium-calls} instead.
20899 @item -mearly-cbranchsi
20900 @opindex mearly-cbranchsi
20901 Enable pre-reload use of the @code{cbranchsi} pattern.
20903 @item -mexpand-adddi
20904 @opindex mexpand-adddi
20905 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
20906 @code{add.f}, @code{adc} etc.  This option is deprecated.
20908 @item -mindexed-loads
20909 @opindex mindexed-loads
20910 Enable the use of indexed loads.  This can be problematic because some
20911 optimizers then assume that indexed stores exist, which is not
20912 the case.
20914 @item -mlra
20915 @opindex mlra
20916 Enable Local Register Allocation.  This is still experimental for ARC,
20917 so by default the compiler uses standard reload
20918 (i.e.@: @option{-mno-lra}).
20920 @item -mlra-priority-none
20921 @opindex mlra-priority-none
20922 Don't indicate any priority for target registers.
20924 @item -mlra-priority-compact
20925 @opindex mlra-priority-compact
20926 Indicate target register priority for r0..r3 / r12..r15.
20928 @item -mlra-priority-noncompact
20929 @opindex mlra-priority-noncompact
20930 Reduce target register priority for r0..r3 / r12..r15.
20932 @item -mmillicode
20933 @opindex mmillicode
20934 When optimizing for size (using @option{-Os}), prologues and epilogues
20935 that have to save or restore a large number of registers are often
20936 shortened by using call to a special function in libgcc; this is
20937 referred to as a @emph{millicode} call.  As these calls can pose
20938 performance issues, and/or cause linking issues when linking in a
20939 nonstandard way, this option is provided to turn on or off millicode
20940 call generation.
20942 @item -mcode-density-frame
20943 @opindex mcode-density-frame
20944 This option enable the compiler to emit @code{enter} and @code{leave}
20945 instructions.  These instructions are only valid for CPUs with
20946 code-density feature.
20948 @item -mmixed-code
20949 @opindex mmixed-code
20950 Does nothing.  Preserved for backward compatibility.
20952 @item -mq-class
20953 @opindex mq-class
20954 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
20955 This is the default for @option{-Os}.
20957 @item -mRcq
20958 @opindex mRcq
20959 Does nothing.  Preserved for backward compatibility.
20961 @item -mRcw
20962 @opindex mRcw
20963 Does nothing.  Preserved for backward compatibility.
20965 @item -msize-level=@var{level}
20966 @opindex msize-level
20967 Fine-tune size optimization with regards to instruction lengths and alignment.
20968 The recognized values for @var{level} are:
20969 @table @samp
20970 @item 0
20971 No size optimization.  This level is deprecated and treated like @samp{1}.
20973 @item 1
20974 Short instructions are used opportunistically.
20976 @item 2
20977 In addition, alignment of loops and of code after barriers are dropped.
20979 @item 3
20980 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
20982 @end table
20984 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
20985 the behavior when this is not set is equivalent to level @samp{1}.
20987 @item -mtune=@var{cpu}
20988 @opindex mtune
20989 Set instruction scheduling parameters for @var{cpu}, overriding any implied
20990 by @option{-mcpu=}.
20992 Supported values for @var{cpu} are
20994 @table @samp
20995 @item ARC600
20996 Tune for ARC600 CPU.
20998 @item ARC601
20999 Tune for ARC601 CPU.
21001 @item ARC700
21002 Tune for ARC700 CPU with standard multiplier block.
21004 @item ARC700-xmac
21005 Tune for ARC700 CPU with XMAC block.
21007 @item ARC725D
21008 Tune for ARC725D CPU.
21010 @item ARC750D
21011 Tune for ARC750D CPU.
21013 @item core3
21014 Tune for ARCv2 core3 type CPU.  This option enable usage of
21015 @code{dbnz} instruction.
21017 @item release31a
21018 Tune for ARC4x release 3.10a.
21020 @end table
21022 @item -mmultcost=@var{num}
21023 @opindex mmultcost
21024 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21025 normal instruction.
21027 @item -munalign-prob-threshold=@var{probability}
21028 @opindex munalign-prob-threshold
21029 Does nothing.  Preserved for backward compatibility.
21031 @end table
21033 The following options are maintained for backward compatibility, but
21034 are now deprecated and will be removed in a future release:
21036 @c Deprecated options
21037 @table @gcctabopt
21039 @item -margonaut
21040 @opindex margonaut
21041 Obsolete FPX.
21043 @item -mbig-endian
21044 @opindex mbig-endian
21045 @itemx -EB
21046 @opindex EB
21047 Compile code for big-endian targets.  Use of these options is now
21048 deprecated.  Big-endian code is supported by configuring GCC to build
21049 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
21050 for which big endian is the default.
21052 @item -mlittle-endian
21053 @opindex mlittle-endian
21054 @itemx -EL
21055 @opindex EL
21056 Compile code for little-endian targets.  Use of these options is now
21057 deprecated.  Little-endian code is supported by configuring GCC to build 
21058 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
21059 for which little endian is the default.
21061 @item -mbarrel_shifter
21062 @opindex mbarrel_shifter
21063 Replaced by @option{-mbarrel-shifter}.
21065 @item -mdpfp_compact
21066 @opindex mdpfp_compact
21067 Replaced by @option{-mdpfp-compact}.
21069 @item -mdpfp_fast
21070 @opindex mdpfp_fast
21071 Replaced by @option{-mdpfp-fast}.
21073 @item -mdsp_packa
21074 @opindex mdsp_packa
21075 Replaced by @option{-mdsp-packa}.
21077 @item -mEA
21078 @opindex mEA
21079 Replaced by @option{-mea}.
21081 @item -mmac_24
21082 @opindex mmac_24
21083 Replaced by @option{-mmac-24}.
21085 @item -mmac_d16
21086 @opindex mmac_d16
21087 Replaced by @option{-mmac-d16}.
21089 @item -mspfp_compact
21090 @opindex mspfp_compact
21091 Replaced by @option{-mspfp-compact}.
21093 @item -mspfp_fast
21094 @opindex mspfp_fast
21095 Replaced by @option{-mspfp-fast}.
21097 @item -mtune=@var{cpu}
21098 @opindex mtune
21099 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
21100 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
21101 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
21103 @item -multcost=@var{num}
21104 @opindex multcost
21105 Replaced by @option{-mmultcost}.
21107 @end table
21109 @node ARM Options
21110 @subsection ARM Options
21111 @cindex ARM options
21113 These @samp{-m} options are defined for the ARM port:
21115 @table @gcctabopt
21116 @item -mabi=@var{name}
21117 @opindex mabi
21118 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
21119 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
21121 @item -mapcs-frame
21122 @opindex mapcs-frame
21123 Generate a stack frame that is compliant with the ARM Procedure Call
21124 Standard for all functions, even if this is not strictly necessary for
21125 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
21126 with this option causes the stack frames not to be generated for
21127 leaf functions.  The default is @option{-mno-apcs-frame}.
21128 This option is deprecated.
21130 @item -mapcs
21131 @opindex mapcs
21132 This is a synonym for @option{-mapcs-frame} and is deprecated.
21134 @ignore
21135 @c not currently implemented
21136 @item -mapcs-stack-check
21137 @opindex mapcs-stack-check
21138 Generate code to check the amount of stack space available upon entry to
21139 every function (that actually uses some stack space).  If there is
21140 insufficient space available then either the function
21141 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
21142 called, depending upon the amount of stack space required.  The runtime
21143 system is required to provide these functions.  The default is
21144 @option{-mno-apcs-stack-check}, since this produces smaller code.
21146 @c not currently implemented
21147 @item -mapcs-reentrant
21148 @opindex mapcs-reentrant
21149 Generate reentrant, position-independent code.  The default is
21150 @option{-mno-apcs-reentrant}.
21151 @end ignore
21153 @item -mthumb-interwork
21154 @opindex mthumb-interwork
21155 Generate code that supports calling between the ARM and Thumb
21156 instruction sets.  Without this option, on pre-v5 architectures, the
21157 two instruction sets cannot be reliably used inside one program.  The
21158 default is @option{-mno-thumb-interwork}, since slightly larger code
21159 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
21160 configurations this option is meaningless.
21162 @item -mno-sched-prolog
21163 @opindex mno-sched-prolog
21164 @opindex msched-prolog
21165 Prevent the reordering of instructions in the function prologue, or the
21166 merging of those instruction with the instructions in the function's
21167 body.  This means that all functions start with a recognizable set
21168 of instructions (or in fact one of a choice from a small set of
21169 different function prologues), and this information can be used to
21170 locate the start of functions inside an executable piece of code.  The
21171 default is @option{-msched-prolog}.
21173 @item -mfloat-abi=@var{name}
21174 @opindex mfloat-abi
21175 Specifies which floating-point ABI to use.  Permissible values
21176 are: @samp{soft}, @samp{softfp} and @samp{hard}.
21178 Specifying @samp{soft} causes GCC to generate output containing
21179 library calls for floating-point operations.
21180 @samp{softfp} allows the generation of code using hardware floating-point
21181 instructions, but still uses the soft-float calling conventions.
21182 @samp{hard} allows generation of floating-point instructions
21183 and uses FPU-specific calling conventions.
21185 The default depends on the specific target configuration.  Note that
21186 the hard-float and soft-float ABIs are not link-compatible; you must
21187 compile your entire program with the same ABI, and link with a
21188 compatible set of libraries.
21190 @item -mgeneral-regs-only
21191 @opindex mgeneral-regs-only
21192 Generate code which uses only the general-purpose registers.  This will prevent
21193 the compiler from using floating-point and Advanced SIMD registers but will not
21194 impose any restrictions on the assembler.
21196 @item -mlittle-endian
21197 @opindex mlittle-endian
21198 Generate code for a processor running in little-endian mode.  This is
21199 the default for all standard configurations.
21201 @item -mbig-endian
21202 @opindex mbig-endian
21203 Generate code for a processor running in big-endian mode; the default is
21204 to compile code for a little-endian processor.
21206 @item -mbe8
21207 @itemx -mbe32
21208 @opindex mbe8
21209 When linking a big-endian image select between BE8 and BE32 formats.
21210 The option has no effect for little-endian images and is ignored.  The
21211 default is dependent on the selected target architecture.  For ARMv6
21212 and later architectures the default is BE8, for older architectures
21213 the default is BE32.  BE32 format has been deprecated by ARM.
21215 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
21216 @opindex march
21217 This specifies the name of the target ARM architecture.  GCC uses this
21218 name to determine what kind of instructions it can emit when generating
21219 assembly code.  This option can be used in conjunction with or instead
21220 of the @option{-mcpu=} option.
21222 Permissible names are:
21223 @samp{armv4t},
21224 @samp{armv5t}, @samp{armv5te},
21225 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
21226 @samp{armv6z}, @samp{armv6zk},
21227 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
21228 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
21229 @samp{armv8.4-a},
21230 @samp{armv8.5-a},
21231 @samp{armv8.6-a},
21232 @samp{armv9-a},
21233 @samp{armv7-r},
21234 @samp{armv8-r},
21235 @samp{armv6-m}, @samp{armv6s-m},
21236 @samp{armv7-m}, @samp{armv7e-m},
21237 @samp{armv8-m.base}, @samp{armv8-m.main},
21238 @samp{armv8.1-m.main},
21239 @samp{armv9-a},
21240 @samp{iwmmxt} and @samp{iwmmxt2}.
21242 Additionally, the following architectures, which lack support for the
21243 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
21245 Many of the architectures support extensions.  These can be added by
21246 appending @samp{+@var{extension}} to the architecture name.  Extension
21247 options are processed in order and capabilities accumulate.  An extension
21248 will also enable any necessary base extensions
21249 upon which it depends.  For example, the @samp{+crypto} extension
21250 will always enable the @samp{+simd} extension.  The exception to the
21251 additive construction is for extensions that are prefixed with
21252 @samp{+no@dots{}}: these extensions disable the specified option and
21253 any other extensions that may depend on the presence of that
21254 extension.
21256 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
21257 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
21258 entirely disabled by the @samp{+nofp} option that follows it.
21260 Most extension names are generically named, but have an effect that is
21261 dependent upon the architecture to which it is applied.  For example,
21262 the @samp{+simd} option can be applied to both @samp{armv7-a} and
21263 @samp{armv8-a} architectures, but will enable the original ARMv7-A
21264 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
21265 variant for @samp{armv8-a}.
21267 The table below lists the supported extensions for each architecture.
21268 Architectures not mentioned do not support any extensions.
21270 @table @samp
21271 @item armv5te
21272 @itemx armv6
21273 @itemx armv6j
21274 @itemx armv6k
21275 @itemx armv6kz
21276 @itemx armv6t2
21277 @itemx armv6z
21278 @itemx armv6zk
21279 @table @samp
21280 @item +fp
21281 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
21282 used as an alias for this extension.
21284 @item +nofp
21285 Disable the floating-point instructions.
21286 @end table
21288 @item armv7
21289 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
21290 @table @samp
21291 @item +fp
21292 The VFPv3 floating-point instructions, with 16 double-precision
21293 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
21294 for this extension.  Note that floating-point is not supported by the
21295 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
21296 ARMv7-R architectures.
21298 @item +nofp
21299 Disable the floating-point instructions.
21300 @end table
21302 @item armv7-a
21303 @table @samp
21304 @item +mp
21305 The multiprocessing extension.
21307 @item +sec
21308 The security extension.
21310 @item +fp
21311 The VFPv3 floating-point instructions, with 16 double-precision
21312 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
21313 for this extension.
21315 @item +simd
21316 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21317 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
21318 for this extension.
21320 @item +vfpv3
21321 The VFPv3 floating-point instructions, with 32 double-precision
21322 registers.
21324 @item +vfpv3-d16-fp16
21325 The VFPv3 floating-point instructions, with 16 double-precision
21326 registers and the half-precision floating-point conversion operations.
21328 @item +vfpv3-fp16
21329 The VFPv3 floating-point instructions, with 32 double-precision
21330 registers and the half-precision floating-point conversion operations.
21332 @item +vfpv4-d16
21333 The VFPv4 floating-point instructions, with 16 double-precision
21334 registers.
21336 @item +vfpv4
21337 The VFPv4 floating-point instructions, with 32 double-precision
21338 registers.
21340 @item +neon-fp16
21341 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21342 the half-precision floating-point conversion operations.
21344 @item +neon-vfpv4
21345 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
21347 @item +nosimd
21348 Disable the Advanced SIMD instructions (does not disable floating point).
21350 @item +nofp
21351 Disable the floating-point and Advanced SIMD instructions.
21352 @end table
21354 @item armv7ve
21355 The extended version of the ARMv7-A architecture with support for
21356 virtualization.
21357 @table @samp
21358 @item +fp
21359 The VFPv4 floating-point instructions, with 16 double-precision registers.
21360 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
21362 @item +simd
21363 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
21364 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
21366 @item +vfpv3-d16
21367 The VFPv3 floating-point instructions, with 16 double-precision
21368 registers.
21370 @item +vfpv3
21371 The VFPv3 floating-point instructions, with 32 double-precision
21372 registers.
21374 @item +vfpv3-d16-fp16
21375 The VFPv3 floating-point instructions, with 16 double-precision
21376 registers and the half-precision floating-point conversion operations.
21378 @item +vfpv3-fp16
21379 The VFPv3 floating-point instructions, with 32 double-precision
21380 registers and the half-precision floating-point conversion operations.
21382 @item +vfpv4-d16
21383 The VFPv4 floating-point instructions, with 16 double-precision
21384 registers.
21386 @item +vfpv4
21387 The VFPv4 floating-point instructions, with 32 double-precision
21388 registers.
21390 @item +neon
21391 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21392 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
21394 @item +neon-fp16
21395 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21396 the half-precision floating-point conversion operations.
21398 @item +nosimd
21399 Disable the Advanced SIMD instructions (does not disable floating point).
21401 @item +nofp
21402 Disable the floating-point and Advanced SIMD instructions.
21403 @end table
21405 @item armv8-a
21406 @table @samp
21407 @item +crc
21408 The Cyclic Redundancy Check (CRC) instructions.
21409 @item +simd
21410 The ARMv8-A Advanced SIMD and floating-point instructions.
21411 @item +crypto
21412 The cryptographic instructions.
21413 @item +nocrypto
21414 Disable the cryptographic instructions.
21415 @item +nofp
21416 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21417 @item +sb
21418 Speculation Barrier Instruction.
21419 @item +predres
21420 Execution and Data Prediction Restriction Instructions.
21421 @end table
21423 @item armv8.1-a
21424 @table @samp
21425 @item +simd
21426 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21428 @item +crypto
21429 The cryptographic instructions.  This also enables the Advanced SIMD and
21430 floating-point instructions.
21432 @item +nocrypto
21433 Disable the cryptographic instructions.
21435 @item +nofp
21436 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21438 @item +sb
21439 Speculation Barrier Instruction.
21441 @item +predres
21442 Execution and Data Prediction Restriction Instructions.
21443 @end table
21445 @item armv8.2-a
21446 @itemx armv8.3-a
21447 @table @samp
21448 @item +fp16
21449 The half-precision floating-point data processing instructions.
21450 This also enables the Advanced SIMD and floating-point instructions.
21452 @item +fp16fml
21453 The half-precision floating-point fmla extension.  This also enables
21454 the half-precision floating-point extension and Advanced SIMD and
21455 floating-point instructions.
21457 @item +simd
21458 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21460 @item +crypto
21461 The cryptographic instructions.  This also enables the Advanced SIMD and
21462 floating-point instructions.
21464 @item +dotprod
21465 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
21467 @item +nocrypto
21468 Disable the cryptographic extension.
21470 @item +nofp
21471 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21473 @item +sb
21474 Speculation Barrier Instruction.
21476 @item +predres
21477 Execution and Data Prediction Restriction Instructions.
21479 @item +i8mm
21480 8-bit Integer Matrix Multiply instructions.
21481 This also enables Advanced SIMD and floating-point instructions.
21483 @item +bf16
21484 Brain half-precision floating-point instructions.
21485 This also enables Advanced SIMD and floating-point instructions.
21486 @end table
21488 @item armv8.4-a
21489 @table @samp
21490 @item +fp16
21491 The half-precision floating-point data processing instructions.
21492 This also enables the Advanced SIMD and floating-point instructions as well
21493 as the Dot Product extension and the half-precision floating-point fmla
21494 extension.
21496 @item +simd
21497 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21498 Dot Product extension.
21500 @item +crypto
21501 The cryptographic instructions.  This also enables the Advanced SIMD and
21502 floating-point instructions as well as the Dot Product extension.
21504 @item +nocrypto
21505 Disable the cryptographic extension.
21507 @item +nofp
21508 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21510 @item +sb
21511 Speculation Barrier Instruction.
21513 @item +predres
21514 Execution and Data Prediction Restriction Instructions.
21516 @item +i8mm
21517 8-bit Integer Matrix Multiply instructions.
21518 This also enables Advanced SIMD and floating-point instructions.
21520 @item +bf16
21521 Brain half-precision floating-point instructions.
21522 This also enables Advanced SIMD and floating-point instructions.
21523 @end table
21525 @item armv8.5-a
21526 @table @samp
21527 @item +fp16
21528 The half-precision floating-point data processing instructions.
21529 This also enables the Advanced SIMD and floating-point instructions as well
21530 as the Dot Product extension and the half-precision floating-point fmla
21531 extension.
21533 @item +simd
21534 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21535 Dot Product extension.
21537 @item +crypto
21538 The cryptographic instructions.  This also enables the Advanced SIMD and
21539 floating-point instructions as well as the Dot Product extension.
21541 @item +nocrypto
21542 Disable the cryptographic extension.
21544 @item +nofp
21545 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21547 @item +i8mm
21548 8-bit Integer Matrix Multiply instructions.
21549 This also enables Advanced SIMD and floating-point instructions.
21551 @item +bf16
21552 Brain half-precision floating-point instructions.
21553 This also enables Advanced SIMD and floating-point instructions.
21554 @end table
21556 @item armv8.6-a
21557 @table @samp
21558 @item +fp16
21559 The half-precision floating-point data processing instructions.
21560 This also enables the Advanced SIMD and floating-point instructions as well
21561 as the Dot Product extension and the half-precision floating-point fmla
21562 extension.
21564 @item +simd
21565 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21566 Dot Product extension.
21568 @item +crypto
21569 The cryptographic instructions.  This also enables the Advanced SIMD and
21570 floating-point instructions as well as the Dot Product extension.
21572 @item +nocrypto
21573 Disable the cryptographic extension.
21575 @item +nofp
21576 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21578 @item +i8mm
21579 8-bit Integer Matrix Multiply instructions.
21580 This also enables Advanced SIMD and floating-point instructions.
21582 @item +bf16
21583 Brain half-precision floating-point instructions.
21584 This also enables Advanced SIMD and floating-point instructions.
21585 @end table
21587 @item armv7-r
21588 @table @samp
21589 @item +fp.sp
21590 The single-precision VFPv3 floating-point instructions.  The extension
21591 @samp{+vfpv3xd} can be used as an alias for this extension.
21593 @item +fp
21594 The VFPv3 floating-point instructions with 16 double-precision registers.
21595 The extension +vfpv3-d16 can be used as an alias for this extension.
21597 @item +vfpv3xd-d16-fp16
21598 The single-precision VFPv3 floating-point instructions with 16 double-precision
21599 registers and the half-precision floating-point conversion operations.
21601 @item +vfpv3-d16-fp16
21602 The VFPv3 floating-point instructions with 16 double-precision
21603 registers and the half-precision floating-point conversion operations.
21605 @item +nofp
21606 Disable the floating-point extension.
21608 @item +idiv
21609 The ARM-state integer division instructions.
21611 @item +noidiv
21612 Disable the ARM-state integer division extension.
21613 @end table
21615 @item armv7e-m
21616 @table @samp
21617 @item +fp
21618 The single-precision VFPv4 floating-point instructions.
21620 @item +fpv5
21621 The single-precision FPv5 floating-point instructions.
21623 @item +fp.dp
21624 The single- and double-precision FPv5 floating-point instructions.
21626 @item +nofp
21627 Disable the floating-point extensions.
21628 @end table
21630 @item  armv8.1-m.main
21631 @table @samp
21633 @item +dsp
21634 The DSP instructions.
21636 @item +mve
21637 The M-Profile Vector Extension (MVE) integer instructions.
21639 @item +mve.fp
21640 The M-Profile Vector Extension (MVE) integer and single precision
21641 floating-point instructions.
21643 @item +fp
21644 The single-precision floating-point instructions.
21646 @item +fp.dp
21647 The single- and double-precision floating-point instructions.
21649 @item +nofp
21650 Disable the floating-point extension.
21652 @item +cdecp0, +cdecp1, ... , +cdecp7
21653 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
21654 to the numbers given in the options in the range 0 to 7.
21655 @end table
21657 @item  armv8-m.main
21658 @table @samp
21659 @item +dsp
21660 The DSP instructions.
21662 @item +nodsp
21663 Disable the DSP extension.
21665 @item +fp
21666 The single-precision floating-point instructions.
21668 @item +fp.dp
21669 The single- and double-precision floating-point instructions.
21671 @item +nofp
21672 Disable the floating-point extension.
21674 @item +cdecp0, +cdecp1, ... , +cdecp7
21675 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
21676 to the numbers given in the options in the range 0 to 7.
21677 @end table
21679 @item armv8-r
21680 @table @samp
21681 @item +crc
21682 The Cyclic Redundancy Check (CRC) instructions.
21683 @item +fp.sp
21684 The single-precision FPv5 floating-point instructions.
21685 @item +simd
21686 The ARMv8-A Advanced SIMD and floating-point instructions.
21687 @item +crypto
21688 The cryptographic instructions.
21689 @item +nocrypto
21690 Disable the cryptographic instructions.
21691 @item +nofp
21692 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21693 @end table
21695 @end table
21697 @option{-march=native} causes the compiler to auto-detect the architecture
21698 of the build computer.  At present, this feature is only supported on
21699 GNU/Linux, and not all architectures are recognized.  If the auto-detect
21700 is unsuccessful the option has no effect.
21702 @item -mtune=@var{name}
21703 @opindex mtune
21704 This option specifies the name of the target ARM processor for
21705 which GCC should tune the performance of the code.
21706 For some ARM implementations better performance can be obtained by using
21707 this option.
21708 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
21709 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
21710 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
21711 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
21712 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
21713 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
21714 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
21715 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
21716 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
21717 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
21718 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
21719 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
21720 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
21721 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
21722 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
21723 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
21724 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
21725 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
21726 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
21727 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1},
21728 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
21729 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
21730 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
21731 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
21732 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
21733 @samp{xgene1}.
21735 Additionally, this option can specify that GCC should tune the performance
21736 of the code for a big.LITTLE system.  Permissible names are:
21737 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
21738 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
21739 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
21740 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
21742 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
21743 performance for a blend of processors within architecture @var{arch}.
21744 The aim is to generate code that run well on the current most popular
21745 processors, balancing between optimizations that benefit some CPUs in the
21746 range, and avoiding performance pitfalls of other CPUs.  The effects of
21747 this option may change in future GCC versions as CPU models come and go.
21749 @option{-mtune} permits the same extension options as @option{-mcpu}, but
21750 the extension options do not affect the tuning of the generated code.
21752 @option{-mtune=native} causes the compiler to auto-detect the CPU
21753 of the build computer.  At present, this feature is only supported on
21754 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
21755 unsuccessful the option has no effect.
21757 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
21758 @opindex mcpu
21759 This specifies the name of the target ARM processor.  GCC uses this name
21760 to derive the name of the target ARM architecture (as if specified
21761 by @option{-march}) and the ARM processor type for which to tune for
21762 performance (as if specified by @option{-mtune}).  Where this option
21763 is used in conjunction with @option{-march} or @option{-mtune},
21764 those options take precedence over the appropriate part of this option.
21766 Many of the supported CPUs implement optional architectural
21767 extensions.  Where this is so the architectural extensions are
21768 normally enabled by default.  If implementations that lack the
21769 extension exist, then the extension syntax can be used to disable
21770 those extensions that have been omitted.  For floating-point and
21771 Advanced SIMD (Neon) instructions, the settings of the options
21772 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
21773 floating-point and Advanced SIMD instructions will only be used if
21774 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
21775 @option{-mfpu} other than @samp{auto} will override the available
21776 floating-point and SIMD extension instructions.
21778 For example, @samp{cortex-a9} can be found in three major
21779 configurations: integer only, with just a floating-point unit or with
21780 floating-point and Advanced SIMD.  The default is to enable all the
21781 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
21782 be used to disable just the SIMD or both the SIMD and floating-point
21783 instructions respectively.
21785 Permissible names for this option are the same as those for
21786 @option{-mtune}.
21788 The following extension options are common to the listed CPUs:
21790 @table @samp
21791 @item +nodsp
21792 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}
21793 and @samp{cortex-m55}. Also disable the M-Profile Vector Extension (MVE)
21794 integer and single precision floating-point instructions on @samp{cortex-m55}.
21796 @item +nomve
21797 Disable the M-Profile Vector Extension (MVE) integer and single precision
21798 floating-point instructions on @samp{cortex-m55}.
21800 @item +nomve.fp
21801 Disable the M-Profile Vector Extension (MVE) single precision floating-point
21802 instructions on @samp{cortex-m55}.
21804 @item  +nofp
21805 Disables the floating-point instructions on @samp{arm9e},
21806 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
21807 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
21808 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
21809 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
21810 and @samp{cortex-m55}.
21811 Disables the floating-point and SIMD instructions on
21812 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
21813 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
21814 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
21815 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
21816 @samp{cortex-a53} and @samp{cortex-a55}.
21818 @item +nofp.dp
21819 Disables the double-precision component of the floating-point instructions
21820 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
21821 @samp{cortex-r52plus} and @samp{cortex-m7}.
21823 @item +nosimd
21824 Disables the SIMD (but not floating-point) instructions on
21825 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
21826 and @samp{cortex-a9}.
21828 @item +crypto
21829 Enables the cryptographic instructions on @samp{cortex-a32},
21830 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
21831 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
21832 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
21833 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
21834 @samp{cortex-a75.cortex-a55}.
21835 @end table
21837 Additionally the @samp{generic-armv7-a} pseudo target defaults to
21838 VFPv3 with 16 double-precision registers.  It supports the following
21839 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
21840 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
21841 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
21842 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
21843 the extensions to @option{-march=armv7-a}.
21845 @option{-mcpu=generic-@var{arch}} is also permissible, and is
21846 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
21847 See @option{-mtune} for more information.
21849 @option{-mcpu=native} causes the compiler to auto-detect the CPU
21850 of the build computer.  At present, this feature is only supported on
21851 GNU/Linux, and not all architectures are recognized.  If the auto-detect
21852 is unsuccessful the option has no effect.
21854 @item -mfpu=@var{name}
21855 @opindex mfpu
21856 This specifies what floating-point hardware (or hardware emulation) is
21857 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
21858 @samp{vfpv3},
21859 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
21860 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
21861 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
21862 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
21863 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
21864 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
21865 is an alias for @samp{vfpv2}.
21867 The setting @samp{auto} is the default and is special.  It causes the
21868 compiler to select the floating-point and Advanced SIMD instructions
21869 based on the settings of @option{-mcpu} and @option{-march}.
21871 If the selected floating-point hardware includes the NEON extension
21872 (e.g.@: @option{-mfpu=neon}), note that floating-point
21873 operations are not generated by GCC's auto-vectorization pass unless
21874 @option{-funsafe-math-optimizations} is also specified.  This is
21875 because NEON hardware does not fully implement the IEEE 754 standard for
21876 floating-point arithmetic (in particular denormal values are treated as
21877 zero), so the use of NEON instructions may lead to a loss of precision.
21879 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}).
21881 @item -mfp16-format=@var{name}
21882 @opindex mfp16-format
21883 Specify the format of the @code{__fp16} half-precision floating-point type.
21884 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
21885 the default is @samp{none}, in which case the @code{__fp16} type is not
21886 defined.  @xref{Half-Precision}, for more information.
21888 @item -mstructure-size-boundary=@var{n}
21889 @opindex mstructure-size-boundary
21890 The sizes of all structures and unions are rounded up to a multiple
21891 of the number of bits set by this option.  Permissible values are 8, 32
21892 and 64.  The default value varies for different toolchains.  For the COFF
21893 targeted toolchain the default value is 8.  A value of 64 is only allowed
21894 if the underlying ABI supports it.
21896 Specifying a larger number can produce faster, more efficient code, but
21897 can also increase the size of the program.  Different values are potentially
21898 incompatible.  Code compiled with one value cannot necessarily expect to
21899 work with code or libraries compiled with another value, if they exchange
21900 information using structures or unions.
21902 This option is deprecated.
21904 @item -mabort-on-noreturn
21905 @opindex mabort-on-noreturn
21906 Generate a call to the function @code{abort} at the end of a
21907 @code{noreturn} function.  It is executed if the function tries to
21908 return.
21910 @item -mlong-calls
21911 @itemx -mno-long-calls
21912 @opindex mlong-calls
21913 @opindex mno-long-calls
21914 Tells the compiler to perform function calls by first loading the
21915 address of the function into a register and then performing a subroutine
21916 call on this register.  This switch is needed if the target function
21917 lies outside of the 64-megabyte addressing range of the offset-based
21918 version of subroutine call instruction.
21920 Even if this switch is enabled, not all function calls are turned
21921 into long calls.  The heuristic is that static functions, functions
21922 that have the @code{short_call} attribute, functions that are inside
21923 the scope of a @code{#pragma no_long_calls} directive, and functions whose
21924 definitions have already been compiled within the current compilation
21925 unit are not turned into long calls.  The exceptions to this rule are
21926 that weak function definitions, functions with the @code{long_call}
21927 attribute or the @code{section} attribute, and functions that are within
21928 the scope of a @code{#pragma long_calls} directive are always
21929 turned into long calls.
21931 This feature is not enabled by default.  Specifying
21932 @option{-mno-long-calls} restores the default behavior, as does
21933 placing the function calls within the scope of a @code{#pragma
21934 long_calls_off} directive.  Note these switches have no effect on how
21935 the compiler generates code to handle function calls via function
21936 pointers.
21938 @item -msingle-pic-base
21939 @opindex msingle-pic-base
21940 Treat the register used for PIC addressing as read-only, rather than
21941 loading it in the prologue for each function.  The runtime system is
21942 responsible for initializing this register with an appropriate value
21943 before execution begins.
21945 @item -mpic-register=@var{reg}
21946 @opindex mpic-register
21947 Specify the register to be used for PIC addressing.
21948 For standard PIC base case, the default is any suitable register
21949 determined by compiler.  For single PIC base case, the default is
21950 @samp{R9} if target is EABI based or stack-checking is enabled,
21951 otherwise the default is @samp{R10}.
21953 @item -mpic-data-is-text-relative
21954 @opindex mpic-data-is-text-relative
21955 Assume that the displacement between the text and data segments is fixed
21956 at static link time.  This permits using PC-relative addressing
21957 operations to access data known to be in the data segment.  For
21958 non-VxWorks RTP targets, this option is enabled by default.  When
21959 disabled on such targets, it will enable @option{-msingle-pic-base} by
21960 default.
21962 @item -mpoke-function-name
21963 @opindex mpoke-function-name
21964 Write the name of each function into the text section, directly
21965 preceding the function prologue.  The generated code is similar to this:
21967 @smallexample
21968      t0
21969          .ascii "arm_poke_function_name", 0
21970          .align
21971      t1
21972          .word 0xff000000 + (t1 - t0)
21973      arm_poke_function_name
21974          mov     ip, sp
21975          stmfd   sp!, @{fp, ip, lr, pc@}
21976          sub     fp, ip, #4
21977 @end smallexample
21979 When performing a stack backtrace, code can inspect the value of
21980 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
21981 location @code{pc - 12} and the top 8 bits are set, then we know that
21982 there is a function name embedded immediately preceding this location
21983 and has length @code{((pc[-3]) & 0xff000000)}.
21985 @item -mthumb
21986 @itemx -marm
21987 @opindex marm
21988 @opindex mthumb
21990 Select between generating code that executes in ARM and Thumb
21991 states.  The default for most configurations is to generate code
21992 that executes in ARM state, but the default can be changed by
21993 configuring GCC with the @option{--with-mode=}@var{state}
21994 configure option.
21996 You can also override the ARM and Thumb mode for each function
21997 by using the @code{target("thumb")} and @code{target("arm")} function attributes
21998 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22000 @item -mflip-thumb 
22001 @opindex mflip-thumb
22002 Switch ARM/Thumb modes on alternating functions.
22003 This option is provided for regression testing of mixed Thumb/ARM code
22004 generation, and is not intended for ordinary use in compiling code.
22006 @item -mtpcs-frame
22007 @opindex mtpcs-frame
22008 Generate a stack frame that is compliant with the Thumb Procedure Call
22009 Standard for all non-leaf functions.  (A leaf function is one that does
22010 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
22012 @item -mtpcs-leaf-frame
22013 @opindex mtpcs-leaf-frame
22014 Generate a stack frame that is compliant with the Thumb Procedure Call
22015 Standard for all leaf functions.  (A leaf function is one that does
22016 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
22018 @item -mcallee-super-interworking
22019 @opindex mcallee-super-interworking
22020 Gives all externally visible functions in the file being compiled an ARM
22021 instruction set header which switches to Thumb mode before executing the
22022 rest of the function.  This allows these functions to be called from
22023 non-interworking code.  This option is not valid in AAPCS configurations
22024 because interworking is enabled by default.
22026 @item -mcaller-super-interworking
22027 @opindex mcaller-super-interworking
22028 Allows calls via function pointers (including virtual functions) to
22029 execute correctly regardless of whether the target code has been
22030 compiled for interworking or not.  There is a small overhead in the cost
22031 of executing a function pointer if this option is enabled.  This option
22032 is not valid in AAPCS configurations because interworking is enabled
22033 by default.
22035 @item -mtp=@var{name}
22036 @opindex mtp
22037 Specify the access model for the thread local storage pointer.  The valid
22038 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
22039 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
22040 (supported in the arm6k architecture), and @samp{auto}, which uses the
22041 best available method for the selected processor.  The default setting is
22042 @samp{auto}.
22044 @item -mtls-dialect=@var{dialect}
22045 @opindex mtls-dialect
22046 Specify the dialect to use for accessing thread local storage.  Two
22047 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
22048 @samp{gnu} dialect selects the original GNU scheme for supporting
22049 local and global dynamic TLS models.  The @samp{gnu2} dialect
22050 selects the GNU descriptor scheme, which provides better performance
22051 for shared libraries.  The GNU descriptor scheme is compatible with
22052 the original scheme, but does require new assembler, linker and
22053 library support.  Initial and local exec TLS models are unaffected by
22054 this option and always use the original scheme.
22056 @item -mword-relocations
22057 @opindex mword-relocations
22058 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
22059 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
22060 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
22061 is specified. This option conflicts with @option{-mslow-flash-data}.
22063 @item -mfix-cortex-m3-ldrd
22064 @opindex mfix-cortex-m3-ldrd
22065 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
22066 with overlapping destination and base registers are used.  This option avoids
22067 generating these instructions.  This option is enabled by default when
22068 @option{-mcpu=cortex-m3} is specified.
22070 @item -mfix-cortex-a57-aes-1742098
22071 @itemx -mno-fix-cortex-a57-aes-1742098
22072 @itemx -mfix-cortex-a72-aes-1655431
22073 @itemx -mno-fix-cortex-a72-aes-1655431
22074 Enable (disable) mitigation for an erratum on Cortex-A57 and
22075 Cortex-A72 that affects the AES cryptographic instructions.  This
22076 option is enabled by default when either @option{-mcpu=cortex-a57} or
22077 @option{-mcpu=cortex-a72} is specified.
22079 @item -munaligned-access
22080 @itemx -mno-unaligned-access
22081 @opindex munaligned-access
22082 @opindex mno-unaligned-access
22083 Enables (or disables) reading and writing of 16- and 32- bit values
22084 from addresses that are not 16- or 32- bit aligned.  By default
22085 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
22086 ARMv8-M Baseline architectures, and enabled for all other
22087 architectures.  If unaligned access is not enabled then words in packed
22088 data structures are accessed a byte at a time.
22090 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
22091 generated object file to either true or false, depending upon the
22092 setting of this option.  If unaligned access is enabled then the
22093 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
22094 defined.
22096 @item -mneon-for-64bits
22097 @opindex mneon-for-64bits
22098 This option is deprecated and has no effect.
22100 @item -mslow-flash-data
22101 @opindex mslow-flash-data
22102 Assume loading data from flash is slower than fetching instruction.
22103 Therefore literal load is minimized for better performance.
22104 This option is only supported when compiling for ARMv7 M-profile and
22105 off by default. It conflicts with @option{-mword-relocations}.
22107 @item -masm-syntax-unified
22108 @opindex masm-syntax-unified
22109 Assume inline assembler is using unified asm syntax.  The default is
22110 currently off which implies divided syntax.  This option has no impact
22111 on Thumb2. However, this may change in future releases of GCC.
22112 Divided syntax should be considered deprecated.
22114 @item -mrestrict-it
22115 @opindex mrestrict-it
22116 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
22117 IT blocks can only contain a single 16-bit instruction from a select
22118 set of instructions. This option is on by default for ARMv8-A Thumb mode.
22120 @item -mprint-tune-info
22121 @opindex mprint-tune-info
22122 Print CPU tuning information as comment in assembler file.  This is
22123 an option used only for regression testing of the compiler and not
22124 intended for ordinary use in compiling code.  This option is disabled
22125 by default.
22127 @item -mverbose-cost-dump
22128 @opindex mverbose-cost-dump
22129 Enable verbose cost model dumping in the debug dump files.  This option is
22130 provided for use in debugging the compiler.
22132 @item -mpure-code
22133 @opindex mpure-code
22134 Do not allow constant data to be placed in code sections.
22135 Additionally, when compiling for ELF object format give all text sections the
22136 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
22137 is only available when generating non-pic code for M-profile targets.
22139 @item -mcmse
22140 @opindex mcmse
22141 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
22142 Development Tools Engineering Specification", which can be found on
22143 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
22145 @item -mfix-cmse-cve-2021-35465
22146 @opindex mfix-cmse-cve-2021-35465
22147 Mitigate against a potential security issue with the @code{VLLDM} instruction
22148 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
22149 enabled by default when the option @option{-mcpu=} is used with
22150 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55} or @code{star-mc1}.
22151 The option @option{-mno-fix-cmse-cve-2021-35465} can be used to disable
22152 the mitigation.
22154 @item -mstack-protector-guard=@var{guard}
22155 @itemx -mstack-protector-guard-offset=@var{offset}
22156 @opindex mstack-protector-guard
22157 @opindex mstack-protector-guard-offset
22158 Generate stack protection code using canary at @var{guard}.  Supported
22159 locations are @samp{global} for a global canary or @samp{tls} for a
22160 canary accessible via the TLS register. The option
22161 @option{-mstack-protector-guard-offset=} is for use with
22162 @option{-fstack-protector-guard=tls} and not for use in user-land code.
22164 @item -mfdpic
22165 @itemx -mno-fdpic
22166 @opindex mfdpic
22167 @opindex mno-fdpic
22168 Select the FDPIC ABI, which uses 64-bit function descriptors to
22169 represent pointers to functions.  When the compiler is configured for
22170 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
22171 and implies @option{-fPIE} if none of the PIC/PIE-related options is
22172 provided.  On other targets, it only enables the FDPIC-specific code
22173 generation features, and the user should explicitly provide the
22174 PIC/PIE-related options as needed.
22176 Note that static linking is not supported because it would still
22177 involve the dynamic linker when the program self-relocates.  If such
22178 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
22180 The opposite @option{-mno-fdpic} option is useful (and required) to
22181 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
22182 toolchain as the one used to build the userland programs.
22184 @end table
22186 @node AVR Options
22187 @subsection AVR Options
22188 @cindex AVR Options
22190 These options are defined for AVR implementations:
22192 @table @gcctabopt
22193 @item -mmcu=@var{mcu}
22194 @opindex mmcu
22195 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
22197 The default for this option is@tie{}@samp{avr2}.
22199 GCC supports the following AVR devices and ISAs:
22201 @include avr-mmcu.texi
22203 @item -mabsdata
22204 @opindex mabsdata
22206 Assume that all data in static storage can be accessed by LDS / STS
22207 instructions.  This option has only an effect on reduced Tiny devices like
22208 ATtiny40.  See also the @code{absdata}
22209 @ref{AVR Variable Attributes,variable attribute}.
22211 @item -maccumulate-args
22212 @opindex maccumulate-args
22213 Accumulate outgoing function arguments and acquire/release the needed
22214 stack space for outgoing function arguments once in function
22215 prologue/epilogue.  Without this option, outgoing arguments are pushed
22216 before calling a function and popped afterwards.
22218 Popping the arguments after the function call can be expensive on
22219 AVR so that accumulating the stack space might lead to smaller
22220 executables because arguments need not be removed from the
22221 stack after such a function call.
22223 This option can lead to reduced code size for functions that perform
22224 several calls to functions that get their arguments on the stack like
22225 calls to printf-like functions.
22227 @item -mbranch-cost=@var{cost}
22228 @opindex mbranch-cost
22229 Set the branch costs for conditional branch instructions to
22230 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
22231 integers. The default branch cost is 0.
22233 @item -mcall-prologues
22234 @opindex mcall-prologues
22235 Functions prologues/epilogues are expanded as calls to appropriate
22236 subroutines.  Code size is smaller.
22238 @item -mdouble=@var{bits}
22239 @itemx -mlong-double=@var{bits}
22240 @opindex mdouble
22241 @opindex mlong-double
22242 Set the size (in bits) of the @code{double} or @code{long double} type,
22243 respectively.  Possible values for @var{bits} are 32 and 64.
22244 Whether or not a specific value for @var{bits} is allowed depends on
22245 the @code{--with-double=} and @code{--with-long-double=}
22246 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
22247 and the same applies for the default values of the options.
22249 @item -mgas-isr-prologues
22250 @opindex mgas-isr-prologues
22251 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
22252 instruction supported by GNU Binutils.
22253 If this option is on, the feature can still be disabled for individual
22254 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
22255 function attribute.  This feature is activated per default
22256 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
22257 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
22259 @item -mint8
22260 @opindex mint8
22261 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
22262 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
22263 and @code{long long} is 4 bytes.  Please note that this option does not
22264 conform to the C standards, but it results in smaller code
22265 size.
22267 @item -mmain-is-OS_task
22268 @opindex mmain-is-OS_task
22269 Do not save registers in @code{main}.  The effect is the same like
22270 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
22271 to @code{main}. It is activated per default if optimization is on.
22273 @item -mn-flash=@var{num}
22274 @opindex mn-flash
22275 Assume that the flash memory has a size of 
22276 @var{num} times 64@tie{}KiB.
22278 @item -mno-interrupts
22279 @opindex mno-interrupts
22280 Generated code is not compatible with hardware interrupts.
22281 Code size is smaller.
22283 @item -mrelax
22284 @opindex mrelax
22285 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
22286 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
22287 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
22288 the assembler's command line and the @option{--relax} option to the
22289 linker's command line.
22291 Jump relaxing is performed by the linker because jump offsets are not
22292 known before code is located. Therefore, the assembler code generated by the
22293 compiler is the same, but the instructions in the executable may
22294 differ from instructions in the assembler code.
22296 Relaxing must be turned on if linker stubs are needed, see the
22297 section on @code{EIND} and linker stubs below.
22299 @item -mrmw
22300 @opindex mrmw
22301 Assume that the device supports the Read-Modify-Write
22302 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
22304 @item -mshort-calls
22305 @opindex mshort-calls
22307 Assume that @code{RJMP} and @code{RCALL} can target the whole
22308 program memory.
22310 This option is used internally for multilib selection.  It is
22311 not an optimization option, and you don't need to set it by hand.
22313 @item -msp8
22314 @opindex msp8
22315 Treat the stack pointer register as an 8-bit register,
22316 i.e.@: assume the high byte of the stack pointer is zero.
22317 In general, you don't need to set this option by hand.
22319 This option is used internally by the compiler to select and
22320 build multilibs for architectures @code{avr2} and @code{avr25}.
22321 These architectures mix devices with and without @code{SPH}.
22322 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
22323 the compiler driver adds or removes this option from the compiler
22324 proper's command line, because the compiler then knows if the device
22325 or architecture has an 8-bit stack pointer and thus no @code{SPH}
22326 register or not.
22328 @item -mstrict-X
22329 @opindex mstrict-X
22330 Use address register @code{X} in a way proposed by the hardware.  This means
22331 that @code{X} is only used in indirect, post-increment or
22332 pre-decrement addressing.
22334 Without this option, the @code{X} register may be used in the same way
22335 as @code{Y} or @code{Z} which then is emulated by additional
22336 instructions.  
22337 For example, loading a value with @code{X+const} addressing with a
22338 small non-negative @code{const < 64} to a register @var{Rn} is
22339 performed as
22341 @example
22342 adiw r26, const   ; X += const
22343 ld   @var{Rn}, X        ; @var{Rn} = *X
22344 sbiw r26, const   ; X -= const
22345 @end example
22347 @item -mtiny-stack
22348 @opindex mtiny-stack
22349 Only change the lower 8@tie{}bits of the stack pointer.
22351 @item -mfract-convert-truncate
22352 @opindex mfract-convert-truncate
22353 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
22355 @item -nodevicelib
22356 @opindex nodevicelib
22357 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
22359 @item -nodevicespecs
22360 @opindex nodevicespecs
22361 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
22362 command line.  The user takes responsibility for supplying the sub-processes
22363 like compiler proper, assembler and linker with appropriate command line
22364 options.  This means that the user has to supply her private device specs
22365 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
22366 more need for option @option{-mmcu=@var{mcu}}.
22368 This option can also serve as a replacement for the older way of
22369 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
22370 which contains a folder named @code{device-specs} which contains a specs file named
22371 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
22373 @item -Waddr-space-convert
22374 @opindex Waddr-space-convert
22375 @opindex Wno-addr-space-convert
22376 Warn about conversions between address spaces in the case where the
22377 resulting address space is not contained in the incoming address space.
22379 @item -Wmisspelled-isr
22380 @opindex Wmisspelled-isr
22381 @opindex Wno-misspelled-isr
22382 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
22383 Enabled by default.
22384 @end table
22386 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
22387 @cindex @code{EIND}
22388 Pointers in the implementation are 16@tie{}bits wide.
22389 The address of a function or label is represented as word address so
22390 that indirect jumps and calls can target any code address in the
22391 range of 64@tie{}Ki words.
22393 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
22394 bytes of program memory space, there is a special function register called
22395 @code{EIND} that serves as most significant part of the target address
22396 when @code{EICALL} or @code{EIJMP} instructions are used.
22398 Indirect jumps and calls on these devices are handled as follows by
22399 the compiler and are subject to some limitations:
22401 @itemize @bullet
22403 @item
22404 The compiler never sets @code{EIND}.
22406 @item
22407 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
22408 instructions or might read @code{EIND} directly in order to emulate an
22409 indirect call/jump by means of a @code{RET} instruction.
22411 @item
22412 The compiler assumes that @code{EIND} never changes during the startup
22413 code or during the application. In particular, @code{EIND} is not
22414 saved/restored in function or interrupt service routine
22415 prologue/epilogue.
22417 @item
22418 For indirect calls to functions and computed goto, the linker
22419 generates @emph{stubs}. Stubs are jump pads sometimes also called
22420 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
22421 The stub contains a direct jump to the desired address.
22423 @item
22424 Linker relaxation must be turned on so that the linker generates
22425 the stubs correctly in all situations. See the compiler option
22426 @option{-mrelax} and the linker option @option{--relax}.
22427 There are corner cases where the linker is supposed to generate stubs
22428 but aborts without relaxation and without a helpful error message.
22430 @item
22431 The default linker script is arranged for code with @code{EIND = 0}.
22432 If code is supposed to work for a setup with @code{EIND != 0}, a custom
22433 linker script has to be used in order to place the sections whose
22434 name start with @code{.trampolines} into the segment where @code{EIND}
22435 points to.
22437 @item
22438 The startup code from libgcc never sets @code{EIND}.
22439 Notice that startup code is a blend of code from libgcc and AVR-LibC.
22440 For the impact of AVR-LibC on @code{EIND}, see the
22441 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
22443 @item
22444 It is legitimate for user-specific startup code to set up @code{EIND}
22445 early, for example by means of initialization code located in
22446 section @code{.init3}. Such code runs prior to general startup code
22447 that initializes RAM and calls constructors, but after the bit
22448 of startup code from AVR-LibC that sets @code{EIND} to the segment
22449 where the vector table is located.
22450 @example
22451 #include <avr/io.h>
22453 static void
22454 __attribute__((section(".init3"),naked,used,no_instrument_function))
22455 init3_set_eind (void)
22457   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
22458                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
22460 @end example
22462 @noindent
22463 The @code{__trampolines_start} symbol is defined in the linker script.
22465 @item
22466 Stubs are generated automatically by the linker if
22467 the following two conditions are met:
22468 @itemize @minus
22470 @item The address of a label is taken by means of the @code{gs} modifier
22471 (short for @emph{generate stubs}) like so:
22472 @example
22473 LDI r24, lo8(gs(@var{func}))
22474 LDI r25, hi8(gs(@var{func}))
22475 @end example
22476 @item The final location of that label is in a code segment
22477 @emph{outside} the segment where the stubs are located.
22478 @end itemize
22480 @item
22481 The compiler emits such @code{gs} modifiers for code labels in the
22482 following situations:
22483 @itemize @minus
22484 @item Taking address of a function or code label.
22485 @item Computed goto.
22486 @item If prologue-save function is used, see @option{-mcall-prologues}
22487 command-line option.
22488 @item Switch/case dispatch tables. If you do not want such dispatch
22489 tables you can specify the @option{-fno-jump-tables} command-line option.
22490 @item C and C++ constructors/destructors called during startup/shutdown.
22491 @item If the tools hit a @code{gs()} modifier explained above.
22492 @end itemize
22494 @item
22495 Jumping to non-symbolic addresses like so is @emph{not} supported:
22497 @example
22498 int main (void)
22500     /* Call function at word address 0x2 */
22501     return ((int(*)(void)) 0x2)();
22503 @end example
22505 Instead, a stub has to be set up, i.e.@: the function has to be called
22506 through a symbol (@code{func_4} in the example):
22508 @example
22509 int main (void)
22511     extern int func_4 (void);
22513     /* Call function at byte address 0x4 */
22514     return func_4();
22516 @end example
22518 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
22519 Alternatively, @code{func_4} can be defined in the linker script.
22520 @end itemize
22522 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
22523 @cindex @code{RAMPD}
22524 @cindex @code{RAMPX}
22525 @cindex @code{RAMPY}
22526 @cindex @code{RAMPZ}
22527 Some AVR devices support memories larger than the 64@tie{}KiB range
22528 that can be accessed with 16-bit pointers.  To access memory locations
22529 outside this 64@tie{}KiB range, the content of a @code{RAMP}
22530 register is used as high part of the address:
22531 The @code{X}, @code{Y}, @code{Z} address register is concatenated
22532 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
22533 register, respectively, to get a wide address. Similarly,
22534 @code{RAMPD} is used together with direct addressing.
22536 @itemize
22537 @item
22538 The startup code initializes the @code{RAMP} special function
22539 registers with zero.
22541 @item
22542 If a @ref{AVR Named Address Spaces,named address space} other than
22543 generic or @code{__flash} is used, then @code{RAMPZ} is set
22544 as needed before the operation.
22546 @item
22547 If the device supports RAM larger than 64@tie{}KiB and the compiler
22548 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
22549 is reset to zero after the operation.
22551 @item
22552 If the device comes with a specific @code{RAMP} register, the ISR
22553 prologue/epilogue saves/restores that SFR and initializes it with
22554 zero in case the ISR code might (implicitly) use it.
22556 @item
22557 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
22558 If you use inline assembler to read from locations outside the
22559 16-bit address range and change one of the @code{RAMP} registers,
22560 you must reset it to zero after the access.
22562 @end itemize
22564 @subsubsection AVR Built-in Macros
22566 GCC defines several built-in macros so that the user code can test
22567 for the presence or absence of features.  Almost any of the following
22568 built-in macros are deduced from device capabilities and thus
22569 triggered by the @option{-mmcu=} command-line option.
22571 For even more AVR-specific built-in macros see
22572 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
22574 @table @code
22576 @item __AVR_ARCH__
22577 Build-in macro that resolves to a decimal number that identifies the
22578 architecture and depends on the @option{-mmcu=@var{mcu}} option.
22579 Possible values are:
22581 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
22582 @code{4}, @code{5}, @code{51}, @code{6}
22584 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
22585 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
22587 respectively and
22589 @code{100},
22590 @code{102}, @code{103}, @code{104},
22591 @code{105}, @code{106}, @code{107}
22593 for @var{mcu}=@code{avrtiny},
22594 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
22595 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
22596 If @var{mcu} specifies a device, this built-in macro is set
22597 accordingly. For example, with @option{-mmcu=atmega8} the macro is
22598 defined to @code{4}.
22600 @item __AVR_@var{Device}__
22601 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
22602 the device's name. For example, @option{-mmcu=atmega8} defines the
22603 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
22604 @code{__AVR_ATtiny261A__}, etc.
22606 The built-in macros' names follow
22607 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
22608 the device name as from the AVR user manual. The difference between
22609 @var{Device} in the built-in macro and @var{device} in
22610 @option{-mmcu=@var{device}} is that the latter is always lowercase.
22612 If @var{device} is not a device but only a core architecture like
22613 @samp{avr51}, this macro is not defined.
22615 @item __AVR_DEVICE_NAME__
22616 Setting @option{-mmcu=@var{device}} defines this built-in macro to
22617 the device's name. For example, with @option{-mmcu=atmega8} the macro
22618 is defined to @code{atmega8}.
22620 If @var{device} is not a device but only a core architecture like
22621 @samp{avr51}, this macro is not defined.
22623 @item __AVR_XMEGA__
22624 The device / architecture belongs to the XMEGA family of devices.
22626 @item __AVR_HAVE_ELPM__
22627 The device has the @code{ELPM} instruction.
22629 @item __AVR_HAVE_ELPMX__
22630 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
22631 R@var{n},Z+} instructions.
22633 @item __AVR_HAVE_MOVW__
22634 The device has the @code{MOVW} instruction to perform 16-bit
22635 register-register moves.
22637 @item __AVR_HAVE_LPMX__
22638 The device has the @code{LPM R@var{n},Z} and
22639 @code{LPM R@var{n},Z+} instructions.
22641 @item __AVR_HAVE_MUL__
22642 The device has a hardware multiplier. 
22644 @item __AVR_HAVE_JMP_CALL__
22645 The device has the @code{JMP} and @code{CALL} instructions.
22646 This is the case for devices with more than 8@tie{}KiB of program
22647 memory.
22649 @item __AVR_HAVE_EIJMP_EICALL__
22650 @itemx __AVR_3_BYTE_PC__
22651 The device has the @code{EIJMP} and @code{EICALL} instructions.
22652 This is the case for devices with more than 128@tie{}KiB of program memory.
22653 This also means that the program counter
22654 (PC) is 3@tie{}bytes wide.
22656 @item __AVR_2_BYTE_PC__
22657 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
22658 with up to 128@tie{}KiB of program memory.
22660 @item __AVR_HAVE_8BIT_SP__
22661 @itemx __AVR_HAVE_16BIT_SP__
22662 The stack pointer (SP) register is treated as 8-bit respectively
22663 16-bit register by the compiler.
22664 The definition of these macros is affected by @option{-mtiny-stack}.
22666 @item __AVR_HAVE_SPH__
22667 @itemx __AVR_SP8__
22668 The device has the SPH (high part of stack pointer) special function
22669 register or has an 8-bit stack pointer, respectively.
22670 The definition of these macros is affected by @option{-mmcu=} and
22671 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
22672 by @option{-msp8}.
22674 @item __AVR_HAVE_RAMPD__
22675 @itemx __AVR_HAVE_RAMPX__
22676 @itemx __AVR_HAVE_RAMPY__
22677 @itemx __AVR_HAVE_RAMPZ__
22678 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
22679 @code{RAMPZ} special function register, respectively.
22681 @item __NO_INTERRUPTS__
22682 This macro reflects the @option{-mno-interrupts} command-line option.
22684 @item __AVR_ERRATA_SKIP__
22685 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
22686 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
22687 instructions because of a hardware erratum.  Skip instructions are
22688 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
22689 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
22690 set.
22692 @item __AVR_ISA_RMW__
22693 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
22695 @item __AVR_SFR_OFFSET__=@var{offset}
22696 Instructions that can address I/O special function registers directly
22697 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
22698 address as if addressed by an instruction to access RAM like @code{LD}
22699 or @code{STS}. This offset depends on the device architecture and has
22700 to be subtracted from the RAM address in order to get the
22701 respective I/O@tie{}address.
22703 @item __AVR_SHORT_CALLS__
22704 The @option{-mshort-calls} command line option is set.
22706 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
22707 Some devices support reading from flash memory by means of @code{LD*}
22708 instructions.  The flash memory is seen in the data address space
22709 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
22710 is not defined, this feature is not available.  If defined,
22711 the address space is linear and there is no need to put
22712 @code{.rodata} into RAM.  This is handled by the default linker
22713 description file, and is currently available for
22714 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
22715 there is no need to use address spaces like @code{__flash} or
22716 features like attribute @code{progmem} and @code{pgm_read_*}.
22718 @item __WITH_AVRLIBC__
22719 The compiler is configured to be used together with AVR-Libc.
22720 See the @option{--with-avrlibc} configure option.
22722 @item __HAVE_DOUBLE_MULTILIB__
22723 Defined if @option{-mdouble=} acts as a multilib option.
22725 @item __HAVE_DOUBLE32__
22726 @itemx __HAVE_DOUBLE64__
22727 Defined if the compiler supports 32-bit double resp. 64-bit double.
22728 The actual layout is specified by option @option{-mdouble=}.
22730 @item __DEFAULT_DOUBLE__
22731 The size in bits of @code{double} if @option{-mdouble=} is not set.
22732 To test the layout of @code{double} in a program, use the built-in
22733 macro @code{__SIZEOF_DOUBLE__}.
22735 @item __HAVE_LONG_DOUBLE32__
22736 @itemx __HAVE_LONG_DOUBLE64__
22737 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
22738 @itemx __DEFAULT_LONG_DOUBLE__
22739 Same as above, but for @code{long double} instead of @code{double}.
22741 @item __WITH_DOUBLE_COMPARISON__
22742 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
22743 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
22744 and is defined to @code{2} or @code{3}.
22746 @item __WITH_LIBF7_LIBGCC__
22747 @itemx __WITH_LIBF7_MATH__
22748 @itemx __WITH_LIBF7_MATH_SYMBOLS__
22749 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
22750 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
22752 @end table
22754 @node Blackfin Options
22755 @subsection Blackfin Options
22756 @cindex Blackfin Options
22758 @table @gcctabopt
22759 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
22760 @opindex mcpu=
22761 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
22762 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
22763 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
22764 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
22765 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
22766 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
22767 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
22768 @samp{bf561}, @samp{bf592}.
22770 The optional @var{sirevision} specifies the silicon revision of the target
22771 Blackfin processor.  Any workarounds available for the targeted silicon revision
22772 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
22773 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
22774 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
22775 hexadecimal digits representing the major and minor numbers in the silicon
22776 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
22777 is not defined.  If @var{sirevision} is @samp{any}, the
22778 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
22779 If this optional @var{sirevision} is not used, GCC assumes the latest known
22780 silicon revision of the targeted Blackfin processor.
22782 GCC defines a preprocessor macro for the specified @var{cpu}.
22783 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
22784 provided by libgloss to be linked in if @option{-msim} is not given.
22786 Without this option, @samp{bf532} is used as the processor by default.
22788 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
22789 only the preprocessor macro is defined.
22791 @item -msim
22792 @opindex msim
22793 Specifies that the program will be run on the simulator.  This causes
22794 the simulator BSP provided by libgloss to be linked in.  This option
22795 has effect only for @samp{bfin-elf} toolchain.
22796 Certain other options, such as @option{-mid-shared-library} and
22797 @option{-mfdpic}, imply @option{-msim}.
22799 @item -momit-leaf-frame-pointer
22800 @opindex momit-leaf-frame-pointer
22801 Don't keep the frame pointer in a register for leaf functions.  This
22802 avoids the instructions to save, set up and restore frame pointers and
22803 makes an extra register available in leaf functions.
22805 @item -mspecld-anomaly
22806 @opindex mspecld-anomaly
22807 When enabled, the compiler ensures that the generated code does not
22808 contain speculative loads after jump instructions. If this option is used,
22809 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
22811 @item -mno-specld-anomaly
22812 @opindex mno-specld-anomaly
22813 @opindex mspecld-anomaly
22814 Don't generate extra code to prevent speculative loads from occurring.
22816 @item -mcsync-anomaly
22817 @opindex mcsync-anomaly
22818 When enabled, the compiler ensures that the generated code does not
22819 contain CSYNC or SSYNC instructions too soon after conditional branches.
22820 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
22822 @item -mno-csync-anomaly
22823 @opindex mno-csync-anomaly
22824 @opindex mcsync-anomaly
22825 Don't generate extra code to prevent CSYNC or SSYNC instructions from
22826 occurring too soon after a conditional branch.
22828 @item -mlow64k
22829 @opindex mlow64k
22830 When enabled, the compiler is free to take advantage of the knowledge that
22831 the entire program fits into the low 64k of memory.
22833 @item -mno-low64k
22834 @opindex mno-low64k
22835 Assume that the program is arbitrarily large.  This is the default.
22837 @item -mstack-check-l1
22838 @opindex mstack-check-l1
22839 Do stack checking using information placed into L1 scratchpad memory by the
22840 uClinux kernel.
22842 @item -mid-shared-library
22843 @opindex mid-shared-library
22844 Generate code that supports shared libraries via the library ID method.
22845 This allows for execute in place and shared libraries in an environment
22846 without virtual memory management.  This option implies @option{-fPIC}.
22847 With a @samp{bfin-elf} target, this option implies @option{-msim}.
22849 @item -mno-id-shared-library
22850 @opindex mno-id-shared-library
22851 @opindex mid-shared-library
22852 Generate code that doesn't assume ID-based shared libraries are being used.
22853 This is the default.
22855 @item -mleaf-id-shared-library
22856 @opindex mleaf-id-shared-library
22857 Generate code that supports shared libraries via the library ID method,
22858 but assumes that this library or executable won't link against any other
22859 ID shared libraries.  That allows the compiler to use faster code for jumps
22860 and calls.
22862 @item -mno-leaf-id-shared-library
22863 @opindex mno-leaf-id-shared-library
22864 @opindex mleaf-id-shared-library
22865 Do not assume that the code being compiled won't link against any ID shared
22866 libraries.  Slower code is generated for jump and call insns.
22868 @item -mshared-library-id=n
22869 @opindex mshared-library-id
22870 Specifies the identification number of the ID-based shared library being
22871 compiled.  Specifying a value of 0 generates more compact code; specifying
22872 other values forces the allocation of that number to the current
22873 library but is no more space- or time-efficient than omitting this option.
22875 @item -msep-data
22876 @opindex msep-data
22877 Generate code that allows the data segment to be located in a different
22878 area of memory from the text segment.  This allows for execute in place in
22879 an environment without virtual memory management by eliminating relocations
22880 against the text section.
22882 @item -mno-sep-data
22883 @opindex mno-sep-data
22884 @opindex msep-data
22885 Generate code that assumes that the data segment follows the text segment.
22886 This is the default.
22888 @item -mlong-calls
22889 @itemx -mno-long-calls
22890 @opindex mlong-calls
22891 @opindex mno-long-calls
22892 Tells the compiler to perform function calls by first loading the
22893 address of the function into a register and then performing a subroutine
22894 call on this register.  This switch is needed if the target function
22895 lies outside of the 24-bit addressing range of the offset-based
22896 version of subroutine call instruction.
22898 This feature is not enabled by default.  Specifying
22899 @option{-mno-long-calls} restores the default behavior.  Note these
22900 switches have no effect on how the compiler generates code to handle
22901 function calls via function pointers.
22903 @item -mfast-fp
22904 @opindex mfast-fp
22905 Link with the fast floating-point library. This library relaxes some of
22906 the IEEE floating-point standard's rules for checking inputs against
22907 Not-a-Number (NAN), in the interest of performance.
22909 @item -minline-plt
22910 @opindex minline-plt
22911 Enable inlining of PLT entries in function calls to functions that are
22912 not known to bind locally.  It has no effect without @option{-mfdpic}.
22914 @item -mmulticore
22915 @opindex mmulticore
22916 Build a standalone application for multicore Blackfin processors. 
22917 This option causes proper start files and link scripts supporting 
22918 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
22919 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
22921 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
22922 selects the one-application-per-core programming model.  Without
22923 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
22924 programming model is used. In this model, the main function of Core B
22925 should be named as @code{coreb_main}.
22927 If this option is not used, the single-core application programming
22928 model is used.
22930 @item -mcorea
22931 @opindex mcorea
22932 Build a standalone application for Core A of BF561 when using
22933 the one-application-per-core programming model. Proper start files
22934 and link scripts are used to support Core A, and the macro
22935 @code{__BFIN_COREA} is defined.
22936 This option can only be used in conjunction with @option{-mmulticore}.
22938 @item -mcoreb
22939 @opindex mcoreb
22940 Build a standalone application for Core B of BF561 when using
22941 the one-application-per-core programming model. Proper start files
22942 and link scripts are used to support Core B, and the macro
22943 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
22944 should be used instead of @code{main}. 
22945 This option can only be used in conjunction with @option{-mmulticore}.
22947 @item -msdram
22948 @opindex msdram
22949 Build a standalone application for SDRAM. Proper start files and
22950 link scripts are used to put the application into SDRAM, and the macro
22951 @code{__BFIN_SDRAM} is defined.
22952 The loader should initialize SDRAM before loading the application.
22954 @item -micplb
22955 @opindex micplb
22956 Assume that ICPLBs are enabled at run time.  This has an effect on certain
22957 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
22958 are enabled; for standalone applications the default is off.
22959 @end table
22961 @node C6X Options
22962 @subsection C6X Options
22963 @cindex C6X Options
22965 @table @gcctabopt
22966 @item -march=@var{name}
22967 @opindex march
22968 This specifies the name of the target architecture.  GCC uses this
22969 name to determine what kind of instructions it can emit when generating
22970 assembly code.  Permissible names are: @samp{c62x},
22971 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
22973 @item -mbig-endian
22974 @opindex mbig-endian
22975 Generate code for a big-endian target.
22977 @item -mlittle-endian
22978 @opindex mlittle-endian
22979 Generate code for a little-endian target.  This is the default.
22981 @item -msim
22982 @opindex msim
22983 Choose startup files and linker script suitable for the simulator.
22985 @item -msdata=default
22986 @opindex msdata=default
22987 Put small global and static data in the @code{.neardata} section,
22988 which is pointed to by register @code{B14}.  Put small uninitialized
22989 global and static data in the @code{.bss} section, which is adjacent
22990 to the @code{.neardata} section.  Put small read-only data into the
22991 @code{.rodata} section.  The corresponding sections used for large
22992 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
22994 @item -msdata=all
22995 @opindex msdata=all
22996 Put all data, not just small objects, into the sections reserved for
22997 small data, and use addressing relative to the @code{B14} register to
22998 access them.
23000 @item -msdata=none
23001 @opindex msdata=none
23002 Make no use of the sections reserved for small data, and use absolute
23003 addresses to access all data.  Put all initialized global and static
23004 data in the @code{.fardata} section, and all uninitialized data in the
23005 @code{.far} section.  Put all constant data into the @code{.const}
23006 section.
23007 @end table
23009 @node CRIS Options
23010 @subsection CRIS Options
23011 @cindex CRIS Options
23013 These options are defined specifically for the CRIS ports.
23015 @table @gcctabopt
23016 @item -march=@var{architecture-type}
23017 @itemx -mcpu=@var{architecture-type}
23018 @opindex march
23019 @opindex mcpu
23020 Generate code for the specified architecture.  The choices for
23021 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
23022 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
23023 Default is @samp{v0}.
23025 @item -mtune=@var{architecture-type}
23026 @opindex mtune
23027 Tune to @var{architecture-type} everything applicable about the generated
23028 code, except for the ABI and the set of available instructions.  The
23029 choices for @var{architecture-type} are the same as for
23030 @option{-march=@var{architecture-type}}.
23032 @item -mmax-stack-frame=@var{n}
23033 @opindex mmax-stack-frame
23034 Warn when the stack frame of a function exceeds @var{n} bytes.
23036 @item -metrax4
23037 @itemx -metrax100
23038 @opindex metrax4
23039 @opindex metrax100
23040 The options @option{-metrax4} and @option{-metrax100} are synonyms for
23041 @option{-march=v3} and @option{-march=v8} respectively.
23043 @item -mmul-bug-workaround
23044 @itemx -mno-mul-bug-workaround
23045 @opindex mmul-bug-workaround
23046 @opindex mno-mul-bug-workaround
23047 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
23048 models where it applies.  This option is disabled by default.
23050 @item -mpdebug
23051 @opindex mpdebug
23052 Enable CRIS-specific verbose debug-related information in the assembly
23053 code.  This option also has the effect of turning off the @samp{#NO_APP}
23054 formatted-code indicator to the assembler at the beginning of the
23055 assembly file.
23057 @item -mcc-init
23058 @opindex mcc-init
23059 Do not use condition-code results from previous instruction; always emit
23060 compare and test instructions before use of condition codes.
23062 @item -mno-side-effects
23063 @opindex mno-side-effects
23064 @opindex mside-effects
23065 Do not emit instructions with side effects in addressing modes other than
23066 post-increment.
23068 @item -mstack-align
23069 @itemx -mno-stack-align
23070 @itemx -mdata-align
23071 @itemx -mno-data-align
23072 @itemx -mconst-align
23073 @itemx -mno-const-align
23074 @opindex mstack-align
23075 @opindex mno-stack-align
23076 @opindex mdata-align
23077 @opindex mno-data-align
23078 @opindex mconst-align
23079 @opindex mno-const-align
23080 These options (@samp{no-} options) arrange (eliminate arrangements) for the
23081 stack frame, individual data and constants to be aligned for the maximum
23082 single data access size for the chosen CPU model.  The default is to
23083 arrange for 32-bit alignment.  ABI details such as structure layout are
23084 not affected by these options.
23086 @item -m32-bit
23087 @itemx -m16-bit
23088 @itemx -m8-bit
23089 @opindex m32-bit
23090 @opindex m16-bit
23091 @opindex m8-bit
23092 Similar to the stack- data- and const-align options above, these options
23093 arrange for stack frame, writable data and constants to all be 32-bit,
23094 16-bit or 8-bit aligned.  The default is 32-bit alignment.
23096 @item -mno-prologue-epilogue
23097 @itemx -mprologue-epilogue
23098 @opindex mno-prologue-epilogue
23099 @opindex mprologue-epilogue
23100 With @option{-mno-prologue-epilogue}, the normal function prologue and
23101 epilogue which set up the stack frame are omitted and no return
23102 instructions or return sequences are generated in the code.  Use this
23103 option only together with visual inspection of the compiled code: no
23104 warnings or errors are generated when call-saved registers must be saved,
23105 or storage for local variables needs to be allocated.
23107 @item -melf
23108 @opindex melf
23109 Legacy no-op option.
23111 @item -sim
23112 @opindex sim
23113 This option arranges
23114 to link with input-output functions from a simulator library.  Code,
23115 initialized data and zero-initialized data are allocated consecutively.
23117 @item -sim2
23118 @opindex sim2
23119 Like @option{-sim}, but pass linker options to locate initialized data at
23120 0x40000000 and zero-initialized data at 0x80000000.
23121 @end table
23123 @node C-SKY Options
23124 @subsection C-SKY Options
23125 @cindex C-SKY Options
23127 GCC supports these options when compiling for C-SKY V2 processors.
23129 @table @gcctabopt
23131 @item -march=@var{arch}
23132 @opindex march=
23133 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
23134 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
23135 The default is @samp{ck810}.
23137 @item -mcpu=@var{cpu}
23138 @opindex mcpu=
23139 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
23140 @samp{ck801}, @samp{ck801t},
23141 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
23142 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
23143 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
23144 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
23145 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
23146 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
23147 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
23148 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
23149 @samp{ck803eftr1}, @samp{ck803efhtr1},
23150 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
23151 @samp{ck803sef}, @samp{ck803seft},
23152 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
23153 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
23154 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
23155 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
23157 @item -mbig-endian
23158 @opindex mbig-endian
23159 @itemx -EB
23160 @opindex EB
23161 @itemx -mlittle-endian
23162 @opindex mlittle-endian
23163 @itemx -EL
23164 @opindex EL
23166 Select big- or little-endian code.  The default is little-endian.
23168 @item -mfloat-abi=@var{name}
23169 @opindex mfloat-abi
23170 Specifies which floating-point ABI to use.  Permissible values
23171 are: @samp{soft}, @samp{softfp} and @samp{hard}.
23173 Specifying @samp{soft} causes GCC to generate output containing
23174 library calls for floating-point operations.
23175 @samp{softfp} allows the generation of code using hardware floating-point
23176 instructions, but still uses the soft-float calling conventions.
23177 @samp{hard} allows generation of floating-point instructions
23178 and uses FPU-specific calling conventions.
23180 The default depends on the specific target configuration.  Note that
23181 the hard-float and soft-float ABIs are not link-compatible; you must
23182 compile your entire program with the same ABI, and link with a
23183 compatible set of libraries.
23185 @item -mhard-float
23186 @opindex mhard-float
23187 @itemx -msoft-float
23188 @opindex msoft-float
23190 Select hardware or software floating-point implementations.
23191 The default is soft float.
23193 @item -mdouble-float
23194 @itemx -mno-double-float
23195 @opindex mdouble-float
23196 When @option{-mhard-float} is in effect, enable generation of
23197 double-precision float instructions.  This is the default except
23198 when compiling for CK803.
23200 @item -mfdivdu
23201 @itemx -mno-fdivdu
23202 @opindex mfdivdu
23203 When @option{-mhard-float} is in effect, enable generation of
23204 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
23205 This is the default except when compiling for CK803.
23207 @item -mfpu=@var{fpu}
23208 @opindex mfpu=
23209 Select the floating-point processor.  This option can only be used with
23210 @option{-mhard-float}.
23211 Values for @var{fpu} are
23212 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
23213 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
23214 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
23216 @item -melrw
23217 @itemx -mno-elrw
23218 @opindex melrw
23219 Enable the extended @code{lrw} instruction.  This option defaults to on
23220 for CK801 and off otherwise.
23222 @item -mistack
23223 @itemx -mno-istack
23224 @opindex mistack
23225 Enable interrupt stack instructions; the default is off.
23227 The @option{-mistack} option is required to handle the
23228 @code{interrupt} and @code{isr} function attributes
23229 (@pxref{C-SKY Function Attributes}).
23231 @item -mmp
23232 @opindex mmp
23233 Enable multiprocessor instructions; the default is off.
23235 @item -mcp
23236 @opindex mcp
23237 Enable coprocessor instructions; the default is off.
23239 @item -mcache
23240 @opindex mcache
23241 Enable coprocessor instructions; the default is off.
23243 @item -msecurity
23244 @opindex msecurity
23245 Enable C-SKY security instructions; the default is off.
23247 @item -mtrust
23248 @opindex mtrust
23249 Enable C-SKY trust instructions; the default is off.
23251 @item -mdsp
23252 @opindex mdsp
23253 @itemx -medsp
23254 @opindex medsp
23255 @itemx -mvdsp
23256 @opindex mvdsp
23257 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
23258 All of these options default to off.
23260 @item -mdiv
23261 @itemx -mno-div
23262 @opindex mdiv
23263 Generate divide instructions.  Default is off.
23265 @item -msmart
23266 @itemx -mno-smart
23267 @opindex msmart
23268 Generate code for Smart Mode, using only registers numbered 0-7 to allow
23269 use of 16-bit instructions.  This option is ignored for CK801 where this
23270 is the required behavior, and it defaults to on for CK802.
23271 For other targets, the default is off.
23273 @item -mhigh-registers
23274 @itemx -mno-high-registers
23275 @opindex mhigh-registers
23276 Generate code using the high registers numbered 16-31.  This option
23277 is not supported on CK801, CK802, or CK803, and is enabled by default
23278 for other processors.
23280 @item -manchor
23281 @itemx -mno-anchor
23282 @opindex manchor
23283 Generate code using global anchor symbol addresses.
23285 @item -mpushpop
23286 @itemx -mno-pushpop
23287 @opindex mpushpop
23288 Generate code using @code{push} and @code{pop} instructions.  This option
23289 defaults to on.
23291 @item -mmultiple-stld
23292 @itemx -mstm
23293 @itemx -mno-multiple-stld
23294 @itemx -mno-stm
23295 @opindex mmultiple-stld
23296 Generate code using @code{stm} and @code{ldm} instructions.  This option
23297 isn't supported on CK801 but is enabled by default on other processors.
23299 @item -mconstpool
23300 @itemx -mno-constpool
23301 @opindex mconstpool
23302 Create constant pools in the compiler instead of deferring it to the
23303 assembler.  This option is the default and required for correct code
23304 generation on CK801 and CK802, and is optional on other processors.
23306 @item -mstack-size
23307 @item -mno-stack-size
23308 @opindex mstack-size
23309 Emit @code{.stack_size} directives for each function in the assembly
23310 output.  This option defaults to off.
23312 @item -mccrt
23313 @itemx -mno-ccrt
23314 @opindex mccrt
23315 Generate code for the C-SKY compiler runtime instead of libgcc.  This
23316 option defaults to off.
23318 @item -mbranch-cost=@var{n}
23319 @opindex mbranch-cost=
23320 Set the branch costs to roughly @code{n} instructions.  The default is 1.
23322 @item -msched-prolog
23323 @itemx -mno-sched-prolog
23324 @opindex msched-prolog
23325 Permit scheduling of function prologue and epilogue sequences.  Using
23326 this option can result in code that is not compliant with the C-SKY V2 ABI
23327 prologue requirements and that cannot be debugged or backtraced.
23328 It is disabled by default.
23330 @item -msim
23331 @opindex msim
23332 Links the library libsemi.a which is in compatible with simulator. Applicable
23333 to ELF compiler only.
23335 @end table
23337 @node Darwin Options
23338 @subsection Darwin Options
23339 @cindex Darwin options
23341 These options are defined for all architectures running the Darwin operating
23342 system.
23344 FSF GCC on Darwin does not create ``fat'' object files; it creates
23345 an object file for the single architecture that GCC was built to
23346 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
23347 @option{-arch} options are used; it does so by running the compiler or
23348 linker multiple times and joining the results together with
23349 @file{lipo}.
23351 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
23352 @samp{i686}) is determined by the flags that specify the ISA
23353 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
23354 @option{-force_cpusubtype_ALL} option can be used to override this.
23356 The Darwin tools vary in their behavior when presented with an ISA
23357 mismatch.  The assembler, @file{as}, only permits instructions to
23358 be used that are valid for the subtype of the file it is generating,
23359 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
23360 The linker for shared libraries, @file{/usr/bin/libtool}, fails
23361 and prints an error if asked to create a shared library with a less
23362 restrictive subtype than its input files (for instance, trying to put
23363 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
23364 for executables, @command{ld}, quietly gives the executable the most
23365 restrictive subtype of any of its input files.
23367 @table @gcctabopt
23368 @item -F@var{dir}
23369 @opindex F
23370 Add the framework directory @var{dir} to the head of the list of
23371 directories to be searched for header files.  These directories are
23372 interleaved with those specified by @option{-I} options and are
23373 scanned in a left-to-right order.
23375 A framework directory is a directory with frameworks in it.  A
23376 framework is a directory with a @file{Headers} and/or
23377 @file{PrivateHeaders} directory contained directly in it that ends
23378 in @file{.framework}.  The name of a framework is the name of this
23379 directory excluding the @file{.framework}.  Headers associated with
23380 the framework are found in one of those two directories, with
23381 @file{Headers} being searched first.  A subframework is a framework
23382 directory that is in a framework's @file{Frameworks} directory.
23383 Includes of subframework headers can only appear in a header of a
23384 framework that contains the subframework, or in a sibling subframework
23385 header.  Two subframeworks are siblings if they occur in the same
23386 framework.  A subframework should not have the same name as a
23387 framework; a warning is issued if this is violated.  Currently a
23388 subframework cannot have subframeworks; in the future, the mechanism
23389 may be extended to support this.  The standard frameworks can be found
23390 in @file{/System/Library/Frameworks} and
23391 @file{/Library/Frameworks}.  An example include looks like
23392 @code{#include <Framework/header.h>}, where @file{Framework} denotes
23393 the name of the framework and @file{header.h} is found in the
23394 @file{PrivateHeaders} or @file{Headers} directory.
23396 @item -iframework@var{dir}
23397 @opindex iframework
23398 Like @option{-F} except the directory is a treated as a system
23399 directory.  The main difference between this @option{-iframework} and
23400 @option{-F} is that with @option{-iframework} the compiler does not
23401 warn about constructs contained within header files found via
23402 @var{dir}.  This option is valid only for the C family of languages.
23404 @item -gused
23405 @opindex gused
23406 Emit debugging information for symbols that are used.  For stabs
23407 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
23408 This is by default ON@.
23410 @item -gfull
23411 @opindex gfull
23412 Emit debugging information for all symbols and types.
23414 @item -mmacosx-version-min=@var{version}
23415 The earliest version of MacOS X that this executable will run on
23416 is @var{version}.  Typical values of @var{version} include @code{10.1},
23417 @code{10.2}, and @code{10.3.9}.
23419 If the compiler was built to use the system's headers by default,
23420 then the default for this option is the system version on which the
23421 compiler is running, otherwise the default is to make choices that
23422 are compatible with as many systems and code bases as possible.
23424 @item -mkernel
23425 @opindex mkernel
23426 Enable kernel development mode.  The @option{-mkernel} option sets
23427 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
23428 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
23429 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
23430 applicable.  This mode also sets @option{-mno-altivec},
23431 @option{-msoft-float}, @option{-fno-builtin} and
23432 @option{-mlong-branch} for PowerPC targets.
23434 @item -mone-byte-bool
23435 @opindex mone-byte-bool
23436 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
23437 By default @code{sizeof(bool)} is @code{4} when compiling for
23438 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
23439 option has no effect on x86.
23441 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
23442 to generate code that is not binary compatible with code generated
23443 without that switch.  Using this switch may require recompiling all
23444 other modules in a program, including system libraries.  Use this
23445 switch to conform to a non-default data model.
23447 @item -mfix-and-continue
23448 @itemx -ffix-and-continue
23449 @itemx -findirect-data
23450 @opindex mfix-and-continue
23451 @opindex ffix-and-continue
23452 @opindex findirect-data
23453 Generate code suitable for fast turnaround development, such as to
23454 allow GDB to dynamically load @file{.o} files into already-running
23455 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
23456 are provided for backwards compatibility.
23458 @item -all_load
23459 @opindex all_load
23460 Loads all members of static archive libraries.
23461 See man ld(1) for more information.
23463 @item -arch_errors_fatal
23464 @opindex arch_errors_fatal
23465 Cause the errors having to do with files that have the wrong architecture
23466 to be fatal.
23468 @item -bind_at_load
23469 @opindex bind_at_load
23470 Causes the output file to be marked such that the dynamic linker will
23471 bind all undefined references when the file is loaded or launched.
23473 @item -bundle
23474 @opindex bundle
23475 Produce a Mach-o bundle format file.
23476 See man ld(1) for more information.
23478 @item -bundle_loader @var{executable}
23479 @opindex bundle_loader
23480 This option specifies the @var{executable} that will load the build
23481 output file being linked.  See man ld(1) for more information.
23483 @item -dynamiclib
23484 @opindex dynamiclib
23485 When passed this option, GCC produces a dynamic library instead of
23486 an executable when linking, using the Darwin @file{libtool} command.
23488 @item -force_cpusubtype_ALL
23489 @opindex force_cpusubtype_ALL
23490 This causes GCC's output file to have the @samp{ALL} subtype, instead of
23491 one controlled by the @option{-mcpu} or @option{-march} option.
23493 @item -allowable_client  @var{client_name}
23494 @itemx -client_name
23495 @itemx -compatibility_version
23496 @itemx -current_version
23497 @itemx -dead_strip
23498 @itemx -dependency-file
23499 @itemx -dylib_file
23500 @itemx -dylinker_install_name
23501 @itemx -dynamic
23502 @itemx -exported_symbols_list
23503 @itemx -filelist
23504 @need 800
23505 @itemx -flat_namespace
23506 @itemx -force_flat_namespace
23507 @itemx -headerpad_max_install_names
23508 @itemx -image_base
23509 @itemx -init
23510 @itemx -install_name
23511 @itemx -keep_private_externs
23512 @itemx -multi_module
23513 @itemx -multiply_defined
23514 @itemx -multiply_defined_unused
23515 @need 800
23516 @itemx -noall_load
23517 @itemx -no_dead_strip_inits_and_terms
23518 @itemx -nofixprebinding
23519 @itemx -nomultidefs
23520 @itemx -noprebind
23521 @itemx -noseglinkedit
23522 @itemx -pagezero_size
23523 @itemx -prebind
23524 @itemx -prebind_all_twolevel_modules
23525 @itemx -private_bundle
23526 @need 800
23527 @itemx -read_only_relocs
23528 @itemx -sectalign
23529 @itemx -sectobjectsymbols
23530 @itemx -whyload
23531 @itemx -seg1addr
23532 @itemx -sectcreate
23533 @itemx -sectobjectsymbols
23534 @itemx -sectorder
23535 @itemx -segaddr
23536 @itemx -segs_read_only_addr
23537 @need 800
23538 @itemx -segs_read_write_addr
23539 @itemx -seg_addr_table
23540 @itemx -seg_addr_table_filename
23541 @itemx -seglinkedit
23542 @itemx -segprot
23543 @itemx -segs_read_only_addr
23544 @itemx -segs_read_write_addr
23545 @itemx -single_module
23546 @itemx -static
23547 @itemx -sub_library
23548 @need 800
23549 @itemx -sub_umbrella
23550 @itemx -twolevel_namespace
23551 @itemx -umbrella
23552 @itemx -undefined
23553 @itemx -unexported_symbols_list
23554 @itemx -weak_reference_mismatches
23555 @itemx -whatsloaded
23556 @opindex allowable_client
23557 @opindex client_name
23558 @opindex compatibility_version
23559 @opindex current_version
23560 @opindex dead_strip
23561 @opindex dependency-file
23562 @opindex dylib_file
23563 @opindex dylinker_install_name
23564 @opindex dynamic
23565 @opindex exported_symbols_list
23566 @opindex filelist
23567 @opindex flat_namespace
23568 @opindex force_flat_namespace
23569 @opindex headerpad_max_install_names
23570 @opindex image_base
23571 @opindex init
23572 @opindex install_name
23573 @opindex keep_private_externs
23574 @opindex multi_module
23575 @opindex multiply_defined
23576 @opindex multiply_defined_unused
23577 @opindex noall_load
23578 @opindex no_dead_strip_inits_and_terms
23579 @opindex nofixprebinding
23580 @opindex nomultidefs
23581 @opindex noprebind
23582 @opindex noseglinkedit
23583 @opindex pagezero_size
23584 @opindex prebind
23585 @opindex prebind_all_twolevel_modules
23586 @opindex private_bundle
23587 @opindex read_only_relocs
23588 @opindex sectalign
23589 @opindex sectobjectsymbols
23590 @opindex whyload
23591 @opindex seg1addr
23592 @opindex sectcreate
23593 @opindex sectobjectsymbols
23594 @opindex sectorder
23595 @opindex segaddr
23596 @opindex segs_read_only_addr
23597 @opindex segs_read_write_addr
23598 @opindex seg_addr_table
23599 @opindex seg_addr_table_filename
23600 @opindex seglinkedit
23601 @opindex segprot
23602 @opindex segs_read_only_addr
23603 @opindex segs_read_write_addr
23604 @opindex single_module
23605 @opindex static
23606 @opindex sub_library
23607 @opindex sub_umbrella
23608 @opindex twolevel_namespace
23609 @opindex umbrella
23610 @opindex undefined
23611 @opindex unexported_symbols_list
23612 @opindex weak_reference_mismatches
23613 @opindex whatsloaded
23614 These options are passed to the Darwin linker.  The Darwin linker man page
23615 describes them in detail.
23616 @end table
23618 @node DEC Alpha Options
23619 @subsection DEC Alpha Options
23621 These @samp{-m} options are defined for the DEC Alpha implementations:
23623 @table @gcctabopt
23624 @item -mno-soft-float
23625 @itemx -msoft-float
23626 @opindex mno-soft-float
23627 @opindex msoft-float
23628 Use (do not use) the hardware floating-point instructions for
23629 floating-point operations.  When @option{-msoft-float} is specified,
23630 functions in @file{libgcc.a} are used to perform floating-point
23631 operations.  Unless they are replaced by routines that emulate the
23632 floating-point operations, or compiled in such a way as to call such
23633 emulations routines, these routines issue floating-point
23634 operations.   If you are compiling for an Alpha without floating-point
23635 operations, you must ensure that the library is built so as not to call
23636 them.
23638 Note that Alpha implementations without floating-point operations are
23639 required to have floating-point registers.
23641 @item -mfp-reg
23642 @itemx -mno-fp-regs
23643 @opindex mfp-reg
23644 @opindex mno-fp-regs
23645 Generate code that uses (does not use) the floating-point register set.
23646 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
23647 register set is not used, floating-point operands are passed in integer
23648 registers as if they were integers and floating-point results are passed
23649 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
23650 so any function with a floating-point argument or return value called by code
23651 compiled with @option{-mno-fp-regs} must also be compiled with that
23652 option.
23654 A typical use of this option is building a kernel that does not use,
23655 and hence need not save and restore, any floating-point registers.
23657 @item -mieee
23658 @opindex mieee
23659 The Alpha architecture implements floating-point hardware optimized for
23660 maximum performance.  It is mostly compliant with the IEEE floating-point
23661 standard.  However, for full compliance, software assistance is
23662 required.  This option generates code fully IEEE-compliant code
23663 @emph{except} that the @var{inexact-flag} is not maintained (see below).
23664 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
23665 defined during compilation.  The resulting code is less efficient but is
23666 able to correctly support denormalized numbers and exceptional IEEE
23667 values such as not-a-number and plus/minus infinity.  Other Alpha
23668 compilers call this option @option{-ieee_with_no_inexact}.
23670 @item -mieee-with-inexact
23671 @opindex mieee-with-inexact
23672 This is like @option{-mieee} except the generated code also maintains
23673 the IEEE @var{inexact-flag}.  Turning on this option causes the
23674 generated code to implement fully-compliant IEEE math.  In addition to
23675 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
23676 macro.  On some Alpha implementations the resulting code may execute
23677 significantly slower than the code generated by default.  Since there is
23678 very little code that depends on the @var{inexact-flag}, you should
23679 normally not specify this option.  Other Alpha compilers call this
23680 option @option{-ieee_with_inexact}.
23682 @item -mfp-trap-mode=@var{trap-mode}
23683 @opindex mfp-trap-mode
23684 This option controls what floating-point related traps are enabled.
23685 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
23686 The trap mode can be set to one of four values:
23688 @table @samp
23689 @item n
23690 This is the default (normal) setting.  The only traps that are enabled
23691 are the ones that cannot be disabled in software (e.g., division by zero
23692 trap).
23694 @item u
23695 In addition to the traps enabled by @samp{n}, underflow traps are enabled
23696 as well.
23698 @item su
23699 Like @samp{u}, but the instructions are marked to be safe for software
23700 completion (see Alpha architecture manual for details).
23702 @item sui
23703 Like @samp{su}, but inexact traps are enabled as well.
23704 @end table
23706 @item -mfp-rounding-mode=@var{rounding-mode}
23707 @opindex mfp-rounding-mode
23708 Selects the IEEE rounding mode.  Other Alpha compilers call this option
23709 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
23712 @table @samp
23713 @item n
23714 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
23715 the nearest machine number or towards the even machine number in case
23716 of a tie.
23718 @item m
23719 Round towards minus infinity.
23721 @item c
23722 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
23724 @item d
23725 Dynamic rounding mode.  A field in the floating-point control register
23726 (@var{fpcr}, see Alpha architecture reference manual) controls the
23727 rounding mode in effect.  The C library initializes this register for
23728 rounding towards plus infinity.  Thus, unless your program modifies the
23729 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
23730 @end table
23732 @item -mtrap-precision=@var{trap-precision}
23733 @opindex mtrap-precision
23734 In the Alpha architecture, floating-point traps are imprecise.  This
23735 means without software assistance it is impossible to recover from a
23736 floating trap and program execution normally needs to be terminated.
23737 GCC can generate code that can assist operating system trap handlers
23738 in determining the exact location that caused a floating-point trap.
23739 Depending on the requirements of an application, different levels of
23740 precisions can be selected:
23742 @table @samp
23743 @item p
23744 Program precision.  This option is the default and means a trap handler
23745 can only identify which program caused a floating-point exception.
23747 @item f
23748 Function precision.  The trap handler can determine the function that
23749 caused a floating-point exception.
23751 @item i
23752 Instruction precision.  The trap handler can determine the exact
23753 instruction that caused a floating-point exception.
23754 @end table
23756 Other Alpha compilers provide the equivalent options called
23757 @option{-scope_safe} and @option{-resumption_safe}.
23759 @item -mieee-conformant
23760 @opindex mieee-conformant
23761 This option marks the generated code as IEEE conformant.  You must not
23762 use this option unless you also specify @option{-mtrap-precision=i} and either
23763 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
23764 is to emit the line @samp{.eflag 48} in the function prologue of the
23765 generated assembly file.
23767 @item -mbuild-constants
23768 @opindex mbuild-constants
23769 Normally GCC examines a 32- or 64-bit integer constant to
23770 see if it can construct it from smaller constants in two or three
23771 instructions.  If it cannot, it outputs the constant as a literal and
23772 generates code to load it from the data segment at run time.
23774 Use this option to require GCC to construct @emph{all} integer constants
23775 using code, even if it takes more instructions (the maximum is six).
23777 You typically use this option to build a shared library dynamic
23778 loader.  Itself a shared library, it must relocate itself in memory
23779 before it can find the variables and constants in its own data segment.
23781 @item -mbwx
23782 @itemx -mno-bwx
23783 @itemx -mcix
23784 @itemx -mno-cix
23785 @itemx -mfix
23786 @itemx -mno-fix
23787 @itemx -mmax
23788 @itemx -mno-max
23789 @opindex mbwx
23790 @opindex mno-bwx
23791 @opindex mcix
23792 @opindex mno-cix
23793 @opindex mfix
23794 @opindex mno-fix
23795 @opindex mmax
23796 @opindex mno-max
23797 Indicate whether GCC should generate code to use the optional BWX,
23798 CIX, FIX and MAX instruction sets.  The default is to use the instruction
23799 sets supported by the CPU type specified via @option{-mcpu=} option or that
23800 of the CPU on which GCC was built if none is specified.
23802 @item -mfloat-vax
23803 @itemx -mfloat-ieee
23804 @opindex mfloat-vax
23805 @opindex mfloat-ieee
23806 Generate code that uses (does not use) VAX F and G floating-point
23807 arithmetic instead of IEEE single and double precision.
23809 @item -mexplicit-relocs
23810 @itemx -mno-explicit-relocs
23811 @opindex mexplicit-relocs
23812 @opindex mno-explicit-relocs
23813 Older Alpha assemblers provided no way to generate symbol relocations
23814 except via assembler macros.  Use of these macros does not allow
23815 optimal instruction scheduling.  GNU binutils as of version 2.12
23816 supports a new syntax that allows the compiler to explicitly mark
23817 which relocations should apply to which instructions.  This option
23818 is mostly useful for debugging, as GCC detects the capabilities of
23819 the assembler when it is built and sets the default accordingly.
23821 @item -msmall-data
23822 @itemx -mlarge-data
23823 @opindex msmall-data
23824 @opindex mlarge-data
23825 When @option{-mexplicit-relocs} is in effect, static data is
23826 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
23827 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
23828 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
23829 16-bit relocations off of the @code{$gp} register.  This limits the
23830 size of the small data area to 64KB, but allows the variables to be
23831 directly accessed via a single instruction.
23833 The default is @option{-mlarge-data}.  With this option the data area
23834 is limited to just below 2GB@.  Programs that require more than 2GB of
23835 data must use @code{malloc} or @code{mmap} to allocate the data in the
23836 heap instead of in the program's data segment.
23838 When generating code for shared libraries, @option{-fpic} implies
23839 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
23841 @item -msmall-text
23842 @itemx -mlarge-text
23843 @opindex msmall-text
23844 @opindex mlarge-text
23845 When @option{-msmall-text} is used, the compiler assumes that the
23846 code of the entire program (or shared library) fits in 4MB, and is
23847 thus reachable with a branch instruction.  When @option{-msmall-data}
23848 is used, the compiler can assume that all local symbols share the
23849 same @code{$gp} value, and thus reduce the number of instructions
23850 required for a function call from 4 to 1.
23852 The default is @option{-mlarge-text}.
23854 @item -mcpu=@var{cpu_type}
23855 @opindex mcpu
23856 Set the instruction set and instruction scheduling parameters for
23857 machine type @var{cpu_type}.  You can specify either the @samp{EV}
23858 style name or the corresponding chip number.  GCC supports scheduling
23859 parameters for the EV4, EV5 and EV6 family of processors and
23860 chooses the default values for the instruction set from the processor
23861 you specify.  If you do not specify a processor type, GCC defaults
23862 to the processor on which the compiler was built.
23864 Supported values for @var{cpu_type} are
23866 @table @samp
23867 @item ev4
23868 @itemx ev45
23869 @itemx 21064
23870 Schedules as an EV4 and has no instruction set extensions.
23872 @item ev5
23873 @itemx 21164
23874 Schedules as an EV5 and has no instruction set extensions.
23876 @item ev56
23877 @itemx 21164a
23878 Schedules as an EV5 and supports the BWX extension.
23880 @item pca56
23881 @itemx 21164pc
23882 @itemx 21164PC
23883 Schedules as an EV5 and supports the BWX and MAX extensions.
23885 @item ev6
23886 @itemx 21264
23887 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
23889 @item ev67
23890 @itemx 21264a
23891 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
23892 @end table
23894 Native toolchains also support the value @samp{native},
23895 which selects the best architecture option for the host processor.
23896 @option{-mcpu=native} has no effect if GCC does not recognize
23897 the processor.
23899 @item -mtune=@var{cpu_type}
23900 @opindex mtune
23901 Set only the instruction scheduling parameters for machine type
23902 @var{cpu_type}.  The instruction set is not changed.
23904 Native toolchains also support the value @samp{native},
23905 which selects the best architecture option for the host processor.
23906 @option{-mtune=native} has no effect if GCC does not recognize
23907 the processor.
23909 @item -mmemory-latency=@var{time}
23910 @opindex mmemory-latency
23911 Sets the latency the scheduler should assume for typical memory
23912 references as seen by the application.  This number is highly
23913 dependent on the memory access patterns used by the application
23914 and the size of the external cache on the machine.
23916 Valid options for @var{time} are
23918 @table @samp
23919 @item @var{number}
23920 A decimal number representing clock cycles.
23922 @item L1
23923 @itemx L2
23924 @itemx L3
23925 @itemx main
23926 The compiler contains estimates of the number of clock cycles for
23927 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
23928 (also called Dcache, Scache, and Bcache), as well as to main memory.
23929 Note that L3 is only valid for EV5.
23931 @end table
23932 @end table
23934 @node eBPF Options
23935 @subsection eBPF Options
23936 @cindex eBPF Options
23938 @table @gcctabopt
23939 @item -mframe-limit=@var{bytes}
23940 This specifies the hard limit for frame sizes, in bytes.  Currently,
23941 the value that can be specified should be less than or equal to
23942 @samp{32767}.  Defaults to whatever limit is imposed by the version of
23943 the Linux kernel targeted.
23945 @item -mkernel=@var{version}
23946 @opindex mkernel
23947 This specifies the minimum version of the kernel that will run the
23948 compiled program.  GCC uses this version to determine which
23949 instructions to use, what kernel helpers to allow, etc.  Currently,
23950 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
23951 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
23952 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
23953 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
23954 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
23955 @samp{5.2}, @samp{latest} and @samp{native}.
23957 @item -mbig-endian
23958 @opindex mbig-endian
23959 Generate code for a big-endian target.
23961 @item -mlittle-endian
23962 @opindex mlittle-endian
23963 Generate code for a little-endian target.  This is the default.
23965 @item -mjmpext
23966 @opindex mjmpext
23967 Enable generation of extra conditional-branch instructions.
23968 Enabled for CPU v2 and above.
23970 @item -mjmp32
23971 @opindex mjmp32
23972 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
23974 @item -malu32
23975 @opindex malu32
23976 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
23978 @item -mcpu=@var{version}
23979 @opindex mcpu
23980 This specifies which version of the eBPF ISA to target. Newer versions
23981 may not be supported by all kernels. The default is @samp{v3}.
23983 Supported values for @var{version} are:
23985 @table @samp
23986 @item v1
23987 The first stable eBPF ISA with no special features or extensions.
23989 @item v2
23990 Supports the jump extensions, as in @option{-mjmpext}.
23992 @item v3
23993 All features of v2, plus:
23994 @itemize @minus
23995 @item 32-bit jump operations, as in @option{-mjmp32}
23996 @item 32-bit ALU operations, as in @option{-malu32}
23997 @end itemize
23999 @end table
24001 @item -mco-re
24002 @opindex mco-re
24003 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
24004 is implied by @option{-gbtf}.
24006 @item -mno-co-re
24007 @opindex mno-co-re
24008 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
24009 support is enabled by default when generating BTF debug information for
24010 the BPF target.
24012 @item -mxbpf
24013 Generate code for an expanded version of BPF, which relaxes some of
24014 the restrictions imposed by the BPF architecture:
24015 @itemize @minus
24016 @item Save and restore callee-saved registers at function entry and
24017 exit, respectively.
24018 @end itemize
24019 @end table
24021 @node FR30 Options
24022 @subsection FR30 Options
24023 @cindex FR30 Options
24025 These options are defined specifically for the FR30 port.
24027 @table @gcctabopt
24029 @item -msmall-model
24030 @opindex msmall-model
24031 Use the small address space model.  This can produce smaller code, but
24032 it does assume that all symbolic values and addresses fit into a
24033 20-bit range.
24035 @item -mno-lsim
24036 @opindex mno-lsim
24037 Assume that runtime support has been provided and so there is no need
24038 to include the simulator library (@file{libsim.a}) on the linker
24039 command line.
24041 @end table
24043 @node FT32 Options
24044 @subsection FT32 Options
24045 @cindex FT32 Options
24047 These options are defined specifically for the FT32 port.
24049 @table @gcctabopt
24051 @item -msim
24052 @opindex msim
24053 Specifies that the program will be run on the simulator.  This causes
24054 an alternate runtime startup and library to be linked.
24055 You must not use this option when generating programs that will run on
24056 real hardware; you must provide your own runtime library for whatever
24057 I/O functions are needed.
24059 @item -mlra
24060 @opindex mlra
24061 Enable Local Register Allocation.  This is still experimental for FT32,
24062 so by default the compiler uses standard reload.
24064 @item -mnodiv
24065 @opindex mnodiv
24066 Do not use div and mod instructions.
24068 @item -mft32b
24069 @opindex mft32b
24070 Enable use of the extended instructions of the FT32B processor.
24072 @item -mcompress
24073 @opindex mcompress
24074 Compress all code using the Ft32B code compression scheme.
24076 @item -mnopm
24077 @opindex  mnopm
24078 Do not generate code that reads program memory.
24080 @end table
24082 @node FRV Options
24083 @subsection FRV Options
24084 @cindex FRV Options
24086 @table @gcctabopt
24087 @item -mgpr-32
24088 @opindex mgpr-32
24090 Only use the first 32 general-purpose registers.
24092 @item -mgpr-64
24093 @opindex mgpr-64
24095 Use all 64 general-purpose registers.
24097 @item -mfpr-32
24098 @opindex mfpr-32
24100 Use only the first 32 floating-point registers.
24102 @item -mfpr-64
24103 @opindex mfpr-64
24105 Use all 64 floating-point registers.
24107 @item -mhard-float
24108 @opindex mhard-float
24110 Use hardware instructions for floating-point operations.
24112 @item -msoft-float
24113 @opindex msoft-float
24115 Use library routines for floating-point operations.
24117 @item -malloc-cc
24118 @opindex malloc-cc
24120 Dynamically allocate condition code registers.
24122 @item -mfixed-cc
24123 @opindex mfixed-cc
24125 Do not try to dynamically allocate condition code registers, only
24126 use @code{icc0} and @code{fcc0}.
24128 @item -mdword
24129 @opindex mdword
24131 Change ABI to use double word insns.
24133 @item -mno-dword
24134 @opindex mno-dword
24135 @opindex mdword
24137 Do not use double word instructions.
24139 @item -mdouble
24140 @opindex mdouble
24142 Use floating-point double instructions.
24144 @item -mno-double
24145 @opindex mno-double
24147 Do not use floating-point double instructions.
24149 @item -mmedia
24150 @opindex mmedia
24152 Use media instructions.
24154 @item -mno-media
24155 @opindex mno-media
24157 Do not use media instructions.
24159 @item -mmuladd
24160 @opindex mmuladd
24162 Use multiply and add/subtract instructions.
24164 @item -mno-muladd
24165 @opindex mno-muladd
24167 Do not use multiply and add/subtract instructions.
24169 @item -mfdpic
24170 @opindex mfdpic
24172 Select the FDPIC ABI, which uses function descriptors to represent
24173 pointers to functions.  Without any PIC/PIE-related options, it
24174 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
24175 assumes GOT entries and small data are within a 12-bit range from the
24176 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
24177 are computed with 32 bits.
24178 With a @samp{bfin-elf} target, this option implies @option{-msim}.
24180 @item -minline-plt
24181 @opindex minline-plt
24183 Enable inlining of PLT entries in function calls to functions that are
24184 not known to bind locally.  It has no effect without @option{-mfdpic}.
24185 It's enabled by default if optimizing for speed and compiling for
24186 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
24187 optimization option such as @option{-O3} or above is present in the
24188 command line.
24190 @item -mTLS
24191 @opindex mTLS
24193 Assume a large TLS segment when generating thread-local code.
24195 @item -mtls
24196 @opindex mtls
24198 Do not assume a large TLS segment when generating thread-local code.
24200 @item -mgprel-ro
24201 @opindex mgprel-ro
24203 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
24204 that is known to be in read-only sections.  It's enabled by default,
24205 except for @option{-fpic} or @option{-fpie}: even though it may help
24206 make the global offset table smaller, it trades 1 instruction for 4.
24207 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
24208 one of which may be shared by multiple symbols, and it avoids the need
24209 for a GOT entry for the referenced symbol, so it's more likely to be a
24210 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
24212 @item -multilib-library-pic
24213 @opindex multilib-library-pic
24215 Link with the (library, not FD) pic libraries.  It's implied by
24216 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
24217 @option{-fpic} without @option{-mfdpic}.  You should never have to use
24218 it explicitly.
24220 @item -mlinked-fp
24221 @opindex mlinked-fp
24223 Follow the EABI requirement of always creating a frame pointer whenever
24224 a stack frame is allocated.  This option is enabled by default and can
24225 be disabled with @option{-mno-linked-fp}.
24227 @item -mlong-calls
24228 @opindex mlong-calls
24230 Use indirect addressing to call functions outside the current
24231 compilation unit.  This allows the functions to be placed anywhere
24232 within the 32-bit address space.
24234 @item -malign-labels
24235 @opindex malign-labels
24237 Try to align labels to an 8-byte boundary by inserting NOPs into the
24238 previous packet.  This option only has an effect when VLIW packing
24239 is enabled.  It doesn't create new packets; it merely adds NOPs to
24240 existing ones.
24242 @item -mlibrary-pic
24243 @opindex mlibrary-pic
24245 Generate position-independent EABI code.
24247 @item -macc-4
24248 @opindex macc-4
24250 Use only the first four media accumulator registers.
24252 @item -macc-8
24253 @opindex macc-8
24255 Use all eight media accumulator registers.
24257 @item -mpack
24258 @opindex mpack
24260 Pack VLIW instructions.
24262 @item -mno-pack
24263 @opindex mno-pack
24265 Do not pack VLIW instructions.
24267 @item -mno-eflags
24268 @opindex mno-eflags
24270 Do not mark ABI switches in e_flags.
24272 @item -mcond-move
24273 @opindex mcond-move
24275 Enable the use of conditional-move instructions (default).
24277 This switch is mainly for debugging the compiler and will likely be removed
24278 in a future version.
24280 @item -mno-cond-move
24281 @opindex mno-cond-move
24283 Disable the use of conditional-move instructions.
24285 This switch is mainly for debugging the compiler and will likely be removed
24286 in a future version.
24288 @item -mscc
24289 @opindex mscc
24291 Enable the use of conditional set instructions (default).
24293 This switch is mainly for debugging the compiler and will likely be removed
24294 in a future version.
24296 @item -mno-scc
24297 @opindex mno-scc
24299 Disable the use of conditional set instructions.
24301 This switch is mainly for debugging the compiler and will likely be removed
24302 in a future version.
24304 @item -mcond-exec
24305 @opindex mcond-exec
24307 Enable the use of conditional execution (default).
24309 This switch is mainly for debugging the compiler and will likely be removed
24310 in a future version.
24312 @item -mno-cond-exec
24313 @opindex mno-cond-exec
24315 Disable the use of conditional execution.
24317 This switch is mainly for debugging the compiler and will likely be removed
24318 in a future version.
24320 @item -mvliw-branch
24321 @opindex mvliw-branch
24323 Run a pass to pack branches into VLIW instructions (default).
24325 This switch is mainly for debugging the compiler and will likely be removed
24326 in a future version.
24328 @item -mno-vliw-branch
24329 @opindex mno-vliw-branch
24331 Do not run a pass to pack branches into VLIW instructions.
24333 This switch is mainly for debugging the compiler and will likely be removed
24334 in a future version.
24336 @item -mmulti-cond-exec
24337 @opindex mmulti-cond-exec
24339 Enable optimization of @code{&&} and @code{||} in conditional execution
24340 (default).
24342 This switch is mainly for debugging the compiler and will likely be removed
24343 in a future version.
24345 @item -mno-multi-cond-exec
24346 @opindex mno-multi-cond-exec
24348 Disable optimization of @code{&&} and @code{||} in conditional execution.
24350 This switch is mainly for debugging the compiler and will likely be removed
24351 in a future version.
24353 @item -mnested-cond-exec
24354 @opindex mnested-cond-exec
24356 Enable nested conditional execution optimizations (default).
24358 This switch is mainly for debugging the compiler and will likely be removed
24359 in a future version.
24361 @item -mno-nested-cond-exec
24362 @opindex mno-nested-cond-exec
24364 Disable nested conditional execution optimizations.
24366 This switch is mainly for debugging the compiler and will likely be removed
24367 in a future version.
24369 @item -moptimize-membar
24370 @opindex moptimize-membar
24372 This switch removes redundant @code{membar} instructions from the
24373 compiler-generated code.  It is enabled by default.
24375 @item -mno-optimize-membar
24376 @opindex mno-optimize-membar
24377 @opindex moptimize-membar
24379 This switch disables the automatic removal of redundant @code{membar}
24380 instructions from the generated code.
24382 @item -mtomcat-stats
24383 @opindex mtomcat-stats
24385 Cause gas to print out tomcat statistics.
24387 @item -mcpu=@var{cpu}
24388 @opindex mcpu
24390 Select the processor type for which to generate code.  Possible values are
24391 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
24392 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
24394 @end table
24396 @node GNU/Linux Options
24397 @subsection GNU/Linux Options
24399 These @samp{-m} options are defined for GNU/Linux targets:
24401 @table @gcctabopt
24402 @item -mglibc
24403 @opindex mglibc
24404 Use the GNU C library.  This is the default except
24405 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
24406 @samp{*-*-linux-*android*} targets.
24408 @item -muclibc
24409 @opindex muclibc
24410 Use uClibc C library.  This is the default on
24411 @samp{*-*-linux-*uclibc*} targets.
24413 @item -mmusl
24414 @opindex mmusl
24415 Use the musl C library.  This is the default on
24416 @samp{*-*-linux-*musl*} targets.
24418 @item -mbionic
24419 @opindex mbionic
24420 Use Bionic C library.  This is the default on
24421 @samp{*-*-linux-*android*} targets.
24423 @item -mandroid
24424 @opindex mandroid
24425 Compile code compatible with Android platform.  This is the default on
24426 @samp{*-*-linux-*android*} targets.
24428 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
24429 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
24430 this option makes the GCC driver pass Android-specific options to the linker.
24431 Finally, this option causes the preprocessor macro @code{__ANDROID__}
24432 to be defined.
24434 @item -tno-android-cc
24435 @opindex tno-android-cc
24436 Disable compilation effects of @option{-mandroid}, i.e., do not enable
24437 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
24438 @option{-fno-rtti} by default.
24440 @item -tno-android-ld
24441 @opindex tno-android-ld
24442 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
24443 linking options to the linker.
24445 @end table
24447 @node H8/300 Options
24448 @subsection H8/300 Options
24450 These @samp{-m} options are defined for the H8/300 implementations:
24452 @table @gcctabopt
24453 @item -mrelax
24454 @opindex mrelax
24455 Shorten some address references at link time, when possible; uses the
24456 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
24457 ld, Using ld}, for a fuller description.
24459 @item -mh
24460 @opindex mh
24461 Generate code for the H8/300H@.
24463 @item -ms
24464 @opindex ms
24465 Generate code for the H8S@.
24467 @item -mn
24468 @opindex mn
24469 Generate code for the H8S and H8/300H in the normal mode.  This switch
24470 must be used either with @option{-mh} or @option{-ms}.
24472 @item -ms2600
24473 @opindex ms2600
24474 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
24476 @item -mexr
24477 @opindex mexr
24478 Extended registers are stored on stack before execution of function
24479 with monitor attribute. Default option is @option{-mexr}.
24480 This option is valid only for H8S targets.
24482 @item -mno-exr
24483 @opindex mno-exr
24484 @opindex mexr
24485 Extended registers are not stored on stack before execution of function 
24486 with monitor attribute. Default option is @option{-mno-exr}. 
24487 This option is valid only for H8S targets.
24489 @item -mint32
24490 @opindex mint32
24491 Make @code{int} data 32 bits by default.
24493 @item -malign-300
24494 @opindex malign-300
24495 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
24496 The default for the H8/300H and H8S is to align longs and floats on
24497 4-byte boundaries.
24498 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
24499 This option has no effect on the H8/300.
24500 @end table
24502 @node HPPA Options
24503 @subsection HPPA Options
24504 @cindex HPPA Options
24506 These @samp{-m} options are defined for the HPPA family of computers:
24508 @table @gcctabopt
24509 @item -march=@var{architecture-type}
24510 @opindex march
24511 Generate code for the specified architecture.  The choices for
24512 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
24513 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
24514 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
24515 architecture option for your machine.  Code compiled for lower numbered
24516 architectures runs on higher numbered architectures, but not the
24517 other way around.
24519 @item -mpa-risc-1-0
24520 @itemx -mpa-risc-1-1
24521 @itemx -mpa-risc-2-0
24522 @opindex mpa-risc-1-0
24523 @opindex mpa-risc-1-1
24524 @opindex mpa-risc-2-0
24525 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
24527 @item -mcaller-copies
24528 @opindex mcaller-copies
24529 The caller copies function arguments passed by hidden reference.  This
24530 option should be used with care as it is not compatible with the default
24531 32-bit runtime.  However, only aggregates larger than eight bytes are
24532 passed by hidden reference and the option provides better compatibility
24533 with OpenMP.
24535 @item -mjump-in-delay
24536 @opindex mjump-in-delay
24537 This option is ignored and provided for compatibility purposes only.
24539 @item -mdisable-fpregs
24540 @opindex mdisable-fpregs
24541 Prevent floating-point registers from being used in any manner.  This is
24542 necessary for compiling kernels that perform lazy context switching of
24543 floating-point registers.  If you use this option and attempt to perform
24544 floating-point operations, the compiler aborts.
24546 @item -mdisable-indexing
24547 @opindex mdisable-indexing
24548 Prevent the compiler from using indexing address modes.  This avoids some
24549 rather obscure problems when compiling MIG generated code under MACH@.
24551 @item -mno-space-regs
24552 @opindex mno-space-regs
24553 @opindex mspace-regs
24554 Generate code that assumes the target has no space registers.  This allows
24555 GCC to generate faster indirect calls and use unscaled index address modes.
24557 Such code is suitable for level 0 PA systems and kernels.
24559 @item -mfast-indirect-calls
24560 @opindex mfast-indirect-calls
24561 Generate code that assumes calls never cross space boundaries.  This
24562 allows GCC to emit code that performs faster indirect calls.
24564 This option does not work in the presence of shared libraries or nested
24565 functions.
24567 @item -mfixed-range=@var{register-range}
24568 @opindex mfixed-range
24569 Generate code treating the given register range as fixed registers.
24570 A fixed register is one that the register allocator cannot use.  This is
24571 useful when compiling kernel code.  A register range is specified as
24572 two registers separated by a dash.  Multiple register ranges can be
24573 specified separated by a comma.
24575 @item -mlong-load-store
24576 @opindex mlong-load-store
24577 Generate 3-instruction load and store sequences as sometimes required by
24578 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
24579 the HP compilers.
24581 @item -mportable-runtime
24582 @opindex mportable-runtime
24583 Use the portable calling conventions proposed by HP for ELF systems.
24585 @item -mgas
24586 @opindex mgas
24587 Enable the use of assembler directives only GAS understands.
24589 @item -mschedule=@var{cpu-type}
24590 @opindex mschedule
24591 Schedule code according to the constraints for the machine type
24592 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
24593 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
24594 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
24595 proper scheduling option for your machine.  The default scheduling is
24596 @samp{8000}.
24598 @item -mlinker-opt
24599 @opindex mlinker-opt
24600 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
24601 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
24602 linkers in which they give bogus error messages when linking some programs.
24604 @item -msoft-float
24605 @opindex msoft-float
24606 Generate output containing library calls for floating point.
24607 @strong{Warning:} the requisite libraries are not available for all HPPA
24608 targets.  Normally the facilities of the machine's usual C compiler are
24609 used, but this cannot be done directly in cross-compilation.  You must make
24610 your own arrangements to provide suitable library functions for
24611 cross-compilation.
24613 @option{-msoft-float} changes the calling convention in the output file;
24614 therefore, it is only useful if you compile @emph{all} of a program with
24615 this option.  In particular, you need to compile @file{libgcc.a}, the
24616 library that comes with GCC, with @option{-msoft-float} in order for
24617 this to work.
24619 @item -msio
24620 @opindex msio
24621 Generate the predefine, @code{_SIO}, for server IO@.  The default is
24622 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
24623 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
24624 options are available under HP-UX and HI-UX@.
24626 @item -mgnu-ld
24627 @opindex mgnu-ld
24628 Use options specific to GNU @command{ld}.
24629 This passes @option{-shared} to @command{ld} when
24630 building a shared library.  It is the default when GCC is configured,
24631 explicitly or implicitly, with the GNU linker.  This option does not
24632 affect which @command{ld} is called; it only changes what parameters
24633 are passed to that @command{ld}.
24634 The @command{ld} that is called is determined by the
24635 @option{--with-ld} configure option, GCC's program search path, and
24636 finally by the user's @env{PATH}.  The linker used by GCC can be printed
24637 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
24638 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
24640 @item -mhp-ld
24641 @opindex mhp-ld
24642 Use options specific to HP @command{ld}.
24643 This passes @option{-b} to @command{ld} when building
24644 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
24645 links.  It is the default when GCC is configured, explicitly or
24646 implicitly, with the HP linker.  This option does not affect
24647 which @command{ld} is called; it only changes what parameters are passed to that
24648 @command{ld}.
24649 The @command{ld} that is called is determined by the @option{--with-ld}
24650 configure option, GCC's program search path, and finally by the user's
24651 @env{PATH}.  The linker used by GCC can be printed using @samp{which
24652 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
24653 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
24655 @item -mlong-calls
24656 @opindex mno-long-calls
24657 @opindex mlong-calls
24658 Generate code that uses long call sequences.  This ensures that a call
24659 is always able to reach linker generated stubs.  The default is to generate
24660 long calls only when the distance from the call site to the beginning
24661 of the function or translation unit, as the case may be, exceeds a
24662 predefined limit set by the branch type being used.  The limits for
24663 normal calls are 7,600,000 and 240,000 bytes, respectively for the
24664 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
24665 240,000 bytes.
24667 Distances are measured from the beginning of functions when using the
24668 @option{-ffunction-sections} option, or when using the @option{-mgas}
24669 and @option{-mno-portable-runtime} options together under HP-UX with
24670 the SOM linker.
24672 It is normally not desirable to use this option as it degrades
24673 performance.  However, it may be useful in large applications,
24674 particularly when partial linking is used to build the application.
24676 The types of long calls used depends on the capabilities of the
24677 assembler and linker, and the type of code being generated.  The
24678 impact on systems that support long absolute calls, and long pic
24679 symbol-difference or pc-relative calls should be relatively small.
24680 However, an indirect call is used on 32-bit ELF systems in pic code
24681 and it is quite long.
24683 @item -munix=@var{unix-std}
24684 @opindex march
24685 Generate compiler predefines and select a startfile for the specified
24686 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
24687 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
24688 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
24689 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
24690 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
24691 and later.
24693 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
24694 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
24695 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
24696 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
24697 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
24698 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
24700 It is @emph{important} to note that this option changes the interfaces
24701 for various library routines.  It also affects the operational behavior
24702 of the C library.  Thus, @emph{extreme} care is needed in using this
24703 option.
24705 Library code that is intended to operate with more than one UNIX
24706 standard must test, set and restore the variable @code{__xpg4_extended_mask}
24707 as appropriate.  Most GNU software doesn't provide this capability.
24709 @item -nolibdld
24710 @opindex nolibdld
24711 Suppress the generation of link options to search libdld.sl when the
24712 @option{-static} option is specified on HP-UX 10 and later.
24714 @item -static
24715 @opindex static
24716 The HP-UX implementation of setlocale in libc has a dependency on
24717 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
24718 when the @option{-static} option is specified, special link options
24719 are needed to resolve this dependency.
24721 On HP-UX 10 and later, the GCC driver adds the necessary options to
24722 link with libdld.sl when the @option{-static} option is specified.
24723 This causes the resulting binary to be dynamic.  On the 64-bit port,
24724 the linkers generate dynamic binaries by default in any case.  The
24725 @option{-nolibdld} option can be used to prevent the GCC driver from
24726 adding these link options.
24728 @item -threads
24729 @opindex threads
24730 Add support for multithreading with the @dfn{dce thread} library
24731 under HP-UX@.  This option sets flags for both the preprocessor and
24732 linker.
24733 @end table
24735 @node IA-64 Options
24736 @subsection IA-64 Options
24737 @cindex IA-64 Options
24739 These are the @samp{-m} options defined for the Intel IA-64 architecture.
24741 @table @gcctabopt
24742 @item -mbig-endian
24743 @opindex mbig-endian
24744 Generate code for a big-endian target.  This is the default for HP-UX@.
24746 @item -mlittle-endian
24747 @opindex mlittle-endian
24748 Generate code for a little-endian target.  This is the default for AIX5
24749 and GNU/Linux.
24751 @item -mgnu-as
24752 @itemx -mno-gnu-as
24753 @opindex mgnu-as
24754 @opindex mno-gnu-as
24755 Generate (or don't) code for the GNU assembler.  This is the default.
24756 @c Also, this is the default if the configure option @option{--with-gnu-as}
24757 @c is used.
24759 @item -mgnu-ld
24760 @itemx -mno-gnu-ld
24761 @opindex mgnu-ld
24762 @opindex mno-gnu-ld
24763 Generate (or don't) code for the GNU linker.  This is the default.
24764 @c Also, this is the default if the configure option @option{--with-gnu-ld}
24765 @c is used.
24767 @item -mno-pic
24768 @opindex mno-pic
24769 Generate code that does not use a global pointer register.  The result
24770 is not position independent code, and violates the IA-64 ABI@.
24772 @item -mvolatile-asm-stop
24773 @itemx -mno-volatile-asm-stop
24774 @opindex mvolatile-asm-stop
24775 @opindex mno-volatile-asm-stop
24776 Generate (or don't) a stop bit immediately before and after volatile asm
24777 statements.
24779 @item -mregister-names
24780 @itemx -mno-register-names
24781 @opindex mregister-names
24782 @opindex mno-register-names
24783 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
24784 the stacked registers.  This may make assembler output more readable.
24786 @item -mno-sdata
24787 @itemx -msdata
24788 @opindex mno-sdata
24789 @opindex msdata
24790 Disable (or enable) optimizations that use the small data section.  This may
24791 be useful for working around optimizer bugs.
24793 @item -mconstant-gp
24794 @opindex mconstant-gp
24795 Generate code that uses a single constant global pointer value.  This is
24796 useful when compiling kernel code.
24798 @item -mauto-pic
24799 @opindex mauto-pic
24800 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
24801 This is useful when compiling firmware code.
24803 @item -minline-float-divide-min-latency
24804 @opindex minline-float-divide-min-latency
24805 Generate code for inline divides of floating-point values
24806 using the minimum latency algorithm.
24808 @item -minline-float-divide-max-throughput
24809 @opindex minline-float-divide-max-throughput
24810 Generate code for inline divides of floating-point values
24811 using the maximum throughput algorithm.
24813 @item -mno-inline-float-divide
24814 @opindex mno-inline-float-divide
24815 Do not generate inline code for divides of floating-point values.
24817 @item -minline-int-divide-min-latency
24818 @opindex minline-int-divide-min-latency
24819 Generate code for inline divides of integer values
24820 using the minimum latency algorithm.
24822 @item -minline-int-divide-max-throughput
24823 @opindex minline-int-divide-max-throughput
24824 Generate code for inline divides of integer values
24825 using the maximum throughput algorithm.
24827 @item -mno-inline-int-divide
24828 @opindex mno-inline-int-divide
24829 @opindex minline-int-divide
24830 Do not generate inline code for divides of integer values.
24832 @item -minline-sqrt-min-latency
24833 @opindex minline-sqrt-min-latency
24834 Generate code for inline square roots
24835 using the minimum latency algorithm.
24837 @item -minline-sqrt-max-throughput
24838 @opindex minline-sqrt-max-throughput
24839 Generate code for inline square roots
24840 using the maximum throughput algorithm.
24842 @item -mno-inline-sqrt
24843 @opindex mno-inline-sqrt
24844 Do not generate inline code for @code{sqrt}.
24846 @item -mfused-madd
24847 @itemx -mno-fused-madd
24848 @opindex mfused-madd
24849 @opindex mno-fused-madd
24850 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
24851 instructions.  The default is to use these instructions.
24853 @item -mno-dwarf2-asm
24854 @itemx -mdwarf2-asm
24855 @opindex mno-dwarf2-asm
24856 @opindex mdwarf2-asm
24857 Don't (or do) generate assembler code for the DWARF line number debugging
24858 info.  This may be useful when not using the GNU assembler.
24860 @item -mearly-stop-bits
24861 @itemx -mno-early-stop-bits
24862 @opindex mearly-stop-bits
24863 @opindex mno-early-stop-bits
24864 Allow stop bits to be placed earlier than immediately preceding the
24865 instruction that triggered the stop bit.  This can improve instruction
24866 scheduling, but does not always do so.
24868 @item -mfixed-range=@var{register-range}
24869 @opindex mfixed-range
24870 Generate code treating the given register range as fixed registers.
24871 A fixed register is one that the register allocator cannot use.  This is
24872 useful when compiling kernel code.  A register range is specified as
24873 two registers separated by a dash.  Multiple register ranges can be
24874 specified separated by a comma.
24876 @item -mtls-size=@var{tls-size}
24877 @opindex mtls-size
24878 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
24881 @item -mtune=@var{cpu-type}
24882 @opindex mtune
24883 Tune the instruction scheduling for a particular CPU, Valid values are
24884 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
24885 and @samp{mckinley}.
24887 @item -milp32
24888 @itemx -mlp64
24889 @opindex milp32
24890 @opindex mlp64
24891 Generate code for a 32-bit or 64-bit environment.
24892 The 32-bit environment sets int, long and pointer to 32 bits.
24893 The 64-bit environment sets int to 32 bits and long and pointer
24894 to 64 bits.  These are HP-UX specific flags.
24896 @item -mno-sched-br-data-spec
24897 @itemx -msched-br-data-spec
24898 @opindex mno-sched-br-data-spec
24899 @opindex msched-br-data-spec
24900 (Dis/En)able data speculative scheduling before reload.
24901 This results in generation of @code{ld.a} instructions and
24902 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
24903 The default setting is disabled.
24905 @item -msched-ar-data-spec
24906 @itemx -mno-sched-ar-data-spec
24907 @opindex msched-ar-data-spec
24908 @opindex mno-sched-ar-data-spec
24909 (En/Dis)able data speculative scheduling after reload.
24910 This results in generation of @code{ld.a} instructions and
24911 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
24912 The default setting is enabled.
24914 @item -mno-sched-control-spec
24915 @itemx -msched-control-spec
24916 @opindex mno-sched-control-spec
24917 @opindex msched-control-spec
24918 (Dis/En)able control speculative scheduling.  This feature is
24919 available only during region scheduling (i.e.@: before reload).
24920 This results in generation of the @code{ld.s} instructions and
24921 the corresponding check instructions @code{chk.s}.
24922 The default setting is disabled.
24924 @item -msched-br-in-data-spec
24925 @itemx -mno-sched-br-in-data-spec
24926 @opindex msched-br-in-data-spec
24927 @opindex mno-sched-br-in-data-spec
24928 (En/Dis)able speculative scheduling of the instructions that
24929 are dependent on the data speculative loads before reload.
24930 This is effective only with @option{-msched-br-data-spec} enabled.
24931 The default setting is enabled.
24933 @item -msched-ar-in-data-spec
24934 @itemx -mno-sched-ar-in-data-spec
24935 @opindex msched-ar-in-data-spec
24936 @opindex mno-sched-ar-in-data-spec
24937 (En/Dis)able speculative scheduling of the instructions that
24938 are dependent on the data speculative loads after reload.
24939 This is effective only with @option{-msched-ar-data-spec} enabled.
24940 The default setting is enabled.
24942 @item -msched-in-control-spec
24943 @itemx -mno-sched-in-control-spec
24944 @opindex msched-in-control-spec
24945 @opindex mno-sched-in-control-spec
24946 (En/Dis)able speculative scheduling of the instructions that
24947 are dependent on the control speculative loads.
24948 This is effective only with @option{-msched-control-spec} enabled.
24949 The default setting is enabled.
24951 @item -mno-sched-prefer-non-data-spec-insns
24952 @itemx -msched-prefer-non-data-spec-insns
24953 @opindex mno-sched-prefer-non-data-spec-insns
24954 @opindex msched-prefer-non-data-spec-insns
24955 If enabled, data-speculative instructions are chosen for schedule
24956 only if there are no other choices at the moment.  This makes
24957 the use of the data speculation much more conservative.
24958 The default setting is disabled.
24960 @item -mno-sched-prefer-non-control-spec-insns
24961 @itemx -msched-prefer-non-control-spec-insns
24962 @opindex mno-sched-prefer-non-control-spec-insns
24963 @opindex msched-prefer-non-control-spec-insns
24964 If enabled, control-speculative instructions are chosen for schedule
24965 only if there are no other choices at the moment.  This makes
24966 the use of the control speculation much more conservative.
24967 The default setting is disabled.
24969 @item -mno-sched-count-spec-in-critical-path
24970 @itemx -msched-count-spec-in-critical-path
24971 @opindex mno-sched-count-spec-in-critical-path
24972 @opindex msched-count-spec-in-critical-path
24973 If enabled, speculative dependencies are considered during
24974 computation of the instructions priorities.  This makes the use of the
24975 speculation a bit more conservative.
24976 The default setting is disabled.
24978 @item -msched-spec-ldc
24979 @opindex msched-spec-ldc
24980 Use a simple data speculation check.  This option is on by default.
24982 @item -msched-control-spec-ldc
24983 @opindex msched-spec-ldc
24984 Use a simple check for control speculation.  This option is on by default.
24986 @item -msched-stop-bits-after-every-cycle
24987 @opindex msched-stop-bits-after-every-cycle
24988 Place a stop bit after every cycle when scheduling.  This option is on
24989 by default.
24991 @item -msched-fp-mem-deps-zero-cost
24992 @opindex msched-fp-mem-deps-zero-cost
24993 Assume that floating-point stores and loads are not likely to cause a conflict
24994 when placed into the same instruction group.  This option is disabled by
24995 default.
24997 @item -msel-sched-dont-check-control-spec
24998 @opindex msel-sched-dont-check-control-spec
24999 Generate checks for control speculation in selective scheduling.
25000 This flag is disabled by default.
25002 @item -msched-max-memory-insns=@var{max-insns}
25003 @opindex msched-max-memory-insns
25004 Limit on the number of memory insns per instruction group, giving lower
25005 priority to subsequent memory insns attempting to schedule in the same
25006 instruction group. Frequently useful to prevent cache bank conflicts.
25007 The default value is 1.
25009 @item -msched-max-memory-insns-hard-limit
25010 @opindex msched-max-memory-insns-hard-limit
25011 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
25012 disallowing more than that number in an instruction group.
25013 Otherwise, the limit is ``soft'', meaning that non-memory operations
25014 are preferred when the limit is reached, but memory operations may still
25015 be scheduled.
25017 @end table
25019 @node LM32 Options
25020 @subsection LM32 Options
25021 @cindex LM32 options
25023 These @option{-m} options are defined for the LatticeMico32 architecture:
25025 @table @gcctabopt
25026 @item -mbarrel-shift-enabled
25027 @opindex mbarrel-shift-enabled
25028 Enable barrel-shift instructions.
25030 @item -mdivide-enabled
25031 @opindex mdivide-enabled
25032 Enable divide and modulus instructions.
25034 @item -mmultiply-enabled
25035 @opindex multiply-enabled
25036 Enable multiply instructions.
25038 @item -msign-extend-enabled
25039 @opindex msign-extend-enabled
25040 Enable sign extend instructions.
25042 @item -muser-enabled
25043 @opindex muser-enabled
25044 Enable user-defined instructions.
25046 @end table
25048 @node LoongArch Options
25049 @subsection LoongArch Options
25050 @cindex LoongArch Options
25052 These command-line options are defined for LoongArch targets:
25054 @table @gcctabopt
25055 @item -march=@var{cpu-type}
25056 @opindex -march
25057 Generate instructions for the machine type @var{cpu-type}.  In contrast to
25058 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
25059 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
25060 to generate code that may not run at all on processors other than the one
25061 indicated.  Specifying @option{-march=@var{cpu-type}} implies
25062 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
25064 The choices for @var{cpu-type} are:
25066 @table @samp
25067 @item native
25068 This selects the CPU to generate code for at compilation time by determining
25069 the processor type of the compiling machine.  Using @option{-march=native}
25070 enables all instruction subsets supported by the local machine (hence
25071 the result might not run on different machines).  Using @option{-mtune=native}
25072 produces code optimized for the local machine under the constraints
25073 of the selected instruction set.
25074 @item loongarch64
25075 A generic CPU with 64-bit extensions.
25076 @item la464
25077 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
25078 @end table
25080 @item -mtune=@var{cpu-type}
25081 @opindex mtune
25082 Optimize the output for the given processor, specified by microarchitecture
25083 name.
25085 @item -mabi=@var{base-abi-type}
25086 @opindex mabi
25087 Generate code for the specified calling convention.
25088 @var{base-abi-type} can be one of:
25089 @table @samp
25090 @item lp64d
25091 Uses 64-bit general purpose registers and 32/64-bit floating-point
25092 registers for parameter passing.  Data model is LP64, where @samp{int}
25093 is 32 bits, while @samp{long int} and pointers are 64 bits.
25094 @item lp64f
25095 Uses 64-bit general purpose registers and 32-bit floating-point
25096 registers for parameter passing.  Data model is LP64, where @samp{int}
25097 is 32 bits, while @samp{long int} and pointers are 64 bits.
25098 @item lp64s
25099 Uses 64-bit general purpose registers and no floating-point
25100 registers for parameter passing.  Data model is LP64, where @samp{int}
25101 is 32 bits, while @samp{long int} and pointers are 64 bits.
25102 @end table
25104 @item -mfpu=@var{fpu-type}
25105 @opindex mfpu
25106 Generate code for the specified FPU type, which can be one of:
25107 @table @samp
25108 @item 64
25109 Allow the use of hardware floating-point instructions for 32-bit
25110 and 64-bit operations.
25111 @item 32
25112 Allow the use of hardware floating-point instructions for 32-bit
25113 operations.
25114 @item none
25115 @item 0
25116 Prevent the use of hardware floating-point instructions.
25117 @end table
25119 @item -msoft-float
25120 @opindex msoft-float
25121 Force @option{-mfpu=none} and prevents the use of floating-point
25122 registers for parameter passing.  This option may change the target
25123 ABI.
25125 @item -msingle-float
25126 @opindex -msingle-float
25127 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
25128 registers for parameter passing.  This option may change the target
25129 ABI.
25131 @item -mdouble-float
25132 @opindex -mdouble-float
25133 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
25134 registers for parameter passing.  This option may change the target
25135 ABI.
25137 @item -mbranch-cost=@var{n}
25138 @opindex -mbranch-cost
25139 Set the cost of branches to roughly @var{n} instructions.
25141 @item -mcheck-zero-division
25142 @itemx -mno-check-zero-divison
25143 @opindex -mcheck-zero-division
25144 Trap (do not trap) on integer division by zero.  The default is
25145 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
25146 @option{-mno-check-zero-division} for other optimization levels.
25148 @item -mcond-move-int
25149 @itemx -mno-cond-move-int
25150 @opindex -mcond-move-int
25151 Conditional moves for integral data in general-purpose registers
25152 are enabled (disabled).  The default is @option{-mcond-move-int}.
25154 @item -mcond-move-float
25155 @itemx -mno-cond-move-float
25156 @opindex -mcond-move-float
25157 Conditional moves for floating-point registers are enabled (disabled).
25158 The default is @option{-mcond-move-float}.
25160 @item -mmemcpy
25161 @itemx -mno-memcpy
25162 @opindex -mmemcpy
25163 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
25164 The default is @option{-mno-memcpy}, which allows GCC to inline most
25165 constant-sized copies.  Setting optimization level to @option{-Os} also
25166 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
25167 behavior if explicitly specified, regardless of the order these options on
25168 the command line.
25170 @item -mstrict-align
25171 @itemx -mno-strict-align
25172 @opindex -mstrict-align
25173 Avoid or allow generating memory accesses that may not be aligned on a natural
25174 object boundary as described in the architecture specification. The default is
25175 @option{-mno-strict-align}.
25177 @item -msmall-data-limit=@var{number}
25178 @opindex -msmall-data-limit
25179 Put global and static data smaller than @var{number} bytes into a special
25180 section (on some targets).  The default value is 0.
25182 @item -mmax-inline-memcpy-size=@var{n}
25183 @opindex -mmax-inline-memcpy-size
25184 Inline all block moves (such as calls to @code{memcpy} or structure copies)
25185 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
25187 @item -mcmodel=@var{code-model}
25188 Set the code model to one of:
25189 @table @samp
25190 @item tiny-static (Not implemented yet)
25191 @item tiny (Not implemented yet)
25193 @item normal
25194 The text segment must be within 128MB addressing space.  The data segment must
25195 be within 2GB addressing space.
25197 @item medium
25198 The text segment and data segment must be within 2GB addressing space.
25200 @item large (Not implemented yet)
25202 @item extreme
25203 This mode does not limit the size of the code segment and data segment.
25204 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt} and
25205 @option{-mno-explicit-relocs}.
25206 @end table
25207 The default code model is @code{normal}.
25209 @item -mexplicit-relocs
25210 @itemx -mno-explicit-relocs
25211 @opindex mexplicit-relocs
25212 @opindex mno-explicit-relocs
25213 Use or do not use assembler relocation operators when dealing with symbolic
25214 addresses.  The alternative is to use assembler macros instead, which may
25215 limit optimization.  The default value for the option is determined during
25216 GCC build-time by detecting corresponding assembler support:
25217 @code{-mexplicit-relocs} if said support is present,
25218 @code{-mno-explicit-relocs} otherwise.  This option is mostly useful for
25219 debugging, or interoperation with assemblers different from the build-time
25220 one.
25222 @item -mdirect-extern-access
25223 @itemx -mno-direct-extern-access
25224 @opindex mdirect-extern-access
25225 Do not use or use GOT to access external symbols.  The default is
25226 @option{-mno-direct-extern-access}: GOT is used for external symbols with
25227 default visibility, but not used for other external symbols.
25229 With @option{-mdirect-extern-access}, GOT is not used and all external
25230 symbols are PC-relatively addressed.  It is @strong{only} suitable for
25231 environments where no dynamic link is performed, like firmwares, OS
25232 kernels, executables linked with @option{-static} or @option{-static-pie}.
25233 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
25234 @option{-fpic}.
25235 @end table
25237 @node M32C Options
25238 @subsection M32C Options
25239 @cindex M32C options
25241 @table @gcctabopt
25242 @item -mcpu=@var{name}
25243 @opindex mcpu=
25244 Select the CPU for which code is generated.  @var{name} may be one of
25245 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
25246 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
25247 the M32C/80 series.
25249 @item -msim
25250 @opindex msim
25251 Specifies that the program will be run on the simulator.  This causes
25252 an alternate runtime library to be linked in which supports, for
25253 example, file I/O@.  You must not use this option when generating
25254 programs that will run on real hardware; you must provide your own
25255 runtime library for whatever I/O functions are needed.
25257 @item -memregs=@var{number}
25258 @opindex memregs=
25259 Specifies the number of memory-based pseudo-registers GCC uses
25260 during code generation.  These pseudo-registers are used like real
25261 registers, so there is a tradeoff between GCC's ability to fit the
25262 code into available registers, and the performance penalty of using
25263 memory instead of registers.  Note that all modules in a program must
25264 be compiled with the same value for this option.  Because of that, you
25265 must not use this option with GCC's default runtime libraries.
25267 @end table
25269 @node M32R/D Options
25270 @subsection M32R/D Options
25271 @cindex M32R/D options
25273 These @option{-m} options are defined for Renesas M32R/D architectures:
25275 @table @gcctabopt
25276 @item -m32r2
25277 @opindex m32r2
25278 Generate code for the M32R/2@.
25280 @item -m32rx
25281 @opindex m32rx
25282 Generate code for the M32R/X@.
25284 @item -m32r
25285 @opindex m32r
25286 Generate code for the M32R@.  This is the default.
25288 @item -mmodel=small
25289 @opindex mmodel=small
25290 Assume all objects live in the lower 16MB of memory (so that their addresses
25291 can be loaded with the @code{ld24} instruction), and assume all subroutines
25292 are reachable with the @code{bl} instruction.
25293 This is the default.
25295 The addressability of a particular object can be set with the
25296 @code{model} attribute.
25298 @item -mmodel=medium
25299 @opindex mmodel=medium
25300 Assume objects may be anywhere in the 32-bit address space (the compiler
25301 generates @code{seth/add3} instructions to load their addresses), and
25302 assume all subroutines are reachable with the @code{bl} instruction.
25304 @item -mmodel=large
25305 @opindex mmodel=large
25306 Assume objects may be anywhere in the 32-bit address space (the compiler
25307 generates @code{seth/add3} instructions to load their addresses), and
25308 assume subroutines may not be reachable with the @code{bl} instruction
25309 (the compiler generates the much slower @code{seth/add3/jl}
25310 instruction sequence).
25312 @item -msdata=none
25313 @opindex msdata=none
25314 Disable use of the small data area.  Variables are put into
25315 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
25316 @code{section} attribute has been specified).
25317 This is the default.
25319 The small data area consists of sections @code{.sdata} and @code{.sbss}.
25320 Objects may be explicitly put in the small data area with the
25321 @code{section} attribute using one of these sections.
25323 @item -msdata=sdata
25324 @opindex msdata=sdata
25325 Put small global and static data in the small data area, but do not
25326 generate special code to reference them.
25328 @item -msdata=use
25329 @opindex msdata=use
25330 Put small global and static data in the small data area, and generate
25331 special instructions to reference them.
25333 @item -G @var{num}
25334 @opindex G
25335 @cindex smaller data references
25336 Put global and static objects less than or equal to @var{num} bytes
25337 into the small data or BSS sections instead of the normal data or BSS
25338 sections.  The default value of @var{num} is 8.
25339 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
25340 for this option to have any effect.
25342 All modules should be compiled with the same @option{-G @var{num}} value.
25343 Compiling with different values of @var{num} may or may not work; if it
25344 doesn't the linker gives an error message---incorrect code is not
25345 generated.
25347 @item -mdebug
25348 @opindex mdebug
25349 Makes the M32R-specific code in the compiler display some statistics
25350 that might help in debugging programs.
25352 @item -malign-loops
25353 @opindex malign-loops
25354 Align all loops to a 32-byte boundary.
25356 @item -mno-align-loops
25357 @opindex mno-align-loops
25358 Do not enforce a 32-byte alignment for loops.  This is the default.
25360 @item -missue-rate=@var{number}
25361 @opindex missue-rate=@var{number}
25362 Issue @var{number} instructions per cycle.  @var{number} can only be 1
25363 or 2.
25365 @item -mbranch-cost=@var{number}
25366 @opindex mbranch-cost=@var{number}
25367 @var{number} can only be 1 or 2.  If it is 1 then branches are
25368 preferred over conditional code, if it is 2, then the opposite applies.
25370 @item -mflush-trap=@var{number}
25371 @opindex mflush-trap=@var{number}
25372 Specifies the trap number to use to flush the cache.  The default is
25373 12.  Valid numbers are between 0 and 15 inclusive.
25375 @item -mno-flush-trap
25376 @opindex mno-flush-trap
25377 Specifies that the cache cannot be flushed by using a trap.
25379 @item -mflush-func=@var{name}
25380 @opindex mflush-func=@var{name}
25381 Specifies the name of the operating system function to call to flush
25382 the cache.  The default is @samp{_flush_cache}, but a function call
25383 is only used if a trap is not available.
25385 @item -mno-flush-func
25386 @opindex mno-flush-func
25387 Indicates that there is no OS function for flushing the cache.
25389 @end table
25391 @node M680x0 Options
25392 @subsection M680x0 Options
25393 @cindex M680x0 options
25395 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
25396 The default settings depend on which architecture was selected when
25397 the compiler was configured; the defaults for the most common choices
25398 are given below.
25400 @table @gcctabopt
25401 @item -march=@var{arch}
25402 @opindex march
25403 Generate code for a specific M680x0 or ColdFire instruction set
25404 architecture.  Permissible values of @var{arch} for M680x0
25405 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
25406 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
25407 architectures are selected according to Freescale's ISA classification
25408 and the permissible values are: @samp{isaa}, @samp{isaaplus},
25409 @samp{isab} and @samp{isac}.
25411 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
25412 code for a ColdFire target.  The @var{arch} in this macro is one of the
25413 @option{-march} arguments given above.
25415 When used together, @option{-march} and @option{-mtune} select code
25416 that runs on a family of similar processors but that is optimized
25417 for a particular microarchitecture.
25419 @item -mcpu=@var{cpu}
25420 @opindex mcpu
25421 Generate code for a specific M680x0 or ColdFire processor.
25422 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
25423 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
25424 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
25425 below, which also classifies the CPUs into families:
25427 @multitable @columnfractions 0.20 0.80
25428 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
25429 @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}
25430 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
25431 @item @samp{5206e} @tab @samp{5206e}
25432 @item @samp{5208} @tab @samp{5207} @samp{5208}
25433 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
25434 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
25435 @item @samp{5216} @tab @samp{5214} @samp{5216}
25436 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
25437 @item @samp{5225} @tab @samp{5224} @samp{5225}
25438 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
25439 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
25440 @item @samp{5249} @tab @samp{5249}
25441 @item @samp{5250} @tab @samp{5250}
25442 @item @samp{5271} @tab @samp{5270} @samp{5271}
25443 @item @samp{5272} @tab @samp{5272}
25444 @item @samp{5275} @tab @samp{5274} @samp{5275}
25445 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
25446 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
25447 @item @samp{5307} @tab @samp{5307}
25448 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
25449 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
25450 @item @samp{5407} @tab @samp{5407}
25451 @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}
25452 @end multitable
25454 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
25455 @var{arch} is compatible with @var{cpu}.  Other combinations of
25456 @option{-mcpu} and @option{-march} are rejected.
25458 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
25459 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
25460 where the value of @var{family} is given by the table above.
25462 @item -mtune=@var{tune}
25463 @opindex mtune
25464 Tune the code for a particular microarchitecture within the
25465 constraints set by @option{-march} and @option{-mcpu}.
25466 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
25467 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
25468 and @samp{cpu32}.  The ColdFire microarchitectures
25469 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
25471 You can also use @option{-mtune=68020-40} for code that needs
25472 to run relatively well on 68020, 68030 and 68040 targets.
25473 @option{-mtune=68020-60} is similar but includes 68060 targets
25474 as well.  These two options select the same tuning decisions as
25475 @option{-m68020-40} and @option{-m68020-60} respectively.
25477 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
25478 when tuning for 680x0 architecture @var{arch}.  It also defines
25479 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
25480 option is used.  If GCC is tuning for a range of architectures,
25481 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
25482 it defines the macros for every architecture in the range.
25484 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
25485 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
25486 of the arguments given above.
25488 @item -m68000
25489 @itemx -mc68000
25490 @opindex m68000
25491 @opindex mc68000
25492 Generate output for a 68000.  This is the default
25493 when the compiler is configured for 68000-based systems.
25494 It is equivalent to @option{-march=68000}.
25496 Use this option for microcontrollers with a 68000 or EC000 core,
25497 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
25499 @item -m68010
25500 @opindex m68010
25501 Generate output for a 68010.  This is the default
25502 when the compiler is configured for 68010-based systems.
25503 It is equivalent to @option{-march=68010}.
25505 @item -m68020
25506 @itemx -mc68020
25507 @opindex m68020
25508 @opindex mc68020
25509 Generate output for a 68020.  This is the default
25510 when the compiler is configured for 68020-based systems.
25511 It is equivalent to @option{-march=68020}.
25513 @item -m68030
25514 @opindex m68030
25515 Generate output for a 68030.  This is the default when the compiler is
25516 configured for 68030-based systems.  It is equivalent to
25517 @option{-march=68030}.
25519 @item -m68040
25520 @opindex m68040
25521 Generate output for a 68040.  This is the default when the compiler is
25522 configured for 68040-based systems.  It is equivalent to
25523 @option{-march=68040}.
25525 This option inhibits the use of 68881/68882 instructions that have to be
25526 emulated by software on the 68040.  Use this option if your 68040 does not
25527 have code to emulate those instructions.
25529 @item -m68060
25530 @opindex m68060
25531 Generate output for a 68060.  This is the default when the compiler is
25532 configured for 68060-based systems.  It is equivalent to
25533 @option{-march=68060}.
25535 This option inhibits the use of 68020 and 68881/68882 instructions that
25536 have to be emulated by software on the 68060.  Use this option if your 68060
25537 does not have code to emulate those instructions.
25539 @item -mcpu32
25540 @opindex mcpu32
25541 Generate output for a CPU32.  This is the default
25542 when the compiler is configured for CPU32-based systems.
25543 It is equivalent to @option{-march=cpu32}.
25545 Use this option for microcontrollers with a
25546 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
25547 68336, 68340, 68341, 68349 and 68360.
25549 @item -m5200
25550 @opindex m5200
25551 Generate output for a 520X ColdFire CPU@.  This is the default
25552 when the compiler is configured for 520X-based systems.
25553 It is equivalent to @option{-mcpu=5206}, and is now deprecated
25554 in favor of that option.
25556 Use this option for microcontroller with a 5200 core, including
25557 the MCF5202, MCF5203, MCF5204 and MCF5206.
25559 @item -m5206e
25560 @opindex m5206e
25561 Generate output for a 5206e ColdFire CPU@.  The option is now
25562 deprecated in favor of the equivalent @option{-mcpu=5206e}.
25564 @item -m528x
25565 @opindex m528x
25566 Generate output for a member of the ColdFire 528X family.
25567 The option is now deprecated in favor of the equivalent
25568 @option{-mcpu=528x}.
25570 @item -m5307
25571 @opindex m5307
25572 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
25573 in favor of the equivalent @option{-mcpu=5307}.
25575 @item -m5407
25576 @opindex m5407
25577 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
25578 in favor of the equivalent @option{-mcpu=5407}.
25580 @item -mcfv4e
25581 @opindex mcfv4e
25582 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
25583 This includes use of hardware floating-point instructions.
25584 The option is equivalent to @option{-mcpu=547x}, and is now
25585 deprecated in favor of that option.
25587 @item -m68020-40
25588 @opindex m68020-40
25589 Generate output for a 68040, without using any of the new instructions.
25590 This results in code that can run relatively efficiently on either a
25591 68020/68881 or a 68030 or a 68040.  The generated code does use the
25592 68881 instructions that are emulated on the 68040.
25594 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
25596 @item -m68020-60
25597 @opindex m68020-60
25598 Generate output for a 68060, without using any of the new instructions.
25599 This results in code that can run relatively efficiently on either a
25600 68020/68881 or a 68030 or a 68040.  The generated code does use the
25601 68881 instructions that are emulated on the 68060.
25603 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
25605 @item -mhard-float
25606 @itemx -m68881
25607 @opindex mhard-float
25608 @opindex m68881
25609 Generate floating-point instructions.  This is the default for 68020
25610 and above, and for ColdFire devices that have an FPU@.  It defines the
25611 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
25612 on ColdFire targets.
25614 @item -msoft-float
25615 @opindex msoft-float
25616 Do not generate floating-point instructions; use library calls instead.
25617 This is the default for 68000, 68010, and 68832 targets.  It is also
25618 the default for ColdFire devices that have no FPU.
25620 @item -mdiv
25621 @itemx -mno-div
25622 @opindex mdiv
25623 @opindex mno-div
25624 Generate (do not generate) ColdFire hardware divide and remainder
25625 instructions.  If @option{-march} is used without @option{-mcpu},
25626 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
25627 architectures.  Otherwise, the default is taken from the target CPU
25628 (either the default CPU, or the one specified by @option{-mcpu}).  For
25629 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
25630 @option{-mcpu=5206e}.
25632 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
25634 @item -mshort
25635 @opindex mshort
25636 Consider type @code{int} to be 16 bits wide, like @code{short int}.
25637 Additionally, parameters passed on the stack are also aligned to a
25638 16-bit boundary even on targets whose API mandates promotion to 32-bit.
25640 @item -mno-short
25641 @opindex mno-short
25642 Do not consider type @code{int} to be 16 bits wide.  This is the default.
25644 @item -mnobitfield
25645 @itemx -mno-bitfield
25646 @opindex mnobitfield
25647 @opindex mno-bitfield
25648 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
25649 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
25651 @item -mbitfield
25652 @opindex mbitfield
25653 Do use the bit-field instructions.  The @option{-m68020} option implies
25654 @option{-mbitfield}.  This is the default if you use a configuration
25655 designed for a 68020.
25657 @item -mrtd
25658 @opindex mrtd
25659 Use a different function-calling convention, in which functions
25660 that take a fixed number of arguments return with the @code{rtd}
25661 instruction, which pops their arguments while returning.  This
25662 saves one instruction in the caller since there is no need to pop
25663 the arguments there.
25665 This calling convention is incompatible with the one normally
25666 used on Unix, so you cannot use it if you need to call libraries
25667 compiled with the Unix compiler.
25669 Also, you must provide function prototypes for all functions that
25670 take variable numbers of arguments (including @code{printf});
25671 otherwise incorrect code is generated for calls to those
25672 functions.
25674 In addition, seriously incorrect code results if you call a
25675 function with too many arguments.  (Normally, extra arguments are
25676 harmlessly ignored.)
25678 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
25679 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
25681 The default is @option{-mno-rtd}.
25683 @item -malign-int
25684 @itemx -mno-align-int
25685 @opindex malign-int
25686 @opindex mno-align-int
25687 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
25688 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
25689 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
25690 Aligning variables on 32-bit boundaries produces code that runs somewhat
25691 faster on processors with 32-bit busses at the expense of more memory.
25693 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
25694 aligns structures containing the above types differently than
25695 most published application binary interface specifications for the m68k.
25697 @opindex mpcrel
25698 Use the pc-relative addressing mode of the 68000 directly, instead of
25699 using a global offset table.  At present, this option implies @option{-fpic},
25700 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
25701 not presently supported with @option{-mpcrel}, though this could be supported for
25702 68020 and higher processors.
25704 @item -mno-strict-align
25705 @itemx -mstrict-align
25706 @opindex mno-strict-align
25707 @opindex mstrict-align
25708 Do not (do) assume that unaligned memory references are handled by
25709 the system.
25711 @item -msep-data
25712 Generate code that allows the data segment to be located in a different
25713 area of memory from the text segment.  This allows for execute-in-place in
25714 an environment without virtual memory management.  This option implies
25715 @option{-fPIC}.
25717 @item -mno-sep-data
25718 Generate code that assumes that the data segment follows the text segment.
25719 This is the default.
25721 @item -mid-shared-library
25722 Generate code that supports shared libraries via the library ID method.
25723 This allows for execute-in-place and shared libraries in an environment
25724 without virtual memory management.  This option implies @option{-fPIC}.
25726 @item -mno-id-shared-library
25727 Generate code that doesn't assume ID-based shared libraries are being used.
25728 This is the default.
25730 @item -mshared-library-id=n
25731 Specifies the identification number of the ID-based shared library being
25732 compiled.  Specifying a value of 0 generates more compact code; specifying
25733 other values forces the allocation of that number to the current
25734 library, but is no more space- or time-efficient than omitting this option.
25736 @item -mxgot
25737 @itemx -mno-xgot
25738 @opindex mxgot
25739 @opindex mno-xgot
25740 When generating position-independent code for ColdFire, generate code
25741 that works if the GOT has more than 8192 entries.  This code is
25742 larger and slower than code generated without this option.  On M680x0
25743 processors, this option is not needed; @option{-fPIC} suffices.
25745 GCC normally uses a single instruction to load values from the GOT@.
25746 While this is relatively efficient, it only works if the GOT
25747 is smaller than about 64k.  Anything larger causes the linker
25748 to report an error such as:
25750 @cindex relocation truncated to fit (ColdFire)
25751 @smallexample
25752 relocation truncated to fit: R_68K_GOT16O foobar
25753 @end smallexample
25755 If this happens, you should recompile your code with @option{-mxgot}.
25756 It should then work with very large GOTs.  However, code generated with
25757 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
25758 the value of a global symbol.
25760 Note that some linkers, including newer versions of the GNU linker,
25761 can create multiple GOTs and sort GOT entries.  If you have such a linker,
25762 you should only need to use @option{-mxgot} when compiling a single
25763 object file that accesses more than 8192 GOT entries.  Very few do.
25765 These options have no effect unless GCC is generating
25766 position-independent code.
25768 @item -mlong-jump-table-offsets
25769 @opindex mlong-jump-table-offsets
25770 Use 32-bit offsets in @code{switch} tables.  The default is to use
25771 16-bit offsets.
25773 @end table
25775 @node MCore Options
25776 @subsection MCore Options
25777 @cindex MCore options
25779 These are the @samp{-m} options defined for the Motorola M*Core
25780 processors.
25782 @table @gcctabopt
25784 @item -mhardlit
25785 @itemx -mno-hardlit
25786 @opindex mhardlit
25787 @opindex mno-hardlit
25788 Inline constants into the code stream if it can be done in two
25789 instructions or less.
25791 @item -mdiv
25792 @itemx -mno-div
25793 @opindex mdiv
25794 @opindex mno-div
25795 Use the divide instruction.  (Enabled by default).
25797 @item -mrelax-immediate
25798 @itemx -mno-relax-immediate
25799 @opindex mrelax-immediate
25800 @opindex mno-relax-immediate
25801 Allow arbitrary-sized immediates in bit operations.
25803 @item -mwide-bitfields
25804 @itemx -mno-wide-bitfields
25805 @opindex mwide-bitfields
25806 @opindex mno-wide-bitfields
25807 Always treat bit-fields as @code{int}-sized.
25809 @item -m4byte-functions
25810 @itemx -mno-4byte-functions
25811 @opindex m4byte-functions
25812 @opindex mno-4byte-functions
25813 Force all functions to be aligned to a 4-byte boundary.
25815 @item -mcallgraph-data
25816 @itemx -mno-callgraph-data
25817 @opindex mcallgraph-data
25818 @opindex mno-callgraph-data
25819 Emit callgraph information.
25821 @item -mslow-bytes
25822 @itemx -mno-slow-bytes
25823 @opindex mslow-bytes
25824 @opindex mno-slow-bytes
25825 Prefer word access when reading byte quantities.
25827 @item -mlittle-endian
25828 @itemx -mbig-endian
25829 @opindex mlittle-endian
25830 @opindex mbig-endian
25831 Generate code for a little-endian target.
25833 @item -m210
25834 @itemx -m340
25835 @opindex m210
25836 @opindex m340
25837 Generate code for the 210 processor.
25839 @item -mno-lsim
25840 @opindex mno-lsim
25841 Assume that runtime support has been provided and so omit the
25842 simulator library (@file{libsim.a)} from the linker command line.
25844 @item -mstack-increment=@var{size}
25845 @opindex mstack-increment
25846 Set the maximum amount for a single stack increment operation.  Large
25847 values can increase the speed of programs that contain functions
25848 that need a large amount of stack space, but they can also trigger a
25849 segmentation fault if the stack is extended too much.  The default
25850 value is 0x1000.
25852 @end table
25854 @node MeP Options
25855 @subsection MeP Options
25856 @cindex MeP options
25858 @table @gcctabopt
25860 @item -mabsdiff
25861 @opindex mabsdiff
25862 Enables the @code{abs} instruction, which is the absolute difference
25863 between two registers.
25865 @item -mall-opts
25866 @opindex mall-opts
25867 Enables all the optional instructions---average, multiply, divide, bit
25868 operations, leading zero, absolute difference, min/max, clip, and
25869 saturation.
25872 @item -maverage
25873 @opindex maverage
25874 Enables the @code{ave} instruction, which computes the average of two
25875 registers.
25877 @item -mbased=@var{n}
25878 @opindex mbased=
25879 Variables of size @var{n} bytes or smaller are placed in the
25880 @code{.based} section by default.  Based variables use the @code{$tp}
25881 register as a base register, and there is a 128-byte limit to the
25882 @code{.based} section.
25884 @item -mbitops
25885 @opindex mbitops
25886 Enables the bit operation instructions---bit test (@code{btstm}), set
25887 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
25888 test-and-set (@code{tas}).
25890 @item -mc=@var{name}
25891 @opindex mc=
25892 Selects which section constant data is placed in.  @var{name} may
25893 be @samp{tiny}, @samp{near}, or @samp{far}.
25895 @item -mclip
25896 @opindex mclip
25897 Enables the @code{clip} instruction.  Note that @option{-mclip} is not
25898 useful unless you also provide @option{-mminmax}.
25900 @item -mconfig=@var{name}
25901 @opindex mconfig=
25902 Selects one of the built-in core configurations.  Each MeP chip has
25903 one or more modules in it; each module has a core CPU and a variety of
25904 coprocessors, optional instructions, and peripherals.  The
25905 @code{MeP-Integrator} tool, not part of GCC, provides these
25906 configurations through this option; using this option is the same as
25907 using all the corresponding command-line options.  The default
25908 configuration is @samp{default}.
25910 @item -mcop
25911 @opindex mcop
25912 Enables the coprocessor instructions.  By default, this is a 32-bit
25913 coprocessor.  Note that the coprocessor is normally enabled via the
25914 @option{-mconfig=} option.
25916 @item -mcop32
25917 @opindex mcop32
25918 Enables the 32-bit coprocessor's instructions.
25920 @item -mcop64
25921 @opindex mcop64
25922 Enables the 64-bit coprocessor's instructions.
25924 @item -mivc2
25925 @opindex mivc2
25926 Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
25928 @item -mdc
25929 @opindex mdc
25930 Causes constant variables to be placed in the @code{.near} section.
25932 @item -mdiv
25933 @opindex mdiv
25934 Enables the @code{div} and @code{divu} instructions.
25936 @item -meb
25937 @opindex meb
25938 Generate big-endian code.
25940 @item -mel
25941 @opindex mel
25942 Generate little-endian code.
25944 @item -mio-volatile
25945 @opindex mio-volatile
25946 Tells the compiler that any variable marked with the @code{io}
25947 attribute is to be considered volatile.
25949 @item -ml
25950 @opindex ml
25951 Causes variables to be assigned to the @code{.far} section by default.
25953 @item -mleadz
25954 @opindex mleadz
25955 Enables the @code{leadz} (leading zero) instruction.
25957 @item -mm
25958 @opindex mm
25959 Causes variables to be assigned to the @code{.near} section by default.
25961 @item -mminmax
25962 @opindex mminmax
25963 Enables the @code{min} and @code{max} instructions.
25965 @item -mmult
25966 @opindex mmult
25967 Enables the multiplication and multiply-accumulate instructions.
25969 @item -mno-opts
25970 @opindex mno-opts
25971 Disables all the optional instructions enabled by @option{-mall-opts}.
25973 @item -mrepeat
25974 @opindex mrepeat
25975 Enables the @code{repeat} and @code{erepeat} instructions, used for
25976 low-overhead looping.
25978 @item -ms
25979 @opindex ms
25980 Causes all variables to default to the @code{.tiny} section.  Note
25981 that there is a 65536-byte limit to this section.  Accesses to these
25982 variables use the @code{%gp} base register.
25984 @item -msatur
25985 @opindex msatur
25986 Enables the saturation instructions.  Note that the compiler does not
25987 currently generate these itself, but this option is included for
25988 compatibility with other tools, like @code{as}.
25990 @item -msdram
25991 @opindex msdram
25992 Link the SDRAM-based runtime instead of the default ROM-based runtime.
25994 @item -msim
25995 @opindex msim
25996 Link the simulator run-time libraries.
25998 @item -msimnovec
25999 @opindex msimnovec
26000 Link the simulator runtime libraries, excluding built-in support
26001 for reset and exception vectors and tables.
26003 @item -mtf
26004 @opindex mtf
26005 Causes all functions to default to the @code{.far} section.  Without
26006 this option, functions default to the @code{.near} section.
26008 @item -mtiny=@var{n}
26009 @opindex mtiny=
26010 Variables that are @var{n} bytes or smaller are allocated to the
26011 @code{.tiny} section.  These variables use the @code{$gp} base
26012 register.  The default for this option is 4, but note that there's a
26013 65536-byte limit to the @code{.tiny} section.
26015 @end table
26017 @node MicroBlaze Options
26018 @subsection MicroBlaze Options
26019 @cindex MicroBlaze Options
26021 @table @gcctabopt
26023 @item -msoft-float
26024 @opindex msoft-float
26025 Use software emulation for floating point (default).
26027 @item -mhard-float
26028 @opindex mhard-float
26029 Use hardware floating-point instructions.
26031 @item -mmemcpy
26032 @opindex mmemcpy
26033 Do not optimize block moves, use @code{memcpy}.
26035 @item -mno-clearbss
26036 @opindex mno-clearbss
26037 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
26039 @item -mcpu=@var{cpu-type}
26040 @opindex mcpu=
26041 Use features of, and schedule code for, the given CPU.
26042 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
26043 where @var{X} is a major version, @var{YY} is the minor version, and
26044 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
26045 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
26047 @item -mxl-soft-mul
26048 @opindex mxl-soft-mul
26049 Use software multiply emulation (default).
26051 @item -mxl-soft-div
26052 @opindex mxl-soft-div
26053 Use software emulation for divides (default).
26055 @item -mxl-barrel-shift
26056 @opindex mxl-barrel-shift
26057 Use the hardware barrel shifter.
26059 @item -mxl-pattern-compare
26060 @opindex mxl-pattern-compare
26061 Use pattern compare instructions.
26063 @item -msmall-divides
26064 @opindex msmall-divides
26065 Use table lookup optimization for small signed integer divisions.
26067 @item -mxl-stack-check
26068 @opindex mxl-stack-check
26069 This option is deprecated.  Use @option{-fstack-check} instead.
26071 @item -mxl-gp-opt
26072 @opindex mxl-gp-opt
26073 Use GP-relative @code{.sdata}/@code{.sbss} sections.
26075 @item -mxl-multiply-high
26076 @opindex mxl-multiply-high
26077 Use multiply high instructions for high part of 32x32 multiply.
26079 @item -mxl-float-convert
26080 @opindex mxl-float-convert
26081 Use hardware floating-point conversion instructions.
26083 @item -mxl-float-sqrt
26084 @opindex mxl-float-sqrt
26085 Use hardware floating-point square root instruction.
26087 @item -mbig-endian
26088 @opindex mbig-endian
26089 Generate code for a big-endian target.
26091 @item -mlittle-endian
26092 @opindex mlittle-endian
26093 Generate code for a little-endian target.
26095 @item -mxl-reorder
26096 @opindex mxl-reorder
26097 Use reorder instructions (swap and byte reversed load/store).
26099 @item -mxl-mode-@var{app-model}
26100 Select application model @var{app-model}.  Valid models are
26101 @table @samp
26102 @item executable
26103 normal executable (default), uses startup code @file{crt0.o}.
26105 @item xmdstub
26106 for use with Xilinx Microprocessor Debugger (XMD) based
26107 software intrusive debug agent called xmdstub. This uses startup file
26108 @file{crt1.o} and sets the start address of the program to 0x800.
26110 @item bootstrap
26111 for applications that are loaded using a bootloader.
26112 This model uses startup file @file{crt2.o} which does not contain a processor
26113 reset vector handler. This is suitable for transferring control on a
26114 processor reset to the bootloader rather than the application.
26116 @item novectors
26117 for applications that do not require any of the
26118 MicroBlaze vectors. This option may be useful for applications running
26119 within a monitoring application. This model uses @file{crt3.o} as a startup file.
26120 @end table
26122 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
26123 @option{-mxl-mode-@var{app-model}}.
26125 @item -mpic-data-is-text-relative
26126 @opindex mpic-data-is-text-relative
26127 Assume that the displacement between the text and data segments is fixed
26128 at static link time.  This allows data to be referenced by offset from start of
26129 text address instead of GOT since PC-relative addressing is not supported.
26131 @end table
26133 @node MIPS Options
26134 @subsection MIPS Options
26135 @cindex MIPS options
26137 @table @gcctabopt
26139 @item -EB
26140 @opindex EB
26141 Generate big-endian code.
26143 @item -EL
26144 @opindex EL
26145 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
26146 configurations.
26148 @item -march=@var{arch}
26149 @opindex march
26150 Generate code that runs on @var{arch}, which can be the name of a
26151 generic MIPS ISA, or the name of a particular processor.
26152 The ISA names are:
26153 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
26154 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
26155 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
26156 @samp{mips64r5} and @samp{mips64r6}.
26157 The processor names are:
26158 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
26159 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
26160 @samp{5kc}, @samp{5kf},
26161 @samp{20kc},
26162 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
26163 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
26164 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
26165 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
26166 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
26167 @samp{i6400}, @samp{i6500},
26168 @samp{interaptiv},
26169 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
26170 @samp{gs464e}, @samp{gs264e},
26171 @samp{m4k},
26172 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
26173 @samp{m5100}, @samp{m5101},
26174 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
26175 @samp{orion},
26176 @samp{p5600}, @samp{p6600},
26177 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
26178 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
26179 @samp{r6000}, @samp{r8000},
26180 @samp{rm7000}, @samp{rm9000},
26181 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
26182 @samp{sb1},
26183 @samp{sr71000},
26184 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
26185 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
26186 @samp{xlr} and @samp{xlp}.
26187 The special value @samp{from-abi} selects the
26188 most compatible architecture for the selected ABI (that is,
26189 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
26191 The native Linux/GNU toolchain also supports the value @samp{native},
26192 which selects the best architecture option for the host processor.
26193 @option{-march=native} has no effect if GCC does not recognize
26194 the processor.
26196 In processor names, a final @samp{000} can be abbreviated as @samp{k}
26197 (for example, @option{-march=r2k}).  Prefixes are optional, and
26198 @samp{vr} may be written @samp{r}.
26200 Names of the form @samp{@var{n}f2_1} refer to processors with
26201 FPUs clocked at half the rate of the core, names of the form
26202 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
26203 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
26204 processors with FPUs clocked a ratio of 3:2 with respect to the core.
26205 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
26206 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
26207 accepted as synonyms for @samp{@var{n}f1_1}.
26209 GCC defines two macros based on the value of this option.  The first
26210 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
26211 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
26212 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
26213 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
26214 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
26216 Note that the @code{_MIPS_ARCH} macro uses the processor names given
26217 above.  In other words, it has the full prefix and does not
26218 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
26219 the macro names the resolved architecture (either @code{"mips1"} or
26220 @code{"mips3"}).  It names the default architecture when no
26221 @option{-march} option is given.
26223 @item -mtune=@var{arch}
26224 @opindex mtune
26225 Optimize for @var{arch}.  Among other things, this option controls
26226 the way instructions are scheduled, and the perceived cost of arithmetic
26227 operations.  The list of @var{arch} values is the same as for
26228 @option{-march}.
26230 When this option is not used, GCC optimizes for the processor
26231 specified by @option{-march}.  By using @option{-march} and
26232 @option{-mtune} together, it is possible to generate code that
26233 runs on a family of processors, but optimize the code for one
26234 particular member of that family.
26236 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
26237 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
26238 @option{-march} ones described above.
26240 @item -mips1
26241 @opindex mips1
26242 Equivalent to @option{-march=mips1}.
26244 @item -mips2
26245 @opindex mips2
26246 Equivalent to @option{-march=mips2}.
26248 @item -mips3
26249 @opindex mips3
26250 Equivalent to @option{-march=mips3}.
26252 @item -mips4
26253 @opindex mips4
26254 Equivalent to @option{-march=mips4}.
26256 @item -mips32
26257 @opindex mips32
26258 Equivalent to @option{-march=mips32}.
26260 @item -mips32r3
26261 @opindex mips32r3
26262 Equivalent to @option{-march=mips32r3}.
26264 @item -mips32r5
26265 @opindex mips32r5
26266 Equivalent to @option{-march=mips32r5}.
26268 @item -mips32r6
26269 @opindex mips32r6
26270 Equivalent to @option{-march=mips32r6}.
26272 @item -mips64
26273 @opindex mips64
26274 Equivalent to @option{-march=mips64}.
26276 @item -mips64r2
26277 @opindex mips64r2
26278 Equivalent to @option{-march=mips64r2}.
26280 @item -mips64r3
26281 @opindex mips64r3
26282 Equivalent to @option{-march=mips64r3}.
26284 @item -mips64r5
26285 @opindex mips64r5
26286 Equivalent to @option{-march=mips64r5}.
26288 @item -mips64r6
26289 @opindex mips64r6
26290 Equivalent to @option{-march=mips64r6}.
26292 @item -mips16
26293 @itemx -mno-mips16
26294 @opindex mips16
26295 @opindex mno-mips16
26296 Generate (do not generate) MIPS16 code.  If GCC is targeting a
26297 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
26299 MIPS16 code generation can also be controlled on a per-function basis
26300 by means of @code{mips16} and @code{nomips16} attributes.
26301 @xref{Function Attributes}, for more information.
26303 @item -mflip-mips16
26304 @opindex mflip-mips16
26305 Generate MIPS16 code on alternating functions.  This option is provided
26306 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
26307 not intended for ordinary use in compiling user code.
26309 @item -minterlink-compressed
26310 @itemx -mno-interlink-compressed
26311 @opindex minterlink-compressed
26312 @opindex mno-interlink-compressed
26313 Require (do not require) that code using the standard (uncompressed) MIPS ISA
26314 be link-compatible with MIPS16 and microMIPS code, and vice versa.
26316 For example, code using the standard ISA encoding cannot jump directly
26317 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
26318 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
26319 knows that the target of the jump is not compressed.
26321 @item -minterlink-mips16
26322 @itemx -mno-interlink-mips16
26323 @opindex minterlink-mips16
26324 @opindex mno-interlink-mips16
26325 Aliases of @option{-minterlink-compressed} and
26326 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
26327 and are retained for backwards compatibility.
26329 @item -mabi=32
26330 @itemx -mabi=o64
26331 @itemx -mabi=n32
26332 @itemx -mabi=64
26333 @itemx -mabi=eabi
26334 @opindex mabi=32
26335 @opindex mabi=o64
26336 @opindex mabi=n32
26337 @opindex mabi=64
26338 @opindex mabi=eabi
26339 Generate code for the given ABI@.
26341 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
26342 generates 64-bit code when you select a 64-bit architecture, but you
26343 can use @option{-mgp32} to get 32-bit code instead.
26345 For information about the O64 ABI, see
26346 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
26348 GCC supports a variant of the o32 ABI in which floating-point registers
26349 are 64 rather than 32 bits wide.  You can select this combination with
26350 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
26351 and @code{mfhc1} instructions and is therefore only supported for
26352 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
26354 The register assignments for arguments and return values remain the
26355 same, but each scalar value is passed in a single 64-bit register
26356 rather than a pair of 32-bit registers.  For example, scalar
26357 floating-point values are returned in @samp{$f0} only, not a
26358 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
26359 remains the same in that the even-numbered double-precision registers
26360 are saved.
26362 Two additional variants of the o32 ABI are supported to enable
26363 a transition from 32-bit to 64-bit registers.  These are FPXX
26364 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
26365 The FPXX extension mandates that all code must execute correctly
26366 when run using 32-bit or 64-bit registers.  The code can be interlinked
26367 with either FP32 or FP64, but not both.
26368 The FP64A extension is similar to the FP64 extension but forbids the
26369 use of odd-numbered single-precision registers.  This can be used
26370 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
26371 processors and allows both FP32 and FP64A code to interlink and
26372 run in the same process without changing FPU modes.
26374 @item -mabicalls
26375 @itemx -mno-abicalls
26376 @opindex mabicalls
26377 @opindex mno-abicalls
26378 Generate (do not generate) code that is suitable for SVR4-style
26379 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
26380 systems.
26382 @item -mshared
26383 @itemx -mno-shared
26384 Generate (do not generate) code that is fully position-independent,
26385 and that can therefore be linked into shared libraries.  This option
26386 only affects @option{-mabicalls}.
26388 All @option{-mabicalls} code has traditionally been position-independent,
26389 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
26390 as an extension, the GNU toolchain allows executables to use absolute
26391 accesses for locally-binding symbols.  It can also use shorter GP
26392 initialization sequences and generate direct calls to locally-defined
26393 functions.  This mode is selected by @option{-mno-shared}.
26395 @option{-mno-shared} depends on binutils 2.16 or higher and generates
26396 objects that can only be linked by the GNU linker.  However, the option
26397 does not affect the ABI of the final executable; it only affects the ABI
26398 of relocatable objects.  Using @option{-mno-shared} generally makes
26399 executables both smaller and quicker.
26401 @option{-mshared} is the default.
26403 @item -mplt
26404 @itemx -mno-plt
26405 @opindex mplt
26406 @opindex mno-plt
26407 Assume (do not assume) that the static and dynamic linkers
26408 support PLTs and copy relocations.  This option only affects
26409 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
26410 has no effect without @option{-msym32}.
26412 You can make @option{-mplt} the default by configuring
26413 GCC with @option{--with-mips-plt}.  The default is
26414 @option{-mno-plt} otherwise.
26416 @item -mxgot
26417 @itemx -mno-xgot
26418 @opindex mxgot
26419 @opindex mno-xgot
26420 Lift (do not lift) the usual restrictions on the size of the global
26421 offset table.
26423 GCC normally uses a single instruction to load values from the GOT@.
26424 While this is relatively efficient, it only works if the GOT
26425 is smaller than about 64k.  Anything larger causes the linker
26426 to report an error such as:
26428 @cindex relocation truncated to fit (MIPS)
26429 @smallexample
26430 relocation truncated to fit: R_MIPS_GOT16 foobar
26431 @end smallexample
26433 If this happens, you should recompile your code with @option{-mxgot}.
26434 This works with very large GOTs, although the code is also
26435 less efficient, since it takes three instructions to fetch the
26436 value of a global symbol.
26438 Note that some linkers can create multiple GOTs.  If you have such a
26439 linker, you should only need to use @option{-mxgot} when a single object
26440 file accesses more than 64k's worth of GOT entries.  Very few do.
26442 These options have no effect unless GCC is generating position
26443 independent code.
26445 @item -mgp32
26446 @opindex mgp32
26447 Assume that general-purpose registers are 32 bits wide.
26449 @item -mgp64
26450 @opindex mgp64
26451 Assume that general-purpose registers are 64 bits wide.
26453 @item -mfp32
26454 @opindex mfp32
26455 Assume that floating-point registers are 32 bits wide.
26457 @item -mfp64
26458 @opindex mfp64
26459 Assume that floating-point registers are 64 bits wide.
26461 @item -mfpxx
26462 @opindex mfpxx
26463 Do not assume the width of floating-point registers.
26465 @item -mhard-float
26466 @opindex mhard-float
26467 Use floating-point coprocessor instructions.
26469 @item -msoft-float
26470 @opindex msoft-float
26471 Do not use floating-point coprocessor instructions.  Implement
26472 floating-point calculations using library calls instead.
26474 @item -mno-float
26475 @opindex mno-float
26476 Equivalent to @option{-msoft-float}, but additionally asserts that the
26477 program being compiled does not perform any floating-point operations.
26478 This option is presently supported only by some bare-metal MIPS
26479 configurations, where it may select a special set of libraries
26480 that lack all floating-point support (including, for example, the
26481 floating-point @code{printf} formats).  
26482 If code compiled with @option{-mno-float} accidentally contains
26483 floating-point operations, it is likely to suffer a link-time
26484 or run-time failure.
26486 @item -msingle-float
26487 @opindex msingle-float
26488 Assume that the floating-point coprocessor only supports single-precision
26489 operations.
26491 @item -mdouble-float
26492 @opindex mdouble-float
26493 Assume that the floating-point coprocessor supports double-precision
26494 operations.  This is the default.
26496 @item -modd-spreg
26497 @itemx -mno-odd-spreg
26498 @opindex modd-spreg
26499 @opindex mno-odd-spreg
26500 Enable the use of odd-numbered single-precision floating-point registers
26501 for the o32 ABI.  This is the default for processors that are known to
26502 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
26503 is set by default.
26505 @item -mabs=2008
26506 @itemx -mabs=legacy
26507 @opindex mabs=2008
26508 @opindex mabs=legacy
26509 These options control the treatment of the special not-a-number (NaN)
26510 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
26511 @code{neg.@i{fmt}} machine instructions.
26513 By default or when @option{-mabs=legacy} is used the legacy
26514 treatment is selected.  In this case these instructions are considered
26515 arithmetic and avoided where correct operation is required and the
26516 input operand might be a NaN.  A longer sequence of instructions that
26517 manipulate the sign bit of floating-point datum manually is used
26518 instead unless the @option{-ffinite-math-only} option has also been
26519 specified.
26521 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
26522 this case these instructions are considered non-arithmetic and therefore
26523 operating correctly in all cases, including in particular where the
26524 input operand is a NaN.  These instructions are therefore always used
26525 for the respective operations.
26527 @item -mnan=2008
26528 @itemx -mnan=legacy
26529 @opindex mnan=2008
26530 @opindex mnan=legacy
26531 These options control the encoding of the special not-a-number (NaN)
26532 IEEE 754 floating-point data.
26534 The @option{-mnan=legacy} option selects the legacy encoding.  In this
26535 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
26536 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
26537 by the first bit of their trailing significand field being 1.
26539 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
26540 this case qNaNs are denoted by the first bit of their trailing
26541 significand field being 1, whereas sNaNs are denoted by the first bit of
26542 their trailing significand field being 0.
26544 The default is @option{-mnan=legacy} unless GCC has been configured with
26545 @option{--with-nan=2008}.
26547 @item -mllsc
26548 @itemx -mno-llsc
26549 @opindex mllsc
26550 @opindex mno-llsc
26551 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
26552 implement atomic memory built-in functions.  When neither option is
26553 specified, GCC uses the instructions if the target architecture
26554 supports them.
26556 @option{-mllsc} is useful if the runtime environment can emulate the
26557 instructions and @option{-mno-llsc} can be useful when compiling for
26558 nonstandard ISAs.  You can make either option the default by
26559 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
26560 respectively.  @option{--with-llsc} is the default for some
26561 configurations; see the installation documentation for details.
26563 @item -mdsp
26564 @itemx -mno-dsp
26565 @opindex mdsp
26566 @opindex mno-dsp
26567 Use (do not use) revision 1 of the MIPS DSP ASE@.
26568 @xref{MIPS DSP Built-in Functions}.  This option defines the
26569 preprocessor macro @code{__mips_dsp}.  It also defines
26570 @code{__mips_dsp_rev} to 1.
26572 @item -mdspr2
26573 @itemx -mno-dspr2
26574 @opindex mdspr2
26575 @opindex mno-dspr2
26576 Use (do not use) revision 2 of the MIPS DSP ASE@.
26577 @xref{MIPS DSP Built-in Functions}.  This option defines the
26578 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
26579 It also defines @code{__mips_dsp_rev} to 2.
26581 @item -msmartmips
26582 @itemx -mno-smartmips
26583 @opindex msmartmips
26584 @opindex mno-smartmips
26585 Use (do not use) the MIPS SmartMIPS ASE.
26587 @item -mpaired-single
26588 @itemx -mno-paired-single
26589 @opindex mpaired-single
26590 @opindex mno-paired-single
26591 Use (do not use) paired-single floating-point instructions.
26592 @xref{MIPS Paired-Single Support}.  This option requires
26593 hardware floating-point support to be enabled.
26595 @item -mdmx
26596 @itemx -mno-mdmx
26597 @opindex mdmx
26598 @opindex mno-mdmx
26599 Use (do not use) MIPS Digital Media Extension instructions.
26600 This option can only be used when generating 64-bit code and requires
26601 hardware floating-point support to be enabled.
26603 @item -mips3d
26604 @itemx -mno-mips3d
26605 @opindex mips3d
26606 @opindex mno-mips3d
26607 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
26608 The option @option{-mips3d} implies @option{-mpaired-single}.
26610 @item -mmicromips
26611 @itemx -mno-micromips
26612 @opindex mmicromips
26613 @opindex mno-mmicromips
26614 Generate (do not generate) microMIPS code.
26616 MicroMIPS code generation can also be controlled on a per-function basis
26617 by means of @code{micromips} and @code{nomicromips} attributes.
26618 @xref{Function Attributes}, for more information.
26620 @item -mmt
26621 @itemx -mno-mt
26622 @opindex mmt
26623 @opindex mno-mt
26624 Use (do not use) MT Multithreading instructions.
26626 @item -mmcu
26627 @itemx -mno-mcu
26628 @opindex mmcu
26629 @opindex mno-mcu
26630 Use (do not use) the MIPS MCU ASE instructions.
26632 @item -meva
26633 @itemx -mno-eva
26634 @opindex meva
26635 @opindex mno-eva
26636 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
26638 @item -mvirt
26639 @itemx -mno-virt
26640 @opindex mvirt
26641 @opindex mno-virt
26642 Use (do not use) the MIPS Virtualization (VZ) instructions.
26644 @item -mxpa
26645 @itemx -mno-xpa
26646 @opindex mxpa
26647 @opindex mno-xpa
26648 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
26650 @item -mcrc
26651 @itemx -mno-crc
26652 @opindex mcrc
26653 @opindex mno-crc
26654 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
26656 @item -mginv
26657 @itemx -mno-ginv
26658 @opindex mginv
26659 @opindex mno-ginv
26660 Use (do not use) the MIPS Global INValidate (GINV) instructions.
26662 @item -mloongson-mmi
26663 @itemx -mno-loongson-mmi
26664 @opindex mloongson-mmi
26665 @opindex mno-loongson-mmi
26666 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
26668 @item -mloongson-ext
26669 @itemx -mno-loongson-ext
26670 @opindex mloongson-ext
26671 @opindex mno-loongson-ext
26672 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
26674 @item -mloongson-ext2
26675 @itemx -mno-loongson-ext2
26676 @opindex mloongson-ext2
26677 @opindex mno-loongson-ext2
26678 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
26680 @item -mlong64
26681 @opindex mlong64
26682 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
26683 an explanation of the default and the way that the pointer size is
26684 determined.
26686 @item -mlong32
26687 @opindex mlong32
26688 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
26690 The default size of @code{int}s, @code{long}s and pointers depends on
26691 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
26692 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
26693 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
26694 or the same size as integer registers, whichever is smaller.
26696 @item -msym32
26697 @itemx -mno-sym32
26698 @opindex msym32
26699 @opindex mno-sym32
26700 Assume (do not assume) that all symbols have 32-bit values, regardless
26701 of the selected ABI@.  This option is useful in combination with
26702 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
26703 to generate shorter and faster references to symbolic addresses.
26705 @item -G @var{num}
26706 @opindex G
26707 Put definitions of externally-visible data in a small data section
26708 if that data is no bigger than @var{num} bytes.  GCC can then generate
26709 more efficient accesses to the data; see @option{-mgpopt} for details.
26711 The default @option{-G} option depends on the configuration.
26713 @item -mlocal-sdata
26714 @itemx -mno-local-sdata
26715 @opindex mlocal-sdata
26716 @opindex mno-local-sdata
26717 Extend (do not extend) the @option{-G} behavior to local data too,
26718 such as to static variables in C@.  @option{-mlocal-sdata} is the
26719 default for all configurations.
26721 If the linker complains that an application is using too much small data,
26722 you might want to try rebuilding the less performance-critical parts with
26723 @option{-mno-local-sdata}.  You might also want to build large
26724 libraries with @option{-mno-local-sdata}, so that the libraries leave
26725 more room for the main program.
26727 @item -mextern-sdata
26728 @itemx -mno-extern-sdata
26729 @opindex mextern-sdata
26730 @opindex mno-extern-sdata
26731 Assume (do not assume) that externally-defined data is in
26732 a small data section if the size of that data is within the @option{-G} limit.
26733 @option{-mextern-sdata} is the default for all configurations.
26735 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
26736 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
26737 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
26738 is placed in a small data section.  If @var{Var} is defined by another
26739 module, you must either compile that module with a high-enough
26740 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
26741 definition.  If @var{Var} is common, you must link the application
26742 with a high-enough @option{-G} setting.
26744 The easiest way of satisfying these restrictions is to compile
26745 and link every module with the same @option{-G} option.  However,
26746 you may wish to build a library that supports several different
26747 small data limits.  You can do this by compiling the library with
26748 the highest supported @option{-G} setting and additionally using
26749 @option{-mno-extern-sdata} to stop the library from making assumptions
26750 about externally-defined data.
26752 @item -mgpopt
26753 @itemx -mno-gpopt
26754 @opindex mgpopt
26755 @opindex mno-gpopt
26756 Use (do not use) GP-relative accesses for symbols that are known to be
26757 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
26758 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
26759 configurations.
26761 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
26762 might not hold the value of @code{_gp}.  For example, if the code is
26763 part of a library that might be used in a boot monitor, programs that
26764 call boot monitor routines pass an unknown value in @code{$gp}.
26765 (In such situations, the boot monitor itself is usually compiled
26766 with @option{-G0}.)
26768 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
26769 @option{-mno-extern-sdata}.
26771 @item -membedded-data
26772 @itemx -mno-embedded-data
26773 @opindex membedded-data
26774 @opindex mno-embedded-data
26775 Allocate variables to the read-only data section first if possible, then
26776 next in the small data section if possible, otherwise in data.  This gives
26777 slightly slower code than the default, but reduces the amount of RAM required
26778 when executing, and thus may be preferred for some embedded systems.
26780 @item -muninit-const-in-rodata
26781 @itemx -mno-uninit-const-in-rodata
26782 @opindex muninit-const-in-rodata
26783 @opindex mno-uninit-const-in-rodata
26784 Put uninitialized @code{const} variables in the read-only data section.
26785 This option is only meaningful in conjunction with @option{-membedded-data}.
26787 @item -mcode-readable=@var{setting}
26788 @opindex mcode-readable
26789 Specify whether GCC may generate code that reads from executable sections.
26790 There are three possible settings:
26792 @table @gcctabopt
26793 @item -mcode-readable=yes
26794 Instructions may freely access executable sections.  This is the
26795 default setting.
26797 @item -mcode-readable=pcrel
26798 MIPS16 PC-relative load instructions can access executable sections,
26799 but other instructions must not do so.  This option is useful on 4KSc
26800 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
26801 It is also useful on processors that can be configured to have a dual
26802 instruction/data SRAM interface and that, like the M4K, automatically
26803 redirect PC-relative loads to the instruction RAM.
26805 @item -mcode-readable=no
26806 Instructions must not access executable sections.  This option can be
26807 useful on targets that are configured to have a dual instruction/data
26808 SRAM interface but that (unlike the M4K) do not automatically redirect
26809 PC-relative loads to the instruction RAM.
26810 @end table
26812 @item -msplit-addresses
26813 @itemx -mno-split-addresses
26814 @opindex msplit-addresses
26815 @opindex mno-split-addresses
26816 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
26817 relocation operators.  This option has been superseded by
26818 @option{-mexplicit-relocs} but is retained for backwards compatibility.
26820 @item -mexplicit-relocs
26821 @itemx -mno-explicit-relocs
26822 @opindex mexplicit-relocs
26823 @opindex mno-explicit-relocs
26824 Use (do not use) assembler relocation operators when dealing with symbolic
26825 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
26826 is to use assembler macros instead.
26828 @option{-mexplicit-relocs} is the default if GCC was configured
26829 to use an assembler that supports relocation operators.
26831 @item -mcheck-zero-division
26832 @itemx -mno-check-zero-division
26833 @opindex mcheck-zero-division
26834 @opindex mno-check-zero-division
26835 Trap (do not trap) on integer division by zero.
26837 The default is @option{-mcheck-zero-division}.
26839 @item -mdivide-traps
26840 @itemx -mdivide-breaks
26841 @opindex mdivide-traps
26842 @opindex mdivide-breaks
26843 MIPS systems check for division by zero by generating either a
26844 conditional trap or a break instruction.  Using traps results in
26845 smaller code, but is only supported on MIPS II and later.  Also, some
26846 versions of the Linux kernel have a bug that prevents trap from
26847 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
26848 allow conditional traps on architectures that support them and
26849 @option{-mdivide-breaks} to force the use of breaks.
26851 The default is usually @option{-mdivide-traps}, but this can be
26852 overridden at configure time using @option{--with-divide=breaks}.
26853 Divide-by-zero checks can be completely disabled using
26854 @option{-mno-check-zero-division}.
26856 @item -mload-store-pairs
26857 @itemx -mno-load-store-pairs
26858 @opindex mload-store-pairs
26859 @opindex mno-load-store-pairs
26860 Enable (disable) an optimization that pairs consecutive load or store
26861 instructions to enable load/store bonding.  This option is enabled by
26862 default but only takes effect when the selected architecture is known
26863 to support bonding.
26865 @item -munaligned-access
26866 @itemx -mno-unaligned-access
26867 @opindex munaligned-access
26868 @opindex mno-unaligned-access
26869 Enable (disable) direct unaligned access for MIPS Release 6.
26870 MIPSr6 requires load/store unaligned-access support,
26871 by hardware or trap&emulate.
26872 So @option{-mno-unaligned-access} may be needed by kernel.
26874 @item -mmemcpy
26875 @itemx -mno-memcpy
26876 @opindex mmemcpy
26877 @opindex mno-memcpy
26878 Force (do not force) the use of @code{memcpy} for non-trivial block
26879 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
26880 most constant-sized copies.
26882 @item -mlong-calls
26883 @itemx -mno-long-calls
26884 @opindex mlong-calls
26885 @opindex mno-long-calls
26886 Disable (do not disable) use of the @code{jal} instruction.  Calling
26887 functions using @code{jal} is more efficient but requires the caller
26888 and callee to be in the same 256 megabyte segment.
26890 This option has no effect on abicalls code.  The default is
26891 @option{-mno-long-calls}.
26893 @item -mmad
26894 @itemx -mno-mad
26895 @opindex mmad
26896 @opindex mno-mad
26897 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
26898 instructions, as provided by the R4650 ISA@.
26900 @item -mimadd
26901 @itemx -mno-imadd
26902 @opindex mimadd
26903 @opindex mno-imadd
26904 Enable (disable) use of the @code{madd} and @code{msub} integer
26905 instructions.  The default is @option{-mimadd} on architectures
26906 that support @code{madd} and @code{msub} except for the 74k 
26907 architecture where it was found to generate slower code.
26909 @item -mfused-madd
26910 @itemx -mno-fused-madd
26911 @opindex mfused-madd
26912 @opindex mno-fused-madd
26913 Enable (disable) use of the floating-point multiply-accumulate
26914 instructions, when they are available.  The default is
26915 @option{-mfused-madd}.
26917 On the R8000 CPU when multiply-accumulate instructions are used,
26918 the intermediate product is calculated to infinite precision
26919 and is not subject to the FCSR Flush to Zero bit.  This may be
26920 undesirable in some circumstances.  On other processors the result
26921 is numerically identical to the equivalent computation using
26922 separate multiply, add, subtract and negate instructions.
26924 @item -nocpp
26925 @opindex nocpp
26926 Tell the MIPS assembler to not run its preprocessor over user
26927 assembler files (with a @samp{.s} suffix) when assembling them.
26929 @item -mfix-24k
26930 @itemx -mno-fix-24k
26931 @opindex mfix-24k
26932 @opindex mno-fix-24k
26933 Work around the 24K E48 (lost data on stores during refill) errata.
26934 The workarounds are implemented by the assembler rather than by GCC@.
26936 @item -mfix-r4000
26937 @itemx -mno-fix-r4000
26938 @opindex mfix-r4000
26939 @opindex mno-fix-r4000
26940 Work around certain R4000 CPU errata:
26941 @itemize @minus
26942 @item
26943 A double-word or a variable shift may give an incorrect result if executed
26944 immediately after starting an integer division.
26945 @item
26946 A double-word or a variable shift may give an incorrect result if executed
26947 while an integer multiplication is in progress.
26948 @item
26949 An integer division may give an incorrect result if started in a delay slot
26950 of a taken branch or a jump.
26951 @end itemize
26953 @item -mfix-r4400
26954 @itemx -mno-fix-r4400
26955 @opindex mfix-r4400
26956 @opindex mno-fix-r4400
26957 Work around certain R4400 CPU errata:
26958 @itemize @minus
26959 @item
26960 A double-word or a variable shift may give an incorrect result if executed
26961 immediately after starting an integer division.
26962 @end itemize
26964 @item -mfix-r10000
26965 @itemx -mno-fix-r10000
26966 @opindex mfix-r10000
26967 @opindex mno-fix-r10000
26968 Work around certain R10000 errata:
26969 @itemize @minus
26970 @item
26971 @code{ll}/@code{sc} sequences may not behave atomically on revisions
26972 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
26973 @end itemize
26975 This option can only be used if the target architecture supports
26976 branch-likely instructions.  @option{-mfix-r10000} is the default when
26977 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
26978 otherwise.
26980 @item -mfix-r5900
26981 @itemx -mno-fix-r5900
26982 @opindex mfix-r5900
26983 Do not attempt to schedule the preceding instruction into the delay slot
26984 of a branch instruction placed at the end of a short loop of six
26985 instructions or fewer and always schedule a @code{nop} instruction there
26986 instead.  The short loop bug under certain conditions causes loops to
26987 execute only once or twice, due to a hardware bug in the R5900 chip.  The
26988 workaround is implemented by the assembler rather than by GCC@.
26990 @item -mfix-rm7000
26991 @itemx -mno-fix-rm7000
26992 @opindex mfix-rm7000
26993 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
26994 workarounds are implemented by the assembler rather than by GCC@.
26996 @item -mfix-vr4120
26997 @itemx -mno-fix-vr4120
26998 @opindex mfix-vr4120
26999 Work around certain VR4120 errata:
27000 @itemize @minus
27001 @item
27002 @code{dmultu} does not always produce the correct result.
27003 @item
27004 @code{div} and @code{ddiv} do not always produce the correct result if one
27005 of the operands is negative.
27006 @end itemize
27007 The workarounds for the division errata rely on special functions in
27008 @file{libgcc.a}.  At present, these functions are only provided by
27009 the @code{mips64vr*-elf} configurations.
27011 Other VR4120 errata require a NOP to be inserted between certain pairs of
27012 instructions.  These errata are handled by the assembler, not by GCC itself.
27014 @item -mfix-vr4130
27015 @opindex mfix-vr4130
27016 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
27017 workarounds are implemented by the assembler rather than by GCC,
27018 although GCC avoids using @code{mflo} and @code{mfhi} if the
27019 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
27020 instructions are available instead.
27022 @item -mfix-sb1
27023 @itemx -mno-fix-sb1
27024 @opindex mfix-sb1
27025 Work around certain SB-1 CPU core errata.
27026 (This flag currently works around the SB-1 revision 2
27027 ``F1'' and ``F2'' floating-point errata.)
27029 @item -mr10k-cache-barrier=@var{setting}
27030 @opindex mr10k-cache-barrier
27031 Specify whether GCC should insert cache barriers to avoid the
27032 side effects of speculation on R10K processors.
27034 In common with many processors, the R10K tries to predict the outcome
27035 of a conditional branch and speculatively executes instructions from
27036 the ``taken'' branch.  It later aborts these instructions if the
27037 predicted outcome is wrong.  However, on the R10K, even aborted
27038 instructions can have side effects.
27040 This problem only affects kernel stores and, depending on the system,
27041 kernel loads.  As an example, a speculatively-executed store may load
27042 the target memory into cache and mark the cache line as dirty, even if
27043 the store itself is later aborted.  If a DMA operation writes to the
27044 same area of memory before the ``dirty'' line is flushed, the cached
27045 data overwrites the DMA-ed data.  See the R10K processor manual
27046 for a full description, including other potential problems.
27048 One workaround is to insert cache barrier instructions before every memory
27049 access that might be speculatively executed and that might have side
27050 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
27051 controls GCC's implementation of this workaround.  It assumes that
27052 aborted accesses to any byte in the following regions does not have
27053 side effects:
27055 @enumerate
27056 @item
27057 the memory occupied by the current function's stack frame;
27059 @item
27060 the memory occupied by an incoming stack argument;
27062 @item
27063 the memory occupied by an object with a link-time-constant address.
27064 @end enumerate
27066 It is the kernel's responsibility to ensure that speculative
27067 accesses to these regions are indeed safe.
27069 If the input program contains a function declaration such as:
27071 @smallexample
27072 void foo (void);
27073 @end smallexample
27075 then the implementation of @code{foo} must allow @code{j foo} and
27076 @code{jal foo} to be executed speculatively.  GCC honors this
27077 restriction for functions it compiles itself.  It expects non-GCC
27078 functions (such as hand-written assembly code) to do the same.
27080 The option has three forms:
27082 @table @gcctabopt
27083 @item -mr10k-cache-barrier=load-store
27084 Insert a cache barrier before a load or store that might be
27085 speculatively executed and that might have side effects even
27086 if aborted.
27088 @item -mr10k-cache-barrier=store
27089 Insert a cache barrier before a store that might be speculatively
27090 executed and that might have side effects even if aborted.
27092 @item -mr10k-cache-barrier=none
27093 Disable the insertion of cache barriers.  This is the default setting.
27094 @end table
27096 @item -mflush-func=@var{func}
27097 @itemx -mno-flush-func
27098 @opindex mflush-func
27099 Specifies the function to call to flush the I and D caches, or to not
27100 call any such function.  If called, the function must take the same
27101 arguments as the common @code{_flush_func}, that is, the address of the
27102 memory range for which the cache is being flushed, the size of the
27103 memory range, and the number 3 (to flush both caches).  The default
27104 depends on the target GCC was configured for, but commonly is either
27105 @code{_flush_func} or @code{__cpu_flush}.
27107 @item mbranch-cost=@var{num}
27108 @opindex mbranch-cost
27109 Set the cost of branches to roughly @var{num} ``simple'' instructions.
27110 This cost is only a heuristic and is not guaranteed to produce
27111 consistent results across releases.  A zero cost redundantly selects
27112 the default, which is based on the @option{-mtune} setting.
27114 @item -mbranch-likely
27115 @itemx -mno-branch-likely
27116 @opindex mbranch-likely
27117 @opindex mno-branch-likely
27118 Enable or disable use of Branch Likely instructions, regardless of the
27119 default for the selected architecture.  By default, Branch Likely
27120 instructions may be generated if they are supported by the selected
27121 architecture.  An exception is for the MIPS32 and MIPS64 architectures
27122 and processors that implement those architectures; for those, Branch
27123 Likely instructions are not be generated by default because the MIPS32
27124 and MIPS64 architectures specifically deprecate their use.
27126 @item -mcompact-branches=never
27127 @itemx -mcompact-branches=optimal
27128 @itemx -mcompact-branches=always
27129 @opindex mcompact-branches=never
27130 @opindex mcompact-branches=optimal
27131 @opindex mcompact-branches=always
27132 These options control which form of branches will be generated.  The
27133 default is @option{-mcompact-branches=optimal}.
27135 The @option{-mcompact-branches=never} option ensures that compact branch
27136 instructions will never be generated.
27138 The @option{-mcompact-branches=always} option ensures that a compact
27139 branch instruction will be generated if available for MIPS Release 6 onwards.
27140 If a compact branch instruction is not available (or pre-R6),
27141 a delay slot form of the branch will be used instead.
27143 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
27144 The behaviour for MIPS16/microMIPS may change in future,
27145 since they do have some compact branch instructions.
27147 The @option{-mcompact-branches=optimal} option will cause a delay slot
27148 branch to be used if one is available in the current ISA and the delay
27149 slot is successfully filled.  If the delay slot is not filled, a compact
27150 branch will be chosen if one is available.
27152 @item -mfp-exceptions
27153 @itemx -mno-fp-exceptions
27154 @opindex mfp-exceptions
27155 Specifies whether FP exceptions are enabled.  This affects how
27156 FP instructions are scheduled for some processors.
27157 The default is that FP exceptions are
27158 enabled.
27160 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
27161 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
27162 FP pipe.
27164 @item -mvr4130-align
27165 @itemx -mno-vr4130-align
27166 @opindex mvr4130-align
27167 The VR4130 pipeline is two-way superscalar, but can only issue two
27168 instructions together if the first one is 8-byte aligned.  When this
27169 option is enabled, GCC aligns pairs of instructions that it
27170 thinks should execute in parallel.
27172 This option only has an effect when optimizing for the VR4130.
27173 It normally makes code faster, but at the expense of making it bigger.
27174 It is enabled by default at optimization level @option{-O3}.
27176 @item -msynci
27177 @itemx -mno-synci
27178 @opindex msynci
27179 Enable (disable) generation of @code{synci} instructions on
27180 architectures that support it.  The @code{synci} instructions (if
27181 enabled) are generated when @code{__builtin___clear_cache} is
27182 compiled.
27184 This option defaults to @option{-mno-synci}, but the default can be
27185 overridden by configuring GCC with @option{--with-synci}.
27187 When compiling code for single processor systems, it is generally safe
27188 to use @code{synci}.  However, on many multi-core (SMP) systems, it
27189 does not invalidate the instruction caches on all cores and may lead
27190 to undefined behavior.
27192 @item -mrelax-pic-calls
27193 @itemx -mno-relax-pic-calls
27194 @opindex mrelax-pic-calls
27195 Try to turn PIC calls that are normally dispatched via register
27196 @code{$25} into direct calls.  This is only possible if the linker can
27197 resolve the destination at link time and if the destination is within
27198 range for a direct call.
27200 @option{-mrelax-pic-calls} is the default if GCC was configured to use
27201 an assembler and a linker that support the @code{.reloc} assembly
27202 directive and @option{-mexplicit-relocs} is in effect.  With
27203 @option{-mno-explicit-relocs}, this optimization can be performed by the
27204 assembler and the linker alone without help from the compiler.
27206 @item -mmcount-ra-address
27207 @itemx -mno-mcount-ra-address
27208 @opindex mmcount-ra-address
27209 @opindex mno-mcount-ra-address
27210 Emit (do not emit) code that allows @code{_mcount} to modify the
27211 calling function's return address.  When enabled, this option extends
27212 the usual @code{_mcount} interface with a new @var{ra-address}
27213 parameter, which has type @code{intptr_t *} and is passed in register
27214 @code{$12}.  @code{_mcount} can then modify the return address by
27215 doing both of the following:
27216 @itemize
27217 @item
27218 Returning the new address in register @code{$31}.
27219 @item
27220 Storing the new address in @code{*@var{ra-address}},
27221 if @var{ra-address} is nonnull.
27222 @end itemize
27224 The default is @option{-mno-mcount-ra-address}.
27226 @item -mframe-header-opt
27227 @itemx -mno-frame-header-opt
27228 @opindex mframe-header-opt
27229 Enable (disable) frame header optimization in the o32 ABI.  When using the
27230 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
27231 function to write out register arguments.  When enabled, this optimization
27232 will suppress the allocation of the frame header if it can be determined that
27233 it is unused.
27235 This optimization is off by default at all optimization levels.
27237 @item -mlxc1-sxc1
27238 @itemx -mno-lxc1-sxc1
27239 @opindex mlxc1-sxc1
27240 When applicable, enable (disable) the generation of @code{lwxc1},
27241 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
27243 @item -mmadd4
27244 @itemx -mno-madd4
27245 @opindex mmadd4
27246 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
27247 @code{madd.d} and related instructions.  Enabled by default.
27249 @end table
27251 @node MMIX Options
27252 @subsection MMIX Options
27253 @cindex MMIX Options
27255 These options are defined for the MMIX:
27257 @table @gcctabopt
27258 @item -mlibfuncs
27259 @itemx -mno-libfuncs
27260 @opindex mlibfuncs
27261 @opindex mno-libfuncs
27262 Specify that intrinsic library functions are being compiled, passing all
27263 values in registers, no matter the size.
27265 @item -mepsilon
27266 @itemx -mno-epsilon
27267 @opindex mepsilon
27268 @opindex mno-epsilon
27269 Generate floating-point comparison instructions that compare with respect
27270 to the @code{rE} epsilon register.
27272 @item -mabi=mmixware
27273 @itemx -mabi=gnu
27274 @opindex mabi=mmixware
27275 @opindex mabi=gnu
27276 Generate code that passes function parameters and return values that (in
27277 the called function) are seen as registers @code{$0} and up, as opposed to
27278 the GNU ABI which uses global registers @code{$231} and up.
27280 @item -mzero-extend
27281 @itemx -mno-zero-extend
27282 @opindex mzero-extend
27283 @opindex mno-zero-extend
27284 When reading data from memory in sizes shorter than 64 bits, use (do not
27285 use) zero-extending load instructions by default, rather than
27286 sign-extending ones.
27288 @item -mknuthdiv
27289 @itemx -mno-knuthdiv
27290 @opindex mknuthdiv
27291 @opindex mno-knuthdiv
27292 Make the result of a division yielding a remainder have the same sign as
27293 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
27294 remainder follows the sign of the dividend.  Both methods are
27295 arithmetically valid, the latter being almost exclusively used.
27297 @item -mtoplevel-symbols
27298 @itemx -mno-toplevel-symbols
27299 @opindex mtoplevel-symbols
27300 @opindex mno-toplevel-symbols
27301 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
27302 code can be used with the @code{PREFIX} assembly directive.
27304 @item -melf
27305 @opindex melf
27306 Generate an executable in the ELF format, rather than the default
27307 @samp{mmo} format used by the @command{mmix} simulator.
27309 @item -mbranch-predict
27310 @itemx -mno-branch-predict
27311 @opindex mbranch-predict
27312 @opindex mno-branch-predict
27313 Use (do not use) the probable-branch instructions, when static branch
27314 prediction indicates a probable branch.
27316 @item -mbase-addresses
27317 @itemx -mno-base-addresses
27318 @opindex mbase-addresses
27319 @opindex mno-base-addresses
27320 Generate (do not generate) code that uses @emph{base addresses}.  Using a
27321 base address automatically generates a request (handled by the assembler
27322 and the linker) for a constant to be set up in a global register.  The
27323 register is used for one or more base address requests within the range 0
27324 to 255 from the value held in the register.  The generally leads to short
27325 and fast code, but the number of different data items that can be
27326 addressed is limited.  This means that a program that uses lots of static
27327 data may require @option{-mno-base-addresses}.
27329 @item -msingle-exit
27330 @itemx -mno-single-exit
27331 @opindex msingle-exit
27332 @opindex mno-single-exit
27333 Force (do not force) generated code to have a single exit point in each
27334 function.
27335 @end table
27337 @node MN10300 Options
27338 @subsection MN10300 Options
27339 @cindex MN10300 options
27341 These @option{-m} options are defined for Matsushita MN10300 architectures:
27343 @table @gcctabopt
27344 @item -mmult-bug
27345 @opindex mmult-bug
27346 Generate code to avoid bugs in the multiply instructions for the MN10300
27347 processors.  This is the default.
27349 @item -mno-mult-bug
27350 @opindex mno-mult-bug
27351 Do not generate code to avoid bugs in the multiply instructions for the
27352 MN10300 processors.
27354 @item -mam33
27355 @opindex mam33
27356 Generate code using features specific to the AM33 processor.
27358 @item -mno-am33
27359 @opindex mno-am33
27360 Do not generate code using features specific to the AM33 processor.  This
27361 is the default.
27363 @item -mam33-2
27364 @opindex mam33-2
27365 Generate code using features specific to the AM33/2.0 processor.
27367 @item -mam34
27368 @opindex mam34
27369 Generate code using features specific to the AM34 processor.
27371 @item -mtune=@var{cpu-type}
27372 @opindex mtune
27373 Use the timing characteristics of the indicated CPU type when
27374 scheduling instructions.  This does not change the targeted processor
27375 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
27376 @samp{am33-2} or @samp{am34}.
27378 @item -mreturn-pointer-on-d0
27379 @opindex mreturn-pointer-on-d0
27380 When generating a function that returns a pointer, return the pointer
27381 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
27382 only in @code{a0}, and attempts to call such functions without a prototype
27383 result in errors.  Note that this option is on by default; use
27384 @option{-mno-return-pointer-on-d0} to disable it.
27386 @item -mno-crt0
27387 @opindex mno-crt0
27388 Do not link in the C run-time initialization object file.
27390 @item -mrelax
27391 @opindex mrelax
27392 Indicate to the linker that it should perform a relaxation optimization pass
27393 to shorten branches, calls and absolute memory addresses.  This option only
27394 has an effect when used on the command line for the final link step.
27396 This option makes symbolic debugging impossible.
27398 @item -mliw
27399 @opindex mliw
27400 Allow the compiler to generate @emph{Long Instruction Word}
27401 instructions if the target is the @samp{AM33} or later.  This is the
27402 default.  This option defines the preprocessor macro @code{__LIW__}.
27404 @item -mno-liw
27405 @opindex mno-liw
27406 Do not allow the compiler to generate @emph{Long Instruction Word}
27407 instructions.  This option defines the preprocessor macro
27408 @code{__NO_LIW__}.
27410 @item -msetlb
27411 @opindex msetlb
27412 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
27413 instructions if the target is the @samp{AM33} or later.  This is the
27414 default.  This option defines the preprocessor macro @code{__SETLB__}.
27416 @item -mno-setlb
27417 @opindex mno-setlb
27418 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
27419 instructions.  This option defines the preprocessor macro
27420 @code{__NO_SETLB__}.
27422 @end table
27424 @node Moxie Options
27425 @subsection Moxie Options
27426 @cindex Moxie Options
27428 @table @gcctabopt
27430 @item -meb
27431 @opindex meb
27432 Generate big-endian code.  This is the default for @samp{moxie-*-*}
27433 configurations.
27435 @item -mel
27436 @opindex mel
27437 Generate little-endian code.
27439 @item -mmul.x
27440 @opindex mmul.x
27441 Generate mul.x and umul.x instructions.  This is the default for
27442 @samp{moxiebox-*-*} configurations.
27444 @item -mno-crt0
27445 @opindex mno-crt0
27446 Do not link in the C run-time initialization object file.
27448 @end table
27450 @node MSP430 Options
27451 @subsection MSP430 Options
27452 @cindex MSP430 Options
27454 These options are defined for the MSP430:
27456 @table @gcctabopt
27458 @item -masm-hex
27459 @opindex masm-hex
27460 Force assembly output to always use hex constants.  Normally such
27461 constants are signed decimals, but this option is available for
27462 testsuite and/or aesthetic purposes.
27464 @item -mmcu=
27465 @opindex mmcu=
27466 Select the MCU to target.  This is used to create a C preprocessor
27467 symbol based upon the MCU name, converted to upper case and pre- and
27468 post-fixed with @samp{__}.  This in turn is used by the
27469 @file{msp430.h} header file to select an MCU-specific supplementary
27470 header file.
27472 The option also sets the ISA to use.  If the MCU name is one that is
27473 known to only support the 430 ISA then that is selected, otherwise the
27474 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
27475 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
27476 name selects the 430X ISA.
27478 In addition an MCU-specific linker script is added to the linker
27479 command line.  The script's name is the name of the MCU with
27480 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
27481 command line defines the C preprocessor symbol @code{__XXX__} and
27482 cause the linker to search for a script called @file{xxx.ld}.
27484 The ISA and hardware multiply supported for the different MCUs is hard-coded
27485 into GCC.  However, an external @samp{devices.csv} file can be used to
27486 extend device support beyond those that have been hard-coded.
27488 GCC searches for the @samp{devices.csv} file using the following methods in the
27489 given precedence order, where the first method takes precendence over the
27490 second which takes precedence over the third.
27492 @table @asis
27493 @item Include path specified with @code{-I} and @code{-L}
27494 @samp{devices.csv} will be searched for in each of the directories specified by
27495 include paths and linker library search paths.
27496 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
27497 Define the value of the global environment variable
27498 @samp{MSP430_GCC_INCLUDE_DIR}
27499 to the full path to the directory containing devices.csv, and GCC will search
27500 this directory for devices.csv.  If devices.csv is found, this directory will
27501 also be registered as an include path, and linker library path.  Header files
27502 and linker scripts in this directory can therefore be used without manually
27503 specifying @code{-I} and @code{-L} on the command line.
27504 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
27505 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
27506 toolchain root directory.  This directory does not exist in a default
27507 installation, but if the user has created it and copied @samp{devices.csv}
27508 there, then the MCU data will be read.  As above, this directory will
27509 also be registered as an include path, and linker library path.
27511 @end table
27512 If none of the above search methods find @samp{devices.csv}, then the
27513 hard-coded MCU data is used.
27516 @item -mwarn-mcu
27517 @itemx -mno-warn-mcu
27518 @opindex mwarn-mcu
27519 @opindex mno-warn-mcu
27520 This option enables or disables warnings about conflicts between the
27521 MCU name specified by the @option{-mmcu} option and the ISA set by the
27522 @option{-mcpu} option and/or the hardware multiply support set by the
27523 @option{-mhwmult} option.  It also toggles warnings about unrecognized
27524 MCU names.  This option is on by default.
27526 @item -mcpu=
27527 @opindex mcpu=
27528 Specifies the ISA to use.  Accepted values are @samp{msp430},
27529 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
27530 @option{-mmcu=} option should be used to select the ISA.
27532 @item -msim
27533 @opindex msim
27534 Link to the simulator runtime libraries and linker script.  Overrides
27535 any scripts that would be selected by the @option{-mmcu=} option.
27537 @item -mlarge
27538 @opindex mlarge
27539 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
27541 @item -msmall
27542 @opindex msmall
27543 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
27545 @item -mrelax
27546 @opindex mrelax
27547 This option is passed to the assembler and linker, and allows the
27548 linker to perform certain optimizations that cannot be done until
27549 the final link.
27551 @item mhwmult=
27552 @opindex mhwmult=
27553 Describes the type of hardware multiply supported by the target.
27554 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
27555 for the original 16-bit-only multiply supported by early MCUs.
27556 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
27557 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
27558 A value of @samp{auto} can also be given.  This tells GCC to deduce
27559 the hardware multiply support based upon the MCU name provided by the
27560 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
27561 the MCU name is not recognized then no hardware multiply support is
27562 assumed.  @code{auto} is the default setting.
27564 Hardware multiplies are normally performed by calling a library
27565 routine.  This saves space in the generated code.  When compiling at
27566 @option{-O3} or higher however the hardware multiplier is invoked
27567 inline.  This makes for bigger, but faster code.
27569 The hardware multiply routines disable interrupts whilst running and
27570 restore the previous interrupt state when they finish.  This makes
27571 them safe to use inside interrupt handlers as well as in normal code.
27573 @item -minrt
27574 @opindex minrt
27575 Enable the use of a minimum runtime environment - no static
27576 initializers or constructors.  This is intended for memory-constrained
27577 devices.  The compiler includes special symbols in some objects
27578 that tell the linker and runtime which code fragments are required.
27580 @item -mtiny-printf
27581 @opindex mtiny-printf
27582 Enable reduced code size @code{printf} and @code{puts} library functions.
27583 The @samp{tiny} implementations of these functions are not reentrant, so
27584 must be used with caution in multi-threaded applications.
27586 Support for streams has been removed and the string to be printed will
27587 always be sent to stdout via the @code{write} syscall.  The string is not
27588 buffered before it is sent to write.
27590 This option requires Newlib Nano IO, so GCC must be configured with
27591 @samp{--enable-newlib-nano-formatted-io}.
27593 @item -mmax-inline-shift=
27594 @opindex mmax-inline-shift=
27595 This option takes an integer between 0 and 64 inclusive, and sets
27596 the maximum number of inline shift instructions which should be emitted to
27597 perform a shift operation by a constant amount.  When this value needs to be
27598 exceeded, an mspabi helper function is used instead.  The default value is 4.
27600 This only affects cases where a shift by multiple positions cannot be
27601 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
27603 Shifts of a 32-bit value are at least twice as costly, so the value passed for
27604 this option is divided by 2 and the resulting value used instead.
27606 @item -mcode-region=
27607 @itemx -mdata-region=
27608 @opindex mcode-region
27609 @opindex mdata-region
27610 These options tell the compiler where to place functions and data that
27611 do not have one of the @code{lower}, @code{upper}, @code{either} or
27612 @code{section} attributes.  Possible values are @code{lower},
27613 @code{upper}, @code{either} or @code{any}.  The first three behave
27614 like the corresponding attribute.  The fourth possible value -
27615 @code{any} - is the default.  It leaves placement entirely up to the
27616 linker script and how it assigns the standard sections
27617 (@code{.text}, @code{.data}, etc) to the memory regions.
27619 @item -msilicon-errata=
27620 @opindex msilicon-errata
27621 This option passes on a request to assembler to enable the fixes for
27622 the named silicon errata.
27624 @item -msilicon-errata-warn=
27625 @opindex msilicon-errata-warn
27626 This option passes on a request to the assembler to enable warning
27627 messages when a silicon errata might need to be applied.
27629 @item -mwarn-devices-csv
27630 @itemx -mno-warn-devices-csv
27631 @opindex mwarn-devices-csv
27632 @opindex mno-warn-devices-csv
27633 Warn if @samp{devices.csv} is not found or there are problem parsing it
27634 (default: on).
27636 @end table
27638 @node NDS32 Options
27639 @subsection NDS32 Options
27640 @cindex NDS32 Options
27642 These options are defined for NDS32 implementations:
27644 @table @gcctabopt
27646 @item -mbig-endian
27647 @opindex mbig-endian
27648 Generate code in big-endian mode.
27650 @item -mlittle-endian
27651 @opindex mlittle-endian
27652 Generate code in little-endian mode.
27654 @item -mreduced-regs
27655 @opindex mreduced-regs
27656 Use reduced-set registers for register allocation.
27658 @item -mfull-regs
27659 @opindex mfull-regs
27660 Use full-set registers for register allocation.
27662 @item -mcmov
27663 @opindex mcmov
27664 Generate conditional move instructions.
27666 @item -mno-cmov
27667 @opindex mno-cmov
27668 Do not generate conditional move instructions.
27670 @item -mext-perf
27671 @opindex mext-perf
27672 Generate performance extension instructions.
27674 @item -mno-ext-perf
27675 @opindex mno-ext-perf
27676 Do not generate performance extension instructions.
27678 @item -mext-perf2
27679 @opindex mext-perf2
27680 Generate performance extension 2 instructions.
27682 @item -mno-ext-perf2
27683 @opindex mno-ext-perf2
27684 Do not generate performance extension 2 instructions.
27686 @item -mext-string
27687 @opindex mext-string
27688 Generate string extension instructions.
27690 @item -mno-ext-string
27691 @opindex mno-ext-string
27692 Do not generate string extension instructions.
27694 @item -mv3push
27695 @opindex mv3push
27696 Generate v3 push25/pop25 instructions.
27698 @item -mno-v3push
27699 @opindex mno-v3push
27700 Do not generate v3 push25/pop25 instructions.
27702 @item -m16-bit
27703 @opindex m16-bit
27704 Generate 16-bit instructions.
27706 @item -mno-16-bit
27707 @opindex mno-16-bit
27708 Do not generate 16-bit instructions.
27710 @item -misr-vector-size=@var{num}
27711 @opindex misr-vector-size
27712 Specify the size of each interrupt vector, which must be 4 or 16.
27714 @item -mcache-block-size=@var{num}
27715 @opindex mcache-block-size
27716 Specify the size of each cache block,
27717 which must be a power of 2 between 4 and 512.
27719 @item -march=@var{arch}
27720 @opindex march
27721 Specify the name of the target architecture.
27723 @item -mcmodel=@var{code-model}
27724 @opindex mcmodel
27725 Set the code model to one of
27726 @table @asis
27727 @item @samp{small}
27728 All the data and read-only data segments must be within 512KB addressing space.
27729 The text segment must be within 16MB addressing space.
27730 @item @samp{medium}
27731 The data segment must be within 512KB while the read-only data segment can be
27732 within 4GB addressing space.  The text segment should be still within 16MB
27733 addressing space.
27734 @item @samp{large}
27735 All the text and data segments can be within 4GB addressing space.
27736 @end table
27738 @item -mctor-dtor
27739 @opindex mctor-dtor
27740 Enable constructor/destructor feature.
27742 @item -mrelax
27743 @opindex mrelax
27744 Guide linker to relax instructions.
27746 @end table
27748 @node Nios II Options
27749 @subsection Nios II Options
27750 @cindex Nios II options
27751 @cindex Altera Nios II options
27753 These are the options defined for the Altera Nios II processor.
27755 @table @gcctabopt
27757 @item -G @var{num}
27758 @opindex G
27759 @cindex smaller data references
27760 Put global and static objects less than or equal to @var{num} bytes
27761 into the small data or BSS sections instead of the normal data or BSS
27762 sections.  The default value of @var{num} is 8.
27764 @item -mgpopt=@var{option}
27765 @itemx -mgpopt
27766 @itemx -mno-gpopt
27767 @opindex mgpopt
27768 @opindex mno-gpopt
27769 Generate (do not generate) GP-relative accesses.  The following 
27770 @var{option} names are recognized:
27772 @table @samp
27774 @item none
27775 Do not generate GP-relative accesses.
27777 @item local
27778 Generate GP-relative accesses for small data objects that are not 
27779 external, weak, or uninitialized common symbols.  
27780 Also use GP-relative addressing for objects that
27781 have been explicitly placed in a small data section via a @code{section}
27782 attribute.
27784 @item global
27785 As for @samp{local}, but also generate GP-relative accesses for
27786 small data objects that are external, weak, or common.  If you use this option,
27787 you must ensure that all parts of your program (including libraries) are
27788 compiled with the same @option{-G} setting.
27790 @item data
27791 Generate GP-relative accesses for all data objects in the program.  If you
27792 use this option, the entire data and BSS segments
27793 of your program must fit in 64K of memory and you must use an appropriate
27794 linker script to allocate them within the addressable range of the
27795 global pointer.
27797 @item all
27798 Generate GP-relative addresses for function pointers as well as data
27799 pointers.  If you use this option, the entire text, data, and BSS segments
27800 of your program must fit in 64K of memory and you must use an appropriate
27801 linker script to allocate them within the addressable range of the
27802 global pointer.
27804 @end table
27806 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
27807 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
27809 The default is @option{-mgpopt} except when @option{-fpic} or
27810 @option{-fPIC} is specified to generate position-independent code.
27811 Note that the Nios II ABI does not permit GP-relative accesses from
27812 shared libraries.
27814 You may need to specify @option{-mno-gpopt} explicitly when building
27815 programs that include large amounts of small data, including large
27816 GOT data sections.  In this case, the 16-bit offset for GP-relative
27817 addressing may not be large enough to allow access to the entire 
27818 small data section.
27820 @item -mgprel-sec=@var{regexp}
27821 @opindex mgprel-sec
27822 This option specifies additional section names that can be accessed via
27823 GP-relative addressing.  It is most useful in conjunction with 
27824 @code{section} attributes on variable declarations 
27825 (@pxref{Common Variable Attributes}) and a custom linker script.  
27826 The @var{regexp} is a POSIX Extended Regular Expression.
27828 This option does not affect the behavior of the @option{-G} option, and 
27829 the specified sections are in addition to the standard @code{.sdata}
27830 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
27832 @item -mr0rel-sec=@var{regexp}
27833 @opindex mr0rel-sec
27834 This option specifies names of sections that can be accessed via a 
27835 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
27836 of the 32-bit address space.  It is most useful in conjunction with 
27837 @code{section} attributes on variable declarations 
27838 (@pxref{Common Variable Attributes}) and a custom linker script.  
27839 The @var{regexp} is a POSIX Extended Regular Expression.
27841 In contrast to the use of GP-relative addressing for small data, 
27842 zero-based addressing is never generated by default and there are no 
27843 conventional section names used in standard linker scripts for sections
27844 in the low or high areas of memory.
27846 @item -mel
27847 @itemx -meb
27848 @opindex mel
27849 @opindex meb
27850 Generate little-endian (default) or big-endian (experimental) code,
27851 respectively.
27853 @item -march=@var{arch}
27854 @opindex march
27855 This specifies the name of the target Nios II architecture.  GCC uses this
27856 name to determine what kind of instructions it can emit when generating
27857 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
27859 The preprocessor macro @code{__nios2_arch__} is available to programs,
27860 with value 1 or 2, indicating the targeted ISA level.
27862 @item -mbypass-cache
27863 @itemx -mno-bypass-cache
27864 @opindex mno-bypass-cache
27865 @opindex mbypass-cache
27866 Force all load and store instructions to always bypass cache by 
27867 using I/O variants of the instructions. The default is not to
27868 bypass the cache.
27870 @item -mno-cache-volatile 
27871 @itemx -mcache-volatile       
27872 @opindex mcache-volatile 
27873 @opindex mno-cache-volatile
27874 Volatile memory access bypass the cache using the I/O variants of 
27875 the load and store instructions. The default is not to bypass the cache.
27877 @item -mno-fast-sw-div
27878 @itemx -mfast-sw-div
27879 @opindex mno-fast-sw-div
27880 @opindex mfast-sw-div
27881 Do not use table-based fast divide for small numbers. The default 
27882 is to use the fast divide at @option{-O3} and above.
27884 @item -mno-hw-mul
27885 @itemx -mhw-mul
27886 @itemx -mno-hw-mulx
27887 @itemx -mhw-mulx
27888 @itemx -mno-hw-div
27889 @itemx -mhw-div
27890 @opindex mno-hw-mul
27891 @opindex mhw-mul
27892 @opindex mno-hw-mulx
27893 @opindex mhw-mulx
27894 @opindex mno-hw-div
27895 @opindex mhw-div
27896 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
27897 instructions by the compiler. The default is to emit @code{mul}
27898 and not emit @code{div} and @code{mulx}.
27900 @item -mbmx
27901 @itemx -mno-bmx
27902 @itemx -mcdx
27903 @itemx -mno-cdx
27904 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
27905 CDX (code density) instructions.  Enabling these instructions also
27906 requires @option{-march=r2}.  Since these instructions are optional
27907 extensions to the R2 architecture, the default is not to emit them.
27909 @item -mcustom-@var{insn}=@var{N}
27910 @itemx -mno-custom-@var{insn}
27911 @opindex mcustom-@var{insn}
27912 @opindex mno-custom-@var{insn}
27913 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
27914 custom instruction with encoding @var{N} when generating code that uses 
27915 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
27916 instruction 253 for single-precision floating-point add operations instead
27917 of the default behavior of using a library call.
27919 The following values of @var{insn} are supported.  Except as otherwise
27920 noted, floating-point operations are expected to be implemented with
27921 normal IEEE 754 semantics and correspond directly to the C operators or the
27922 equivalent GCC built-in functions (@pxref{Other Builtins}).
27924 Single-precision floating point:
27925 @table @asis
27927 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
27928 Binary arithmetic operations.
27930 @item @samp{fnegs}
27931 Unary negation.
27933 @item @samp{fabss}
27934 Unary absolute value.
27936 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
27937 Comparison operations.
27939 @item @samp{fmins}, @samp{fmaxs}
27940 Floating-point minimum and maximum.  These instructions are only
27941 generated if @option{-ffinite-math-only} is specified.
27943 @item @samp{fsqrts}
27944 Unary square root operation.
27946 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
27947 Floating-point trigonometric and exponential functions.  These instructions
27948 are only generated if @option{-funsafe-math-optimizations} is also specified.
27950 @end table
27952 Double-precision floating point:
27953 @table @asis
27955 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
27956 Binary arithmetic operations.
27958 @item @samp{fnegd}
27959 Unary negation.
27961 @item @samp{fabsd}
27962 Unary absolute value.
27964 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
27965 Comparison operations.
27967 @item @samp{fmind}, @samp{fmaxd}
27968 Double-precision minimum and maximum.  These instructions are only
27969 generated if @option{-ffinite-math-only} is specified.
27971 @item @samp{fsqrtd}
27972 Unary square root operation.
27974 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
27975 Double-precision trigonometric and exponential functions.  These instructions
27976 are only generated if @option{-funsafe-math-optimizations} is also specified.
27978 @end table
27980 Conversions:
27981 @table @asis
27982 @item @samp{fextsd}
27983 Conversion from single precision to double precision.
27985 @item @samp{ftruncds}
27986 Conversion from double precision to single precision.
27988 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
27989 Conversion from floating point to signed or unsigned integer types, with
27990 truncation towards zero.
27992 @item @samp{round}
27993 Conversion from single-precision floating point to signed integer,
27994 rounding to the nearest integer and ties away from zero.
27995 This corresponds to the @code{__builtin_lroundf} function when
27996 @option{-fno-math-errno} is used.
27998 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
27999 Conversion from signed or unsigned integer types to floating-point types.
28001 @end table
28003 In addition, all of the following transfer instructions for internal
28004 registers X and Y must be provided to use any of the double-precision
28005 floating-point instructions.  Custom instructions taking two
28006 double-precision source operands expect the first operand in the
28007 64-bit register X.  The other operand (or only operand of a unary
28008 operation) is given to the custom arithmetic instruction with the
28009 least significant half in source register @var{src1} and the most
28010 significant half in @var{src2}.  A custom instruction that returns a
28011 double-precision result returns the most significant 32 bits in the
28012 destination register and the other half in 32-bit register Y.  
28013 GCC automatically generates the necessary code sequences to write
28014 register X and/or read register Y when double-precision floating-point
28015 instructions are used.
28017 @table @asis
28019 @item @samp{fwrx}
28020 Write @var{src1} into the least significant half of X and @var{src2} into
28021 the most significant half of X.
28023 @item @samp{fwry}
28024 Write @var{src1} into Y.
28026 @item @samp{frdxhi}, @samp{frdxlo}
28027 Read the most or least (respectively) significant half of X and store it in
28028 @var{dest}.
28030 @item @samp{frdy}
28031 Read the value of Y and store it into @var{dest}.
28032 @end table
28034 Note that you can gain more local control over generation of Nios II custom
28035 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
28036 and @code{target("no-custom-@var{insn}")} function attributes
28037 (@pxref{Function Attributes})
28038 or pragmas (@pxref{Function Specific Option Pragmas}).
28040 @item -mcustom-fpu-cfg=@var{name}
28041 @opindex mcustom-fpu-cfg
28043 This option enables a predefined, named set of custom instruction encodings
28044 (see @option{-mcustom-@var{insn}} above).  
28045 Currently, the following sets are defined:
28047 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
28048 @gccoptlist{-mcustom-fmuls=252 @gol
28049 -mcustom-fadds=253 @gol
28050 -mcustom-fsubs=254 @gol
28051 -fsingle-precision-constant}
28053 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
28054 @gccoptlist{-mcustom-fmuls=252 @gol
28055 -mcustom-fadds=253 @gol
28056 -mcustom-fsubs=254 @gol
28057 -mcustom-fdivs=255 @gol
28058 -fsingle-precision-constant}
28060 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
28061 @gccoptlist{-mcustom-floatus=243 @gol
28062 -mcustom-fixsi=244 @gol
28063 -mcustom-floatis=245 @gol
28064 -mcustom-fcmpgts=246 @gol
28065 -mcustom-fcmples=249 @gol
28066 -mcustom-fcmpeqs=250 @gol
28067 -mcustom-fcmpnes=251 @gol
28068 -mcustom-fmuls=252 @gol
28069 -mcustom-fadds=253 @gol
28070 -mcustom-fsubs=254 @gol
28071 -mcustom-fdivs=255 @gol
28072 -fsingle-precision-constant}
28074 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
28075 @gccoptlist{-mcustom-fabss=224 @gol
28076 -mcustom-fnegs=225 @gol
28077 -mcustom-fcmpnes=226 @gol
28078 -mcustom-fcmpeqs=227 @gol
28079 -mcustom-fcmpges=228 @gol
28080 -mcustom-fcmpgts=229 @gol
28081 -mcustom-fcmples=230 @gol
28082 -mcustom-fcmplts=231 @gol
28083 -mcustom-fmaxs=232 @gol
28084 -mcustom-fmins=233 @gol
28085 -mcustom-round=248 @gol
28086 -mcustom-fixsi=249 @gol
28087 -mcustom-floatis=250 @gol
28088 -mcustom-fsqrts=251 @gol
28089 -mcustom-fmuls=252 @gol
28090 -mcustom-fadds=253 @gol
28091 -mcustom-fsubs=254 @gol
28092 -mcustom-fdivs=255 @gol}
28094 Custom instruction assignments given by individual
28095 @option{-mcustom-@var{insn}=} options override those given by
28096 @option{-mcustom-fpu-cfg=}, regardless of the
28097 order of the options on the command line.
28099 Note that you can gain more local control over selection of a FPU
28100 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
28101 function attribute (@pxref{Function Attributes})
28102 or pragma (@pxref{Function Specific Option Pragmas}).
28104 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
28105 Hardware 2 Component}.  Please note that the custom instructions enabled by
28106 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
28107 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
28108 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
28109 specified.  In contrast to the other configurations,
28110 @option{-fsingle-precision-constant} is not set.
28112 @end table
28114 These additional @samp{-m} options are available for the Altera Nios II
28115 ELF (bare-metal) target:
28117 @table @gcctabopt
28119 @item -mhal
28120 @opindex mhal
28121 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
28122 startup and termination code, and is typically used in conjunction with
28123 @option{-msys-crt0=} to specify the location of the alternate startup code
28124 provided by the HAL BSP.
28126 @item -msmallc
28127 @opindex msmallc
28128 Link with a limited version of the C library, @option{-lsmallc}, rather than
28129 Newlib.
28131 @item -msys-crt0=@var{startfile}
28132 @opindex msys-crt0
28133 @var{startfile} is the file name of the startfile (crt0) to use 
28134 when linking.  This option is only useful in conjunction with @option{-mhal}.
28136 @item -msys-lib=@var{systemlib}
28137 @opindex msys-lib
28138 @var{systemlib} is the library name of the library that provides
28139 low-level system calls required by the C library,
28140 e.g.@: @code{read} and @code{write}.
28141 This option is typically used to link with a library provided by a HAL BSP.
28143 @end table
28145 @node Nvidia PTX Options
28146 @subsection Nvidia PTX Options
28147 @cindex Nvidia PTX options
28148 @cindex nvptx options
28150 These options are defined for Nvidia PTX:
28152 @table @gcctabopt
28154 @item -m64
28155 @opindex m64
28156 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
28157 supported.
28159 @item -march=@var{architecture-string}
28160 @opindex march
28161 Generate code for the specified PTX ISA target architecture
28162 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
28163 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
28164 @samp{sm_80}.
28165 The default depends on how the compiler has been configured, see
28166 @option{--with-arch}.
28168 This option sets the value of the preprocessor macro
28169 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
28170 @samp{350}.
28172 @item -misa=@var{architecture-string}
28173 @opindex misa
28174 Alias of @option{-march=}.
28176 @item -march-map=@var{architecture-string}
28177 @opindex march
28178 Select the closest available @option{-march=} value that is not more
28179 capable.  For instance, for @option{-march-map=sm_50} select
28180 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
28181 @option{-march=sm_53}.
28183 @item -mptx=@var{version-string}
28184 @opindex mptx
28185 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
28186 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
28187 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
28188 version is required for specified PTX ISA target architecture via
28189 option @option{-march=}.
28191 This option sets the values of the preprocessor macros
28192 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
28193 for instance, for @samp{3.1} the macros have the values @samp{3} and
28194 @samp{1}, respectively.
28196 @item -mmainkernel
28197 @opindex mmainkernel
28198 Link in code for a __main kernel.  This is for stand-alone instead of
28199 offloading execution.
28201 @item -moptimize
28202 @opindex moptimize
28203 Apply partitioned execution optimizations.  This is the default when any
28204 level of optimization is selected.
28206 @item -msoft-stack
28207 @opindex msoft-stack
28208 Generate code that does not use @code{.local} memory
28209 directly for stack storage. Instead, a per-warp stack pointer is
28210 maintained explicitly. This enables variable-length stack allocation (with
28211 variable-length arrays or @code{alloca}), and when global memory is used for
28212 underlying storage, makes it possible to access automatic variables from other
28213 threads, or with atomic instructions. This code generation variant is used
28214 for OpenMP offloading, but the option is exposed on its own for the purpose
28215 of testing the compiler; to generate code suitable for linking into programs
28216 using OpenMP offloading, use option @option{-mgomp}.
28218 @item -muniform-simt
28219 @opindex muniform-simt
28220 Switch to code generation variant that allows to execute all threads in each
28221 warp, while maintaining memory state and side effects as if only one thread
28222 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
28223 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
28224 current lane index equals the master lane index), and the register being
28225 assigned is copied via a shuffle instruction from the master lane.  Outside of
28226 SIMD regions lane 0 is the master; inside, each thread sees itself as the
28227 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
28228 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
28229 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
28230 with current lane index to compute the master lane index.
28232 @item -mgomp
28233 @opindex mgomp
28234 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
28235 @option{-muniform-simt} options, and selects corresponding multilib variant.
28237 @end table
28239 @node OpenRISC Options
28240 @subsection OpenRISC Options
28241 @cindex OpenRISC Options
28243 These options are defined for OpenRISC:
28245 @table @gcctabopt
28247 @item -mboard=@var{name}
28248 @opindex mboard
28249 Configure a board specific runtime.  This will be passed to the linker for
28250 newlib board library linking.  The default is @code{or1ksim}.
28252 @item -mnewlib
28253 @opindex mnewlib
28254 This option is ignored; it is for compatibility purposes only.  This used to
28255 select linker and preprocessor options for use with newlib.
28257 @item -msoft-div
28258 @itemx -mhard-div
28259 @opindex msoft-div
28260 @opindex mhard-div
28261 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
28262 This default is hardware divide.
28264 @item -msoft-mul
28265 @itemx -mhard-mul
28266 @opindex msoft-mul
28267 @opindex mhard-mul
28268 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
28269 This default is hardware multiply.
28271 @item -msoft-float
28272 @itemx -mhard-float
28273 @opindex msoft-float
28274 @opindex mhard-float
28275 Select software or hardware for floating point operations.
28276 The default is software.
28278 @item -mdouble-float
28279 @opindex mdouble-float
28280 When @option{-mhard-float} is selected, enables generation of double-precision
28281 floating point instructions.  By default functions from @file{libgcc} are used
28282 to perform double-precision floating point operations.
28284 @item -munordered-float
28285 @opindex munordered-float
28286 When @option{-mhard-float} is selected, enables generation of unordered
28287 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
28288 functions from @file{libgcc} are used to perform unordered floating point
28289 compare and set flag operations.
28291 @item -mcmov
28292 @opindex mcmov
28293 Enable generation of conditional move (@code{l.cmov}) instructions.  By
28294 default the equivalent will be generated using set and branch.
28296 @item -mror
28297 @opindex mror
28298 Enable generation of rotate right (@code{l.ror}) instructions.  By default
28299 functions from @file{libgcc} are used to perform rotate right operations.
28301 @item -mrori
28302 @opindex mrori
28303 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
28304 By default functions from @file{libgcc} are used to perform rotate right with
28305 immediate operations.
28307 @item -msext
28308 @opindex msext
28309 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
28310 memory loads are used to perform sign extension.
28312 @item -msfimm
28313 @opindex msfimm
28314 Enable generation of compare and set flag with immediate (@code{l.sf*i})
28315 instructions.  By default extra instructions will be generated to store the
28316 immediate to a register first.
28318 @item -mshftimm
28319 @opindex mshftimm
28320 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
28321 @code{l.slli}) instructions.  By default extra instructions will be generated
28322 to store the immediate to a register first.
28324 @item -mcmodel=small
28325 @opindex mcmodel=small
28326 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
28327 the default model.
28329 @item -mcmodel=large
28330 @opindex mcmodel=large
28331 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
28334 @end table
28336 @node PDP-11 Options
28337 @subsection PDP-11 Options
28338 @cindex PDP-11 Options
28340 These options are defined for the PDP-11:
28342 @table @gcctabopt
28343 @item -mfpu
28344 @opindex mfpu
28345 Use hardware FPP floating point.  This is the default.  (FIS floating
28346 point on the PDP-11/40 is not supported.)  Implies -m45.
28348 @item -msoft-float
28349 @opindex msoft-float
28350 Do not use hardware floating point.
28352 @item -mac0
28353 @opindex mac0
28354 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
28356 @item -mno-ac0
28357 @opindex mno-ac0
28358 Return floating-point results in memory.  This is the default.
28360 @item -m40
28361 @opindex m40
28362 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
28364 @item -m45
28365 @opindex m45
28366 Generate code for a PDP-11/45.  This is the default.
28368 @item -m10
28369 @opindex m10
28370 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
28372 @item -mint16
28373 @itemx -mno-int32
28374 @opindex mint16
28375 @opindex mno-int32
28376 Use 16-bit @code{int}.  This is the default.
28378 @item -mint32
28379 @itemx -mno-int16
28380 @opindex mint32
28381 @opindex mno-int16
28382 Use 32-bit @code{int}.
28384 @item -msplit
28385 @opindex msplit
28386 Target has split instruction and data space.  Implies -m45.
28388 @item -munix-asm
28389 @opindex munix-asm
28390 Use Unix assembler syntax.
28392 @item -mdec-asm
28393 @opindex mdec-asm
28394 Use DEC assembler syntax.
28396 @item -mgnu-asm
28397 @opindex mgnu-asm
28398 Use GNU assembler syntax.  This is the default.
28400 @item -mlra
28401 @opindex mlra
28402 Use the new LRA register allocator.  By default, the old ``reload''
28403 allocator is used.
28404 @end table
28406 @node picoChip Options
28407 @subsection picoChip Options
28408 @cindex picoChip options
28410 These @samp{-m} options are defined for picoChip implementations:
28412 @table @gcctabopt
28414 @item -mae=@var{ae_type}
28415 @opindex mcpu
28416 Set the instruction set, register set, and instruction scheduling
28417 parameters for array element type @var{ae_type}.  Supported values
28418 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
28420 @option{-mae=ANY} selects a completely generic AE type.  Code
28421 generated with this option runs on any of the other AE types.  The
28422 code is not as efficient as it would be if compiled for a specific
28423 AE type, and some types of operation (e.g., multiplication) do not
28424 work properly on all types of AE.
28426 @option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
28427 for compiled code, and is the default.
28429 @option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
28430 option may suffer from poor performance of byte (char) manipulation,
28431 since the DSP AE does not provide hardware support for byte load/stores.
28433 @item -msymbol-as-address
28434 Enable the compiler to directly use a symbol name as an address in a
28435 load/store instruction, without first loading it into a
28436 register.  Typically, the use of this option generates larger
28437 programs, which run faster than when the option isn't used.  However, the
28438 results vary from program to program, so it is left as a user option,
28439 rather than being permanently enabled.
28441 @item -mno-inefficient-warnings
28442 Disables warnings about the generation of inefficient code.  These
28443 warnings can be generated, for example, when compiling code that
28444 performs byte-level memory operations on the MAC AE type.  The MAC AE has
28445 no hardware support for byte-level memory operations, so all byte
28446 load/stores must be synthesized from word load/store operations.  This is
28447 inefficient and a warning is generated to indicate
28448 that you should rewrite the code to avoid byte operations, or to target
28449 an AE type that has the necessary hardware support.  This option disables
28450 these warnings.
28452 @end table
28454 @node PowerPC Options
28455 @subsection PowerPC Options
28456 @cindex PowerPC options
28458 These are listed under @xref{RS/6000 and PowerPC Options}.
28460 @node PRU Options
28461 @subsection PRU Options
28462 @cindex PRU Options
28464 These command-line options are defined for PRU target:
28466 @table @gcctabopt
28467 @item -minrt
28468 @opindex minrt
28469 Link with a minimum runtime environment, with no support for static
28470 initializers and constructors.  Using this option can significantly reduce
28471 the size of the final ELF binary.  Beware that the compiler could still
28472 generate code with static initializers and constructors.  It is up to the
28473 programmer to ensure that the source program will not use those features.
28475 @item -mmcu=@var{mcu}
28476 @opindex mmcu
28477 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
28478 supported MCUs.
28480 @item -mno-relax
28481 @opindex mno-relax
28482 Make GCC pass the @option{--no-relax} command-line option to the linker
28483 instead of the @option{--relax} option.
28485 @item -mloop
28486 @opindex mloop
28487 Allow (or do not allow) GCC to use the LOOP instruction.
28489 @item -mabi=@var{variant}
28490 @opindex mabi
28491 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
28492 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
28493 more naturally with certain GCC assumptions.  These are the differences:
28495 @table @samp
28496 @item Function Pointer Size
28497 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
28498 supports only 32-bit data and code pointers.
28500 @item Optional Return Value Pointer
28501 Function return values larger than 64 bits are passed by using a hidden
28502 pointer as the first argument of the function.  TI ABI, though, mandates that
28503 the pointer can be NULL in case the caller is not using the returned value.
28504 GNU always passes and expects a valid return value pointer.
28506 @end table
28508 The current @option{-mabi=ti} implementation simply raises a compile error
28509 when any of the above code constructs is detected.  As a consequence
28510 the standard C library cannot be built and it is omitted when linking with
28511 @option{-mabi=ti}.
28513 Relaxation is a GNU feature and for safety reasons is disabled when using
28514 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
28515 instructions, so the GNU linker cannot adjust them when shortening adjacent
28516 LDI32 pseudo instructions.
28518 @end table
28520 @node RISC-V Options
28521 @subsection RISC-V Options
28522 @cindex RISC-V Options
28524 These command-line options are defined for RISC-V targets:
28526 @table @gcctabopt
28527 @item -mbranch-cost=@var{n}
28528 @opindex mbranch-cost
28529 Set the cost of branches to roughly @var{n} instructions.
28531 @item -mplt
28532 @itemx -mno-plt
28533 @opindex plt
28534 When generating PIC code, do or don't allow the use of PLTs. Ignored for
28535 non-PIC.  The default is @option{-mplt}.
28537 @item -mabi=@var{ABI-string}
28538 @opindex mabi
28539 Specify integer and floating-point calling convention.  @var{ABI-string}
28540 contains two parts: the size of integer types and the registers used for
28541 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
28542 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
28543 32-bit), and that floating-point values up to 64 bits wide are passed in F
28544 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
28545 allows the compiler to generate code that uses the F and D extensions but only
28546 allows floating-point values up to 32 bits long to be passed in registers; or
28547 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
28548 passed in registers.
28550 The default for this argument is system dependent, users who want a specific
28551 calling convention should specify one explicitly.  The valid calling
28552 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
28553 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
28554 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
28555 invalid because the ABI requires 64-bit values be passed in F registers, but F
28556 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
28557 only be used with the @samp{rv32e} architecture.  This ABI is not well
28558 specified at present, and is subject to change.
28560 @item -mfdiv
28561 @itemx -mno-fdiv
28562 @opindex mfdiv
28563 Do or don't use hardware floating-point divide and square root instructions.
28564 This requires the F or D extensions for floating-point registers.  The default
28565 is to use them if the specified architecture has these instructions.
28567 @item -mdiv
28568 @itemx -mno-div
28569 @opindex mdiv
28570 Do or don't use hardware instructions for integer division.  This requires the
28571 M extension.  The default is to use them if the specified architecture has
28572 these instructions.
28574 @item -misa-spec=@var{ISA-spec-string}
28575 @opindex misa-spec
28576 Specify the version of the RISC-V Unprivileged (formerly User-Level)
28577 ISA specification to produce code conforming to.  The possibilities
28578 for @var{ISA-spec-string} are:
28579 @table @code
28580 @item 2.2
28581 Produce code conforming to version 2.2.
28582 @item 20190608
28583 Produce code conforming to version 20190608.
28584 @item 20191213
28585 Produce code conforming to version 20191213.
28586 @end table
28587 The default is @option{-misa-spec=20191213} unless GCC has been configured
28588 with @option{--with-isa-spec=} specifying a different default version.
28590 @item -march=@var{ISA-string}
28591 @opindex march
28592 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
28593 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
28594 @samp{rv32imaf}.
28596 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
28598 If both @option{-march} and @option{-mcpu=} are not specified, the default for
28599 this argument is system dependent, users who want a specific architecture
28600 extensions should specify one explicitly.
28602 @item -mcpu=@var{processor-string}
28603 @opindex mcpu
28604 Use architecture of and optimize the output for the given processor, specified
28605 by particular CPU name.
28606 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
28607 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
28608 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
28609 @samp{sifive-u54}, and @samp{sifive-u74}.
28611 @item -mtune=@var{processor-string}
28612 @opindex mtune
28613 Optimize the output for the given processor, specified by microarchitecture or
28614 particular CPU name.  Permissible values for this option are: @samp{rocket},
28615 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
28616 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
28618 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
28619 the default is @samp{rocket} if both are not specified.
28621 The @samp{size} choice is not intended for use by end-users.  This is used
28622 when @option{-Os} is specified.  It overrides the instruction cost info
28623 provided by @option{-mtune=}, but does not override the pipeline info.  This
28624 helps reduce code size while still giving good performance.
28626 @item -mpreferred-stack-boundary=@var{num}
28627 @opindex mpreferred-stack-boundary
28628 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28629 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
28630 the default is 4 (16 bytes or 128-bits).
28632 @strong{Warning:} If you use this switch, then you must build all modules with
28633 the same value, including any libraries.  This includes the system libraries
28634 and startup modules.
28636 @item -msmall-data-limit=@var{n}
28637 @opindex msmall-data-limit
28638 Put global and static data smaller than @var{n} bytes into a special section
28639 (on some targets).
28641 @item -msave-restore
28642 @itemx -mno-save-restore
28643 @opindex msave-restore
28644 Do or don't use smaller but slower prologue and epilogue code that uses
28645 library function calls.  The default is to use fast inline prologues and
28646 epilogues.
28648 @item -mshorten-memrefs
28649 @itemx -mno-shorten-memrefs
28650 @opindex mshorten-memrefs
28651 Do or do not attempt to make more use of compressed load/store instructions by
28652 replacing a load/store of 'base register + large offset' with a new load/store
28653 of 'new base + small offset'.  If the new base gets stored in a compressed
28654 register, then the new load/store can be compressed.  Currently targets 32-bit
28655 integer load/stores only.
28657 @item -mstrict-align
28658 @itemx -mno-strict-align
28659 @opindex mstrict-align
28660 Do not or do generate unaligned memory accesses.  The default is set depending
28661 on whether the processor we are optimizing for supports fast unaligned access
28662 or not.
28664 @item -mcmodel=medlow
28665 @opindex mcmodel=medlow
28666 Generate code for the medium-low code model. The program and its statically
28667 defined symbols must lie within a single 2 GiB address range and must lie
28668 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
28669 statically or dynamically linked. This is the default code model.
28671 @item -mcmodel=medany
28672 @opindex mcmodel=medany
28673 Generate code for the medium-any code model. The program and its statically
28674 defined symbols must be within any single 2 GiB address range. Programs can be
28675 statically or dynamically linked.
28677 The code generated by the medium-any code model is position-independent, but is
28678 not guaranteed to function correctly when linked into position-independent
28679 executables or libraries.
28681 @item -mexplicit-relocs
28682 @itemx -mno-exlicit-relocs
28683 Use or do not use assembler relocation operators when dealing with symbolic
28684 addresses.  The alternative is to use assembler macros instead, which may
28685 limit optimization.
28687 @item -mrelax
28688 @itemx -mno-relax
28689 @opindex mrelax
28690 Take advantage of linker relaxations to reduce the number of instructions
28691 required to materialize symbol addresses. The default is to take advantage of
28692 linker relaxations.
28694 @item -mriscv-attribute
28695 @itemx -mno-riscv-attribute
28696 @opindex mriscv-attribute
28697 Emit (do not emit) RISC-V attribute to record extra information into ELF
28698 objects.  This feature requires at least binutils 2.32.
28700 @item -mcsr-check
28701 @itemx -mno-csr-check
28702 @opindex mcsr-check
28703 Enables or disables the CSR checking.
28705 @item -malign-data=@var{type}
28706 @opindex malign-data
28707 Control how GCC aligns variables and constants of array, structure, or union
28708 types.  Supported values for @var{type} are @samp{xlen} which uses x register
28709 width as the alignment value, and @samp{natural} which uses natural alignment.
28710 @samp{xlen} is the default.
28712 @item -mbig-endian
28713 @opindex mbig-endian
28714 Generate big-endian code.  This is the default when GCC is configured for a
28715 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
28717 @item -mlittle-endian
28718 @opindex mlittle-endian
28719 Generate little-endian code.  This is the default when GCC is configured for a
28720 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
28721 @samp{riscv32be-*-*} target.
28723 @item -mstack-protector-guard=@var{guard}
28724 @itemx -mstack-protector-guard-reg=@var{reg}
28725 @itemx -mstack-protector-guard-offset=@var{offset}
28726 @opindex mstack-protector-guard
28727 @opindex mstack-protector-guard-reg
28728 @opindex mstack-protector-guard-offset
28729 Generate stack protection code using canary at @var{guard}.  Supported
28730 locations are @samp{global} for a global canary or @samp{tls} for per-thread
28731 canary in the TLS block.
28733 With the latter choice the options
28734 @option{-mstack-protector-guard-reg=@var{reg}} and
28735 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28736 which register to use as base register for reading the canary,
28737 and from what offset from that base register. There is no default
28738 register or offset as this is entirely for use within the Linux
28739 kernel.
28740 @end table
28742 @node RL78 Options
28743 @subsection RL78 Options
28744 @cindex RL78 Options
28746 @table @gcctabopt
28748 @item -msim
28749 @opindex msim
28750 Links in additional target libraries to support operation within a
28751 simulator.
28753 @item -mmul=none
28754 @itemx -mmul=g10
28755 @itemx -mmul=g13
28756 @itemx -mmul=g14
28757 @itemx -mmul=rl78
28758 @opindex mmul
28759 Specifies the type of hardware multiplication and division support to
28760 be used.  The simplest is @code{none}, which uses software for both
28761 multiplication and division.  This is the default.  The @code{g13}
28762 value is for the hardware multiply/divide peripheral found on the
28763 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
28764 the multiplication and division instructions supported by the RL78/G14
28765 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
28766 the value @code{mg10} is an alias for @code{none}.
28768 In addition a C preprocessor macro is defined, based upon the setting
28769 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
28770 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
28772 @item -mcpu=g10
28773 @itemx -mcpu=g13
28774 @itemx -mcpu=g14
28775 @itemx -mcpu=rl78
28776 @opindex mcpu
28777 Specifies the RL78 core to target.  The default is the G14 core, also
28778 known as an S3 core or just RL78.  The G13 or S2 core does not have
28779 multiply or divide instructions, instead it uses a hardware peripheral
28780 for these operations.  The G10 or S1 core does not have register
28781 banks, so it uses a different calling convention.
28783 If this option is set it also selects the type of hardware multiply
28784 support to use, unless this is overridden by an explicit
28785 @option{-mmul=none} option on the command line.  Thus specifying
28786 @option{-mcpu=g13} enables the use of the G13 hardware multiply
28787 peripheral and specifying @option{-mcpu=g10} disables the use of
28788 hardware multiplications altogether.
28790 Note, although the RL78/G14 core is the default target, specifying
28791 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
28792 change the behavior of the toolchain since it also enables G14
28793 hardware multiply support.  If these options are not specified on the
28794 command line then software multiplication routines will be used even
28795 though the code targets the RL78 core.  This is for backwards
28796 compatibility with older toolchains which did not have hardware
28797 multiply and divide support.
28799 In addition a C preprocessor macro is defined, based upon the setting
28800 of this option.  Possible values are: @code{__RL78_G10__},
28801 @code{__RL78_G13__} or @code{__RL78_G14__}.
28803 @item -mg10
28804 @itemx -mg13
28805 @itemx -mg14
28806 @itemx -mrl78
28807 @opindex mg10
28808 @opindex mg13
28809 @opindex mg14
28810 @opindex mrl78
28811 These are aliases for the corresponding @option{-mcpu=} option.  They
28812 are provided for backwards compatibility.
28814 @item -mallregs
28815 @opindex mallregs
28816 Allow the compiler to use all of the available registers.  By default
28817 registers @code{r24..r31} are reserved for use in interrupt handlers.
28818 With this option enabled these registers can be used in ordinary
28819 functions as well.
28821 @item -m64bit-doubles
28822 @itemx -m32bit-doubles
28823 @opindex m64bit-doubles
28824 @opindex m32bit-doubles
28825 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
28826 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
28827 @option{-m32bit-doubles}.
28829 @item -msave-mduc-in-interrupts
28830 @itemx -mno-save-mduc-in-interrupts
28831 @opindex msave-mduc-in-interrupts
28832 @opindex mno-save-mduc-in-interrupts
28833 Specifies that interrupt handler functions should preserve the
28834 MDUC registers.  This is only necessary if normal code might use
28835 the MDUC registers, for example because it performs multiplication
28836 and division operations.  The default is to ignore the MDUC registers
28837 as this makes the interrupt handlers faster.  The target option -mg13
28838 needs to be passed for this to work as this feature is only available
28839 on the G13 target (S2 core).  The MDUC registers will only be saved
28840 if the interrupt handler performs a multiplication or division
28841 operation or it calls another function.
28843 @end table
28845 @node RS/6000 and PowerPC Options
28846 @subsection IBM RS/6000 and PowerPC Options
28847 @cindex RS/6000 and PowerPC Options
28848 @cindex IBM RS/6000 and PowerPC Options
28850 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
28851 @table @gcctabopt
28852 @item -mpowerpc-gpopt
28853 @itemx -mno-powerpc-gpopt
28854 @itemx -mpowerpc-gfxopt
28855 @itemx -mno-powerpc-gfxopt
28856 @need 800
28857 @itemx -mpowerpc64
28858 @itemx -mno-powerpc64
28859 @itemx -mmfcrf
28860 @itemx -mno-mfcrf
28861 @itemx -mpopcntb
28862 @itemx -mno-popcntb
28863 @itemx -mpopcntd
28864 @itemx -mno-popcntd
28865 @itemx -mfprnd
28866 @itemx -mno-fprnd
28867 @need 800
28868 @itemx -mcmpb
28869 @itemx -mno-cmpb
28870 @itemx -mhard-dfp
28871 @itemx -mno-hard-dfp
28872 @opindex mpowerpc-gpopt
28873 @opindex mno-powerpc-gpopt
28874 @opindex mpowerpc-gfxopt
28875 @opindex mno-powerpc-gfxopt
28876 @opindex mpowerpc64
28877 @opindex mno-powerpc64
28878 @opindex mmfcrf
28879 @opindex mno-mfcrf
28880 @opindex mpopcntb
28881 @opindex mno-popcntb
28882 @opindex mpopcntd
28883 @opindex mno-popcntd
28884 @opindex mfprnd
28885 @opindex mno-fprnd
28886 @opindex mcmpb
28887 @opindex mno-cmpb
28888 @opindex mhard-dfp
28889 @opindex mno-hard-dfp
28890 You use these options to specify which instructions are available on the
28891 processor you are using.  The default value of these options is
28892 determined when configuring GCC@.  Specifying the
28893 @option{-mcpu=@var{cpu_type}} overrides the specification of these
28894 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
28895 rather than the options listed above.
28897 Specifying @option{-mpowerpc-gpopt} allows
28898 GCC to use the optional PowerPC architecture instructions in the
28899 General Purpose group, including floating-point square root.  Specifying
28900 @option{-mpowerpc-gfxopt} allows GCC to
28901 use the optional PowerPC architecture instructions in the Graphics
28902 group, including floating-point select.
28904 The @option{-mmfcrf} option allows GCC to generate the move from
28905 condition register field instruction implemented on the POWER4
28906 processor and other processors that support the PowerPC V2.01
28907 architecture.
28908 The @option{-mpopcntb} option allows GCC to generate the popcount and
28909 double-precision FP reciprocal estimate instruction implemented on the
28910 POWER5 processor and other processors that support the PowerPC V2.02
28911 architecture.
28912 The @option{-mpopcntd} option allows GCC to generate the popcount
28913 instruction implemented on the POWER7 processor and other processors
28914 that support the PowerPC V2.06 architecture.
28915 The @option{-mfprnd} option allows GCC to generate the FP round to
28916 integer instructions implemented on the POWER5+ processor and other
28917 processors that support the PowerPC V2.03 architecture.
28918 The @option{-mcmpb} option allows GCC to generate the compare bytes
28919 instruction implemented on the POWER6 processor and other processors
28920 that support the PowerPC V2.05 architecture.
28921 The @option{-mhard-dfp} option allows GCC to generate the decimal
28922 floating-point instructions implemented on some POWER processors.
28924 The @option{-mpowerpc64} option allows GCC to generate the additional
28925 64-bit instructions that are found in the full PowerPC64 architecture
28926 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
28927 @option{-mno-powerpc64}.
28929 @item -mcpu=@var{cpu_type}
28930 @opindex mcpu
28931 Set architecture type, register usage, and
28932 instruction scheduling parameters for machine type @var{cpu_type}.
28933 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
28934 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
28935 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
28936 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
28937 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
28938 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
28939 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
28940 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
28941 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
28942 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
28943 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
28944 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
28946 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
28947 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
28948 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
28949 architecture machine types, with an appropriate, generic processor
28950 model assumed for scheduling purposes.
28952 Specifying @samp{native} as cpu type detects and selects the
28953 architecture option that corresponds to the host processor of the
28954 system performing the compilation.
28955 @option{-mcpu=native} has no effect if GCC does not recognize the
28956 processor.
28958 The other options specify a specific processor.  Code generated under
28959 those options runs best on that processor, and may not run at all on
28960 others.
28962 The @option{-mcpu} options automatically enable or disable the
28963 following options:
28965 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
28966 -mpopcntb  -mpopcntd  -mpowerpc64 @gol
28967 -mpowerpc-gpopt  -mpowerpc-gfxopt @gol
28968 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx @gol
28969 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector @gol
28970 -mquad-memory  -mquad-memory-atomic  -mfloat128 @gol
28971 -mfloat128-hardware -mprefixed -mpcrel -mmma @gol
28972 -mrop-protect}
28974 The particular options set for any particular CPU varies between
28975 compiler versions, depending on what setting seems to produce optimal
28976 code for that CPU; it doesn't necessarily reflect the actual hardware's
28977 capabilities.  If you wish to set an individual option to a particular
28978 value, you may specify it after the @option{-mcpu} option, like
28979 @option{-mcpu=970 -mno-altivec}.
28981 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
28982 not enabled or disabled by the @option{-mcpu} option at present because
28983 AIX does not have full support for these options.  You may still
28984 enable or disable them individually if you're sure it'll work in your
28985 environment.
28987 @item -mtune=@var{cpu_type}
28988 @opindex mtune
28989 Set the instruction scheduling parameters for machine type
28990 @var{cpu_type}, but do not set the architecture type or register usage,
28991 as @option{-mcpu=@var{cpu_type}} does.  The same
28992 values for @var{cpu_type} are used for @option{-mtune} as for
28993 @option{-mcpu}.  If both are specified, the code generated uses the
28994 architecture and registers set by @option{-mcpu}, but the
28995 scheduling parameters set by @option{-mtune}.
28997 @item -mcmodel=small
28998 @opindex mcmodel=small
28999 Generate PowerPC64 code for the small model: The TOC is limited to
29000 64k.
29002 @item -mcmodel=medium
29003 @opindex mcmodel=medium
29004 Generate PowerPC64 code for the medium model: The TOC and other static
29005 data may be up to a total of 4G in size.  This is the default for 64-bit
29006 Linux.
29008 @item -mcmodel=large
29009 @opindex mcmodel=large
29010 Generate PowerPC64 code for the large model: The TOC may be up to 4G
29011 in size.  Other data and code is only limited by the 64-bit address
29012 space.
29014 @item -maltivec
29015 @itemx -mno-altivec
29016 @opindex maltivec
29017 @opindex mno-altivec
29018 Generate code that uses (does not use) AltiVec instructions, and also
29019 enable the use of built-in functions that allow more direct access to
29020 the AltiVec instruction set.  You may also need to set
29021 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
29022 enhancements.
29024 When @option{-maltivec} is used, the element order for AltiVec intrinsics
29025 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
29026 match array element order corresponding to the endianness of the
29027 target.  That is, element zero identifies the leftmost element in a
29028 vector register when targeting a big-endian platform, and identifies
29029 the rightmost element in a vector register when targeting a
29030 little-endian platform.
29032 @item -mvrsave
29033 @itemx -mno-vrsave
29034 @opindex mvrsave
29035 @opindex mno-vrsave
29036 Generate VRSAVE instructions when generating AltiVec code.
29038 @item -msecure-plt
29039 @opindex msecure-plt
29040 Generate code that allows @command{ld} and @command{ld.so}
29041 to build executables and shared
29042 libraries with non-executable @code{.plt} and @code{.got} sections.
29043 This is a PowerPC
29044 32-bit SYSV ABI option.
29046 @item -mbss-plt
29047 @opindex mbss-plt
29048 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
29049 fills in, and
29050 requires @code{.plt} and @code{.got}
29051 sections that are both writable and executable.
29052 This is a PowerPC 32-bit SYSV ABI option.
29054 @item -misel
29055 @itemx -mno-isel
29056 @opindex misel
29057 @opindex mno-isel
29058 This switch enables or disables the generation of ISEL instructions.
29060 @item -mvsx
29061 @itemx -mno-vsx
29062 @opindex mvsx
29063 @opindex mno-vsx
29064 Generate code that uses (does not use) vector/scalar (VSX)
29065 instructions, and also enable the use of built-in functions that allow
29066 more direct access to the VSX instruction set.
29068 @item -mcrypto
29069 @itemx -mno-crypto
29070 @opindex mcrypto
29071 @opindex mno-crypto
29072 Enable the use (disable) of the built-in functions that allow direct
29073 access to the cryptographic instructions that were added in version
29074 2.07 of the PowerPC ISA.
29076 @item -mhtm
29077 @itemx -mno-htm
29078 @opindex mhtm
29079 @opindex mno-htm
29080 Enable (disable) the use of the built-in functions that allow direct
29081 access to the Hardware Transactional Memory (HTM) instructions that
29082 were added in version 2.07 of the PowerPC ISA.
29084 @item -mpower8-fusion
29085 @itemx -mno-power8-fusion
29086 @opindex mpower8-fusion
29087 @opindex mno-power8-fusion
29088 Generate code that keeps (does not keeps) some integer operations
29089 adjacent so that the instructions can be fused together on power8 and
29090 later processors.
29092 @item -mpower8-vector
29093 @itemx -mno-power8-vector
29094 @opindex mpower8-vector
29095 @opindex mno-power8-vector
29096 Generate code that uses (does not use) the vector and scalar
29097 instructions that were added in version 2.07 of the PowerPC ISA.  Also
29098 enable the use of built-in functions that allow more direct access to
29099 the vector instructions.
29101 @item -mquad-memory
29102 @itemx -mno-quad-memory
29103 @opindex mquad-memory
29104 @opindex mno-quad-memory
29105 Generate code that uses (does not use) the non-atomic quad word memory
29106 instructions.  The @option{-mquad-memory} option requires use of
29107 64-bit mode.
29109 @item -mquad-memory-atomic
29110 @itemx -mno-quad-memory-atomic
29111 @opindex mquad-memory-atomic
29112 @opindex mno-quad-memory-atomic
29113 Generate code that uses (does not use) the atomic quad word memory
29114 instructions.  The @option{-mquad-memory-atomic} option requires use of
29115 64-bit mode.
29117 @item -mfloat128
29118 @itemx -mno-float128
29119 @opindex mfloat128
29120 @opindex mno-float128
29121 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
29122 and use either software emulation for IEEE 128-bit floating point or
29123 hardware instructions.
29125 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
29126 128-bit floating point support.  The IEEE 128-bit floating point is only
29127 supported on Linux.
29129 The default for @option{-mfloat128} is enabled on PowerPC Linux
29130 systems using the VSX instruction set, and disabled on other systems.
29132 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
29133 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
29134 point support will also enable the generation of ISA 3.0 IEEE 128-bit
29135 floating point instructions.  Otherwise, if you do not specify to
29136 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
29137 system, IEEE 128-bit floating point will be done with software
29138 emulation.
29140 @item -mfloat128-hardware
29141 @itemx -mno-float128-hardware
29142 @opindex mfloat128-hardware
29143 @opindex mno-float128-hardware
29144 Enable/disable using ISA 3.0 hardware instructions to support the
29145 @var{__float128} data type.
29147 The default for @option{-mfloat128-hardware} is enabled on PowerPC
29148 Linux systems using the ISA 3.0 instruction set, and disabled on other
29149 systems.
29151 @item -m32
29152 @itemx -m64
29153 @opindex m32
29154 @opindex m64
29155 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
29156 targets (including GNU/Linux).  The 32-bit environment sets int, long
29157 and pointer to 32 bits and generates code that runs on any PowerPC
29158 variant.  The 64-bit environment sets int to 32 bits and long and
29159 pointer to 64 bits, and generates code for PowerPC64, as for
29160 @option{-mpowerpc64}.
29162 @item -mfull-toc
29163 @itemx -mno-fp-in-toc
29164 @itemx -mno-sum-in-toc
29165 @itemx -mminimal-toc
29166 @opindex mfull-toc
29167 @opindex mno-fp-in-toc
29168 @opindex mno-sum-in-toc
29169 @opindex mminimal-toc
29170 Modify generation of the TOC (Table Of Contents), which is created for
29171 every executable file.  The @option{-mfull-toc} option is selected by
29172 default.  In that case, GCC allocates at least one TOC entry for
29173 each unique non-automatic variable reference in your program.  GCC
29174 also places floating-point constants in the TOC@.  However, only
29175 16,384 entries are available in the TOC@.
29177 If you receive a linker error message that saying you have overflowed
29178 the available TOC space, you can reduce the amount of TOC space used
29179 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
29180 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
29181 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
29182 generate code to calculate the sum of an address and a constant at
29183 run time instead of putting that sum into the TOC@.  You may specify one
29184 or both of these options.  Each causes GCC to produce very slightly
29185 slower and larger code at the expense of conserving TOC space.
29187 If you still run out of space in the TOC even when you specify both of
29188 these options, specify @option{-mminimal-toc} instead.  This option causes
29189 GCC to make only one TOC entry for every file.  When you specify this
29190 option, GCC produces code that is slower and larger but which
29191 uses extremely little TOC space.  You may wish to use this option
29192 only on files that contain less frequently-executed code.
29194 @item -maix64
29195 @itemx -maix32
29196 @opindex maix64
29197 @opindex maix32
29198 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
29199 @code{long} type, and the infrastructure needed to support them.
29200 Specifying @option{-maix64} implies @option{-mpowerpc64},
29201 while @option{-maix32} disables the 64-bit ABI and
29202 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
29204 @item -mxl-compat
29205 @itemx -mno-xl-compat
29206 @opindex mxl-compat
29207 @opindex mno-xl-compat
29208 Produce code that conforms more closely to IBM XL compiler semantics
29209 when using AIX-compatible ABI@.  Pass floating-point arguments to
29210 prototyped functions beyond the register save area (RSA) on the stack
29211 in addition to argument FPRs.  Do not assume that most significant
29212 double in 128-bit long double value is properly rounded when comparing
29213 values and converting to double.  Use XL symbol names for long double
29214 support routines.
29216 The AIX calling convention was extended but not initially documented to
29217 handle an obscure K&R C case of calling a function that takes the
29218 address of its arguments with fewer arguments than declared.  IBM XL
29219 compilers access floating-point arguments that do not fit in the
29220 RSA from the stack when a subroutine is compiled without
29221 optimization.  Because always storing floating-point arguments on the
29222 stack is inefficient and rarely needed, this option is not enabled by
29223 default and only is necessary when calling subroutines compiled by IBM
29224 XL compilers without optimization.
29226 @item -mpe
29227 @opindex mpe
29228 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
29229 application written to use message passing with special startup code to
29230 enable the application to run.  The system must have PE installed in the
29231 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
29232 must be overridden with the @option{-specs=} option to specify the
29233 appropriate directory location.  The Parallel Environment does not
29234 support threads, so the @option{-mpe} option and the @option{-pthread}
29235 option are incompatible.
29237 @item -malign-natural
29238 @itemx -malign-power
29239 @opindex malign-natural
29240 @opindex malign-power
29241 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
29242 @option{-malign-natural} overrides the ABI-defined alignment of larger
29243 types, such as floating-point doubles, on their natural size-based boundary.
29244 The option @option{-malign-power} instructs GCC to follow the ABI-specified
29245 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
29247 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
29248 is not supported.
29250 @item -msoft-float
29251 @itemx -mhard-float
29252 @opindex msoft-float
29253 @opindex mhard-float
29254 Generate code that does not use (uses) the floating-point register set.
29255 Software floating-point emulation is provided if you use the
29256 @option{-msoft-float} option, and pass the option to GCC when linking.
29258 @item -mmultiple
29259 @itemx -mno-multiple
29260 @opindex mmultiple
29261 @opindex mno-multiple
29262 Generate code that uses (does not use) the load multiple word
29263 instructions and the store multiple word instructions.  These
29264 instructions are generated by default on POWER systems, and not
29265 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
29266 PowerPC systems, since those instructions do not work when the
29267 processor is in little-endian mode.  The exceptions are PPC740 and
29268 PPC750 which permit these instructions in little-endian mode.
29270 @item -mupdate
29271 @itemx -mno-update
29272 @opindex mupdate
29273 @opindex mno-update
29274 Generate code that uses (does not use) the load or store instructions
29275 that update the base register to the address of the calculated memory
29276 location.  These instructions are generated by default.  If you use
29277 @option{-mno-update}, there is a small window between the time that the
29278 stack pointer is updated and the address of the previous frame is
29279 stored, which means code that walks the stack frame across interrupts or
29280 signals may get corrupted data.
29282 @item -mavoid-indexed-addresses
29283 @itemx -mno-avoid-indexed-addresses
29284 @opindex mavoid-indexed-addresses
29285 @opindex mno-avoid-indexed-addresses
29286 Generate code that tries to avoid (not avoid) the use of indexed load
29287 or store instructions. These instructions can incur a performance
29288 penalty on Power6 processors in certain situations, such as when
29289 stepping through large arrays that cross a 16M boundary.  This option
29290 is enabled by default when targeting Power6 and disabled otherwise.
29292 @item -mfused-madd
29293 @itemx -mno-fused-madd
29294 @opindex mfused-madd
29295 @opindex mno-fused-madd
29296 Generate code that uses (does not use) the floating-point multiply and
29297 accumulate instructions.  These instructions are generated by default
29298 if hardware floating point is used.  The machine-dependent
29299 @option{-mfused-madd} option is now mapped to the machine-independent
29300 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29301 mapped to @option{-ffp-contract=off}.
29303 @item -mmulhw
29304 @itemx -mno-mulhw
29305 @opindex mmulhw
29306 @opindex mno-mulhw
29307 Generate code that uses (does not use) the half-word multiply and
29308 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
29309 These instructions are generated by default when targeting those
29310 processors.
29312 @item -mdlmzb
29313 @itemx -mno-dlmzb
29314 @opindex mdlmzb
29315 @opindex mno-dlmzb
29316 Generate code that uses (does not use) the string-search @samp{dlmzb}
29317 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
29318 generated by default when targeting those processors.
29320 @item -mno-bit-align
29321 @itemx -mbit-align
29322 @opindex mno-bit-align
29323 @opindex mbit-align
29324 On System V.4 and embedded PowerPC systems do not (do) force structures
29325 and unions that contain bit-fields to be aligned to the base type of the
29326 bit-field.
29328 For example, by default a structure containing nothing but 8
29329 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
29330 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
29331 the structure is aligned to a 1-byte boundary and is 1 byte in
29332 size.
29334 @item -mno-strict-align
29335 @itemx -mstrict-align
29336 @opindex mno-strict-align
29337 @opindex mstrict-align
29338 On System V.4 and embedded PowerPC systems do not (do) assume that
29339 unaligned memory references are handled by the system.
29341 @item -mrelocatable
29342 @itemx -mno-relocatable
29343 @opindex mrelocatable
29344 @opindex mno-relocatable
29345 Generate code that allows (does not allow) a static executable to be
29346 relocated to a different address at run time.  A simple embedded
29347 PowerPC system loader should relocate the entire contents of
29348 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
29349 a table of 32-bit addresses generated by this option.  For this to
29350 work, all objects linked together must be compiled with
29351 @option{-mrelocatable} or @option{-mrelocatable-lib}.
29352 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
29354 @item -mrelocatable-lib
29355 @itemx -mno-relocatable-lib
29356 @opindex mrelocatable-lib
29357 @opindex mno-relocatable-lib
29358 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
29359 @code{.fixup} section to allow static executables to be relocated at
29360 run time, but @option{-mrelocatable-lib} does not use the smaller stack
29361 alignment of @option{-mrelocatable}.  Objects compiled with
29362 @option{-mrelocatable-lib} may be linked with objects compiled with
29363 any combination of the @option{-mrelocatable} options.
29365 @item -mno-toc
29366 @itemx -mtoc
29367 @opindex mno-toc
29368 @opindex mtoc
29369 On System V.4 and embedded PowerPC systems do not (do) assume that
29370 register 2 contains a pointer to a global area pointing to the addresses
29371 used in the program.
29373 @item -mlittle
29374 @itemx -mlittle-endian
29375 @opindex mlittle
29376 @opindex mlittle-endian
29377 On System V.4 and embedded PowerPC systems compile code for the
29378 processor in little-endian mode.  The @option{-mlittle-endian} option is
29379 the same as @option{-mlittle}.
29381 @item -mbig
29382 @itemx -mbig-endian
29383 @opindex mbig
29384 @opindex mbig-endian
29385 On System V.4 and embedded PowerPC systems compile code for the
29386 processor in big-endian mode.  The @option{-mbig-endian} option is
29387 the same as @option{-mbig}.
29389 @item -mdynamic-no-pic
29390 @opindex mdynamic-no-pic
29391 On Darwin and Mac OS X systems, compile code so that it is not
29392 relocatable, but that its external references are relocatable.  The
29393 resulting code is suitable for applications, but not shared
29394 libraries.
29396 @item -msingle-pic-base
29397 @opindex msingle-pic-base
29398 Treat the register used for PIC addressing as read-only, rather than
29399 loading it in the prologue for each function.  The runtime system is
29400 responsible for initializing this register with an appropriate value
29401 before execution begins.
29403 @item -mprioritize-restricted-insns=@var{priority}
29404 @opindex mprioritize-restricted-insns
29405 This option controls the priority that is assigned to
29406 dispatch-slot restricted instructions during the second scheduling
29407 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
29408 or @samp{2} to assign no, highest, or second-highest (respectively) 
29409 priority to dispatch-slot restricted
29410 instructions.
29412 @item -msched-costly-dep=@var{dependence_type}
29413 @opindex msched-costly-dep
29414 This option controls which dependences are considered costly
29415 by the target during instruction scheduling.  The argument
29416 @var{dependence_type} takes one of the following values:
29418 @table @asis
29419 @item @samp{no}
29420 No dependence is costly.
29422 @item @samp{all}
29423 All dependences are costly.
29425 @item @samp{true_store_to_load}
29426 A true dependence from store to load is costly.
29428 @item @samp{store_to_load}
29429 Any dependence from store to load is costly.
29431 @item @var{number}
29432 Any dependence for which the latency is greater than or equal to 
29433 @var{number} is costly.
29434 @end table
29436 @item -minsert-sched-nops=@var{scheme}
29437 @opindex minsert-sched-nops
29438 This option controls which NOP insertion scheme is used during
29439 the second scheduling pass.  The argument @var{scheme} takes one of the
29440 following values:
29442 @table @asis
29443 @item @samp{no}
29444 Don't insert NOPs.
29446 @item @samp{pad}
29447 Pad with NOPs any dispatch group that has vacant issue slots,
29448 according to the scheduler's grouping.
29450 @item @samp{regroup_exact}
29451 Insert NOPs to force costly dependent insns into
29452 separate groups.  Insert exactly as many NOPs as needed to force an insn
29453 to a new group, according to the estimated processor grouping.
29455 @item @var{number}
29456 Insert NOPs to force costly dependent insns into
29457 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
29458 @end table
29460 @item -mcall-sysv
29461 @opindex mcall-sysv
29462 On System V.4 and embedded PowerPC systems compile code using calling
29463 conventions that adhere to the March 1995 draft of the System V
29464 Application Binary Interface, PowerPC processor supplement.  This is the
29465 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
29467 @item -mcall-sysv-eabi
29468 @itemx -mcall-eabi
29469 @opindex mcall-sysv-eabi
29470 @opindex mcall-eabi
29471 Specify both @option{-mcall-sysv} and @option{-meabi} options.
29473 @item -mcall-sysv-noeabi
29474 @opindex mcall-sysv-noeabi
29475 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
29477 @item -mcall-aixdesc
29478 @opindex m
29479 On System V.4 and embedded PowerPC systems compile code for the AIX
29480 operating system.
29482 @item -mcall-linux
29483 @opindex mcall-linux
29484 On System V.4 and embedded PowerPC systems compile code for the
29485 Linux-based GNU system.
29487 @item -mcall-freebsd
29488 @opindex mcall-freebsd
29489 On System V.4 and embedded PowerPC systems compile code for the
29490 FreeBSD operating system.
29492 @item -mcall-netbsd
29493 @opindex mcall-netbsd
29494 On System V.4 and embedded PowerPC systems compile code for the
29495 NetBSD operating system.
29497 @item -mcall-openbsd
29498 @opindex mcall-netbsd
29499 On System V.4 and embedded PowerPC systems compile code for the
29500 OpenBSD operating system.
29502 @item -mtraceback=@var{traceback_type}
29503 @opindex mtraceback
29504 Select the type of traceback table. Valid values for @var{traceback_type}
29505 are @samp{full}, @samp{part}, and @samp{no}.
29507 @item -maix-struct-return
29508 @opindex maix-struct-return
29509 Return all structures in memory (as specified by the AIX ABI)@.
29511 @item -msvr4-struct-return
29512 @opindex msvr4-struct-return
29513 Return structures smaller than 8 bytes in registers (as specified by the
29514 SVR4 ABI)@.
29516 @item -mabi=@var{abi-type}
29517 @opindex mabi
29518 Extend the current ABI with a particular extension, or remove such extension.
29519 Valid values are: @samp{altivec}, @samp{no-altivec},
29520 @samp{ibmlongdouble}, @samp{ieeelongdouble},
29521 @samp{elfv1}, @samp{elfv2},
29522 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
29524 @item -mabi=ibmlongdouble
29525 @opindex mabi=ibmlongdouble
29526 Change the current ABI to use IBM extended-precision long double.
29527 This is not likely to work if your system defaults to using IEEE
29528 extended-precision long double.  If you change the long double type
29529 from IEEE extended-precision, the compiler will issue a warning unless
29530 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
29531 to be enabled.
29533 @item -mabi=ieeelongdouble
29534 @opindex mabi=ieeelongdouble
29535 Change the current ABI to use IEEE extended-precision long double.
29536 This is not likely to work if your system defaults to using IBM
29537 extended-precision long double.  If you change the long double type
29538 from IBM extended-precision, the compiler will issue a warning unless
29539 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
29540 to be enabled.
29542 @item -mabi=elfv1
29543 @opindex mabi=elfv1
29544 Change the current ABI to use the ELFv1 ABI.
29545 This is the default ABI for big-endian PowerPC 64-bit Linux.
29546 Overriding the default ABI requires special system support and is
29547 likely to fail in spectacular ways.
29549 @item -mabi=elfv2
29550 @opindex mabi=elfv2
29551 Change the current ABI to use the ELFv2 ABI.
29552 This is the default ABI for little-endian PowerPC 64-bit Linux.
29553 Overriding the default ABI requires special system support and is
29554 likely to fail in spectacular ways.
29556 @item -mgnu-attribute
29557 @itemx -mno-gnu-attribute
29558 @opindex mgnu-attribute
29559 @opindex mno-gnu-attribute
29560 Emit .gnu_attribute assembly directives to set tag/value pairs in a
29561 .gnu.attributes section that specify ABI variations in function
29562 parameters or return values.
29564 @item -mprototype
29565 @itemx -mno-prototype
29566 @opindex mprototype
29567 @opindex mno-prototype
29568 On System V.4 and embedded PowerPC systems assume that all calls to
29569 variable argument functions are properly prototyped.  Otherwise, the
29570 compiler must insert an instruction before every non-prototyped call to
29571 set or clear bit 6 of the condition code register (@code{CR}) to
29572 indicate whether floating-point values are passed in the floating-point
29573 registers in case the function takes variable arguments.  With
29574 @option{-mprototype}, only calls to prototyped variable argument functions
29575 set or clear the bit.
29577 @item -msim
29578 @opindex msim
29579 On embedded PowerPC systems, assume that the startup module is called
29580 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
29581 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
29582 configurations.
29584 @item -mmvme
29585 @opindex mmvme
29586 On embedded PowerPC systems, assume that the startup module is called
29587 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
29588 @file{libc.a}.
29590 @item -mads
29591 @opindex mads
29592 On embedded PowerPC systems, assume that the startup module is called
29593 @file{crt0.o} and the standard C libraries are @file{libads.a} and
29594 @file{libc.a}.
29596 @item -myellowknife
29597 @opindex myellowknife
29598 On embedded PowerPC systems, assume that the startup module is called
29599 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
29600 @file{libc.a}.
29602 @item -mvxworks
29603 @opindex mvxworks
29604 On System V.4 and embedded PowerPC systems, specify that you are
29605 compiling for a VxWorks system.
29607 @item -memb
29608 @opindex memb
29609 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
29610 header to indicate that @samp{eabi} extended relocations are used.
29612 @item -meabi
29613 @itemx -mno-eabi
29614 @opindex meabi
29615 @opindex mno-eabi
29616 On System V.4 and embedded PowerPC systems do (do not) adhere to the
29617 Embedded Applications Binary Interface (EABI), which is a set of
29618 modifications to the System V.4 specifications.  Selecting @option{-meabi}
29619 means that the stack is aligned to an 8-byte boundary, a function
29620 @code{__eabi} is called from @code{main} to set up the EABI
29621 environment, and the @option{-msdata} option can use both @code{r2} and
29622 @code{r13} to point to two separate small data areas.  Selecting
29623 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
29624 no EABI initialization function is called from @code{main}, and the
29625 @option{-msdata} option only uses @code{r13} to point to a single
29626 small data area.  The @option{-meabi} option is on by default if you
29627 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
29629 @item -msdata=eabi
29630 @opindex msdata=eabi
29631 On System V.4 and embedded PowerPC systems, put small initialized
29632 @code{const} global and static data in the @code{.sdata2} section, which
29633 is pointed to by register @code{r2}.  Put small initialized
29634 non-@code{const} global and static data in the @code{.sdata} section,
29635 which is pointed to by register @code{r13}.  Put small uninitialized
29636 global and static data in the @code{.sbss} section, which is adjacent to
29637 the @code{.sdata} section.  The @option{-msdata=eabi} option is
29638 incompatible with the @option{-mrelocatable} option.  The
29639 @option{-msdata=eabi} option also sets the @option{-memb} option.
29641 @item -msdata=sysv
29642 @opindex msdata=sysv
29643 On System V.4 and embedded PowerPC systems, put small global and static
29644 data in the @code{.sdata} section, which is pointed to by register
29645 @code{r13}.  Put small uninitialized global and static data in the
29646 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
29647 The @option{-msdata=sysv} option is incompatible with the
29648 @option{-mrelocatable} option.
29650 @item -msdata=default
29651 @itemx -msdata
29652 @opindex msdata=default
29653 @opindex msdata
29654 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
29655 compile code the same as @option{-msdata=eabi}, otherwise compile code the
29656 same as @option{-msdata=sysv}.
29658 @item -msdata=data
29659 @opindex msdata=data
29660 On System V.4 and embedded PowerPC systems, put small global
29661 data in the @code{.sdata} section.  Put small uninitialized global
29662 data in the @code{.sbss} section.  Do not use register @code{r13}
29663 to address small data however.  This is the default behavior unless
29664 other @option{-msdata} options are used.
29666 @item -msdata=none
29667 @itemx -mno-sdata
29668 @opindex msdata=none
29669 @opindex mno-sdata
29670 On embedded PowerPC systems, put all initialized global and static data
29671 in the @code{.data} section, and all uninitialized data in the
29672 @code{.bss} section.
29674 @item -mreadonly-in-sdata
29675 @opindex mreadonly-in-sdata
29676 @opindex mno-readonly-in-sdata
29677 Put read-only objects in the @code{.sdata} section as well.  This is the
29678 default.
29680 @item -mblock-move-inline-limit=@var{num}
29681 @opindex mblock-move-inline-limit
29682 Inline all block moves (such as calls to @code{memcpy} or structure
29683 copies) less than or equal to @var{num} bytes.  The minimum value for
29684 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
29685 targets.  The default value is target-specific.
29687 @item -mblock-compare-inline-limit=@var{num}
29688 @opindex mblock-compare-inline-limit
29689 Generate non-looping inline code for all block compares (such as calls
29690 to @code{memcmp} or structure compares) less than or equal to @var{num}
29691 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
29692 block compare is disabled. The default value is target-specific.
29694 @item -mblock-compare-inline-loop-limit=@var{num}
29695 @opindex mblock-compare-inline-loop-limit
29696 Generate an inline expansion using loop code for all block compares that
29697 are less than or equal to @var{num} bytes, but greater than the limit
29698 for non-loop inline block compare expansion. If the block length is not
29699 constant, at most @var{num} bytes will be compared before @code{memcmp}
29700 is called to compare the remainder of the block. The default value is
29701 target-specific.
29703 @item -mstring-compare-inline-limit=@var{num}
29704 @opindex mstring-compare-inline-limit
29705 Compare at most @var{num} string bytes with inline code.
29706 If the difference or end of string is not found at the
29707 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
29708 take care of the rest of the comparison. The default is 64 bytes.
29710 @item -G @var{num}
29711 @opindex G
29712 @cindex smaller data references (PowerPC)
29713 @cindex .sdata/.sdata2 references (PowerPC)
29714 On embedded PowerPC systems, put global and static items less than or
29715 equal to @var{num} bytes into the small data or BSS sections instead of
29716 the normal data or BSS section.  By default, @var{num} is 8.  The
29717 @option{-G @var{num}} switch is also passed to the linker.
29718 All modules should be compiled with the same @option{-G @var{num}} value.
29720 @item -mregnames
29721 @itemx -mno-regnames
29722 @opindex mregnames
29723 @opindex mno-regnames
29724 On System V.4 and embedded PowerPC systems do (do not) emit register
29725 names in the assembly language output using symbolic forms.
29727 @item -mlongcall
29728 @itemx -mno-longcall
29729 @opindex mlongcall
29730 @opindex mno-longcall
29731 By default assume that all calls are far away so that a longer and more
29732 expensive calling sequence is required.  This is required for calls
29733 farther than 32 megabytes (33,554,432 bytes) from the current location.
29734 A short call is generated if the compiler knows
29735 the call cannot be that far away.  This setting can be overridden by
29736 the @code{shortcall} function attribute, or by @code{#pragma
29737 longcall(0)}.
29739 Some linkers are capable of detecting out-of-range calls and generating
29740 glue code on the fly.  On these systems, long calls are unnecessary and
29741 generate slower code.  As of this writing, the AIX linker can do this,
29742 as can the GNU linker for PowerPC/64.  It is planned to add this feature
29743 to the GNU linker for 32-bit PowerPC systems as well.
29745 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
29746 GCC can generate long calls using an inline PLT call sequence (see
29747 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
29748 ELFv1 (big-endian) do not support inline PLT calls.
29750 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
29751 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
29752 addresses represent the callee and the branch island.  The
29753 Darwin/PPC linker prefers the first address and generates a @code{bl
29754 callee} if the PPC @code{bl} instruction reaches the callee directly;
29755 otherwise, the linker generates @code{bl L42} to call the branch
29756 island.  The branch island is appended to the body of the
29757 calling function; it computes the full 32-bit address of the callee
29758 and jumps to it.
29760 On Mach-O (Darwin) systems, this option directs the compiler emit to
29761 the glue for every direct call, and the Darwin linker decides whether
29762 to use or discard it.
29764 In the future, GCC may ignore all longcall specifications
29765 when the linker is known to generate glue.
29767 @item -mpltseq
29768 @itemx -mno-pltseq
29769 @opindex mpltseq
29770 @opindex mno-pltseq
29771 Implement (do not implement) -fno-plt and long calls using an inline
29772 PLT call sequence that supports lazy linking and long calls to
29773 functions in dlopen'd shared libraries.  Inline PLT calls are only
29774 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
29775 linkers, and are enabled by default if the support is detected when
29776 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
29777 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
29778 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
29779 linked together.
29781 @item -mtls-markers
29782 @itemx -mno-tls-markers
29783 @opindex mtls-markers
29784 @opindex mno-tls-markers
29785 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
29786 specifying the function argument.  The relocation allows the linker to
29787 reliably associate function call with argument setup instructions for
29788 TLS optimization, which in turn allows GCC to better schedule the
29789 sequence.
29791 @item -mrecip
29792 @itemx -mno-recip
29793 @opindex mrecip
29794 This option enables use of the reciprocal estimate and
29795 reciprocal square root estimate instructions with additional
29796 Newton-Raphson steps to increase precision instead of doing a divide or
29797 square root and divide for floating-point arguments.  You should use
29798 the @option{-ffast-math} option when using @option{-mrecip} (or at
29799 least @option{-funsafe-math-optimizations},
29800 @option{-ffinite-math-only}, @option{-freciprocal-math} and
29801 @option{-fno-trapping-math}).  Note that while the throughput of the
29802 sequence is generally higher than the throughput of the non-reciprocal
29803 instruction, the precision of the sequence can be decreased by up to 2
29804 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
29805 roots.
29807 @item -mrecip=@var{opt}
29808 @opindex mrecip=opt
29809 This option controls which reciprocal estimate instructions
29810 may be used.  @var{opt} is a comma-separated list of options, which may
29811 be preceded by a @code{!} to invert the option:
29813 @table @samp
29815 @item all
29816 Enable all estimate instructions.
29818 @item default 
29819 Enable the default instructions, equivalent to @option{-mrecip}.
29821 @item none 
29822 Disable all estimate instructions, equivalent to @option{-mno-recip}.
29824 @item div 
29825 Enable the reciprocal approximation instructions for both 
29826 single and double precision.
29828 @item divf 
29829 Enable the single-precision reciprocal approximation instructions.
29831 @item divd 
29832 Enable the double-precision reciprocal approximation instructions.
29834 @item rsqrt 
29835 Enable the reciprocal square root approximation instructions for both
29836 single and double precision.
29838 @item rsqrtf 
29839 Enable the single-precision reciprocal square root approximation instructions.
29841 @item rsqrtd 
29842 Enable the double-precision reciprocal square root approximation instructions.
29844 @end table
29846 So, for example, @option{-mrecip=all,!rsqrtd} enables
29847 all of the reciprocal estimate instructions, except for the
29848 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
29849 which handle the double-precision reciprocal square root calculations.
29851 @item -mrecip-precision
29852 @itemx -mno-recip-precision
29853 @opindex mrecip-precision
29854 Assume (do not assume) that the reciprocal estimate instructions
29855 provide higher-precision estimates than is mandated by the PowerPC
29856 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
29857 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
29858 The double-precision square root estimate instructions are not generated by
29859 default on low-precision machines, since they do not provide an
29860 estimate that converges after three steps.
29862 @item -mveclibabi=@var{type}
29863 @opindex mveclibabi
29864 Specifies the ABI type to use for vectorizing intrinsics using an
29865 external library.  The only type supported at present is @samp{mass},
29866 which specifies to use IBM's Mathematical Acceleration Subsystem
29867 (MASS) libraries for vectorizing intrinsics using external libraries.
29868 GCC currently emits calls to @code{acosd2}, @code{acosf4},
29869 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
29870 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
29871 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
29872 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
29873 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
29874 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
29875 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
29876 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
29877 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
29878 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
29879 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
29880 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
29881 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
29882 for power7.  Both @option{-ftree-vectorize} and
29883 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
29884 libraries must be specified at link time.
29886 @item -mfriz
29887 @itemx -mno-friz
29888 @opindex mfriz
29889 Generate (do not generate) the @code{friz} instruction when the
29890 @option{-funsafe-math-optimizations} option is used to optimize
29891 rounding of floating-point values to 64-bit integer and back to floating
29892 point.  The @code{friz} instruction does not return the same value if
29893 the floating-point number is too large to fit in an integer.
29895 @item -mpointers-to-nested-functions
29896 @itemx -mno-pointers-to-nested-functions
29897 @opindex mpointers-to-nested-functions
29898 Generate (do not generate) code to load up the static chain register
29899 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
29900 systems where a function pointer points to a 3-word descriptor giving
29901 the function address, TOC value to be loaded in register @code{r2}, and
29902 static chain value to be loaded in register @code{r11}.  The
29903 @option{-mpointers-to-nested-functions} is on by default.  You cannot
29904 call through pointers to nested functions or pointers
29905 to functions compiled in other languages that use the static chain if
29906 you use @option{-mno-pointers-to-nested-functions}.
29908 @item -msave-toc-indirect
29909 @itemx -mno-save-toc-indirect
29910 @opindex msave-toc-indirect
29911 Generate (do not generate) code to save the TOC value in the reserved
29912 stack location in the function prologue if the function calls through
29913 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
29914 saved in the prologue, it is saved just before the call through the
29915 pointer.  The @option{-mno-save-toc-indirect} option is the default.
29917 @item -mcompat-align-parm
29918 @itemx -mno-compat-align-parm
29919 @opindex mcompat-align-parm
29920 Generate (do not generate) code to pass structure parameters with a
29921 maximum alignment of 64 bits, for compatibility with older versions
29922 of GCC.
29924 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
29925 structure parameter on a 128-bit boundary when that structure contained
29926 a member requiring 128-bit alignment.  This is corrected in more
29927 recent versions of GCC.  This option may be used to generate code
29928 that is compatible with functions compiled with older versions of
29929 GCC.
29931 The @option{-mno-compat-align-parm} option is the default.
29933 @item -mstack-protector-guard=@var{guard}
29934 @itemx -mstack-protector-guard-reg=@var{reg}
29935 @itemx -mstack-protector-guard-offset=@var{offset}
29936 @itemx -mstack-protector-guard-symbol=@var{symbol}
29937 @opindex mstack-protector-guard
29938 @opindex mstack-protector-guard-reg
29939 @opindex mstack-protector-guard-offset
29940 @opindex mstack-protector-guard-symbol
29941 Generate stack protection code using canary at @var{guard}.  Supported
29942 locations are @samp{global} for global canary or @samp{tls} for per-thread
29943 canary in the TLS block (the default with GNU libc version 2.4 or later).
29945 With the latter choice the options
29946 @option{-mstack-protector-guard-reg=@var{reg}} and
29947 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29948 which register to use as base register for reading the canary, and from what
29949 offset from that base register. The default for those is as specified in the
29950 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
29951 the offset with a symbol reference to a canary in the TLS block.
29953 @item -mpcrel
29954 @itemx -mno-pcrel
29955 @opindex mpcrel
29956 @opindex mno-pcrel
29957 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
29958 option requires that the medium code model (@option{-mcmodel=medium})
29959 and prefixed addressing (@option{-mprefixed}) options are enabled.
29961 @item -mprefixed
29962 @itemx -mno-prefixed
29963 @opindex mprefixed
29964 @opindex mno-prefixed
29965 Generate (do not generate) addressing modes using prefixed load and
29966 store instructions.  The @option{-mprefixed} option requires that
29967 the option @option{-mcpu=power10} (or later) is enabled.
29969 @item -mmma
29970 @itemx -mno-mma
29971 @opindex mmma
29972 @opindex mno-mma
29973 Generate (do not generate) the MMA instructions.  The @option{-mma}
29974 option requires that the option @option{-mcpu=power10} (or later)
29975 is enabled.
29977 @item -mrop-protect
29978 @itemx -mno-rop-protect
29979 @opindex mrop-protect
29980 @opindex mno-rop-protect
29981 Generate (do not generate) ROP protection instructions when the target
29982 processor supports them.  Currently this option disables the shrink-wrap
29983 optimization (@option{-fshrink-wrap}).
29985 @item -mprivileged
29986 @itemx -mno-privileged
29987 @opindex mprivileged
29988 @opindex mno-privileged
29989 Generate (do not generate) code that will run in privileged state.
29991 @item -mblock-ops-unaligned-vsx
29992 @itemx -mno-block-ops-unaligned-vsx
29993 @opindex block-ops-unaligned-vsx
29994 @opindex no-block-ops-unaligned-vsx
29995 Generate (do not generate) unaligned vsx loads and stores for
29996 inline expansion of @code{memcpy} and @code{memmove}.
29998 @item --param rs6000-vect-unroll-limit=
29999 The vectorizer will check with target information to determine whether it
30000 would be beneficial to unroll the main vectorized loop and by how much.  This
30001 parameter sets the upper bound of how much the vectorizer will unroll the main
30002 loop.  The default value is four.
30004 @end table
30006 @node RX Options
30007 @subsection RX Options
30008 @cindex RX Options
30010 These command-line options are defined for RX targets:
30012 @table @gcctabopt
30013 @item -m64bit-doubles
30014 @itemx -m32bit-doubles
30015 @opindex m64bit-doubles
30016 @opindex m32bit-doubles
30017 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30018 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
30019 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
30020 works on 32-bit values, which is why the default is
30021 @option{-m32bit-doubles}.
30023 @item -fpu
30024 @itemx -nofpu
30025 @opindex fpu
30026 @opindex nofpu
30027 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
30028 floating-point hardware.  The default is enabled for the RX600
30029 series and disabled for the RX200 series.
30031 Floating-point instructions are only generated for 32-bit floating-point 
30032 values, however, so the FPU hardware is not used for doubles if the
30033 @option{-m64bit-doubles} option is used.
30035 @emph{Note} If the @option{-fpu} option is enabled then
30036 @option{-funsafe-math-optimizations} is also enabled automatically.
30037 This is because the RX FPU instructions are themselves unsafe.
30039 @item -mcpu=@var{name}
30040 @opindex mcpu
30041 Selects the type of RX CPU to be targeted.  Currently three types are
30042 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
30043 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
30045 The only difference between @samp{RX600} and @samp{RX610} is that the
30046 @samp{RX610} does not support the @code{MVTIPL} instruction.
30048 The @samp{RX200} series does not have a hardware floating-point unit
30049 and so @option{-nofpu} is enabled by default when this type is
30050 selected.
30052 @item -mbig-endian-data
30053 @itemx -mlittle-endian-data
30054 @opindex mbig-endian-data
30055 @opindex mlittle-endian-data
30056 Store data (but not code) in the big-endian format.  The default is
30057 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
30058 format.
30060 @item -msmall-data-limit=@var{N}
30061 @opindex msmall-data-limit
30062 Specifies the maximum size in bytes of global and static variables
30063 which can be placed into the small data area.  Using the small data
30064 area can lead to smaller and faster code, but the size of area is
30065 limited and it is up to the programmer to ensure that the area does
30066 not overflow.  Also when the small data area is used one of the RX's
30067 registers (usually @code{r13}) is reserved for use pointing to this
30068 area, so it is no longer available for use by the compiler.  This
30069 could result in slower and/or larger code if variables are pushed onto
30070 the stack instead of being held in this register.
30072 Note, common variables (variables that have not been initialized) and
30073 constants are not placed into the small data area as they are assigned
30074 to other sections in the output executable.
30076 The default value is zero, which disables this feature.  Note, this
30077 feature is not enabled by default with higher optimization levels
30078 (@option{-O2} etc) because of the potentially detrimental effects of
30079 reserving a register.  It is up to the programmer to experiment and
30080 discover whether this feature is of benefit to their program.  See the
30081 description of the @option{-mpid} option for a description of how the
30082 actual register to hold the small data area pointer is chosen.
30084 @item -msim
30085 @itemx -mno-sim
30086 @opindex msim
30087 @opindex mno-sim
30088 Use the simulator runtime.  The default is to use the libgloss
30089 board-specific runtime.
30091 @item -mas100-syntax
30092 @itemx -mno-as100-syntax
30093 @opindex mas100-syntax
30094 @opindex mno-as100-syntax
30095 When generating assembler output use a syntax that is compatible with
30096 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
30097 assembler, but it has some restrictions so it is not generated by default.
30099 @item -mmax-constant-size=@var{N}
30100 @opindex mmax-constant-size
30101 Specifies the maximum size, in bytes, of a constant that can be used as
30102 an operand in a RX instruction.  Although the RX instruction set does
30103 allow constants of up to 4 bytes in length to be used in instructions,
30104 a longer value equates to a longer instruction.  Thus in some
30105 circumstances it can be beneficial to restrict the size of constants
30106 that are used in instructions.  Constants that are too big are instead
30107 placed into a constant pool and referenced via register indirection.
30109 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
30110 or 4 means that constants of any size are allowed.
30112 @item -mrelax
30113 @opindex mrelax
30114 Enable linker relaxation.  Linker relaxation is a process whereby the
30115 linker attempts to reduce the size of a program by finding shorter
30116 versions of various instructions.  Disabled by default.
30118 @item -mint-register=@var{N}
30119 @opindex mint-register
30120 Specify the number of registers to reserve for fast interrupt handler
30121 functions.  The value @var{N} can be between 0 and 4.  A value of 1
30122 means that register @code{r13} is reserved for the exclusive use
30123 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
30124 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
30125 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
30126 A value of 0, the default, does not reserve any registers.
30128 @item -msave-acc-in-interrupts
30129 @opindex msave-acc-in-interrupts
30130 Specifies that interrupt handler functions should preserve the
30131 accumulator register.  This is only necessary if normal code might use
30132 the accumulator register, for example because it performs 64-bit
30133 multiplications.  The default is to ignore the accumulator as this
30134 makes the interrupt handlers faster.
30136 @item -mpid
30137 @itemx -mno-pid
30138 @opindex mpid
30139 @opindex mno-pid
30140 Enables the generation of position independent data.  When enabled any
30141 access to constant data is done via an offset from a base address
30142 held in a register.  This allows the location of constant data to be
30143 determined at run time without requiring the executable to be
30144 relocated, which is a benefit to embedded applications with tight
30145 memory constraints.  Data that can be modified is not affected by this
30146 option.
30148 Note, using this feature reserves a register, usually @code{r13}, for
30149 the constant data base address.  This can result in slower and/or
30150 larger code, especially in complicated functions.
30152 The actual register chosen to hold the constant data base address
30153 depends upon whether the @option{-msmall-data-limit} and/or the
30154 @option{-mint-register} command-line options are enabled.  Starting
30155 with register @code{r13} and proceeding downwards, registers are
30156 allocated first to satisfy the requirements of @option{-mint-register},
30157 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
30158 is possible for the small data area register to be @code{r8} if both
30159 @option{-mint-register=4} and @option{-mpid} are specified on the
30160 command line.
30162 By default this feature is not enabled.  The default can be restored
30163 via the @option{-mno-pid} command-line option.
30165 @item -mno-warn-multiple-fast-interrupts
30166 @itemx -mwarn-multiple-fast-interrupts
30167 @opindex mno-warn-multiple-fast-interrupts
30168 @opindex mwarn-multiple-fast-interrupts
30169 Prevents GCC from issuing a warning message if it finds more than one
30170 fast interrupt handler when it is compiling a file.  The default is to
30171 issue a warning for each extra fast interrupt handler found, as the RX
30172 only supports one such interrupt.
30174 @item -mallow-string-insns
30175 @itemx -mno-allow-string-insns
30176 @opindex mallow-string-insns
30177 @opindex mno-allow-string-insns
30178 Enables or disables the use of the string manipulation instructions
30179 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
30180 @code{SWHILE} and also the @code{RMPA} instruction.  These
30181 instructions may prefetch data, which is not safe to do if accessing
30182 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
30183 for more information).
30185 The default is to allow these instructions, but it is not possible for
30186 GCC to reliably detect all circumstances where a string instruction
30187 might be used to access an I/O register, so their use cannot be
30188 disabled automatically.  Instead it is reliant upon the programmer to
30189 use the @option{-mno-allow-string-insns} option if their program
30190 accesses I/O space.
30192 When the instructions are enabled GCC defines the C preprocessor
30193 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
30194 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
30196 @item -mjsr
30197 @itemx -mno-jsr
30198 @opindex mjsr
30199 @opindex mno-jsr
30200 Use only (or not only) @code{JSR} instructions to access functions.
30201 This option can be used when code size exceeds the range of @code{BSR}
30202 instructions.  Note that @option{-mno-jsr} does not mean to not use
30203 @code{JSR} but instead means that any type of branch may be used.
30204 @end table
30206 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
30207 has special significance to the RX port when used with the
30208 @code{interrupt} function attribute.  This attribute indicates a
30209 function intended to process fast interrupts.  GCC ensures
30210 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
30211 and/or @code{r13} and only provided that the normal use of the
30212 corresponding registers have been restricted via the
30213 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
30214 options.
30216 @node S/390 and zSeries Options
30217 @subsection S/390 and zSeries Options
30218 @cindex S/390 and zSeries Options
30220 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
30222 @table @gcctabopt
30223 @item -mhard-float
30224 @itemx -msoft-float
30225 @opindex mhard-float
30226 @opindex msoft-float
30227 Use (do not use) the hardware floating-point instructions and registers
30228 for floating-point operations.  When @option{-msoft-float} is specified,
30229 functions in @file{libgcc.a} are used to perform floating-point
30230 operations.  When @option{-mhard-float} is specified, the compiler
30231 generates IEEE floating-point instructions.  This is the default.
30233 @item -mhard-dfp
30234 @itemx -mno-hard-dfp
30235 @opindex mhard-dfp
30236 @opindex mno-hard-dfp
30237 Use (do not use) the hardware decimal-floating-point instructions for
30238 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
30239 specified, functions in @file{libgcc.a} are used to perform
30240 decimal-floating-point operations.  When @option{-mhard-dfp} is
30241 specified, the compiler generates decimal-floating-point hardware
30242 instructions.  This is the default for @option{-march=z9-ec} or higher.
30244 @item -mlong-double-64
30245 @itemx -mlong-double-128
30246 @opindex mlong-double-64
30247 @opindex mlong-double-128
30248 These switches control the size of @code{long double} type. A size
30249 of 64 bits makes the @code{long double} type equivalent to the @code{double}
30250 type. This is the default.
30252 @item -mbackchain
30253 @itemx -mno-backchain
30254 @opindex mbackchain
30255 @opindex mno-backchain
30256 Store (do not store) the address of the caller's frame as backchain pointer
30257 into the callee's stack frame.
30258 A backchain may be needed to allow debugging using tools that do not understand
30259 DWARF call frame information.
30260 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
30261 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
30262 the backchain is placed into the topmost word of the 96/160 byte register
30263 save area.
30265 In general, code compiled with @option{-mbackchain} is call-compatible with
30266 code compiled with @option{-mno-backchain}; however, use of the backchain
30267 for debugging purposes usually requires that the whole binary is built with
30268 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
30269 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
30270 to build a linux kernel use @option{-msoft-float}.
30272 The default is to not maintain the backchain.
30274 @item -mpacked-stack
30275 @itemx -mno-packed-stack
30276 @opindex mpacked-stack
30277 @opindex mno-packed-stack
30278 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
30279 specified, the compiler uses the all fields of the 96/160 byte register save
30280 area only for their default purpose; unused fields still take up stack space.
30281 When @option{-mpacked-stack} is specified, register save slots are densely
30282 packed at the top of the register save area; unused space is reused for other
30283 purposes, allowing for more efficient use of the available stack space.
30284 However, when @option{-mbackchain} is also in effect, the topmost word of
30285 the save area is always used to store the backchain, and the return address
30286 register is always saved two words below the backchain.
30288 As long as the stack frame backchain is not used, code generated with
30289 @option{-mpacked-stack} is call-compatible with code generated with
30290 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
30291 S/390 or zSeries generated code that uses the stack frame backchain at run
30292 time, not just for debugging purposes.  Such code is not call-compatible
30293 with code compiled with @option{-mpacked-stack}.  Also, note that the
30294 combination of @option{-mbackchain},
30295 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
30296 to build a linux kernel use @option{-msoft-float}.
30298 The default is to not use the packed stack layout.
30300 @item -msmall-exec
30301 @itemx -mno-small-exec
30302 @opindex msmall-exec
30303 @opindex mno-small-exec
30304 Generate (or do not generate) code using the @code{bras} instruction
30305 to do subroutine calls.
30306 This only works reliably if the total executable size does not
30307 exceed 64k.  The default is to use the @code{basr} instruction instead,
30308 which does not have this limitation.
30310 @item -m64
30311 @itemx -m31
30312 @opindex m64
30313 @opindex m31
30314 When @option{-m31} is specified, generate code compliant to the
30315 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
30316 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
30317 particular to generate 64-bit instructions.  For the @samp{s390}
30318 targets, the default is @option{-m31}, while the @samp{s390x}
30319 targets default to @option{-m64}.
30321 @item -mzarch
30322 @itemx -mesa
30323 @opindex mzarch
30324 @opindex mesa
30325 When @option{-mzarch} is specified, generate code using the
30326 instructions available on z/Architecture.
30327 When @option{-mesa} is specified, generate code using the
30328 instructions available on ESA/390.  Note that @option{-mesa} is
30329 not possible with @option{-m64}.
30330 When generating code compliant to the GNU/Linux for S/390 ABI,
30331 the default is @option{-mesa}.  When generating code compliant
30332 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
30334 @item -mhtm
30335 @itemx -mno-htm
30336 @opindex mhtm
30337 @opindex mno-htm
30338 The @option{-mhtm} option enables a set of builtins making use of
30339 instructions available with the transactional execution facility
30340 introduced with the IBM zEnterprise EC12 machine generation
30341 @ref{S/390 System z Built-in Functions}.
30342 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
30344 @item -mvx
30345 @itemx -mno-vx
30346 @opindex mvx
30347 @opindex mno-vx
30348 When @option{-mvx} is specified, generate code using the instructions
30349 available with the vector extension facility introduced with the IBM
30350 z13 machine generation.
30351 This option changes the ABI for some vector type values with regard to
30352 alignment and calling conventions.  In case vector type values are
30353 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
30354 command will be added to mark the resulting binary with the ABI used.
30355 @option{-mvx} is enabled by default when using @option{-march=z13}.
30357 @item -mzvector
30358 @itemx -mno-zvector
30359 @opindex mzvector
30360 @opindex mno-zvector
30361 The @option{-mzvector} option enables vector language extensions and
30362 builtins using instructions available with the vector extension
30363 facility introduced with the IBM z13 machine generation.
30364 This option adds support for @samp{vector} to be used as a keyword to
30365 define vector type variables and arguments.  @samp{vector} is only
30366 available when GNU extensions are enabled.  It will not be expanded
30367 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
30368 In addition to the GCC low-level builtins @option{-mzvector} enables
30369 a set of builtins added for compatibility with AltiVec-style
30370 implementations like Power and Cell.  In order to make use of these
30371 builtins the header file @file{vecintrin.h} needs to be included.
30372 @option{-mzvector} is disabled by default.
30374 @item -mmvcle
30375 @itemx -mno-mvcle
30376 @opindex mmvcle
30377 @opindex mno-mvcle
30378 Generate (or do not generate) code using the @code{mvcle} instruction
30379 to perform block moves.  When @option{-mno-mvcle} is specified,
30380 use a @code{mvc} loop instead.  This is the default unless optimizing for
30381 size.
30383 @item -mdebug
30384 @itemx -mno-debug
30385 @opindex mdebug
30386 @opindex mno-debug
30387 Print (or do not print) additional debug information when compiling.
30388 The default is to not print debug information.
30390 @item -march=@var{cpu-type}
30391 @opindex march
30392 Generate code that runs on @var{cpu-type}, which is the name of a
30393 system representing a certain processor type.  Possible values for
30394 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
30395 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
30396 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
30397 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
30398 @samp{z16}/@samp{arch14}, and @samp{native}.
30400 The default is @option{-march=z900}.
30402 Specifying @samp{native} as cpu type can be used to select the best
30403 architecture option for the host processor.
30404 @option{-march=native} has no effect if GCC does not recognize the
30405 processor.
30407 @item -mtune=@var{cpu-type}
30408 @opindex mtune
30409 Tune to @var{cpu-type} everything applicable about the generated code,
30410 except for the ABI and the set of available instructions.
30411 The list of @var{cpu-type} values is the same as for @option{-march}.
30412 The default is the value used for @option{-march}.
30414 @item -mtpf-trace
30415 @itemx -mno-tpf-trace
30416 @opindex mtpf-trace
30417 @opindex mno-tpf-trace
30418 Generate code that adds (does not add) in TPF OS specific branches to trace
30419 routines in the operating system.  This option is off by default, even
30420 when compiling for the TPF OS@.
30422 @item -mtpf-trace-skip
30423 @itemx -mno-tpf-trace-skip
30424 @opindex mtpf-trace-skip
30425 @opindex mno-tpf-trace-skip
30426 Generate code that changes (does not change) the default branch
30427 targets enabled by @option{-mtpf-trace} to point to specialized trace
30428 routines providing the ability of selectively skipping function trace
30429 entries for the TPF OS.  This option is off by default, even when
30430 compiling for the TPF OS and specifying @option{-mtpf-trace}.
30432 @item -mfused-madd
30433 @itemx -mno-fused-madd
30434 @opindex mfused-madd
30435 @opindex mno-fused-madd
30436 Generate code that uses (does not use) the floating-point multiply and
30437 accumulate instructions.  These instructions are generated by default if
30438 hardware floating point is used.
30440 @item -mwarn-framesize=@var{framesize}
30441 @opindex mwarn-framesize
30442 Emit a warning if the current function exceeds the given frame size.  Because
30443 this is a compile-time check it doesn't need to be a real problem when the program
30444 runs.  It is intended to identify functions that most probably cause
30445 a stack overflow.  It is useful to be used in an environment with limited stack
30446 size e.g.@: the linux kernel.
30448 @item -mwarn-dynamicstack
30449 @opindex mwarn-dynamicstack
30450 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
30451 arrays.  This is generally a bad idea with a limited stack size.
30453 @item -mstack-guard=@var{stack-guard}
30454 @itemx -mstack-size=@var{stack-size}
30455 @opindex mstack-guard
30456 @opindex mstack-size
30457 If these options are provided the S/390 back end emits additional instructions in
30458 the function prologue that trigger a trap if the stack size is @var{stack-guard}
30459 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
30460 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
30461 the frame size of the compiled function is chosen.
30462 These options are intended to be used to help debugging stack overflow problems.
30463 The additionally emitted code causes only little overhead and hence can also be
30464 used in production-like systems without greater performance degradation.  The given
30465 values have to be exact powers of 2 and @var{stack-size} has to be greater than
30466 @var{stack-guard} without exceeding 64k.
30467 In order to be efficient the extra code makes the assumption that the stack starts
30468 at an address aligned to the value given by @var{stack-size}.
30469 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
30471 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
30472 @opindex mhotpatch
30473 If the hotpatch option is enabled, a ``hot-patching'' function
30474 prologue is generated for all functions in the compilation unit.
30475 The funtion label is prepended with the given number of two-byte
30476 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
30477 the label, 2 * @var{post-halfwords} bytes are appended, using the
30478 largest NOP like instructions the architecture allows (maximum
30479 1000000).
30481 If both arguments are zero, hotpatching is disabled.
30483 This option can be overridden for individual functions with the
30484 @code{hotpatch} attribute.
30485 @end table
30487 @node Score Options
30488 @subsection Score Options
30489 @cindex Score Options
30491 These options are defined for Score implementations:
30493 @table @gcctabopt
30494 @item -meb
30495 @opindex meb
30496 Compile code for big-endian mode.  This is the default.
30498 @item -mel
30499 @opindex mel
30500 Compile code for little-endian mode.
30502 @item -mnhwloop
30503 @opindex mnhwloop
30504 Disable generation of @code{bcnz} instructions.
30506 @item -muls
30507 @opindex muls
30508 Enable generation of unaligned load and store instructions.
30510 @item -mmac
30511 @opindex mmac
30512 Enable the use of multiply-accumulate instructions. Disabled by default.
30514 @item -mscore5
30515 @opindex mscore5
30516 Specify the SCORE5 as the target architecture.
30518 @item -mscore5u
30519 @opindex mscore5u
30520 Specify the SCORE5U of the target architecture.
30522 @item -mscore7
30523 @opindex mscore7
30524 Specify the SCORE7 as the target architecture. This is the default.
30526 @item -mscore7d
30527 @opindex mscore7d
30528 Specify the SCORE7D as the target architecture.
30529 @end table
30531 @node SH Options
30532 @subsection SH Options
30534 These @samp{-m} options are defined for the SH implementations:
30536 @table @gcctabopt
30537 @item -m1
30538 @opindex m1
30539 Generate code for the SH1.
30541 @item -m2
30542 @opindex m2
30543 Generate code for the SH2.
30545 @item -m2e
30546 Generate code for the SH2e.
30548 @item -m2a-nofpu
30549 @opindex m2a-nofpu
30550 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
30551 that the floating-point unit is not used.
30553 @item -m2a-single-only
30554 @opindex m2a-single-only
30555 Generate code for the SH2a-FPU, in such a way that no double-precision
30556 floating-point operations are used.
30558 @item -m2a-single
30559 @opindex m2a-single
30560 Generate code for the SH2a-FPU assuming the floating-point unit is in
30561 single-precision mode by default.
30563 @item -m2a
30564 @opindex m2a
30565 Generate code for the SH2a-FPU assuming the floating-point unit is in
30566 double-precision mode by default.
30568 @item -m3
30569 @opindex m3
30570 Generate code for the SH3.
30572 @item -m3e
30573 @opindex m3e
30574 Generate code for the SH3e.
30576 @item -m4-nofpu
30577 @opindex m4-nofpu
30578 Generate code for the SH4 without a floating-point unit.
30580 @item -m4-single-only
30581 @opindex m4-single-only
30582 Generate code for the SH4 with a floating-point unit that only
30583 supports single-precision arithmetic.
30585 @item -m4-single
30586 @opindex m4-single
30587 Generate code for the SH4 assuming the floating-point unit is in
30588 single-precision mode by default.
30590 @item -m4
30591 @opindex m4
30592 Generate code for the SH4.
30594 @item -m4-100
30595 @opindex m4-100
30596 Generate code for SH4-100.
30598 @item -m4-100-nofpu
30599 @opindex m4-100-nofpu
30600 Generate code for SH4-100 in such a way that the
30601 floating-point unit is not used.
30603 @item -m4-100-single
30604 @opindex m4-100-single
30605 Generate code for SH4-100 assuming the floating-point unit is in
30606 single-precision mode by default.
30608 @item -m4-100-single-only
30609 @opindex m4-100-single-only
30610 Generate code for SH4-100 in such a way that no double-precision
30611 floating-point operations are used.
30613 @item -m4-200
30614 @opindex m4-200
30615 Generate code for SH4-200.
30617 @item -m4-200-nofpu
30618 @opindex m4-200-nofpu
30619 Generate code for SH4-200 without in such a way that the
30620 floating-point unit is not used.
30622 @item -m4-200-single
30623 @opindex m4-200-single
30624 Generate code for SH4-200 assuming the floating-point unit is in
30625 single-precision mode by default.
30627 @item -m4-200-single-only
30628 @opindex m4-200-single-only
30629 Generate code for SH4-200 in such a way that no double-precision
30630 floating-point operations are used.
30632 @item -m4-300
30633 @opindex m4-300
30634 Generate code for SH4-300.
30636 @item -m4-300-nofpu
30637 @opindex m4-300-nofpu
30638 Generate code for SH4-300 without in such a way that the
30639 floating-point unit is not used.
30641 @item -m4-300-single
30642 @opindex m4-300-single
30643 Generate code for SH4-300 in such a way that no double-precision
30644 floating-point operations are used.
30646 @item -m4-300-single-only
30647 @opindex m4-300-single-only
30648 Generate code for SH4-300 in such a way that no double-precision
30649 floating-point operations are used.
30651 @item -m4-340
30652 @opindex m4-340
30653 Generate code for SH4-340 (no MMU, no FPU).
30655 @item -m4-500
30656 @opindex m4-500
30657 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
30658 assembler.
30660 @item -m4a-nofpu
30661 @opindex m4a-nofpu
30662 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
30663 floating-point unit is not used.
30665 @item -m4a-single-only
30666 @opindex m4a-single-only
30667 Generate code for the SH4a, in such a way that no double-precision
30668 floating-point operations are used.
30670 @item -m4a-single
30671 @opindex m4a-single
30672 Generate code for the SH4a assuming the floating-point unit is in
30673 single-precision mode by default.
30675 @item -m4a
30676 @opindex m4a
30677 Generate code for the SH4a.
30679 @item -m4al
30680 @opindex m4al
30681 Same as @option{-m4a-nofpu}, except that it implicitly passes
30682 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
30683 instructions at the moment.
30685 @item -mb
30686 @opindex mb
30687 Compile code for the processor in big-endian mode.
30689 @item -ml
30690 @opindex ml
30691 Compile code for the processor in little-endian mode.
30693 @item -mdalign
30694 @opindex mdalign
30695 Align doubles at 64-bit boundaries.  Note that this changes the calling
30696 conventions, and thus some functions from the standard C library do
30697 not work unless you recompile it first with @option{-mdalign}.
30699 @item -mrelax
30700 @opindex mrelax
30701 Shorten some address references at link time, when possible; uses the
30702 linker option @option{-relax}.
30704 @item -mbigtable
30705 @opindex mbigtable
30706 Use 32-bit offsets in @code{switch} tables.  The default is to use
30707 16-bit offsets.
30709 @item -mbitops
30710 @opindex mbitops
30711 Enable the use of bit manipulation instructions on SH2A.
30713 @item -mfmovd
30714 @opindex mfmovd
30715 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
30716 alignment constraints.
30718 @item -mrenesas
30719 @opindex mrenesas
30720 Comply with the calling conventions defined by Renesas.
30722 @item -mno-renesas
30723 @opindex mno-renesas
30724 Comply with the calling conventions defined for GCC before the Renesas
30725 conventions were available.  This option is the default for all
30726 targets of the SH toolchain.
30728 @item -mnomacsave
30729 @opindex mnomacsave
30730 Mark the @code{MAC} register as call-clobbered, even if
30731 @option{-mrenesas} is given.
30733 @item -mieee
30734 @itemx -mno-ieee
30735 @opindex mieee
30736 @opindex mno-ieee
30737 Control the IEEE compliance of floating-point comparisons, which affects the
30738 handling of cases where the result of a comparison is unordered.  By default
30739 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
30740 enabled @option{-mno-ieee} is implicitly set, which results in faster
30741 floating-point greater-equal and less-equal comparisons.  The implicit settings
30742 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
30744 @item -minline-ic_invalidate
30745 @opindex minline-ic_invalidate
30746 Inline code to invalidate instruction cache entries after setting up
30747 nested function trampolines.
30748 This option has no effect if @option{-musermode} is in effect and the selected
30749 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
30750 instruction.
30751 If the selected code generation option does not allow the use of the @code{icbi}
30752 instruction, and @option{-musermode} is not in effect, the inlined code
30753 manipulates the instruction cache address array directly with an associative
30754 write.  This not only requires privileged mode at run time, but it also
30755 fails if the cache line had been mapped via the TLB and has become unmapped.
30757 @item -misize
30758 @opindex misize
30759 Dump instruction size and location in the assembly code.
30761 @item -mpadstruct
30762 @opindex mpadstruct
30763 This option is deprecated.  It pads structures to multiple of 4 bytes,
30764 which is incompatible with the SH ABI@.
30766 @item -matomic-model=@var{model}
30767 @opindex matomic-model=@var{model}
30768 Sets the model of atomic operations and additional parameters as a comma
30769 separated list.  For details on the atomic built-in functions see
30770 @ref{__atomic Builtins}.  The following models and parameters are supported:
30772 @table @samp
30774 @item none
30775 Disable compiler generated atomic sequences and emit library calls for atomic
30776 operations.  This is the default if the target is not @code{sh*-*-linux*}.
30778 @item soft-gusa
30779 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
30780 built-in functions.  The generated atomic sequences require additional support
30781 from the interrupt/exception handling code of the system and are only suitable
30782 for SH3* and SH4* single-core systems.  This option is enabled by default when
30783 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
30784 this option also partially utilizes the hardware atomic instructions
30785 @code{movli.l} and @code{movco.l} to create more efficient code, unless
30786 @samp{strict} is specified.  
30788 @item soft-tcb
30789 Generate software atomic sequences that use a variable in the thread control
30790 block.  This is a variation of the gUSA sequences which can also be used on
30791 SH1* and SH2* targets.  The generated atomic sequences require additional
30792 support from the interrupt/exception handling code of the system and are only
30793 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
30794 parameter has to be specified as well.
30796 @item soft-imask
30797 Generate software atomic sequences that temporarily disable interrupts by
30798 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
30799 in privileged mode and is only suitable for single-core systems.  Additional
30800 support from the interrupt/exception handling code of the system is not
30801 required.  This model is enabled by default when the target is
30802 @code{sh*-*-linux*} and SH1* or SH2*.
30804 @item hard-llcs
30805 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
30806 instructions only.  This is only available on SH4A and is suitable for
30807 multi-core systems.  Since the hardware instructions support only 32 bit atomic
30808 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
30809 Code compiled with this option is also compatible with other software
30810 atomic model interrupt/exception handling systems if executed on an SH4A
30811 system.  Additional support from the interrupt/exception handling code of the
30812 system is not required for this model.
30814 @item gbr-offset=
30815 This parameter specifies the offset in bytes of the variable in the thread
30816 control block structure that should be used by the generated atomic sequences
30817 when the @samp{soft-tcb} model has been selected.  For other models this
30818 parameter is ignored.  The specified value must be an integer multiple of four
30819 and in the range 0-1020.
30821 @item strict
30822 This parameter prevents mixed usage of multiple atomic models, even if they
30823 are compatible, and makes the compiler generate atomic sequences of the
30824 specified model only.
30826 @end table
30828 @item -mtas
30829 @opindex mtas
30830 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
30831 Notice that depending on the particular hardware and software configuration
30832 this can degrade overall performance due to the operand cache line flushes
30833 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
30834 processors the @code{tas.b} instruction must be used with caution since it
30835 can result in data corruption for certain cache configurations.
30837 @item -mprefergot
30838 @opindex mprefergot
30839 When generating position-independent code, emit function calls using
30840 the Global Offset Table instead of the Procedure Linkage Table.
30842 @item -musermode
30843 @itemx -mno-usermode
30844 @opindex musermode
30845 @opindex mno-usermode
30846 Don't allow (allow) the compiler generating privileged mode code.  Specifying
30847 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
30848 inlined code would not work in user mode.  @option{-musermode} is the default
30849 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
30850 @option{-musermode} has no effect, since there is no user mode.
30852 @item -multcost=@var{number}
30853 @opindex multcost=@var{number}
30854 Set the cost to assume for a multiply insn.
30856 @item -mdiv=@var{strategy}
30857 @opindex mdiv=@var{strategy}
30858 Set the division strategy to be used for integer division operations.
30859 @var{strategy} can be one of: 
30861 @table @samp
30863 @item call-div1
30864 Calls a library function that uses the single-step division instruction
30865 @code{div1} to perform the operation.  Division by zero calculates an
30866 unspecified result and does not trap.  This is the default except for SH4,
30867 SH2A and SHcompact.
30869 @item call-fp
30870 Calls a library function that performs the operation in double precision
30871 floating point.  Division by zero causes a floating-point exception.  This is
30872 the default for SHcompact with FPU.  Specifying this for targets that do not
30873 have a double precision FPU defaults to @code{call-div1}.
30875 @item call-table
30876 Calls a library function that uses a lookup table for small divisors and
30877 the @code{div1} instruction with case distinction for larger divisors.  Division
30878 by zero calculates an unspecified result and does not trap.  This is the default
30879 for SH4.  Specifying this for targets that do not have dynamic shift
30880 instructions defaults to @code{call-div1}.
30882 @end table
30884 When a division strategy has not been specified the default strategy is
30885 selected based on the current target.  For SH2A the default strategy is to
30886 use the @code{divs} and @code{divu} instructions instead of library function
30887 calls.
30889 @item -maccumulate-outgoing-args
30890 @opindex maccumulate-outgoing-args
30891 Reserve space once for outgoing arguments in the function prologue rather
30892 than around each call.  Generally beneficial for performance and size.  Also
30893 needed for unwinding to avoid changing the stack frame around conditional code.
30895 @item -mdivsi3_libfunc=@var{name}
30896 @opindex mdivsi3_libfunc=@var{name}
30897 Set the name of the library function used for 32-bit signed division to
30898 @var{name}.
30899 This only affects the name used in the @samp{call} division strategies, and
30900 the compiler still expects the same sets of input/output/clobbered registers as
30901 if this option were not present.
30903 @item -mfixed-range=@var{register-range}
30904 @opindex mfixed-range
30905 Generate code treating the given register range as fixed registers.
30906 A fixed register is one that the register allocator cannot use.  This is
30907 useful when compiling kernel code.  A register range is specified as
30908 two registers separated by a dash.  Multiple register ranges can be
30909 specified separated by a comma.
30911 @item -mbranch-cost=@var{num}
30912 @opindex mbranch-cost=@var{num}
30913 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
30914 make the compiler try to generate more branch-free code if possible.  
30915 If not specified the value is selected depending on the processor type that
30916 is being compiled for.
30918 @item -mzdcbranch
30919 @itemx -mno-zdcbranch
30920 @opindex mzdcbranch
30921 @opindex mno-zdcbranch
30922 Assume (do not assume) that zero displacement conditional branch instructions
30923 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
30924 compiler prefers zero displacement branch code sequences.  This is
30925 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
30926 disabled by specifying @option{-mno-zdcbranch}.
30928 @item -mcbranch-force-delay-slot
30929 @opindex mcbranch-force-delay-slot
30930 Force the usage of delay slots for conditional branches, which stuffs the delay
30931 slot with a @code{nop} if a suitable instruction cannot be found.  By default
30932 this option is disabled.  It can be enabled to work around hardware bugs as
30933 found in the original SH7055.
30935 @item -mfused-madd
30936 @itemx -mno-fused-madd
30937 @opindex mfused-madd
30938 @opindex mno-fused-madd
30939 Generate code that uses (does not use) the floating-point multiply and
30940 accumulate instructions.  These instructions are generated by default
30941 if hardware floating point is used.  The machine-dependent
30942 @option{-mfused-madd} option is now mapped to the machine-independent
30943 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
30944 mapped to @option{-ffp-contract=off}.
30946 @item -mfsca
30947 @itemx -mno-fsca
30948 @opindex mfsca
30949 @opindex mno-fsca
30950 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
30951 and cosine approximations.  The option @option{-mfsca} must be used in
30952 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
30953 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
30954 approximations even if @option{-funsafe-math-optimizations} is in effect.
30956 @item -mfsrra
30957 @itemx -mno-fsrra
30958 @opindex mfsrra
30959 @opindex mno-fsrra
30960 Allow or disallow the compiler to emit the @code{fsrra} instruction for
30961 reciprocal square root approximations.  The option @option{-mfsrra} must be used
30962 in combination with @option{-funsafe-math-optimizations} and
30963 @option{-ffinite-math-only}.  It is enabled by default when generating code for
30964 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
30965 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
30966 in effect.
30968 @item -mpretend-cmove
30969 @opindex mpretend-cmove
30970 Prefer zero-displacement conditional branches for conditional move instruction
30971 patterns.  This can result in faster code on the SH4 processor.
30973 @item -mfdpic
30974 @opindex fdpic
30975 Generate code using the FDPIC ABI.
30977 @end table
30979 @node Solaris 2 Options
30980 @subsection Solaris 2 Options
30981 @cindex Solaris 2 options
30983 These @samp{-m} options are supported on Solaris 2:
30985 @table @gcctabopt
30986 @item -mclear-hwcap
30987 @opindex mclear-hwcap
30988 @option{-mclear-hwcap} tells the compiler to remove the hardware
30989 capabilities generated by the Solaris assembler.  This is only necessary
30990 when object files use ISA extensions not supported by the current
30991 machine, but check at runtime whether or not to use them.
30993 @item -mimpure-text
30994 @opindex mimpure-text
30995 @option{-mimpure-text}, used in addition to @option{-shared}, tells
30996 the compiler to not pass @option{-z text} to the linker when linking a
30997 shared object.  Using this option, you can link position-dependent
30998 code into a shared object.
31000 @option{-mimpure-text} suppresses the ``relocations remain against
31001 allocatable but non-writable sections'' linker error message.
31002 However, the necessary relocations trigger copy-on-write, and the
31003 shared object is not actually shared across processes.  Instead of
31004 using @option{-mimpure-text}, you should compile all source code with
31005 @option{-fpic} or @option{-fPIC}.
31007 @end table
31009 These switches are supported in addition to the above on Solaris 2:
31011 @table @gcctabopt
31012 @item -pthreads
31013 @opindex pthreads
31014 This is a synonym for @option{-pthread}.
31015 @end table
31017 @node SPARC Options
31018 @subsection SPARC Options
31019 @cindex SPARC options
31021 These @samp{-m} options are supported on the SPARC:
31023 @table @gcctabopt
31024 @item -mno-app-regs
31025 @itemx -mapp-regs
31026 @opindex mno-app-regs
31027 @opindex mapp-regs
31028 Specify @option{-mapp-regs} to generate output using the global registers
31029 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
31030 global register 1, each global register 2 through 4 is then treated as an
31031 allocable register that is clobbered by function calls.  This is the default.
31033 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31034 specify @option{-mno-app-regs}.  You should compile libraries and system
31035 software with this option.
31037 @item -mflat
31038 @itemx -mno-flat
31039 @opindex mflat
31040 @opindex mno-flat
31041 With @option{-mflat}, the compiler does not generate save/restore instructions
31042 and uses a ``flat'' or single register window model.  This model is compatible
31043 with the regular register window model.  The local registers and the input
31044 registers (0--5) are still treated as ``call-saved'' registers and are
31045 saved on the stack as needed.
31047 With @option{-mno-flat} (the default), the compiler generates save/restore
31048 instructions (except for leaf functions).  This is the normal operating mode.
31050 @item -mfpu
31051 @itemx -mhard-float
31052 @opindex mfpu
31053 @opindex mhard-float
31054 Generate output containing floating-point instructions.  This is the
31055 default.
31057 @item -mno-fpu
31058 @itemx -msoft-float
31059 @opindex mno-fpu
31060 @opindex msoft-float
31061 Generate output containing library calls for floating point.
31062 @strong{Warning:} the requisite libraries are not available for all SPARC
31063 targets.  Normally the facilities of the machine's usual C compiler are
31064 used, but this cannot be done directly in cross-compilation.  You must make
31065 your own arrangements to provide suitable library functions for
31066 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
31067 @samp{sparclite-*-*} do provide software floating-point support.
31069 @option{-msoft-float} changes the calling convention in the output file;
31070 therefore, it is only useful if you compile @emph{all} of a program with
31071 this option.  In particular, you need to compile @file{libgcc.a}, the
31072 library that comes with GCC, with @option{-msoft-float} in order for
31073 this to work.
31075 @item -mhard-quad-float
31076 @opindex mhard-quad-float
31077 Generate output containing quad-word (long double) floating-point
31078 instructions.
31080 @item -msoft-quad-float
31081 @opindex msoft-quad-float
31082 Generate output containing library calls for quad-word (long double)
31083 floating-point instructions.  The functions called are those specified
31084 in the SPARC ABI@.  This is the default.
31086 As of this writing, there are no SPARC implementations that have hardware
31087 support for the quad-word floating-point instructions.  They all invoke
31088 a trap handler for one of these instructions, and then the trap handler
31089 emulates the effect of the instruction.  Because of the trap handler overhead,
31090 this is much slower than calling the ABI library routines.  Thus the
31091 @option{-msoft-quad-float} option is the default.
31093 @item -mno-unaligned-doubles
31094 @itemx -munaligned-doubles
31095 @opindex mno-unaligned-doubles
31096 @opindex munaligned-doubles
31097 Assume that doubles have 8-byte alignment.  This is the default.
31099 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
31100 alignment only if they are contained in another type, or if they have an
31101 absolute address.  Otherwise, it assumes they have 4-byte alignment.
31102 Specifying this option avoids some rare compatibility problems with code
31103 generated by other compilers.  It is not the default because it results
31104 in a performance loss, especially for floating-point code.
31106 @item -muser-mode
31107 @itemx -mno-user-mode
31108 @opindex muser-mode
31109 @opindex mno-user-mode
31110 Do not generate code that can only run in supervisor mode.  This is relevant
31111 only for the @code{casa} instruction emitted for the LEON3 processor.  This
31112 is the default.
31114 @item -mfaster-structs
31115 @itemx -mno-faster-structs
31116 @opindex mfaster-structs
31117 @opindex mno-faster-structs
31118 With @option{-mfaster-structs}, the compiler assumes that structures
31119 should have 8-byte alignment.  This enables the use of pairs of
31120 @code{ldd} and @code{std} instructions for copies in structure
31121 assignment, in place of twice as many @code{ld} and @code{st} pairs.
31122 However, the use of this changed alignment directly violates the SPARC
31123 ABI@.  Thus, it's intended only for use on targets where the developer
31124 acknowledges that their resulting code is not directly in line with
31125 the rules of the ABI@.
31127 @item -mstd-struct-return
31128 @itemx -mno-std-struct-return
31129 @opindex mstd-struct-return
31130 @opindex mno-std-struct-return
31131 With @option{-mstd-struct-return}, the compiler generates checking code
31132 in functions returning structures or unions to detect size mismatches
31133 between the two sides of function calls, as per the 32-bit ABI@.
31135 The default is @option{-mno-std-struct-return}.  This option has no effect
31136 in 64-bit mode.
31138 @item -mlra
31139 @itemx -mno-lra
31140 @opindex mlra
31141 @opindex mno-lra
31142 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
31143 so @option{-mno-lra} needs to be passed to get old Reload.
31145 @item -mcpu=@var{cpu_type}
31146 @opindex mcpu
31147 Set the instruction set, register set, and instruction scheduling parameters
31148 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
31149 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
31150 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
31151 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
31152 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
31153 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
31154 @samp{m8}.
31156 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
31157 which selects the best architecture option for the host processor.
31158 @option{-mcpu=native} has no effect if GCC does not recognize
31159 the processor.
31161 Default instruction scheduling parameters are used for values that select
31162 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
31163 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
31165 Here is a list of each supported architecture and their supported
31166 implementations.
31168 @table @asis
31169 @item v7
31170 cypress, leon3v7
31172 @item v8
31173 supersparc, hypersparc, leon, leon3, leon5
31175 @item sparclite
31176 f930, f934, sparclite86x
31178 @item sparclet
31179 tsc701
31181 @item v9
31182 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
31183 niagara7, m8
31184 @end table
31186 By default (unless configured otherwise), GCC generates code for the V7
31187 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
31188 additionally optimizes it for the Cypress CY7C602 chip, as used in the
31189 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
31190 SPARCStation 1, 2, IPX etc.
31192 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
31193 architecture.  The only difference from V7 code is that the compiler emits
31194 the integer multiply and integer divide instructions which exist in SPARC-V8
31195 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
31196 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
31197 2000 series.
31199 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
31200 the SPARC architecture.  This adds the integer multiply, integer divide step
31201 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
31202 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
31203 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
31204 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
31205 MB86934 chip, which is the more recent SPARClite with FPU@.
31207 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
31208 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
31209 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
31210 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
31211 optimizes it for the TEMIC SPARClet chip.
31213 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
31214 architecture.  This adds 64-bit integer and floating-point move instructions,
31215 3 additional floating-point condition code registers and conditional move
31216 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
31217 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
31218 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
31219 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
31220 @option{-mcpu=niagara}, the compiler additionally optimizes it for
31221 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
31222 additionally optimizes it for Sun UltraSPARC T2 chips. With
31223 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
31224 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
31225 additionally optimizes it for Sun UltraSPARC T4 chips.  With
31226 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
31227 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
31228 additionally optimizes it for Oracle M8 chips.
31230 @item -mtune=@var{cpu_type}
31231 @opindex mtune
31232 Set the instruction scheduling parameters for machine type
31233 @var{cpu_type}, but do not set the instruction set or register set that the
31234 option @option{-mcpu=@var{cpu_type}} does.
31236 The same values for @option{-mcpu=@var{cpu_type}} can be used for
31237 @option{-mtune=@var{cpu_type}}, but the only useful values are those
31238 that select a particular CPU implementation.  Those are
31239 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
31240 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
31241 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
31242 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
31243 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
31244 and GNU/Linux toolchains, @samp{native} can also be used.
31246 @item -mv8plus
31247 @itemx -mno-v8plus
31248 @opindex mv8plus
31249 @opindex mno-v8plus
31250 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
31251 difference from the V8 ABI is that the global and out registers are
31252 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
31253 mode for all SPARC-V9 processors.
31255 @item -mvis
31256 @itemx -mno-vis
31257 @opindex mvis
31258 @opindex mno-vis
31259 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
31260 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
31262 @item -mvis2
31263 @itemx -mno-vis2
31264 @opindex mvis2
31265 @opindex mno-vis2
31266 With @option{-mvis2}, GCC generates code that takes advantage of
31267 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
31268 default is @option{-mvis2} when targeting a cpu that supports such
31269 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
31270 also sets @option{-mvis}.
31272 @item -mvis3
31273 @itemx -mno-vis3
31274 @opindex mvis3
31275 @opindex mno-vis3
31276 With @option{-mvis3}, GCC generates code that takes advantage of
31277 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
31278 default is @option{-mvis3} when targeting a cpu that supports such
31279 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
31280 also sets @option{-mvis2} and @option{-mvis}.
31282 @item -mvis4
31283 @itemx -mno-vis4
31284 @opindex mvis4
31285 @opindex mno-vis4
31286 With @option{-mvis4}, GCC generates code that takes advantage of
31287 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
31288 default is @option{-mvis4} when targeting a cpu that supports such
31289 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
31290 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
31292 @item -mvis4b
31293 @itemx -mno-vis4b
31294 @opindex mvis4b
31295 @opindex mno-vis4b
31296 With @option{-mvis4b}, GCC generates code that takes advantage of
31297 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
31298 the additional VIS instructions introduced in the Oracle SPARC
31299 Architecture 2017.  The default is @option{-mvis4b} when targeting a
31300 cpu that supports such instructions, such as m8 and later.  Setting
31301 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
31302 @option{-mvis2} and @option{-mvis}.
31304 @item -mcbcond
31305 @itemx -mno-cbcond
31306 @opindex mcbcond
31307 @opindex mno-cbcond
31308 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
31309 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
31310 when targeting a CPU that supports such instructions, such as Niagara-4 and
31311 later.
31313 @item -mfmaf
31314 @itemx -mno-fmaf
31315 @opindex mfmaf
31316 @opindex mno-fmaf
31317 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
31318 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
31319 when targeting a CPU that supports such instructions, such as Niagara-3 and
31320 later.
31322 @item -mfsmuld
31323 @itemx -mno-fsmuld
31324 @opindex mfsmuld
31325 @opindex mno-fsmuld
31326 With @option{-mfsmuld}, GCC generates code that takes advantage of the
31327 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
31328 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
31329 or V9 with FPU except @option{-mcpu=leon}.
31331 @item -mpopc
31332 @itemx -mno-popc
31333 @opindex mpopc
31334 @opindex mno-popc
31335 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
31336 Population Count instruction.  The default is @option{-mpopc}
31337 when targeting a CPU that supports such an instruction, such as Niagara-2 and
31338 later.
31340 @item -msubxc
31341 @itemx -mno-subxc
31342 @opindex msubxc
31343 @opindex mno-subxc
31344 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
31345 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
31346 when targeting a CPU that supports such an instruction, such as Niagara-7 and
31347 later.
31349 @item -mfix-at697f
31350 @opindex mfix-at697f
31351 Enable the documented workaround for the single erratum of the Atmel AT697F
31352 processor (which corresponds to erratum #13 of the AT697E processor).
31354 @item -mfix-ut699
31355 @opindex mfix-ut699
31356 Enable the documented workarounds for the floating-point errata and the data
31357 cache nullify errata of the UT699 processor.
31359 @item -mfix-ut700
31360 @opindex mfix-ut700
31361 Enable the documented workaround for the back-to-back store errata of
31362 the UT699E/UT700 processor.
31364 @item -mfix-gr712rc
31365 @opindex mfix-gr712rc
31366 Enable the documented workaround for the back-to-back store errata of
31367 the GR712RC processor.
31368 @end table
31370 These @samp{-m} options are supported in addition to the above
31371 on SPARC-V9 processors in 64-bit environments:
31373 @table @gcctabopt
31374 @item -m32
31375 @itemx -m64
31376 @opindex m32
31377 @opindex m64
31378 Generate code for a 32-bit or 64-bit environment.
31379 The 32-bit environment sets int, long and pointer to 32 bits.
31380 The 64-bit environment sets int to 32 bits and long and pointer
31381 to 64 bits.
31383 @item -mcmodel=@var{which}
31384 @opindex mcmodel
31385 Set the code model to one of
31387 @table @samp
31388 @item medlow
31389 The Medium/Low code model: 64-bit addresses, programs
31390 must be linked in the low 32 bits of memory.  Programs can be statically
31391 or dynamically linked.
31393 @item medmid
31394 The Medium/Middle code model: 64-bit addresses, programs
31395 must be linked in the low 44 bits of memory, the text and data segments must
31396 be less than 2GB in size and the data segment must be located within 2GB of
31397 the text segment.
31399 @item medany
31400 The Medium/Anywhere code model: 64-bit addresses, programs
31401 may be linked anywhere in memory, the text and data segments must be less
31402 than 2GB in size and the data segment must be located within 2GB of the
31403 text segment.
31405 @item embmedany
31406 The Medium/Anywhere code model for embedded systems:
31407 64-bit addresses, the text and data segments must be less than 2GB in
31408 size, both starting anywhere in memory (determined at link time).  The
31409 global register %g4 points to the base of the data segment.  Programs
31410 are statically linked and PIC is not supported.
31411 @end table
31413 @item -mmemory-model=@var{mem-model}
31414 @opindex mmemory-model
31415 Set the memory model in force on the processor to one of
31417 @table @samp
31418 @item default
31419 The default memory model for the processor and operating system.
31421 @item rmo
31422 Relaxed Memory Order
31424 @item pso
31425 Partial Store Order
31427 @item tso
31428 Total Store Order
31430 @item sc
31431 Sequential Consistency
31432 @end table
31434 These memory models are formally defined in Appendix D of the SPARC-V9
31435 architecture manual, as set in the processor's @code{PSTATE.MM} field.
31437 @item -mstack-bias
31438 @itemx -mno-stack-bias
31439 @opindex mstack-bias
31440 @opindex mno-stack-bias
31441 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
31442 frame pointer if present, are offset by @minus{}2047 which must be added back
31443 when making stack frame references.  This is the default in 64-bit mode.
31444 Otherwise, assume no such offset is present.
31445 @end table
31447 @node System V Options
31448 @subsection Options for System V
31450 These additional options are available on System V Release 4 for
31451 compatibility with other compilers on those systems:
31453 @table @gcctabopt
31454 @item -G
31455 @opindex G
31456 Create a shared object.
31457 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
31459 @item -Qy
31460 @opindex Qy
31461 Identify the versions of each tool used by the compiler, in a
31462 @code{.ident} assembler directive in the output.
31464 @item -Qn
31465 @opindex Qn
31466 Refrain from adding @code{.ident} directives to the output file (this is
31467 the default).
31469 @item -YP,@var{dirs}
31470 @opindex YP
31471 Search the directories @var{dirs}, and no others, for libraries
31472 specified with @option{-l}.
31474 @item -Ym,@var{dir}
31475 @opindex Ym
31476 Look in the directory @var{dir} to find the M4 preprocessor.
31477 The assembler uses this option.
31478 @c This is supposed to go with a -Yd for predefined M4 macro files, but
31479 @c the generic assembler that comes with Solaris takes just -Ym.
31480 @end table
31482 @node V850 Options
31483 @subsection V850 Options
31484 @cindex V850 Options
31486 These @samp{-m} options are defined for V850 implementations:
31488 @table @gcctabopt
31489 @item -mlong-calls
31490 @itemx -mno-long-calls
31491 @opindex mlong-calls
31492 @opindex mno-long-calls
31493 Treat all calls as being far away (near).  If calls are assumed to be
31494 far away, the compiler always loads the function's address into a
31495 register, and calls indirect through the pointer.
31497 @item -mno-ep
31498 @itemx -mep
31499 @opindex mno-ep
31500 @opindex mep
31501 Do not optimize (do optimize) basic blocks that use the same index
31502 pointer 4 or more times to copy pointer into the @code{ep} register, and
31503 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
31504 option is on by default if you optimize.
31506 @item -mno-prolog-function
31507 @itemx -mprolog-function
31508 @opindex mno-prolog-function
31509 @opindex mprolog-function
31510 Do not use (do use) external functions to save and restore registers
31511 at the prologue and epilogue of a function.  The external functions
31512 are slower, but use less code space if more than one function saves
31513 the same number of registers.  The @option{-mprolog-function} option
31514 is on by default if you optimize.
31516 @item -mspace
31517 @opindex mspace
31518 Try to make the code as small as possible.  At present, this just turns
31519 on the @option{-mep} and @option{-mprolog-function} options.
31521 @item -mtda=@var{n}
31522 @opindex mtda
31523 Put static or global variables whose size is @var{n} bytes or less into
31524 the tiny data area that register @code{ep} points to.  The tiny data
31525 area can hold up to 256 bytes in total (128 bytes for byte references).
31527 @item -msda=@var{n}
31528 @opindex msda
31529 Put static or global variables whose size is @var{n} bytes or less into
31530 the small data area that register @code{gp} points to.  The small data
31531 area can hold up to 64 kilobytes.
31533 @item -mzda=@var{n}
31534 @opindex mzda
31535 Put static or global variables whose size is @var{n} bytes or less into
31536 the first 32 kilobytes of memory.
31538 @item -mv850
31539 @opindex mv850
31540 Specify that the target processor is the V850.
31542 @item -mv850e3v5
31543 @opindex mv850e3v5
31544 Specify that the target processor is the V850E3V5.  The preprocessor
31545 constant @code{__v850e3v5__} is defined if this option is used.
31547 @item -mv850e2v4
31548 @opindex mv850e2v4
31549 Specify that the target processor is the V850E3V5.  This is an alias for
31550 the @option{-mv850e3v5} option.
31552 @item -mv850e2v3
31553 @opindex mv850e2v3
31554 Specify that the target processor is the V850E2V3.  The preprocessor
31555 constant @code{__v850e2v3__} is defined if this option is used.
31557 @item -mv850e2
31558 @opindex mv850e2
31559 Specify that the target processor is the V850E2.  The preprocessor
31560 constant @code{__v850e2__} is defined if this option is used.
31562 @item -mv850e1
31563 @opindex mv850e1
31564 Specify that the target processor is the V850E1.  The preprocessor
31565 constants @code{__v850e1__} and @code{__v850e__} are defined if
31566 this option is used.
31568 @item -mv850es
31569 @opindex mv850es
31570 Specify that the target processor is the V850ES.  This is an alias for
31571 the @option{-mv850e1} option.
31573 @item -mv850e
31574 @opindex mv850e
31575 Specify that the target processor is the V850E@.  The preprocessor
31576 constant @code{__v850e__} is defined if this option is used.
31578 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
31579 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
31580 are defined then a default target processor is chosen and the
31581 relevant @samp{__v850*__} preprocessor constant is defined.
31583 The preprocessor constants @code{__v850} and @code{__v851__} are always
31584 defined, regardless of which processor variant is the target.
31586 @item -mdisable-callt
31587 @itemx -mno-disable-callt
31588 @opindex mdisable-callt
31589 @opindex mno-disable-callt
31590 This option suppresses generation of the @code{CALLT} instruction for the
31591 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
31592 architecture.
31594 This option is enabled by default when the RH850 ABI is
31595 in use (see @option{-mrh850-abi}), and disabled by default when the
31596 GCC ABI is in use.  If @code{CALLT} instructions are being generated
31597 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
31599 @item -mrelax
31600 @itemx -mno-relax
31601 @opindex mrelax
31602 @opindex mno-relax
31603 Pass on (or do not pass on) the @option{-mrelax} command-line option
31604 to the assembler.
31606 @item -mlong-jumps
31607 @itemx -mno-long-jumps
31608 @opindex mlong-jumps
31609 @opindex mno-long-jumps
31610 Disable (or re-enable) the generation of PC-relative jump instructions.
31612 @item -msoft-float
31613 @itemx -mhard-float
31614 @opindex msoft-float
31615 @opindex mhard-float
31616 Disable (or re-enable) the generation of hardware floating point
31617 instructions.  This option is only significant when the target
31618 architecture is @samp{V850E2V3} or higher.  If hardware floating point
31619 instructions are being generated then the C preprocessor symbol
31620 @code{__FPU_OK__} is defined, otherwise the symbol
31621 @code{__NO_FPU__} is defined.
31623 @item -mloop
31624 @opindex mloop
31625 Enables the use of the e3v5 LOOP instruction.  The use of this
31626 instruction is not enabled by default when the e3v5 architecture is
31627 selected because its use is still experimental.
31629 @item -mrh850-abi
31630 @itemx -mghs
31631 @opindex mrh850-abi
31632 @opindex mghs
31633 Enables support for the RH850 version of the V850 ABI.  This is the
31634 default.  With this version of the ABI the following rules apply:
31636 @itemize
31637 @item
31638 Integer sized structures and unions are returned via a memory pointer
31639 rather than a register.
31641 @item
31642 Large structures and unions (more than 8 bytes in size) are passed by
31643 value.
31645 @item
31646 Functions are aligned to 16-bit boundaries.
31648 @item
31649 The @option{-m8byte-align} command-line option is supported.
31651 @item
31652 The @option{-mdisable-callt} command-line option is enabled by
31653 default.  The @option{-mno-disable-callt} command-line option is not
31654 supported.
31655 @end itemize
31657 When this version of the ABI is enabled the C preprocessor symbol
31658 @code{__V850_RH850_ABI__} is defined.
31660 @item -mgcc-abi
31661 @opindex mgcc-abi
31662 Enables support for the old GCC version of the V850 ABI.  With this
31663 version of the ABI the following rules apply:
31665 @itemize
31666 @item
31667 Integer sized structures and unions are returned in register @code{r10}.
31669 @item
31670 Large structures and unions (more than 8 bytes in size) are passed by
31671 reference.
31673 @item
31674 Functions are aligned to 32-bit boundaries, unless optimizing for
31675 size.
31677 @item
31678 The @option{-m8byte-align} command-line option is not supported.
31680 @item
31681 The @option{-mdisable-callt} command-line option is supported but not
31682 enabled by default.
31683 @end itemize
31685 When this version of the ABI is enabled the C preprocessor symbol
31686 @code{__V850_GCC_ABI__} is defined.
31688 @item -m8byte-align
31689 @itemx -mno-8byte-align
31690 @opindex m8byte-align
31691 @opindex mno-8byte-align
31692 Enables support for @code{double} and @code{long long} types to be
31693 aligned on 8-byte boundaries.  The default is to restrict the
31694 alignment of all objects to at most 4-bytes.  When
31695 @option{-m8byte-align} is in effect the C preprocessor symbol
31696 @code{__V850_8BYTE_ALIGN__} is defined.
31698 @item -mbig-switch
31699 @opindex mbig-switch
31700 Generate code suitable for big switch tables.  Use this option only if
31701 the assembler/linker complain about out of range branches within a switch
31702 table.
31704 @item -mapp-regs
31705 @opindex mapp-regs
31706 This option causes r2 and r5 to be used in the code generated by
31707 the compiler.  This setting is the default.
31709 @item -mno-app-regs
31710 @opindex mno-app-regs
31711 This option causes r2 and r5 to be treated as fixed registers.
31713 @end table
31715 @node VAX Options
31716 @subsection VAX Options
31717 @cindex VAX options
31719 These @samp{-m} options are defined for the VAX:
31721 @table @gcctabopt
31722 @item -munix
31723 @opindex munix
31724 Do not output certain jump instructions (@code{aobleq} and so on)
31725 that the Unix assembler for the VAX cannot handle across long
31726 ranges.
31728 @item -mgnu
31729 @opindex mgnu
31730 Do output those jump instructions, on the assumption that the
31731 GNU assembler is being used.
31733 @item -mg
31734 @opindex mg
31735 Output code for G-format floating-point numbers instead of D-format.
31737 @item -mlra
31738 @itemx -mno-lra
31739 @opindex mlra
31740 @opindex mno-lra
31741 Enable Local Register Allocation.  This is still experimental for the VAX,
31742 so by default the compiler uses standard reload.
31743 @end table
31745 @node Visium Options
31746 @subsection Visium Options
31747 @cindex Visium options
31749 @table @gcctabopt
31751 @item -mdebug
31752 @opindex mdebug
31753 A program which performs file I/O and is destined to run on an MCM target
31754 should be linked with this option.  It causes the libraries libc.a and
31755 libdebug.a to be linked.  The program should be run on the target under
31756 the control of the GDB remote debugging stub.
31758 @item -msim
31759 @opindex msim
31760 A program which performs file I/O and is destined to run on the simulator
31761 should be linked with option.  This causes libraries libc.a and libsim.a to
31762 be linked.
31764 @item -mfpu
31765 @itemx -mhard-float
31766 @opindex mfpu
31767 @opindex mhard-float
31768 Generate code containing floating-point instructions.  This is the
31769 default.
31771 @item -mno-fpu
31772 @itemx -msoft-float
31773 @opindex mno-fpu
31774 @opindex msoft-float
31775 Generate code containing library calls for floating-point.
31777 @option{-msoft-float} changes the calling convention in the output file;
31778 therefore, it is only useful if you compile @emph{all} of a program with
31779 this option.  In particular, you need to compile @file{libgcc.a}, the
31780 library that comes with GCC, with @option{-msoft-float} in order for
31781 this to work.
31783 @item -mcpu=@var{cpu_type}
31784 @opindex mcpu
31785 Set the instruction set, register set, and instruction scheduling parameters
31786 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
31787 @samp{mcm}, @samp{gr5} and @samp{gr6}.
31789 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
31791 By default (unless configured otherwise), GCC generates code for the GR5
31792 variant of the Visium architecture.  
31794 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
31795 architecture.  The only difference from GR5 code is that the compiler will
31796 generate block move instructions.
31798 @item -mtune=@var{cpu_type}
31799 @opindex mtune
31800 Set the instruction scheduling parameters for machine type @var{cpu_type},
31801 but do not set the instruction set or register set that the option
31802 @option{-mcpu=@var{cpu_type}} would.
31804 @item -msv-mode
31805 @opindex msv-mode
31806 Generate code for the supervisor mode, where there are no restrictions on
31807 the access to general registers.  This is the default.
31809 @item -muser-mode
31810 @opindex muser-mode
31811 Generate code for the user mode, where the access to some general registers
31812 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
31813 mode; on the GR6, only registers r29 to r31 are affected.
31814 @end table
31816 @node VMS Options
31817 @subsection VMS Options
31819 These @samp{-m} options are defined for the VMS implementations:
31821 @table @gcctabopt
31822 @item -mvms-return-codes
31823 @opindex mvms-return-codes
31824 Return VMS condition codes from @code{main}. The default is to return POSIX-style
31825 condition (e.g.@: error) codes.
31827 @item -mdebug-main=@var{prefix}
31828 @opindex mdebug-main=@var{prefix}
31829 Flag the first routine whose name starts with @var{prefix} as the main
31830 routine for the debugger.
31832 @item -mmalloc64
31833 @opindex mmalloc64
31834 Default to 64-bit memory allocation routines.
31836 @item -mpointer-size=@var{size}
31837 @opindex mpointer-size=@var{size}
31838 Set the default size of pointers. Possible options for @var{size} are
31839 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
31840 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
31841 The later option disables @code{pragma pointer_size}.
31842 @end table
31844 @node VxWorks Options
31845 @subsection VxWorks Options
31846 @cindex VxWorks Options
31848 The options in this section are defined for all VxWorks targets.
31849 Options specific to the target hardware are listed with the other
31850 options for that target.
31852 @table @gcctabopt
31853 @item -mrtp
31854 @opindex mrtp
31855 GCC can generate code for both VxWorks kernels and real time processes
31856 (RTPs).  This option switches from the former to the latter.  It also
31857 defines the preprocessor macro @code{__RTP__}.
31859 @item -non-static
31860 @opindex non-static
31861 Link an RTP executable against shared libraries rather than static
31862 libraries.  The options @option{-static} and @option{-shared} can
31863 also be used for RTPs (@pxref{Link Options}); @option{-static}
31864 is the default.
31866 @item -Bstatic
31867 @itemx -Bdynamic
31868 @opindex Bstatic
31869 @opindex Bdynamic
31870 These options are passed down to the linker.  They are defined for
31871 compatibility with Diab.
31873 @item -Xbind-lazy
31874 @opindex Xbind-lazy
31875 Enable lazy binding of function calls.  This option is equivalent to
31876 @option{-Wl,-z,now} and is defined for compatibility with Diab.
31878 @item -Xbind-now
31879 @opindex Xbind-now
31880 Disable lazy binding of function calls.  This option is the default and
31881 is defined for compatibility with Diab.
31882 @end table
31884 @node x86 Options
31885 @subsection x86 Options
31886 @cindex x86 Options
31888 These @samp{-m} options are defined for the x86 family of computers.
31890 @table @gcctabopt
31892 @item -march=@var{cpu-type}
31893 @opindex march
31894 Generate instructions for the machine type @var{cpu-type}.  In contrast to
31895 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
31896 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
31897 to generate code that may not run at all on processors other than the one
31898 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
31899 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
31901 The choices for @var{cpu-type} are:
31903 @table @samp
31904 @item native
31905 This selects the CPU to generate code for at compilation time by determining
31906 the processor type of the compiling machine.  Using @option{-march=native}
31907 enables all instruction subsets supported by the local machine (hence
31908 the result might not run on different machines).  Using @option{-mtune=native}
31909 produces code optimized for the local machine under the constraints
31910 of the selected instruction set.  
31912 @item x86-64
31913 A generic CPU with 64-bit extensions.
31915 @item x86-64-v2
31916 @itemx x86-64-v3
31917 @itemx x86-64-v4
31918 These choices for @var{cpu-type} select the corresponding
31919 micro-architecture level from the x86-64 psABI.  On ABIs other than
31920 the x86-64 psABI they select the same CPU features as the x86-64 psABI
31921 documents for the particular micro-architecture level.
31923 Since these @var{cpu-type} values do not have a corresponding
31924 @option{-mtune} setting, using @option{-march} with these values enables
31925 generic tuning.  Specific tuning can be enabled using the
31926 @option{-mtune=@var{other-cpu-type}} option with an appropriate
31927 @var{other-cpu-type} value.
31929 @item i386
31930 Original Intel i386 CPU@.
31932 @item i486
31933 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
31935 @item i586
31936 @itemx pentium
31937 Intel Pentium CPU with no MMX support.
31939 @item lakemont
31940 Intel Lakemont MCU, based on Intel Pentium CPU.
31942 @item pentium-mmx
31943 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
31945 @item pentiumpro
31946 Intel Pentium Pro CPU@.
31948 @item i686
31949 When used with @option{-march}, the Pentium Pro
31950 instruction set is used, so the code runs on all i686 family chips.
31951 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
31953 @item pentium2
31954 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
31955 set support.
31957 @item pentium3
31958 @itemx pentium3m
31959 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
31960 instruction set support.
31962 @item pentium-m
31963 Intel Pentium M; low-power version of Intel Pentium III CPU
31964 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
31965 notebooks.
31967 @item pentium4
31968 @itemx pentium4m
31969 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
31971 @item prescott
31972 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
31973 instruction set support.
31975 @item nocona
31976 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
31977 SSE2, SSE3 and FXSR instruction set support.
31979 @item core2
31980 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
31981 SAHF and FXSR instruction set support.
31983 @item nehalem
31984 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
31985 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
31987 @item westmere
31988 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
31989 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
31991 @item sandybridge
31992 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
31993 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
31994 support.
31996 @item ivybridge
31997 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
31998 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
31999 and F16C instruction set support.
32001 @item haswell
32002 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32003 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32004 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32006 @item broadwell
32007 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32008 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32009 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32010 instruction set support.
32012 @item skylake
32013 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32014 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32015 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32016 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32018 @item bonnell
32019 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32020 instruction set support.
32022 @item silvermont
32023 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32024 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32025 instruction set support.
32027 @item goldmont
32028 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32029 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32030 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32031 set support.
32033 @item goldmont-plus
32034 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32035 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32036 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32037 RDPID and SGX instruction set support.
32039 @item tremont
32040 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32041 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32042 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32043 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32044 support.
32046 @item knl
32047 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32048 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32049 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32050 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
32052 @item knm
32053 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32054 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32055 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32056 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
32057 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
32059 @item skylake-avx512
32060 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32061 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32062 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32063 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
32064 AVX512DQ and AVX512CD instruction set support.
32066 @item cannonlake
32067 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
32068 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
32069 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
32070 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
32071 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
32072 support.
32074 @item icelake-client
32075 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32076 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32077 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32078 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32079 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32080 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32082 @item icelake-server
32083 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32084 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32085 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32086 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32087 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32088 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
32089 instruction set support.
32091 @item cascadelake
32092 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32093 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32094 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32095 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32096 AVX512CD and AVX512VNNI instruction set support.
32098 @item cooperlake
32099 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32100 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32101 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32102 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32103 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
32105 @item tigerlake
32106 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32107 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32108 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32109 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32110 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32111 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
32112 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
32114 @item sapphirerapids
32115 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32116 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32117 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32118 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32119 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32120 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32121 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32122 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16 and AVX512BF16
32123 instruction set support.
32125 @item alderlake
32126 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32127 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
32128 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
32129 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
32130 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
32131 support.
32133 @item rocketlake
32134 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
32135 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32136 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32137 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32138 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32139 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32141 @item k6
32142 AMD K6 CPU with MMX instruction set support.
32144 @item k6-2
32145 @itemx k6-3
32146 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
32148 @item athlon
32149 @itemx athlon-tbird
32150 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
32151 support.
32153 @item athlon-4
32154 @itemx athlon-xp
32155 @itemx athlon-mp
32156 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
32157 instruction set support.
32159 @item k8
32160 @itemx opteron
32161 @itemx athlon64
32162 @itemx athlon-fx
32163 Processors based on the AMD K8 core with x86-64 instruction set support,
32164 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
32165 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
32166 instruction set extensions.)
32168 @item k8-sse3
32169 @itemx opteron-sse3
32170 @itemx athlon64-sse3
32171 Improved versions of AMD K8 cores with SSE3 instruction set support.
32173 @item amdfam10
32174 @itemx barcelona
32175 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
32176 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
32177 instruction set extensions.)
32179 @item bdver1
32180 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
32181 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
32182 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
32184 @item bdver2
32185 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32186 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
32187 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
32188 extensions.)
32190 @item bdver3
32191 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32192 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
32193 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
32194 64-bit instruction set extensions.)
32196 @item bdver4
32197 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32198 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
32199 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
32200 SSE4.2, ABM and 64-bit instruction set extensions.)
32202 @item znver1
32203 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
32204 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
32205 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
32206 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
32207 instruction set extensions.)
32209 @item znver2
32210 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32211 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32212 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32213 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32214 WBNOINVD, and 64-bit instruction set extensions.)
32216 @item znver3
32217 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32218 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32219 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32220 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32221 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
32223 @item znver4
32224 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32225 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32226 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32227 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32228 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
32229 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
32230 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
32232 @item btver1
32233 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
32234 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
32235 instruction set extensions.)
32237 @item btver2
32238 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
32239 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
32240 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
32242 @item winchip-c6
32243 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
32244 set support.
32246 @item winchip2
32247 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
32248 instruction set support.
32250 @item c3
32251 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
32252 (No scheduling is implemented for this chip.)
32254 @item c3-2
32255 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
32256 (No scheduling is implemented for this chip.)
32258 @item c7
32259 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32260 (No scheduling is implemented for this chip.)
32262 @item samuel-2
32263 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
32264 (No scheduling is implemented for this chip.)
32266 @item nehemiah
32267 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
32268 (No scheduling is implemented for this chip.)
32270 @item esther
32271 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32272 (No scheduling is implemented for this chip.)
32274 @item eden-x2
32275 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
32276 (No scheduling is implemented for this chip.)
32278 @item eden-x4
32279 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
32280 AVX and AVX2 instruction set support.
32281 (No scheduling is implemented for this chip.)
32283 @item nano
32284 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32285 instruction set support.
32286 (No scheduling is implemented for this chip.)
32288 @item nano-1000
32289 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32290 instruction set support.
32291 (No scheduling is implemented for this chip.)
32293 @item nano-2000
32294 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32295 instruction set support.
32296 (No scheduling is implemented for this chip.)
32298 @item nano-3000
32299 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32300 instruction set support.
32301 (No scheduling is implemented for this chip.)
32303 @item nano-x2
32304 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32305 instruction set support.
32306 (No scheduling is implemented for this chip.)
32308 @item nano-x4
32309 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32310 instruction set support.
32311 (No scheduling is implemented for this chip.)
32313 @item lujiazui
32314 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
32315 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
32316 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
32318 @item geode
32319 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
32320 @end table
32322 @item -mtune=@var{cpu-type}
32323 @opindex mtune
32324 Tune to @var{cpu-type} everything applicable about the generated code, except
32325 for the ABI and the set of available instructions.  
32326 While picking a specific @var{cpu-type} schedules things appropriately
32327 for that particular chip, the compiler does not generate any code that
32328 cannot run on the default machine type unless you use a
32329 @option{-march=@var{cpu-type}} option.
32330 For example, if GCC is configured for i686-pc-linux-gnu
32331 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
32332 but still runs on i686 machines.
32334 The choices for @var{cpu-type} are the same as for @option{-march}.
32335 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
32337 @table @samp
32338 @item generic
32339 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
32340 If you know the CPU on which your code will run, then you should use
32341 the corresponding @option{-mtune} or @option{-march} option instead of
32342 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
32343 of your application will have, then you should use this option.
32345 As new processors are deployed in the marketplace, the behavior of this
32346 option will change.  Therefore, if you upgrade to a newer version of
32347 GCC, code generation controlled by this option will change to reflect
32348 the processors
32349 that are most common at the time that version of GCC is released.
32351 There is no @option{-march=generic} option because @option{-march}
32352 indicates the instruction set the compiler can use, and there is no
32353 generic instruction set applicable to all processors.  In contrast,
32354 @option{-mtune} indicates the processor (or, in this case, collection of
32355 processors) for which the code is optimized.
32357 @item intel
32358 Produce code optimized for the most current Intel processors, which are
32359 Haswell and Silvermont for this version of GCC.  If you know the CPU
32360 on which your code will run, then you should use the corresponding
32361 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
32362 But, if you want your application performs better on both Haswell and
32363 Silvermont, then you should use this option.
32365 As new Intel processors are deployed in the marketplace, the behavior of
32366 this option will change.  Therefore, if you upgrade to a newer version of
32367 GCC, code generation controlled by this option will change to reflect
32368 the most current Intel processors at the time that version of GCC is
32369 released.
32371 There is no @option{-march=intel} option because @option{-march} indicates
32372 the instruction set the compiler can use, and there is no common
32373 instruction set applicable to all processors.  In contrast,
32374 @option{-mtune} indicates the processor (or, in this case, collection of
32375 processors) for which the code is optimized.
32376 @end table
32378 @item -mcpu=@var{cpu-type}
32379 @opindex mcpu
32380 A deprecated synonym for @option{-mtune}.
32382 @item -mfpmath=@var{unit}
32383 @opindex mfpmath
32384 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
32385 for @var{unit} are:
32387 @table @samp
32388 @item 387
32389 Use the standard 387 floating-point coprocessor present on the majority of chips and
32390 emulated otherwise.  Code compiled with this option runs almost everywhere.
32391 The temporary results are computed in 80-bit precision instead of the precision
32392 specified by the type, resulting in slightly different results compared to most
32393 of other chips.  See @option{-ffloat-store} for more detailed description.
32395 This is the default choice for non-Darwin x86-32 targets.
32397 @item sse
32398 Use scalar floating-point instructions present in the SSE instruction set.
32399 This instruction set is supported by Pentium III and newer chips,
32400 and in the AMD line
32401 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
32402 instruction set supports only single-precision arithmetic, thus the double and
32403 extended-precision arithmetic are still done using 387.  A later version, present
32404 only in Pentium 4 and AMD x86-64 chips, supports double-precision
32405 arithmetic too.
32407 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
32408 or @option{-msse2} switches to enable SSE extensions and make this option
32409 effective.  For the x86-64 compiler, these extensions are enabled by default.
32411 The resulting code should be considerably faster in the majority of cases and avoid
32412 the numerical instability problems of 387 code, but may break some existing
32413 code that expects temporaries to be 80 bits.
32415 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
32416 and the default choice for x86-32 targets with the SSE2 instruction set
32417 when @option{-ffast-math} is enabled.
32419 @item sse,387
32420 @itemx sse+387
32421 @itemx both
32422 Attempt to utilize both instruction sets at once.  This effectively doubles the
32423 amount of available registers, and on chips with separate execution units for
32424 387 and SSE the execution resources too.  Use this option with care, as it is
32425 still experimental, because the GCC register allocator does not model separate
32426 functional units well, resulting in unstable performance.
32427 @end table
32429 @item -masm=@var{dialect}
32430 @opindex masm=@var{dialect}
32431 Output assembly instructions using selected @var{dialect}.  Also affects
32432 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
32433 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
32434 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
32435 not support @samp{intel}.
32437 @item -mieee-fp
32438 @itemx -mno-ieee-fp
32439 @opindex mieee-fp
32440 @opindex mno-ieee-fp
32441 Control whether or not the compiler uses IEEE floating-point
32442 comparisons.  These correctly handle the case where the result of a
32443 comparison is unordered.
32445 @item -m80387
32446 @itemx -mhard-float
32447 @opindex 80387
32448 @opindex mhard-float
32449 Generate output containing 80387 instructions for floating point.
32451 @item -mno-80387
32452 @itemx -msoft-float
32453 @opindex no-80387
32454 @opindex msoft-float
32455 Generate output containing library calls for floating point.
32457 @strong{Warning:} the requisite libraries are not part of GCC@.
32458 Normally the facilities of the machine's usual C compiler are used, but
32459 this cannot be done directly in cross-compilation.  You must make your
32460 own arrangements to provide suitable library functions for
32461 cross-compilation.
32463 On machines where a function returns floating-point results in the 80387
32464 register stack, some floating-point opcodes may be emitted even if
32465 @option{-msoft-float} is used.
32467 @item -mno-fp-ret-in-387
32468 @opindex mno-fp-ret-in-387
32469 @opindex mfp-ret-in-387
32470 Do not use the FPU registers for return values of functions.
32472 The usual calling convention has functions return values of types
32473 @code{float} and @code{double} in an FPU register, even if there
32474 is no FPU@.  The idea is that the operating system should emulate
32475 an FPU@.
32477 The option @option{-mno-fp-ret-in-387} causes such values to be returned
32478 in ordinary CPU registers instead.
32480 @item -mno-fancy-math-387
32481 @opindex mno-fancy-math-387
32482 @opindex mfancy-math-387
32483 Some 387 emulators do not support the @code{sin}, @code{cos} and
32484 @code{sqrt} instructions for the 387.  Specify this option to avoid
32485 generating those instructions.
32486 This option is overridden when @option{-march}
32487 indicates that the target CPU always has an FPU and so the
32488 instruction does not need emulation.  These
32489 instructions are not generated unless you also use the
32490 @option{-funsafe-math-optimizations} switch.
32492 @item -malign-double
32493 @itemx -mno-align-double
32494 @opindex malign-double
32495 @opindex mno-align-double
32496 Control whether GCC aligns @code{double}, @code{long double}, and
32497 @code{long long} variables on a two-word boundary or a one-word
32498 boundary.  Aligning @code{double} variables on a two-word boundary
32499 produces code that runs somewhat faster on a Pentium at the
32500 expense of more memory.
32502 On x86-64, @option{-malign-double} is enabled by default.
32504 @strong{Warning:} if you use the @option{-malign-double} switch,
32505 structures containing the above types are aligned differently than
32506 the published application binary interface specifications for the x86-32
32507 and are not binary compatible with structures in code compiled
32508 without that switch.
32510 @item -m96bit-long-double
32511 @itemx -m128bit-long-double
32512 @opindex m96bit-long-double
32513 @opindex m128bit-long-double
32514 These switches control the size of @code{long double} type.  The x86-32
32515 application binary interface specifies the size to be 96 bits,
32516 so @option{-m96bit-long-double} is the default in 32-bit mode.
32518 Modern architectures (Pentium and newer) prefer @code{long double}
32519 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
32520 conforming to the ABI, this is not possible.  So specifying
32521 @option{-m128bit-long-double} aligns @code{long double}
32522 to a 16-byte boundary by padding the @code{long double} with an additional
32523 32-bit zero.
32525 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
32526 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
32528 Notice that neither of these options enable any extra precision over the x87
32529 standard of 80 bits for a @code{long double}.
32531 @strong{Warning:} if you override the default value for your target ABI, this
32532 changes the size of 
32533 structures and arrays containing @code{long double} variables,
32534 as well as modifying the function calling convention for functions taking
32535 @code{long double}.  Hence they are not binary-compatible
32536 with code compiled without that switch.
32538 @item -mlong-double-64
32539 @itemx -mlong-double-80
32540 @itemx -mlong-double-128
32541 @opindex mlong-double-64
32542 @opindex mlong-double-80
32543 @opindex mlong-double-128
32544 These switches control the size of @code{long double} type. A size
32545 of 64 bits makes the @code{long double} type equivalent to the @code{double}
32546 type. This is the default for 32-bit Bionic C library.  A size
32547 of 128 bits makes the @code{long double} type equivalent to the
32548 @code{__float128} type. This is the default for 64-bit Bionic C library.
32550 @strong{Warning:} if you override the default value for your target ABI, this
32551 changes the size of
32552 structures and arrays containing @code{long double} variables,
32553 as well as modifying the function calling convention for functions taking
32554 @code{long double}.  Hence they are not binary-compatible
32555 with code compiled without that switch.
32557 @item -malign-data=@var{type}
32558 @opindex malign-data
32559 Control how GCC aligns variables.  Supported values for @var{type} are
32560 @samp{compat} uses increased alignment value compatible uses GCC 4.8
32561 and earlier, @samp{abi} uses alignment value as specified by the
32562 psABI, and @samp{cacheline} uses increased alignment value to match
32563 the cache line size.  @samp{compat} is the default.
32565 @item -mlarge-data-threshold=@var{threshold}
32566 @opindex mlarge-data-threshold
32567 When @option{-mcmodel=medium} is specified, data objects larger than
32568 @var{threshold} are placed in the large data section.  This value must be the
32569 same across all objects linked into the binary, and defaults to 65535.
32571 @item -mrtd
32572 @opindex mrtd
32573 Use a different function-calling convention, in which functions that
32574 take a fixed number of arguments return with the @code{ret @var{num}}
32575 instruction, which pops their arguments while returning.  This saves one
32576 instruction in the caller since there is no need to pop the arguments
32577 there.
32579 You can specify that an individual function is called with this calling
32580 sequence with the function attribute @code{stdcall}.  You can also
32581 override the @option{-mrtd} option by using the function attribute
32582 @code{cdecl}.  @xref{Function Attributes}.
32584 @strong{Warning:} this calling convention is incompatible with the one
32585 normally used on Unix, so you cannot use it if you need to call
32586 libraries compiled with the Unix compiler.
32588 Also, you must provide function prototypes for all functions that
32589 take variable numbers of arguments (including @code{printf});
32590 otherwise incorrect code is generated for calls to those
32591 functions.
32593 In addition, seriously incorrect code results if you call a
32594 function with too many arguments.  (Normally, extra arguments are
32595 harmlessly ignored.)
32597 @item -mregparm=@var{num}
32598 @opindex mregparm
32599 Control how many registers are used to pass integer arguments.  By
32600 default, no registers are used to pass arguments, and at most 3
32601 registers can be used.  You can control this behavior for a specific
32602 function by using the function attribute @code{regparm}.
32603 @xref{Function Attributes}.
32605 @strong{Warning:} if you use this switch, and
32606 @var{num} is nonzero, then you must build all modules with the same
32607 value, including any libraries.  This includes the system libraries and
32608 startup modules.
32610 @item -msseregparm
32611 @opindex msseregparm
32612 Use SSE register passing conventions for float and double arguments
32613 and return values.  You can control this behavior for a specific
32614 function by using the function attribute @code{sseregparm}.
32615 @xref{Function Attributes}.
32617 @strong{Warning:} if you use this switch then you must build all
32618 modules with the same value, including any libraries.  This includes
32619 the system libraries and startup modules.
32621 @item -mvect8-ret-in-mem
32622 @opindex mvect8-ret-in-mem
32623 Return 8-byte vectors in memory instead of MMX registers.  This is the
32624 default on VxWorks to match the ABI of the Sun Studio compilers until
32625 version 12.  @emph{Only} use this option if you need to remain
32626 compatible with existing code produced by those previous compiler
32627 versions or older versions of GCC@.
32629 @item -mpc32
32630 @itemx -mpc64
32631 @itemx -mpc80
32632 @opindex mpc32
32633 @opindex mpc64
32634 @opindex mpc80
32636 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
32637 is specified, the significands of results of floating-point operations are
32638 rounded to 24 bits (single precision); @option{-mpc64} rounds the
32639 significands of results of floating-point operations to 53 bits (double
32640 precision) and @option{-mpc80} rounds the significands of results of
32641 floating-point operations to 64 bits (extended double precision), which is
32642 the default.  When this option is used, floating-point operations in higher
32643 precisions are not available to the programmer without setting the FPU
32644 control word explicitly.
32646 Setting the rounding of floating-point operations to less than the default
32647 80 bits can speed some programs by 2% or more.  Note that some mathematical
32648 libraries assume that extended-precision (80-bit) floating-point operations
32649 are enabled by default; routines in such libraries could suffer significant
32650 loss of accuracy, typically through so-called ``catastrophic cancellation'',
32651 when this option is used to set the precision to less than extended precision.
32653 @item -mstackrealign
32654 @opindex mstackrealign
32655 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
32656 option generates an alternate prologue and epilogue that realigns the
32657 run-time stack if necessary.  This supports mixing legacy codes that keep
32658 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
32659 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
32660 applicable to individual functions.
32662 @item -mpreferred-stack-boundary=@var{num}
32663 @opindex mpreferred-stack-boundary
32664 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
32665 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
32666 the default is 4 (16 bytes or 128 bits).
32668 @strong{Warning:} When generating code for the x86-64 architecture with
32669 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
32670 used to keep the stack boundary aligned to 8 byte boundary.  Since
32671 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
32672 intended to be used in controlled environment where stack space is
32673 important limitation.  This option leads to wrong code when functions
32674 compiled with 16 byte stack alignment (such as functions from a standard
32675 library) are called with misaligned stack.  In this case, SSE
32676 instructions may lead to misaligned memory access traps.  In addition,
32677 variable arguments are handled incorrectly for 16 byte aligned
32678 objects (including x87 long double and __int128), leading to wrong
32679 results.  You must build all modules with
32680 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
32681 includes the system libraries and startup modules.
32683 @item -mincoming-stack-boundary=@var{num}
32684 @opindex mincoming-stack-boundary
32685 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
32686 boundary.  If @option{-mincoming-stack-boundary} is not specified,
32687 the one specified by @option{-mpreferred-stack-boundary} is used.
32689 On Pentium and Pentium Pro, @code{double} and @code{long double} values
32690 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
32691 suffer significant run time performance penalties.  On Pentium III, the
32692 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
32693 properly if it is not 16-byte aligned.
32695 To ensure proper alignment of this values on the stack, the stack boundary
32696 must be as aligned as that required by any value stored on the stack.
32697 Further, every function must be generated such that it keeps the stack
32698 aligned.  Thus calling a function compiled with a higher preferred
32699 stack boundary from a function compiled with a lower preferred stack
32700 boundary most likely misaligns the stack.  It is recommended that
32701 libraries that use callbacks always use the default setting.
32703 This extra alignment does consume extra stack space, and generally
32704 increases code size.  Code that is sensitive to stack space usage, such
32705 as embedded systems and operating system kernels, may want to reduce the
32706 preferred alignment to @option{-mpreferred-stack-boundary=2}.
32708 @need 200
32709 @item -mmmx
32710 @opindex mmmx
32711 @need 200
32712 @itemx -msse
32713 @opindex msse
32714 @need 200
32715 @itemx -msse2
32716 @opindex msse2
32717 @need 200
32718 @itemx -msse3
32719 @opindex msse3
32720 @need 200
32721 @itemx -mssse3
32722 @opindex mssse3
32723 @need 200
32724 @itemx -msse4
32725 @opindex msse4
32726 @need 200
32727 @itemx -msse4a
32728 @opindex msse4a
32729 @need 200
32730 @itemx -msse4.1
32731 @opindex msse4.1
32732 @need 200
32733 @itemx -msse4.2
32734 @opindex msse4.2
32735 @need 200
32736 @itemx -mavx
32737 @opindex mavx
32738 @need 200
32739 @itemx -mavx2
32740 @opindex mavx2
32741 @need 200
32742 @itemx -mavx512f
32743 @opindex mavx512f
32744 @need 200
32745 @itemx -mavx512pf
32746 @opindex mavx512pf
32747 @need 200
32748 @itemx -mavx512er
32749 @opindex mavx512er
32750 @need 200
32751 @itemx -mavx512cd
32752 @opindex mavx512cd
32753 @need 200
32754 @itemx -mavx512vl
32755 @opindex mavx512vl
32756 @need 200
32757 @itemx -mavx512bw
32758 @opindex mavx512bw
32759 @need 200
32760 @itemx -mavx512dq
32761 @opindex mavx512dq
32762 @need 200
32763 @itemx -mavx512ifma
32764 @opindex mavx512ifma
32765 @need 200
32766 @itemx -mavx512vbmi
32767 @opindex mavx512vbmi
32768 @need 200
32769 @itemx -msha
32770 @opindex msha
32771 @need 200
32772 @itemx -maes
32773 @opindex maes
32774 @need 200
32775 @itemx -mpclmul
32776 @opindex mpclmul
32777 @need 200
32778 @itemx -mclflushopt
32779 @opindex mclflushopt
32780 @need 200
32781 @itemx -mclwb
32782 @opindex mclwb
32783 @need 200
32784 @itemx -mfsgsbase
32785 @opindex mfsgsbase
32786 @need 200
32787 @itemx -mptwrite
32788 @opindex mptwrite
32789 @need 200
32790 @itemx -mrdrnd
32791 @opindex mrdrnd
32792 @need 200
32793 @itemx -mf16c
32794 @opindex mf16c
32795 @need 200
32796 @itemx -mfma
32797 @opindex mfma
32798 @need 200
32799 @itemx -mpconfig
32800 @opindex mpconfig
32801 @need 200
32802 @itemx -mwbnoinvd
32803 @opindex mwbnoinvd
32804 @need 200
32805 @itemx -mfma4
32806 @opindex mfma4
32807 @need 200
32808 @itemx -mprfchw
32809 @opindex mprfchw
32810 @need 200
32811 @itemx -mrdpid
32812 @opindex mrdpid
32813 @need 200
32814 @itemx -mprefetchwt1
32815 @opindex mprefetchwt1
32816 @need 200
32817 @itemx -mrdseed
32818 @opindex mrdseed
32819 @need 200
32820 @itemx -msgx
32821 @opindex msgx
32822 @need 200
32823 @itemx -mxop
32824 @opindex mxop
32825 @need 200
32826 @itemx -mlwp
32827 @opindex mlwp
32828 @need 200
32829 @itemx -m3dnow
32830 @opindex m3dnow
32831 @need 200
32832 @itemx -m3dnowa
32833 @opindex m3dnowa
32834 @need 200
32835 @itemx -mpopcnt
32836 @opindex mpopcnt
32837 @need 200
32838 @itemx -mabm
32839 @opindex mabm
32840 @need 200
32841 @itemx -madx
32842 @opindex madx
32843 @need 200
32844 @itemx -mbmi
32845 @opindex mbmi
32846 @need 200
32847 @itemx -mbmi2
32848 @opindex mbmi2
32849 @need 200
32850 @itemx -mlzcnt
32851 @opindex mlzcnt
32852 @need 200
32853 @itemx -mfxsr
32854 @opindex mfxsr
32855 @need 200
32856 @itemx -mxsave
32857 @opindex mxsave
32858 @need 200
32859 @itemx -mxsaveopt
32860 @opindex mxsaveopt
32861 @need 200
32862 @itemx -mxsavec
32863 @opindex mxsavec
32864 @need 200
32865 @itemx -mxsaves
32866 @opindex mxsaves
32867 @need 200
32868 @itemx -mrtm
32869 @opindex mrtm
32870 @need 200
32871 @itemx -mhle
32872 @opindex mhle
32873 @need 200
32874 @itemx -mtbm
32875 @opindex mtbm
32876 @need 200
32877 @itemx -mmwaitx
32878 @opindex mmwaitx
32879 @need 200
32880 @itemx -mclzero
32881 @opindex mclzero
32882 @need 200
32883 @itemx -mpku
32884 @opindex mpku
32885 @need 200
32886 @itemx -mavx512vbmi2
32887 @opindex mavx512vbmi2
32888 @need 200
32889 @itemx -mavx512bf16
32890 @opindex mavx512bf16
32891 @need 200
32892 @itemx -mavx512fp16
32893 @opindex mavx512fp16
32894 @need 200
32895 @itemx -mgfni
32896 @opindex mgfni
32897 @need 200
32898 @itemx -mvaes
32899 @opindex mvaes
32900 @need 200
32901 @itemx -mwaitpkg
32902 @opindex mwaitpkg
32903 @need 200
32904 @itemx -mvpclmulqdq
32905 @opindex mvpclmulqdq
32906 @need 200
32907 @itemx -mavx512bitalg
32908 @opindex mavx512bitalg
32909 @need 200
32910 @itemx -mmovdiri
32911 @opindex mmovdiri
32912 @need 200
32913 @itemx -mmovdir64b
32914 @opindex mmovdir64b
32915 @need 200
32916 @itemx -menqcmd
32917 @opindex menqcmd
32918 @itemx -muintr
32919 @opindex muintr
32920 @need 200
32921 @itemx -mtsxldtrk
32922 @opindex mtsxldtrk
32923 @need 200
32924 @itemx -mavx512vpopcntdq
32925 @opindex mavx512vpopcntdq
32926 @need 200
32927 @itemx -mavx512vp2intersect
32928 @opindex mavx512vp2intersect
32929 @need 200
32930 @itemx -mavx5124fmaps
32931 @opindex mavx5124fmaps
32932 @need 200
32933 @itemx -mavx512vnni
32934 @opindex mavx512vnni
32935 @need 200
32936 @itemx -mavxvnni
32937 @opindex mavxvnni
32938 @need 200
32939 @itemx -mavx5124vnniw
32940 @opindex mavx5124vnniw
32941 @need 200
32942 @itemx -mcldemote
32943 @opindex mcldemote
32944 @need 200
32945 @itemx -mserialize
32946 @opindex mserialize
32947 @need 200
32948 @itemx -mamx-tile
32949 @opindex mamx-tile
32950 @need 200
32951 @itemx -mamx-int8
32952 @opindex mamx-int8
32953 @need 200
32954 @itemx -mamx-bf16
32955 @opindex mamx-bf16
32956 @need 200
32957 @itemx -mhreset
32958 @opindex mhreset
32959 @itemx -mkl
32960 @opindex mkl
32961 @need 200
32962 @itemx -mwidekl
32963 @opindex mwidekl
32964 @need 200
32965 @itemx -mavxifma
32966 @opindex mavxifma
32967 @need 200
32968 @itemx -mavxvnniint8
32969 @opindex mavxvnniint8
32970 @need 200
32971 @itemx -mavxneconvert
32972 @opindex mavxneconvert
32973 These switches enable the use of instructions in the MMX, SSE,
32974 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
32975 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
32976 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
32977 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
32978 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
32979 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
32980 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
32981 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
32982 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16,
32983 AVXIFMA, AVXVNNIINT8, AVXNECONVERT or CLDEMOTE extended instruction sets. Each
32984 has a corresponding @option{-mno-} option to disable use of these instructions.
32986 These extensions are also available as built-in functions: see
32987 @ref{x86 Built-in Functions}, for details of the functions enabled and
32988 disabled by these switches.
32990 To generate SSE/SSE2 instructions automatically from floating-point
32991 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
32993 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
32994 generates new AVX instructions or AVX equivalence for all SSEx instructions
32995 when needed.
32997 These options enable GCC to use these extended instructions in
32998 generated code, even without @option{-mfpmath=sse}.  Applications that
32999 perform run-time CPU detection must compile separate files for each
33000 supported architecture, using the appropriate flags.  In particular,
33001 the file containing the CPU detection code should be compiled without
33002 these options.
33004 @item -mdump-tune-features
33005 @opindex mdump-tune-features
33006 This option instructs GCC to dump the names of the x86 performance 
33007 tuning features and default settings. The names can be used in 
33008 @option{-mtune-ctrl=@var{feature-list}}.
33010 @item -mtune-ctrl=@var{feature-list}
33011 @opindex mtune-ctrl=@var{feature-list}
33012 This option is used to do fine grain control of x86 code generation features.
33013 @var{feature-list} is a comma separated list of @var{feature} names. See also
33014 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
33015 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
33016 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
33017 developers. Using it may lead to code paths not covered by testing and can
33018 potentially result in compiler ICEs or runtime errors.
33020 @item -mno-default
33021 @opindex mno-default
33022 This option instructs GCC to turn off all tunable features. See also 
33023 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
33025 @item -mcld
33026 @opindex mcld
33027 This option instructs GCC to emit a @code{cld} instruction in the prologue
33028 of functions that use string instructions.  String instructions depend on
33029 the DF flag to select between autoincrement or autodecrement mode.  While the
33030 ABI specifies the DF flag to be cleared on function entry, some operating
33031 systems violate this specification by not clearing the DF flag in their
33032 exception dispatchers.  The exception handler can be invoked with the DF flag
33033 set, which leads to wrong direction mode when string instructions are used.
33034 This option can be enabled by default on 32-bit x86 targets by configuring
33035 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
33036 instructions can be suppressed with the @option{-mno-cld} compiler option
33037 in this case.
33039 @item -mvzeroupper
33040 @opindex mvzeroupper
33041 This option instructs GCC to emit a @code{vzeroupper} instruction
33042 before a transfer of control flow out of the function to minimize
33043 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
33044 intrinsics.
33046 @item -mprefer-avx128
33047 @opindex mprefer-avx128
33048 This option instructs GCC to use 128-bit AVX instructions instead of
33049 256-bit AVX instructions in the auto-vectorizer.
33051 @item -mprefer-vector-width=@var{opt}
33052 @opindex mprefer-vector-width
33053 This option instructs GCC to use @var{opt}-bit vector width in instructions
33054 instead of default on the selected platform.
33056 @item -mmove-max=@var{bits}
33057 @opindex mmove-max
33058 This option instructs GCC to set the maximum number of bits can be
33059 moved from memory to memory efficiently to @var{bits}.  The valid
33060 @var{bits} are 128, 256 and 512.
33062 @item -mstore-max=@var{bits}
33063 @opindex mstore-max
33064 This option instructs GCC to set the maximum number of bits can be
33065 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
33066 128, 256 and 512.
33068 @table @samp
33069 @item none
33070 No extra limitations applied to GCC other than defined by the selected platform.
33072 @item 128
33073 Prefer 128-bit vector width for instructions.
33075 @item 256
33076 Prefer 256-bit vector width for instructions.
33078 @item 512
33079 Prefer 512-bit vector width for instructions.
33080 @end table
33082 @item -mcx16
33083 @opindex mcx16
33084 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
33085 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
33086 objects.  This is useful for atomic updates of data structures exceeding one
33087 machine word in size.  The compiler uses this instruction to implement
33088 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
33089 128-bit integers, a library call is always used.
33091 @item -msahf
33092 @opindex msahf
33093 This option enables generation of @code{SAHF} instructions in 64-bit code.
33094 Early Intel Pentium 4 CPUs with Intel 64 support,
33095 prior to the introduction of Pentium 4 G1 step in December 2005,
33096 lacked the @code{LAHF} and @code{SAHF} instructions
33097 which are supported by AMD64.
33098 These are load and store instructions, respectively, for certain status flags.
33099 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
33100 @code{drem}, and @code{remainder} built-in functions;
33101 see @ref{Other Builtins} for details.
33103 @item -mmovbe
33104 @opindex mmovbe
33105 This option enables use of the @code{movbe} instruction to implement
33106 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
33108 @item -mshstk
33109 @opindex mshstk
33110 The @option{-mshstk} option enables shadow stack built-in functions
33111 from x86 Control-flow Enforcement Technology (CET).
33113 @item -mcrc32
33114 @opindex mcrc32
33115 This option enables built-in functions @code{__builtin_ia32_crc32qi},
33116 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
33117 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
33119 @item -mmwait
33120 @opindex mmwait
33121 This option enables built-in functions @code{__builtin_ia32_monitor},
33122 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
33123 @code{mwait} machine instructions.
33125 @item -mrecip
33126 @opindex mrecip
33127 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
33128 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
33129 with an additional Newton-Raphson step
33130 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
33131 (and their vectorized
33132 variants) for single-precision floating-point arguments.  These instructions
33133 are generated only when @option{-funsafe-math-optimizations} is enabled
33134 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
33135 Note that while the throughput of the sequence is higher than the throughput
33136 of the non-reciprocal instruction, the precision of the sequence can be
33137 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
33139 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
33140 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
33141 combination), and doesn't need @option{-mrecip}.
33143 Also note that GCC emits the above sequence with additional Newton-Raphson step
33144 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
33145 already with @option{-ffast-math} (or the above option combination), and
33146 doesn't need @option{-mrecip}.
33148 @item -mrecip=@var{opt}
33149 @opindex mrecip=opt
33150 This option controls which reciprocal estimate instructions
33151 may be used.  @var{opt} is a comma-separated list of options, which may
33152 be preceded by a @samp{!} to invert the option:
33154 @table @samp
33155 @item all
33156 Enable all estimate instructions.
33158 @item default
33159 Enable the default instructions, equivalent to @option{-mrecip}.
33161 @item none
33162 Disable all estimate instructions, equivalent to @option{-mno-recip}.
33164 @item div
33165 Enable the approximation for scalar division.
33167 @item vec-div
33168 Enable the approximation for vectorized division.
33170 @item sqrt
33171 Enable the approximation for scalar square root.
33173 @item vec-sqrt
33174 Enable the approximation for vectorized square root.
33175 @end table
33177 So, for example, @option{-mrecip=all,!sqrt} enables
33178 all of the reciprocal approximations, except for square root.
33180 @item -mveclibabi=@var{type}
33181 @opindex mveclibabi
33182 Specifies the ABI type to use for vectorizing intrinsics using an
33183 external library.  Supported values for @var{type} are @samp{svml} 
33184 for the Intel short
33185 vector math library and @samp{acml} for the AMD math core library.
33186 To use this option, both @option{-ftree-vectorize} and
33187 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
33188 ABI-compatible library must be specified at link time.
33190 GCC currently emits calls to @code{vmldExp2},
33191 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
33192 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
33193 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
33194 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
33195 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
33196 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
33197 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
33198 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
33199 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
33200 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
33201 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
33202 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
33203 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
33204 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
33205 when @option{-mveclibabi=acml} is used.  
33207 @item -mabi=@var{name}
33208 @opindex mabi
33209 Generate code for the specified calling convention.  Permissible values
33210 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
33211 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
33212 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
33213 You can control this behavior for specific functions by
33214 using the function attributes @code{ms_abi} and @code{sysv_abi}.
33215 @xref{Function Attributes}.
33217 @item -mforce-indirect-call
33218 @opindex mforce-indirect-call
33219 Force all calls to functions to be indirect. This is useful
33220 when using Intel Processor Trace where it generates more precise timing
33221 information for function calls.
33223 @item -mmanual-endbr
33224 @opindex mmanual-endbr
33225 Insert ENDBR instruction at function entry only via the @code{cf_check}
33226 function attribute. This is useful when used with the option
33227 @option{-fcf-protection=branch} to control ENDBR insertion at the
33228 function entry.
33230 @item -mcet-switch
33231 @opindex mcet-switch
33232 By default, CET instrumentation is turned off on switch statements that
33233 use a jump table and indirect branch track is disabled.  Since jump
33234 tables are stored in read-only memory, this does not result in a direct
33235 loss of hardening.  But if the jump table index is attacker-controlled,
33236 the indirect jump may not be constrained by CET.  This option turns on
33237 CET instrumentation to enable indirect branch track for switch statements
33238 with jump tables which leads to the jump targets reachable via any indirect
33239 jumps.
33241 @item -mcall-ms2sysv-xlogues
33242 @opindex mcall-ms2sysv-xlogues
33243 @opindex mno-call-ms2sysv-xlogues
33244 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
33245 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
33246 default, the code for saving and restoring these registers is emitted inline,
33247 resulting in fairly lengthy prologues and epilogues.  Using
33248 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
33249 use stubs in the static portion of libgcc to perform these saves and restores,
33250 thus reducing function size at the cost of a few extra instructions.
33252 @item -mtls-dialect=@var{type}
33253 @opindex mtls-dialect
33254 Generate code to access thread-local storage using the @samp{gnu} or
33255 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
33256 @samp{gnu2} is more efficient, but it may add compile- and run-time
33257 requirements that cannot be satisfied on all systems.
33259 @item -mpush-args
33260 @itemx -mno-push-args
33261 @opindex mpush-args
33262 @opindex mno-push-args
33263 Use PUSH operations to store outgoing parameters.  This method is shorter
33264 and usually equally fast as method using SUB/MOV operations and is enabled
33265 by default.  In some cases disabling it may improve performance because of
33266 improved scheduling and reduced dependencies.
33268 @item -maccumulate-outgoing-args
33269 @opindex maccumulate-outgoing-args
33270 If enabled, the maximum amount of space required for outgoing arguments is
33271 computed in the function prologue.  This is faster on most modern CPUs
33272 because of reduced dependencies, improved scheduling and reduced stack usage
33273 when the preferred stack boundary is not equal to 2.  The drawback is a notable
33274 increase in code size.  This switch implies @option{-mno-push-args}.
33276 @item -mthreads
33277 @opindex mthreads
33278 Support thread-safe exception handling on MinGW.  Programs that rely
33279 on thread-safe exception handling must compile and link all code with the
33280 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
33281 @option{-D_MT}; when linking, it links in a special thread helper library
33282 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
33284 @item -mms-bitfields
33285 @itemx -mno-ms-bitfields
33286 @opindex mms-bitfields
33287 @opindex mno-ms-bitfields
33289 Enable/disable bit-field layout compatible with the native Microsoft
33290 Windows compiler.  
33292 If @code{packed} is used on a structure, or if bit-fields are used,
33293 it may be that the Microsoft ABI lays out the structure differently
33294 than the way GCC normally does.  Particularly when moving packed
33295 data between functions compiled with GCC and the native Microsoft compiler
33296 (either via function call or as data in a file), it may be necessary to access
33297 either format.
33299 This option is enabled by default for Microsoft Windows
33300 targets.  This behavior can also be controlled locally by use of variable
33301 or type attributes.  For more information, see @ref{x86 Variable Attributes}
33302 and @ref{x86 Type Attributes}.
33304 The Microsoft structure layout algorithm is fairly simple with the exception
33305 of the bit-field packing.  
33306 The padding and alignment of members of structures and whether a bit-field 
33307 can straddle a storage-unit boundary are determine by these rules:
33309 @enumerate
33310 @item Structure members are stored sequentially in the order in which they are
33311 declared: the first member has the lowest memory address and the last member
33312 the highest.
33314 @item Every data object has an alignment requirement.  The alignment requirement
33315 for all data except structures, unions, and arrays is either the size of the
33316 object or the current packing size (specified with either the
33317 @code{aligned} attribute or the @code{pack} pragma),
33318 whichever is less.  For structures, unions, and arrays,
33319 the alignment requirement is the largest alignment requirement of its members.
33320 Every object is allocated an offset so that:
33322 @smallexample
33323 offset % alignment_requirement == 0
33324 @end smallexample
33326 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
33327 unit if the integral types are the same size and if the next bit-field fits
33328 into the current allocation unit without crossing the boundary imposed by the
33329 common alignment requirements of the bit-fields.
33330 @end enumerate
33332 MSVC interprets zero-length bit-fields in the following ways:
33334 @enumerate
33335 @item If a zero-length bit-field is inserted between two bit-fields that
33336 are normally coalesced, the bit-fields are not coalesced.
33338 For example:
33340 @smallexample
33341 struct
33342  @{
33343    unsigned long bf_1 : 12;
33344    unsigned long : 0;
33345    unsigned long bf_2 : 12;
33346  @} t1;
33347 @end smallexample
33349 @noindent
33350 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
33351 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
33353 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
33354 alignment of the zero-length bit-field is greater than the member that follows it,
33355 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
33357 For example:
33359 @smallexample
33360 struct
33361  @{
33362    char foo : 4;
33363    short : 0;
33364    char bar;
33365  @} t2;
33367 struct
33368  @{
33369    char foo : 4;
33370    short : 0;
33371    double bar;
33372  @} t3;
33373 @end smallexample
33375 @noindent
33376 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
33377 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
33378 bit-field does not affect the alignment of @code{bar} or, as a result, the size
33379 of the structure.
33381 Taking this into account, it is important to note the following:
33383 @enumerate
33384 @item If a zero-length bit-field follows a normal bit-field, the type of the
33385 zero-length bit-field may affect the alignment of the structure as whole. For
33386 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
33387 normal bit-field, and is of type short.
33389 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
33390 still affect the alignment of the structure:
33392 @smallexample
33393 struct
33394  @{
33395    char foo : 6;
33396    long : 0;
33397  @} t4;
33398 @end smallexample
33400 @noindent
33401 Here, @code{t4} takes up 4 bytes.
33402 @end enumerate
33404 @item Zero-length bit-fields following non-bit-field members are ignored:
33406 @smallexample
33407 struct
33408  @{
33409    char foo;
33410    long : 0;
33411    char bar;
33412  @} t5;
33413 @end smallexample
33415 @noindent
33416 Here, @code{t5} takes up 2 bytes.
33417 @end enumerate
33420 @item -mno-align-stringops
33421 @opindex mno-align-stringops
33422 @opindex malign-stringops
33423 Do not align the destination of inlined string operations.  This switch reduces
33424 code size and improves performance in case the destination is already aligned,
33425 but GCC doesn't know about it.
33427 @item -minline-all-stringops
33428 @opindex minline-all-stringops
33429 By default GCC inlines string operations only when the destination is 
33430 known to be aligned to least a 4-byte boundary.  
33431 This enables more inlining and increases code
33432 size, but may improve performance of code that depends on fast
33433 @code{memcpy} and @code{memset} for short lengths.
33434 The option enables inline expansion of @code{strlen} for all
33435 pointer alignments.
33437 @item -minline-stringops-dynamically
33438 @opindex minline-stringops-dynamically
33439 For string operations of unknown size, use run-time checks with
33440 inline code for small blocks and a library call for large blocks.
33442 @item -mstringop-strategy=@var{alg}
33443 @opindex mstringop-strategy=@var{alg}
33444 Override the internal decision heuristic for the particular algorithm to use
33445 for inlining string operations.  The allowed values for @var{alg} are:
33447 @table @samp
33448 @item rep_byte
33449 @itemx rep_4byte
33450 @itemx rep_8byte
33451 Expand using i386 @code{rep} prefix of the specified size.
33453 @item byte_loop
33454 @itemx loop
33455 @itemx unrolled_loop
33456 Expand into an inline loop.
33458 @item libcall
33459 Always use a library call.
33460 @end table
33462 @item -mmemcpy-strategy=@var{strategy}
33463 @opindex mmemcpy-strategy=@var{strategy}
33464 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
33465 should be inlined and what inline algorithm to use when the expected size
33466 of the copy operation is known. @var{strategy} 
33467 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
33468 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
33469 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
33470 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
33471 in the list must be specified in increasing order.  The minimal byte size for 
33472 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
33473 preceding range.
33475 @item -mmemset-strategy=@var{strategy}
33476 @opindex mmemset-strategy=@var{strategy}
33477 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
33478 @code{__builtin_memset} expansion.
33480 @item -momit-leaf-frame-pointer
33481 @opindex momit-leaf-frame-pointer
33482 Don't keep the frame pointer in a register for leaf functions.  This
33483 avoids the instructions to save, set up, and restore frame pointers and
33484 makes an extra register available in leaf functions.  The option
33485 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
33486 which might make debugging harder.
33488 @item -mtls-direct-seg-refs
33489 @itemx -mno-tls-direct-seg-refs
33490 @opindex mtls-direct-seg-refs
33491 Controls whether TLS variables may be accessed with offsets from the
33492 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
33493 or whether the thread base pointer must be added.  Whether or not this
33494 is valid depends on the operating system, and whether it maps the
33495 segment to cover the entire TLS area.
33497 For systems that use the GNU C Library, the default is on.
33499 @item -msse2avx
33500 @itemx -mno-sse2avx
33501 @opindex msse2avx
33502 Specify that the assembler should encode SSE instructions with VEX
33503 prefix.  The option @option{-mavx} turns this on by default.
33505 @item -mfentry
33506 @itemx -mno-fentry
33507 @opindex mfentry
33508 If profiling is active (@option{-pg}), put the profiling
33509 counter call before the prologue.
33510 Note: On x86 architectures the attribute @code{ms_hook_prologue}
33511 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
33513 @item -mrecord-mcount
33514 @itemx -mno-record-mcount
33515 @opindex mrecord-mcount
33516 If profiling is active (@option{-pg}), generate a __mcount_loc section
33517 that contains pointers to each profiling call. This is useful for
33518 automatically patching and out calls.
33520 @item -mnop-mcount
33521 @itemx -mno-nop-mcount
33522 @opindex mnop-mcount
33523 If profiling is active (@option{-pg}), generate the calls to
33524 the profiling functions as NOPs. This is useful when they
33525 should be patched in later dynamically. This is likely only
33526 useful together with @option{-mrecord-mcount}.
33528 @item -minstrument-return=@var{type}
33529 @opindex minstrument-return
33530 Instrument function exit in -pg -mfentry instrumented functions with
33531 call to specified function. This only instruments true returns ending
33532 with ret, but not sibling calls ending with jump. Valid types
33533 are @var{none} to not instrument, @var{call} to generate a call to __return__,
33534 or @var{nop5} to generate a 5 byte nop.
33536 @item -mrecord-return
33537 @itemx -mno-record-return
33538 @opindex mrecord-return
33539 Generate a __return_loc section pointing to all return instrumentation code.
33541 @item -mfentry-name=@var{name}
33542 @opindex mfentry-name
33543 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
33545 @item -mfentry-section=@var{name}
33546 @opindex mfentry-section
33547 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
33549 @item -mskip-rax-setup
33550 @itemx -mno-skip-rax-setup
33551 @opindex mskip-rax-setup
33552 When generating code for the x86-64 architecture with SSE extensions
33553 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
33554 register when there are no variable arguments passed in vector registers.
33556 @strong{Warning:} Since RAX register is used to avoid unnecessarily
33557 saving vector registers on stack when passing variable arguments, the
33558 impacts of this option are callees may waste some stack space,
33559 misbehave or jump to a random location.  GCC 4.4 or newer don't have
33560 those issues, regardless the RAX register value.
33562 @item -m8bit-idiv
33563 @itemx -mno-8bit-idiv
33564 @opindex m8bit-idiv
33565 On some processors, like Intel Atom, 8-bit unsigned integer divide is
33566 much faster than 32-bit/64-bit integer divide.  This option generates a
33567 run-time check.  If both dividend and divisor are within range of 0
33568 to 255, 8-bit unsigned integer divide is used instead of
33569 32-bit/64-bit integer divide.
33571 @item -mavx256-split-unaligned-load
33572 @itemx -mavx256-split-unaligned-store
33573 @opindex mavx256-split-unaligned-load
33574 @opindex mavx256-split-unaligned-store
33575 Split 32-byte AVX unaligned load and store.
33577 @item -mstack-protector-guard=@var{guard}
33578 @itemx -mstack-protector-guard-reg=@var{reg}
33579 @itemx -mstack-protector-guard-offset=@var{offset}
33580 @opindex mstack-protector-guard
33581 @opindex mstack-protector-guard-reg
33582 @opindex mstack-protector-guard-offset
33583 Generate stack protection code using canary at @var{guard}.  Supported
33584 locations are @samp{global} for global canary or @samp{tls} for per-thread
33585 canary in the TLS block (the default).  This option has effect only when
33586 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
33588 With the latter choice the options
33589 @option{-mstack-protector-guard-reg=@var{reg}} and
33590 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
33591 which segment register (@code{%fs} or @code{%gs}) to use as base register
33592 for reading the canary, and from what offset from that base register.
33593 The default for those is as specified in the relevant ABI.
33595 @item -mgeneral-regs-only
33596 @opindex mgeneral-regs-only
33597 Generate code that uses only the general-purpose registers.  This
33598 prevents the compiler from using floating-point, vector, mask and bound
33599 registers.
33601 @item -mrelax-cmpxchg-loop
33602 @opindex mrelax-cmpxchg-loop
33603 Relax cmpxchg loop by emitting an early load and compare before cmpxchg,
33604 execute pause if load value is not expected. This reduces excessive
33605 cachline bouncing when and works for all atomic logic fetch builtins
33606 that generates compare and swap loop.
33608 @item -mindirect-branch=@var{choice}
33609 @opindex mindirect-branch
33610 Convert indirect call and jump with @var{choice}.  The default is
33611 @samp{keep}, which keeps indirect call and jump unmodified.
33612 @samp{thunk} converts indirect call and jump to call and return thunk.
33613 @samp{thunk-inline} converts indirect call and jump to inlined call
33614 and return thunk.  @samp{thunk-extern} converts indirect call and jump
33615 to external call and return thunk provided in a separate object file.
33616 You can control this behavior for a specific function by using the
33617 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
33619 Note that @option{-mcmodel=large} is incompatible with
33620 @option{-mindirect-branch=thunk} and
33621 @option{-mindirect-branch=thunk-extern} since the thunk function may
33622 not be reachable in the large code model.
33624 Note that @option{-mindirect-branch=thunk-extern} is compatible with
33625 @option{-fcf-protection=branch} since the external thunk can be made
33626 to enable control-flow check.
33628 @item -mfunction-return=@var{choice}
33629 @opindex mfunction-return
33630 Convert function return with @var{choice}.  The default is @samp{keep},
33631 which keeps function return unmodified.  @samp{thunk} converts function
33632 return to call and return thunk.  @samp{thunk-inline} converts function
33633 return to inlined call and return thunk.  @samp{thunk-extern} converts
33634 function return to external call and return thunk provided in a separate
33635 object file.  You can control this behavior for a specific function by
33636 using the function attribute @code{function_return}.
33637 @xref{Function Attributes}.
33639 Note that @option{-mindirect-return=thunk-extern} is compatible with
33640 @option{-fcf-protection=branch} since the external thunk can be made
33641 to enable control-flow check.
33643 Note that @option{-mcmodel=large} is incompatible with
33644 @option{-mfunction-return=thunk} and
33645 @option{-mfunction-return=thunk-extern} since the thunk function may
33646 not be reachable in the large code model.
33649 @item -mindirect-branch-register
33650 @opindex mindirect-branch-register
33651 Force indirect call and jump via register.
33653 @item -mharden-sls=@var{choice}
33654 @opindex mharden-sls
33655 Generate code to mitigate against straight line speculation (SLS) with
33656 @var{choice}.  The default is @samp{none} which disables all SLS
33657 hardening.  @samp{return} enables SLS hardening for function returns.
33658 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
33659 @samp{all} enables all SLS hardening.
33661 @item -mindirect-branch-cs-prefix
33662 @opindex mindirect-branch-cs-prefix
33663 Add CS prefix to call and jmp to indirect thunk with branch target in
33664 r8-r15 registers so that the call and jmp instruction length is 6 bytes
33665 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
33666 @samp{lfence; jmp *%r8-r15} at run-time.
33668 @end table
33670 These @samp{-m} switches are supported in addition to the above
33671 on x86-64 processors in 64-bit environments.
33673 @table @gcctabopt
33674 @item -m32
33675 @itemx -m64
33676 @itemx -mx32
33677 @itemx -m16
33678 @itemx -miamcu
33679 @opindex m32
33680 @opindex m64
33681 @opindex mx32
33682 @opindex m16
33683 @opindex miamcu
33684 Generate code for a 16-bit, 32-bit or 64-bit environment.
33685 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
33686 to 32 bits, and
33687 generates code that runs on any i386 system.
33689 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
33690 types to 64 bits, and generates code for the x86-64 architecture.
33691 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
33692 and @option{-mdynamic-no-pic} options.
33694 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
33695 to 32 bits, and
33696 generates code for the x86-64 architecture.
33698 The @option{-m16} option is the same as @option{-m32}, except for that
33699 it outputs the @code{.code16gcc} assembly directive at the beginning of
33700 the assembly output so that the binary can run in 16-bit mode.
33702 The @option{-miamcu} option generates code which conforms to Intel MCU
33703 psABI.  It requires the @option{-m32} option to be turned on.
33705 @item -mno-red-zone
33706 @opindex mno-red-zone
33707 @opindex mred-zone
33708 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
33709 by the x86-64 ABI; it is a 128-byte area beyond the location of the
33710 stack pointer that is not modified by signal or interrupt handlers
33711 and therefore can be used for temporary data without adjusting the stack
33712 pointer.  The flag @option{-mno-red-zone} disables this red zone.
33714 @item -mcmodel=small
33715 @opindex mcmodel=small
33716 Generate code for the small code model: the program and its symbols must
33717 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
33718 Programs can be statically or dynamically linked.  This is the default
33719 code model.
33721 @item -mcmodel=kernel
33722 @opindex mcmodel=kernel
33723 Generate code for the kernel code model.  The kernel runs in the
33724 negative 2 GB of the address space.
33725 This model has to be used for Linux kernel code.
33727 @item -mcmodel=medium
33728 @opindex mcmodel=medium
33729 Generate code for the medium model: the program is linked in the lower 2
33730 GB of the address space.  Small symbols are also placed there.  Symbols
33731 with sizes larger than @option{-mlarge-data-threshold} are put into
33732 large data or BSS sections and can be located above 2GB.  Programs can
33733 be statically or dynamically linked.
33735 @item -mcmodel=large
33736 @opindex mcmodel=large
33737 Generate code for the large model.  This model makes no assumptions
33738 about addresses and sizes of sections.
33740 @item -maddress-mode=long
33741 @opindex maddress-mode=long
33742 Generate code for long address mode.  This is only supported for 64-bit
33743 and x32 environments.  It is the default address mode for 64-bit
33744 environments.
33746 @item -maddress-mode=short
33747 @opindex maddress-mode=short
33748 Generate code for short address mode.  This is only supported for 32-bit
33749 and x32 environments.  It is the default address mode for 32-bit and
33750 x32 environments.
33752 @item -mneeded
33753 @itemx -mno-needed
33754 @opindex mneeded
33755 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
33756 indicate the micro-architecture ISA level required to execute the binary.
33758 @item -mno-direct-extern-access
33759 @opindex mno-direct-extern-access
33760 @opindex mdirect-extern-access
33761 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
33762 to access external symbols.  With @option{-fpic} or @option{-fPIC},
33763 treat access to protected symbols as local symbols.  The default is
33764 @option{-mdirect-extern-access}.
33766 @strong{Warning:} shared libraries compiled with
33767 @option{-mno-direct-extern-access} and executable compiled with
33768 @option{-mdirect-extern-access} may not be binary compatible if
33769 protected symbols are used in shared libraries and executable.
33770 @end table
33772 @node x86 Windows Options
33773 @subsection x86 Windows Options
33774 @cindex x86 Windows Options
33775 @cindex Windows Options for x86
33777 These additional options are available for Microsoft Windows targets:
33779 @table @gcctabopt
33780 @item -mconsole
33781 @opindex mconsole
33782 This option
33783 specifies that a console application is to be generated, by
33784 instructing the linker to set the PE header subsystem type
33785 required for console applications.
33786 This option is available for Cygwin and MinGW targets and is
33787 enabled by default on those targets.
33789 @item -mdll
33790 @opindex mdll
33791 This option is available for Cygwin and MinGW targets.  It
33792 specifies that a DLL---a dynamic link library---is to be
33793 generated, enabling the selection of the required runtime
33794 startup object and entry point.
33796 @item -mnop-fun-dllimport
33797 @opindex mnop-fun-dllimport
33798 This option is available for Cygwin and MinGW targets.  It
33799 specifies that the @code{dllimport} attribute should be ignored.
33801 @item -mthreads
33802 @opindex mthreads
33803 This option is available for MinGW targets. It specifies
33804 that MinGW-specific thread support is to be used.
33806 @item -municode
33807 @opindex municode
33808 This option is available for MinGW-w64 targets.  It causes
33809 the @code{UNICODE} preprocessor macro to be predefined, and
33810 chooses Unicode-capable runtime startup code.
33812 @item -mwin32
33813 @opindex mwin32
33814 This option is available for Cygwin and MinGW targets.  It
33815 specifies that the typical Microsoft Windows predefined macros are to
33816 be set in the pre-processor, but does not influence the choice
33817 of runtime library/startup code.
33819 @item -mwindows
33820 @opindex mwindows
33821 This option is available for Cygwin and MinGW targets.  It
33822 specifies that a GUI application is to be generated by
33823 instructing the linker to set the PE header subsystem type
33824 appropriately.
33826 @item -fno-set-stack-executable
33827 @opindex fno-set-stack-executable
33828 @opindex fset-stack-executable
33829 This option is available for MinGW targets. It specifies that
33830 the executable flag for the stack used by nested functions isn't
33831 set. This is necessary for binaries running in kernel mode of
33832 Microsoft Windows, as there the User32 API, which is used to set executable
33833 privileges, isn't available.
33835 @item -fwritable-relocated-rdata
33836 @opindex fno-writable-relocated-rdata
33837 @opindex fwritable-relocated-rdata
33838 This option is available for MinGW and Cygwin targets.  It specifies
33839 that relocated-data in read-only section is put into the @code{.data}
33840 section.  This is a necessary for older runtimes not supporting
33841 modification of @code{.rdata} sections for pseudo-relocation.
33843 @item -mpe-aligned-commons
33844 @opindex mpe-aligned-commons
33845 This option is available for Cygwin and MinGW targets.  It
33846 specifies that the GNU extension to the PE file format that
33847 permits the correct alignment of COMMON variables should be
33848 used when generating code.  It is enabled by default if
33849 GCC detects that the target assembler found during configuration
33850 supports the feature.
33851 @end table
33853 See also under @ref{x86 Options} for standard options.
33855 @node Xstormy16 Options
33856 @subsection Xstormy16 Options
33857 @cindex Xstormy16 Options
33859 These options are defined for Xstormy16:
33861 @table @gcctabopt
33862 @item -msim
33863 @opindex msim
33864 Choose startup files and linker script suitable for the simulator.
33865 @end table
33867 @node Xtensa Options
33868 @subsection Xtensa Options
33869 @cindex Xtensa Options
33871 These options are supported for Xtensa targets:
33873 @table @gcctabopt
33874 @item -mconst16
33875 @itemx -mno-const16
33876 @opindex mconst16
33877 @opindex mno-const16
33878 Enable or disable use of @code{CONST16} instructions for loading
33879 constant values.  The @code{CONST16} instruction is currently not a
33880 standard option from Tensilica.  When enabled, @code{CONST16}
33881 instructions are always used in place of the standard @code{L32R}
33882 instructions.  The use of @code{CONST16} is enabled by default only if
33883 the @code{L32R} instruction is not available.
33885 @item -mfused-madd
33886 @itemx -mno-fused-madd
33887 @opindex mfused-madd
33888 @opindex mno-fused-madd
33889 Enable or disable use of fused multiply/add and multiply/subtract
33890 instructions in the floating-point option.  This has no effect if the
33891 floating-point option is not also enabled.  Disabling fused multiply/add
33892 and multiply/subtract instructions forces the compiler to use separate
33893 instructions for the multiply and add/subtract operations.  This may be
33894 desirable in some cases where strict IEEE 754-compliant results are
33895 required: the fused multiply add/subtract instructions do not round the
33896 intermediate result, thereby producing results with @emph{more} bits of
33897 precision than specified by the IEEE standard.  Disabling fused multiply
33898 add/subtract instructions also ensures that the program output is not
33899 sensitive to the compiler's ability to combine multiply and add/subtract
33900 operations.
33902 @item -mserialize-volatile
33903 @itemx -mno-serialize-volatile
33904 @opindex mserialize-volatile
33905 @opindex mno-serialize-volatile
33906 When this option is enabled, GCC inserts @code{MEMW} instructions before
33907 @code{volatile} memory references to guarantee sequential consistency.
33908 The default is @option{-mserialize-volatile}.  Use
33909 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
33911 @item -mforce-no-pic
33912 @opindex mforce-no-pic
33913 For targets, like GNU/Linux, where all user-mode Xtensa code must be
33914 position-independent code (PIC), this option disables PIC for compiling
33915 kernel code.
33917 @item -mtext-section-literals
33918 @itemx -mno-text-section-literals
33919 @opindex mtext-section-literals
33920 @opindex mno-text-section-literals
33921 These options control the treatment of literal pools.  The default is
33922 @option{-mno-text-section-literals}, which places literals in a separate
33923 section in the output file.  This allows the literal pool to be placed
33924 in a data RAM/ROM, and it also allows the linker to combine literal
33925 pools from separate object files to remove redundant literals and
33926 improve code size.  With @option{-mtext-section-literals}, the literals
33927 are interspersed in the text section in order to keep them as close as
33928 possible to their references.  This may be necessary for large assembly
33929 files.  Literals for each function are placed right before that function.
33931 @item -mauto-litpools
33932 @itemx -mno-auto-litpools
33933 @opindex mauto-litpools
33934 @opindex mno-auto-litpools
33935 These options control the treatment of literal pools.  The default is
33936 @option{-mno-auto-litpools}, which places literals in a separate
33937 section in the output file unless @option{-mtext-section-literals} is
33938 used.  With @option{-mauto-litpools} the literals are interspersed in
33939 the text section by the assembler.  Compiler does not produce explicit
33940 @code{.literal} directives and loads literals into registers with
33941 @code{MOVI} instructions instead of @code{L32R} to let the assembler
33942 do relaxation and place literals as necessary.  This option allows
33943 assembler to create several literal pools per function and assemble
33944 very big functions, which may not be possible with
33945 @option{-mtext-section-literals}.
33947 @item -mtarget-align
33948 @itemx -mno-target-align
33949 @opindex mtarget-align
33950 @opindex mno-target-align
33951 When this option is enabled, GCC instructs the assembler to
33952 automatically align instructions to reduce branch penalties at the
33953 expense of some code density.  The assembler attempts to widen density
33954 instructions to align branch targets and the instructions following call
33955 instructions.  If there are not enough preceding safe density
33956 instructions to align a target, no widening is performed.  The
33957 default is @option{-mtarget-align}.  These options do not affect the
33958 treatment of auto-aligned instructions like @code{LOOP}, which the
33959 assembler always aligns, either by widening density instructions or
33960 by inserting NOP instructions.
33962 @item -mlongcalls
33963 @itemx -mno-longcalls
33964 @opindex mlongcalls
33965 @opindex mno-longcalls
33966 When this option is enabled, GCC instructs the assembler to translate
33967 direct calls to indirect calls unless it can determine that the target
33968 of a direct call is in the range allowed by the call instruction.  This
33969 translation typically occurs for calls to functions in other source
33970 files.  Specifically, the assembler translates a direct @code{CALL}
33971 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
33972 The default is @option{-mno-longcalls}.  This option should be used in
33973 programs where the call target can potentially be out of range.  This
33974 option is implemented in the assembler, not the compiler, so the
33975 assembly code generated by GCC still shows direct call
33976 instructions---look at the disassembled object code to see the actual
33977 instructions.  Note that the assembler uses an indirect call for
33978 every cross-file call, not just those that really are out of range.
33980 @item -mabi=@var{name}
33981 @opindex mabi
33982 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
33983 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
33985 @item -mabi=call0
33986 @opindex mabi=call0
33987 When this option is enabled function parameters are passed in registers
33988 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
33989 caller-saved, and register @code{a15} may be used as a frame pointer.
33990 When this version of the ABI is enabled the C preprocessor symbol
33991 @code{__XTENSA_CALL0_ABI__} is defined.
33993 @item -mabi=windowed
33994 @opindex mabi=windowed
33995 When this option is enabled function parameters are passed in registers
33996 @code{a10} through @code{a15}, and called function rotates register window
33997 by 8 registers on entry so that its arguments are found in registers
33998 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
33999 pointer.  Register window is rotated 8 registers back upon return.
34000 When this version of the ABI is enabled the C preprocessor symbol
34001 @code{__XTENSA_WINDOWED_ABI__} is defined.
34003 @item -mextra-l32r-costs=@var{n}
34004 @opindex mextra-l32r-costs
34005 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
34006 instructions, in clock cycles.  This affects, when optimizing for speed,
34007 whether loading a constant from literal pool using @code{L32R} or
34008 synthesizing the constant from a small one with a couple of arithmetic
34009 instructions.  The default value is 0.
34010 @end table
34012 @node zSeries Options
34013 @subsection zSeries Options
34014 @cindex zSeries options
34016 These are listed under @xref{S/390 and zSeries Options}.
34019 @c man end
34021 @node Spec Files
34022 @section Specifying Subprocesses and the Switches to Pass to Them
34023 @cindex Spec Files
34025 @command{gcc} is a driver program.  It performs its job by invoking a
34026 sequence of other programs to do the work of compiling, assembling and
34027 linking.  GCC interprets its command-line parameters and uses these to
34028 deduce which programs it should invoke, and which command-line options
34029 it ought to place on their command lines.  This behavior is controlled
34030 by @dfn{spec strings}.  In most cases there is one spec string for each
34031 program that GCC can invoke, but a few programs have multiple spec
34032 strings to control their behavior.  The spec strings built into GCC can
34033 be overridden by using the @option{-specs=} command-line switch to specify
34034 a spec file.
34036 @dfn{Spec files} are plain-text files that are used to construct spec
34037 strings.  They consist of a sequence of directives separated by blank
34038 lines.  The type of directive is determined by the first non-whitespace
34039 character on the line, which can be one of the following:
34041 @table @code
34042 @item %@var{command}
34043 Issues a @var{command} to the spec file processor.  The commands that can
34044 appear here are:
34046 @table @code
34047 @item %include <@var{file}>
34048 @cindex @code{%include}
34049 Search for @var{file} and insert its text at the current point in the
34050 specs file.
34052 @item %include_noerr <@var{file}>
34053 @cindex @code{%include_noerr}
34054 Just like @samp{%include}, but do not generate an error message if the include
34055 file cannot be found.
34057 @item %rename @var{old_name} @var{new_name}
34058 @cindex @code{%rename}
34059 Rename the spec string @var{old_name} to @var{new_name}.
34061 @end table
34063 @item *[@var{spec_name}]:
34064 This tells the compiler to create, override or delete the named spec
34065 string.  All lines after this directive up to the next directive or
34066 blank line are considered to be the text for the spec string.  If this
34067 results in an empty string then the spec is deleted.  (Or, if the
34068 spec did not exist, then nothing happens.)  Otherwise, if the spec
34069 does not currently exist a new spec is created.  If the spec does
34070 exist then its contents are overridden by the text of this
34071 directive, unless the first character of that text is the @samp{+}
34072 character, in which case the text is appended to the spec.
34074 @item [@var{suffix}]:
34075 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
34076 and up to the next directive or blank line are considered to make up the
34077 spec string for the indicated suffix.  When the compiler encounters an
34078 input file with the named suffix, it processes the spec string in
34079 order to work out how to compile that file.  For example:
34081 @smallexample
34082 .ZZ:
34083 z-compile -input %i
34084 @end smallexample
34086 This says that any input file whose name ends in @samp{.ZZ} should be
34087 passed to the program @samp{z-compile}, which should be invoked with the
34088 command-line switch @option{-input} and with the result of performing the
34089 @samp{%i} substitution.  (See below.)
34091 As an alternative to providing a spec string, the text following a
34092 suffix directive can be one of the following:
34094 @table @code
34095 @item @@@var{language}
34096 This says that the suffix is an alias for a known @var{language}.  This is
34097 similar to using the @option{-x} command-line switch to GCC to specify a
34098 language explicitly.  For example:
34100 @smallexample
34101 .ZZ:
34102 @@c++
34103 @end smallexample
34105 Says that .ZZ files are, in fact, C++ source files.
34107 @item #@var{name}
34108 This causes an error messages saying:
34110 @smallexample
34111 @var{name} compiler not installed on this system.
34112 @end smallexample
34113 @end table
34115 GCC already has an extensive list of suffixes built into it.
34116 This directive adds an entry to the end of the list of suffixes, but
34117 since the list is searched from the end backwards, it is effectively
34118 possible to override earlier entries using this technique.
34120 @end table
34122 GCC has the following spec strings built into it.  Spec files can
34123 override these strings or create their own.  Note that individual
34124 targets can also add their own spec strings to this list.
34126 @smallexample
34127 asm          Options to pass to the assembler
34128 asm_final    Options to pass to the assembler post-processor
34129 cpp          Options to pass to the C preprocessor
34130 cc1          Options to pass to the C compiler
34131 cc1plus      Options to pass to the C++ compiler
34132 endfile      Object files to include at the end of the link
34133 link         Options to pass to the linker
34134 lib          Libraries to include on the command line to the linker
34135 libgcc       Decides which GCC support library to pass to the linker
34136 linker       Sets the name of the linker
34137 predefines   Defines to be passed to the C preprocessor
34138 signed_char  Defines to pass to CPP to say whether @code{char} is signed
34139              by default
34140 startfile    Object files to include at the start of the link
34141 @end smallexample
34143 Here is a small example of a spec file:
34145 @smallexample
34146 %rename lib                 old_lib
34148 *lib:
34149 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
34150 @end smallexample
34152 This example renames the spec called @samp{lib} to @samp{old_lib} and
34153 then overrides the previous definition of @samp{lib} with a new one.
34154 The new definition adds in some extra command-line options before
34155 including the text of the old definition.
34157 @dfn{Spec strings} are a list of command-line options to be passed to their
34158 corresponding program.  In addition, the spec strings can contain
34159 @samp{%}-prefixed sequences to substitute variable text or to
34160 conditionally insert text into the command line.  Using these constructs
34161 it is possible to generate quite complex command lines.
34163 Here is a table of all defined @samp{%}-sequences for spec
34164 strings.  Note that spaces are not generated automatically around the
34165 results of expanding these sequences.  Therefore you can concatenate them
34166 together or combine them with constant text in a single argument.
34168 @table @code
34169 @item %%
34170 Substitute one @samp{%} into the program name or argument.
34172 @item %"
34173 Substitute an empty argument.
34175 @item %i
34176 Substitute the name of the input file being processed.
34178 @item %b
34179 Substitute the basename for outputs related with the input file being
34180 processed.  This is often the substring up to (and not including) the
34181 last period and not including the directory but, unless %w is active, it
34182 expands to the basename for auxiliary outputs, which may be influenced
34183 by an explicit output name, and by various other options that control
34184 how auxiliary outputs are named.
34186 @item %B
34187 This is the same as @samp{%b}, but include the file suffix (text after
34188 the last period).  Without %w, it expands to the basename for dump
34189 outputs.
34191 @item %d
34192 Marks the argument containing or following the @samp{%d} as a
34193 temporary file name, so that that file is deleted if GCC exits
34194 successfully.  Unlike @samp{%g}, this contributes no text to the
34195 argument.
34197 @item %g@var{suffix}
34198 Substitute a file name that has suffix @var{suffix} and is chosen
34199 once per compilation, and mark the argument in the same way as
34200 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
34201 name is now chosen in a way that is hard to predict even when previously
34202 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
34203 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
34204 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
34205 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
34206 was simply substituted with a file name chosen once per compilation,
34207 without regard to any appended suffix (which was therefore treated
34208 just like ordinary text), making such attacks more likely to succeed.
34210 @item %u@var{suffix}
34211 Like @samp{%g}, but generates a new temporary file name
34212 each time it appears instead of once per compilation.
34214 @item %U@var{suffix}
34215 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
34216 new one if there is no such last file name.  In the absence of any
34217 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
34218 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
34219 involves the generation of two distinct file names, one
34220 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
34221 simply substituted with a file name chosen for the previous @samp{%u},
34222 without regard to any appended suffix.
34224 @item %j@var{suffix}
34225 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
34226 writable, and if @option{-save-temps} is not used; 
34227 otherwise, substitute the name
34228 of a temporary file, just like @samp{%u}.  This temporary file is not
34229 meant for communication between processes, but rather as a junk
34230 disposal mechanism.
34232 @item %|@var{suffix}
34233 @itemx %m@var{suffix}
34234 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
34235 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
34236 all.  These are the two most common ways to instruct a program that it
34237 should read from standard input or write to standard output.  If you
34238 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
34239 construct: see for example @file{gcc/fortran/lang-specs.h}.
34241 @item %.@var{SUFFIX}
34242 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
34243 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
34244 terminated by the next space or %.
34246 @item %w
34247 Marks the argument containing or following the @samp{%w} as the
34248 designated output file of this compilation.  This puts the argument
34249 into the sequence of arguments that @samp{%o} substitutes.
34251 @item %V
34252 Indicates that this compilation produces no output file.
34254 @item %o
34255 Substitutes the names of all the output files, with spaces
34256 automatically placed around them.  You should write spaces
34257 around the @samp{%o} as well or the results are undefined.
34258 @samp{%o} is for use in the specs for running the linker.
34259 Input files whose names have no recognized suffix are not compiled
34260 at all, but they are included among the output files, so they are
34261 linked.
34263 @item %O
34264 Substitutes the suffix for object files.  Note that this is
34265 handled specially when it immediately follows @samp{%g, %u, or %U},
34266 because of the need for those to form complete file names.  The
34267 handling is such that @samp{%O} is treated exactly as if it had already
34268 been substituted, except that @samp{%g, %u, and %U} do not currently
34269 support additional @var{suffix} characters following @samp{%O} as they do
34270 following, for example, @samp{.o}.
34272 @item %I
34273 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
34274 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
34275 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
34276 and @option{-imultilib} as necessary.
34278 @item %s
34279 Current argument is the name of a library or startup file of some sort.
34280 Search for that file in a standard list of directories and substitute
34281 the full name found.  The current working directory is included in the
34282 list of directories scanned.
34284 @item %T
34285 Current argument is the name of a linker script.  Search for that file
34286 in the current list of directories to scan for libraries. If the file
34287 is located insert a @option{--script} option into the command line
34288 followed by the full path name found.  If the file is not found then
34289 generate an error message.  Note: the current working directory is not
34290 searched.
34292 @item %e@var{str}
34293 Print @var{str} as an error message.  @var{str} is terminated by a newline.
34294 Use this when inconsistent options are detected.
34296 @item %n@var{str}
34297 Print @var{str} as a notice.  @var{str} is terminated by a newline.
34299 @item %(@var{name})
34300 Substitute the contents of spec string @var{name} at this point.
34302 @item %x@{@var{option}@}
34303 Accumulate an option for @samp{%X}.
34305 @item %X
34306 Output the accumulated linker options specified by a @samp{%x} spec string.
34308 @item %Y
34309 Output the accumulated assembler options specified by @option{-Wa}.
34311 @item %Z
34312 Output the accumulated preprocessor options specified by @option{-Wp}.
34314 @item %M
34315 Output @code{multilib_os_dir}.
34317 @item %R
34318 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
34320 @item %a
34321 Process the @code{asm} spec.  This is used to compute the
34322 switches to be passed to the assembler.
34324 @item %A
34325 Process the @code{asm_final} spec.  This is a spec string for
34326 passing switches to an assembler post-processor, if such a program is
34327 needed.
34329 @item %l
34330 Process the @code{link} spec.  This is the spec for computing the
34331 command line passed to the linker.  Typically it makes use of the
34332 @samp{%L %G %S %D and %E} sequences.
34334 @item %D
34335 Dump out a @option{-L} option for each directory that GCC believes might
34336 contain startup files.  If the target supports multilibs then the
34337 current multilib directory is prepended to each of these paths.
34339 @item %L
34340 Process the @code{lib} spec.  This is a spec string for deciding which
34341 libraries are included on the command line to the linker.
34343 @item %G
34344 Process the @code{libgcc} spec.  This is a spec string for deciding
34345 which GCC support library is included on the command line to the linker.
34347 @item %S
34348 Process the @code{startfile} spec.  This is a spec for deciding which
34349 object files are the first ones passed to the linker.  Typically
34350 this might be a file named @file{crt0.o}.
34352 @item %E
34353 Process the @code{endfile} spec.  This is a spec string that specifies
34354 the last object files that are passed to the linker.
34356 @item %C
34357 Process the @code{cpp} spec.  This is used to construct the arguments
34358 to be passed to the C preprocessor.
34360 @item %1
34361 Process the @code{cc1} spec.  This is used to construct the options to be
34362 passed to the actual C compiler (@command{cc1}).
34364 @item %2
34365 Process the @code{cc1plus} spec.  This is used to construct the options to be
34366 passed to the actual C++ compiler (@command{cc1plus}).
34368 @item %*
34369 Substitute the variable part of a matched option.  See below.
34370 Note that each comma in the substituted string is replaced by
34371 a single space.
34373 @item %<S
34374 Remove all occurrences of @code{-S} from the command line.  Note---this
34375 command is position dependent.  @samp{%} commands in the spec string
34376 before this one see @code{-S}, @samp{%} commands in the spec string
34377 after this one do not.
34379 @item %<S*
34380 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
34382 @item %>S
34383 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
34385 @item %:@var{function}(@var{args})
34386 Call the named function @var{function}, passing it @var{args}.
34387 @var{args} is first processed as a nested spec string, then split
34388 into an argument vector in the usual fashion.  The function returns
34389 a string which is processed as if it had appeared literally as part
34390 of the current spec.
34392 The following built-in spec functions are provided:
34394 @table @code
34395 @item @code{getenv}
34396 The @code{getenv} spec function takes two arguments: an environment
34397 variable name and a string.  If the environment variable is not
34398 defined, a fatal error is issued.  Otherwise, the return value is the
34399 value of the environment variable concatenated with the string.  For
34400 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
34402 @smallexample
34403 %:getenv(TOPDIR /include)
34404 @end smallexample
34406 expands to @file{/path/to/top/include}.
34408 @item @code{if-exists}
34409 The @code{if-exists} spec function takes one argument, an absolute
34410 pathname to a file.  If the file exists, @code{if-exists} returns the
34411 pathname.  Here is a small example of its usage:
34413 @smallexample
34414 *startfile:
34415 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
34416 @end smallexample
34418 @item @code{if-exists-else}
34419 The @code{if-exists-else} spec function is similar to the @code{if-exists}
34420 spec function, except that it takes two arguments.  The first argument is
34421 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
34422 returns the pathname.  If it does not exist, it returns the second argument.
34423 This way, @code{if-exists-else} can be used to select one file or another,
34424 based on the existence of the first.  Here is a small example of its usage:
34426 @smallexample
34427 *startfile:
34428 crt0%O%s %:if-exists(crti%O%s) \
34429 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
34430 @end smallexample
34432 @item @code{if-exists-then-else}
34433 The @code{if-exists-then-else} spec function takes at least two arguments
34434 and an optional third one. The first argument is an absolute pathname to a
34435 file.  If the file exists, the function returns the second argument.
34436 If the file does not exist, the function returns the third argument if there
34437 is one, or NULL otherwise. This can be used to expand one text, or optionally
34438 another, based on the existence of a file.  Here is a small example of its
34439 usage:
34441 @smallexample
34442 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
34443 @end smallexample
34445 @item @code{sanitize}
34446 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
34447 any address, thread or undefined behavior sanitizers are active.
34449 @smallexample
34450 %@{%:sanitize(address):-funwind-tables@}
34451 @end smallexample
34453 @item @code{replace-outfile}
34454 The @code{replace-outfile} spec function takes two arguments.  It looks for the
34455 first argument in the outfiles array and replaces it with the second argument.  Here
34456 is a small example of its usage:
34458 @smallexample
34459 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
34460 @end smallexample
34462 @item @code{remove-outfile}
34463 The @code{remove-outfile} spec function takes one argument.  It looks for the
34464 first argument in the outfiles array and removes it.  Here is a small example
34465 its usage:
34467 @smallexample
34468 %:remove-outfile(-lm)
34469 @end smallexample
34471 @item @code{version-compare}
34472 The @code{version-compare} spec function takes four or five arguments of the following
34473 form:
34475 @smallexample
34476 <comparison-op> <arg1> [<arg2>] <switch> <result>
34477 @end smallexample
34479 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
34480 The supported @code{comparison-op} values are:
34482 @table @code
34483 @item >=
34484 True if @code{switch} is a later (or same) version than @code{arg1}
34486 @item !>
34487 Opposite of @code{>=}
34489 @item <
34490 True if @code{switch} is an earlier version than @code{arg1}
34492 @item !<
34493 Opposite of @code{<}
34495 @item ><
34496 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
34498 @item <>
34499 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
34500 @end table
34502 If the @code{switch} is not present at all, the condition is false unless the first character
34503 of the @code{comparison-op} is @code{!}.
34505 @smallexample
34506 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
34507 @end smallexample
34509 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
34510 passed.
34512 @item @code{include}
34513 The @code{include} spec function behaves much like @code{%include}, with the advantage
34514 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
34515 the filename, and looks for it in the startfile path.  It always returns NULL.
34517 @smallexample
34518 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
34519 @end smallexample
34521 @item @code{pass-through-libs}
34522 The @code{pass-through-libs} spec function takes any number of arguments.  It
34523 finds any @option{-l} options and any non-options ending in @file{.a} (which it
34524 assumes are the names of linker input library archive files) and returns a
34525 result containing all the found arguments each prepended by
34526 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
34527 intended to be passed to the LTO linker plugin.
34529 @smallexample
34530 %:pass-through-libs(%G %L %G)
34531 @end smallexample
34533 @item @code{print-asm-header}
34534 The @code{print-asm-header} function takes no arguments and simply
34535 prints a banner like:
34537 @smallexample
34538 Assembler options
34539 =================
34541 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
34542 @end smallexample
34544 It is used to separate compiler options from assembler options
34545 in the @option{--target-help} output.
34547 @item @code{gt}
34548 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
34549 empty string) if the second-to-last argument is greater than the last argument, and NULL
34550 otherwise.  The following example inserts the @code{link_gomp} spec if the last
34551 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
34553 @smallexample
34554 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
34555 @end smallexample
34557 @item @code{debug-level-gt}
34558 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
34559 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
34560 otherwise.
34562 @smallexample
34563 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
34564 @end smallexample
34565 @end table
34567 @item %@{S@}
34568 Substitutes the @code{-S} switch, if that switch is given to GCC@.
34569 If that switch is not specified, this substitutes nothing.  Note that
34570 the leading dash is omitted when specifying this option, and it is
34571 automatically inserted if the substitution is performed.  Thus the spec
34572 string @samp{%@{foo@}} matches the command-line option @option{-foo}
34573 and outputs the command-line option @option{-foo}.
34575 @item %W@{S@}
34576 Like %@{@code{S}@} but mark last argument supplied within as a file to be
34577 deleted on failure.
34579 @item %@@@{S@}
34580 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
34581 @code{@@FILE} if an @code{@@file} argument has been supplied.
34583 @item %@{S*@}
34584 Substitutes all the switches specified to GCC whose names start
34585 with @code{-S}, but which also take an argument.  This is used for
34586 switches like @option{-o}, @option{-D}, @option{-I}, etc.
34587 GCC considers @option{-o foo} as being
34588 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
34589 text, including the space.  Thus two arguments are generated.
34591 @item %@{S*&T*@}
34592 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
34593 (the order of @code{S} and @code{T} in the spec is not significant).
34594 There can be any number of ampersand-separated variables; for each the
34595 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
34597 @item %@{S:X@}
34598 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
34600 @item %@{!S:X@}
34601 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
34603 @item %@{S*:X@}
34604 Substitutes @code{X} if one or more switches whose names start with
34605 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
34606 once, no matter how many such switches appeared.  However, if @code{%*}
34607 appears somewhere in @code{X}, then @code{X} is substituted once
34608 for each matching switch, with the @code{%*} replaced by the part of
34609 that switch matching the @code{*}.
34611 If @code{%*} appears as the last part of a spec sequence then a space
34612 is added after the end of the last substitution.  If there is more
34613 text in the sequence, however, then a space is not generated.  This
34614 allows the @code{%*} substitution to be used as part of a larger
34615 string.  For example, a spec string like this:
34617 @smallexample
34618 %@{mcu=*:--script=%*/memory.ld@}
34619 @end smallexample
34621 @noindent
34622 when matching an option like @option{-mcu=newchip} produces:
34624 @smallexample
34625 --script=newchip/memory.ld
34626 @end smallexample
34628 @item %@{.S:X@}
34629 Substitutes @code{X}, if processing a file with suffix @code{S}.
34631 @item %@{!.S:X@}
34632 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
34634 @item %@{,S:X@}
34635 Substitutes @code{X}, if processing a file for language @code{S}.
34637 @item %@{!,S:X@}
34638 Substitutes @code{X}, if not processing a file for language @code{S}.
34640 @item %@{S|P:X@}
34641 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
34642 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
34643 @code{*} sequences as well, although they have a stronger binding than
34644 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
34645 alternatives must be starred, and only the first matching alternative
34646 is substituted.
34648 For example, a spec string like this:
34650 @smallexample
34651 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
34652 @end smallexample
34654 @noindent
34655 outputs the following command-line options from the following input
34656 command-line options:
34658 @smallexample
34659 fred.c        -foo -baz
34660 jim.d         -bar -boggle
34661 -d fred.c     -foo -baz -boggle
34662 -d jim.d      -bar -baz -boggle
34663 @end smallexample
34665 @item %@{%:@var{function}(@var{args}):X@}
34667 Call function named @var{function} with args @var{args}.  If the
34668 function returns non-NULL, then @code{X} is substituted, if it returns
34669 NULL, it isn't substituted.
34671 @item %@{S:X; T:Y; :D@}
34673 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
34674 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
34675 be as many clauses as you need.  This may be combined with @code{.},
34676 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
34679 @end table
34681 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
34682 or similar construct can use a backslash to ignore the special meaning
34683 of the character following it, thus allowing literal matching of a
34684 character that is otherwise specially treated.  For example,
34685 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
34686 @option{-std=iso9899:1999} option is given.
34688 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
34689 construct may contain other nested @samp{%} constructs or spaces, or
34690 even newlines.  They are processed as usual, as described above.
34691 Trailing white space in @code{X} is ignored.  White space may also
34692 appear anywhere on the left side of the colon in these constructs,
34693 except between @code{.} or @code{*} and the corresponding word.
34695 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
34696 handled specifically in these constructs.  If another value of
34697 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
34698 @option{-W} switch is found later in the command line, the earlier
34699 switch value is ignored, except with @{@code{S}*@} where @code{S} is
34700 just one letter, which passes all matching options.
34702 The character @samp{|} at the beginning of the predicate text is used to
34703 indicate that a command should be piped to the following command, but
34704 only if @option{-pipe} is specified.
34706 It is built into GCC which switches take arguments and which do not.
34707 (You might think it would be useful to generalize this to allow each
34708 compiler's spec to say which switches take arguments.  But this cannot
34709 be done in a consistent fashion.  GCC cannot even decide which input
34710 files have been specified without knowing which switches take arguments,
34711 and it must know which input files to compile in order to tell which
34712 compilers to run).
34714 GCC also knows implicitly that arguments starting in @option{-l} are to be
34715 treated as compiler output files, and passed to the linker in their
34716 proper position among the other output files.
34718 @node Environment Variables
34719 @section Environment Variables Affecting GCC
34720 @cindex environment variables
34722 @c man begin ENVIRONMENT
34723 This section describes several environment variables that affect how GCC
34724 operates.  Some of them work by specifying directories or prefixes to use
34725 when searching for various kinds of files.  Some are used to specify other
34726 aspects of the compilation environment.
34728 Note that you can also specify places to search using options such as
34729 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
34730 take precedence over places specified using environment variables, which
34731 in turn take precedence over those specified by the configuration of GCC@.
34732 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
34733 GNU Compiler Collection (GCC) Internals}.
34735 @table @env
34736 @item LANG
34737 @itemx LC_CTYPE
34738 @c @itemx LC_COLLATE
34739 @itemx LC_MESSAGES
34740 @c @itemx LC_MONETARY
34741 @c @itemx LC_NUMERIC
34742 @c @itemx LC_TIME
34743 @itemx LC_ALL
34744 @findex LANG
34745 @findex LC_CTYPE
34746 @c @findex LC_COLLATE
34747 @findex LC_MESSAGES
34748 @c @findex LC_MONETARY
34749 @c @findex LC_NUMERIC
34750 @c @findex LC_TIME
34751 @findex LC_ALL
34752 @cindex locale
34753 These environment variables control the way that GCC uses
34754 localization information which allows GCC to work with different
34755 national conventions.  GCC inspects the locale categories
34756 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
34757 so.  These locale categories can be set to any value supported by your
34758 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
34759 Kingdom encoded in UTF-8.
34761 The @env{LC_CTYPE} environment variable specifies character
34762 classification.  GCC uses it to determine the character boundaries in
34763 a string; this is needed for some multibyte encodings that contain quote
34764 and escape characters that are otherwise interpreted as a string
34765 end or escape.
34767 The @env{LC_MESSAGES} environment variable specifies the language to
34768 use in diagnostic messages.
34770 If the @env{LC_ALL} environment variable is set, it overrides the value
34771 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
34772 and @env{LC_MESSAGES} default to the value of the @env{LANG}
34773 environment variable.  If none of these variables are set, GCC
34774 defaults to traditional C English behavior.
34776 @item TMPDIR
34777 @findex TMPDIR
34778 If @env{TMPDIR} is set, it specifies the directory to use for temporary
34779 files.  GCC uses temporary files to hold the output of one stage of
34780 compilation which is to be used as input to the next stage: for example,
34781 the output of the preprocessor, which is the input to the compiler
34782 proper.
34784 @item GCC_COMPARE_DEBUG
34785 @findex GCC_COMPARE_DEBUG
34786 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
34787 @option{-fcompare-debug} to the compiler driver.  See the documentation
34788 of this option for more details.
34790 @item GCC_EXEC_PREFIX
34791 @findex GCC_EXEC_PREFIX
34792 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
34793 names of the subprograms executed by the compiler.  No slash is added
34794 when this prefix is combined with the name of a subprogram, but you can
34795 specify a prefix that ends with a slash if you wish.
34797 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
34798 an appropriate prefix to use based on the pathname it is invoked with.
34800 If GCC cannot find the subprogram using the specified prefix, it
34801 tries looking in the usual places for the subprogram.
34803 The default value of @env{GCC_EXEC_PREFIX} is
34804 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
34805 the installed compiler. In many cases @var{prefix} is the value
34806 of @code{prefix} when you ran the @file{configure} script.
34808 Other prefixes specified with @option{-B} take precedence over this prefix.
34810 This prefix is also used for finding files such as @file{crt0.o} that are
34811 used for linking.
34813 In addition, the prefix is used in an unusual way in finding the
34814 directories to search for header files.  For each of the standard
34815 directories whose name normally begins with @samp{/usr/local/lib/gcc}
34816 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
34817 replacing that beginning with the specified prefix to produce an
34818 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
34819 @file{foo/bar} just before it searches the standard directory 
34820 @file{/usr/local/lib/bar}.
34821 If a standard directory begins with the configured
34822 @var{prefix} then the value of @var{prefix} is replaced by
34823 @env{GCC_EXEC_PREFIX} when looking for header files.
34825 @item COMPILER_PATH
34826 @findex COMPILER_PATH
34827 The value of @env{COMPILER_PATH} is a colon-separated list of
34828 directories, much like @env{PATH}.  GCC tries the directories thus
34829 specified when searching for subprograms, if it cannot find the
34830 subprograms using @env{GCC_EXEC_PREFIX}.
34832 @item LIBRARY_PATH
34833 @findex LIBRARY_PATH
34834 The value of @env{LIBRARY_PATH} is a colon-separated list of
34835 directories, much like @env{PATH}.  When configured as a native compiler,
34836 GCC tries the directories thus specified when searching for special
34837 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
34838 using GCC also uses these directories when searching for ordinary
34839 libraries for the @option{-l} option (but directories specified with
34840 @option{-L} come first).
34842 @item LANG
34843 @findex LANG
34844 @cindex locale definition
34845 This variable is used to pass locale information to the compiler.  One way in
34846 which this information is used is to determine the character set to be used
34847 when character literals, string literals and comments are parsed in C and C++.
34848 When the compiler is configured to allow multibyte characters,
34849 the following values for @env{LANG} are recognized:
34851 @table @samp
34852 @item C-JIS
34853 Recognize JIS characters.
34854 @item C-SJIS
34855 Recognize SJIS characters.
34856 @item C-EUCJP
34857 Recognize EUCJP characters.
34858 @end table
34860 If @env{LANG} is not defined, or if it has some other value, then the
34861 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
34862 recognize and translate multibyte characters.
34864 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
34865 @findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
34866 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
34867 then additional text will be emitted to stderr when fix-it hints are
34868 emitted.  @option{-fdiagnostics-parseable-fixits} and
34869 @option{-fno-diagnostics-parseable-fixits} take precedence over this
34870 environment variable.
34872 @table @samp
34873 @item fixits-v1
34874 Emit parseable fix-it hints, equivalent to
34875 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
34876 expressed as a count of bytes, starting at byte 1 for the initial column.
34878 @item fixits-v2
34879 As @code{fixits-v1}, but columns are expressed as display columns,
34880 as per @option{-fdiagnostics-column-unit=display}.
34881 @end table
34883 @end table
34885 @noindent
34886 Some additional environment variables affect the behavior of the
34887 preprocessor.
34889 @include cppenv.texi
34891 @c man end
34893 @node Precompiled Headers
34894 @section Using Precompiled Headers
34895 @cindex precompiled headers
34896 @cindex speed of compilation
34898 Often large projects have many header files that are included in every
34899 source file.  The time the compiler takes to process these header files
34900 over and over again can account for nearly all of the time required to
34901 build the project.  To make builds faster, GCC allows you to
34902 @dfn{precompile} a header file.
34904 To create a precompiled header file, simply compile it as you would any
34905 other file, if necessary using the @option{-x} option to make the driver
34906 treat it as a C or C++ header file.  You may want to use a
34907 tool like @command{make} to keep the precompiled header up-to-date when
34908 the headers it contains change.
34910 A precompiled header file is searched for when @code{#include} is
34911 seen in the compilation.  As it searches for the included file
34912 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
34913 compiler looks for a precompiled header in each directory just before it
34914 looks for the include file in that directory.  The name searched for is
34915 the name specified in the @code{#include} with @samp{.gch} appended.  If
34916 the precompiled header file cannot be used, it is ignored.
34918 For instance, if you have @code{#include "all.h"}, and you have
34919 @file{all.h.gch} in the same directory as @file{all.h}, then the
34920 precompiled header file is used if possible, and the original
34921 header is used otherwise.
34923 Alternatively, you might decide to put the precompiled header file in a
34924 directory and use @option{-I} to ensure that directory is searched
34925 before (or instead of) the directory containing the original header.
34926 Then, if you want to check that the precompiled header file is always
34927 used, you can put a file of the same name as the original header in this
34928 directory containing an @code{#error} command.
34930 This also works with @option{-include}.  So yet another way to use
34931 precompiled headers, good for projects not designed with precompiled
34932 header files in mind, is to simply take most of the header files used by
34933 a project, include them from another header file, precompile that header
34934 file, and @option{-include} the precompiled header.  If the header files
34935 have guards against multiple inclusion, they are skipped because
34936 they've already been included (in the precompiled header).
34938 If you need to precompile the same header file for different
34939 languages, targets, or compiler options, you can instead make a
34940 @emph{directory} named like @file{all.h.gch}, and put each precompiled
34941 header in the directory, perhaps using @option{-o}.  It doesn't matter
34942 what you call the files in the directory; every precompiled header in
34943 the directory is considered.  The first precompiled header
34944 encountered in the directory that is valid for this compilation is
34945 used; they're searched in no particular order.
34947 There are many other possibilities, limited only by your imagination,
34948 good sense, and the constraints of your build system.
34950 A precompiled header file can be used only when these conditions apply:
34952 @itemize
34953 @item
34954 Only one precompiled header can be used in a particular compilation.
34956 @item
34957 A precompiled header cannot be used once the first C token is seen.  You
34958 can have preprocessor directives before a precompiled header; you cannot
34959 include a precompiled header from inside another header.
34961 @item
34962 The precompiled header file must be produced for the same language as
34963 the current compilation.  You cannot use a C precompiled header for a C++
34964 compilation.
34966 @item
34967 The precompiled header file must have been produced by the same compiler
34968 binary as the current compilation is using.
34970 @item
34971 Any macros defined before the precompiled header is included must
34972 either be defined in the same way as when the precompiled header was
34973 generated, or must not affect the precompiled header, which usually
34974 means that they don't appear in the precompiled header at all.
34976 The @option{-D} option is one way to define a macro before a
34977 precompiled header is included; using a @code{#define} can also do it.
34978 There are also some options that define macros implicitly, like
34979 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
34980 defined this way.
34982 @item If debugging information is output when using the precompiled
34983 header, using @option{-g} or similar, the same kind of debugging information
34984 must have been output when building the precompiled header.  However,
34985 a precompiled header built using @option{-g} can be used in a compilation
34986 when no debugging information is being output.
34988 @item The same @option{-m} options must generally be used when building
34989 and using the precompiled header.  @xref{Submodel Options},
34990 for any cases where this rule is relaxed.
34992 @item Each of the following options must be the same when building and using
34993 the precompiled header:
34995 @gccoptlist{-fexceptions}
34997 @item
34998 Some other command-line options starting with @option{-f},
34999 @option{-p}, or @option{-O} must be defined in the same way as when
35000 the precompiled header was generated.  At present, it's not clear
35001 which options are safe to change and which are not; the safest choice
35002 is to use exactly the same options when generating and using the
35003 precompiled header.  The following are known to be safe:
35005 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
35006 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
35007 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
35008 -pedantic-errors}
35010 @item Address space layout randomization (ASLR) can lead to not binary identical
35011 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
35012 PCH files.
35014 @end itemize
35016 For all of these except the last, the compiler automatically
35017 ignores the precompiled header if the conditions aren't met.  If you
35018 find an option combination that doesn't work and doesn't cause the
35019 precompiled header to be ignored, please consider filing a bug report,
35020 see @ref{Bugs}.
35022 If you do use differing options when generating and using the
35023 precompiled header, the actual behavior is a mixture of the
35024 behavior for the options.  For instance, if you use @option{-g} to
35025 generate the precompiled header but not when using it, you may or may
35026 not get debugging information for routines in the precompiled header.
35028 @node C++ Modules
35029 @section C++ Modules
35030 @cindex speed of compilation
35032 Modules are a C++20 language feature.  As the name suggests, they
35033 provides a modular compilation system, intending to provide both
35034 faster builds and better library isolation.  The ``Merging Modules''
35035 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
35036 of changes to the standard, although it does not capture later
35037 changes.
35039 @emph{G++'s modules support is not complete.}  Other than bugs, the
35040 known missing pieces are:
35042 @table @emph
35044 @item Private Module Fragment
35045 The Private Module Fragment is recognized, but an error is emitted.
35047 @item Partition definition visibility rules
35048 Entities may be defined in implementation partitions, and those
35049 definitions are not available outside of the module.  This is not
35050 implemented, and the definitions are available to extra-module use.
35052 @item Textual merging of reachable GM entities
35053 Entities may be multiply defined across different header-units.
35054 These must be de-duplicated, and this is implemented across imports,
35055 or when an import redefines a textually-defined entity.  However the
35056 reverse is not implemented---textually redefining an entity that has
35057 been defined in an imported header-unit.  A redefinition error is
35058 emitted.
35060 @item Translation-Unit local referencing rules
35061 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
35062 (@uref{https://wg21.link/p2003}) add limitations on which entities an
35063 exported region may reference (for instance, the entities an exported
35064 template definition may reference).  These are not fully implemented.
35066 @item Standard Library Header Units
35067 The Standard Library is not provided as importable header units.  If
35068 you want to import such units, you must explicitly build them first.
35069 If you do not do this with care, you may have multiple declarations,
35070 which the module machinery must merge---compiler resource usage can be
35071 affected by how you partition header files into header units.
35073 @end table
35075 Modular compilation is @emph{not} enabled with just the
35076 @option{-std=c++20} option.  You must explicitly enable it with the
35077 @option{-fmodules-ts} option.  It is independent of the language
35078 version selected, although in pre-C++20 versions, it is of course an
35079 extension.
35081 No new source file suffixes are required or supported.  If you wish to
35082 use a non-standard suffix (@pxref{Overall Options}), you also need
35083 to provide a @option{-x c++} option too.@footnote{Some users like to
35084 distinguish module interface files with a new suffix, such as naming
35085 the source @code{module.cppm}, which involves
35086 teaching all tools about the new suffix.  A different scheme, such as
35087 naming @code{module-m.cpp} would be less invasive.}
35089 Compiling a module interface unit produces an additional output (to
35090 the assembly or object file), called a Compiled Module Interface
35091 (CMI).  This encodes the exported declarations of the module.
35092 Importing a module reads in the CMI.  The import graph is a Directed
35093 Acyclic Graph (DAG).  You must build imports before the importer.
35095 Header files may themselves be compiled to header units, which are a
35096 transitional ability aiming at faster compilation.  The
35097 @option{-fmodule-header} option is used to enable this, and implies
35098 the @option{-fmodules-ts} option.  These CMIs are named by the fully
35099 resolved underlying header file, and thus may be a complete pathname
35100 containing subdirectories.  If the header file is found at an absolute
35101 pathname, the CMI location is still relative to a CMI root directory.
35103 As header files often have no suffix, you commonly have to specify a
35104 @option{-x} option to tell the compiler the source is a header file.
35105 You may use @option{-x c++-header}, @option{-x c++-user-header} or
35106 @option{-x c++-system-header}.  When used in conjunction with
35107 @option{-fmodules-ts}, these all imply an appropriate
35108 @option{-fmodule-header} option.  The latter two variants use the
35109 user or system include path to search for the file specified.  This
35110 allows you to, for instance, compile standard library header files as
35111 header units, without needing to know exactly where they are
35112 installed.  Specifying the language as one of these variants also
35113 inhibits output of the object file, as header files have no associated
35114 object file.
35116 The @option{-fmodule-only} option disables generation of the
35117 associated object file for compiling a module interface.  Only the CMI
35118 is generated.  This option is implied when using the
35119 @option{-fmodule-header} option.
35121 The @option{-flang-info-include-translate} and
35122 @option{-flang-info-include-translate-not} options notes whether
35123 include translation occurs or not.  With no argument, the first will
35124 note all include translation.  The second will note all
35125 non-translations of include files not known to intentionally be
35126 textual.  With an argument, queries about include translation of a
35127 header files with that particular trailing pathname are noted.  You
35128 may repeat this form to cover several different header files.  This
35129 option may be helpful in determining whether include translation is
35130 happening---if it is working correctly, it behaves as if it isn't
35131 there at all.
35133 The @option{-flang-info-module-cmi} option can be used to determine
35134 where the compiler is reading a CMI from.  Without the option, the
35135 compiler is silent when such a read is successful.  This option has an
35136 optional argument, which will restrict the notification to just the
35137 set of named modules or header units specified.
35139 The @option{-Winvalid-imported-macros} option causes all imported macros
35140 to be resolved at the end of compilation.  Without this, imported
35141 macros are only resolved when expanded or (re)defined.  This option
35142 detects conflicting import definitions for all macros.
35144 For details of the @option{-fmodule-mapper} family of options,
35145 @pxref{C++ Module Mapper}.
35147 @menu
35148 * C++ Module Mapper::       Module Mapper
35149 * C++ Module Preprocessing::  Module Preprocessing
35150 * C++ Compiled Module Interface:: Compiled Module Interface
35151 @end menu
35153 @node C++ Module Mapper
35154 @subsection Module Mapper
35155 @cindex C++ Module Mapper
35157 A module mapper provides a server or file that the compiler queries to
35158 determine the mapping between module names and CMI files.  It is also
35159 used to build CMIs on demand.  @emph{Mapper functionality is in its
35160 infancy and is intended for experimentation with build system
35161 interactions.}
35163 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
35164 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
35165 have one of the following forms:
35167 @table @gcctabopt
35169 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
35170 An optional hostname and a numeric port number to connect to.  If the
35171 hostname is omitted, the loopback address is used.  If the hostname
35172 corresponds to multiple IPV6 addresses, these are tried in turn, until
35173 one is successful.  If your host lacks IPv6, this form is
35174 non-functional.  If you must use IPv4 use
35175 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
35177 @item =@var{socket}@r{[}?@var{ident}@r{]}
35178 A local domain socket.  If your host lacks local domain sockets, this
35179 form is non-functional.
35181 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
35182 A program to spawn, and communicate with on its stdin/stdout streams.
35183 Your @var{PATH} environment variable is searched for the program.
35184 Arguments are separated by space characters, (it is not possible for
35185 one of the arguments delivered to the program to contain a space).  An
35186 exception is if @var{program} begins with @@.  In that case
35187 @var{program} (sans @@) is looked for in the compiler's internal
35188 binary directory.  Thus the sample mapper-server can be specified
35189 with @code{@@g++-mapper-server}.
35191 @item <>@r{[}?@var{ident}@r{]}
35192 @item <>@var{inout}@r{[}?@var{ident}@r{]}
35193 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
35194 Named pipes or file descriptors to communicate over.  The first form,
35195 @option{<>}, communicates over stdin and stdout.  The other forms
35196 allow you to specify a file descriptor or name a pipe.  A numeric value
35197 is interpreted as a file descriptor, otherwise named pipe is opened.
35198 The second form specifies a bidirectional pipe and the last form
35199 allows specifying two independent pipes.  Using file descriptors
35200 directly in this manner is fragile in general, as it can require the
35201 cooperation of intermediate processes.  In particular using stdin &
35202 stdout is fraught with danger as other compiler options might also
35203 cause the compiler to read stdin or write stdout, and it can have
35204 unfortunate interactions with signal delivery from the terminal.
35206 @item @var{file}@r{[}?@var{ident}@r{]}
35207 A mapping file consisting of space-separated module-name, filename
35208 pairs, one per line.  Only the mappings for the direct imports and any
35209 module export name need be provided.  If other mappings are provided,
35210 they override those stored in any imported CMI files.  A repository
35211 root may be specified in the mapping file by using @samp{$root} as the
35212 module name in the first active line.  Use of this option will disable
35213 any default module->CMI name mapping.
35215 @end table
35217 As shown, an optional @var{ident} may suffix the first word of the
35218 option, indicated by a @samp{?} prefix.  The value is used in the
35219 initial handshake with the module server, or to specify a prefix on
35220 mapping file lines.  In the server case, the main source file name is
35221 used if no @var{ident} is specified.  In the file case, all non-blank
35222 lines are significant, unless a value is specified, in which case only
35223 lines beginning with @var{ident} are significant.  The @var{ident}
35224 must be separated by whitespace from the module name.  Be aware that
35225 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
35226 significant to the shell, and therefore may need quoting.
35228 The mapper is connected to or loaded lazily, when the first module
35229 mapping is required.  The networking protocols are only supported on
35230 hosts that provide networking.  If no mapper is specified a default is
35231 provided.
35233 A project-specific mapper is expected to be provided by the build
35234 system that invokes the compiler.  It is not expected that a
35235 general-purpose server is provided for all compilations.  As such, the
35236 server will know the build configuration, the compiler it invoked, and
35237 the environment (such as working directory) in which that is
35238 operating.  As it may parallelize builds, several compilations may
35239 connect to the same socket.
35241 The default mapper generates CMI files in a @samp{gcm.cache}
35242 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
35243 is used directly to provide the basename.  Header units construct a
35244 relative path using the underlying header file name.  If the path is
35245 already relative, a @samp{,} directory is prepended.  Internal
35246 @samp{..} components are translated to @samp{,,}.  No attempt is made
35247 to canonicalize these filenames beyond that done by the preprocessor's
35248 include search algorithm, as in general it is ambiguous when symbolic
35249 links are present.
35251 The mapper protocol was published as ``A Module Mapper''
35252 @uref{https://wg21.link/p1184}.  The implementation is provided by
35253 @command{libcody}, @uref{https://github.com/urnathan/libcody},
35254 which specifies the canonical protocol definition.  A proof of concept
35255 server implementation embedded in @command{make} was described in
35256 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
35258 @node C++ Module Preprocessing
35259 @subsection Module Preprocessing
35260 @cindex C++ Module Preprocessing
35262 Modules affect preprocessing because of header units and include
35263 translation.  Some uses of the preprocessor as a separate step either
35264 do not produce a correct output, or require CMIs to be available.
35266 Header units import macros.  These macros can affect later conditional
35267 inclusion, which therefore can cascade to differing import sets.  When
35268 preprocessing, it is necessary to load the CMI.  If a header unit is
35269 unavailable, the preprocessor issues a warning and continue (when
35270 not just preprocessing, an error is emitted).  Detecting such imports
35271 requires preprocessor tokenization of the input stream to phase 4
35272 (macro expansion).
35274 Include translation converts @code{#include}, @code{#include_next} and
35275 @code{#import} directives to internal @code{import} declarations.
35276 Whether a particular directive is translated is controlled by the
35277 module mapper.  Header unit names are canonicalized during
35278 preprocessing.
35280 Dependency information can be emitted for macro import, extending the
35281 functionality of @option{-MD} and @option{-MMD} options.  Detection of
35282 import declarations also requires phase 4 preprocessing, and thus
35283 requires full preprocessing (or compilation).
35285 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
35286 preprocessing before phase 4.
35288 The @option{-save-temps} option uses @option{-fdirectives-only} for
35289 preprocessing, and preserve the macro definitions in the preprocessed
35290 output.  Usually you also want to use this option when explicitly
35291 preprocessing a header-unit, or consuming such preprocessed output:
35293 @smallexample
35294 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
35295 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
35296 @end smallexample
35298 @node C++ Compiled Module Interface
35299 @subsection Compiled Module Interface
35300 @cindex C++ Compiled Module Interface
35302 CMIs are an additional artifact when compiling named module
35303 interfaces, partitions or header units.  These are read when
35304 importing.  CMI contents are implementation-specific, and in GCC's
35305 case tied to the compiler version.  Consider them a rebuildable cache
35306 artifact, not a distributable object.
35308 When creating an output CMI, any missing directory components are
35309 created in a manner that is safe for concurrent builds creating
35310 multiple, different, CMIs within a common subdirectory tree.
35312 CMI contents are written to a temporary file, which is then atomically
35313 renamed.  Observers either see old contents (if there is an
35314 existing file), or complete new contents.  They do not observe the
35315 CMI during its creation.  This is unlike object file writing, which
35316 may be observed by an external process.
35318 CMIs are read in lazily, if the host OS provides @code{mmap}
35319 functionality.  Generally blocks are read when name lookup or template
35320 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
35321 option may be used.
35323 The @option{--param lazy-modules=@var{n}} parameter controls the limit
35324 on the number of concurrently open module files during lazy loading.
35325 Should more modules be imported, an LRU algorithm is used to determine
35326 which files to close---until that file is needed again.  This limit
35327 may be exceeded with deep module dependency hierarchies.  With large
35328 code bases there may be more imports than the process limit of file
35329 descriptors.  By default, the limit is a few less than the per-process
35330 file descriptor hard limit, if that is determinable.@footnote{Where
35331 applicable the soft limit is incremented as needed towards the hard limit.}
35333 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
35334 You may use @command{readelf} to inspect them, although section
35335 contents are largely undecipherable.  There is a section named
35336 @code{.gnu.c++.README}, which contains human-readable text.  Other
35337 than the first line, each line consists of @code{@var{tag}: @code{value}}
35338 tuples.
35340 @smallexample
35341 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
35343 String dump of section '.gnu.c++.README':
35344   [     0]  GNU C++ primary module interface
35345   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
35346   [    6f]  version: 2020/11/16-04:54
35347   [    89]  module: foo
35348   [    95]  source: c_b.ii
35349   [    a4]  dialect: C++20/coroutines
35350   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
35351   [    ee]  repository: gcm.cache
35352   [   104]  buildtime: 2020/11/16 15:03:21 UTC
35353   [   127]  localtime: 2020/11/16 07:03:21 PST
35354   [   14a]  export: foo:part1 foo-part1.gcm
35355 @end smallexample
35357 Amongst other things, this lists the source that was built, C++
35358 dialect used and imports of the module.@footnote{The precise contents
35359 of this output may change.} The timestamp is the same value as that
35360 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
35361 explicitly specified with the environment variable
35362 @code{SOURCE_DATE_EPOCH}.  For further details
35363 @pxref{Environment Variables}.
35365 A set of related CMIs may be copied, provided the relative pathnames
35366 are preserved.
35368 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
35369 it may be removed or altered.  The section numbering of the sections
35370 whose names do not begin with @code{.gnu.c++.}, or are not the string
35371 section is significant and must not be altered.