Fix support for atomic loads and stores on hppa.
[official-gcc.git] / gcc / doc / invoke.texi
blobdec0cdb9d35058a5c20f4655b8d96033236734f8
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-2023 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  -fopenmp-target-simd-clone@r{[}=@var{device-type}@r{]} @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-constexpr -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 -Wstrict-flex-arrays @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-phase-mismatch @gol
457 -Wno-analyzer-fd-type-mismatch @gol
458 -Wno-analyzer-fd-use-after-close @gol
459 -Wno-analyzer-fd-use-without-check @gol
460 -Wno-analyzer-file-leak @gol
461 -Wno-analyzer-free-of-non-heap @gol
462 -Wno-analyzer-imprecise-fp-arithmetic @gol
463 -Wno-analyzer-infinite-recursion @gol
464 -Wno-analyzer-jump-through-null @gol
465 -Wno-analyzer-malloc-leak @gol
466 -Wno-analyzer-mismatching-deallocation @gol
467 -Wno-analyzer-null-argument @gol
468 -Wno-analyzer-null-dereference @gol
469 -Wno-analyzer-out-of-bounds @gol
470 -Wno-analyzer-possible-null-argument @gol
471 -Wno-analyzer-possible-null-dereference @gol
472 -Wno-analyzer-putenv-of-auto-var @gol
473 -Wno-analyzer-shift-count-negative @gol
474 -Wno-analyzer-shift-count-overflow @gol
475 -Wno-analyzer-stale-setjmp-buffer @gol
476 -Wno-analyzer-tainted-allocation-size @gol
477 -Wno-analyzer-tainted-assertion @gol
478 -Wno-analyzer-tainted-array-index @gol
479 -Wno-analyzer-tainted-divisor @gol
480 -Wno-analyzer-tainted-offset @gol
481 -Wno-analyzer-tainted-size @gol
482 -Wanalyzer-too-complex @gol
483 -Wno-analyzer-unsafe-call-within-signal-handler @gol
484 -Wno-analyzer-use-after-free @gol
485 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
486 -Wno-analyzer-use-of-uninitialized-value @gol
487 -Wno-analyzer-va-arg-type-mismatch @gol
488 -Wno-analyzer-va-list-exhausted @gol
489 -Wno-analyzer-va-list-leak @gol
490 -Wno-analyzer-va-list-use-after-va-end @gol
491 -Wno-analyzer-write-to-const @gol
492 -Wno-analyzer-write-to-string-literal @gol
495 @item C and Objective-C-only Warning Options
496 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
497 -Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
498 -Wold-style-declaration  -Wold-style-definition @gol
499 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
500 -Wdeclaration-after-statement  -Wpointer-sign}
502 @item Debugging Options
503 @xref{Debugging Options,,Options for Debugging Your Program}.
504 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version} @gol
505 -gbtf -gctf  -gctf@var{level} @gol
506 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
507 -gstrict-dwarf  -gno-strict-dwarf @gol
508 -gas-loc-support  -gno-as-loc-support @gol
509 -gas-locview-support  -gno-as-locview-support @gol
510 -gcolumn-info  -gno-column-info  -gdwarf32  -gdwarf64 @gol
511 -gstatement-frontiers  -gno-statement-frontiers @gol
512 -gvariable-location-views  -gno-variable-location-views @gol
513 -ginternal-reset-location-views  -gno-internal-reset-location-views @gol
514 -ginline-points  -gno-inline-points @gol
515 -gvms -gz@r{[}=@var{type}@r{]} @gol
516 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies @gol
517 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
518 -fno-eliminate-unused-debug-types @gol
519 -femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol
520 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
521 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
522 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
523 -fvar-tracking  -fvar-tracking-assignments}
525 @item Optimization Options
526 @xref{Optimize Options,,Options that Control Optimization}.
527 @gccoptlist{-faggressive-loop-optimizations @gol
528 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
529 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
530 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
531 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
532 -fno-allocation-dce -fallow-store-data-races @gol
533 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}] @gol
534 -fauto-inc-dec  -fbranch-probabilities @gol
535 -fcaller-saves @gol
536 -fcombine-stack-adjustments  -fconserve-stack @gol
537 -fcompare-elim  -fcprop-registers  -fcrossjumping @gol
538 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules @gol
539 -fcx-limited-range @gol
540 -fdata-sections  -fdce  -fdelayed-branch @gol
541 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively @gol
542 -fdevirtualize-at-ltrans  -fdse @gol
543 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects @gol
544 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style} @gol
545 -ffinite-loops @gol
546 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections @gol
547 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity @gol
548 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion @gol
549 -fif-conversion2  -findirect-inlining @gol
550 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n} @gol
551 -finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone @gol
552 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const @gol
553 -fipa-reference  -fipa-reference-addressable @gol
554 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm} @gol
555 -flive-patching=@var{level} @gol
556 -fira-region=@var{region}  -fira-hoist-pressure @gol
557 -fira-loop-pressure  -fno-ira-share-save-slots @gol
558 -fno-ira-share-spill-slots @gol
559 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute @gol
560 -fivopts  -fkeep-inline-functions  -fkeep-static-functions @gol
561 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage @gol
562 -floop-block  -floop-interchange  -floop-strip-mine @gol
563 -floop-unroll-and-jam  -floop-nest-optimize @gol
564 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level @gol
565 -flto-partition=@var{alg}  -fmerge-all-constants @gol
566 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves @gol
567 -fmove-loop-invariants  -fmove-loop-stores  -fno-branch-count-reg @gol
568 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse @gol
569 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole @gol
570 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock @gol
571 -fno-sched-spec  -fno-signed-zeros @gol
572 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss @gol
573 -fomit-frame-pointer  -foptimize-sibling-calls @gol
574 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning @gol
575 -fprefetch-loop-arrays @gol
576 -fprofile-correction @gol
577 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training @gol
578 -fprofile-values -fprofile-reorder-functions @gol
579 -freciprocal-math  -free  -frename-registers  -freorder-blocks @gol
580 -freorder-blocks-algorithm=@var{algorithm} @gol
581 -freorder-blocks-and-partition  -freorder-functions @gol
582 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops @gol
583 -frounding-math  -fsave-optimization-record @gol
584 -fsched2-use-superblocks  -fsched-pressure @gol
585 -fsched-spec-load  -fsched-spec-load-dangerous @gol
586 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}] @gol
587 -fsched-group-heuristic  -fsched-critical-path-heuristic @gol
588 -fsched-spec-insn-heuristic  -fsched-rank-heuristic @gol
589 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic @gol
590 -fschedule-fusion @gol
591 -fschedule-insns  -fschedule-insns2  -fsection-anchors @gol
592 -fselective-scheduling  -fselective-scheduling2 @gol
593 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops @gol
594 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate @gol
595 -fsignaling-nans @gol
596 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops@gol
597 -fsplit-paths @gol
598 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt @gol
599 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing @gol
600 -fthread-jumps  -ftracer  -ftree-bit-ccp @gol
601 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch @gol
602 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts @gol
603 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting @gol
604 -ftree-loop-if-convert  -ftree-loop-im @gol
605 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns @gol
606 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize @gol
607 -ftree-loop-vectorize @gol
608 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta @gol
609 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra @gol
610 -ftree-switch-conversion  -ftree-tail-merge @gol
611 -ftree-ter  -ftree-vectorize  -ftree-vrp  -ftrivial-auto-var-init @gol
612 -funconstrained-commons -funit-at-a-time  -funroll-all-loops @gol
613 -funroll-loops -funsafe-math-optimizations  -funswitch-loops @gol
614 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt @gol
615 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs @gol
616 --param @var{name}=@var{value}
617 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og  -Oz}
619 @item Program Instrumentation Options
620 @xref{Instrumentation Options,,Program Instrumentation Options}.
621 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage @gol
622 -fprofile-abs-path @gol
623 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path} @gol
624 -fprofile-info-section  -fprofile-info-section=@var{name} @gol
625 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
626 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
627 -fprofile-exclude-files=@var{regex} @gol
628 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol
629 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style} @gol
630 -fsanitize-trap   -fsanitize-trap=@var{style}  @gol
631 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},... @gol
632 -fsanitize-undefined-trap-on-error  -fbounds-check @gol
633 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
634 -fharden-compares -fharden-conditional-branches @gol
635 -fstack-protector  -fstack-protector-all  -fstack-protector-strong @gol
636 -fstack-protector-explicit  -fstack-check @gol
637 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
638 -fno-stack-limit  -fsplit-stack @gol
639 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
640 -fvtv-counts  -fvtv-debug @gol
641 -finstrument-functions  -finstrument-functions-once @gol
642 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
643 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} @gol
644 -fprofile-prefix-map=@var{old}=@var{new}
646 @item Preprocessor Options
647 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
648 @gccoptlist{-A@var{question}=@var{answer} @gol
649 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
650 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]} @gol
651 -dD  -dI  -dM  -dN  -dU @gol
652 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers  @gol
653 -fexec-charset=@var{charset}  -fextended-identifiers  @gol
654 -finput-charset=@var{charset}  -flarge-source-files  @gol
655 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
656 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess  @gol
657 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion  @gol
658 -fwide-exec-charset=@var{charset}  -fworking-directory @gol
659 -H  -imacros @var{file}  -include @var{file} @gol
660 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules @gol
661 -no-integrated-cpp  -P  -pthread  -remap @gol
662 -traditional  -traditional-cpp  -trigraphs @gol
663 -U@var{macro}  -undef  @gol
664 -Wp,@var{option}  -Xpreprocessor @var{option}}
666 @item Assembler Options
667 @xref{Assembler Options,,Passing Options to the Assembler}.
668 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
670 @item Linker Options
671 @xref{Link Options,,Options for Linking}.
672 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
673 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib  -nostdlib++ @gol
674 -e @var{entry}  --entry=@var{entry} @gol
675 -pie  -pthread  -r  -rdynamic @gol
676 -s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
677 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan @gol
678 -shared  -shared-libgcc  -symbolic @gol
679 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
680 -u @var{symbol}  -z @var{keyword}}
682 @item Directory Options
683 @xref{Directory Options,,Options for Directory Search}.
684 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I- @gol
685 -idirafter @var{dir} @gol
686 -imacros @var{file}  -imultilib @var{dir} @gol
687 -iplugindir=@var{dir}  -iprefix @var{file} @gol
688 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir} @gol
689 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}  @gol
690 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix @gol
691 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
693 @item Code Generation Options
694 @xref{Code Gen Options,,Options for Code Generation Conventions}.
695 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
696 -ffixed-@var{reg}  -fexceptions @gol
697 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
698 -fasynchronous-unwind-tables @gol
699 -fno-gnu-unique @gol
700 -finhibit-size-directive  -fcommon  -fno-ident @gol
701 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
702 -fno-jump-tables -fno-bit-tests @gol
703 -frecord-gcc-switches @gol
704 -freg-struct-return  -fshort-enums  -fshort-wchar @gol
705 -fverbose-asm  -fpack-struct[=@var{n}]  @gol
706 -fleading-underscore  -ftls-model=@var{model} @gol
707 -fstack-reuse=@var{reuse_level} @gol
708 -ftrampolines  -ftrapv  -fwrapv @gol
709 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
710 -fstrict-volatile-bitfields  -fsync-libcalls}
712 @item Developer Options
713 @xref{Developer Options,,GCC Developer Options}.
714 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
715 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
716 -fchecking  -fchecking=@var{n}
717 -fdbg-cnt-list @gol  -fdbg-cnt=@var{counter-value-list} @gol
718 -fdisable-ipa-@var{pass_name} @gol
719 -fdisable-rtl-@var{pass_name} @gol
720 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
721 -fdisable-tree-@var{pass_name} @gol
722 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
723 -fdump-debug  -fdump-earlydebug @gol
724 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
725 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
726 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
727 -fdump-lang-all @gol
728 -fdump-lang-@var{switch} @gol
729 -fdump-lang-@var{switch}-@var{options} @gol
730 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
731 -fdump-passes @gol
732 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
733 -fdump-statistics @gol
734 -fdump-tree-all @gol
735 -fdump-tree-@var{switch} @gol
736 -fdump-tree-@var{switch}-@var{options} @gol
737 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
738 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
739 -fenable-@var{kind}-@var{pass} @gol
740 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
741 -fira-verbose=@var{n} @gol
742 -flto-report  -flto-report-wpa  -fmem-report-wpa @gol
743 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report @gol
744 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
745 -fmultiflags  -fprofile-report @gol
746 -frandom-seed=@var{string}  -fsched-verbose=@var{n} @gol
747 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose @gol
748 -fstats  -fstack-usage  -ftime-report  -ftime-report-details @gol
749 -fvar-tracking-assignments-toggle  -gtoggle @gol
750 -print-file-name=@var{library}  -print-libgcc-file-name @gol
751 -print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
752 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
753 -print-sysroot  -print-sysroot-headers-suffix @gol
754 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
756 @item Machine-Dependent Options
757 @xref{Submodel Options,,Machine-Dependent Options}.
758 @c This list is ordered alphanumerically by subsection name.
759 @c Try and put the significant identifier (CPU or system) first,
760 @c so users have a clue at guessing where the ones they want will be.
762 @emph{AArch64 Options}
763 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian @gol
764 -mgeneral-regs-only @gol
765 -mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
766 -mstrict-align  -mno-strict-align @gol
767 -momit-leaf-frame-pointer @gol
768 -mtls-dialect=desc  -mtls-dialect=traditional @gol
769 -mtls-size=@var{size} @gol
770 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419 @gol
771 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div @gol
772 -mpc-relative-literal-loads @gol
773 -msign-return-address=@var{scope} @gol
774 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
775 +@var{b-key}]|@var{bti} @gol
776 -mharden-sls=@var{opts} @gol
777 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}  @gol
778 -moverride=@var{string}  -mverbose-cost-dump @gol
779 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
780 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
781 -moutline-atomics }
783 @emph{Adapteva Epiphany Options}
784 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs @gol
785 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf @gol
786 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num} @gol
787 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16 @gol
788 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num} @gol
789 -msplit-vecmove-early  -m1reg-@var{reg}}
791 @emph{AMD GCN Options}
792 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
794 @emph{ARC Options}
795 @gccoptlist{-mbarrel-shifter  -mjli-always @gol
796 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700 @gol
797 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr @gol
798 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic @gol
799 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap @gol
800 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape @gol
801 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof @gol
802 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved @gol
803 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num} @gol
804 -mvolatile-cache  -mtp-regno=@var{regno} @gol
805 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc @gol
806 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi @gol
807 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none @gol
808 -mlra-priority-compact -mlra-priority-noncompact  -mmillicode @gol
809 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level} @gol
810 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame @gol
811 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo} @gol
812 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
814 @emph{ARM Options}
815 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
816 -mabi=@var{name} @gol
817 -mapcs-stack-check  -mno-apcs-stack-check @gol
818 -mapcs-reentrant  -mno-apcs-reentrant @gol
819 -mgeneral-regs-only @gol
820 -msched-prolog  -mno-sched-prolog @gol
821 -mlittle-endian  -mbig-endian @gol
822 -mbe8  -mbe32 @gol
823 -mfloat-abi=@var{name} @gol
824 -mfp16-format=@var{name}
825 -mthumb-interwork  -mno-thumb-interwork @gol
826 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
827 -mtune=@var{name}  -mprint-tune-info @gol
828 -mstructure-size-boundary=@var{n} @gol
829 -mabort-on-noreturn @gol
830 -mlong-calls  -mno-long-calls @gol
831 -msingle-pic-base  -mno-single-pic-base @gol
832 -mpic-register=@var{reg} @gol
833 -mnop-fun-dllimport @gol
834 -mpoke-function-name @gol
835 -mthumb  -marm  -mflip-thumb @gol
836 -mtpcs-frame  -mtpcs-leaf-frame @gol
837 -mcaller-super-interworking  -mcallee-super-interworking @gol
838 -mtp=@var{name}  -mtls-dialect=@var{dialect} @gol
839 -mword-relocations @gol
840 -mfix-cortex-m3-ldrd @gol
841 -mfix-cortex-a57-aes-1742098 @gol
842 -mfix-cortex-a72-aes-1655431 @gol
843 -munaligned-access @gol
844 -mneon-for-64bits @gol
845 -mslow-flash-data @gol
846 -masm-syntax-unified @gol
847 -mrestrict-it @gol
848 -mverbose-cost-dump @gol
849 -mpure-code @gol
850 -mcmse @gol
851 -mfix-cmse-cve-2021-35465 @gol
852 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset} @gol
853 -mfdpic}
855 @emph{AVR Options}
856 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
857 -mbranch-cost=@var{cost} @gol
858 -mcall-prologues  -mgas-isr-prologues  -mint8 @gol
859 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
860 -mn_flash=@var{size}  -mno-interrupts @gol
861 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack @gol
862 -mfract-convert-truncate @gol
863 -mshort-calls  -nodevicelib  -nodevicespecs @gol
864 -Waddr-space-convert  -Wmisspelled-isr}
866 @emph{Blackfin Options}
867 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
868 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
869 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
870 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
871 -mno-id-shared-library  -mshared-library-id=@var{n} @gol
872 -mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
873 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
874 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram @gol
875 -micplb}
877 @emph{C6X Options}
878 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu} @gol
879 -msim  -msdata=@var{sdata-type}}
881 @emph{CRIS Options}
882 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}
883 -mtune=@var{cpu} -mmax-stack-frame=@var{n} @gol
884 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
885 -mstack-align  -mdata-align  -mconst-align @gol
886 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue @gol
887 -melf  -maout  -sim  -sim2 @gol
888 -mmul-bug-workaround  -mno-mul-bug-workaround}
890 @emph{C-SKY Options}
891 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu} @gol
892 -mbig-endian  -EB  -mlittle-endian  -EL @gol
893 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu @gol
894 -mfloat-abi=@var{name} @gol
895 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust @gol
896 -mdsp  -medsp  -mvdsp @gol
897 -mdiv  -msmart  -mhigh-registers  -manchor @gol
898 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt @gol
899 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
901 @emph{Darwin Options}
902 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
903 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
904 -client_name  -compatibility_version  -current_version @gol
905 -dead_strip @gol
906 -dependency-file  -dylib_file  -dylinker_install_name @gol
907 -dynamic  -dynamiclib  -exported_symbols_list @gol
908 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
909 -force_flat_namespace  -headerpad_max_install_names @gol
910 -iframework @gol
911 -image_base  -init  -install_name  -keep_private_externs @gol
912 -multi_module  -multiply_defined  -multiply_defined_unused @gol
913 -noall_load   -no_dead_strip_inits_and_terms @gol
914 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit @gol
915 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
916 -private_bundle  -read_only_relocs  -sectalign @gol
917 -sectobjectsymbols  -whyload  -seg1addr @gol
918 -sectcreate  -sectobjectsymbols  -sectorder @gol
919 -segaddr  -segs_read_only_addr  -segs_read_write_addr @gol
920 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
921 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
922 -single_module  -static  -sub_library  -sub_umbrella @gol
923 -twolevel_namespace  -umbrella  -undefined @gol
924 -unexported_symbols_list  -weak_reference_mismatches @gol
925 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version} @gol
926 -mkernel  -mone-byte-bool}
928 @emph{DEC Alpha Options}
929 @gccoptlist{-mno-fp-regs  -msoft-float @gol
930 -mieee  -mieee-with-inexact  -mieee-conformant @gol
931 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
932 -mtrap-precision=@var{mode}  -mbuild-constants @gol
933 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
934 -mbwx  -mmax  -mfix  -mcix @gol
935 -mfloat-vax  -mfloat-ieee @gol
936 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
937 -msmall-text  -mlarge-text @gol
938 -mmemory-latency=@var{time}}
940 @emph{eBPF Options}
941 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
942 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re
943 -mjmpext -mjmp32 -malu32 -mcpu=@var{version}}
945 @emph{FR30 Options}
946 @gccoptlist{-msmall-model  -mno-lsim}
948 @emph{FT32 Options}
949 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
951 @emph{FRV Options}
952 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
953 -mhard-float  -msoft-float @gol
954 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
955 -mdouble  -mno-double @gol
956 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
957 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic @gol
958 -mlinked-fp  -mlong-calls  -malign-labels @gol
959 -mlibrary-pic  -macc-4  -macc-8 @gol
960 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
961 -moptimize-membar  -mno-optimize-membar @gol
962 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
963 -mvliw-branch  -mno-vliw-branch @gol
964 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
965 -mno-nested-cond-exec  -mtomcat-stats @gol
966 -mTLS  -mtls @gol
967 -mcpu=@var{cpu}}
969 @emph{GNU/Linux Options}
970 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid @gol
971 -tno-android-cc  -tno-android-ld}
973 @emph{H8/300 Options}
974 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
976 @emph{HPPA Options}
977 @gccoptlist{-march=@var{architecture-type} @gol
978 -matomic-libcalls  -mbig-switch @gol
979 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
980 -mordered  -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
981 -mfixed-range=@var{register-range} @gol
982 -mcoherent-ldcw -mjump-in-delay  -mlinker-opt  -mlong-calls @gol
983 -mlong-load-store  -mno-atomic-libcalls  -mno-disable-fpregs @gol
984 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
985 -mno-jump-in-delay  -mno-long-load-store @gol
986 -mno-portable-runtime  -mno-soft-float @gol
987 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
988 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
989 -mschedule=@var{cpu-type}  -mspace-regs  -msoft-mult  -msio  -mwsio @gol
990 -munix=@var{unix-std}  -nolibdld  -static  -threads}
992 @emph{IA-64 Options}
993 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
994 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata @gol
995 -mconstant-gp  -mauto-pic  -mfused-madd @gol
996 -minline-float-divide-min-latency @gol
997 -minline-float-divide-max-throughput @gol
998 -mno-inline-float-divide @gol
999 -minline-int-divide-min-latency @gol
1000 -minline-int-divide-max-throughput  @gol
1001 -mno-inline-int-divide @gol
1002 -minline-sqrt-min-latency  -minline-sqrt-max-throughput @gol
1003 -mno-inline-sqrt @gol
1004 -mdwarf2-asm  -mearly-stop-bits @gol
1005 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size} @gol
1006 -mtune=@var{cpu-type}  -milp32  -mlp64 @gol
1007 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec @gol
1008 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec @gol
1009 -msched-spec-ldc  -msched-spec-control-ldc @gol
1010 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns @gol
1011 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path @gol
1012 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost @gol
1013 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
1015 @emph{LM32 Options}
1016 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled @gol
1017 -msign-extend-enabled  -muser-enabled}
1019 @emph{LoongArch Options}
1020 @gccoptlist{-march=@var{cpu-type}  -mtune=@var{cpu-type} -mabi=@var{base-abi-type} @gol
1021 -mfpu=@var{fpu-type} -msoft-float -msingle-float -mdouble-float @gol
1022 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division @gol
1023 -mcond-move-int  -mno-cond-move-int @gol
1024 -mcond-move-float  -mno-cond-move-float @gol
1025 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align @gol
1026 -mmax-inline-memcpy-size=@var{n} @gol
1027 -mexplicit-relocs -mno-explicit-relocs @gol
1028 -mdirect-extern-access -mno-direct-extern-access @gol
1029 -mcmodel=@var{code-model}}
1031 @emph{M32R/D Options}
1032 @gccoptlist{-m32r2  -m32rx  -m32r @gol
1033 -mdebug @gol
1034 -malign-loops  -mno-align-loops @gol
1035 -missue-rate=@var{number} @gol
1036 -mbranch-cost=@var{number} @gol
1037 -mmodel=@var{code-size-model-type} @gol
1038 -msdata=@var{sdata-type} @gol
1039 -mno-flush-func  -mflush-func=@var{name} @gol
1040 -mno-flush-trap  -mflush-trap=@var{number} @gol
1041 -G @var{num}}
1043 @emph{M32C Options}
1044 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1046 @emph{M680x0 Options}
1047 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune} @gol
1048 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
1049 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
1050 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
1051 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
1052 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
1053 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
1054 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
1055 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1057 @emph{MCore Options}
1058 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
1059 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
1060 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
1061 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
1062 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1064 @emph{MicroBlaze Options}
1065 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
1066 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
1067 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
1068 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
1069 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model} @gol
1070 -mpic-data-is-text-relative}
1072 @emph{MIPS Options}
1073 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
1074 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5 @gol
1075 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6 @gol
1076 -mips16  -mno-mips16  -mflip-mips16 @gol
1077 -minterlink-compressed  -mno-interlink-compressed @gol
1078 -minterlink-mips16  -mno-interlink-mips16 @gol
1079 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
1080 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
1081 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
1082 -mno-float  -msingle-float  -mdouble-float @gol
1083 -modd-spreg  -mno-odd-spreg @gol
1084 -mabs=@var{mode}  -mnan=@var{encoding} @gol
1085 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
1086 -mmcu  -mmno-mcu @gol
1087 -meva  -mno-eva @gol
1088 -mvirt  -mno-virt @gol
1089 -mxpa  -mno-xpa @gol
1090 -mcrc  -mno-crc @gol
1091 -mginv  -mno-ginv @gol
1092 -mmicromips  -mno-micromips @gol
1093 -mmsa  -mno-msa @gol
1094 -mloongson-mmi  -mno-loongson-mmi @gol
1095 -mloongson-ext  -mno-loongson-ext @gol
1096 -mloongson-ext2  -mno-loongson-ext2 @gol
1097 -mfpu=@var{fpu-type} @gol
1098 -msmartmips  -mno-smartmips @gol
1099 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
1100 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
1101 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
1102 -G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
1103 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
1104 -membedded-data  -mno-embedded-data @gol
1105 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
1106 -mcode-readable=@var{setting} @gol
1107 -msplit-addresses  -mno-split-addresses @gol
1108 -mexplicit-relocs  -mno-explicit-relocs @gol
1109 -mcheck-zero-division  -mno-check-zero-division @gol
1110 -mdivide-traps  -mdivide-breaks @gol
1111 -mload-store-pairs  -mno-load-store-pairs @gol
1112 -munaligned-access  -mno-unaligned-access @gol
1113 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
1114 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp @gol
1115 -mfix-24k  -mno-fix-24k @gol
1116 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
1117 -mfix-r5900  -mno-fix-r5900 @gol
1118 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000 @gol
1119 -mfix-vr4120  -mno-fix-vr4120 @gol
1120 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
1121 -mflush-func=@var{func}  -mno-flush-func @gol
1122 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
1123 -mcompact-branches=@var{policy} @gol
1124 -mfp-exceptions  -mno-fp-exceptions @gol
1125 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci @gol
1126 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4 @gol
1127 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address @gol
1128 -mframe-header-opt  -mno-frame-header-opt}
1130 @emph{MMIX Options}
1131 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
1132 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
1133 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
1134 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1136 @emph{MN10300 Options}
1137 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
1138 -mno-am33  -mam33  -mam33-2  -mam34 @gol
1139 -mtune=@var{cpu-type} @gol
1140 -mreturn-pointer-on-d0 @gol
1141 -mno-crt0  -mrelax  -mliw  -msetlb}
1143 @emph{Moxie Options}
1144 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1146 @emph{MSP430 Options}
1147 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax @gol
1148 -mwarn-mcu @gol
1149 -mcode-region=  -mdata-region= @gol
1150 -msilicon-errata=  -msilicon-errata-warn= @gol
1151 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1153 @emph{NDS32 Options}
1154 @gccoptlist{-mbig-endian  -mlittle-endian @gol
1155 -mreduced-regs  -mfull-regs @gol
1156 -mcmov  -mno-cmov @gol
1157 -mext-perf  -mno-ext-perf @gol
1158 -mext-perf2  -mno-ext-perf2 @gol
1159 -mext-string  -mno-ext-string @gol
1160 -mv3push  -mno-v3push @gol
1161 -m16bit  -mno-16bit @gol
1162 -misr-vector-size=@var{num} @gol
1163 -mcache-block-size=@var{num} @gol
1164 -march=@var{arch} @gol
1165 -mcmodel=@var{code-model} @gol
1166 -mctor-dtor  -mrelax}
1168 @emph{Nios II Options}
1169 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt @gol
1170 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp} @gol
1171 -mel  -meb @gol
1172 -mno-bypass-cache  -mbypass-cache @gol
1173 -mno-cache-volatile  -mcache-volatile @gol
1174 -mno-fast-sw-div  -mfast-sw-div @gol
1175 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div @gol
1176 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn} @gol
1177 -mcustom-fpu-cfg=@var{name} @gol
1178 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name} @gol
1179 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1181 @emph{Nvidia PTX Options}
1182 @gccoptlist{-m64  -mmainkernel  -moptimize}
1184 @emph{OpenRISC Options}
1185 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
1186 -msoft-mul  -msoft-div @gol
1187 -msoft-float  -mhard-float  -mdouble-float -munordered-float @gol
1188 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm @gol
1189 -mcmodel=@var{code-model}}
1191 @emph{PDP-11 Options}
1192 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
1193 -mint32  -mno-int16  -mint16  -mno-int32 @gol
1194 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1196 @emph{PowerPC Options}
1197 See RS/6000 and PowerPC Options.
1199 @emph{PRU Options}
1200 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop @gol
1201 -mabi=@var{variant}}
1203 @emph{RISC-V Options}
1204 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1205 -mplt  -mno-plt @gol
1206 -mabi=@var{ABI-string} @gol
1207 -mfdiv  -mno-fdiv @gol
1208 -mdiv  -mno-div @gol
1209 -misa-spec=@var{ISA-spec-string} @gol
1210 -march=@var{ISA-string} @gol
1211 -mtune=@var{processor-string} @gol
1212 -mpreferred-stack-boundary=@var{num} @gol
1213 -msmall-data-limit=@var{N-bytes} @gol
1214 -msave-restore  -mno-save-restore @gol
1215 -mshorten-memrefs  -mno-shorten-memrefs @gol
1216 -mstrict-align  -mno-strict-align @gol
1217 -mcmodel=medlow  -mcmodel=medany @gol
1218 -mexplicit-relocs  -mno-explicit-relocs @gol
1219 -mrelax  -mno-relax @gol
1220 -mriscv-attribute  -mno-riscv-attribute @gol
1221 -malign-data=@var{type} @gol
1222 -mbig-endian  -mlittle-endian @gol
1223 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg} @gol
1224 -mstack-protector-guard-offset=@var{offset} @gol
1225 -mcsr-check -mno-csr-check}
1227 @emph{RL78 Options}
1228 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
1229 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14 @gol
1230 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1232 @emph{RS/6000 and PowerPC Options}
1233 @gccoptlist{-mcpu=@var{cpu-type} @gol
1234 -mtune=@var{cpu-type} @gol
1235 -mcmodel=@var{code-model} @gol
1236 -mpowerpc64 @gol
1237 -maltivec  -mno-altivec @gol
1238 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
1239 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
1240 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd @gol
1241 -mfprnd  -mno-fprnd @gol
1242 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp @gol
1243 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
1244 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
1245 -malign-power  -malign-natural @gol
1246 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
1247 -mupdate  -mno-update @gol
1248 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
1249 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
1250 -mstrict-align  -mno-strict-align  -mrelocatable @gol
1251 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
1252 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
1253 -mdynamic-no-pic  -mswdiv  -msingle-pic-base @gol
1254 -mprioritize-restricted-insns=@var{priority} @gol
1255 -msched-costly-dep=@var{dependence_type} @gol
1256 -minsert-sched-nops=@var{scheme} @gol
1257 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd  @gol
1258 -mcall-linux  -mcall-netbsd  -mcall-openbsd  @gol
1259 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi @gol
1260 -mtraceback=@var{traceback_type} @gol
1261 -maix-struct-return  -msvr4-struct-return @gol
1262 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt @gol
1263 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq  @gol
1264 -mblock-move-inline-limit=@var{num} @gol
1265 -mblock-compare-inline-limit=@var{num} @gol
1266 -mblock-compare-inline-loop-limit=@var{num} @gol
1267 -mno-block-ops-unaligned-vsx @gol
1268 -mstring-compare-inline-limit=@var{num} @gol
1269 -misel  -mno-isel @gol
1270 -mvrsave  -mno-vrsave @gol
1271 -mmulhw  -mno-mulhw @gol
1272 -mdlmzb  -mno-dlmzb @gol
1273 -mprototype  -mno-prototype @gol
1274 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
1275 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num} @gol
1276 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision @gol
1277 -mno-recip-precision @gol
1278 -mveclibabi=@var{type}  -mfriz  -mno-friz @gol
1279 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions @gol
1280 -msave-toc-indirect  -mno-save-toc-indirect @gol
1281 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector @gol
1282 -mcrypto  -mno-crypto  -mhtm  -mno-htm @gol
1283 -mquad-memory  -mno-quad-memory @gol
1284 -mquad-memory-atomic  -mno-quad-memory-atomic @gol
1285 -mcompat-align-parm  -mno-compat-align-parm @gol
1286 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware @gol
1287 -mgnu-attribute  -mno-gnu-attribute @gol
1288 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1289 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1290 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol
1291 -mprivileged -mno-privileged}
1293 @emph{RX Options}
1294 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
1295 -mcpu=@gol
1296 -mbig-endian-data  -mlittle-endian-data @gol
1297 -msmall-data @gol
1298 -msim  -mno-sim@gol
1299 -mas100-syntax  -mno-as100-syntax@gol
1300 -mrelax@gol
1301 -mmax-constant-size=@gol
1302 -mint-register=@gol
1303 -mpid@gol
1304 -mallow-string-insns  -mno-allow-string-insns@gol
1305 -mjsr@gol
1306 -mno-warn-multiple-fast-interrupts@gol
1307 -msave-acc-in-interrupts}
1309 @emph{S/390 and zSeries Options}
1310 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1311 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp @gol
1312 -mlong-double-64  -mlong-double-128 @gol
1313 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack @gol
1314 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
1315 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
1316 -mhtm  -mvx  -mzvector @gol
1317 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip @gol
1318 -mfused-madd  -mno-fused-madd @gol
1319 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard @gol
1320 -mhotpatch=@var{halfwords},@var{halfwords}}
1322 @emph{SH Options}
1323 @gccoptlist{-m1  -m2  -m2e @gol
1324 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a @gol
1325 -m3  -m3e @gol
1326 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
1327 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al @gol
1328 -mb  -ml  -mdalign  -mrelax @gol
1329 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave @gol
1330 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct @gol
1331 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy} @gol
1332 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range} @gol
1333 -maccumulate-outgoing-args @gol
1334 -matomic-model=@var{atomic-model} @gol
1335 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch @gol
1336 -mcbranch-force-delay-slot @gol
1337 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra @gol
1338 -mpretend-cmove  -mtas}
1340 @emph{Solaris 2 Options}
1341 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text @gol
1342 -pthreads}
1344 @emph{SPARC Options}
1345 @gccoptlist{-mcpu=@var{cpu-type} @gol
1346 -mtune=@var{cpu-type} @gol
1347 -mcmodel=@var{code-model} @gol
1348 -mmemory-model=@var{mem-model} @gol
1349 -m32  -m64  -mapp-regs  -mno-app-regs @gol
1350 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
1351 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1352 -mhard-quad-float  -msoft-quad-float @gol
1353 -mstack-bias  -mno-stack-bias @gol
1354 -mstd-struct-return  -mno-std-struct-return @gol
1355 -munaligned-doubles  -mno-unaligned-doubles @gol
1356 -muser-mode  -mno-user-mode @gol
1357 -mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
1358 -mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
1359 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b @gol
1360 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld  @gol
1361 -mpopc  -mno-popc  -msubxc  -mno-subxc @gol
1362 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc @gol
1363 -mlra  -mno-lra}
1365 @emph{System V Options}
1366 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1368 @emph{V850 Options}
1369 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
1370 -mprolog-function  -mno-prolog-function  -mspace @gol
1371 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
1372 -mapp-regs  -mno-app-regs @gol
1373 -mdisable-callt  -mno-disable-callt @gol
1374 -mv850e2v3  -mv850e2  -mv850e1  -mv850es @gol
1375 -mv850e  -mv850  -mv850e3v5 @gol
1376 -mloop @gol
1377 -mrelax @gol
1378 -mlong-jumps @gol
1379 -msoft-float @gol
1380 -mhard-float @gol
1381 -mgcc-abi @gol
1382 -mrh850-abi @gol
1383 -mbig-switch}
1385 @emph{VAX Options}
1386 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1388 @emph{Visium Options}
1389 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1390 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1392 @emph{VMS Options}
1393 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64 @gol
1394 -mpointer-size=@var{size}}
1396 @emph{VxWorks Options}
1397 @gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
1398 -Xbind-lazy  -Xbind-now}
1400 @emph{x86 Options}
1401 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1402 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default @gol
1403 -mfpmath=@var{unit} @gol
1404 -masm=@var{dialect}  -mno-fancy-math-387 @gol
1405 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float @gol
1406 -mno-wide-multiply  -mrtd  -malign-double @gol
1407 -mpreferred-stack-boundary=@var{num} @gol
1408 -mincoming-stack-boundary=@var{num} @gol
1409 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait @gol
1410 -mrecip  -mrecip=@var{opt} @gol
1411 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt} @gol
1412 -mmove-max=@var{bits} -mstore-max=@var{bits} @gol
1413 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx @gol
1414 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl @gol
1415 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes @gol
1416 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd  @gol
1417 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves @gol
1418 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
1419 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp @gol
1420 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg @gol
1421 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call @gol
1422 -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1423 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq @gol
1424 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid @gol
1425 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1426 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni@gol
1427 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16 @gol
1428 -mprefetchi -mraoint @gol
1429 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
1430 -minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
1431 -mkl -mwidekl @gol
1432 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
1433 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
1434 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128 @gol
1435 -mregparm=@var{num}  -msseregparm @gol
1436 -mveclibabi=@var{type}  -mvect8-ret-in-mem @gol
1437 -mpc32  -mpc64  -mpc80  -mdaz-ftz -mstackrealign @gol
1438 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs @gol
1439 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode} @gol
1440 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num} @gol
1441 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
1442 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1443 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
1444 -malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
1445 -mstack-protector-guard-reg=@var{reg} @gol
1446 -mstack-protector-guard-offset=@var{offset} @gol
1447 -mstack-protector-guard-symbol=@var{symbol} @gol
1448 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop @gol
1449 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice} @gol
1450 -mindirect-branch-register -mharden-sls=@var{choice} @gol
1451 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access @gol
1452 -munroll-only-small-loops -mlam=@var{choice}}
1454 @emph{x86 Windows Options}
1455 @gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
1456 -mnop-fun-dllimport  -mthread @gol
1457 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1459 @emph{Xstormy16 Options}
1460 @gccoptlist{-msim}
1462 @emph{Xtensa Options}
1463 @gccoptlist{-mconst16  -mno-const16 @gol
1464 -mfused-madd  -mno-fused-madd @gol
1465 -mforce-no-pic @gol
1466 -mserialize-volatile  -mno-serialize-volatile @gol
1467 -mtext-section-literals  -mno-text-section-literals @gol
1468 -mauto-litpools  -mno-auto-litpools @gol
1469 -mtarget-align  -mno-target-align @gol
1470 -mlongcalls  -mno-longcalls @gol
1471 -mabi=@var{abi-type} @gol
1472 -mextra-l32r-costs=@var{cycles}}
1474 @emph{zSeries Options}
1475 See S/390 and zSeries Options.
1476 @end table
1479 @node Overall Options
1480 @section Options Controlling the Kind of Output
1482 Compilation can involve up to four stages: preprocessing, compilation
1483 proper, assembly and linking, always in that order.  GCC is capable of
1484 preprocessing and compiling several files either into several
1485 assembler input files, or into one assembler input file; then each
1486 assembler input file produces an object file, and linking combines all
1487 the object files (those newly compiled, and those specified as input)
1488 into an executable file.
1490 @cindex file name suffix
1491 For any given input file, the file name suffix determines what kind of
1492 compilation is done:
1494 @table @gcctabopt
1495 @item @var{file}.c
1496 C source code that must be preprocessed.
1498 @item @var{file}.i
1499 C source code that should not be preprocessed.
1501 @item @var{file}.ii
1502 C++ source code that should not be preprocessed.
1504 @item @var{file}.m
1505 Objective-C source code.  Note that you must link with the @file{libobjc}
1506 library to make an Objective-C program work.
1508 @item @var{file}.mi
1509 Objective-C source code that should not be preprocessed.
1511 @item @var{file}.mm
1512 @itemx @var{file}.M
1513 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1514 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1515 to a literal capital M@.
1517 @item @var{file}.mii
1518 Objective-C++ source code that should not be preprocessed.
1520 @item @var{file}.h
1521 C, C++, Objective-C or Objective-C++ header file to be turned into a
1522 precompiled header (default), or C, C++ header file to be turned into an
1523 Ada spec (via the @option{-fdump-ada-spec} switch).
1525 @item @var{file}.cc
1526 @itemx @var{file}.cp
1527 @itemx @var{file}.cxx
1528 @itemx @var{file}.cpp
1529 @itemx @var{file}.CPP
1530 @itemx @var{file}.c++
1531 @itemx @var{file}.C
1532 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1533 the last two letters must both be literally @samp{x}.  Likewise,
1534 @samp{.C} refers to a literal capital C@.
1536 @item @var{file}.mm
1537 @itemx @var{file}.M
1538 Objective-C++ source code that must be preprocessed.
1540 @item @var{file}.mii
1541 Objective-C++ source code that should not be preprocessed.
1543 @item @var{file}.hh
1544 @itemx @var{file}.H
1545 @itemx @var{file}.hp
1546 @itemx @var{file}.hxx
1547 @itemx @var{file}.hpp
1548 @itemx @var{file}.HPP
1549 @itemx @var{file}.h++
1550 @itemx @var{file}.tcc
1551 C++ header file to be turned into a precompiled header or Ada spec.
1553 @item @var{file}.f
1554 @itemx @var{file}.for
1555 @itemx @var{file}.ftn
1556 Fixed form Fortran source code that should not be preprocessed.
1558 @item @var{file}.F
1559 @itemx @var{file}.FOR
1560 @itemx @var{file}.fpp
1561 @itemx @var{file}.FPP
1562 @itemx @var{file}.FTN
1563 Fixed form Fortran source code that must be preprocessed (with the traditional
1564 preprocessor).
1566 @item @var{file}.f90
1567 @itemx @var{file}.f95
1568 @itemx @var{file}.f03
1569 @itemx @var{file}.f08
1570 Free form Fortran source code that should not be preprocessed.
1572 @item @var{file}.F90
1573 @itemx @var{file}.F95
1574 @itemx @var{file}.F03
1575 @itemx @var{file}.F08
1576 Free form Fortran source code that must be preprocessed (with the
1577 traditional preprocessor).
1579 @item @var{file}.go
1580 Go source code.
1582 @item @var{file}.d
1583 D source code.
1585 @item @var{file}.di
1586 D interface file.
1588 @item @var{file}.dd
1589 D documentation code (Ddoc).
1591 @item @var{file}.ads
1592 Ada source code file that contains a library unit declaration (a
1593 declaration of a package, subprogram, or generic, or a generic
1594 instantiation), or a library unit renaming declaration (a package,
1595 generic, or subprogram renaming declaration).  Such files are also
1596 called @dfn{specs}.
1598 @item @var{file}.adb
1599 Ada source code file containing a library unit body (a subprogram or
1600 package body).  Such files are also called @dfn{bodies}.
1602 @c GCC also knows about some suffixes for languages not yet included:
1603 @c Ratfor:
1604 @c @var{file}.r
1606 @item @var{file}.s
1607 Assembler code.
1609 @item @var{file}.S
1610 @itemx @var{file}.sx
1611 Assembler code that must be preprocessed.
1613 @item @var{other}
1614 An object file to be fed straight into linking.
1615 Any file name with no recognized suffix is treated this way.
1616 @end table
1618 @opindex x
1619 You can specify the input language explicitly with the @option{-x} option:
1621 @table @gcctabopt
1622 @item -x @var{language}
1623 Specify explicitly the @var{language} for the following input files
1624 (rather than letting the compiler choose a default based on the file
1625 name suffix).  This option applies to all following input files until
1626 the next @option{-x} option.  Possible values for @var{language} are:
1627 @smallexample
1628 c  c-header  cpp-output
1629 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1630 objective-c  objective-c-header  objective-c-cpp-output
1631 objective-c++ objective-c++-header objective-c++-cpp-output
1632 assembler  assembler-with-cpp
1635 f77  f77-cpp-input f95  f95-cpp-input
1637 @end smallexample
1639 @item -x none
1640 Turn off any specification of a language, so that subsequent files are
1641 handled according to their file name suffixes (as they are if @option{-x}
1642 has not been used at all).
1643 @end table
1645 If you only want some of the stages of compilation, you can use
1646 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1647 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1648 @command{gcc} is to stop.  Note that some combinations (for example,
1649 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1651 @table @gcctabopt
1652 @item -c
1653 @opindex c
1654 Compile or assemble the source files, but do not link.  The linking
1655 stage simply is not done.  The ultimate output is in the form of an
1656 object file for each source file.
1658 By default, the object file name for a source file is made by replacing
1659 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1661 Unrecognized input files, not requiring compilation or assembly, are
1662 ignored.
1664 @item -S
1665 @opindex S
1666 Stop after the stage of compilation proper; do not assemble.  The output
1667 is in the form of an assembler code file for each non-assembler input
1668 file specified.
1670 By default, the assembler file name for a source file is made by
1671 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1673 Input files that don't require compilation are ignored.
1675 @item -E
1676 @opindex E
1677 Stop after the preprocessing stage; do not run the compiler proper.  The
1678 output is in the form of preprocessed source code, which is sent to the
1679 standard output.
1681 Input files that don't require preprocessing are ignored.
1683 @cindex output file option
1684 @item -o @var{file}
1685 @opindex o
1686 Place the primary output in file @var{file}.  This applies to whatever
1687 sort of output is being produced, whether it be an executable file, an
1688 object file, an assembler file or preprocessed C code.
1690 If @option{-o} is not specified, the default is to put an executable
1691 file in @file{a.out}, the object file for
1692 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1693 assembler file in @file{@var{source}.s}, a precompiled header file in
1694 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1695 standard output.
1697 Though @option{-o} names only the primary output, it also affects the
1698 naming of auxiliary and dump outputs.  See the examples below.  Unless
1699 overridden, both auxiliary outputs and dump outputs are placed in the
1700 same directory as the primary output.  In auxiliary outputs, the suffix
1701 of the input file is replaced with that of the auxiliary output file
1702 type; in dump outputs, the suffix of the dump file is appended to the
1703 input file suffix.  In compilation commands, the base name of both
1704 auxiliary and dump outputs is that of the primary output; in compile and
1705 link commands, the primary output name, minus the executable suffix, is
1706 combined with the input file name.  If both share the same base name,
1707 disregarding the suffix, the result of the combination is that base
1708 name, otherwise, they are concatenated, separated by a dash.
1710 @smallexample
1711 gcc -c foo.c ...
1712 @end smallexample
1714 will use @file{foo.o} as the primary output, and place aux outputs and
1715 dumps next to it, e.g., aux file @file{foo.dwo} for
1716 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1717 @option{-fdump-rtl-final}.
1719 If a non-linker output file is explicitly specified, aux and dump files
1720 by default take the same base name:
1722 @smallexample
1723 gcc -c foo.c -o dir/foobar.o ...
1724 @end smallexample
1726 will name aux outputs @file{dir/foobar.*} and dump outputs
1727 @file{dir/foobar.c.*}.
1729 A linker output will instead prefix aux and dump outputs:
1731 @smallexample
1732 gcc foo.c bar.c -o dir/foobar ...
1733 @end smallexample
1735 will generally name aux outputs @file{dir/foobar-foo.*} and
1736 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1737 @file{dir/foobar-bar.c.*}.
1739 The one exception to the above is when the executable shares the base
1740 name with the single input:
1742 @smallexample
1743 gcc foo.c -o dir/foo ...
1744 @end smallexample
1746 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1747 named @file{dir/foo.c.*}.
1749 The location and the names of auxiliary and dump outputs can be adjusted
1750 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1751 @option{-dumpdir}, @option{-save-temps=cwd}, and
1752 @option{-save-temps=obj}.
1755 @item -dumpbase @var{dumpbase}
1756 @opindex dumpbase
1757 This option sets the base name for auxiliary and dump output files.  It
1758 does not affect the name of the primary output file.  Intermediate
1759 outputs, when preserved, are not regarded as primary outputs, but as
1760 auxiliary outputs:
1762 @smallexample
1763 gcc -save-temps -S foo.c
1764 @end smallexample
1766 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1767 then compiles to the (implied) output file @file{foo.s}, whereas:
1769 @smallexample
1770 gcc -save-temps -dumpbase save-foo -c foo.c
1771 @end smallexample
1773 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1774 an intermediate, thus auxiliary output), and then assembles to the
1775 (implied) output file @file{foo.o}.
1777 Absent this option, dump and aux files take their names from the input
1778 file, or from the (non-linker) output file, if one is explicitly
1779 specified: dump output files (e.g. those requested by @option{-fdump-*}
1780 options) with the input name suffix, and aux output files (those
1781 requested by other non-dump options, e.g. @code{-save-temps},
1782 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1784 Similar suffix differentiation of dump and aux outputs can be attained
1785 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1786 @option{-dumpbase-ext .suf}.
1788 If @var{dumpbase} is explicitly specified with any directory component,
1789 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1790 @option{-save-temps=*}) is ignored, and instead of appending to it,
1791 @var{dumpbase} fully overrides it:
1793 @smallexample
1794 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1795   -dumpdir pfx- -save-temps=cwd ...
1796 @end smallexample
1798 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1799 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1800 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1802 When @option{-dumpbase} is specified in a command that compiles multiple
1803 inputs, or that compiles and then links, it may be combined with
1804 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1805 file is compiled using the combined @var{dumppfx}, and default values
1806 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1807 file:
1809 @smallexample
1810 gcc foo.c bar.c -c -dumpbase main ...
1811 @end smallexample
1813 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1814 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1815 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1816 and @file{main-bar.*}.
1818 An empty string specified as @var{dumpbase} avoids the influence of the
1819 output basename in the naming of auxiliary and dump outputs during
1820 compilation, computing default values :
1822 @smallexample
1823 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1824 @end smallexample
1826 will name aux outputs @file{dir/foo.*} and dump outputs
1827 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1828 name, but the directory still defaults to that of the output.
1830 The empty-string dumpbase does not prevent the use of the output
1831 basename for outputs during linking:
1833 @smallexample
1834 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1835 @end smallexample
1837 The compilation of the source files will name auxiliary outputs
1838 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1839 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1840 linking will use @file{dir/foobar.} as the prefix for dumps and
1841 auxiliary files.
1844 @item -dumpbase-ext @var{auxdropsuf}
1845 @opindex dumpbase-ext
1846 When forming the name of an auxiliary (but not a dump) output file, drop
1847 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1848 suffixes.  If not specified, this option defaults to the suffix of a
1849 default @var{dumpbase}, i.e., the suffix of the input file when
1850 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1851 is combined with @var{dumppfx}.
1853 @smallexample
1854 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1855 @end smallexample
1857 creates @file{dir/foo.o} as the main output, and generates auxiliary
1858 outputs in @file{dir/x-foo.*}, taking the location of the primary
1859 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1860 outputs retain the suffix: @file{dir/x-foo.c.*}.
1862 This option is disregarded if it does not match the suffix of a
1863 specified @var{dumpbase}, except as an alternative to the executable
1864 suffix when appending the linker output base name to @var{dumppfx}, as
1865 specified below:
1867 @smallexample
1868 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1869 @end smallexample
1871 creates @file{main.out} as the primary output, and avoids overwriting
1872 the auxiliary and dump outputs by using the executable name minus
1873 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1874 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1875 @file{main-foo.c.*} and @file{main-bar.c.*}.
1878 @item -dumpdir @var{dumppfx}
1879 @opindex dumpdir
1880 When forming the name of an auxiliary or dump output file, use
1881 @var{dumppfx} as a prefix:
1883 @smallexample
1884 gcc -dumpdir pfx- -c foo.c ...
1885 @end smallexample
1887 creates @file{foo.o} as the primary output, and auxiliary outputs named
1888 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1889 @var{dumpbase} derived from the default primary output, derived in turn
1890 from the input name.  Dump outputs also take the input name suffix:
1891 @file{pfx-foo.c.*}.
1893 If @var{dumppfx} is to be used as a directory name, it must end with a
1894 directory separator:
1896 @smallexample
1897 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1898 @end smallexample
1900 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1901 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1902 default @var{dumpbase} derived from the primary output name.  Dump
1903 outputs also take the input name suffix: @file{dir/bar.c.*}.
1905 It defaults to the location of the output file, unless the output
1906 file is a special file like @code{/dev/null}. Options
1907 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1908 default, just like an explicit @option{-dumpdir} option.  In case
1909 multiple such options are given, the last one prevails:
1911 @smallexample
1912 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1913 @end smallexample
1915 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1916 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1917 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1918 default for @option{-save-temps}, nor that the output directory is
1919 implicitly the current directory.  Dump outputs are named
1920 @file{foo.c.*}.
1922 When compiling from multiple input files, if @option{-dumpbase} is
1923 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1924 are appended to (or override, if containing any directory components) an
1925 explicit or defaulted @var{dumppfx}, so that each of the multiple
1926 compilations gets differently-named aux and dump outputs.
1928 @smallexample
1929 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1930 @end smallexample
1932 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1933 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1934 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1935 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1936 single-input compilation:
1938 @smallexample
1939 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1940 @end smallexample
1942 that, applying @option{-dumpbase} to a single source, does not compute
1943 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1944 dump outputs go in @file{dir/pfx-main.*}.
1946 When compiling and then linking from multiple input files, a defaulted
1947 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1948 transformation above (e.g. the compilation of @file{foo.c} and
1949 @file{bar.c} above, but without @option{-c}).  If neither
1950 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1951 base name, minus @var{auxdropsuf}, if specified, or the executable
1952 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1953 instead.  Note, however, that unlike earlier cases of linking:
1955 @smallexample
1956 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1957 @end smallexample
1959 does not append the output name @file{main} to @var{dumppfx}, because
1960 @option{-dumpdir} is explicitly specified.  The goal is that the
1961 explicitly-specified @var{dumppfx} may contain the specified output name
1962 as part of the prefix, if desired; only an explicitly-specified
1963 @option{-dumpbase} would be combined with it, in order to avoid simply
1964 discarding a meaningful option.
1966 When compiling and then linking from a single input file, the linker
1967 output base name will only be appended to the default @var{dumppfx} as
1968 above if it does not share the base name with the single input file
1969 name.  This has been covered in single-input linking cases above, but
1970 not with an explicit @option{-dumpdir} that inhibits the combination,
1971 even if overridden by @option{-save-temps=*}:
1973 @smallexample
1974 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1975 @end smallexample
1977 Auxiliary outputs are named @file{foo.*}, and dump outputs
1978 @file{foo.c.*}, in the current working directory as ultimately requested
1979 by @option{-save-temps=cwd}.
1981 Summing it all up for an intuitive though slightly imprecise data flow:
1982 the primary output name is broken into a directory part and a basename
1983 part; @var{dumppfx} is set to the former, unless overridden by
1984 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1985 to the latter, unless overriden by @option{-dumpbase}.  If there are
1986 multiple inputs or linking, this @var{dumpbase} may be combined with
1987 @var{dumppfx} and taken from each input file.  Auxiliary output names
1988 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1989 minus suffix, and the auxiliary output suffix; dump output names are
1990 only different in that the suffix from @var{dumpbase} is retained.
1992 When it comes to auxiliary and dump outputs created during LTO
1993 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1994 given or as derived from the linker output name but not from inputs,
1995 even in cases in which this combination would not otherwise be used as
1996 such, is passed down with a trailing period replacing the compiler-added
1997 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1998 being involved in linking, this program does not normally get any
1999 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2001 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2002 names to the received @var{dumppfx}, ensures it contains a directory
2003 component so that it overrides any @option{-dumpdir}, and passes that as
2004 @option{-dumpbase} to sub-compilers.
2006 @item -v
2007 @opindex v
2008 Print (on standard error output) the commands executed to run the stages
2009 of compilation.  Also print the version number of the compiler driver
2010 program and of the preprocessor and the compiler proper.
2012 @item -###
2013 @opindex ###
2014 Like @option{-v} except the commands are not executed and arguments
2015 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2016 This is useful for shell scripts to capture the driver-generated command lines.
2018 @item --help
2019 @opindex help
2020 Print (on the standard output) a description of the command-line options
2021 understood by @command{gcc}.  If the @option{-v} option is also specified
2022 then @option{--help} is also passed on to the various processes
2023 invoked by @command{gcc}, so that they can display the command-line options
2024 they accept.  If the @option{-Wextra} option has also been specified
2025 (prior to the @option{--help} option), then command-line options that
2026 have no documentation associated with them are also displayed.
2028 @item --target-help
2029 @opindex target-help
2030 Print (on the standard output) a description of target-specific command-line
2031 options for each tool.  For some targets extra target-specific
2032 information may also be printed.
2034 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2035 Print (on the standard output) a description of the command-line
2036 options understood by the compiler that fit into all specified classes
2037 and qualifiers.  These are the supported classes:
2039 @table @asis
2040 @item @samp{optimizers}
2041 Display all of the optimization options supported by the
2042 compiler.
2044 @item @samp{warnings}
2045 Display all of the options controlling warning messages
2046 produced by the compiler.
2048 @item @samp{target}
2049 Display target-specific options.  Unlike the
2050 @option{--target-help} option however, target-specific options of the
2051 linker and assembler are not displayed.  This is because those
2052 tools do not currently support the extended @option{--help=} syntax.
2054 @item @samp{params}
2055 Display the values recognized by the @option{--param}
2056 option.
2058 @item @var{language}
2059 Display the options supported for @var{language}, where
2060 @var{language} is the name of one of the languages supported in this
2061 version of GCC@.  If an option is supported by all languages, one needs
2062 to select @samp{common} class.
2064 @item @samp{common}
2065 Display the options that are common to all languages.
2066 @end table
2068 These are the supported qualifiers:
2070 @table @asis
2071 @item @samp{undocumented}
2072 Display only those options that are undocumented.
2074 @item @samp{joined}
2075 Display options taking an argument that appears after an equal
2076 sign in the same continuous piece of text, such as:
2077 @samp{--help=target}.
2079 @item @samp{separate}
2080 Display options taking an argument that appears as a separate word
2081 following the original option, such as: @samp{-o output-file}.
2082 @end table
2084 Thus for example to display all the undocumented target-specific
2085 switches supported by the compiler, use:
2087 @smallexample
2088 --help=target,undocumented
2089 @end smallexample
2091 The sense of a qualifier can be inverted by prefixing it with the
2092 @samp{^} character, so for example to display all binary warning
2093 options (i.e., ones that are either on or off and that do not take an
2094 argument) that have a description, use:
2096 @smallexample
2097 --help=warnings,^joined,^undocumented
2098 @end smallexample
2100 The argument to @option{--help=} should not consist solely of inverted
2101 qualifiers.
2103 Combining several classes is possible, although this usually
2104 restricts the output so much that there is nothing to display.  One
2105 case where it does work, however, is when one of the classes is
2106 @var{target}.  For example, to display all the target-specific
2107 optimization options, use:
2109 @smallexample
2110 --help=target,optimizers
2111 @end smallexample
2113 The @option{--help=} option can be repeated on the command line.  Each
2114 successive use displays its requested class of options, skipping
2115 those that have already been displayed.  If @option{--help} is also
2116 specified anywhere on the command line then this takes precedence
2117 over any @option{--help=} option.
2119 If the @option{-Q} option appears on the command line before the
2120 @option{--help=} option, then the descriptive text displayed by
2121 @option{--help=} is changed.  Instead of describing the displayed
2122 options, an indication is given as to whether the option is enabled,
2123 disabled or set to a specific value (assuming that the compiler
2124 knows this at the point where the @option{--help=} option is used).
2126 Here is a truncated example from the ARM port of @command{gcc}:
2128 @smallexample
2129   % gcc -Q -mabi=2 --help=target -c
2130   The following options are target specific:
2131   -mabi=                                2
2132   -mabort-on-noreturn                   [disabled]
2133   -mapcs                                [disabled]
2134 @end smallexample
2136 The output is sensitive to the effects of previous command-line
2137 options, so for example it is possible to find out which optimizations
2138 are enabled at @option{-O2} by using:
2140 @smallexample
2141 -Q -O2 --help=optimizers
2142 @end smallexample
2144 Alternatively you can discover which binary optimizations are enabled
2145 by @option{-O3} by using:
2147 @smallexample
2148 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2149 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2150 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2151 @end smallexample
2153 @item --version
2154 @opindex version
2155 Display the version number and copyrights of the invoked GCC@.
2157 @item -pass-exit-codes
2158 @opindex pass-exit-codes
2159 Normally the @command{gcc} program exits with the code of 1 if any
2160 phase of the compiler returns a non-success return code.  If you specify
2161 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2162 the numerically highest error produced by any phase returning an error
2163 indication.  The C, C++, and Fortran front ends return 4 if an internal
2164 compiler error is encountered.
2166 @item -pipe
2167 @opindex pipe
2168 Use pipes rather than temporary files for communication between the
2169 various stages of compilation.  This fails to work on some systems where
2170 the assembler is unable to read from a pipe; but the GNU assembler has
2171 no trouble.
2173 @item -specs=@var{file}
2174 @opindex specs
2175 Process @var{file} after the compiler reads in the standard @file{specs}
2176 file, in order to override the defaults which the @command{gcc} driver
2177 program uses when determining what switches to pass to @command{cc1},
2178 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2179 @option{-specs=@var{file}} can be specified on the command line, and they
2180 are processed in order, from left to right.  @xref{Spec Files}, for
2181 information about the format of the @var{file}.
2183 @item -wrapper
2184 @opindex wrapper
2185 Invoke all subcommands under a wrapper program.  The name of the
2186 wrapper program and its parameters are passed as a comma separated
2187 list.
2189 @smallexample
2190 gcc -c t.c -wrapper gdb,--args
2191 @end smallexample
2193 @noindent
2194 This invokes all subprograms of @command{gcc} under
2195 @samp{gdb --args}, thus the invocation of @command{cc1} is
2196 @samp{gdb --args cc1 @dots{}}.
2198 @item -ffile-prefix-map=@var{old}=@var{new}
2199 @opindex ffile-prefix-map
2200 When compiling files residing in directory @file{@var{old}}, record
2201 any references to them in the result of the compilation as if the
2202 files resided in directory @file{@var{new}} instead.  Specifying this
2203 option is equivalent to specifying all the individual
2204 @option{-f*-prefix-map} options.  This can be used to make reproducible
2205 builds that are location independent.  Directories referenced by
2206 directives are not affected by these options. See also
2207 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map} and
2208 @option{-fprofile-prefix-map}.
2210 @item -fplugin=@var{name}.so
2211 @opindex fplugin
2212 Load the plugin code in file @var{name}.so, assumed to be a
2213 shared object to be dlopen'd by the compiler.  The base name of
2214 the shared object file is used to identify the plugin for the
2215 purposes of argument parsing (See
2216 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2217 Each plugin should define the callback functions specified in the
2218 Plugins API.
2220 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2221 @opindex fplugin-arg
2222 Define an argument called @var{key} with a value of @var{value}
2223 for the plugin called @var{name}.
2225 @item -fdump-ada-spec@r{[}-slim@r{]}
2226 @opindex fdump-ada-spec
2227 For C and C++ source and include files, generate corresponding Ada specs.
2228 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2229 GNAT User's Guide}, which provides detailed documentation on this feature.
2231 @item -fada-spec-parent=@var{unit}
2232 @opindex fada-spec-parent
2233 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2234 Ada specs as child units of parent @var{unit}.
2236 @item -fdump-go-spec=@var{file}
2237 @opindex fdump-go-spec
2238 For input files in any language, generate corresponding Go
2239 declarations in @var{file}.  This generates Go @code{const},
2240 @code{type}, @code{var}, and @code{func} declarations which may be a
2241 useful way to start writing a Go interface to code written in some
2242 other language.
2244 @include @value{srcdir}/../libiberty/at-file.texi
2245 @end table
2247 @node Invoking G++
2248 @section Compiling C++ Programs
2250 @cindex suffixes for C++ source
2251 @cindex C++ source file suffixes
2252 C++ source files conventionally use one of the suffixes @samp{.C},
2253 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2254 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2255 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2256 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2257 files with these names and compiles them as C++ programs even if you
2258 call the compiler the same way as for compiling C programs (usually
2259 with the name @command{gcc}).
2261 @findex g++
2262 @findex c++
2263 However, the use of @command{gcc} does not add the C++ library.
2264 @command{g++} is a program that calls GCC and automatically specifies linking
2265 against the C++ library.  It treats @samp{.c},
2266 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2267 files unless @option{-x} is used.  This program is also useful when
2268 precompiling a C header file with a @samp{.h} extension for use in C++
2269 compilations.  On many systems, @command{g++} is also installed with
2270 the name @command{c++}.
2272 @cindex invoking @command{g++}
2273 When you compile C++ programs, you may specify many of the same
2274 command-line options that you use for compiling programs in any
2275 language; or command-line options meaningful for C and related
2276 languages; or options that are meaningful only for C++ programs.
2277 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2278 explanations of options for languages related to C@.
2279 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2280 explanations of options that are meaningful only for C++ programs.
2282 @node C Dialect Options
2283 @section Options Controlling C Dialect
2284 @cindex dialect options
2285 @cindex language dialect options
2286 @cindex options, dialect
2288 The following options control the dialect of C (or languages derived
2289 from C, such as C++, Objective-C and Objective-C++) that the compiler
2290 accepts:
2292 @table @gcctabopt
2293 @cindex ANSI support
2294 @cindex ISO support
2295 @item -ansi
2296 @opindex ansi
2297 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2298 equivalent to @option{-std=c++98}.
2300 This turns off certain features of GCC that are incompatible with ISO
2301 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2302 such as the @code{asm} and @code{typeof} keywords, and
2303 predefined macros such as @code{unix} and @code{vax} that identify the
2304 type of system you are using.  It also enables the undesirable and
2305 rarely used ISO trigraph feature.  For the C compiler,
2306 it disables recognition of C++ style @samp{//} comments as well as
2307 the @code{inline} keyword.
2309 The alternate keywords @code{__asm__}, @code{__extension__},
2310 @code{__inline__} and @code{__typeof__} continue to work despite
2311 @option{-ansi}.  You would not want to use them in an ISO C program, of
2312 course, but it is useful to put them in header files that might be included
2313 in compilations done with @option{-ansi}.  Alternate predefined macros
2314 such as @code{__unix__} and @code{__vax__} are also available, with or
2315 without @option{-ansi}.
2317 The @option{-ansi} option does not cause non-ISO programs to be
2318 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2319 addition to @option{-ansi}.  @xref{Warning Options}.
2321 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2322 option is used.  Some header files may notice this macro and refrain
2323 from declaring certain functions or defining certain macros that the
2324 ISO standard doesn't call for; this is to avoid interfering with any
2325 programs that might use these names for other things.
2327 Functions that are normally built in but do not have semantics
2328 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2329 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2330 built-in functions provided by GCC}, for details of the functions
2331 affected.
2333 @item -std=
2334 @opindex std
2335 Determine the language standard. @xref{Standards,,Language Standards
2336 Supported by GCC}, for details of these standard versions.  This option
2337 is currently only supported when compiling C or C++.
2339 The compiler can accept several base standards, such as @samp{c90} or
2340 @samp{c++98}, and GNU dialects of those standards, such as
2341 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2342 compiler accepts all programs following that standard plus those
2343 using GNU extensions that do not contradict it.  For example,
2344 @option{-std=c90} turns off certain features of GCC that are
2345 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2346 keywords, but not other GNU extensions that do not have a meaning in
2347 ISO C90, such as omitting the middle term of a @code{?:}
2348 expression. On the other hand, when a GNU dialect of a standard is
2349 specified, all features supported by the compiler are enabled, even when
2350 those features change the meaning of the base standard.  As a result, some
2351 strict-conforming programs may be rejected.  The particular standard
2352 is used by @option{-Wpedantic} to identify which features are GNU
2353 extensions given that version of the standard. For example
2354 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2355 comments, while @option{-std=gnu99 -Wpedantic} does not.
2357 A value for this option must be provided; possible values are
2359 @table @samp
2360 @item c90
2361 @itemx c89
2362 @itemx iso9899:1990
2363 Support all ISO C90 programs (certain GNU extensions that conflict
2364 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2366 @item iso9899:199409
2367 ISO C90 as modified in amendment 1.
2369 @item c99
2370 @itemx c9x
2371 @itemx iso9899:1999
2372 @itemx iso9899:199x
2373 ISO C99.  This standard is substantially completely supported, modulo
2374 bugs and floating-point issues
2375 (mainly but not entirely relating to optional C99 features from
2376 Annexes F and G).  See
2377 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2378 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2380 @item c11
2381 @itemx c1x
2382 @itemx iso9899:2011
2383 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2384 substantially completely supported, modulo bugs, floating-point issues
2385 (mainly but not entirely relating to optional C11 features from
2386 Annexes F and G) and the optional Annexes K (Bounds-checking
2387 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2389 @item c17
2390 @itemx c18
2391 @itemx iso9899:2017
2392 @itemx iso9899:2018
2393 ISO C17, the 2017 revision of the ISO C standard
2394 (published in 2018).  This standard is
2395 same as C11 except for corrections of defects (all of which are also
2396 applied with @option{-std=c11}) and a new value of
2397 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2399 @item c2x
2400 The next version of the ISO C standard, still under development.  The
2401 support for this version is experimental and incomplete.
2403 @item gnu90
2404 @itemx gnu89
2405 GNU dialect of ISO C90 (including some C99 features).
2407 @item gnu99
2408 @itemx gnu9x
2409 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2411 @item gnu11
2412 @itemx gnu1x
2413 GNU dialect of ISO C11.
2414 The name @samp{gnu1x} is deprecated.
2416 @item gnu17
2417 @itemx gnu18
2418 GNU dialect of ISO C17.  This is the default for C code.
2420 @item gnu2x
2421 The next version of the ISO C standard, still under development, plus
2422 GNU extensions.  The support for this version is experimental and
2423 incomplete.
2425 @item c++98
2426 @itemx c++03
2427 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2428 additional defect reports. Same as @option{-ansi} for C++ code.
2430 @item gnu++98
2431 @itemx gnu++03
2432 GNU dialect of @option{-std=c++98}.
2434 @item c++11
2435 @itemx c++0x
2436 The 2011 ISO C++ standard plus amendments.
2437 The name @samp{c++0x} is deprecated.
2439 @item gnu++11
2440 @itemx gnu++0x
2441 GNU dialect of @option{-std=c++11}.
2442 The name @samp{gnu++0x} is deprecated.
2444 @item c++14
2445 @itemx c++1y
2446 The 2014 ISO C++ standard plus amendments.
2447 The name @samp{c++1y} is deprecated.
2449 @item gnu++14
2450 @itemx gnu++1y
2451 GNU dialect of @option{-std=c++14}.
2452 The name @samp{gnu++1y} is deprecated.
2454 @item c++17
2455 @itemx c++1z
2456 The 2017 ISO C++ standard plus amendments.
2457 The name @samp{c++1z} is deprecated.
2459 @item gnu++17
2460 @itemx gnu++1z
2461 GNU dialect of @option{-std=c++17}.
2462 This is the default for C++ code.
2463 The name @samp{gnu++1z} is deprecated.
2465 @item c++20
2466 @itemx c++2a
2467 The 2020 ISO C++ standard plus amendments.
2468 Support is experimental, and could change in incompatible ways in
2469 future releases.
2470 The name @samp{c++2a} is deprecated.
2472 @item gnu++20
2473 @itemx gnu++2a
2474 GNU dialect of @option{-std=c++20}.
2475 Support is experimental, and could change in incompatible ways in
2476 future releases.
2477 The name @samp{gnu++2a} is deprecated.
2479 @item c++2b
2480 @itemx c++23
2481 The next revision of the ISO C++ standard, planned for
2482 2023.  Support is highly experimental, and will almost certainly
2483 change in incompatible ways in future releases.
2485 @item gnu++2b
2486 @itemx gnu++23
2487 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2488 and will almost certainly change in incompatible ways in future
2489 releases.
2490 @end table
2492 @item -aux-info @var{filename}
2493 @opindex aux-info
2494 Output to the given filename prototyped declarations for all functions
2495 declared and/or defined in a translation unit, including those in header
2496 files.  This option is silently ignored in any language other than C@.
2498 Besides declarations, the file indicates, in comments, the origin of
2499 each declaration (source file and line), whether the declaration was
2500 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2501 @samp{O} for old, respectively, in the first character after the line
2502 number and the colon), and whether it came from a declaration or a
2503 definition (@samp{C} or @samp{F}, respectively, in the following
2504 character).  In the case of function definitions, a K&R-style list of
2505 arguments followed by their declarations is also provided, inside
2506 comments, after the declaration.
2508 @item -fno-asm
2509 @opindex fno-asm
2510 @opindex fasm
2511 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2512 keyword, so that code can use these words as identifiers.  You can use
2513 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2514 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2516 In C++, @code{inline} is a standard keyword and is not affected by
2517 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2518 instead, which disables @code{typeof} but not @code{asm} and
2519 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2520 this switch only affects the @code{asm} and @code{typeof} keywords,
2521 since @code{inline} is a standard keyword in ISO C99.  In C2X mode
2522 (@option{-std=c2x} or @option{-std=gnu2x}), this switch only affects
2523 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2524 ISO C2X.
2526 @item -fno-builtin
2527 @itemx -fno-builtin-@var{function}
2528 @opindex fno-builtin
2529 @opindex fbuiltin
2530 @cindex built-in functions
2531 Don't recognize built-in functions that do not begin with
2532 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2533 functions provided by GCC}, for details of the functions affected,
2534 including those which are not built-in functions when @option{-ansi} or
2535 @option{-std} options for strict ISO C conformance are used because they
2536 do not have an ISO standard meaning.
2538 GCC normally generates special code to handle certain built-in functions
2539 more efficiently; for instance, calls to @code{alloca} may become single
2540 instructions which adjust the stack directly, and calls to @code{memcpy}
2541 may become inline copy loops.  The resulting code is often both smaller
2542 and faster, but since the function calls no longer appear as such, you
2543 cannot set a breakpoint on those calls, nor can you change the behavior
2544 of the functions by linking with a different library.  In addition,
2545 when a function is recognized as a built-in function, GCC may use
2546 information about that function to warn about problems with calls to
2547 that function, or to generate more efficient code, even if the
2548 resulting code still contains calls to that function.  For example,
2549 warnings are given with @option{-Wformat} for bad calls to
2550 @code{printf} when @code{printf} is built in and @code{strlen} is
2551 known not to modify global memory.
2553 With the @option{-fno-builtin-@var{function}} option
2554 only the built-in function @var{function} is
2555 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2556 function is named that is not built-in in this version of GCC, this
2557 option is ignored.  There is no corresponding
2558 @option{-fbuiltin-@var{function}} option; if you wish to enable
2559 built-in functions selectively when using @option{-fno-builtin} or
2560 @option{-ffreestanding}, you may define macros such as:
2562 @smallexample
2563 #define abs(n)          __builtin_abs ((n))
2564 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2565 @end smallexample
2567 @item -fcond-mismatch
2568 @opindex fcond-mismatch
2569 Allow conditional expressions with mismatched types in the second and
2570 third arguments.  The value of such an expression is void.  This option
2571 is not supported for C++.
2573 @item -ffreestanding
2574 @opindex ffreestanding
2575 @cindex hosted environment
2577 Assert that compilation targets a freestanding environment.  This
2578 implies @option{-fno-builtin}.  A freestanding environment
2579 is one in which the standard library may not exist, and program startup may
2580 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2581 This is equivalent to @option{-fno-hosted}.
2583 @xref{Standards,,Language Standards Supported by GCC}, for details of
2584 freestanding and hosted environments.
2586 @item -fgimple
2587 @opindex fgimple
2589 Enable parsing of function definitions marked with @code{__GIMPLE}.
2590 This is an experimental feature that allows unit testing of GIMPLE
2591 passes.
2593 @item -fgnu-tm
2594 @opindex fgnu-tm
2595 When the option @option{-fgnu-tm} is specified, the compiler
2596 generates code for the Linux variant of Intel's current Transactional
2597 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2598 an experimental feature whose interface may change in future versions
2599 of GCC, as the official specification changes.  Please note that not
2600 all architectures are supported for this feature.
2602 For more information on GCC's support for transactional memory,
2603 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2604 Transactional Memory Library}.
2606 Note that the transactional memory feature is not supported with
2607 non-call exceptions (@option{-fnon-call-exceptions}).
2609 @item -fgnu89-inline
2610 @opindex fgnu89-inline
2611 The option @option{-fgnu89-inline} tells GCC to use the traditional
2612 GNU semantics for @code{inline} functions when in C99 mode.
2613 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2614 Using this option is roughly equivalent to adding the
2615 @code{gnu_inline} function attribute to all inline functions
2616 (@pxref{Function Attributes}).
2618 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2619 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2620 specifies the default behavior).
2621 This option is not supported in @option{-std=c90} or
2622 @option{-std=gnu90} mode.
2624 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2625 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2626 in effect for @code{inline} functions.  @xref{Common Predefined
2627 Macros,,,cpp,The C Preprocessor}.
2629 @item -fhosted
2630 @opindex fhosted
2631 @cindex hosted environment
2633 Assert that compilation targets a hosted environment.  This implies
2634 @option{-fbuiltin}.  A hosted environment is one in which the
2635 entire standard library is available, and in which @code{main} has a return
2636 type of @code{int}.  Examples are nearly everything except a kernel.
2637 This is equivalent to @option{-fno-freestanding}.
2639 @item -flax-vector-conversions
2640 @opindex flax-vector-conversions
2641 Allow implicit conversions between vectors with differing numbers of
2642 elements and/or incompatible element types.  This option should not be
2643 used for new code.
2645 @item -fms-extensions
2646 @opindex fms-extensions
2647 Accept some non-standard constructs used in Microsoft header files.
2649 In C++ code, this allows member names in structures to be similar
2650 to previous types declarations.
2652 @smallexample
2653 typedef int UOW;
2654 struct ABC @{
2655   UOW UOW;
2657 @end smallexample
2659 Some cases of unnamed fields in structures and unions are only
2660 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2661 fields within structs/unions}, for details.
2663 Note that this option is off for all targets except for x86
2664 targets using ms-abi.
2666 @item -foffload=disable
2667 @itemx -foffload=default
2668 @itemx -foffload=@var{target-list}
2669 @opindex foffload
2670 @cindex Offloading targets
2671 @cindex OpenACC offloading targets
2672 @cindex OpenMP offloading targets
2673 Specify for which OpenMP and OpenACC offload targets code should be generated.
2674 The default behavior, equivalent to @option{-foffload=default}, is to generate
2675 code for all supported offload targets.  The @option{-foffload=disable} form
2676 generates code only for the host fallback, while
2677 @option{-foffload=@var{target-list}} generates code only for the specified
2678 comma-separated list of offload targets.
2680 Offload targets are specified in GCC's internal target-triplet format. You can
2681 run the compiler with @option{-v} to show the list of configured offload targets
2682 under @code{OFFLOAD_TARGET_NAMES}.
2684 @item -foffload-options=@var{options}
2685 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2686 @opindex foffload-options
2687 @cindex Offloading options
2688 @cindex OpenACC offloading options
2689 @cindex OpenMP offloading options
2691 With @option{-foffload-options=@var{options}}, GCC passes the specified
2692 @var{options} to the compilers for all enabled offloading targets.  You can
2693 specify options that apply only to a specific target or targets by using
2694 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2695 @var{target-list} is a comma-separated list in the same format as for the
2696 @option{-foffload=} option.
2698 Typical command lines are
2700 @smallexample
2701 -foffload-options=-lgfortran -foffload-options=-lm
2702 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2703 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2704 @end smallexample
2706 @item -fopenacc
2707 @opindex fopenacc
2708 @cindex OpenACC accelerator programming
2709 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2710 @code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2711 compiler generates accelerated code according to the OpenACC Application
2712 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2713 implies @option{-pthread}, and thus is only supported on targets that
2714 have support for @option{-pthread}.
2716 @item -fopenacc-dim=@var{geom}
2717 @opindex fopenacc-dim
2718 @cindex OpenACC accelerator programming
2719 Specify default compute dimensions for parallel offload regions that do
2720 not explicitly specify.  The @var{geom} value is a triple of
2721 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2722 can be omitted, to use a target-specific default value.
2724 @item -fopenmp
2725 @opindex fopenmp
2726 @cindex OpenMP parallel
2727 Enable handling of OpenMP directives @code{#pragma omp} in C/C++,
2728 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++ and
2729 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2730 compiler generates parallel code according to the OpenMP Application
2731 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2732 implies @option{-pthread}, and thus is only supported on targets that
2733 have support for @option{-pthread}. @option{-fopenmp} implies
2734 @option{-fopenmp-simd}.
2736 @item -fopenmp-simd
2737 @opindex fopenmp-simd
2738 @cindex OpenMP SIMD
2739 @cindex SIMD
2740 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2741 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan},
2742 @code{loop} directives and combined or composite directives with
2743 @code{simd} as constituent with @code{#pragma omp} in C/C++,
2744 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++
2745 and @code{!$omp} in Fortran.  Other OpenMP directives are ignored.
2747 @item -fopenmp-target-simd-clone
2748 @item -fopenmp-target-simd-clone=@var{device-type}
2749 @opindex fopenmp-target-simd-clone
2750 @cindex OpenMP target SIMD clone
2751 In addition to generating SIMD clones for functions marked with the
2752 @code{declare simd} directive, GCC also generates clones
2753 for functions marked with the OpenMP @code{declare target} directive
2754 that are suitable for vectorization when this option is in effect.  The
2755 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2756 and @code{any}, which correspond to keywords for the @code{device_type}
2757 clause of the @code{declare target} directive; clones are generated for
2758 the intersection of devices specified.
2759 @option{-fopenmp-target-simd-clone} is equivalent to
2760 @option{-fopenmp-target-simd-clone=any} and
2761 @option{-fno-openmp-target-simd-clone} is equivalent to
2762 @option{-fopenmp-target-simd-clone=none}.
2764 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2765 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2766 it is disabled by default.
2768 @item -fpermitted-flt-eval-methods=@var{style}
2769 @opindex fpermitted-flt-eval-methods
2770 @opindex fpermitted-flt-eval-methods=c11
2771 @opindex fpermitted-flt-eval-methods=ts-18661-3
2772 ISO/IEC TS 18661-3 defines new permissible values for
2773 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2774 a semantic type that is an interchange or extended format should be
2775 evaluated to the precision and range of that type.  These new values are
2776 a superset of those permitted under C99/C11, which does not specify the
2777 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2778 conforming to C11 may not have been written expecting the possibility of
2779 the new values.
2781 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2782 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2783 or the extended set of values specified in ISO/IEC TS 18661-3.
2785 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2787 The default when in a standards compliant mode (@option{-std=c11} or similar)
2788 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2789 dialect (@option{-std=gnu11} or similar) is
2790 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2792 @item -fplan9-extensions
2793 @opindex fplan9-extensions
2794 Accept some non-standard constructs used in Plan 9 code.
2796 This enables @option{-fms-extensions}, permits passing pointers to
2797 structures with anonymous fields to functions that expect pointers to
2798 elements of the type of the field, and permits referring to anonymous
2799 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2800 struct/union fields within structs/unions}, for details.  This is only
2801 supported for C, not C++.
2803 @item -fsigned-bitfields
2804 @itemx -funsigned-bitfields
2805 @itemx -fno-signed-bitfields
2806 @itemx -fno-unsigned-bitfields
2807 @opindex fsigned-bitfields
2808 @opindex funsigned-bitfields
2809 @opindex fno-signed-bitfields
2810 @opindex fno-unsigned-bitfields
2811 These options control whether a bit-field is signed or unsigned, when the
2812 declaration does not use either @code{signed} or @code{unsigned}.  By
2813 default, such a bit-field is signed, because this is consistent: the
2814 basic integer types such as @code{int} are signed types.
2816 @item -fsigned-char
2817 @opindex fsigned-char
2818 Let the type @code{char} be signed, like @code{signed char}.
2820 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2821 the negative form of @option{-funsigned-char}.  Likewise, the option
2822 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2824 @item -funsigned-char
2825 @opindex funsigned-char
2826 Let the type @code{char} be unsigned, like @code{unsigned char}.
2828 Each kind of machine has a default for what @code{char} should
2829 be.  It is either like @code{unsigned char} by default or like
2830 @code{signed char} by default.
2832 Ideally, a portable program should always use @code{signed char} or
2833 @code{unsigned char} when it depends on the signedness of an object.
2834 But many programs have been written to use plain @code{char} and
2835 expect it to be signed, or expect it to be unsigned, depending on the
2836 machines they were written for.  This option, and its inverse, let you
2837 make such a program work with the opposite default.
2839 The type @code{char} is always a distinct type from each of
2840 @code{signed char} or @code{unsigned char}, even though its behavior
2841 is always just like one of those two.
2843 @item -fstrict-flex-arrays
2844 @opindex fstrict-flex-arrays
2845 @opindex fno-strict-flex-arrays
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.
2848 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2849 strictest.  A trailing array is treated as a flexible array member only when it
2850 is declared as a flexible array member per C99 standard onwards.
2851 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2852 least strict.  All trailing arrays of structures are treated as flexible array
2853 members.
2855 @item -fstrict-flex-arrays=@var{level}
2856 @opindex fstrict-flex-arrays=@var{level}
2857 Control when to treat the trailing array of a structure as a flexible array
2858 member for the purpose of accessing the elements of such an array.  The value
2859 of @var{level} controls the level of strictness.
2861 The possible values of @var{level} are the same as for the
2862 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2864 You can control this behavior for a specific trailing array field of a
2865 structure by using the variable attribute @code{strict_flex_array} attribute
2866 (@pxref{Variable Attributes}).
2868 @item -fsso-struct=@var{endianness}
2869 @opindex fsso-struct
2870 Set the default scalar storage order of structures and unions to the
2871 specified endianness.  The accepted values are @samp{big-endian},
2872 @samp{little-endian} and @samp{native} for the native endianness of
2873 the target (the default).  This option is not supported for C++.
2875 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2876 code that is not binary compatible with code generated without it if the
2877 specified endianness is not the native endianness of the target.
2878 @end table
2880 @node C++ Dialect Options
2881 @section Options Controlling C++ Dialect
2883 @cindex compiler options, C++
2884 @cindex C++ options, command-line
2885 @cindex options, C++
2886 This section describes the command-line options that are only meaningful
2887 for C++ programs.  You can also use most of the GNU compiler options
2888 regardless of what language your program is in.  For example, you
2889 might compile a file @file{firstClass.C} like this:
2891 @smallexample
2892 g++ -g -fstrict-enums -O -c firstClass.C
2893 @end smallexample
2895 @noindent
2896 In this example, only @option{-fstrict-enums} is an option meant
2897 only for C++ programs; you can use the other options with any
2898 language supported by GCC@.
2900 Some options for compiling C programs, such as @option{-std}, are also
2901 relevant for C++ programs.
2902 @xref{C Dialect Options,,Options Controlling C Dialect}.
2904 Here is a list of options that are @emph{only} for compiling C++ programs:
2906 @table @gcctabopt
2908 @item -fabi-version=@var{n}
2909 @opindex fabi-version
2910 Use version @var{n} of the C++ ABI@.  The default is version 0.
2912 Version 0 refers to the version conforming most closely to
2913 the C++ ABI specification.  Therefore, the ABI obtained using version 0
2914 will change in different versions of G++ as ABI bugs are fixed.
2916 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2918 Version 2 is the version of the C++ ABI that first appeared in G++
2919 3.4, and was the default through G++ 4.9.
2921 Version 3 corrects an error in mangling a constant address as a
2922 template argument.
2924 Version 4, which first appeared in G++ 4.5, implements a standard
2925 mangling for vector types.
2927 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2928 attribute const/volatile on function pointer types, decltype of a
2929 plain decl, and use of a function parameter in the declaration of
2930 another parameter.
2932 Version 6, which first appeared in G++ 4.7, corrects the promotion
2933 behavior of C++11 scoped enums and the mangling of template argument
2934 packs, const/static_cast, prefix ++ and --, and a class scope function
2935 used as a template argument.
2937 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2938 builtin type and corrects the mangling of lambdas in default argument
2939 scope.
2941 Version 8, which first appeared in G++ 4.9, corrects the substitution
2942 behavior of function types with function-cv-qualifiers.
2944 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2945 @code{nullptr_t}.
2947 Version 10, which first appeared in G++ 6.1, adds mangling of
2948 attributes that affect type identity, such as ia32 calling convention
2949 attributes (e.g.@: @samp{stdcall}).
2951 Version 11, which first appeared in G++ 7, corrects the mangling of
2952 sizeof... expressions and operator names.  For multiple entities with
2953 the same name within a function, that are declared in different scopes,
2954 the mangling now changes starting with the twelfth occurrence.  It also
2955 implies @option{-fnew-inheriting-ctors}.
2957 Version 12, which first appeared in G++ 8, corrects the calling
2958 conventions for empty classes on the x86_64 target and for classes
2959 with only deleted copy/move constructors.  It accidentally changes the
2960 calling convention for classes with a deleted copy constructor and a
2961 trivial move constructor.
2963 Version 13, which first appeared in G++ 8.2, fixes the accidental
2964 change in version 12.
2966 Version 14, which first appeared in G++ 10, corrects the mangling of
2967 the nullptr expression.
2969 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
2970 tag regression.
2972 Version 16, which first appeared in G++ 11, changes the mangling of
2973 @code{__alignof__} to be distinct from that of @code{alignof}, and
2974 dependent operator names.
2976 Version 17, which first appeared in G++ 12, fixes layout of classes
2977 that inherit from aggregate classes with default member initializers
2978 in C++14 and up.
2980 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
2981 that have additional context.
2983 See also @option{-Wabi}.
2985 @item -fabi-compat-version=@var{n}
2986 @opindex fabi-compat-version
2987 On targets that support strong aliases, G++
2988 works around mangling changes by creating an alias with the correct
2989 mangled name when defining a symbol with an incorrect mangled name.
2990 This switch specifies which ABI version to use for the alias.
2992 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
2993 compatibility).  If another ABI version is explicitly selected, this
2994 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
2995 use @option{-fabi-compat-version=2}.
2997 If this option is not provided but @option{-Wabi=@var{n}} is, that
2998 version is used for compatibility aliases.  If this option is provided
2999 along with @option{-Wabi} (without the version), the version from this
3000 option is used for the warning.
3002 @item -fno-access-control
3003 @opindex fno-access-control
3004 @opindex faccess-control
3005 Turn off all access checking.  This switch is mainly useful for working
3006 around bugs in the access control code.
3008 @item -faligned-new
3009 @opindex faligned-new
3010 Enable support for C++17 @code{new} of types that require more
3011 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3012 numeric argument such as @code{-faligned-new=32} can be used to
3013 specify how much alignment (in bytes) is provided by that function,
3014 but few users will need to override the default of
3015 @code{alignof(std::max_align_t)}.
3017 This flag is enabled by default for @option{-std=c++17}.
3019 @item -fchar8_t
3020 @itemx -fno-char8_t
3021 @opindex fchar8_t
3022 @opindex fno-char8_t
3023 Enable support for @code{char8_t} as adopted for C++20.  This includes
3024 the addition of a new @code{char8_t} fundamental type, changes to the
3025 types of UTF-8 string and character literals, new signatures for
3026 user-defined literals, associated standard library updates, and new
3027 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3029 This option enables functions to be overloaded for ordinary and UTF-8
3030 strings:
3032 @smallexample
3033 int f(const char *);    // #1
3034 int f(const char8_t *); // #2
3035 int v1 = f("text");     // Calls #1
3036 int v2 = f(u8"text");   // Calls #2
3037 @end smallexample
3039 @noindent
3040 and introduces new signatures for user-defined literals:
3042 @smallexample
3043 int operator""_udl1(char8_t);
3044 int v3 = u8'x'_udl1;
3045 int operator""_udl2(const char8_t*, std::size_t);
3046 int v4 = u8"text"_udl2;
3047 template<typename T, T...> int operator""_udl3();
3048 int v5 = u8"text"_udl3;
3049 @end smallexample
3051 @noindent
3052 The change to the types of UTF-8 string and character literals introduces
3053 incompatibilities with ISO C++11 and later standards.  For example, the
3054 following code is well-formed under ISO C++11, but is ill-formed when
3055 @option{-fchar8_t} is specified.
3057 @smallexample
3058 char ca[] = u8"xx";     // error: char-array initialized from wide
3059                         //        string
3060 const char *cp = u8"xx";// error: invalid conversion from
3061                         //        `const char8_t*' to `const char*'
3062 int f(const char*);
3063 auto v = f(u8"xx");     // error: invalid conversion from
3064                         //        `const char8_t*' to `const char*'
3065 std::string s@{u8"xx"@};  // error: no matching function for call to
3066                         //        `std::basic_string<char>::basic_string()'
3067 using namespace std::literals;
3068 s = u8"xx"s;            // error: conversion from
3069                         //        `basic_string<char8_t>' to non-scalar
3070                         //        type `basic_string<char>' requested
3071 @end smallexample
3073 @item -fcheck-new
3074 @opindex fcheck-new
3075 Check that the pointer returned by @code{operator new} is non-null
3076 before attempting to modify the storage allocated.  This check is
3077 normally unnecessary because the C++ standard specifies that
3078 @code{operator new} only returns @code{0} if it is declared
3079 @code{throw()}, in which case the compiler always checks the
3080 return value even without this option.  In all other cases, when
3081 @code{operator new} has a non-empty exception specification, memory
3082 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3083 @samp{new (nothrow)}.
3085 @item -fconcepts
3086 @itemx -fconcepts-ts
3087 @opindex fconcepts
3088 @opindex fconcepts-ts
3089 Enable support for the C++ Concepts feature for constraining template
3090 arguments.  With @option{-std=c++20} and above, Concepts are part of
3091 the language standard, so @option{-fconcepts} defaults to on.
3093 Some constructs that were allowed by the earlier C++ Extensions for
3094 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3095 into the standard, can additionally be enabled by
3096 @option{-fconcepts-ts}.
3098 @item -fconstexpr-depth=@var{n}
3099 @opindex fconstexpr-depth
3100 Set the maximum nested evaluation depth for C++11 constexpr functions
3101 to @var{n}.  A limit is needed to detect endless recursion during
3102 constant expression evaluation.  The minimum specified by the standard
3103 is 512.
3105 @item -fconstexpr-cache-depth=@var{n}
3106 @opindex fconstexpr-cache-depth
3107 Set the maximum level of nested evaluation depth for C++11 constexpr
3108 functions that will be cached to @var{n}.  This is a heuristic that
3109 trades off compilation speed (when the cache avoids repeated
3110 calculations) against memory consumption (when the cache grows very
3111 large from highly recursive evaluations).  The default is 8.  Very few
3112 users are likely to want to adjust it, but if your code does heavy
3113 constexpr calculations you might want to experiment to find which
3114 value works best for you.
3116 @item -fconstexpr-fp-except
3117 @opindex fconstexpr-fp-except
3118 Annex F of the C standard specifies that IEC559 floating point
3119 exceptions encountered at compile time should not stop compilation.
3120 C++ compilers have historically not followed this guidance, instead
3121 treating floating point division by zero as non-constant even though
3122 it has a well defined value.  This flag tells the compiler to give
3123 Annex F priority over other rules saying that a particular operation
3124 is undefined.
3126 @smallexample
3127 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3128 @end smallexample
3130 @item -fconstexpr-loop-limit=@var{n}
3131 @opindex fconstexpr-loop-limit
3132 Set the maximum number of iterations for a loop in C++14 constexpr functions
3133 to @var{n}.  A limit is needed to detect infinite loops during
3134 constant expression evaluation.  The default is 262144 (1<<18).
3136 @item -fconstexpr-ops-limit=@var{n}
3137 @opindex fconstexpr-ops-limit
3138 Set the maximum number of operations during a single constexpr evaluation.
3139 Even when number of iterations of a single loop is limited with the above limit,
3140 if there are several nested loops and each of them has many iterations but still
3141 smaller than the above limit, or if in a body of some loop or even outside
3142 of a loop too many expressions need to be evaluated, the resulting constexpr
3143 evaluation might take too long.
3144 The default is 33554432 (1<<25).
3146 @item -fcontracts
3147 @opindex fcontracts
3148 Enable experimental support for the C++ Contracts feature, as briefly
3149 added to and then removed from the C++20 working paper (N4820).  The
3150 implementation also includes proposed enhancements from papers P1290,
3151 P1332, and P1429.  This functionality is intended mostly for those
3152 interested in experimentation towards refining the feature to get it
3153 into shape for a future C++ standard.
3155 On violation of a checked contract, the violation handler is called.
3156 Users can replace the violation handler by defining
3157 @smallexample
3158 void handle_contract_violation (const std::experimental::contract_violation&);
3159 @end smallexample
3161 There are different sets of additional flags that can be used together
3162 to specify which contracts will be checked and how, for N4820
3163 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3164 used together.
3166 @table @gcctabopt
3167 @item -fcontract-mode=[on|off]
3168 @opindex fcontract-mode
3169 Control whether any contracts have any semantics at all.  Defaults to on.
3171 @item -fcontract-assumption-mode=[on|off]
3172 @opindex fcontract-assumption-mode
3173 [N4820] Control whether contracts with level @samp{axiom}
3174 should have the assume semantic.  Defaults to on.
3176 @item -fcontract-build-level=[off|default|audit]
3177 @opindex fcontract-build-level
3178 [N4820] Specify which level of contracts to generate checks
3179 for.  Defaults to @samp{default}.
3181 @item -fcontract-continuation-mode=[on|off]
3182 @opindex fcontract-continuation-mode
3183 [N4820] Control whether to allow the program to continue executing
3184 after a contract violation.  That is, do checked contracts have the
3185 @samp{maybe} semantic described below rather than the @samp{never}
3186 semantic.  Defaults to off.
3188 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3189 @opindex fcontract-role
3190 [P1332] Specify the concrete semantics for each contract level
3191 of a particular contract role.
3193 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3194 [P1429] Specify the concrete semantic for a particular
3195 contract level.
3197 @item -fcontract-strict-declarations=[on|off]
3198 @opindex fcontract-strict-declarations
3199 Control whether to reject adding contracts to a function after its
3200 first declaration.  Defaults to off.
3201 @end table
3203 The possible concrete semantics for that can be specified with
3204 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3206 @table @code
3207 @item ignore
3208 This contract has no effect.
3210 @item assume
3211 This contract is treated like C++23 @code{[[assume]]}.
3213 @item check_never_continue
3214 @itemx never
3215 @itemx abort
3216 This contract is checked.  If it fails, the violation handler is
3217 called.  If the handler returns, @code{std::terminate} is called.
3219 @item check_maybe_continue
3220 @itemx maybe
3221 This contract is checked.  If it fails, the violation handler is
3222 called.  If the handler returns, execution continues normally.
3223 @end table
3225 @item -fcoroutines
3226 @opindex fcoroutines
3227 Enable support for the C++ coroutines extension (experimental).
3229 @item -fno-elide-constructors
3230 @opindex fno-elide-constructors
3231 @opindex felide-constructors
3232 The C++ standard allows an implementation to omit creating a temporary
3233 that is only used to initialize another object of the same type.
3234 Specifying this option disables that optimization, and forces G++ to
3235 call the copy constructor in all cases.  This option also causes G++
3236 to call trivial member functions which otherwise would be expanded inline.
3238 In C++17, the compiler is required to omit these temporaries, but this
3239 option still affects trivial member functions.
3241 @item -fno-enforce-eh-specs
3242 @opindex fno-enforce-eh-specs
3243 @opindex fenforce-eh-specs
3244 Don't generate code to check for violation of exception specifications
3245 at run time.  This option violates the C++ standard, but may be useful
3246 for reducing code size in production builds, much like defining
3247 @code{NDEBUG}.  This does not give user code permission to throw
3248 exceptions in violation of the exception specifications; the compiler
3249 still optimizes based on the specifications, so throwing an
3250 unexpected exception results in undefined behavior at run time.
3252 @item -fextern-tls-init
3253 @itemx -fno-extern-tls-init
3254 @opindex fextern-tls-init
3255 @opindex fno-extern-tls-init
3256 The C++11 and OpenMP standards allow @code{thread_local} and
3257 @code{threadprivate} variables to have dynamic (runtime)
3258 initialization.  To support this, any use of such a variable goes
3259 through a wrapper function that performs any necessary initialization.
3260 When the use and definition of the variable are in the same
3261 translation unit, this overhead can be optimized away, but when the
3262 use is in a different translation unit there is significant overhead
3263 even if the variable doesn't actually need dynamic initialization.  If
3264 the programmer can be sure that no use of the variable in a
3265 non-defining TU needs to trigger dynamic initialization (either
3266 because the variable is statically initialized, or a use of the
3267 variable in the defining TU will be executed before any uses in
3268 another TU), they can avoid this overhead with the
3269 @option{-fno-extern-tls-init} option.
3271 On targets that support symbol aliases, the default is
3272 @option{-fextern-tls-init}.  On targets that do not support symbol
3273 aliases, the default is @option{-fno-extern-tls-init}.
3275 @item -ffold-simple-inlines
3276 @itemx -fno-fold-simple-inlines
3277 @opindex ffold-simple-inlines
3278 @opindex fno-fold-simple-inlines
3279 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3280 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3281 means no debug information will be generated for such calls.  Since these
3282 functions are rarely interesting to debug, this flag is enabled by default
3283 unless @option{-fno-inline} is active.
3285 @item -fno-gnu-keywords
3286 @opindex fno-gnu-keywords
3287 @opindex fgnu-keywords
3288 Do not recognize @code{typeof} as a keyword, so that code can use this
3289 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3290 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3291 @option{-std=c++98}, @option{-std=c++11}, etc.
3293 @item -fimplicit-constexpr
3294 @opindex fimplicit-constexpr
3295 Make inline functions implicitly constexpr, if they satisfy the
3296 requirements for a constexpr function.  This option can be used in
3297 C++14 mode or later.  This can result in initialization changing from
3298 dynamic to static and other optimizations.
3300 @item -fno-implicit-templates
3301 @opindex fno-implicit-templates
3302 @opindex fimplicit-templates
3303 Never emit code for non-inline templates that are instantiated
3304 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3305 If you use this option, you must take care to structure your code to
3306 include all the necessary explicit instantiations to avoid getting
3307 undefined symbols at link time.
3308 @xref{Template Instantiation}, for more information.
3310 @item -fno-implicit-inline-templates
3311 @opindex fno-implicit-inline-templates
3312 @opindex fimplicit-inline-templates
3313 Don't emit code for implicit instantiations of inline templates, either.
3314 The default is to handle inlines differently so that compiles with and
3315 without optimization need the same set of explicit instantiations.
3317 @item -fno-implement-inlines
3318 @opindex fno-implement-inlines
3319 @opindex fimplement-inlines
3320 To save space, do not emit out-of-line copies of inline functions
3321 controlled by @code{#pragma implementation}.  This causes linker
3322 errors if these functions are not inlined everywhere they are called.
3324 @item -fmodules-ts
3325 @itemx -fno-modules-ts
3326 @opindex fmodules-ts
3327 @opindex fno-modules-ts
3328 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3329 @option{-fno-modules-ts} is usually not needed, as that is the
3330 default.  Even though this is a C++20 feature, it is not currently
3331 implicitly enabled by selecting that standard version.
3333 @item -fmodule-header
3334 @itemx -fmodule-header=user
3335 @itemx -fmodule-header=system
3336 @opindex fmodule-header
3337 Compile a header file to create an importable header unit.
3339 @item -fmodule-implicit-inline
3340 @opindex fmodule-implicit-inline
3341 Member functions defined in their class definitions are not implicitly
3342 inline for modular code.  This is different to traditional C++
3343 behavior, for good reasons.  However, it may result in a difficulty
3344 during code porting.  This option makes such function definitions
3345 implicitly inline.  It does however generate an ABI incompatibility,
3346 so you must use it everywhere or nowhere.  (Such definitions outside
3347 of a named module remain implicitly inline, regardless.)
3349 @item -fno-module-lazy
3350 @opindex fno-module-lazy
3351 @opindex fmodule-lazy
3352 Disable lazy module importing and module mapper creation.
3354 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3355 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3356 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3357 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3358 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3359 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3360 @vindex CXX_MODULE_MAPPER @r{environment variable}
3361 @opindex fmodule-mapper
3362 An oracle to query for module name to filename mappings.  If
3363 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3364 and if that is unset, an in-process default is provided.
3366 @item -fmodule-only
3367 @opindex fmodule-only
3368 Only emit the Compiled Module Interface, inhibiting any object file.
3370 @item -fms-extensions
3371 @opindex fms-extensions
3372 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3373 int and getting a pointer to member function via non-standard syntax.
3375 @item -fnew-inheriting-ctors
3376 @opindex fnew-inheriting-ctors
3377 Enable the P0136 adjustment to the semantics of C++11 constructor
3378 inheritance.  This is part of C++17 but also considered to be a Defect
3379 Report against C++11 and C++14.  This flag is enabled by default
3380 unless @option{-fabi-version=10} or lower is specified.
3382 @item -fnew-ttp-matching
3383 @opindex fnew-ttp-matching
3384 Enable the P0522 resolution to Core issue 150, template template
3385 parameters and default arguments: this allows a template with default
3386 template arguments as an argument for a template template parameter
3387 with fewer template parameters.  This flag is enabled by default for
3388 @option{-std=c++17}.
3390 @item -fno-nonansi-builtins
3391 @opindex fno-nonansi-builtins
3392 @opindex fnonansi-builtins
3393 Disable built-in declarations of functions that are not mandated by
3394 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3395 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3397 @item -fnothrow-opt
3398 @opindex fnothrow-opt
3399 Treat a @code{throw()} exception specification as if it were a
3400 @code{noexcept} specification to reduce or eliminate the text size
3401 overhead relative to a function with no exception specification.  If
3402 the function has local variables of types with non-trivial
3403 destructors, the exception specification actually makes the
3404 function smaller because the EH cleanups for those variables can be
3405 optimized away.  The semantic effect is that an exception thrown out of
3406 a function with such an exception specification results in a call
3407 to @code{terminate} rather than @code{unexpected}.
3409 @item -fno-operator-names
3410 @opindex fno-operator-names
3411 @opindex foperator-names
3412 Do not treat the operator name keywords @code{and}, @code{bitand},
3413 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3414 synonyms as keywords.
3416 @item -fno-optional-diags
3417 @opindex fno-optional-diags
3418 @opindex foptional-diags
3419 Disable diagnostics that the standard says a compiler does not need to
3420 issue.  Currently, the only such diagnostic issued by G++ is the one for
3421 a name having multiple meanings within a class.
3423 @item -fpermissive
3424 @opindex fpermissive
3425 Downgrade some diagnostics about nonconformant code from errors to
3426 warnings.  Thus, using @option{-fpermissive} allows some
3427 nonconforming code to compile.
3429 @item -fno-pretty-templates
3430 @opindex fno-pretty-templates
3431 @opindex fpretty-templates
3432 When an error message refers to a specialization of a function
3433 template, the compiler normally prints the signature of the
3434 template followed by the template arguments and any typedefs or
3435 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3436 rather than @code{void f(int)}) so that it's clear which template is
3437 involved.  When an error message refers to a specialization of a class
3438 template, the compiler omits any template arguments that match
3439 the default template arguments for that template.  If either of these
3440 behaviors make it harder to understand the error message rather than
3441 easier, you can use @option{-fno-pretty-templates} to disable them.
3443 @item -fno-rtti
3444 @opindex fno-rtti
3445 @opindex frtti
3446 Disable generation of information about every class with virtual
3447 functions for use by the C++ run-time type identification features
3448 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3449 of the language, you can save some space by using this flag.  Note that
3450 exception handling uses the same information, but G++ generates it as
3451 needed. The @code{dynamic_cast} operator can still be used for casts that
3452 do not require run-time type information, i.e.@: casts to @code{void *} or to
3453 unambiguous base classes.
3455 Mixing code compiled with @option{-frtti} with that compiled with
3456 @option{-fno-rtti} may not work.  For example, programs may
3457 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3458 for a class compiled with @option{-frtti}.  
3460 @item -fsized-deallocation
3461 @opindex fsized-deallocation
3462 Enable the built-in global declarations
3463 @smallexample
3464 void operator delete (void *, std::size_t) noexcept;
3465 void operator delete[] (void *, std::size_t) noexcept;
3466 @end smallexample
3467 as introduced in C++14.  This is useful for user-defined replacement
3468 deallocation functions that, for example, use the size of the object
3469 to make deallocation faster.  Enabled by default under
3470 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3471 warns about places that might want to add a definition.
3473 @item -fstrict-enums
3474 @opindex fstrict-enums
3475 Allow the compiler to optimize using the assumption that a value of
3476 enumerated type can only be one of the values of the enumeration (as
3477 defined in the C++ standard; basically, a value that can be
3478 represented in the minimum number of bits needed to represent all the
3479 enumerators).  This assumption may not be valid if the program uses a
3480 cast to convert an arbitrary integer value to the enumerated type.
3482 @item -fstrong-eval-order
3483 @opindex fstrong-eval-order
3484 Evaluate member access, array subscripting, and shift expressions in
3485 left-to-right order, and evaluate assignment in right-to-left order,
3486 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3487 @option{-fstrong-eval-order=some} enables just the ordering of member
3488 access and shift expressions, and is the default without
3489 @option{-std=c++17}.
3491 @item -ftemplate-backtrace-limit=@var{n}
3492 @opindex ftemplate-backtrace-limit
3493 Set the maximum number of template instantiation notes for a single
3494 warning or error to @var{n}.  The default value is 10.
3496 @item -ftemplate-depth=@var{n}
3497 @opindex ftemplate-depth
3498 Set the maximum instantiation depth for template classes to @var{n}.
3499 A limit on the template instantiation depth is needed to detect
3500 endless recursions during template class instantiation.  ANSI/ISO C++
3501 conforming programs must not rely on a maximum depth greater than 17
3502 (changed to 1024 in C++11).  The default value is 900, as the compiler
3503 can run out of stack space before hitting 1024 in some situations.
3505 @item -fno-threadsafe-statics
3506 @opindex fno-threadsafe-statics
3507 @opindex fthreadsafe-statics
3508 Do not emit the extra code to use the routines specified in the C++
3509 ABI for thread-safe initialization of local statics.  You can use this
3510 option to reduce code size slightly in code that doesn't need to be
3511 thread-safe.
3513 @item -fuse-cxa-atexit
3514 @opindex fuse-cxa-atexit
3515 Register destructors for objects with static storage duration with the
3516 @code{__cxa_atexit} function rather than the @code{atexit} function.
3517 This option is required for fully standards-compliant handling of static
3518 destructors, but only works if your C library supports
3519 @code{__cxa_atexit}.
3521 @item -fno-use-cxa-get-exception-ptr
3522 @opindex fno-use-cxa-get-exception-ptr
3523 @opindex fuse-cxa-get-exception-ptr
3524 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3525 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3526 if the runtime routine is not available.
3528 @item -fvisibility-inlines-hidden
3529 @opindex fvisibility-inlines-hidden
3530 This switch declares that the user does not attempt to compare
3531 pointers to inline functions or methods where the addresses of the two functions
3532 are taken in different shared objects.
3534 The effect of this is that GCC may, effectively, mark inline methods with
3535 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3536 appear in the export table of a DSO and do not require a PLT indirection
3537 when used within the DSO@.  Enabling this option can have a dramatic effect
3538 on load and link times of a DSO as it massively reduces the size of the
3539 dynamic export table when the library makes heavy use of templates.
3541 The behavior of this switch is not quite the same as marking the
3542 methods as hidden directly, because it does not affect static variables
3543 local to the function or cause the compiler to deduce that
3544 the function is defined in only one shared object.
3546 You may mark a method as having a visibility explicitly to negate the
3547 effect of the switch for that method.  For example, if you do want to
3548 compare pointers to a particular inline method, you might mark it as
3549 having default visibility.  Marking the enclosing class with explicit
3550 visibility has no effect.
3552 Explicitly instantiated inline methods are unaffected by this option
3553 as their linkage might otherwise cross a shared library boundary.
3554 @xref{Template Instantiation}.
3556 @item -fvisibility-ms-compat
3557 @opindex fvisibility-ms-compat
3558 This flag attempts to use visibility settings to make GCC's C++
3559 linkage model compatible with that of Microsoft Visual Studio.
3561 The flag makes these changes to GCC's linkage model:
3563 @enumerate
3564 @item
3565 It sets the default visibility to @code{hidden}, like
3566 @option{-fvisibility=hidden}.
3568 @item
3569 Types, but not their members, are not hidden by default.
3571 @item
3572 The One Definition Rule is relaxed for types without explicit
3573 visibility specifications that are defined in more than one
3574 shared object: those declarations are permitted if they are
3575 permitted when this option is not used.
3576 @end enumerate
3578 In new code it is better to use @option{-fvisibility=hidden} and
3579 export those classes that are intended to be externally visible.
3580 Unfortunately it is possible for code to rely, perhaps accidentally,
3581 on the Visual Studio behavior.
3583 Among the consequences of these changes are that static data members
3584 of the same type with the same name but defined in different shared
3585 objects are different, so changing one does not change the other;
3586 and that pointers to function members defined in different shared
3587 objects may not compare equal.  When this flag is given, it is a
3588 violation of the ODR to define types with the same name differently.
3590 @item -fno-weak
3591 @opindex fno-weak
3592 @opindex fweak
3593 Do not use weak symbol support, even if it is provided by the linker.
3594 By default, G++ uses weak symbols if they are available.  This
3595 option exists only for testing, and should not be used by end-users;
3596 it results in inferior code and has no benefits.  This option may
3597 be removed in a future release of G++.
3599 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3600 @opindex fext-numeric-literals
3601 @opindex fno-ext-numeric-literals
3602 Accept imaginary, fixed-point, or machine-defined
3603 literal number suffixes as GNU extensions.
3604 When this option is turned off these suffixes are treated
3605 as C++11 user-defined literal numeric suffixes.
3606 This is on by default for all pre-C++11 dialects and all GNU dialects:
3607 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3608 @option{-std=gnu++14}.
3609 This option is off by default
3610 for ISO C++11 onwards (@option{-std=c++11}, ...).
3612 @item -nostdinc++
3613 @opindex nostdinc++
3614 Do not search for header files in the standard directories specific to
3615 C++, but do still search the other standard directories.  (This option
3616 is used when building the C++ library.)
3618 @item -flang-info-include-translate
3619 @itemx -flang-info-include-translate-not
3620 @itemx -flang-info-include-translate=@var{header}
3621 @opindex flang-info-include-translate
3622 @opindex flang-info-include-translate-not
3623 Inform of include translation events.  The first will note accepted
3624 include translations, the second will note declined include
3625 translations.  The @var{header} form will inform of include
3626 translations relating to that specific header.  If @var{header} is of
3627 the form @code{"user"} or @code{<system>} it will be resolved to a
3628 specific user or system header using the include path.
3630 @item -flang-info-module-cmi
3631 @itemx -flang-info-module-cmi=@var{module}
3632 @opindex flang-info-module-cmi
3633 Inform of Compiled Module Interface pathnames.  The first will note
3634 all read CMI pathnames.  The @var{module} form will not reading a
3635 specific module's CMI.  @var{module} may be a named module or a
3636 header-unit (the latter indicated by either being a pathname containing
3637 directory separators or enclosed in @code{<>} or @code{""}).
3639 @item -stdlib=@var{libstdc++,libc++}
3640 @opindex stdlib
3641 When G++ is configured to support this option, it allows specification of
3642 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3643 (the default, native C++ runtime for G++) and @var{libc++} which is the
3644 C++ runtime installed on some operating systems (e.g. Darwin versions from
3645 Darwin11 onwards).  The option switches G++ to use the headers from the
3646 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3647 when a C++ runtime is required for linking.
3648 @end table
3650 In addition, these warning options have meanings only for C++ programs:
3652 @table @gcctabopt
3653 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3654 @opindex Wabi-tag
3655 Warn when a type with an ABI tag is used in a context that does not
3656 have that ABI tag.  See @ref{C++ Attributes} for more information
3657 about ABI tags.
3659 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3660 @opindex Wcomma-subscript
3661 @opindex Wno-comma-subscript
3662 Warn about uses of a comma expression within a subscripting expression.
3663 This usage was deprecated in C++20 and is going to be removed in C++23.
3664 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3666 @smallexample
3667 @group
3668 void f(int *a, int b, int c) @{
3669     a[b,c];     // deprecated in C++20, invalid in C++23
3670     a[(b,c)];   // OK
3672 @end group
3673 @end smallexample
3675 In C++23 it is valid to have comma separated expressions in a subscript
3676 when an overloaded subscript operator is found and supports the right
3677 number and types of arguments.  G++ will accept the formerly valid syntax
3678 for code that is not valid in C++23 but used to be valid but deprecated
3679 in C++20 with a pedantic warning that can be disabled with
3680 @option{-Wno-comma-subscript}.
3682 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3683 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3685 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3686 @opindex Wctad-maybe-unsupported
3687 @opindex Wno-ctad-maybe-unsupported
3688 Warn when performing class template argument deduction (CTAD) on a type with
3689 no explicitly written deduction guides.  This warning will point out cases
3690 where CTAD succeeded only because the compiler synthesized the implicit
3691 deduction guides, which might not be what the programmer intended.  Certain
3692 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3693 types that are designed to support CTAD.  This warning can be suppressed with
3694 the following pattern:
3696 @smallexample
3697 struct allow_ctad_t; // any name works
3698 template <typename T> struct S @{
3699   S(T) @{ @}
3701 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
3702 @end smallexample
3704 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3705 @opindex Wctor-dtor-privacy
3706 @opindex Wno-ctor-dtor-privacy
3707 Warn when a class seems unusable because all the constructors or
3708 destructors in that class are private, and it has neither friends nor
3709 public static member functions.  Also warn if there are no non-private
3710 methods, and there's at least one private member function that isn't
3711 a constructor or destructor.
3713 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3714 @opindex Wdangling-reference
3715 @opindex Wno-dangling-reference
3716 Warn when a reference is bound to a temporary whose lifetime has ended.
3717 For example:
3719 @smallexample
3720 int n = 1;
3721 const int& r = std::max(n - 1, n + 1); // r is dangling
3722 @end smallexample
3724 In the example above, two temporaries are created, one for each
3725 argument, and a reference to one of the temporaries is returned.
3726 However, both temporaries are destroyed at the end of the full
3727 expression, so the reference @code{r} is dangling.  This warning
3728 also detects dangling references in member initializer lists:
3730 @smallexample
3731 const int& f(const int& i) @{ return i; @}
3732 struct S @{
3733   const int &r; // r is dangling
3734   S() : r(f(10)) @{ @}
3736 @end smallexample
3738 Member functions are checked as well, but only their object argument:
3740 @smallexample
3741 struct S @{
3742    const S& self () @{ return *this; @}
3744 const S& s = S().self(); // s is dangling
3745 @end smallexample
3747 Certain functions are safe in this respect, for example @code{std::use_facet}:
3748 they take and return a reference, but they don't return one of its arguments,
3749 which can fool the warning.  Such functions can be excluded from the warning
3750 by wrapping them in a @code{#pragma}:
3752 @smallexample
3753 #pragma GCC diagnostic push
3754 #pragma GCC diagnostic ignored "-Wdangling-reference"
3755 const T& foo (const T&) @{ @dots{} @}
3756 #pragma GCC diagnostic pop
3757 @end smallexample
3759 @option{-Wdangling-reference} also warns about code like
3761 @smallexample
3762 auto p = std::minmax(1, 2);
3763 @end smallexample
3765 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3766 both references dangle after the end of the full expression that contains
3767 the call to @code{std::minmax}.
3769 This warning is enabled by @option{-Wall}.
3771 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3772 @opindex Wdelete-non-virtual-dtor
3773 @opindex Wno-delete-non-virtual-dtor
3774 Warn when @code{delete} is used to destroy an instance of a class that
3775 has virtual functions and non-virtual destructor. It is unsafe to delete
3776 an instance of a derived class through a pointer to a base class if the
3777 base class does not have a virtual destructor.  This warning is enabled
3778 by @option{-Wall}.
3780 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3781 @opindex Wdeprecated-copy
3782 @opindex Wno-deprecated-copy
3783 Warn that the implicit declaration of a copy constructor or copy
3784 assignment operator is deprecated if the class has a user-provided
3785 copy constructor or copy assignment operator, in C++11 and up.  This
3786 warning is enabled by @option{-Wextra}.  With
3787 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3788 user-provided destructor.
3790 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3791 @opindex Wdeprecated-enum-enum-conversion
3792 @opindex Wno-deprecated-enum-enum-conversion
3793 Disable the warning about the case when the usual arithmetic conversions
3794 are applied on operands where one is of enumeration type and the other is
3795 of a different enumeration type.  This conversion was deprecated in C++20.
3796 For example:
3798 @smallexample
3799 enum E1 @{ e @};
3800 enum E2 @{ f @};
3801 int k = f - e;
3802 @end smallexample
3804 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3805 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3806 by @option{-Wenum-conversion}.
3808 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3809 @opindex Wdeprecated-enum-float-conversion
3810 @opindex Wno-deprecated-enum-float-conversion
3811 Disable the warning about the case when the usual arithmetic conversions
3812 are applied on operands where one is of enumeration type and the other is
3813 of a floating-point type.  This conversion was deprecated in C++20.  For
3814 example:
3816 @smallexample
3817 enum E1 @{ e @};
3818 enum E2 @{ f @};
3819 bool b = e <= 3.7;
3820 @end smallexample
3822 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3823 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3824 by @option{-Wenum-conversion}.
3826 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3827 @opindex Winit-list-lifetime
3828 @opindex Wno-init-list-lifetime
3829 Do not warn about uses of @code{std::initializer_list} that are likely
3830 to result in dangling pointers.  Since the underlying array for an
3831 @code{initializer_list} is handled like a normal C++ temporary object,
3832 it is easy to inadvertently keep a pointer to the array past the end
3833 of the array's lifetime.  For example:
3835 @itemize @bullet
3836 @item
3837 If a function returns a temporary @code{initializer_list}, or a local
3838 @code{initializer_list} variable, the array's lifetime ends at the end
3839 of the return statement, so the value returned has a dangling pointer.
3841 @item
3842 If a new-expression creates an @code{initializer_list}, the array only
3843 lives until the end of the enclosing full-expression, so the
3844 @code{initializer_list} in the heap has a dangling pointer.
3846 @item
3847 When an @code{initializer_list} variable is assigned from a
3848 brace-enclosed initializer list, the temporary array created for the
3849 right side of the assignment only lives until the end of the
3850 full-expression, so at the next statement the @code{initializer_list}
3851 variable has a dangling pointer.
3853 @smallexample
3854 // li's initial underlying array lives as long as li
3855 std::initializer_list<int> li = @{ 1,2,3 @};
3856 // assignment changes li to point to a temporary array
3857 li = @{ 4, 5 @};
3858 // now the temporary is gone and li has a dangling pointer
3859 int i = li.begin()[0] // undefined behavior
3860 @end smallexample
3862 @item
3863 When a list constructor stores the @code{begin} pointer from the
3864 @code{initializer_list} argument, this doesn't extend the lifetime of
3865 the array, so if a class variable is constructed from a temporary
3866 @code{initializer_list}, the pointer is left dangling by the end of
3867 the variable declaration statement.
3869 @end itemize
3871 @item -Winvalid-constexpr
3872 @opindex Winvalid-constexpr
3873 @opindex Wno-invalid-constexpr
3875 Warn when a function never produces a constant expression.  In C++20
3876 and earlier, for every @code{constexpr} function and function template,
3877 there must be at least one set of function arguments in at least one
3878 instantiation such that an invocation of the function or constructor
3879 could be an evaluated subexpression of a core constant expression.
3880 C++23 removed this restriction, so it's possible to have a function
3881 or a function template marked @code{constexpr} for which no invocation
3882 satisfies the requirements of a core constant expression.
3884 This warning is enabled as a pedantic warning by default in C++20 and
3885 earlier.  In C++23, @option{-Winvalid-constexpr} can be turned on, in
3886 which case it will be an ordinary warning.  For example:
3888 @smallexample
3889 void f (int& i);
3890 constexpr void
3891 g (int& i)
3893   f(i); // warns by default in C++20, in C++23 only with -Winvalid-constexpr
3895 @end smallexample
3897 @item -Winvalid-imported-macros
3898 @opindex Winvalid-imported-macros
3899 @opindex Wno-invalid-imported-macros
3900 Verify all imported macro definitions are valid at the end of
3901 compilation.  This is not enabled by default, as it requires
3902 additional processing to determine.  It may be useful when preparing
3903 sets of header-units to ensure consistent macros.
3905 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3906 @opindex Wliteral-suffix
3907 @opindex Wno-literal-suffix
3908 Do not warn when a string or character literal is followed by a
3909 ud-suffix which does not begin with an underscore.  As a conforming
3910 extension, GCC treats such suffixes as separate preprocessing tokens
3911 in order to maintain backwards compatibility with code that uses
3912 formatting macros from @code{<inttypes.h>}.  For example:
3914 @smallexample
3915 #define __STDC_FORMAT_MACROS
3916 #include <inttypes.h>
3917 #include <stdio.h>
3919 int main() @{
3920   int64_t i64 = 123;
3921   printf("My int64: %" PRId64"\n", i64);
3923 @end smallexample
3925 In this case, @code{PRId64} is treated as a separate preprocessing token.
3927 This option also controls warnings when a user-defined literal
3928 operator is declared with a literal suffix identifier that doesn't
3929 begin with an underscore. Literal suffix identifiers that don't begin
3930 with an underscore are reserved for future standardization.
3932 These warnings are enabled by default.
3934 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3935 @opindex Wnarrowing
3936 @opindex Wno-narrowing
3937 For C++11 and later standards, narrowing conversions are diagnosed by default,
3938 as required by the standard.  A narrowing conversion from a constant produces
3939 an error, and a narrowing conversion from a non-constant produces a warning,
3940 but @option{-Wno-narrowing} suppresses the diagnostic.
3941 Note that this does not affect the meaning of well-formed code;
3942 narrowing conversions are still considered ill-formed in SFINAE contexts.
3944 With @option{-Wnarrowing} in C++98, warn when a narrowing
3945 conversion prohibited by C++11 occurs within
3946 @samp{@{ @}}, e.g.
3948 @smallexample
3949 int i = @{ 2.2 @}; // error: narrowing from double to int
3950 @end smallexample
3952 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3954 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3955 @opindex Wnoexcept
3956 @opindex Wno-noexcept
3957 Warn when a noexcept-expression evaluates to false because of a call
3958 to a function that does not have a non-throwing exception
3959 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3960 the compiler to never throw an exception.
3962 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3963 @opindex Wnoexcept-type
3964 @opindex Wno-noexcept-type
3965 Warn if the C++17 feature making @code{noexcept} part of a function
3966 type changes the mangled name of a symbol relative to C++14.  Enabled
3967 by @option{-Wabi} and @option{-Wc++17-compat}.
3969 As an example:
3971 @smallexample
3972 template <class T> void f(T t) @{ t(); @};
3973 void g() noexcept;
3974 void h() @{ f(g); @} 
3975 @end smallexample
3977 @noindent
3978 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3979 C++17 it calls @code{f<void(*)()noexcept>}.
3981 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3982 @opindex Wclass-memaccess
3983 @opindex Wno-class-memaccess
3984 Warn when the destination of a call to a raw memory function such as
3985 @code{memset} or @code{memcpy} is an object of class type, and when writing
3986 into such an object might bypass the class non-trivial or deleted constructor
3987 or copy assignment, violate const-correctness or encapsulation, or corrupt
3988 virtual table pointers.  Modifying the representation of such objects may
3989 violate invariants maintained by member functions of the class.  For example,
3990 the call to @code{memset} below is undefined because it modifies a non-trivial
3991 class object and is, therefore, diagnosed.  The safe way to either initialize
3992 or clear the storage of objects of such types is by using the appropriate
3993 constructor or assignment operator, if one is available.
3994 @smallexample
3995 std::string str = "abc";
3996 memset (&str, 0, sizeof str);
3997 @end smallexample
3998 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3999 Explicitly casting the pointer to the class object to @code{void *} or
4000 to a type that can be safely accessed by the raw memory function suppresses
4001 the warning.
4003 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4004 @opindex Wnon-virtual-dtor
4005 @opindex Wno-non-virtual-dtor
4006 Warn when a class has virtual functions and an accessible non-virtual
4007 destructor itself or in an accessible polymorphic base class, in which
4008 case it is possible but unsafe to delete an instance of a derived
4009 class through a pointer to the class itself or base class.  This
4010 warning is automatically enabled if @option{-Weffc++} is specified.
4011 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4012 should be preferred because it warns about the unsafe cases without false
4013 positives.
4015 @item -Wregister @r{(C++ and Objective-C++ only)}
4016 @opindex Wregister
4017 @opindex Wno-register
4018 Warn on uses of the @code{register} storage class specifier, except
4019 when it is part of the GNU @ref{Explicit Register Variables} extension.
4020 The use of the @code{register} keyword as storage class specifier has
4021 been deprecated in C++11 and removed in C++17.
4022 Enabled by default with @option{-std=c++17}.
4024 @item -Wreorder @r{(C++ and Objective-C++ only)}
4025 @opindex Wreorder
4026 @opindex Wno-reorder
4027 @cindex reordering, warning
4028 @cindex warning for reordering of member initializers
4029 Warn when the order of member initializers given in the code does not
4030 match the order in which they must be executed.  For instance:
4032 @smallexample
4033 struct A @{
4034   int i;
4035   int j;
4036   A(): j (0), i (1) @{ @}
4038 @end smallexample
4040 @noindent
4041 The compiler rearranges the member initializers for @code{i}
4042 and @code{j} to match the declaration order of the members, emitting
4043 a warning to that effect.  This warning is enabled by @option{-Wall}.
4045 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4046 @opindex Wpessimizing-move
4047 @opindex Wno-pessimizing-move
4048 This warning warns when a call to @code{std::move} prevents copy
4049 elision.  A typical scenario when copy elision can occur is when returning in
4050 a function with a class return type, when the expression being returned is the
4051 name of a non-volatile automatic object, and is not a function parameter, and
4052 has the same type as the function return type.
4054 @smallexample
4055 struct T @{
4056 @dots{}
4058 T fn()
4060   T t;
4061   @dots{}
4062   return std::move (t);
4064 @end smallexample
4066 But in this example, the @code{std::move} call prevents copy elision.
4068 This warning is enabled by @option{-Wall}.
4070 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4071 @opindex Wredundant-move
4072 @opindex Wno-redundant-move
4073 This warning warns about redundant calls to @code{std::move}; that is, when
4074 a move operation would have been performed even without the @code{std::move}
4075 call.  This happens because the compiler is forced to treat the object as if
4076 it were an rvalue in certain situations such as returning a local variable,
4077 where copy elision isn't applicable.  Consider:
4079 @smallexample
4080 struct T @{
4081 @dots{}
4083 T fn(T t)
4085   @dots{}
4086   return std::move (t);
4088 @end smallexample
4090 Here, the @code{std::move} call is redundant.  Because G++ implements Core
4091 Issue 1579, another example is:
4093 @smallexample
4094 struct T @{ // convertible to U
4095 @dots{}
4097 struct U @{
4098 @dots{}
4100 U fn()
4102   T t;
4103   @dots{}
4104   return std::move (t);
4106 @end smallexample
4107 In this example, copy elision isn't applicable because the type of the
4108 expression being returned and the function return type differ, yet G++
4109 treats the return value as if it were designated by an rvalue.
4111 This warning is enabled by @option{-Wextra}.
4113 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4114 @opindex Wrange-loop-construct
4115 @opindex Wno-range-loop-construct
4116 This warning warns when a C++ range-based for-loop is creating an unnecessary
4117 copy.  This can happen when the range declaration is not a reference, but
4118 probably should be.  For example:
4120 @smallexample
4121 struct S @{ char arr[128]; @};
4122 void fn () @{
4123   S arr[5];
4124   for (const auto x : arr) @{ @dots{} @}
4126 @end smallexample
4128 It does not warn when the type being copied is a trivially-copyable type whose
4129 size is less than 64 bytes.
4131 This warning also warns when a loop variable in a range-based for-loop is
4132 initialized with a value of a different type resulting in a copy.  For example:
4134 @smallexample
4135 void fn() @{
4136   int arr[10];
4137   for (const double &x : arr) @{ @dots{} @}
4139 @end smallexample
4141 In the example above, in every iteration of the loop a temporary value of
4142 type @code{double} is created and destroyed, to which the reference
4143 @code{const double &} is bound.
4145 This warning is enabled by @option{-Wall}.
4147 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4148 @opindex Wredundant-tags
4149 @opindex Wno-redundant-tags
4150 Warn about redundant class-key and enum-key in references to class types
4151 and enumerated types in contexts where the key can be eliminated without
4152 causing an ambiguity.  For example:
4154 @smallexample
4155 struct foo;
4156 struct foo *p;   // warn that keyword struct can be eliminated
4157 @end smallexample
4159 @noindent
4160 On the other hand, in this example there is no warning:
4162 @smallexample
4163 struct foo;
4164 void foo ();   // "hides" struct foo
4165 void bar (struct foo&);  // no warning, keyword struct is necessary
4166 @end smallexample
4168 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4169 @opindex Wsubobject-linkage
4170 @opindex Wno-subobject-linkage
4171 Do not warn
4172 if a class type has a base or a field whose type uses the anonymous
4173 namespace or depends on a type with no linkage.  If a type A depends on
4174 a type B with no or internal linkage, defining it in multiple
4175 translation units would be an ODR violation because the meaning of B
4176 is different in each translation unit.  If A only appears in a single
4177 translation unit, the best way to silence the warning is to give it
4178 internal linkage by putting it in an anonymous namespace as well.  The
4179 compiler doesn't give this warning for types defined in the main .C
4180 file, as those are unlikely to have multiple definitions.
4181 @option{-Wsubobject-linkage} is enabled by default.
4183 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4184 @opindex Weffc++
4185 @opindex Wno-effc++
4186 Warn about violations of the following style guidelines from Scott Meyers'
4187 @cite{Effective C++} series of books:
4189 @itemize @bullet
4190 @item
4191 Define a copy constructor and an assignment operator for classes
4192 with dynamically-allocated memory.
4194 @item
4195 Prefer initialization to assignment in constructors.
4197 @item
4198 Have @code{operator=} return a reference to @code{*this}.
4200 @item
4201 Don't try to return a reference when you must return an object.
4203 @item
4204 Distinguish between prefix and postfix forms of increment and
4205 decrement operators.
4207 @item
4208 Never overload @code{&&}, @code{||}, or @code{,}.
4210 @end itemize
4212 This option also enables @option{-Wnon-virtual-dtor}, which is also
4213 one of the effective C++ recommendations.  However, the check is
4214 extended to warn about the lack of virtual destructor in accessible
4215 non-polymorphic bases classes too.
4217 When selecting this option, be aware that the standard library
4218 headers do not obey all of these guidelines; use @samp{grep -v}
4219 to filter out those warnings.
4221 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4222 @opindex Wexceptions
4223 @opindex Wno-exceptions
4224 Disable the warning about the case when an exception handler is shadowed by
4225 another handler, which can point out a wrong ordering of exception handlers.
4227 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4228 @opindex Wstrict-null-sentinel
4229 @opindex Wno-strict-null-sentinel
4230 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4231 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4232 to @code{__null}.  Although it is a null pointer constant rather than a
4233 null pointer, it is guaranteed to be of the same size as a pointer.
4234 But this use is not portable across different compilers.
4236 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4237 @opindex Wno-non-template-friend
4238 @opindex Wnon-template-friend
4239 Disable warnings when non-template friend functions are declared
4240 within a template.  In very old versions of GCC that predate implementation
4241 of the ISO standard, declarations such as 
4242 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4243 could be interpreted as a particular specialization of a template
4244 function; the warning exists to diagnose compatibility problems, 
4245 and is enabled by default.
4247 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4248 @opindex Wold-style-cast
4249 @opindex Wno-old-style-cast
4250 Warn if an old-style (C-style) cast to a non-void type is used within
4251 a C++ program.  The new-style casts (@code{dynamic_cast},
4252 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4253 less vulnerable to unintended effects and much easier to search for.
4255 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4256 @itemx -Woverloaded-virtual=@var{n}
4257 @opindex Woverloaded-virtual
4258 @opindex Wno-overloaded-virtual
4259 @cindex overloaded virtual function, warning
4260 @cindex warning for overloaded virtual function
4261 Warn when a function declaration hides virtual functions from a
4262 base class.  For example, in:
4264 @smallexample
4265 struct A @{
4266   virtual void f();
4269 struct B: public A @{
4270   void f(int); // does not override
4272 @end smallexample
4274 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4275 like:
4277 @smallexample
4278 B* b;
4279 b->f();
4280 @end smallexample
4282 @noindent
4283 fails to compile.
4285 The optional level suffix controls the behavior when all the
4286 declarations in the derived class override virtual functions in the
4287 base class, even if not all of the base functions are overridden:
4289 @smallexample
4290 struct C @{
4291   virtual void f();
4292   virtual void f(int);
4295 struct D: public C @{
4296   void f(int); // does override
4298 @end smallexample
4300 This pattern is less likely to be a mistake; if D is only used
4301 virtually, the user might have decided that the base class semantics
4302 for some of the overloads are fine.
4304 At level 1, this case does not warn; at level 2, it does.
4305 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4306 included in @option{-Wall}.
4308 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4309 @opindex Wno-pmf-conversions
4310 @opindex Wpmf-conversions
4311 Disable the diagnostic for converting a bound pointer to member function
4312 to a plain pointer.
4314 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4315 @opindex Wsign-promo
4316 @opindex Wno-sign-promo
4317 Warn when overload resolution chooses a promotion from unsigned or
4318 enumerated type to a signed type, over a conversion to an unsigned type of
4319 the same size.  Previous versions of G++ tried to preserve
4320 unsignedness, but the standard mandates the current behavior.
4322 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4323 @opindex Wtemplates
4324 @opindex Wno-templates
4325 Warn when a primary template declaration is encountered.  Some coding
4326 rules disallow templates, and this may be used to enforce that rule.
4327 The warning is inactive inside a system header file, such as the STL, so
4328 one can still use the STL.  One may also instantiate or specialize
4329 templates.
4331 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4332 @opindex Wmismatched-new-delete
4333 @opindex Wno-mismatched-new-delete
4334 Warn for mismatches between calls to @code{operator new} or @code{operator
4335 delete} and the corresponding call to the allocation or deallocation function.
4336 This includes invocations of C++ @code{operator delete} with pointers
4337 returned from either mismatched forms of @code{operator new}, or from other
4338 functions that allocate objects for which the @code{operator delete} isn't
4339 a suitable deallocator, as well as calls to other deallocation functions
4340 with pointers returned from @code{operator new} for which the deallocation
4341 function isn't suitable.
4343 For example, the @code{delete} expression in the function below is diagnosed
4344 because it doesn't match the array form of the @code{new} expression
4345 the pointer argument was returned from.  Similarly, the call to @code{free}
4346 is also diagnosed.
4348 @smallexample
4349 void f ()
4351   int *a = new int[n];
4352   delete a;   // warning: mismatch in array forms of expressions
4354   char *p = new char[n];
4355   free (p);   // warning: mismatch between new and free
4357 @end smallexample
4359 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4360 involving allocation and deallocation functions other than @code{operator
4361 new} and @code{operator delete}.
4363 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4365 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4366 @opindex Wmismatched-tags
4367 @opindex Wno-mismatched-tags
4368 Warn for declarations of structs, classes, and class templates and their
4369 specializations with a class-key that does not match either the definition
4370 or the first declaration if no definition is provided.
4372 For example, the declaration of @code{struct Object} in the argument list
4373 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4374 class-key @code{struct} or replace it with @code{class} to match its definition.
4375 @smallexample
4376 class Object @{
4377 public:
4378   virtual ~Object () = 0;
4380 void draw (struct Object*);
4381 @end smallexample
4383 It is not wrong to declare a class with the class-key @code{struct} as
4384 the example above shows.  The @option{-Wmismatched-tags} option is intended
4385 to help achieve a consistent style of class declarations.  In code that is
4386 intended to be portable to Windows-based compilers the warning helps prevent
4387 unresolved references due to the difference in the mangling of symbols
4388 declared with different class-keys.  The option can be used either on its
4389 own or in conjunction with @option{-Wredundant-tags}.
4391 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4392 @opindex Wmultiple-inheritance
4393 @opindex Wno-multiple-inheritance
4394 Warn when a class is defined with multiple direct base classes.  Some
4395 coding rules disallow multiple inheritance, and this may be used to
4396 enforce that rule.  The warning is inactive inside a system header file,
4397 such as the STL, so one can still use the STL.  One may also define
4398 classes that indirectly use multiple inheritance.
4400 @item -Wvirtual-inheritance
4401 @opindex Wvirtual-inheritance
4402 @opindex Wno-virtual-inheritance
4403 Warn when a class is defined with a virtual direct base class.  Some
4404 coding rules disallow multiple inheritance, and this may be used to
4405 enforce that rule.  The warning is inactive inside a system header file,
4406 such as the STL, so one can still use the STL.  One may also define
4407 classes that indirectly use virtual inheritance.
4409 @item -Wno-virtual-move-assign
4410 @opindex Wvirtual-move-assign
4411 @opindex Wno-virtual-move-assign
4412 Suppress warnings about inheriting from a virtual base with a
4413 non-trivial C++11 move assignment operator.  This is dangerous because
4414 if the virtual base is reachable along more than one path, it is
4415 moved multiple times, which can mean both objects end up in the
4416 moved-from state.  If the move assignment operator is written to avoid
4417 moving from a moved-from object, this warning can be disabled.
4419 @item -Wnamespaces
4420 @opindex Wnamespaces
4421 @opindex Wno-namespaces
4422 Warn when a namespace definition is opened.  Some coding rules disallow
4423 namespaces, and this may be used to enforce that rule.  The warning is
4424 inactive inside a system header file, such as the STL, so one can still
4425 use the STL.  One may also use using directives and qualified names.
4427 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4428 @opindex Wterminate
4429 @opindex Wno-terminate
4430 Disable the warning about a throw-expression that will immediately
4431 result in a call to @code{terminate}.
4433 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4434 @opindex Wvexing-parse
4435 @opindex Wno-vexing-parse
4436 Warn about the most vexing parse syntactic ambiguity.  This warns about
4437 the cases when a declaration looks like a variable definition, but the
4438 C++ language requires it to be interpreted as a function declaration.
4439 For instance:
4441 @smallexample
4442 void f(double a) @{
4443   int i();        // extern int i (void);
4444   int n(int(a));  // extern int n (int);
4446 @end smallexample
4448 Another example:
4450 @smallexample
4451 struct S @{ S(int); @};
4452 void f(double a) @{
4453   S x(int(a));   // extern struct S x (int);
4454   S y(int());    // extern struct S y (int (*) (void));
4455   S z();         // extern struct S z (void);
4457 @end smallexample
4459 The warning will suggest options how to deal with such an ambiguity; e.g.,
4460 it can suggest removing the parentheses or using braces instead.
4462 This warning is enabled by default.
4464 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4465 @opindex Wno-class-conversion
4466 @opindex Wclass-conversion
4467 Do not warn when a conversion function converts an
4468 object to the same type, to a base class of that type, or to void; such
4469 a conversion function will never be called.
4471 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4472 @opindex Wvolatile
4473 @opindex Wno-volatile
4474 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4475 postfix and prefix @code{++} and @code{--} expressions of
4476 @code{volatile}-qualified types, using simple assignments where the left
4477 operand is a @code{volatile}-qualified non-class type for their value,
4478 compound assignments where the left operand is a @code{volatile}-qualified
4479 non-class type, @code{volatile}-qualified function return type,
4480 @code{volatile}-qualified parameter type, and structured bindings of a
4481 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4483 Enabled by default with @option{-std=c++20}.
4485 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4486 @opindex Wzero-as-null-pointer-constant
4487 @opindex Wno-zero-as-null-pointer-constant
4488 Warn when a literal @samp{0} is used as null pointer constant.  This can
4489 be useful to facilitate the conversion to @code{nullptr} in C++11.
4491 @item -Waligned-new
4492 @opindex Waligned-new
4493 @opindex Wno-aligned-new
4494 Warn about a new-expression of a type that requires greater alignment
4495 than the @code{alignof(std::max_align_t)} but uses an allocation
4496 function without an explicit alignment parameter. This option is
4497 enabled by @option{-Wall}.
4499 Normally this only warns about global allocation functions, but
4500 @option{-Waligned-new=all} also warns about class member allocation
4501 functions.
4503 @item -Wno-placement-new
4504 @itemx -Wplacement-new=@var{n}
4505 @opindex Wplacement-new
4506 @opindex Wno-placement-new
4507 Warn about placement new expressions with undefined behavior, such as
4508 constructing an object in a buffer that is smaller than the type of
4509 the object.  For example, the placement new expression below is diagnosed
4510 because it attempts to construct an array of 64 integers in a buffer only
4511 64 bytes large.
4512 @smallexample
4513 char buf [64];
4514 new (buf) int[64];
4515 @end smallexample
4516 This warning is enabled by default.
4518 @table @gcctabopt
4519 @item -Wplacement-new=1
4520 This is the default warning level of @option{-Wplacement-new}.  At this
4521 level the warning is not issued for some strictly undefined constructs that
4522 GCC allows as extensions for compatibility with legacy code.  For example,
4523 the following @code{new} expression is not diagnosed at this level even
4524 though it has undefined behavior according to the C++ standard because
4525 it writes past the end of the one-element array.
4526 @smallexample
4527 struct S @{ int n, a[1]; @};
4528 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4529 new (s->a)int [32]();
4530 @end smallexample
4532 @item -Wplacement-new=2
4533 At this level, in addition to diagnosing all the same constructs as at level
4534 1, a diagnostic is also issued for placement new expressions that construct
4535 an object in the last member of structure whose type is an array of a single
4536 element and whose size is less than the size of the object being constructed.
4537 While the previous example would be diagnosed, the following construct makes
4538 use of the flexible member array extension to avoid the warning at level 2.
4539 @smallexample
4540 struct S @{ int n, a[]; @};
4541 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4542 new (s->a)int [32]();
4543 @end smallexample
4545 @end table
4547 @item -Wcatch-value
4548 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4549 @opindex Wcatch-value
4550 @opindex Wno-catch-value
4551 Warn about catch handlers that do not catch via reference.
4552 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4553 warn about polymorphic class types that are caught by value.
4554 With @option{-Wcatch-value=2} warn about all class types that are caught
4555 by value. With @option{-Wcatch-value=3} warn about all types that are
4556 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4558 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4559 @opindex Wconditionally-supported
4560 @opindex Wno-conditionally-supported
4561 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4563 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4564 @opindex Wdelete-incomplete
4565 @opindex Wno-delete-incomplete
4566 Do not warn when deleting a pointer to incomplete type, which may cause
4567 undefined behavior at runtime.  This warning is enabled by default.
4569 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4570 @opindex Wextra-semi
4571 @opindex Wno-extra-semi
4572 Warn about redundant semicolons after in-class function definitions.
4574 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4575 @opindex Winaccessible-base
4576 @opindex Wno-inaccessible-base
4577 This option controls warnings
4578 when a base class is inaccessible in a class derived from it due to
4579 ambiguity.  The warning is enabled by default.
4580 Note that the warning for ambiguous virtual
4581 bases is enabled by the @option{-Wextra} option.
4582 @smallexample
4583 @group
4584 struct A @{ int a; @};
4586 struct B : A @{ @};
4588 struct C : B, A @{ @};
4589 @end group
4590 @end smallexample
4592 @item -Wno-inherited-variadic-ctor
4593 @opindex Winherited-variadic-ctor
4594 @opindex Wno-inherited-variadic-ctor
4595 Suppress warnings about use of C++11 inheriting constructors when the
4596 base class inherited from has a C variadic constructor; the warning is
4597 on by default because the ellipsis is not inherited.
4599 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4600 @opindex Wno-invalid-offsetof
4601 @opindex Winvalid-offsetof
4602 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4603 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4604 to a non-standard-layout type is undefined.  In existing C++ implementations,
4605 however, @code{offsetof} typically gives meaningful results.
4606 This flag is for users who are aware that they are
4607 writing nonportable code and who have deliberately chosen to ignore the
4608 warning about it.
4610 The restrictions on @code{offsetof} may be relaxed in a future version
4611 of the C++ standard.
4613 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4614 @opindex Wsized-deallocation
4615 @opindex Wno-sized-deallocation
4616 Warn about a definition of an unsized deallocation function
4617 @smallexample
4618 void operator delete (void *) noexcept;
4619 void operator delete[] (void *) noexcept;
4620 @end smallexample
4621 without a definition of the corresponding sized deallocation function
4622 @smallexample
4623 void operator delete (void *, std::size_t) noexcept;
4624 void operator delete[] (void *, std::size_t) noexcept;
4625 @end smallexample
4626 or vice versa.  Enabled by @option{-Wextra} along with
4627 @option{-fsized-deallocation}.
4629 @item -Wsuggest-final-types
4630 @opindex Wno-suggest-final-types
4631 @opindex Wsuggest-final-types
4632 Warn about types with virtual methods where code quality would be improved
4633 if the type were declared with the C++11 @code{final} specifier,
4634 or, if possible,
4635 declared in an anonymous namespace. This allows GCC to more aggressively
4636 devirtualize the polymorphic calls. This warning is more effective with
4637 link-time optimization,
4638 where the information about the class hierarchy graph is
4639 more complete.
4641 @item -Wsuggest-final-methods
4642 @opindex Wno-suggest-final-methods
4643 @opindex Wsuggest-final-methods
4644 Warn about virtual methods where code quality would be improved if the method
4645 were declared with the C++11 @code{final} specifier,
4646 or, if possible, its type were
4647 declared in an anonymous namespace or with the @code{final} specifier.
4648 This warning is
4649 more effective with link-time optimization, where the information about the
4650 class hierarchy graph is more complete. It is recommended to first consider
4651 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4652 annotations.
4654 @item -Wsuggest-override
4655 @opindex Wsuggest-override
4656 @opindex Wno-suggest-override
4657 Warn about overriding virtual functions that are not marked with the
4658 @code{override} keyword.
4660 @item -Wuse-after-free
4661 @itemx -Wuse-after-free=@var{n}
4662 @opindex Wuse-after-free
4663 @opindex Wno-use-after-free
4664 Warn about uses of pointers to dynamically allocated objects that have
4665 been rendered indeterminate by a call to a deallocation function.
4666 The warning is enabled at all optimization levels but may yield different
4667 results with optimization than without.
4669 @table @gcctabopt
4670 @item -Wuse-after-free=1
4671 At level 1 the warning attempts to diagnose only unconditional uses
4672 of pointers made indeterminate by a deallocation call or a successful
4673 call to @code{realloc}, regardless of whether or not the call resulted
4674 in an actual reallocatio of memory.  This includes double-@code{free}
4675 calls as well as uses in arithmetic and relational expressions.  Although
4676 undefined, uses of indeterminate pointers in equality (or inequality)
4677 expressions are not diagnosed at this level.
4678 @item -Wuse-after-free=2
4679 At level 2, in addition to unconditional uses, the warning also diagnoses
4680 conditional uses of pointers made indeterminate by a deallocation call.
4681 As at level 2, uses in equality (or inequality) expressions are not
4682 diagnosed.  For example, the second call to @code{free} in the following
4683 function is diagnosed at this level:
4684 @smallexample
4685 struct A @{ int refcount; void *data; @};
4687 void release (struct A *p)
4689   int refcount = --p->refcount;
4690   free (p);
4691   if (refcount == 0)
4692     free (p->data);   // warning: p may be used after free
4694 @end smallexample
4695 @item -Wuse-after-free=3
4696 At level 3, the warning also diagnoses uses of indeterminate pointers in
4697 equality expressions.  All uses of indeterminate pointers are undefined
4698 but equality tests sometimes appear after calls to @code{realloc} as
4699 an attempt to determine whether the call resulted in relocating the object
4700 to a different address.  They are diagnosed at a separate level to aid
4701 legacy code gradually transition to safe alternatives.  For example,
4702 the equality test in the function below is diagnosed at this level:
4703 @smallexample
4704 void adjust_pointers (int**, int);
4706 void grow (int **p, int n)
4708   int **q = (int**)realloc (p, n *= 2);
4709   if (q == p)
4710     return;
4711   adjust_pointers ((int**)q, n);
4713 @end smallexample
4714 To avoid the warning at this level, store offsets into allocated memory
4715 instead of pointers.  This approach obviates needing to adjust the stored
4716 pointers after reallocation.
4717 @end table
4719 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4721 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4722 @opindex Wuseless-cast
4723 @opindex Wno-useless-cast
4724 Warn when an expression is cast to its own type.  This warning does not
4725 occur when a class object is converted to a non-reference type as that
4726 is a way to create a temporary:
4728 @smallexample
4729 struct S @{ @};
4730 void g (S&&);
4731 void f (S&& arg)
4733   g (S(arg)); // make arg prvalue so that it can bind to S&&
4735 @end smallexample
4737 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4738 @opindex Wconversion-null
4739 @opindex Wno-conversion-null
4740 Do not warn for conversions between @code{NULL} and non-pointer
4741 types. @option{-Wconversion-null} is enabled by default.
4743 @end table
4745 @node Objective-C and Objective-C++ Dialect Options
4746 @section Options Controlling Objective-C and Objective-C++ Dialects
4748 @cindex compiler options, Objective-C and Objective-C++
4749 @cindex Objective-C and Objective-C++ options, command-line
4750 @cindex options, Objective-C and Objective-C++
4751 (NOTE: This manual does not describe the Objective-C and Objective-C++
4752 languages themselves.  @xref{Standards,,Language Standards
4753 Supported by GCC}, for references.)
4755 This section describes the command-line options that are only meaningful
4756 for Objective-C and Objective-C++ programs.  You can also use most of
4757 the language-independent GNU compiler options.
4758 For example, you might compile a file @file{some_class.m} like this:
4760 @smallexample
4761 gcc -g -fgnu-runtime -O -c some_class.m
4762 @end smallexample
4764 @noindent
4765 In this example, @option{-fgnu-runtime} is an option meant only for
4766 Objective-C and Objective-C++ programs; you can use the other options with
4767 any language supported by GCC@.
4769 Note that since Objective-C is an extension of the C language, Objective-C
4770 compilations may also use options specific to the C front-end (e.g.,
4771 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4772 C++-specific options (e.g., @option{-Wabi}).
4774 Here is a list of options that are @emph{only} for compiling Objective-C
4775 and Objective-C++ programs:
4777 @table @gcctabopt
4778 @item -fconstant-string-class=@var{class-name}
4779 @opindex fconstant-string-class
4780 Use @var{class-name} as the name of the class to instantiate for each
4781 literal string specified with the syntax @code{@@"@dots{}"}.  The default
4782 class name is @code{NXConstantString} if the GNU runtime is being used, and
4783 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
4784 @option{-fconstant-cfstrings} option, if also present, overrides the
4785 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4786 to be laid out as constant CoreFoundation strings.
4788 @item -fgnu-runtime
4789 @opindex fgnu-runtime
4790 Generate object code compatible with the standard GNU Objective-C
4791 runtime.  This is the default for most types of systems.
4793 @item -fnext-runtime
4794 @opindex fnext-runtime
4795 Generate output compatible with the NeXT runtime.  This is the default
4796 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
4797 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4798 used.
4800 @item -fno-nil-receivers
4801 @opindex fno-nil-receivers
4802 @opindex fnil-receivers
4803 Assume that all Objective-C message dispatches (@code{[receiver
4804 message:arg]}) in this translation unit ensure that the receiver is
4805 not @code{nil}.  This allows for more efficient entry points in the
4806 runtime to be used.  This option is only available in conjunction with
4807 the NeXT runtime and ABI version 0 or 1.
4809 @item -fobjc-abi-version=@var{n}
4810 @opindex fobjc-abi-version
4811 Use version @var{n} of the Objective-C ABI for the selected runtime.
4812 This option is currently supported only for the NeXT runtime.  In that
4813 case, Version 0 is the traditional (32-bit) ABI without support for
4814 properties and other Objective-C 2.0 additions.  Version 1 is the
4815 traditional (32-bit) ABI with support for properties and other
4816 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4817 nothing is specified, the default is Version 0 on 32-bit target
4818 machines, and Version 2 on 64-bit target machines.
4820 @item -fobjc-call-cxx-cdtors
4821 @opindex fobjc-call-cxx-cdtors
4822 For each Objective-C class, check if any of its instance variables is a
4823 C++ object with a non-trivial default constructor.  If so, synthesize a
4824 special @code{- (id) .cxx_construct} instance method which runs
4825 non-trivial default constructors on any such instance variables, in order,
4826 and then return @code{self}.  Similarly, check if any instance variable
4827 is a C++ object with a non-trivial destructor, and if so, synthesize a
4828 special @code{- (void) .cxx_destruct} method which runs
4829 all such default destructors, in reverse order.
4831 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4832 methods thusly generated only operate on instance variables
4833 declared in the current Objective-C class, and not those inherited
4834 from superclasses.  It is the responsibility of the Objective-C
4835 runtime to invoke all such methods in an object's inheritance
4836 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4837 by the runtime immediately after a new object instance is allocated;
4838 the @code{- (void) .cxx_destruct} methods are invoked immediately
4839 before the runtime deallocates an object instance.
4841 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4842 support for invoking the @code{- (id) .cxx_construct} and
4843 @code{- (void) .cxx_destruct} methods.
4845 @item -fobjc-direct-dispatch
4846 @opindex fobjc-direct-dispatch
4847 Allow fast jumps to the message dispatcher.  On Darwin this is
4848 accomplished via the comm page.
4850 @item -fobjc-exceptions
4851 @opindex fobjc-exceptions
4852 Enable syntactic support for structured exception handling in
4853 Objective-C, similar to what is offered by C++.  This option
4854 is required to use the Objective-C keywords @code{@@try},
4855 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4856 @code{@@synchronized}.  This option is available with both the GNU
4857 runtime and the NeXT runtime (but not available in conjunction with
4858 the NeXT runtime on Mac OS X 10.2 and earlier).
4860 @item -fobjc-gc
4861 @opindex fobjc-gc
4862 Enable garbage collection (GC) in Objective-C and Objective-C++
4863 programs.  This option is only available with the NeXT runtime; the
4864 GNU runtime has a different garbage collection implementation that
4865 does not require special compiler flags.
4867 @item -fobjc-nilcheck
4868 @opindex fobjc-nilcheck
4869 For the NeXT runtime with version 2 of the ABI, check for a nil
4870 receiver in method invocations before doing the actual method call.
4871 This is the default and can be disabled using
4872 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
4873 checked for nil in this way no matter what this flag is set to.
4874 Currently this flag does nothing when the GNU runtime, or an older
4875 version of the NeXT runtime ABI, is used.
4877 @item -fobjc-std=objc1
4878 @opindex fobjc-std
4879 Conform to the language syntax of Objective-C 1.0, the language
4880 recognized by GCC 4.0.  This only affects the Objective-C additions to
4881 the C/C++ language; it does not affect conformance to C/C++ standards,
4882 which is controlled by the separate C/C++ dialect option flags.  When
4883 this option is used with the Objective-C or Objective-C++ compiler,
4884 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4885 This is useful if you need to make sure that your Objective-C code can
4886 be compiled with older versions of GCC@.
4888 @item -freplace-objc-classes
4889 @opindex freplace-objc-classes
4890 Emit a special marker instructing @command{ld(1)} not to statically link in
4891 the resulting object file, and allow @command{dyld(1)} to load it in at
4892 run time instead.  This is used in conjunction with the Fix-and-Continue
4893 debugging mode, where the object file in question may be recompiled and
4894 dynamically reloaded in the course of program execution, without the need
4895 to restart the program itself.  Currently, Fix-and-Continue functionality
4896 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4897 and later.
4899 @item -fzero-link
4900 @opindex fzero-link
4901 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4902 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4903 compile time) with static class references that get initialized at load time,
4904 which improves run-time performance.  Specifying the @option{-fzero-link} flag
4905 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4906 to be retained.  This is useful in Zero-Link debugging mode, since it allows
4907 for individual class implementations to be modified during program execution.
4908 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4909 regardless of command-line options.
4911 @item -fno-local-ivars
4912 @opindex fno-local-ivars
4913 @opindex flocal-ivars
4914 By default instance variables in Objective-C can be accessed as if
4915 they were local variables from within the methods of the class they're
4916 declared in.  This can lead to shadowing between instance variables
4917 and other variables declared either locally inside a class method or
4918 globally with the same name.  Specifying the @option{-fno-local-ivars}
4919 flag disables this behavior thus avoiding variable shadowing issues.
4921 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4922 @opindex fivar-visibility
4923 Set the default instance variable visibility to the specified option
4924 so that instance variables declared outside the scope of any access
4925 modifier directives default to the specified visibility.
4927 @item -gen-decls
4928 @opindex gen-decls
4929 Dump interface declarations for all classes seen in the source file to a
4930 file named @file{@var{sourcename}.decl}.
4932 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4933 @opindex Wassign-intercept
4934 @opindex Wno-assign-intercept
4935 Warn whenever an Objective-C assignment is being intercepted by the
4936 garbage collector.
4938 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4939 @opindex Wproperty-assign-default
4940 @opindex Wno-property-assign-default
4941 Do not warn if a property for an Objective-C object has no assign
4942 semantics specified.
4944 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4945 @opindex Wno-protocol
4946 @opindex Wprotocol
4947 If a class is declared to implement a protocol, a warning is issued for
4948 every method in the protocol that is not implemented by the class.  The
4949 default behavior is to issue a warning for every method not explicitly
4950 implemented in the class, even if a method implementation is inherited
4951 from the superclass.  If you use the @option{-Wno-protocol} option, then
4952 methods inherited from the superclass are considered to be implemented,
4953 and no warning is issued for them.
4955 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4956 @opindex Wobjc-root-class
4957 Warn if a class interface lacks a superclass. Most classes will inherit
4958 from @code{NSObject} (or @code{Object}) for example.  When declaring
4959 classes intended to be root classes, the warning can be suppressed by
4960 marking their interfaces with @code{__attribute__((objc_root_class))}.
4962 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4963 @opindex Wselector
4964 @opindex Wno-selector
4965 Warn if multiple methods of different types for the same selector are
4966 found during compilation.  The check is performed on the list of methods
4967 in the final stage of compilation.  Additionally, a check is performed
4968 for each selector appearing in a @code{@@selector(@dots{})}
4969 expression, and a corresponding method for that selector has been found
4970 during compilation.  Because these checks scan the method table only at
4971 the end of compilation, these warnings are not produced if the final
4972 stage of compilation is not reached, for example because an error is
4973 found during compilation, or because the @option{-fsyntax-only} option is
4974 being used.
4976 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4977 @opindex Wstrict-selector-match
4978 @opindex Wno-strict-selector-match
4979 Warn if multiple methods with differing argument and/or return types are
4980 found for a given selector when attempting to send a message using this
4981 selector to a receiver of type @code{id} or @code{Class}.  When this flag
4982 is off (which is the default behavior), the compiler omits such warnings
4983 if any differences found are confined to types that share the same size
4984 and alignment.
4986 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4987 @opindex Wundeclared-selector
4988 @opindex Wno-undeclared-selector
4989 Warn if a @code{@@selector(@dots{})} expression referring to an
4990 undeclared selector is found.  A selector is considered undeclared if no
4991 method with that name has been declared before the
4992 @code{@@selector(@dots{})} expression, either explicitly in an
4993 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4994 an @code{@@implementation} section.  This option always performs its
4995 checks as soon as a @code{@@selector(@dots{})} expression is found,
4996 while @option{-Wselector} only performs its checks in the final stage of
4997 compilation.  This also enforces the coding style convention
4998 that methods and selectors must be declared before being used.
5000 @item -print-objc-runtime-info
5001 @opindex print-objc-runtime-info
5002 Generate C header describing the largest structure that is passed by
5003 value, if any.
5005 @end table
5007 @node Diagnostic Message Formatting Options
5008 @section Options to Control Diagnostic Messages Formatting
5009 @cindex options to control diagnostics formatting
5010 @cindex diagnostic messages
5011 @cindex message formatting
5013 Traditionally, diagnostic messages have been formatted irrespective of
5014 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
5015 options described below
5016 to control the formatting algorithm for diagnostic messages, 
5017 e.g.@: how many characters per line, how often source location
5018 information should be reported.  Note that some language front ends may not
5019 honor these options.
5021 @table @gcctabopt
5022 @item -fmessage-length=@var{n}
5023 @opindex fmessage-length
5024 Try to format error messages so that they fit on lines of about
5025 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
5026 done; each error message appears on a single line.  This is the
5027 default for all front ends.
5029 Note - this option also affects the display of the @samp{#error} and
5030 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5031 function/type/variable attribute.  It does not however affect the
5032 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5034 @item -fdiagnostics-plain-output
5035 This option requests that diagnostic output look as plain as possible, which
5036 may be useful when running @command{dejagnu} or other utilities that need to
5037 parse diagnostics output and prefer that it remain more stable over time.
5038 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5039 options:
5040 @gccoptlist{-fno-diagnostics-show-caret @gol
5041 -fno-diagnostics-show-line-numbers @gol
5042 -fdiagnostics-color=never @gol
5043 -fdiagnostics-urls=never @gol
5044 -fdiagnostics-path-format=separate-events}
5045 In the future, if GCC changes the default appearance of its diagnostics, the
5046 corresponding option to disable the new behavior will be added to this list.
5048 @item -fdiagnostics-show-location=once
5049 @opindex fdiagnostics-show-location
5050 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
5051 reporter to emit source location information @emph{once}; that is, in
5052 case the message is too long to fit on a single physical line and has to
5053 be wrapped, the source location won't be emitted (as prefix) again,
5054 over and over, in subsequent continuation lines.  This is the default
5055 behavior.
5057 @item -fdiagnostics-show-location=every-line
5058 Only meaningful in line-wrapping mode.  Instructs the diagnostic
5059 messages reporter to emit the same source location information (as
5060 prefix) for physical lines that result from the process of breaking
5061 a message which is too long to fit on a single line.
5063 @item -fdiagnostics-color[=@var{WHEN}]
5064 @itemx -fno-diagnostics-color
5065 @opindex fdiagnostics-color
5066 @cindex highlight, color
5067 @vindex GCC_COLORS @r{environment variable}
5068 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
5069 or @samp{auto}.  The default depends on how the compiler has been configured,
5070 it can be any of the above @var{WHEN} options or also @samp{never}
5071 if @env{GCC_COLORS} environment variable isn't present in the environment,
5072 and @samp{auto} otherwise.
5073 @samp{auto} makes GCC use color only when the standard error is a terminal,
5074 and when not executing in an emacs shell.
5075 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5076 aliases for @option{-fdiagnostics-color=always} and
5077 @option{-fdiagnostics-color=never}, respectively.
5079 The colors are defined by the environment variable @env{GCC_COLORS}.
5080 Its value is a colon-separated list of capabilities and Select Graphic
5081 Rendition (SGR) substrings. SGR commands are interpreted by the
5082 terminal or terminal emulator.  (See the section in the documentation
5083 of your text terminal for permitted values and their meanings as
5084 character attributes.)  These substring values are integers in decimal
5085 representation and can be concatenated with semicolons.
5086 Common values to concatenate include
5087 @samp{1} for bold,
5088 @samp{4} for underline,
5089 @samp{5} for blink,
5090 @samp{7} for inverse,
5091 @samp{39} for default foreground color,
5092 @samp{30} to @samp{37} for foreground colors,
5093 @samp{90} to @samp{97} for 16-color mode foreground colors,
5094 @samp{38;5;0} to @samp{38;5;255}
5095 for 88-color and 256-color modes foreground colors,
5096 @samp{49} for default background color,
5097 @samp{40} to @samp{47} for background colors,
5098 @samp{100} to @samp{107} for 16-color mode background colors,
5099 and @samp{48;5;0} to @samp{48;5;255}
5100 for 88-color and 256-color modes background colors.
5102 The default @env{GCC_COLORS} is
5103 @smallexample
5104 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5105 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5106 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5107 type-diff=01;32:fnname=01;32:targs=35
5108 @end smallexample
5109 @noindent
5110 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5111 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5112 @samp{01} is bold, and @samp{31} is red.
5113 Setting @env{GCC_COLORS} to the empty string disables colors.
5114 Supported capabilities are as follows.
5116 @table @code
5117 @item error=
5118 @vindex error GCC_COLORS @r{capability}
5119 SGR substring for error: markers.
5121 @item warning=
5122 @vindex warning GCC_COLORS @r{capability}
5123 SGR substring for warning: markers.
5125 @item note=
5126 @vindex note GCC_COLORS @r{capability}
5127 SGR substring for note: markers.
5129 @item path=
5130 @vindex path GCC_COLORS @r{capability}
5131 SGR substring for colorizing paths of control-flow events as printed
5132 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5133 individual events and lines indicating interprocedural calls and returns.
5135 @item range1=
5136 @vindex range1 GCC_COLORS @r{capability}
5137 SGR substring for first additional range.
5139 @item range2=
5140 @vindex range2 GCC_COLORS @r{capability}
5141 SGR substring for second additional range.
5143 @item locus=
5144 @vindex locus GCC_COLORS @r{capability}
5145 SGR substring for location information, @samp{file:line} or
5146 @samp{file:line:column} etc.
5148 @item quote=
5149 @vindex quote GCC_COLORS @r{capability}
5150 SGR substring for information printed within quotes.
5152 @item fnname=
5153 @vindex fnname GCC_COLORS @r{capability}
5154 SGR substring for names of C++ functions.
5156 @item targs=
5157 @vindex targs GCC_COLORS @r{capability}
5158 SGR substring for C++ function template parameter bindings.
5160 @item fixit-insert=
5161 @vindex fixit-insert GCC_COLORS @r{capability}
5162 SGR substring for fix-it hints suggesting text to
5163 be inserted or replaced.
5165 @item fixit-delete=
5166 @vindex fixit-delete GCC_COLORS @r{capability}
5167 SGR substring for fix-it hints suggesting text to
5168 be deleted.
5170 @item diff-filename=
5171 @vindex diff-filename GCC_COLORS @r{capability}
5172 SGR substring for filename headers within generated patches.
5174 @item diff-hunk=
5175 @vindex diff-hunk GCC_COLORS @r{capability}
5176 SGR substring for the starts of hunks within generated patches.
5178 @item diff-delete=
5179 @vindex diff-delete GCC_COLORS @r{capability}
5180 SGR substring for deleted lines within generated patches.
5182 @item diff-insert=
5183 @vindex diff-insert GCC_COLORS @r{capability}
5184 SGR substring for inserted lines within generated patches.
5186 @item type-diff=
5187 @vindex type-diff GCC_COLORS @r{capability}
5188 SGR substring for highlighting mismatching types within template
5189 arguments in the C++ frontend.
5190 @end table
5192 @item -fdiagnostics-urls[=@var{WHEN}]
5193 @opindex fdiagnostics-urls
5194 @cindex urls
5195 @vindex GCC_URLS @r{environment variable}
5196 @vindex TERM_URLS @r{environment variable}
5197 Use escape sequences to embed URLs in diagnostics.  For example, when
5198 @option{-fdiagnostics-show-option} emits text showing the command-line
5199 option controlling a diagnostic, embed a URL for documentation of that
5200 option.
5202 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5203 @samp{auto} makes GCC use URL escape sequences only when the standard error
5204 is a terminal, and when not executing in an emacs shell or any graphical
5205 terminal which is known to be incompatible with this feature, see below.
5207 The default depends on how the compiler has been configured.
5208 It can be any of the above @var{WHEN} options.
5210 GCC can also be configured (via the
5211 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5212 so that the default is affected by environment variables.
5213 Under such a configuration, GCC defaults to using @samp{auto}
5214 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5215 present and non-empty in the environment of the compiler, or @samp{never}
5216 if neither are.
5218 However, even with @option{-fdiagnostics-urls=always} the behavior is
5219 dependent on those environment variables:
5220 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5221 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
5222 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5223 Any other non-empty value enables the feature.
5224 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5225 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5226 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5228 At this time GCC tries to detect also a few terminals that are known to
5229 not implement the URL feature, and have bugs or at least had bugs in
5230 some versions that are still in use, where the URL escapes are likely
5231 to misbehave, i.e. print garbage on the screen.
5232 That list is currently xfce4-terminal, certain known to be buggy
5233 gnome-terminal versions, the linux console, and mingw.
5234 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5236 @item -fno-diagnostics-show-option
5237 @opindex fno-diagnostics-show-option
5238 @opindex fdiagnostics-show-option
5239 By default, each diagnostic emitted includes text indicating the
5240 command-line option that directly controls the diagnostic (if such an
5241 option is known to the diagnostic machinery).  Specifying the
5242 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5244 @item -fno-diagnostics-show-caret
5245 @opindex fno-diagnostics-show-caret
5246 @opindex fdiagnostics-show-caret
5247 By default, each diagnostic emitted includes the original source line
5248 and a caret @samp{^} indicating the column.  This option suppresses this
5249 information.  The source line is truncated to @var{n} characters, if
5250 the @option{-fmessage-length=n} option is given.  When the output is done
5251 to the terminal, the width is limited to the width given by the
5252 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5254 @item -fno-diagnostics-show-labels
5255 @opindex fno-diagnostics-show-labels
5256 @opindex fdiagnostics-show-labels
5257 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5258 diagnostics can label ranges of source code with pertinent information, such
5259 as the types of expressions:
5261 @smallexample
5262     printf ("foo %s bar", long_i + long_j);
5263                  ~^       ~~~~~~~~~~~~~~~
5264                   |              |
5265                   char *         long int
5266 @end smallexample
5268 This option suppresses the printing of these labels (in the example above,
5269 the vertical bars and the ``char *'' and ``long int'' text).
5271 @item -fno-diagnostics-show-cwe
5272 @opindex fno-diagnostics-show-cwe
5273 @opindex fdiagnostics-show-cwe
5274 Diagnostic messages can optionally have an associated
5275 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5276 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5277 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
5278 By default, if this information is present, it will be printed with
5279 the diagnostic.  This option suppresses the printing of this metadata.
5281 @item -fno-diagnostics-show-rules
5282 @opindex fno-diagnostics-show-rules
5283 @opindex fdiagnostics-show-rules
5284 Diagnostic messages can optionally have rules associated with them, such
5285 as from a coding standard, or a specification.
5286 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5287 By default, if this information is present, it will be printed with
5288 the diagnostic.  This option suppresses the printing of this metadata.
5290 @item -fno-diagnostics-show-line-numbers
5291 @opindex fno-diagnostics-show-line-numbers
5292 @opindex fdiagnostics-show-line-numbers
5293 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5294 a left margin is printed, showing line numbers.  This option suppresses this
5295 left margin.
5297 @item -fdiagnostics-minimum-margin-width=@var{width}
5298 @opindex fdiagnostics-minimum-margin-width
5299 This option controls the minimum width of the left margin printed by
5300 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
5302 @item -fdiagnostics-parseable-fixits
5303 @opindex fdiagnostics-parseable-fixits
5304 Emit fix-it hints in a machine-parseable format, suitable for consumption
5305 by IDEs.  For each fix-it, a line will be printed after the relevant
5306 diagnostic, starting with the string ``fix-it:''.  For example:
5308 @smallexample
5309 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5310 @end smallexample
5312 The location is expressed as a half-open range, expressed as a count of
5313 bytes, starting at byte 1 for the initial column.  In the above example,
5314 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5315 given string:
5317 @smallexample
5318 00000000011111111112222222222
5319 12345678901234567890123456789
5320   gtk_widget_showall (dlg);
5321   ^^^^^^^^^^^^^^^^^^
5322   gtk_widget_show_all
5323 @end smallexample
5325 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5326 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5327 (e.g. vertical tab as ``\013'').
5329 An empty replacement string indicates that the given range is to be removed.
5330 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5331 be inserted at the given position.
5333 @item -fdiagnostics-generate-patch
5334 @opindex fdiagnostics-generate-patch
5335 Print fix-it hints to stderr in unified diff format, after any diagnostics
5336 are printed.  For example:
5338 @smallexample
5339 --- test.c
5340 +++ test.c
5341 @@ -42,5 +42,5 @@
5343  void show_cb(GtkDialog *dlg)
5344  @{
5345 -  gtk_widget_showall(dlg);
5346 +  gtk_widget_show_all(dlg);
5347  @}
5349 @end smallexample
5351 The diff may or may not be colorized, following the same rules
5352 as for diagnostics (see @option{-fdiagnostics-color}).
5354 @item -fdiagnostics-show-template-tree
5355 @opindex fdiagnostics-show-template-tree
5357 In the C++ frontend, when printing diagnostics showing mismatching
5358 template types, such as:
5360 @smallexample
5361   could not convert 'std::map<int, std::vector<double> >()'
5362     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5363 @end smallexample
5365 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5366 tree-like structure showing the common and differing parts of the types,
5367 such as:
5369 @smallexample
5370   map<
5371     [...],
5372     vector<
5373       [double != float]>>
5374 @end smallexample
5376 The parts that differ are highlighted with color (``double'' and
5377 ``float'' in this case).
5379 @item -fno-elide-type
5380 @opindex fno-elide-type
5381 @opindex felide-type
5382 By default when the C++ frontend prints diagnostics showing mismatching
5383 template types, common parts of the types are printed as ``[...]'' to
5384 simplify the error message.  For example:
5386 @smallexample
5387   could not convert 'std::map<int, std::vector<double> >()'
5388     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5389 @end smallexample
5391 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5392 This flag also affects the output of the
5393 @option{-fdiagnostics-show-template-tree} flag.
5395 @item -fdiagnostics-path-format=@var{KIND}
5396 @opindex fdiagnostics-path-format
5397 Specify how to print paths of control-flow events for diagnostics that
5398 have such a path associated with them.
5400 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5401 the default.
5403 @samp{none} means to not print diagnostic paths.
5405 @samp{separate-events} means to print a separate ``note'' diagnostic for
5406 each event within the diagnostic.  For example:
5408 @smallexample
5409 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5410 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5411 test.c:27:3: note: (2) when 'i < count'
5412 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5413 @end smallexample
5415 @samp{inline-events} means to print the events ``inline'' within the source
5416 code.  This view attempts to consolidate the events into runs of
5417 sufficiently-close events, printing them as labelled ranges within the source.
5419 For example, the same events as above might be printed as:
5421 @smallexample
5422   'test': events 1-3
5423     |
5424     |   25 |   list = PyList_New(0);
5425     |      |          ^~~~~~~~~~~~~
5426     |      |          |
5427     |      |          (1) when 'PyList_New' fails, returning NULL
5428     |   26 |
5429     |   27 |   for (i = 0; i < count; i++) @{
5430     |      |   ~~~
5431     |      |   |
5432     |      |   (2) when 'i < count'
5433     |   28 |     item = PyLong_FromLong(random());
5434     |   29 |     PyList_Append(list, item);
5435     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
5436     |      |     |
5437     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5438     |
5439 @end smallexample
5441 Interprocedural control flow is shown by grouping the events by stack frame,
5442 and using indentation to show how stack frames are nested, pushed, and popped.
5444 For example:
5446 @smallexample
5447   'test': events 1-2
5448     |
5449     |  133 | @{
5450     |      | ^
5451     |      | |
5452     |      | (1) entering 'test'
5453     |  134 |   boxed_int *obj = make_boxed_int (i);
5454     |      |                    ~~~~~~~~~~~~~~~~~~
5455     |      |                    |
5456     |      |                    (2) calling 'make_boxed_int'
5457     |
5458     +--> 'make_boxed_int': events 3-4
5459            |
5460            |  120 | @{
5461            |      | ^
5462            |      | |
5463            |      | (3) entering 'make_boxed_int'
5464            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5465            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5466            |      |                                    |
5467            |      |                                    (4) calling 'wrapped_malloc'
5468            |
5469            +--> 'wrapped_malloc': events 5-6
5470                   |
5471                   |    7 | @{
5472                   |      | ^
5473                   |      | |
5474                   |      | (5) entering 'wrapped_malloc'
5475                   |    8 |   return malloc (size);
5476                   |      |          ~~~~~~~~~~~~~
5477                   |      |          |
5478                   |      |          (6) calling 'malloc'
5479                   |
5480     <-------------+
5481     |
5482  'test': event 7
5483     |
5484     |  138 |   free_boxed_int (obj);
5485     |      |   ^~~~~~~~~~~~~~~~~~~~
5486     |      |   |
5487     |      |   (7) calling 'free_boxed_int'
5488     |
5489 (etc)
5490 @end smallexample
5492 @item -fdiagnostics-show-path-depths
5493 @opindex fdiagnostics-show-path-depths
5494 This option provides additional information when printing control-flow paths
5495 associated with a diagnostic.
5497 If this is option is provided then the stack depth will be printed for
5498 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5499 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5500 the stack depth and function declaration will be appended when printing
5501 each event.
5503 This is intended for use by GCC developers and plugin developers when
5504 debugging diagnostics that report interprocedural control flow.
5506 @item -fno-show-column
5507 @opindex fno-show-column
5508 @opindex fshow-column
5509 Do not print column numbers in diagnostics.  This may be necessary if
5510 diagnostics are being scanned by a program that does not understand the
5511 column numbers, such as @command{dejagnu}.
5513 @item -fdiagnostics-column-unit=@var{UNIT}
5514 @opindex fdiagnostics-column-unit
5515 Select the units for the column number.  This affects traditional diagnostics
5516 (in the absence of @option{-fno-show-column}), as well as JSON format
5517 diagnostics if requested.
5519 The default @var{UNIT}, @samp{display}, considers the number of display
5520 columns occupied by each character.  This may be larger than the number
5521 of bytes required to encode the character, in the case of tab
5522 characters, or it may be smaller, in the case of multibyte characters.
5523 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5524 display column, and its UTF-8 encoding requires two bytes; the character
5525 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5526 its UTF-8 encoding requires four bytes.
5528 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5529 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5531 @item -fdiagnostics-column-origin=@var{ORIGIN}
5532 @opindex fdiagnostics-column-origin
5533 Select the origin for column numbers, i.e. the column number assigned to the
5534 first column.  The default value of 1 corresponds to traditional GCC
5535 behavior and to the GNU style guide.  Some utilities may perform better with an
5536 origin of 0; any non-negative value may be specified.
5538 @item -fdiagnostics-escape-format=@var{FORMAT}
5539 @opindex fdiagnostics-escape-format
5540 When GCC prints pertinent source lines for a diagnostic it normally attempts
5541 to print the source bytes directly.  However, some diagnostics relate to encoding
5542 issues in the source file, such as malformed UTF-8, or issues with Unicode
5543 normalization.  These diagnostics are flagged so that GCC will escape bytes
5544 that are not printable ASCII when printing their pertinent source lines.
5546 This option controls how such bytes should be escaped.
5548 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5549 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5550 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5551 displayed as hexadecimal in the form @samp{<XX>}.
5553 For example, a source line containing the string @samp{before} followed by the
5554 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5555 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5556 the string @samp{after} will be printed for such a diagnostic as:
5558 @smallexample
5559  before<U+03C0><BF>after
5560 @end smallexample
5562 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5563 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5564 Unicode characters.  For the example above, the following will be printed:
5566 @smallexample
5567  before<CF><80><BF>after
5568 @end smallexample
5570 @item -fdiagnostics-format=@var{FORMAT}
5571 @opindex fdiagnostics-format
5572 Select a different format for printing diagnostics.
5573 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5574 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5576 The default is @samp{text}.
5578 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5579 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5580 named @file{@var{source}.sarif}, respectively.
5582 The @samp{json} format is a synonym for @samp{json-stderr}.
5583 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5584 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5585 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5587 The emitted JSON consists of a top-level JSON array containing JSON objects
5588 representing the diagnostics.  The JSON is emitted as one line, without
5589 formatting; the examples below have been formatted for clarity.
5591 Diagnostics can have child diagnostics.  For example, this error and note:
5593 @smallexample
5594 misleading-indentation.c:15:3: warning: this 'if' clause does not
5595   guard... [-Wmisleading-indentation]
5596    15 |   if (flag)
5597       |   ^~
5598 misleading-indentation.c:17:5: note: ...this statement, but the latter
5599   is misleadingly indented as if it were guarded by the 'if'
5600    17 |     y = 2;
5601       |     ^
5602 @end smallexample
5604 @noindent
5605 might be printed in JSON form (after formatting) like this:
5607 @smallexample
5609     @{
5610         "kind": "warning",
5611         "locations": [
5612             @{
5613                 "caret": @{
5614                     "display-column": 3,
5615                     "byte-column": 3,
5616                     "column": 3,
5617                     "file": "misleading-indentation.c",
5618                     "line": 15
5619                 @},
5620                 "finish": @{
5621                     "display-column": 4,
5622                     "byte-column": 4,
5623                     "column": 4,
5624                     "file": "misleading-indentation.c",
5625                     "line": 15
5626                 @}
5627             @}
5628         ],
5629         "message": "this \u2018if\u2019 clause does not guard...",
5630         "option": "-Wmisleading-indentation",
5631         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5632         "children": [
5633             @{
5634                 "kind": "note",
5635                 "locations": [
5636                     @{
5637                         "caret": @{
5638                             "display-column": 5,
5639                             "byte-column": 5,
5640                             "column": 5,
5641                             "file": "misleading-indentation.c",
5642                             "line": 17
5643                         @}
5644                     @}
5645                 ],
5646                 "escape-source": false,
5647                 "message": "...this statement, but the latter is @dots{}"
5648             @}
5649         ]
5650         "escape-source": false,
5651         "column-origin": 1,
5652     @}
5654 @end smallexample
5656 @noindent
5657 where the @code{note} is a child of the @code{warning}.
5659 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5660 an @code{option} key describing the command-line option controlling the
5661 warning.
5663 A diagnostic can contain zero or more locations.  Each location has an
5664 optional @code{label} string and up to three positions within it: a
5665 @code{caret} position and optional @code{start} and @code{finish} positions.
5666 A position is described by a @code{file} name, a @code{line} number, and
5667 three numbers indicating a column position:
5668 @itemize @bullet
5670 @item
5671 @code{display-column} counts display columns, accounting for tabs and
5672 multibyte characters.
5674 @item
5675 @code{byte-column} counts raw bytes.
5677 @item
5678 @code{column} is equal to one of
5679 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5680 option.
5682 @end itemize
5683 All three columns are relative to the origin specified by
5684 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5685 be set, for instance, to 0 for compatibility with other utilities that
5686 number columns from 0.  The column origin is recorded in the JSON output in
5687 the @code{column-origin} tag.  In the remaining examples below, the extra
5688 column number outputs have been omitted for brevity.
5690 For example, this error:
5692 @smallexample
5693 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5694    'struct s'@} and 'T' @{aka 'struct t'@})
5695    64 |   return callee_4a () + callee_4b ();
5696       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5697       |          |              |
5698       |          |              T @{aka struct t@}
5699       |          S @{aka struct s@}
5700 @end smallexample
5702 @noindent
5703 has three locations.  Its primary location is at the ``+'' token at column
5704 23.  It has two secondary locations, describing the left and right-hand sides
5705 of the expression, which have labels.  It might be printed in JSON form as:
5707 @smallexample
5708     @{
5709         "children": [],
5710         "kind": "error",
5711         "locations": [
5712             @{
5713                 "caret": @{
5714                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5715                 @}
5716             @},
5717             @{
5718                 "caret": @{
5719                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5720                 @},
5721                 "finish": @{
5722                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5723                 @},
5724                 "label": "S @{aka struct s@}"
5725             @},
5726             @{
5727                 "caret": @{
5728                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5729                 @},
5730                 "finish": @{
5731                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5732                 @},
5733                 "label": "T @{aka struct t@}"
5734             @}
5735         ],
5736         "escape-source": false,
5737         "message": "invalid operands to binary + @dots{}"
5738     @}
5739 @end smallexample
5741 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5742 consisting of half-open intervals, similar to the output of
5743 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5744 with a replacement fix-it hint:
5746 @smallexample
5747 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5748   mean 'color'?
5749     8 |   return ptr->colour;
5750       |               ^~~~~~
5751       |               color
5752 @end smallexample
5754 @noindent
5755 might be printed in JSON form as:
5757 @smallexample
5758     @{
5759         "children": [],
5760         "fixits": [
5761             @{
5762                 "next": @{
5763                     "column": 21,
5764                     "file": "demo.c",
5765                     "line": 8
5766                 @},
5767                 "start": @{
5768                     "column": 15,
5769                     "file": "demo.c",
5770                     "line": 8
5771                 @},
5772                 "string": "color"
5773             @}
5774         ],
5775         "kind": "error",
5776         "locations": [
5777             @{
5778                 "caret": @{
5779                     "column": 15,
5780                     "file": "demo.c",
5781                     "line": 8
5782                 @},
5783                 "finish": @{
5784                     "column": 20,
5785                     "file": "demo.c",
5786                     "line": 8
5787                 @}
5788             @}
5789         ],
5790         "escape-source": false,
5791         "message": "\u2018struct s\u2019 has no member named @dots{}"
5792     @}
5793 @end smallexample
5795 @noindent
5796 where the fix-it hint suggests replacing the text from @code{start} up
5797 to but not including @code{next} with @code{string}'s value.  Deletions
5798 are expressed via an empty value for @code{string}, insertions by
5799 having @code{start} equal @code{next}.
5801 If the diagnostic has a path of control-flow events associated with it,
5802 it has a @code{path} array of objects representing the events.  Each
5803 event object has a @code{description} string, a @code{location} object,
5804 along with a @code{function} string and a @code{depth} number for
5805 representing interprocedural paths.  The @code{function} represents the
5806 current function at that event, and the @code{depth} represents the
5807 stack depth relative to some baseline: the higher, the more frames are
5808 within the stack.
5810 For example, the intraprocedural example shown for
5811 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5813 @smallexample
5814     "path": [
5815         @{
5816             "depth": 0,
5817             "description": "when 'PyList_New' fails, returning NULL",
5818             "function": "test",
5819             "location": @{
5820                 "column": 10,
5821                 "file": "test.c",
5822                 "line": 25
5823             @}
5824         @},
5825         @{
5826             "depth": 0,
5827             "description": "when 'i < count'",
5828             "function": "test",
5829             "location": @{
5830                 "column": 3,
5831                 "file": "test.c",
5832                 "line": 27
5833             @}
5834         @},
5835         @{
5836             "depth": 0,
5837             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5838             "function": "test",
5839             "location": @{
5840                 "column": 5,
5841                 "file": "test.c",
5842                 "line": 29
5843             @}
5844         @}
5845     ]
5846 @end smallexample
5848 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5849 non-ASCII bytes should be escaped when printing the pertinent lines of
5850 source code (@code{true} for diagnostics involving source encoding issues).
5852 @end table
5854 @node Warning Options
5855 @section Options to Request or Suppress Warnings
5856 @cindex options to control warnings
5857 @cindex warning messages
5858 @cindex messages, warning
5859 @cindex suppressing warnings
5861 Warnings are diagnostic messages that report constructions that
5862 are not inherently erroneous but that are risky or suggest there
5863 may have been an error.
5865 The following language-independent options do not enable specific
5866 warnings but control the kinds of diagnostics produced by GCC@.
5868 @table @gcctabopt
5869 @cindex syntax checking
5870 @item -fsyntax-only
5871 @opindex fsyntax-only
5872 Check the code for syntax errors, but don't do anything beyond that.
5874 @item -fmax-errors=@var{n}
5875 @opindex fmax-errors
5876 Limits the maximum number of error messages to @var{n}, at which point
5877 GCC bails out rather than attempting to continue processing the source
5878 code.  If @var{n} is 0 (the default), there is no limit on the number
5879 of error messages produced.  If @option{-Wfatal-errors} is also
5880 specified, then @option{-Wfatal-errors} takes precedence over this
5881 option.
5883 @item -w
5884 @opindex w
5885 Inhibit all warning messages.
5887 @item -Werror
5888 @opindex Werror
5889 @opindex Wno-error
5890 Make all warnings into errors.
5892 @item -Werror=
5893 @opindex Werror=
5894 @opindex Wno-error=
5895 Make the specified warning into an error.  The specifier for a warning
5896 is appended; for example @option{-Werror=switch} turns the warnings
5897 controlled by @option{-Wswitch} into errors.  This switch takes a
5898 negative form, to be used to negate @option{-Werror} for specific
5899 warnings; for example @option{-Wno-error=switch} makes
5900 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5901 is in effect.
5903 The warning message for each controllable warning includes the
5904 option that controls the warning.  That option can then be used with
5905 @option{-Werror=} and @option{-Wno-error=} as described above.
5906 (Printing of the option in the warning message can be disabled using the
5907 @option{-fno-diagnostics-show-option} flag.)
5909 Note that specifying @option{-Werror=}@var{foo} automatically implies
5910 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
5911 imply anything.
5913 @item -Wfatal-errors
5914 @opindex Wfatal-errors
5915 @opindex Wno-fatal-errors
5916 This option causes the compiler to abort compilation on the first error
5917 occurred rather than trying to keep going and printing further error
5918 messages.
5920 @end table
5922 You can request many specific warnings with options beginning with
5923 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5924 implicit declarations.  Each of these specific warning options also
5925 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5926 example, @option{-Wno-implicit}.  This manual lists only one of the
5927 two forms, whichever is not the default.  For further
5928 language-specific options also refer to @ref{C++ Dialect Options} and
5929 @ref{Objective-C and Objective-C++ Dialect Options}.
5930 Additional warnings can be produced by enabling the static analyzer;
5931 @xref{Static Analyzer Options}.
5933 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5934 options, such as @option{-Wunused}, which may turn on further options,
5935 such as @option{-Wunused-value}. The combined effect of positive and
5936 negative forms is that more specific options have priority over less
5937 specific ones, independently of their position in the command-line. For
5938 options of the same specificity, the last one takes effect. Options
5939 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5940 as if they appeared at the end of the command-line.
5942 When an unrecognized warning option is requested (e.g.,
5943 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5944 that the option is not recognized.  However, if the @option{-Wno-} form
5945 is used, the behavior is slightly different: no diagnostic is
5946 produced for @option{-Wno-unknown-warning} unless other diagnostics
5947 are being produced.  This allows the use of new @option{-Wno-} options
5948 with old compilers, but if something goes wrong, the compiler
5949 warns that an unrecognized option is present.
5951 The effectiveness of some warnings depends on optimizations also being
5952 enabled. For example @option{-Wsuggest-final-types} is more effective
5953 with link-time optimization and some instances of other warnings may
5954 not be issued at all unless optimization is enabled.  While optimization
5955 in general improves the efficacy of control and data flow sensitive
5956 warnings, in some cases it may also cause false positives.
5958 @table @gcctabopt
5959 @item -Wpedantic
5960 @itemx -pedantic
5961 @opindex pedantic
5962 @opindex Wpedantic
5963 @opindex Wno-pedantic
5964 Issue all the warnings demanded by strict ISO C and ISO C++;
5965 reject all programs that use forbidden extensions, and some other
5966 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
5967 version of the ISO C standard specified by any @option{-std} option used.
5969 Valid ISO C and ISO C++ programs should compile properly with or without
5970 this option (though a rare few require @option{-ansi} or a
5971 @option{-std} option specifying the required version of ISO C)@.  However,
5972 without this option, certain GNU extensions and traditional C and C++
5973 features are supported as well.  With this option, they are rejected.
5975 @option{-Wpedantic} does not cause warning messages for use of the
5976 alternate keywords whose names begin and end with @samp{__}.  This alternate
5977 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5978 i.e. @samp{__intN__}.
5979 Pedantic warnings are also disabled in the expression that follows
5980 @code{__extension__}.  However, only system header files should use
5981 these escape routes; application programs should avoid them.
5982 @xref{Alternate Keywords}.
5984 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5985 C conformance.  They soon find that it does not do quite what they want:
5986 it finds some non-ISO practices, but not all---only those for which
5987 ISO C @emph{requires} a diagnostic, and some others for which
5988 diagnostics have been added.
5990 A feature to report any failure to conform to ISO C might be useful in
5991 some instances, but would require considerable additional work and would
5992 be quite different from @option{-Wpedantic}.  We don't have plans to
5993 support such a feature in the near future.
5995 Where the standard specified with @option{-std} represents a GNU
5996 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5997 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5998 extended dialect is based.  Warnings from @option{-Wpedantic} are given
5999 where they are required by the base standard.  (It does not make sense
6000 for such warnings to be given only for features not in the specified GNU
6001 C dialect, since by definition the GNU dialects of C include all
6002 features the compiler supports with the given option, and there would be
6003 nothing to warn about.)
6005 @item -pedantic-errors
6006 @opindex pedantic-errors
6007 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6008 requires a diagnostic, in some cases where there is undefined behavior
6009 at compile-time and in some other cases that do not prevent compilation
6010 of programs that are valid according to the standard. This is not
6011 equivalent to @option{-Werror=pedantic}, since there are errors enabled
6012 by this option and not enabled by the latter and vice versa.
6014 @item -Wall
6015 @opindex Wall
6016 @opindex Wno-all
6017 This enables all the warnings about constructions that some users
6018 consider questionable, and that are easy to avoid (or modify to
6019 prevent the warning), even in conjunction with macros.  This also
6020 enables some language-specific warnings described in @ref{C++ Dialect
6021 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6023 @option{-Wall} turns on the following warning flags:
6025 @gccoptlist{-Waddress   @gol
6026 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}  @gol
6027 -Warray-compare @gol
6028 -Warray-parameter=2 @r{(C and Objective-C only)} @gol
6029 -Wbool-compare  @gol
6030 -Wbool-operation  @gol
6031 -Wc++11-compat  -Wc++14-compat  @gol
6032 -Wcatch-value @r{(C++ and Objective-C++ only)}  @gol
6033 -Wchar-subscripts  @gol
6034 -Wcomment  @gol
6035 -Wdangling-pointer=2  @gol
6036 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
6037 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
6038 -Wenum-int-mismatch @r{(C and Objective-C only)} @gol
6039 -Wformat   @gol
6040 -Wformat-overflow  @gol
6041 -Wformat-truncation  @gol
6042 -Wint-in-bool-context  @gol
6043 -Wimplicit @r{(C and Objective-C only)} @gol
6044 -Wimplicit-int @r{(C and Objective-C only)} @gol
6045 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
6046 -Winit-self @r{(only for C++)} @gol
6047 -Wlogical-not-parentheses @gol
6048 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
6049 -Wmaybe-uninitialized @gol
6050 -Wmemset-elt-size @gol
6051 -Wmemset-transposed-args @gol
6052 -Wmisleading-indentation @r{(only for C/C++)} @gol
6053 -Wmismatched-dealloc @gol
6054 -Wmismatched-new-delete @r{(only for C/C++)} @gol
6055 -Wmissing-attributes @gol
6056 -Wmissing-braces @r{(only for C/ObjC)} @gol
6057 -Wmultistatement-macros  @gol
6058 -Wnarrowing @r{(only for C++)}  @gol
6059 -Wnonnull  @gol
6060 -Wnonnull-compare  @gol
6061 -Wopenmp-simd @gol
6062 -Wparentheses  @gol
6063 -Wpessimizing-move @r{(only for C++)}  @gol
6064 -Wpointer-sign  @gol
6065 -Wrange-loop-construct @r{(only for C++)}  @gol
6066 -Wreorder   @gol
6067 -Wrestrict   @gol
6068 -Wreturn-type  @gol
6069 -Wself-move @r{(only for C++)}  @gol
6070 -Wsequence-point  @gol
6071 -Wsign-compare @r{(only in C++)}  @gol
6072 -Wsizeof-array-div @gol
6073 -Wsizeof-pointer-div @gol
6074 -Wsizeof-pointer-memaccess @gol
6075 -Wstrict-aliasing  @gol
6076 -Wstrict-overflow=1  @gol
6077 -Wswitch  @gol
6078 -Wtautological-compare  @gol
6079 -Wtrigraphs  @gol
6080 -Wuninitialized  @gol
6081 -Wunknown-pragmas  @gol
6082 -Wunused-function  @gol
6083 -Wunused-label     @gol
6084 -Wunused-value     @gol
6085 -Wunused-variable  @gol
6086 -Wuse-after-free=3  @gol
6087 -Wvla-parameter @r{(C and Objective-C only)} @gol
6088 -Wvolatile-register-var  @gol
6089 -Wzero-length-bounds}
6091 Note that some warning flags are not implied by @option{-Wall}.  Some of
6092 them warn about constructions that users generally do not consider
6093 questionable, but which occasionally you might wish to check for;
6094 others warn about constructions that are necessary or hard to avoid in
6095 some cases, and there is no simple way to modify the code to suppress
6096 the warning. Some of them are enabled by @option{-Wextra} but many of
6097 them must be enabled individually.
6099 @item -Wextra
6100 @opindex W
6101 @opindex Wextra
6102 @opindex Wno-extra
6103 This enables some extra warning flags that are not enabled by
6104 @option{-Wall}. (This option used to be called @option{-W}.  The older
6105 name is still supported, but the newer name is more descriptive.)
6107 @gccoptlist{-Wclobbered  @gol
6108 -Wcast-function-type  @gol
6109 -Wdeprecated-copy @r{(C++ only)} @gol
6110 -Wempty-body  @gol
6111 -Wenum-conversion @r{(C only)} @gol
6112 -Wignored-qualifiers @gol
6113 -Wimplicit-fallthrough=3 @gol
6114 -Wmissing-field-initializers  @gol
6115 -Wmissing-parameter-type @r{(C only)}  @gol
6116 -Wold-style-declaration @r{(C only)}  @gol
6117 -Woverride-init  @gol
6118 -Wsign-compare @r{(C only)} @gol
6119 -Wstring-compare @gol
6120 -Wredundant-move @r{(only for C++)}  @gol
6121 -Wtype-limits  @gol
6122 -Wuninitialized  @gol
6123 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}  @gol
6124 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
6125 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6128 The option @option{-Wextra} also prints warning messages for the
6129 following cases:
6131 @itemize @bullet
6133 @item
6134 A pointer is compared against integer zero with @code{<}, @code{<=},
6135 @code{>}, or @code{>=}.
6137 @item
6138 (C++ only) An enumerator and a non-enumerator both appear in a
6139 conditional expression.
6141 @item
6142 (C++ only) Ambiguous virtual bases.
6144 @item
6145 (C++ only) Subscripting an array that has been declared @code{register}.
6147 @item
6148 (C++ only) Taking the address of a variable that has been declared
6149 @code{register}.
6151 @item
6152 (C++ only) A base class is not initialized in the copy constructor
6153 of a derived class.
6155 @end itemize
6157 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6158 @opindex Wabi
6159 @opindex Wno-abi
6161 Warn about code affected by ABI changes.  This includes code that may
6162 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6163 for the particular target.
6165 Since G++ now defaults to updating the ABI with each major release,
6166 normally @option{-Wabi} warns only about C++ ABI compatibility
6167 problems if there is a check added later in a release series for an
6168 ABI issue discovered since the initial release.  @option{-Wabi} warns
6169 about more things if an older ABI version is selected (with
6170 @option{-fabi-version=@var{n}}).
6172 @option{-Wabi} can also be used with an explicit version number to
6173 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6174 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6175 @option{-fabi-version=2}.
6177 If an explicit version number is provided and
6178 @option{-fabi-compat-version} is not specified, the version number
6179 from this option is used for compatibility aliases.  If no explicit
6180 version number is provided with this option, but
6181 @option{-fabi-compat-version} is specified, that version number is
6182 used for C++ ABI warnings.
6184 Although an effort has been made to warn about
6185 all such cases, there are probably some cases that are not warned about,
6186 even though G++ is generating incompatible code.  There may also be
6187 cases where warnings are emitted even though the code that is generated
6188 is compatible.
6190 You should rewrite your code to avoid these warnings if you are
6191 concerned about the fact that code generated by G++ may not be binary
6192 compatible with code generated by other compilers.
6194 Known incompatibilities in @option{-fabi-version=2} (which was the
6195 default from GCC 3.4 to 4.9) include:
6197 @itemize @bullet
6199 @item
6200 A template with a non-type template parameter of reference type was
6201 mangled incorrectly:
6202 @smallexample
6203 extern int N;
6204 template <int &> struct S @{@};
6205 void n (S<N>) @{2@}
6206 @end smallexample
6208 This was fixed in @option{-fabi-version=3}.
6210 @item
6211 SIMD vector types declared using @code{__attribute ((vector_size))} were
6212 mangled in a non-standard way that does not allow for overloading of
6213 functions taking vectors of different sizes.
6215 The mangling was changed in @option{-fabi-version=4}.
6217 @item
6218 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6219 qualifiers, and @code{decltype} of a plain declaration was folded away.
6221 These mangling issues were fixed in @option{-fabi-version=5}.
6223 @item
6224 Scoped enumerators passed as arguments to a variadic function are
6225 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6226 On most targets this does not actually affect the parameter passing
6227 ABI, as there is no way to pass an argument smaller than @code{int}.
6229 Also, the ABI changed the mangling of template argument packs,
6230 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6231 a class scope function used as a template argument.
6233 These issues were corrected in @option{-fabi-version=6}.
6235 @item
6236 Lambdas in default argument scope were mangled incorrectly, and the
6237 ABI changed the mangling of @code{nullptr_t}.
6239 These issues were corrected in @option{-fabi-version=7}.
6241 @item
6242 When mangling a function type with function-cv-qualifiers, the
6243 un-qualified function type was incorrectly treated as a substitution
6244 candidate.
6246 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6248 @item
6249 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6250 unaligned accesses.  Note that this did not affect the ABI of a
6251 function with a @code{nullptr_t} parameter, as parameters have a
6252 minimum alignment.
6254 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6256 @item
6257 Target-specific attributes that affect the identity of a type, such as
6258 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6259 did not affect the mangled name, leading to name collisions when
6260 function pointers were used as template arguments.
6262 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6264 @end itemize
6266 This option also enables warnings about psABI-related changes.
6267 The known psABI changes at this point include:
6269 @itemize @bullet
6271 @item
6272 For SysV/x86-64, unions with @code{long double} members are
6273 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6274 the case.  For example:
6276 @smallexample
6277 union U @{
6278   long double ld;
6279   int i;
6281 @end smallexample
6283 @noindent
6284 @code{union U} is now always passed in memory.
6286 @end itemize
6288 @item -Wchar-subscripts
6289 @opindex Wchar-subscripts
6290 @opindex Wno-char-subscripts
6291 Warn if an array subscript has type @code{char}.  This is a common cause
6292 of error, as programmers often forget that this type is signed on some
6293 machines.
6294 This warning is enabled by @option{-Wall}.
6296 @item -Wno-coverage-mismatch
6297 @opindex Wno-coverage-mismatch
6298 @opindex Wcoverage-mismatch
6299 Warn if feedback profiles do not match when using the
6300 @option{-fprofile-use} option.
6301 If a source file is changed between compiling with @option{-fprofile-generate}
6302 and with @option{-fprofile-use}, the files with the profile feedback can fail
6303 to match the source file and GCC cannot use the profile feedback
6304 information.  By default, this warning is enabled and is treated as an
6305 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6306 warning or @option{-Wno-error=coverage-mismatch} can be used to
6307 disable the error.  Disabling the error for this warning can result in
6308 poorly optimized code and is useful only in the
6309 case of very minor changes such as bug fixes to an existing code-base.
6310 Completely disabling the warning is not recommended.
6312 @item -Wno-coverage-invalid-line-number
6313 @opindex Wno-coverage-invalid-line-number
6314 @opindex Wcoverage-invalid-line-number
6315 Warn in case a function ends earlier than it begins due
6316 to an invalid linenum macros.  The warning is emitted only
6317 with @option{--coverage} enabled.
6319 By default, this warning is enabled and is treated as an
6320 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6321 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6322 disable the error.
6324 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6325 @opindex Wno-cpp
6326 @opindex Wcpp
6327 Suppress warning messages emitted by @code{#warning} directives.
6329 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6330 @opindex Wdouble-promotion
6331 @opindex Wno-double-promotion
6332 Give a warning when a value of type @code{float} is implicitly
6333 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6334 floating-point unit implement @code{float} in hardware, but emulate
6335 @code{double} in software.  On such a machine, doing computations
6336 using @code{double} values is much more expensive because of the
6337 overhead required for software emulation.
6339 It is easy to accidentally do computations with @code{double} because
6340 floating-point literals are implicitly of type @code{double}.  For
6341 example, in:
6342 @smallexample
6343 @group
6344 float area(float radius)
6346    return 3.14159 * radius * radius;
6348 @end group
6349 @end smallexample
6350 the compiler performs the entire computation with @code{double}
6351 because the floating-point literal is a @code{double}.
6353 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6354 @opindex Wduplicate-decl-specifier
6355 @opindex Wno-duplicate-decl-specifier
6356 Warn if a declaration has duplicate @code{const}, @code{volatile},
6357 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6358 @option{-Wall}.
6360 @item -Wformat
6361 @itemx -Wformat=@var{n}
6362 @opindex Wformat
6363 @opindex Wno-format
6364 @opindex ffreestanding
6365 @opindex fno-builtin
6366 @opindex Wformat=
6367 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6368 the arguments supplied have types appropriate to the format string
6369 specified, and that the conversions specified in the format string make
6370 sense.  This includes standard functions, and others specified by format
6371 attributes (@pxref{Function Attributes}), in the @code{printf},
6372 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6373 not in the C standard) families (or other target-specific families).
6374 Which functions are checked without format attributes having been
6375 specified depends on the standard version selected, and such checks of
6376 functions without the attribute specified are disabled by
6377 @option{-ffreestanding} or @option{-fno-builtin}.
6379 The formats are checked against the format features supported by GNU
6380 libc version 2.2.  These include all ISO C90 and C99 features, as well
6381 as features from the Single Unix Specification and some BSD and GNU
6382 extensions.  Other library implementations may not support all these
6383 features; GCC does not support warning about features that go beyond a
6384 particular library's limitations.  However, if @option{-Wpedantic} is used
6385 with @option{-Wformat}, warnings are given about format features not
6386 in the selected standard version (but not for @code{strfmon} formats,
6387 since those are not in any version of the C standard).  @xref{C Dialect
6388 Options,,Options Controlling C Dialect}.
6390 @table @gcctabopt
6391 @item -Wformat=1
6392 @itemx -Wformat
6393 @opindex Wformat
6394 @opindex Wformat=1
6395 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6396 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6397 @option{-Wformat} also checks for null format arguments for several
6398 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6399 aspects of this level of format checking can be disabled by the
6400 options: @option{-Wno-format-contains-nul},
6401 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6402 @option{-Wformat} is enabled by @option{-Wall}.
6404 @item -Wformat=2
6405 @opindex Wformat=2
6406 Enable @option{-Wformat} plus additional format checks.  Currently
6407 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6408 -Wformat-y2k}.
6409 @end table
6411 @item -Wno-format-contains-nul
6412 @opindex Wno-format-contains-nul
6413 @opindex Wformat-contains-nul
6414 If @option{-Wformat} is specified, do not warn about format strings that
6415 contain NUL bytes.
6417 @item -Wno-format-extra-args
6418 @opindex Wno-format-extra-args
6419 @opindex Wformat-extra-args
6420 If @option{-Wformat} is specified, do not warn about excess arguments to a
6421 @code{printf} or @code{scanf} format function.  The C standard specifies
6422 that such arguments are ignored.
6424 Where the unused arguments lie between used arguments that are
6425 specified with @samp{$} operand number specifications, normally
6426 warnings are still given, since the implementation could not know what
6427 type to pass to @code{va_arg} to skip the unused arguments.  However,
6428 in the case of @code{scanf} formats, this option suppresses the
6429 warning if the unused arguments are all pointers, since the Single
6430 Unix Specification says that such unused arguments are allowed.
6432 @item -Wformat-overflow
6433 @itemx -Wformat-overflow=@var{level}
6434 @opindex Wformat-overflow
6435 @opindex Wno-format-overflow
6436 Warn about calls to formatted input/output functions such as @code{sprintf}
6437 and @code{vsprintf} that might overflow the destination buffer.  When the
6438 exact number of bytes written by a format directive cannot be determined
6439 at compile-time it is estimated based on heuristics that depend on the
6440 @var{level} argument and on optimization.  While enabling optimization
6441 will in most cases improve the accuracy of the warning, it may also
6442 result in false positives.
6444 @table @gcctabopt
6445 @item -Wformat-overflow
6446 @itemx -Wformat-overflow=1
6447 @opindex Wformat-overflow
6448 @opindex Wno-format-overflow
6449 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6450 employs a conservative approach that warns only about calls that most
6451 likely overflow the buffer.  At this level, numeric arguments to format
6452 directives with unknown values are assumed to have the value of one, and
6453 strings of unknown length to be empty.  Numeric arguments that are known
6454 to be bounded to a subrange of their type, or string arguments whose output
6455 is bounded either by their directive's precision or by a finite set of
6456 string literals, are assumed to take on the value within the range that
6457 results in the most bytes on output.  For example, the call to @code{sprintf}
6458 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6459 the terminating NUL character (@code{'\0'}) appended by the function
6460 to the destination buffer will be written past its end.  Increasing
6461 the size of the buffer by a single byte is sufficient to avoid the
6462 warning, though it may not be sufficient to avoid the overflow.
6464 @smallexample
6465 void f (int a, int b)
6467   char buf [13];
6468   sprintf (buf, "a = %i, b = %i\n", a, b);
6470 @end smallexample
6472 @item -Wformat-overflow=2
6473 Level @var{2} warns also about calls that might overflow the destination
6474 buffer given an argument of sufficient length or magnitude.  At level
6475 @var{2}, unknown numeric arguments are assumed to have the minimum
6476 representable value for signed types with a precision greater than 1, and
6477 the maximum representable value otherwise.  Unknown string arguments whose
6478 length cannot be assumed to be bounded either by the directive's precision,
6479 or by a finite set of string literals they may evaluate to, or the character
6480 array they may point to, are assumed to be 1 character long.
6482 At level @var{2}, the call in the example above is again diagnosed, but
6483 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6484 @code{%i} directive will write some of its digits beyond the end of
6485 the destination buffer.  To make the call safe regardless of the values
6486 of the two variables, the size of the destination buffer must be increased
6487 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6488 an informational note following the warning.
6490 An alternative to increasing the size of the destination buffer is to
6491 constrain the range of formatted values.  The maximum length of string
6492 arguments can be bounded by specifying the precision in the format
6493 directive.  When numeric arguments of format directives can be assumed
6494 to be bounded by less than the precision of their type, choosing
6495 an appropriate length modifier to the format specifier will reduce
6496 the required buffer size.  For example, if @var{a} and @var{b} in the
6497 example above can be assumed to be within the precision of
6498 the @code{short int} type then using either the @code{%hi} format
6499 directive or casting the argument to @code{short} reduces the maximum
6500 required size of the buffer to 24 bytes.
6502 @smallexample
6503 void f (int a, int b)
6505   char buf [23];
6506   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6508 @end smallexample
6509 @end table
6511 @item -Wno-format-zero-length
6512 @opindex Wno-format-zero-length
6513 @opindex Wformat-zero-length
6514 If @option{-Wformat} is specified, do not warn about zero-length formats.
6515 The C standard specifies that zero-length formats are allowed.
6517 @item -Wformat-nonliteral
6518 @opindex Wformat-nonliteral
6519 @opindex Wno-format-nonliteral
6520 If @option{-Wformat} is specified, also warn if the format string is not a
6521 string literal and so cannot be checked, unless the format function
6522 takes its format arguments as a @code{va_list}.
6524 @item -Wformat-security
6525 @opindex Wformat-security
6526 @opindex Wno-format-security
6527 If @option{-Wformat} is specified, also warn about uses of format
6528 functions that represent possible security problems.  At present, this
6529 warns about calls to @code{printf} and @code{scanf} functions where the
6530 format string is not a string literal and there are no format arguments,
6531 as in @code{printf (foo);}.  This may be a security hole if the format
6532 string came from untrusted input and contains @samp{%n}.  (This is
6533 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6534 in future warnings may be added to @option{-Wformat-security} that are not
6535 included in @option{-Wformat-nonliteral}.)
6537 @item -Wformat-signedness
6538 @opindex Wformat-signedness
6539 @opindex Wno-format-signedness
6540 If @option{-Wformat} is specified, also warn if the format string
6541 requires an unsigned argument and the argument is signed and vice versa.
6543 @item -Wformat-truncation
6544 @itemx -Wformat-truncation=@var{level}
6545 @opindex Wformat-truncation
6546 @opindex Wno-format-truncation
6547 Warn about calls to formatted input/output functions such as @code{snprintf}
6548 and @code{vsnprintf} that might result in output truncation.  When the exact
6549 number of bytes written by a format directive cannot be determined at
6550 compile-time it is estimated based on heuristics that depend on
6551 the @var{level} argument and on optimization.  While enabling optimization
6552 will in most cases improve the accuracy of the warning, it may also result
6553 in false positives.  Except as noted otherwise, the option uses the same
6554 logic @option{-Wformat-overflow}.
6556 @table @gcctabopt
6557 @item -Wformat-truncation
6558 @itemx -Wformat-truncation=1
6559 @opindex Wformat-truncation
6560 @opindex Wno-format-truncation
6561 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6562 employs a conservative approach that warns only about calls to bounded
6563 functions whose return value is unused and that will most likely result
6564 in output truncation.
6566 @item -Wformat-truncation=2
6567 Level @var{2} warns also about calls to bounded functions whose return
6568 value is used and that might result in truncation given an argument of
6569 sufficient length or magnitude.
6570 @end table
6572 @item -Wformat-y2k
6573 @opindex Wformat-y2k
6574 @opindex Wno-format-y2k
6575 If @option{-Wformat} is specified, also warn about @code{strftime}
6576 formats that may yield only a two-digit year.
6578 @item -Wnonnull
6579 @opindex Wnonnull
6580 @opindex Wno-nonnull
6581 Warn about passing a null pointer for arguments marked as
6582 requiring a non-null value by the @code{nonnull} function attribute.
6584 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6585 can be disabled with the @option{-Wno-nonnull} option.
6587 @item -Wnonnull-compare
6588 @opindex Wnonnull-compare
6589 @opindex Wno-nonnull-compare
6590 Warn when comparing an argument marked with the @code{nonnull}
6591 function attribute against null inside the function.
6593 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6594 can be disabled with the @option{-Wno-nonnull-compare} option.
6596 @item -Wnull-dereference
6597 @opindex Wnull-dereference
6598 @opindex Wno-null-dereference
6599 Warn if the compiler detects paths that trigger erroneous or
6600 undefined behavior due to dereferencing a null pointer.  This option
6601 is only active when @option{-fdelete-null-pointer-checks} is active,
6602 which is enabled by optimizations in most targets.  The precision of
6603 the warnings depends on the optimization options used.
6605 @item -Winfinite-recursion
6606 @opindex Winfinite-recursion
6607 @opindex Wno-infinite-recursion
6608 Warn about infinitely recursive calls.  The warning is effective at all
6609 optimization levels but requires optimization in order to detect infinite
6610 recursion in calls between two or more functions.
6611 @option{-Winfinite-recursion} is included in @option{-Wall}.
6613 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6614 similar diagnostic, but is implemented in a different way (as part of
6615 @option{-fanalyzer}).
6617 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6618 @opindex Winit-self
6619 @opindex Wno-init-self
6620 Warn about uninitialized variables that are initialized with themselves.
6621 Note this option can only be used with the @option{-Wuninitialized} option.
6623 For example, GCC warns about @code{i} being uninitialized in the
6624 following snippet only when @option{-Winit-self} has been specified:
6625 @smallexample
6626 @group
6627 int f()
6629   int i = i;
6630   return i;
6632 @end group
6633 @end smallexample
6635 This warning is enabled by @option{-Wall} in C++.
6637 @item -Wno-implicit-int @r{(C and Objective-C only)}
6638 @opindex Wimplicit-int
6639 @opindex Wno-implicit-int
6640 This option controls warnings when a declaration does not specify a type.
6641 This warning is enabled by default in C99 and later dialects of C,
6642 and also by @option{-Wall}.
6644 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6645 @opindex Wimplicit-function-declaration
6646 @opindex Wno-implicit-function-declaration
6647 This option controls warnings when a function is used before being declared.
6648 This warning is enabled by default in C99 and later dialects of C,
6649 and also by @option{-Wall}.
6650 The warning is made into an error by @option{-pedantic-errors}.
6652 @item -Wimplicit @r{(C and Objective-C only)}
6653 @opindex Wimplicit
6654 @opindex Wno-implicit
6655 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6656 This warning is enabled by @option{-Wall}.
6658 @item -Wimplicit-fallthrough
6659 @opindex Wimplicit-fallthrough
6660 @opindex Wno-implicit-fallthrough
6661 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6662 and @option{-Wno-implicit-fallthrough} is the same as
6663 @option{-Wimplicit-fallthrough=0}.
6665 @item -Wimplicit-fallthrough=@var{n}
6666 @opindex Wimplicit-fallthrough=
6667 Warn when a switch case falls through.  For example:
6669 @smallexample
6670 @group
6671 switch (cond)
6672   @{
6673   case 1:
6674     a = 1;
6675     break;
6676   case 2:
6677     a = 2;
6678   case 3:
6679     a = 3;
6680     break;
6681   @}
6682 @end group
6683 @end smallexample
6685 This warning does not warn when the last statement of a case cannot
6686 fall through, e.g. when there is a return statement or a call to function
6687 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6688 also takes into account control flow statements, such as ifs, and only
6689 warns when appropriate.  E.g.@:
6691 @smallexample
6692 @group
6693 switch (cond)
6694   @{
6695   case 1:
6696     if (i > 3) @{
6697       bar (5);
6698       break;
6699     @} else if (i < 1) @{
6700       bar (0);
6701     @} else
6702       return;
6703   default:
6704     @dots{}
6705   @}
6706 @end group
6707 @end smallexample
6709 Since there are occasions where a switch case fall through is desirable,
6710 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6711 to be used along with a null statement to suppress this warning that
6712 would normally occur:
6714 @smallexample
6715 @group
6716 switch (cond)
6717   @{
6718   case 1:
6719     bar (0);
6720     __attribute__ ((fallthrough));
6721   default:
6722     @dots{}
6723   @}
6724 @end group
6725 @end smallexample
6727 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6728 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
6729 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6730 Instead of these attributes, it is also possible to add a fallthrough comment
6731 to silence the warning.  The whole body of the C or C++ style comment should
6732 match the given regular expressions listed below.  The option argument @var{n}
6733 specifies what kind of comments are accepted:
6735 @itemize @bullet
6737 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6739 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6740 expression, any comment is used as fallthrough comment.
6742 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6743 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6745 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6746 following regular expressions:
6748 @itemize @bullet
6750 @item @code{-fallthrough}
6752 @item @code{@@fallthrough@@}
6754 @item @code{lint -fallthrough[ \t]*}
6756 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6758 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6760 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6762 @end itemize
6764 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6765 following regular expressions:
6767 @itemize @bullet
6769 @item @code{-fallthrough}
6771 @item @code{@@fallthrough@@}
6773 @item @code{lint -fallthrough[ \t]*}
6775 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6777 @end itemize
6779 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6780 fallthrough comments, only attributes disable the warning.
6782 @end itemize
6784 The comment needs to be followed after optional whitespace and other comments
6785 by @code{case} or @code{default} keywords or by a user label that precedes some
6786 @code{case} or @code{default} label.
6788 @smallexample
6789 @group
6790 switch (cond)
6791   @{
6792   case 1:
6793     bar (0);
6794     /* FALLTHRU */
6795   default:
6796     @dots{}
6797   @}
6798 @end group
6799 @end smallexample
6801 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6803 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6804 @opindex Wif-not-aligned
6805 @opindex Wno-if-not-aligned
6806 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6807 should be issued.  These warnings are enabled by default.
6809 @item -Wignored-qualifiers @r{(C and C++ only)}
6810 @opindex Wignored-qualifiers
6811 @opindex Wno-ignored-qualifiers
6812 Warn if the return type of a function has a type qualifier
6813 such as @code{const}.  For ISO C such a type qualifier has no effect,
6814 since the value returned by a function is not an lvalue.
6815 For C++, the warning is only emitted for scalar types or @code{void}.
6816 ISO C prohibits qualified @code{void} return types on function
6817 definitions, so such return types always receive a warning
6818 even without this option.
6820 This warning is also enabled by @option{-Wextra}.
6822 @item -Wno-ignored-attributes @r{(C and C++ only)}
6823 @opindex Wignored-attributes
6824 @opindex Wno-ignored-attributes
6825 This option controls warnings when an attribute is ignored.
6826 This is different from the
6827 @option{-Wattributes} option in that it warns whenever the compiler decides
6828 to drop an attribute, not that the attribute is either unknown, used in a
6829 wrong place, etc.  This warning is enabled by default.
6831 @item -Wmain
6832 @opindex Wmain
6833 @opindex Wno-main
6834 Warn if the type of @code{main} is suspicious.  @code{main} should be
6835 a function with external linkage, returning int, taking either zero
6836 arguments, two, or three arguments of appropriate types.  This warning
6837 is enabled by default in C++ and is enabled by either @option{-Wall}
6838 or @option{-Wpedantic}.
6840 @item -Wmisleading-indentation @r{(C and C++ only)}
6841 @opindex Wmisleading-indentation
6842 @opindex Wno-misleading-indentation
6843 Warn when the indentation of the code does not reflect the block structure.
6844 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6845 @code{for} clauses with a guarded statement that does not use braces,
6846 followed by an unguarded statement with the same indentation.
6848 In the following example, the call to ``bar'' is misleadingly indented as
6849 if it were guarded by the ``if'' conditional.
6851 @smallexample
6852   if (some_condition ())
6853     foo ();
6854     bar ();  /* Gotcha: this is not guarded by the "if".  */
6855 @end smallexample
6857 In the case of mixed tabs and spaces, the warning uses the
6858 @option{-ftabstop=} option to determine if the statements line up
6859 (defaulting to 8).
6861 The warning is not issued for code involving multiline preprocessor logic
6862 such as the following example.
6864 @smallexample
6865   if (flagA)
6866     foo (0);
6867 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6868   if (flagB)
6869 #endif
6870     foo (1);
6871 @end smallexample
6873 The warning is not issued after a @code{#line} directive, since this
6874 typically indicates autogenerated code, and no assumptions can be made
6875 about the layout of the file that the directive references.
6877 This warning is enabled by @option{-Wall} in C and C++.
6879 @item -Wmissing-attributes
6880 @opindex Wmissing-attributes
6881 @opindex Wno-missing-attributes
6882 Warn when a declaration of a function is missing one or more attributes
6883 that a related function is declared with and whose absence may adversely
6884 affect the correctness or efficiency of generated code.  For example,
6885 the warning is issued for declarations of aliases that use attributes
6886 to specify less restrictive requirements than those of their targets.
6887 This typically represents a potential optimization opportunity.
6888 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6889 issued when the alias is more restrictive than the target, which could
6890 lead to incorrect code generation.
6891 Attributes considered include @code{alloc_align}, @code{alloc_size},
6892 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6893 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6894 @code{returns_nonnull}, and @code{returns_twice}.
6896 In C++, the warning is issued when an explicit specialization of a primary
6897 template declared with attribute @code{alloc_align}, @code{alloc_size},
6898 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6899 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
6900 @code{error}, and @code{warning} suppress the warning.
6901 (@pxref{Function Attributes}).
6903 You can use the @code{copy} attribute to apply the same
6904 set of attributes to a declaration as that on another declaration without
6905 explicitly enumerating the attributes. This attribute can be applied
6906 to declarations of functions (@pxref{Common Function Attributes}),
6907 variables (@pxref{Common Variable Attributes}), or types
6908 (@pxref{Common Type Attributes}).
6910 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6912 For example, since the declaration of the primary function template
6913 below makes use of both attribute @code{malloc} and @code{alloc_size}
6914 the declaration of the explicit specialization of the template is
6915 diagnosed because it is missing one of the attributes.
6917 @smallexample
6918 template <class T>
6919 T* __attribute__ ((malloc, alloc_size (1)))
6920 allocate (size_t);
6922 template <>
6923 void* __attribute__ ((malloc))   // missing alloc_size
6924 allocate<void> (size_t);
6925 @end smallexample
6927 @item -Wmissing-braces
6928 @opindex Wmissing-braces
6929 @opindex Wno-missing-braces
6930 Warn if an aggregate or union initializer is not fully bracketed.  In
6931 the following example, the initializer for @code{a} is not fully
6932 bracketed, but that for @code{b} is fully bracketed.
6934 @smallexample
6935 int a[2][2] = @{ 0, 1, 2, 3 @};
6936 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6937 @end smallexample
6939 This warning is enabled by @option{-Wall}.
6941 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
6942 @opindex Wmissing-include-dirs
6943 @opindex Wno-missing-include-dirs
6944 Warn if a user-supplied include directory does not exist. This opions is disabled
6945 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
6946 enabled by default by warning for -I and -J, only.
6948 @item -Wno-missing-profile
6949 @opindex Wmissing-profile
6950 @opindex Wno-missing-profile
6951 This option controls warnings if feedback profiles are missing when using the
6952 @option{-fprofile-use} option.
6953 This option diagnoses those cases where a new function or a new file is added
6954 between compiling with @option{-fprofile-generate} and with
6955 @option{-fprofile-use}, without regenerating the profiles.
6956 In these cases, the profile feedback data files do not contain any
6957 profile feedback information for
6958 the newly added function or file respectively.  Also, in the case when profile
6959 count data (.gcda) files are removed, GCC cannot use any profile feedback
6960 information.  In all these cases, warnings are issued to inform you that a
6961 profile generation step is due.
6962 Ignoring the warning can result in poorly optimized code.
6963 @option{-Wno-missing-profile} can be used to
6964 disable the warning, but this is not recommended and should be done only
6965 when non-existent profile data is justified.
6967 @item -Wmismatched-dealloc
6968 @opindex Wmismatched-dealloc
6969 @opindex Wno-mismatched-dealloc
6971 Warn for calls to deallocation functions with pointer arguments returned
6972 from from allocations functions for which the former isn't a suitable
6973 deallocator.  A pair of functions can be associated as matching allocators
6974 and deallocators by use of attribute @code{malloc}.  Unless disabled by
6975 the @option{-fno-builtin} option the standard functions @code{calloc},
6976 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
6977 forms of C++ @code{operator new} and @code{operator delete} are implicitly
6978 associated as matching allocators and deallocators.  In the following
6979 example @code{mydealloc} is the deallocator for pointers returned from
6980 @code{myalloc}.
6982 @smallexample
6983 void mydealloc (void*);
6985 __attribute__ ((malloc (mydealloc, 1))) void*
6986 myalloc (size_t);
6988 void f (void)
6990   void *p = myalloc (32);
6991   // @dots{}use p@dots{}
6992   free (p);   // warning: not a matching deallocator for myalloc
6993   mydealloc (p);   // ok
6995 @end smallexample
6997 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
6998 mismatches involving either @code{operator new} or @code{operator delete}.
7000 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7002 @item -Wmultistatement-macros
7003 @opindex Wmultistatement-macros
7004 @opindex Wno-multistatement-macros
7005 Warn about unsafe multiple statement macros that appear to be guarded
7006 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7007 @code{while}, in which only the first statement is actually guarded after
7008 the macro is expanded.
7010 For example:
7012 @smallexample
7013 #define DOIT x++; y++
7014 if (c)
7015   DOIT;
7016 @end smallexample
7018 will increment @code{y} unconditionally, not just when @code{c} holds.
7019 The can usually be fixed by wrapping the macro in a do-while loop:
7020 @smallexample
7021 #define DOIT do @{ x++; y++; @} while (0)
7022 if (c)
7023   DOIT;
7024 @end smallexample
7026 This warning is enabled by @option{-Wall} in C and C++.
7028 @item -Wparentheses
7029 @opindex Wparentheses
7030 @opindex Wno-parentheses
7031 Warn if parentheses are omitted in certain contexts, such
7032 as when there is an assignment in a context where a truth value
7033 is expected, or when operators are nested whose precedence people
7034 often get confused about.
7036 Also warn if a comparison like @code{x<=y<=z} appears; this is
7037 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7038 interpretation from that of ordinary mathematical notation.
7040 Also warn for dangerous uses of the GNU extension to
7041 @code{?:} with omitted middle operand. When the condition
7042 in the @code{?}: operator is a boolean expression, the omitted value is
7043 always 1.  Often programmers expect it to be a value computed
7044 inside the conditional expression instead.
7046 For C++ this also warns for some cases of unnecessary parentheses in
7047 declarations, which can indicate an attempt at a function call instead
7048 of a declaration:
7049 @smallexample
7051   // Declares a local variable called mymutex.
7052   std::unique_lock<std::mutex> (mymutex);
7053   // User meant std::unique_lock<std::mutex> lock (mymutex);
7055 @end smallexample
7057 This warning is enabled by @option{-Wall}.
7059 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7060 @opindex Wself-move
7061 @opindex Wno-self-move
7062 This warning warns when a value is moved to itself with @code{std::move}.
7063 Such a @code{std::move} typically has no effect.
7065 @smallexample
7066 struct T @{
7067 @dots{}
7069 void fn()
7071   T t;
7072   @dots{}
7073   t = std::move (t);
7075 @end smallexample
7077 This warning is enabled by @option{-Wall}.
7079 @item -Wsequence-point
7080 @opindex Wsequence-point
7081 @opindex Wno-sequence-point
7082 Warn about code that may have undefined semantics because of violations
7083 of sequence point rules in the C and C++ standards.
7085 The C and C++ standards define the order in which expressions in a C/C++
7086 program are evaluated in terms of @dfn{sequence points}, which represent
7087 a partial ordering between the execution of parts of the program: those
7088 executed before the sequence point, and those executed after it.  These
7089 occur after the evaluation of a full expression (one which is not part
7090 of a larger expression), after the evaluation of the first operand of a
7091 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7092 function is called (but after the evaluation of its arguments and the
7093 expression denoting the called function), and in certain other places.
7094 Other than as expressed by the sequence point rules, the order of
7095 evaluation of subexpressions of an expression is not specified.  All
7096 these rules describe only a partial order rather than a total order,
7097 since, for example, if two functions are called within one expression
7098 with no sequence point between them, the order in which the functions
7099 are called is not specified.  However, the standards committee have
7100 ruled that function calls do not overlap.
7102 It is not specified when between sequence points modifications to the
7103 values of objects take effect.  Programs whose behavior depends on this
7104 have undefined behavior; the C and C++ standards specify that ``Between
7105 the previous and next sequence point an object shall have its stored
7106 value modified at most once by the evaluation of an expression.
7107 Furthermore, the prior value shall be read only to determine the value
7108 to be stored.''.  If a program breaks these rules, the results on any
7109 particular implementation are entirely unpredictable.
7111 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7112 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
7113 diagnosed by this option, and it may give an occasional false positive
7114 result, but in general it has been found fairly effective at detecting
7115 this sort of problem in programs.
7117 The C++17 standard will define the order of evaluation of operands in
7118 more cases: in particular it requires that the right-hand side of an
7119 assignment be evaluated before the left-hand side, so the above
7120 examples are no longer undefined.  But this option will still warn
7121 about them, to help people avoid writing code that is undefined in C
7122 and earlier revisions of C++.
7124 The standard is worded confusingly, therefore there is some debate
7125 over the precise meaning of the sequence point rules in subtle cases.
7126 Links to discussions of the problem, including proposed formal
7127 definitions, may be found on the GCC readings page, at
7128 @uref{https://gcc.gnu.org/@/readings.html}.
7130 This warning is enabled by @option{-Wall} for C and C++.
7132 @item -Wno-return-local-addr
7133 @opindex Wno-return-local-addr
7134 @opindex Wreturn-local-addr
7135 Do not warn about returning a pointer (or in C++, a reference) to a
7136 variable that goes out of scope after the function returns.
7138 @item -Wreturn-type
7139 @opindex Wreturn-type
7140 @opindex Wno-return-type
7141 Warn whenever a function is defined with a return type that defaults
7142 to @code{int}.  Also warn about any @code{return} statement with no
7143 return value in a function whose return type is not @code{void}
7144 (falling off the end of the function body is considered returning
7145 without a value).
7147 For C only, warn about a @code{return} statement with an expression in a
7148 function whose return type is @code{void}, unless the expression type is
7149 also @code{void}.  As a GNU extension, the latter case is accepted
7150 without a warning unless @option{-Wpedantic} is used.  Attempting
7151 to use the return value of a non-@code{void} function other than @code{main}
7152 that flows off the end by reaching the closing curly brace that terminates
7153 the function is undefined.
7155 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7156 than @code{main} results in undefined behavior even when the value of
7157 the function is not used.
7159 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7161 @item -Wno-shift-count-negative
7162 @opindex Wshift-count-negative
7163 @opindex Wno-shift-count-negative
7164 Controls warnings if a shift count is negative.
7165 This warning is enabled by default.
7167 @item -Wno-shift-count-overflow
7168 @opindex Wshift-count-overflow
7169 @opindex Wno-shift-count-overflow
7170 Controls warnings if a shift count is greater than or equal to the bit width
7171 of the type.  This warning is enabled by default.
7173 @item -Wshift-negative-value
7174 @opindex Wshift-negative-value
7175 @opindex Wno-shift-negative-value
7176 Warn if left shifting a negative value.  This warning is enabled by
7177 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7179 @item -Wno-shift-overflow
7180 @itemx -Wshift-overflow=@var{n}
7181 @opindex Wshift-overflow
7182 @opindex Wno-shift-overflow
7183 These options control warnings about left shift overflows.
7185 @table @gcctabopt
7186 @item -Wshift-overflow=1
7187 This is the warning level of @option{-Wshift-overflow} and is enabled
7188 by default in C99 and C++11 modes (and newer).  This warning level does
7189 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7190 an overflow is still rejected in contexts where an integer constant expression
7191 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7192 shifts always wrap.
7194 @item -Wshift-overflow=2
7195 This warning level also warns about left-shifting 1 into the sign bit,
7196 unless C++14 mode (or newer) is active.
7197 @end table
7199 @item -Wswitch
7200 @opindex Wswitch
7201 @opindex Wno-switch
7202 Warn whenever a @code{switch} statement has an index of enumerated type
7203 and lacks a @code{case} for one or more of the named codes of that
7204 enumeration.  (The presence of a @code{default} label prevents this
7205 warning.)  @code{case} labels outside the enumeration range also
7206 provoke warnings when this option is used (even if there is a
7207 @code{default} label).
7208 This warning is enabled by @option{-Wall}.
7210 @item -Wswitch-default
7211 @opindex Wswitch-default
7212 @opindex Wno-switch-default
7213 Warn whenever a @code{switch} statement does not have a @code{default}
7214 case.
7216 @item -Wswitch-enum
7217 @opindex Wswitch-enum
7218 @opindex Wno-switch-enum
7219 Warn whenever a @code{switch} statement has an index of enumerated type
7220 and lacks a @code{case} for one or more of the named codes of that
7221 enumeration.  @code{case} labels outside the enumeration range also
7222 provoke warnings when this option is used.  The only difference
7223 between @option{-Wswitch} and this option is that this option gives a
7224 warning about an omitted enumeration code even if there is a
7225 @code{default} label.
7227 @item -Wno-switch-bool
7228 @opindex Wswitch-bool
7229 @opindex Wno-switch-bool
7230 Do not warn when a @code{switch} statement has an index of boolean type
7231 and the case values are outside the range of a boolean type.
7232 It is possible to suppress this warning by casting the controlling
7233 expression to a type other than @code{bool}.  For example:
7234 @smallexample
7235 @group
7236 switch ((int) (a == 4))
7237   @{
7238   @dots{}
7239   @}
7240 @end group
7241 @end smallexample
7242 This warning is enabled by default for C and C++ programs.
7244 @item -Wno-switch-outside-range
7245 @opindex Wswitch-outside-range
7246 @opindex Wno-switch-outside-range
7247 This option controls warnings when a @code{switch} case has a value
7248 that is outside of its
7249 respective type range.  This warning is enabled by default for
7250 C and C++ programs.
7252 @item -Wno-switch-unreachable
7253 @opindex Wswitch-unreachable
7254 @opindex Wno-switch-unreachable
7255 Do not warn when a @code{switch} statement contains statements between the
7256 controlling expression and the first case label, which will never be
7257 executed.  For example:
7258 @smallexample
7259 @group
7260 switch (cond)
7261   @{
7262    i = 15;
7263   @dots{}
7264    case 5:
7265   @dots{}
7266   @}
7267 @end group
7268 @end smallexample
7269 @option{-Wswitch-unreachable} does not warn if the statement between the
7270 controlling expression and the first case label is just a declaration:
7271 @smallexample
7272 @group
7273 switch (cond)
7274   @{
7275    int i;
7276   @dots{}
7277    case 5:
7278    i = 5;
7279   @dots{}
7280   @}
7281 @end group
7282 @end smallexample
7283 This warning is enabled by default for C and C++ programs.
7285 @item -Wsync-nand @r{(C and C++ only)}
7286 @opindex Wsync-nand
7287 @opindex Wno-sync-nand
7288 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7289 built-in functions are used.  These functions changed semantics in GCC 4.4.
7291 @item -Wtrivial-auto-var-init
7292 @opindex Wtrivial-auto-var-init
7293 @opindex Wno-trivial-auto-var-init
7294 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7295 variable.  A common situation is an automatic variable that is declared
7296 between the controlling expression and the first case label of a @code{switch}
7297 statement.
7299 @item -Wunused-but-set-parameter
7300 @opindex Wunused-but-set-parameter
7301 @opindex Wno-unused-but-set-parameter
7302 Warn whenever a function parameter is assigned to, but otherwise unused
7303 (aside from its declaration).
7305 To suppress this warning use the @code{unused} attribute
7306 (@pxref{Variable Attributes}).
7308 This warning is also enabled by @option{-Wunused} together with
7309 @option{-Wextra}.
7311 @item -Wunused-but-set-variable
7312 @opindex Wunused-but-set-variable
7313 @opindex Wno-unused-but-set-variable
7314 Warn whenever a local variable is assigned to, but otherwise unused
7315 (aside from its declaration).
7316 This warning is enabled by @option{-Wall}.
7318 To suppress this warning use the @code{unused} attribute
7319 (@pxref{Variable Attributes}).
7321 This warning is also enabled by @option{-Wunused}, which is enabled
7322 by @option{-Wall}.
7324 @item -Wunused-function
7325 @opindex Wunused-function
7326 @opindex Wno-unused-function
7327 Warn whenever a static function is declared but not defined or a
7328 non-inline static function is unused.
7329 This warning is enabled by @option{-Wall}.
7331 @item -Wunused-label
7332 @opindex Wunused-label
7333 @opindex Wno-unused-label
7334 Warn whenever a label is declared but not used.
7335 This warning is enabled by @option{-Wall}.
7337 To suppress this warning use the @code{unused} attribute
7338 (@pxref{Variable Attributes}).
7340 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7341 @opindex Wunused-local-typedefs
7342 @opindex Wno-unused-local-typedefs
7343 Warn when a typedef locally defined in a function is not used.
7344 This warning is enabled by @option{-Wall}.
7346 @item -Wunused-parameter
7347 @opindex Wunused-parameter
7348 @opindex Wno-unused-parameter
7349 Warn whenever a function parameter is unused aside from its declaration.
7351 To suppress this warning use the @code{unused} attribute
7352 (@pxref{Variable Attributes}).
7354 @item -Wno-unused-result
7355 @opindex Wunused-result
7356 @opindex Wno-unused-result
7357 Do not warn if a caller of a function marked with attribute
7358 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7359 its return value. The default is @option{-Wunused-result}.
7361 @item -Wunused-variable
7362 @opindex Wunused-variable
7363 @opindex Wno-unused-variable
7364 Warn whenever a local or static variable is unused aside from its
7365 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7366 but not for C++. This warning is enabled by @option{-Wall}.
7368 To suppress this warning use the @code{unused} attribute
7369 (@pxref{Variable Attributes}).
7371 @item -Wunused-const-variable
7372 @itemx -Wunused-const-variable=@var{n}
7373 @opindex Wunused-const-variable
7374 @opindex Wno-unused-const-variable
7375 Warn whenever a constant static variable is unused aside from its declaration.
7376 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7377 for C, but not for C++. In C this declares variable storage, but in C++ this
7378 is not an error since const variables take the place of @code{#define}s.
7380 To suppress this warning use the @code{unused} attribute
7381 (@pxref{Variable Attributes}).
7383 @table @gcctabopt
7384 @item -Wunused-const-variable=1
7385 This is the warning level that is enabled by @option{-Wunused-variable} for
7386 C.  It warns only about unused static const variables defined in the main
7387 compilation unit, but not about static const variables declared in any
7388 header included.
7390 @item -Wunused-const-variable=2
7391 This warning level also warns for unused constant static variables in
7392 headers (excluding system headers).  This is the warning level of
7393 @option{-Wunused-const-variable} and must be explicitly requested since
7394 in C++ this isn't an error and in C it might be harder to clean up all
7395 headers included.
7396 @end table
7398 @item -Wunused-value
7399 @opindex Wunused-value
7400 @opindex Wno-unused-value
7401 Warn whenever a statement computes a result that is explicitly not
7402 used. To suppress this warning cast the unused expression to
7403 @code{void}. This includes an expression-statement or the left-hand
7404 side of a comma expression that contains no side effects. For example,
7405 an expression such as @code{x[i,j]} causes a warning, while
7406 @code{x[(void)i,j]} does not.
7408 This warning is enabled by @option{-Wall}.
7410 @item -Wunused
7411 @opindex Wunused
7412 @opindex Wno-unused
7413 All the above @option{-Wunused} options combined.
7415 In order to get a warning about an unused function parameter, you must
7416 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7417 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7419 @item -Wuninitialized
7420 @opindex Wuninitialized
7421 @opindex Wno-uninitialized
7422 Warn if an object with automatic or allocated storage duration is used
7423 without having been initialized.  In C++, also warn if a non-static
7424 reference or non-static @code{const} member appears in a class without
7425 constructors.
7427 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7428 object to a @code{const}-qualified argument of a built-in function known to
7429 read the object is also diagnosed by this warning.
7430 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7432 If you want to warn about code that uses the uninitialized value of the
7433 variable in its own initializer, use the @option{-Winit-self} option.
7435 These warnings occur for individual uninitialized elements of
7436 structure, union or array variables as well as for variables that are
7437 uninitialized as a whole.  They do not occur for variables or elements
7438 declared @code{volatile}.  Because these warnings depend on
7439 optimization, the exact variables or elements for which there are
7440 warnings depend on the precise optimization options and version of GCC
7441 used.
7443 Note that there may be no warning about a variable that is used only
7444 to compute a value that itself is never used, because such
7445 computations may be deleted by data flow analysis before the warnings
7446 are printed.
7448 In C++, this warning also warns about using uninitialized objects in
7449 member-initializer-lists.  For example, GCC warns about @code{b} being
7450 uninitialized in the following snippet:
7452 @smallexample
7453 struct A @{
7454   int a;
7455   int b;
7456   A() : a(b) @{ @}
7458 @end smallexample
7460 @item -Wno-invalid-memory-model
7461 @opindex Winvalid-memory-model
7462 @opindex Wno-invalid-memory-model
7463 This option controls warnings
7464 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7465 and the C11 atomic generic functions with a memory consistency argument
7466 that is either invalid for the operation or outside the range of values
7467 of the @code{memory_order} enumeration.  For example, since the
7468 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7469 defined for the relaxed, release, and sequentially consistent memory
7470 orders the following code is diagnosed:
7472 @smallexample
7473 void store (int *i)
7475   __atomic_store_n (i, 0, memory_order_consume);
7477 @end smallexample
7479 @option{-Winvalid-memory-model} is enabled by default.
7481 @item -Wmaybe-uninitialized
7482 @opindex Wmaybe-uninitialized
7483 @opindex Wno-maybe-uninitialized
7484 For an object with automatic or allocated storage duration, if there exists
7485 a path from the function entry to a use of the object that is initialized,
7486 but there exist some other paths for which the object is not initialized,
7487 the compiler emits a warning if it cannot prove the uninitialized paths
7488 are not executed at run time.
7490 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7491 object to a @code{const}-qualified function argument is also diagnosed by
7492 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7493 known to read the object.)  Annotating the function with attribute
7494 @code{access (none)} indicates that the argument isn't used to access
7495 the object and avoids the warning (@pxref{Common Function Attributes}).
7497 These warnings are only possible in optimizing compilation, because otherwise
7498 GCC does not keep track of the state of variables.
7500 These warnings are made optional because GCC may not be able to determine when
7501 the code is correct in spite of appearing to have an error.  Here is one
7502 example of how this can happen:
7504 @smallexample
7505 @group
7507   int x;
7508   switch (y)
7509     @{
7510     case 1: x = 1;
7511       break;
7512     case 2: x = 4;
7513       break;
7514     case 3: x = 5;
7515     @}
7516   foo (x);
7518 @end group
7519 @end smallexample
7521 @noindent
7522 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7523 always initialized, but GCC doesn't know this. To suppress the
7524 warning, you need to provide a default case with assert(0) or
7525 similar code.
7527 @cindex @code{longjmp} warnings
7528 This option also warns when a non-volatile automatic variable might be
7529 changed by a call to @code{longjmp}.
7530 The compiler sees only the calls to @code{setjmp}.  It cannot know
7531 where @code{longjmp} will be called; in fact, a signal handler could
7532 call it at any point in the code.  As a result, you may get a warning
7533 even when there is in fact no problem because @code{longjmp} cannot
7534 in fact be called at the place that would cause a problem.
7536 Some spurious warnings can be avoided if you declare all the functions
7537 you use that never return as @code{noreturn}.  @xref{Function
7538 Attributes}.
7540 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7542 @item -Wunknown-pragmas
7543 @opindex Wunknown-pragmas
7544 @opindex Wno-unknown-pragmas
7545 @cindex warning for unknown pragmas
7546 @cindex unknown pragmas, warning
7547 @cindex pragmas, warning of unknown
7548 Warn when a @code{#pragma} directive is encountered that is not understood by 
7549 GCC@.  If this command-line option is used, warnings are even issued
7550 for unknown pragmas in system header files.  This is not the case if
7551 the warnings are only enabled by the @option{-Wall} command-line option.
7553 @item -Wno-pragmas
7554 @opindex Wno-pragmas
7555 @opindex Wpragmas
7556 Do not warn about misuses of pragmas, such as incorrect parameters,
7557 invalid syntax, or conflicts between pragmas.  See also
7558 @option{-Wunknown-pragmas}.
7560 @item -Wno-prio-ctor-dtor
7561 @opindex Wno-prio-ctor-dtor
7562 @opindex Wprio-ctor-dtor
7563 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7564 The use of constructor and destructor attributes allow you to assign a
7565 priority to the constructor/destructor to control its order of execution
7566 before @code{main} is called or after it returns.  The priority values must be
7567 greater than 100 as the compiler reserves priority values between 0--100 for
7568 the implementation.
7570 @item -Wstrict-aliasing
7571 @opindex Wstrict-aliasing
7572 @opindex Wno-strict-aliasing
7573 This option is only active when @option{-fstrict-aliasing} is active.
7574 It warns about code that might break the strict aliasing rules that the
7575 compiler is using for optimization.  The warning does not catch all
7576 cases, but does attempt to catch the more common pitfalls.  It is
7577 included in @option{-Wall}.
7578 It is equivalent to @option{-Wstrict-aliasing=3}
7580 @item -Wstrict-aliasing=n
7581 @opindex Wstrict-aliasing=n
7582 This option is only active when @option{-fstrict-aliasing} is active.
7583 It warns about code that might break the strict aliasing rules that the
7584 compiler is using for optimization.
7585 Higher levels correspond to higher accuracy (fewer false positives).
7586 Higher levels also correspond to more effort, similar to the way @option{-O} 
7587 works.
7588 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7590 Level 1: Most aggressive, quick, least accurate.
7591 Possibly useful when higher levels
7592 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7593 false negatives.  However, it has many false positives.
7594 Warns for all pointer conversions between possibly incompatible types,
7595 even if never dereferenced.  Runs in the front end only.
7597 Level 2: Aggressive, quick, not too precise.
7598 May still have many false positives (not as many as level 1 though),
7599 and few false negatives (but possibly more than level 1).
7600 Unlike level 1, it only warns when an address is taken.  Warns about
7601 incomplete types.  Runs in the front end only.
7603 Level 3 (default for @option{-Wstrict-aliasing}):
7604 Should have very few false positives and few false
7605 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7606 Takes care of the common pun+dereference pattern in the front end:
7607 @code{*(int*)&some_float}.
7608 If optimization is enabled, it also runs in the back end, where it deals
7609 with multiple statement cases using flow-sensitive points-to information.
7610 Only warns when the converted pointer is dereferenced.
7611 Does not warn about incomplete types.
7613 @item -Wstrict-overflow
7614 @itemx -Wstrict-overflow=@var{n}
7615 @opindex Wstrict-overflow
7616 @opindex Wno-strict-overflow
7617 This option is only active when signed overflow is undefined.
7618 It warns about cases where the compiler optimizes based on the
7619 assumption that signed overflow does not occur.  Note that it does not
7620 warn about all cases where the code might overflow: it only warns
7621 about cases where the compiler implements some optimization.  Thus
7622 this warning depends on the optimization level.
7624 An optimization that assumes that signed overflow does not occur is
7625 perfectly safe if the values of the variables involved are such that
7626 overflow never does, in fact, occur.  Therefore this warning can
7627 easily give a false positive: a warning about code that is not
7628 actually a problem.  To help focus on important issues, several
7629 warning levels are defined.  No warnings are issued for the use of
7630 undefined signed overflow when estimating how many iterations a loop
7631 requires, in particular when determining whether a loop will be
7632 executed at all.
7634 @table @gcctabopt
7635 @item -Wstrict-overflow=1
7636 Warn about cases that are both questionable and easy to avoid.  For
7637 example the compiler simplifies
7638 @code{x + 1 > x} to @code{1}.  This level of
7639 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7640 are not, and must be explicitly requested.
7642 @item -Wstrict-overflow=2
7643 Also warn about other cases where a comparison is simplified to a
7644 constant.  For example: @code{abs (x) >= 0}.  This can only be
7645 simplified when signed integer overflow is undefined, because
7646 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7647 zero.  @option{-Wstrict-overflow} (with no level) is the same as
7648 @option{-Wstrict-overflow=2}.
7650 @item -Wstrict-overflow=3
7651 Also warn about other cases where a comparison is simplified.  For
7652 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7654 @item -Wstrict-overflow=4
7655 Also warn about other simplifications not covered by the above cases.
7656 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7658 @item -Wstrict-overflow=5
7659 Also warn about cases where the compiler reduces the magnitude of a
7660 constant involved in a comparison.  For example: @code{x + 2 > y} is
7661 simplified to @code{x + 1 >= y}.  This is reported only at the
7662 highest warning level because this simplification applies to many
7663 comparisons, so this warning level gives a very large number of
7664 false positives.
7665 @end table
7667 @item -Wstring-compare
7668 @opindex Wstring-compare
7669 @opindex Wno-string-compare
7670 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7671 determined to be either zero or non-zero in tests for such equality
7672 owing to the length of one argument being greater than the size of
7673 the array the other argument is stored in (or the bound in the case
7674 of @code{strncmp}).  Such calls could be mistakes.  For example,
7675 the call to @code{strcmp} below is diagnosed because its result is
7676 necessarily non-zero irrespective of the contents of the array @code{a}.
7678 @smallexample
7679 extern char a[4];
7680 void f (char *d)
7682   strcpy (d, "string");
7683   @dots{}
7684   if (0 == strcmp (a, d))   // cannot be true
7685     puts ("a and d are the same");
7687 @end smallexample
7689 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7691 @item -Wno-stringop-overflow
7692 @item -Wstringop-overflow
7693 @itemx -Wstringop-overflow=@var{type}
7694 @opindex Wstringop-overflow
7695 @opindex Wno-stringop-overflow
7696 Warn for calls to string manipulation functions such as @code{memcpy} and
7697 @code{strcpy} that are determined to overflow the destination buffer.  The
7698 optional argument is one greater than the type of Object Size Checking to
7699 perform to determine the size of the destination.  @xref{Object Size Checking}.
7700 The argument is meaningful only for functions that operate on character arrays
7701 but not for raw memory functions like @code{memcpy} which always make use
7702 of Object Size type-0.  The option also warns for calls that specify a size
7703 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7704 The option produces the best results with optimization enabled but can detect
7705 a small subset of simple buffer overflows even without optimization in
7706 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7707 correspond to the standard functions.  In any case, the option warns about
7708 just a subset of buffer overflows detected by the corresponding overflow
7709 checking built-ins.  For example, the option issues a warning for
7710 the @code{strcpy} call below because it copies at least 5 characters
7711 (the string @code{"blue"} including the terminating NUL) into the buffer
7712 of size 4.
7714 @smallexample
7715 enum Color @{ blue, purple, yellow @};
7716 const char* f (enum Color clr)
7718   static char buf [4];
7719   const char *str;
7720   switch (clr)
7721     @{
7722       case blue: str = "blue"; break;
7723       case purple: str = "purple"; break;
7724       case yellow: str = "yellow"; break;
7725     @}
7727   return strcpy (buf, str);   // warning here
7729 @end smallexample
7731 Option @option{-Wstringop-overflow=2} is enabled by default.
7733 @table @gcctabopt
7734 @item -Wstringop-overflow
7735 @itemx -Wstringop-overflow=1
7736 @opindex Wstringop-overflow
7737 @opindex Wno-stringop-overflow
7738 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7739 to determine the sizes of destination objects.  At this setting the option
7740 does not warn for writes past the end of subobjects of larger objects accessed
7741 by pointers unless the size of the largest surrounding object is known.  When
7742 the destination may be one of several objects it is assumed to be the largest
7743 one of them.  On Linux systems, when optimization is enabled at this setting
7744 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7745 is defined to a non-zero value.
7747 @item -Wstringop-overflow=2
7748 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7749 to determine the sizes of destination objects.  At this setting the option
7750 warns about overflows when writing to members of the largest complete
7751 objects whose exact size is known.  However, it does not warn for excessive
7752 writes to the same members of unknown objects referenced by pointers since
7753 they may point to arrays containing unknown numbers of elements.  This is
7754 the default setting of the option.
7756 @item -Wstringop-overflow=3
7757 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7758 to determine the sizes of destination objects.  At this setting the option
7759 warns about overflowing the smallest object or data member.  This is the
7760 most restrictive setting of the option that may result in warnings for safe
7761 code.
7763 @item -Wstringop-overflow=4
7764 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7765 to determine the sizes of destination objects.  At this setting the option
7766 warns about overflowing any data members, and when the destination is
7767 one of several objects it uses the size of the largest of them to decide
7768 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
7769 setting of the option may result in warnings for benign code.
7770 @end table
7772 @item -Wno-stringop-overread
7773 @opindex Wstringop-overread
7774 @opindex Wno-stringop-overread
7775 Warn for calls to string manipulation functions such as @code{memchr}, or
7776 @code{strcpy} that are determined to read past the end of the source
7777 sequence.
7779 Option @option{-Wstringop-overread} is enabled by default.
7781 @item -Wno-stringop-truncation
7782 @opindex Wstringop-truncation
7783 @opindex Wno-stringop-truncation
7784 Do not warn for calls to bounded string manipulation functions
7785 such as @code{strncat},
7786 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7787 or leave the destination unchanged.
7789 In the following example, the call to @code{strncat} specifies a bound that
7790 is less than the length of the source string.  As a result, the copy of
7791 the source will be truncated and so the call is diagnosed.  To avoid the
7792 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7794 @smallexample
7795 void append (char *buf, size_t bufsize)
7797   strncat (buf, ".txt", 3);
7799 @end smallexample
7801 As another example, the following call to @code{strncpy} results in copying
7802 to @code{d} just the characters preceding the terminating NUL, without
7803 appending the NUL to the end.  Assuming the result of @code{strncpy} is
7804 necessarily a NUL-terminated string is a common mistake, and so the call
7805 is diagnosed.  To avoid the warning when the result is not expected to be
7806 NUL-terminated, call @code{memcpy} instead.
7808 @smallexample
7809 void copy (char *d, const char *s)
7811   strncpy (d, s, strlen (s));
7813 @end smallexample
7815 In the following example, the call to @code{strncpy} specifies the size
7816 of the destination buffer as the bound.  If the length of the source
7817 string is equal to or greater than this size the result of the copy will
7818 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
7819 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7820 element of the buffer to @code{NUL}.
7822 @smallexample
7823 void copy (const char *s)
7825   char buf[80];
7826   strncpy (buf, s, sizeof buf);
7827   @dots{}
7829 @end smallexample
7831 In situations where a character array is intended to store a sequence
7832 of bytes with no terminating @code{NUL} such an array may be annotated
7833 with attribute @code{nonstring} to avoid this warning.  Such arrays,
7834 however, are not suitable arguments to functions that expect
7835 @code{NUL}-terminated strings.  To help detect accidental misuses of
7836 such arrays GCC issues warnings unless it can prove that the use is
7837 safe.  @xref{Common Variable Attributes}.
7839 @item -Wstrict-flex-arrays
7840 @opindex Wstrict-flex-arrays
7841 @opindex Wno-strict-flex-arrays
7842 Warn about inproper usages of flexible array members
7843 according to the @var{level} of the @code{strict_flex_array (@var{level})}
7844 attribute attached to the trailing array field of a structure if it's
7845 available, otherwise according to the @var{level} of the option
7846 @option{-fstrict-flex-arrays=@var{level}}.
7848 This option is effective only when @var{level} is bigger than 0.  Otherwise,
7849 it will be ignored with a warning.
7851 when @var{level}=1, warnings will be issued for a trailing array reference
7852 of a structure that have 2 or more elements if the trailing array is referenced
7853 as a flexible array member.
7855 when @var{level}=2, in addition to @var{level}=1, additional warnings will be
7856 issued for a trailing one-element array reference of a structure
7857 if the array is referenced as a flexible array member.
7859 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
7860 issued for a trailing zero-length array reference of a structure
7861 if the array is referenced as a flexible array member.
7864 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7865 @opindex Wsuggest-attribute=
7866 @opindex Wno-suggest-attribute=
7867 Warn for cases where adding an attribute may be beneficial. The
7868 attributes currently supported are listed below.
7870 @table @gcctabopt
7871 @item -Wsuggest-attribute=pure
7872 @itemx -Wsuggest-attribute=const
7873 @itemx -Wsuggest-attribute=noreturn
7874 @itemx -Wmissing-noreturn
7875 @itemx -Wsuggest-attribute=malloc
7876 @opindex Wsuggest-attribute=pure
7877 @opindex Wno-suggest-attribute=pure
7878 @opindex Wsuggest-attribute=const
7879 @opindex Wno-suggest-attribute=const
7880 @opindex Wsuggest-attribute=noreturn
7881 @opindex Wno-suggest-attribute=noreturn
7882 @opindex Wmissing-noreturn
7883 @opindex Wno-missing-noreturn
7884 @opindex Wsuggest-attribute=malloc
7885 @opindex Wno-suggest-attribute=malloc
7887 Warn about functions that might be candidates for attributes
7888 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7889 only warns for functions visible in other compilation units or (in the case of
7890 @code{pure} and @code{const}) if it cannot prove that the function returns
7891 normally. A function returns normally if it doesn't contain an infinite loop or
7892 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
7893 requires option @option{-fipa-pure-const}, which is enabled by default at
7894 @option{-O} and higher.  Higher optimization levels improve the accuracy
7895 of the analysis.
7897 @item -Wsuggest-attribute=format
7898 @itemx -Wmissing-format-attribute
7899 @opindex Wsuggest-attribute=format
7900 @opindex Wmissing-format-attribute
7901 @opindex Wno-suggest-attribute=format
7902 @opindex Wno-missing-format-attribute
7903 @opindex Wformat
7904 @opindex Wno-format
7906 Warn about function pointers that might be candidates for @code{format}
7907 attributes.  Note these are only possible candidates, not absolute ones.
7908 GCC guesses that function pointers with @code{format} attributes that
7909 are used in assignment, initialization, parameter passing or return
7910 statements should have a corresponding @code{format} attribute in the
7911 resulting type.  I.e.@: the left-hand side of the assignment or
7912 initialization, the type of the parameter variable, or the return type
7913 of the containing function respectively should also have a @code{format}
7914 attribute to avoid the warning.
7916 GCC also warns about function definitions that might be
7917 candidates for @code{format} attributes.  Again, these are only
7918 possible candidates.  GCC guesses that @code{format} attributes
7919 might be appropriate for any function that calls a function like
7920 @code{vprintf} or @code{vscanf}, but this might not always be the
7921 case, and some functions for which @code{format} attributes are
7922 appropriate may not be detected.
7924 @item -Wsuggest-attribute=cold
7925 @opindex Wsuggest-attribute=cold
7926 @opindex Wno-suggest-attribute=cold
7928 Warn about functions that might be candidates for @code{cold} attribute.  This
7929 is based on static detection and generally only warns about functions which
7930 always leads to a call to another @code{cold} function such as wrappers of
7931 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7932 @end table
7934 @item -Walloc-zero
7935 @opindex Wno-alloc-zero
7936 @opindex Walloc-zero
7937 Warn about calls to allocation functions decorated with attribute
7938 @code{alloc_size} that specify zero bytes, including those to the built-in
7939 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7940 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
7941 when called with a zero size differs among implementations (and in the case
7942 of @code{realloc} has been deprecated) relying on it may result in subtle
7943 portability bugs and should be avoided.
7945 @item -Walloc-size-larger-than=@var{byte-size}
7946 @opindex Walloc-size-larger-than=
7947 @opindex Wno-alloc-size-larger-than
7948 Warn about calls to functions decorated with attribute @code{alloc_size}
7949 that attempt to allocate objects larger than the specified number of bytes,
7950 or where the result of the size computation in an integer type with infinite
7951 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7952 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7953 Warnings controlled by the option can be disabled either by specifying
7954 @var{byte-size} of @samp{SIZE_MAX} or more or by
7955 @option{-Wno-alloc-size-larger-than}.
7956 @xref{Function Attributes}.
7958 @item -Wno-alloc-size-larger-than
7959 @opindex Wno-alloc-size-larger-than
7960 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
7961 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7962 larger.
7964 @item -Walloca
7965 @opindex Wno-alloca
7966 @opindex Walloca
7967 This option warns on all uses of @code{alloca} in the source.
7969 @item -Walloca-larger-than=@var{byte-size}
7970 @opindex Walloca-larger-than=
7971 @opindex Wno-alloca-larger-than
7972 This option warns on calls to @code{alloca} with an integer argument whose
7973 value is either zero, or that is not bounded by a controlling predicate
7974 that limits its value to at most @var{byte-size}.  It also warns for calls
7975 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
7976 types are considered unbounded even if they appear to be constrained to
7977 the expected range.
7979 For example, a bounded case of @code{alloca} could be:
7981 @smallexample
7982 void func (size_t n)
7984   void *p;
7985   if (n <= 1000)
7986     p = alloca (n);
7987   else
7988     p = malloc (n);
7989   f (p);
7991 @end smallexample
7993 In the above example, passing @code{-Walloca-larger-than=1000} would not
7994 issue a warning because the call to @code{alloca} is known to be at most
7995 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
7996 the compiler would emit a warning.
7998 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7999 controlling predicate constraining its integer argument.  For example:
8001 @smallexample
8002 void func ()
8004   void *p = alloca (n);
8005   f (p);
8007 @end smallexample
8009 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8010 a warning, but this time because of the lack of bounds checking.
8012 Note, that even seemingly correct code involving signed integers could
8013 cause a warning:
8015 @smallexample
8016 void func (signed int n)
8018   if (n < 500)
8019     @{
8020       p = alloca (n);
8021       f (p);
8022     @}
8024 @end smallexample
8026 In the above example, @var{n} could be negative, causing a larger than
8027 expected argument to be implicitly cast into the @code{alloca} call.
8029 This option also warns when @code{alloca} is used in a loop.
8031 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8032 but is usually only effective  when @option{-ftree-vrp} is active (default
8033 for @option{-O2} and above).
8035 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8037 @item -Wno-alloca-larger-than
8038 @opindex Wno-alloca-larger-than
8039 Disable @option{-Walloca-larger-than=} warnings.  The option is
8040 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8042 @item -Warith-conversion
8043 @opindex Warith-conversion
8044 @opindex Wno-arith-conversion
8045 Do warn about implicit conversions from arithmetic operations even
8046 when conversion of the operands to the same type cannot change their
8047 values.  This affects warnings from @option{-Wconversion},
8048 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8050 @smallexample
8051 @group
8052 void f (char c, int i)
8054   c = c + i; // warns with @option{-Wconversion}
8055   c = c + 1; // only warns with @option{-Warith-conversion}
8057 @end group
8058 @end smallexample
8060 @item -Warray-bounds
8061 @itemx -Warray-bounds=@var{n}
8062 @opindex Wno-array-bounds
8063 @opindex Warray-bounds
8064 Warn about out of bounds subscripts or offsets into arrays.  This warning
8065 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
8066 is active (the default for @option{-O2} and above) but a subset of instances
8067 are issued even without optimization.
8069 By default, the trailing array of a structure will be treated as a flexible
8070 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8071 if it is declared as either a flexible array member per C99 standard onwards
8072 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8073 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8074 zero-length arrays or one-element arrays are not warned by default.
8076 You can add the option @option{-fstrict-flex-arrays} or
8077 @option{-fstrict-flex-arrays=@var{level}} to control how this
8078 option treat trailing array of a structure as a flexible array member:
8080 when @var{level}<=1, no change to the default behavior.
8082 when @var{level}=2, additional warnings will be issued for out of bounds
8083 subscripts or offsets into one-element arrays;
8085 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8086 issued for out of bounds subscripts or offsets into zero-length arrays.
8088 @table @gcctabopt
8089 @item -Warray-bounds=1
8090 This is the default warning level of @option{-Warray-bounds} and is enabled
8091 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8093 @item -Warray-bounds=2
8094 This warning level also warns about the intermediate results of pointer
8095 arithmetic that may yield out of bounds values. This warning level may
8096 give a larger number of false positives and is deactivated by default.
8097 @end table
8099 @item -Warray-compare
8100 @opindex Warray-compare
8101 @opindex Wno-array-compare
8102 Warn about equality and relational comparisons between two operands of array
8103 type.  This comparison was deprecated in C++20.  For example:
8105 @smallexample
8106 int arr1[5];
8107 int arr2[5];
8108 bool same = arr1 == arr2;
8109 @end smallexample
8111 @option{-Warray-compare} is enabled by @option{-Wall}.
8113 @item -Warray-parameter
8114 @itemx -Warray-parameter=@var{n}
8115 @opindex Wno-array-parameter
8116 Warn about redeclarations of functions involving arguments of array or
8117 pointer types of inconsistent kinds or forms, and enable the detection
8118 of out-of-bounds accesses to such parameters by warnings such as
8119 @option{-Warray-bounds}.
8121 If the first function declaration uses the array form the bound specified
8122 in the array is assumed to be the minimum number of elements expected to
8123 be provided in calls to the function and the maximum number of elements
8124 accessed by it.  Failing to provide arguments of sufficient size or accessing
8125 more than the maximum number of elements may be diagnosed by warnings such
8126 as @option{-Warray-bounds}.  At level 1 the warning diagnoses inconsistencies
8127 involving array parameters declared using the @code{T[static N]} form.
8129 For example, the warning triggers for the following redeclarations because
8130 the first one allows an array of any size to be passed to @code{f} while
8131 the second one with the keyword @code{static} specifies that the array
8132 argument must have at least four elements.
8134 @smallexample
8135 void f (int[static 4]);
8136 void f (int[]);           // warning (inconsistent array form)
8138 void g (void)
8140   int *p = (int *)malloc (4);
8141   f (p);                  // warning (array too small)
8142   @dots{}
8144 @end smallexample
8146 At level 2 the warning also triggers for redeclarations involving any other
8147 inconsistency in array or pointer argument forms denoting array sizes.
8148 Pointers and arrays of unspecified bound are considered equivalent and do
8149 not trigger a warning.
8151 @smallexample
8152 void g (int*);
8153 void g (int[]);     // no warning
8154 void g (int[8]);    // warning (inconsistent array bound)
8155 @end smallexample
8157 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
8158 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8159 involving Variable Length Array arguments.
8161 @item -Wattribute-alias=@var{n}
8162 @itemx -Wno-attribute-alias
8163 @opindex Wattribute-alias
8164 @opindex Wno-attribute-alias
8165 Warn about declarations using the @code{alias} and similar attributes whose
8166 target is incompatible with the type of the alias.
8167 @xref{Function Attributes,,Declaring Attributes of Functions}.
8169 @table @gcctabopt
8170 @item -Wattribute-alias=1
8171 The default warning level of the @option{-Wattribute-alias} option diagnoses
8172 incompatibilities between the type of the alias declaration and that of its
8173 target.  Such incompatibilities are typically indicative of bugs.
8175 @item -Wattribute-alias=2
8177 At this level @option{-Wattribute-alias} also diagnoses cases where
8178 the attributes of the alias declaration are more restrictive than the
8179 attributes applied to its target.  These mismatches can potentially
8180 result in incorrect code generation.  In other cases they may be
8181 benign and could be resolved simply by adding the missing attribute to
8182 the target.  For comparison, see the @option{-Wmissing-attributes}
8183 option, which controls diagnostics when the alias declaration is less
8184 restrictive than the target, rather than more restrictive.
8186 Attributes considered include @code{alloc_align}, @code{alloc_size},
8187 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8188 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8189 @code{returns_nonnull}, and @code{returns_twice}.
8190 @end table
8192 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8193 This is the default.  You can disable these warnings with either
8194 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8196 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8197 @opindex Wbidi-chars=
8198 @opindex Wbidi-chars
8199 @opindex Wno-bidi-chars
8200 Warn about possibly misleading UTF-8 bidirectional control characters in
8201 comments, string literals, character constants, and identifiers.  Such
8202 characters can change left-to-right writing direction into right-to-left
8203 (and vice versa), which can cause confusion between the logical order and
8204 visual order.  This may be dangerous; for instance, it may seem that a piece
8205 of code is not commented out, whereas it in fact is.
8207 There are three levels of warning supported by GCC@.  The default is
8208 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8209 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8210 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8211 characters.
8213 By default, this warning does not warn about UCNs.  It is, however, possible
8214 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8215 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8216 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8217 @option{-Wbidi-chars=any} was specified.
8219 @item -Wbool-compare
8220 @opindex Wno-bool-compare
8221 @opindex Wbool-compare
8222 Warn about boolean expression compared with an integer value different from
8223 @code{true}/@code{false}.  For instance, the following comparison is
8224 always false:
8225 @smallexample
8226 int n = 5;
8227 @dots{}
8228 if ((n > 1) == 2) @{ @dots{} @}
8229 @end smallexample
8230 This warning is enabled by @option{-Wall}.
8232 @item -Wbool-operation
8233 @opindex Wno-bool-operation
8234 @opindex Wbool-operation
8235 Warn about suspicious operations on expressions of a boolean type.  For
8236 instance, bitwise negation of a boolean is very likely a bug in the program.
8237 For C, this warning also warns about incrementing or decrementing a boolean,
8238 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8239 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8241 This warning is enabled by @option{-Wall}.
8243 @item -Wduplicated-branches
8244 @opindex Wno-duplicated-branches
8245 @opindex Wduplicated-branches
8246 Warn when an if-else has identical branches.  This warning detects cases like
8247 @smallexample
8248 if (p != NULL)
8249   return 0;
8250 else
8251   return 0;
8252 @end smallexample
8253 It doesn't warn when both branches contain just a null statement.  This warning
8254 also warn for conditional operators:
8255 @smallexample
8256   int i = x ? *p : *p;
8257 @end smallexample
8259 @item -Wduplicated-cond
8260 @opindex Wno-duplicated-cond
8261 @opindex Wduplicated-cond
8262 Warn about duplicated conditions in an if-else-if chain.  For instance,
8263 warn for the following code:
8264 @smallexample
8265 if (p->q != NULL) @{ @dots{} @}
8266 else if (p->q != NULL) @{ @dots{} @}
8267 @end smallexample
8269 @item -Wframe-address
8270 @opindex Wno-frame-address
8271 @opindex Wframe-address
8272 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8273 is called with an argument greater than 0.  Such calls may return indeterminate
8274 values or crash the program.  The warning is included in @option{-Wall}.
8276 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8277 @opindex Wno-discarded-qualifiers
8278 @opindex Wdiscarded-qualifiers
8279 Do not warn if type qualifiers on pointers are being discarded.
8280 Typically, the compiler warns if a @code{const char *} variable is
8281 passed to a function that takes a @code{char *} parameter.  This option
8282 can be used to suppress such a warning.
8284 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8285 @opindex Wno-discarded-array-qualifiers
8286 @opindex Wdiscarded-array-qualifiers
8287 Do not warn if type qualifiers on arrays which are pointer targets
8288 are being discarded.  Typically, the compiler warns if a
8289 @code{const int (*)[]} variable is passed to a function that
8290 takes a @code{int (*)[]} parameter.  This option can be used to
8291 suppress such a warning.
8293 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8294 @opindex Wno-incompatible-pointer-types
8295 @opindex Wincompatible-pointer-types
8296 Do not warn when there is a conversion between pointers that have incompatible
8297 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8298 which warns for pointer argument passing or assignment with different
8299 signedness.
8301 @item -Wno-int-conversion @r{(C and Objective-C only)}
8302 @opindex Wno-int-conversion
8303 @opindex Wint-conversion
8304 Do not warn about incompatible integer to pointer and pointer to integer
8305 conversions.  This warning is about implicit conversions; for explicit
8306 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8307 @option{-Wno-pointer-to-int-cast} may be used.
8309 @item -Wzero-length-bounds
8310 @opindex Wzero-length-bounds
8311 @opindex Wzero-length-bounds
8312 Warn about accesses to elements of zero-length array members that might
8313 overlap other members of the same object.  Declaring interior zero-length
8314 arrays is discouraged because accesses to them are undefined.  See
8315 @xref{Zero Length}.
8317 For example, the first two stores in function @code{bad} are diagnosed
8318 because the array elements overlap the subsequent members @code{b} and
8319 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8320 because it is beyond the bounds of the enclosing object.
8322 @smallexample
8323 struct X @{ int a[0]; int b, c; @};
8324 struct X x;
8326 void bad (void)
8328   x.a[0] = 0;   // -Wzero-length-bounds
8329   x.a[1] = 1;   // -Wzero-length-bounds
8330   x.a[2] = 2;   // -Warray-bounds
8332 @end smallexample
8334 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8336 @item -Wno-div-by-zero
8337 @opindex Wno-div-by-zero
8338 @opindex Wdiv-by-zero
8339 Do not warn about compile-time integer division by zero.  Floating-point
8340 division by zero is not warned about, as it can be a legitimate way of
8341 obtaining infinities and NaNs.
8343 @item -Wsystem-headers
8344 @opindex Wsystem-headers
8345 @opindex Wno-system-headers
8346 @cindex warnings from system headers
8347 @cindex system headers, warnings from
8348 Print warning messages for constructs found in system header files.
8349 Warnings from system headers are normally suppressed, on the assumption
8350 that they usually do not indicate real problems and would only make the
8351 compiler output harder to read.  Using this command-line option tells
8352 GCC to emit warnings from system headers as if they occurred in user
8353 code.  However, note that using @option{-Wall} in conjunction with this
8354 option does @emph{not} warn about unknown pragmas in system
8355 headers---for that, @option{-Wunknown-pragmas} must also be used.
8357 @item -Wtautological-compare
8358 @opindex Wtautological-compare
8359 @opindex Wno-tautological-compare
8360 Warn if a self-comparison always evaluates to true or false.  This
8361 warning detects various mistakes such as:
8362 @smallexample
8363 int i = 1;
8364 @dots{}
8365 if (i > i) @{ @dots{} @}
8366 @end smallexample
8368 This warning also warns about bitwise comparisons that always evaluate
8369 to true or false, for instance:
8370 @smallexample
8371 if ((a & 16) == 10) @{ @dots{} @}
8372 @end smallexample
8373 will always be false.
8375 This warning is enabled by @option{-Wall}.
8377 @item -Wtrampolines
8378 @opindex Wtrampolines
8379 @opindex Wno-trampolines
8380 Warn about trampolines generated for pointers to nested functions.
8381 A trampoline is a small piece of data or code that is created at run
8382 time on the stack when the address of a nested function is taken, and is
8383 used to call the nested function indirectly.  For some targets, it is
8384 made up of data only and thus requires no special treatment.  But, for
8385 most targets, it is made up of code and thus requires the stack to be
8386 made executable in order for the program to work properly.
8388 @item -Wfloat-equal
8389 @opindex Wfloat-equal
8390 @opindex Wno-float-equal
8391 Warn if floating-point values are used in equality comparisons.
8393 The idea behind this is that sometimes it is convenient (for the
8394 programmer) to consider floating-point values as approximations to
8395 infinitely precise real numbers.  If you are doing this, then you need
8396 to compute (by analyzing the code, or in some other way) the maximum or
8397 likely maximum error that the computation introduces, and allow for it
8398 when performing comparisons (and when producing output, but that's a
8399 different problem).  In particular, instead of testing for equality, you
8400 should check to see whether the two values have ranges that overlap; and
8401 this is done with the relational operators, so equality comparisons are
8402 probably mistaken.
8404 @item -Wtraditional @r{(C and Objective-C only)}
8405 @opindex Wtraditional
8406 @opindex Wno-traditional
8407 Warn about certain constructs that behave differently in traditional and
8408 ISO C@.  Also warn about ISO C constructs that have no traditional C
8409 equivalent, and/or problematic constructs that should be avoided.
8411 @itemize @bullet
8412 @item
8413 Macro parameters that appear within string literals in the macro body.
8414 In traditional C macro replacement takes place within string literals,
8415 but in ISO C it does not.
8417 @item
8418 In traditional C, some preprocessor directives did not exist.
8419 Traditional preprocessors only considered a line to be a directive
8420 if the @samp{#} appeared in column 1 on the line.  Therefore
8421 @option{-Wtraditional} warns about directives that traditional C
8422 understands but ignores because the @samp{#} does not appear as the
8423 first character on the line.  It also suggests you hide directives like
8424 @code{#pragma} not understood by traditional C by indenting them.  Some
8425 traditional implementations do not recognize @code{#elif}, so this option
8426 suggests avoiding it altogether.
8428 @item
8429 A function-like macro that appears without arguments.
8431 @item
8432 The unary plus operator.
8434 @item
8435 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8436 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8437 constants.)  Note, these suffixes appear in macros defined in the system
8438 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8439 Use of these macros in user code might normally lead to spurious
8440 warnings, however GCC's integrated preprocessor has enough context to
8441 avoid warning in these cases.
8443 @item
8444 A function declared external in one block and then used after the end of
8445 the block.
8447 @item
8448 A @code{switch} statement has an operand of type @code{long}.
8450 @item
8451 A non-@code{static} function declaration follows a @code{static} one.
8452 This construct is not accepted by some traditional C compilers.
8454 @item
8455 The ISO type of an integer constant has a different width or
8456 signedness from its traditional type.  This warning is only issued if
8457 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8458 typically represent bit patterns, are not warned about.
8460 @item
8461 Usage of ISO string concatenation is detected.
8463 @item
8464 Initialization of automatic aggregates.
8466 @item
8467 Identifier conflicts with labels.  Traditional C lacks a separate
8468 namespace for labels.
8470 @item
8471 Initialization of unions.  If the initializer is zero, the warning is
8472 omitted.  This is done under the assumption that the zero initializer in
8473 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8474 initializer warnings and relies on default initialization to zero in the
8475 traditional C case.
8477 @item
8478 Conversions by prototypes between fixed/floating-point values and vice
8479 versa.  The absence of these prototypes when compiling with traditional
8480 C causes serious problems.  This is a subset of the possible
8481 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8483 @item
8484 Use of ISO C style function definitions.  This warning intentionally is
8485 @emph{not} issued for prototype declarations or variadic functions
8486 because these ISO C features appear in your code when using
8487 libiberty's traditional C compatibility macros, @code{PARAMS} and
8488 @code{VPARAMS}.  This warning is also bypassed for nested functions
8489 because that feature is already a GCC extension and thus not relevant to
8490 traditional C compatibility.
8491 @end itemize
8493 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8494 @opindex Wtraditional-conversion
8495 @opindex Wno-traditional-conversion
8496 Warn if a prototype causes a type conversion that is different from what
8497 would happen to the same argument in the absence of a prototype.  This
8498 includes conversions of fixed point to floating and vice versa, and
8499 conversions changing the width or signedness of a fixed-point argument
8500 except when the same as the default promotion.
8502 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8503 @opindex Wdeclaration-after-statement
8504 @opindex Wno-declaration-after-statement
8505 Warn when a declaration is found after a statement in a block.  This
8506 construct, known from C++, was introduced with ISO C99 and is by default
8507 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8509 @item -Wshadow
8510 @opindex Wshadow
8511 @opindex Wno-shadow
8512 Warn whenever a local variable or type declaration shadows another
8513 variable, parameter, type, class member (in C++), or instance variable
8514 (in Objective-C) or whenever a built-in function is shadowed.  Note
8515 that in C++, the compiler warns if a local variable shadows an
8516 explicit typedef, but not if it shadows a struct/class/enum.
8517 If this warning is enabled, it includes also all instances of
8518 local shadowing.  This means that @option{-Wno-shadow=local}
8519 and @option{-Wno-shadow=compatible-local} are ignored when
8520 @option{-Wshadow} is used.
8521 Same as @option{-Wshadow=global}.
8523 @item -Wno-shadow-ivar @r{(Objective-C only)}
8524 @opindex Wno-shadow-ivar
8525 @opindex Wshadow-ivar
8526 Do not warn whenever a local variable shadows an instance variable in an
8527 Objective-C method.
8529 @item -Wshadow=global
8530 @opindex Wshadow=global
8531 Warn for any shadowing.
8532 Same as @option{-Wshadow}.
8534 @item -Wshadow=local
8535 @opindex Wshadow=local
8536 Warn when a local variable shadows another local variable or parameter.
8538 @item -Wshadow=compatible-local
8539 @opindex Wshadow=compatible-local
8540 Warn when a local variable shadows another local variable or parameter
8541 whose type is compatible with that of the shadowing variable.  In C++,
8542 type compatibility here means the type of the shadowing variable can be
8543 converted to that of the shadowed variable.  The creation of this flag
8544 (in addition to @option{-Wshadow=local}) is based on the idea that when
8545 a local variable shadows another one of incompatible type, it is most
8546 likely intentional, not a bug or typo, as shown in the following example:
8548 @smallexample
8549 @group
8550 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8552   for (int i = 0; i < N; ++i)
8553   @{
8554     ...
8555   @}
8556   ...
8558 @end group
8559 @end smallexample
8561 Since the two variable @code{i} in the example above have incompatible types,
8562 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8563 Because their types are incompatible, if a programmer accidentally uses one
8564 in place of the other, type checking is expected to catch that and emit an
8565 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
8566 possibly reduce the number of warnings triggered by intentional shadowing.
8567 Note that this also means that shadowing @code{const char *i} by
8568 @code{char *i} does not emit a warning.
8570 This warning is also enabled by @option{-Wshadow=local}.
8572 @item -Wlarger-than=@var{byte-size}
8573 @opindex Wlarger-than=
8574 @opindex Wlarger-than-@var{byte-size}
8575 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8576 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8577 Warnings controlled by the option can be disabled either by specifying
8578 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8580 Also warn for calls to bounded functions such as @code{memchr} or
8581 @code{strnlen} that specify a bound greater than the largest possible
8582 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
8583 can only be disabled by @option{-Wno-larger-than}.
8585 @item -Wno-larger-than
8586 @opindex Wno-larger-than
8587 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
8588 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8590 @item -Wframe-larger-than=@var{byte-size}
8591 @opindex Wframe-larger-than=
8592 @opindex Wno-frame-larger-than
8593 Warn if the size of a function frame exceeds @var{byte-size}.
8594 The computation done to determine the stack frame size is approximate
8595 and not conservative.
8596 The actual requirements may be somewhat greater than @var{byte-size}
8597 even if you do not get a warning.  In addition, any space allocated
8598 via @code{alloca}, variable-length arrays, or related constructs
8599 is not included by the compiler when determining
8600 whether or not to issue a warning.
8601 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8602 Warnings controlled by the option can be disabled either by specifying
8603 @var{byte-size} of @samp{SIZE_MAX} or more or by
8604 @option{-Wno-frame-larger-than}.
8606 @item -Wno-frame-larger-than
8607 @opindex Wno-frame-larger-than
8608 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
8609 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8611 @item -Wfree-nonheap-object
8612 @opindex Wfree-nonheap-object
8613 @opindex Wno-free-nonheap-object
8614 Warn when attempting to deallocate an object that was either not allocated
8615 on the heap, or by using a pointer that was not returned from a prior call
8616 to the corresponding allocation function.  For example, because the call
8617 to @code{stpcpy} returns a pointer to the terminating nul character and
8618 not to the beginning of the object, the call to @code{free} below is
8619 diagnosed.
8621 @smallexample
8622 void f (char *p)
8624   p = stpcpy (p, "abc");
8625   // ...
8626   free (p);   // warning
8628 @end smallexample
8630 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8632 @item -Wstack-usage=@var{byte-size}
8633 @opindex Wstack-usage
8634 @opindex Wno-stack-usage
8635 Warn if the stack usage of a function might exceed @var{byte-size}.
8636 The computation done to determine the stack usage is conservative.
8637 Any space allocated via @code{alloca}, variable-length arrays, or related
8638 constructs is included by the compiler when determining whether or not to
8639 issue a warning.
8641 The message is in keeping with the output of @option{-fstack-usage}.
8643 @itemize
8644 @item
8645 If the stack usage is fully static but exceeds the specified amount, it's:
8647 @smallexample
8648   warning: stack usage is 1120 bytes
8649 @end smallexample
8650 @item
8651 If the stack usage is (partly) dynamic but bounded, it's:
8653 @smallexample
8654   warning: stack usage might be 1648 bytes
8655 @end smallexample
8656 @item
8657 If the stack usage is (partly) dynamic and not bounded, it's:
8659 @smallexample
8660   warning: stack usage might be unbounded
8661 @end smallexample
8662 @end itemize
8664 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8665 Warnings controlled by the option can be disabled either by specifying
8666 @var{byte-size} of @samp{SIZE_MAX} or more or by
8667 @option{-Wno-stack-usage}.
8669 @item -Wno-stack-usage
8670 @opindex Wno-stack-usage
8671 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
8672 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8674 @item -Wunsafe-loop-optimizations
8675 @opindex Wunsafe-loop-optimizations
8676 @opindex Wno-unsafe-loop-optimizations
8677 Warn if the loop cannot be optimized because the compiler cannot
8678 assume anything on the bounds of the loop indices.  With
8679 @option{-funsafe-loop-optimizations} warn if the compiler makes
8680 such assumptions.
8682 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8683 @opindex Wno-pedantic-ms-format
8684 @opindex Wpedantic-ms-format
8685 When used in combination with @option{-Wformat}
8686 and @option{-pedantic} without GNU extensions, this option
8687 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8688 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8689 which depend on the MS runtime.
8691 @item -Wpointer-arith
8692 @opindex Wpointer-arith
8693 @opindex Wno-pointer-arith
8694 Warn about anything that depends on the ``size of'' a function type or
8695 of @code{void}.  GNU C assigns these types a size of 1, for
8696 convenience in calculations with @code{void *} pointers and pointers
8697 to functions.  In C++, warn also when an arithmetic operation involves
8698 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
8700 @item -Wno-pointer-compare
8701 @opindex Wpointer-compare
8702 @opindex Wno-pointer-compare
8703 Do not warn if a pointer is compared with a zero character constant.
8704 This usually
8705 means that the pointer was meant to be dereferenced.  For example:
8707 @smallexample
8708 const char *p = foo ();
8709 if (p == '\0')
8710   return 42;
8711 @end smallexample
8713 Note that the code above is invalid in C++11.
8715 This warning is enabled by default.
8717 @item -Wtsan
8718 @opindex Wtsan
8719 @opindex Wno-tsan
8720 Warn about unsupported features in ThreadSanitizer.
8722 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8723 can report false positives.
8725 This warning is enabled by default.
8727 @item -Wtype-limits
8728 @opindex Wtype-limits
8729 @opindex Wno-type-limits
8730 Warn if a comparison is always true or always false due to the limited
8731 range of the data type, but do not warn for constant expressions.  For
8732 example, warn if an unsigned variable is compared against zero with
8733 @code{<} or @code{>=}.  This warning is also enabled by
8734 @option{-Wextra}.
8736 @item -Wabsolute-value @r{(C and Objective-C only)}
8737 @opindex Wabsolute-value
8738 @opindex Wno-absolute-value
8739 Warn for calls to standard functions that compute the absolute value
8740 of an argument when a more appropriate standard function is available.
8741 For example, calling @code{abs(3.14)} triggers the warning because the
8742 appropriate function to call to compute the absolute value of a double
8743 argument is @code{fabs}.  The option also triggers warnings when the
8744 argument in a call to such a function has an unsigned type.  This
8745 warning can be suppressed with an explicit type cast and it is also
8746 enabled by @option{-Wextra}.
8748 @include cppwarnopts.texi
8750 @item -Wbad-function-cast @r{(C and Objective-C only)}
8751 @opindex Wbad-function-cast
8752 @opindex Wno-bad-function-cast
8753 Warn when a function call is cast to a non-matching type.
8754 For example, warn if a call to a function returning an integer type 
8755 is cast to a pointer type.
8757 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8758 @opindex Wc90-c99-compat
8759 @opindex Wno-c90-c99-compat
8760 Warn about features not present in ISO C90, but present in ISO C99.
8761 For instance, warn about use of variable length arrays, @code{long long}
8762 type, @code{bool} type, compound literals, designated initializers, and so
8763 on.  This option is independent of the standards mode.  Warnings are disabled
8764 in the expression that follows @code{__extension__}.
8766 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8767 @opindex Wc99-c11-compat
8768 @opindex Wno-c99-c11-compat
8769 Warn about features not present in ISO C99, but present in ISO C11.
8770 For instance, warn about use of anonymous structures and unions,
8771 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8772 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8773 and so on.  This option is independent of the standards mode.  Warnings are
8774 disabled in the expression that follows @code{__extension__}.
8776 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8777 @opindex Wc11-c2x-compat
8778 @opindex Wno-c11-c2x-compat
8779 Warn about features not present in ISO C11, but present in ISO C2X.
8780 For instance, warn about omitting the string in @code{_Static_assert},
8781 use of @samp{[[]]} syntax for attributes, use of decimal
8782 floating-point types, and so on.  This option is independent of the
8783 standards mode.  Warnings are disabled in the expression that follows
8784 @code{__extension__}.
8786 @item -Wc++-compat @r{(C and Objective-C only)}
8787 @opindex Wc++-compat
8788 @opindex Wno-c++-compat
8789 Warn about ISO C constructs that are outside of the common subset of
8790 ISO C and ISO C++, e.g.@: request for implicit conversion from
8791 @code{void *} to a pointer to non-@code{void} type.
8793 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8794 @opindex Wc++11-compat
8795 @opindex Wno-c++11-compat
8796 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8797 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8798 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
8799 enabled by @option{-Wall}.
8801 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8802 @opindex Wc++14-compat
8803 @opindex Wno-c++14-compat
8804 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8805 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
8807 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8808 @opindex Wc++17-compat
8809 @opindex Wno-c++17-compat
8810 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8811 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
8813 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8814 @opindex Wc++20-compat
8815 @opindex Wno-c++20-compat
8816 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8817 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
8819 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8820 @opindex Wc++11-extensions
8821 @opindex Wno-c++11-extensions
8822 Do not warn about C++11 constructs in code being compiled using
8823 an older C++ standard.  Even without this option, some C++11 constructs
8824 will only be diagnosed if @option{-Wpedantic} is used.
8826 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8827 @opindex Wc++14-extensions
8828 @opindex Wno-c++14-extensions
8829 Do not warn about C++14 constructs in code being compiled using
8830 an older C++ standard.  Even without this option, some C++14 constructs
8831 will only be diagnosed if @option{-Wpedantic} is used.
8833 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8834 @opindex Wc++17-extensions
8835 @opindex Wno-c++17-extensions
8836 Do not warn about C++17 constructs in code being compiled using
8837 an older C++ standard.  Even without this option, some C++17 constructs
8838 will only be diagnosed if @option{-Wpedantic} is used.
8840 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8841 @opindex Wc++20-extensions
8842 @opindex Wno-c++20-extensions
8843 Do not warn about C++20 constructs in code being compiled using
8844 an older C++ standard.  Even without this option, some C++20 constructs
8845 will only be diagnosed if @option{-Wpedantic} is used.
8847 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8848 @opindex Wc++23-extensions
8849 @opindex Wno-c++23-extensions
8850 Do not warn about C++23 constructs in code being compiled using
8851 an older C++ standard.  Even without this option, some C++23 constructs
8852 will only be diagnosed if @option{-Wpedantic} is used.
8854 @item -Wcast-qual
8855 @opindex Wcast-qual
8856 @opindex Wno-cast-qual
8857 Warn whenever a pointer is cast so as to remove a type qualifier from
8858 the target type.  For example, warn if a @code{const char *} is cast
8859 to an ordinary @code{char *}.
8861 Also warn when making a cast that introduces a type qualifier in an
8862 unsafe way.  For example, casting @code{char **} to @code{const char **}
8863 is unsafe, as in this example:
8865 @smallexample
8866   /* p is char ** value.  */
8867   const char **q = (const char **) p;
8868   /* Assignment of readonly string to const char * is OK.  */
8869   *q = "string";
8870   /* Now char** pointer points to read-only memory.  */
8871   **p = 'b';
8872 @end smallexample
8874 @item -Wcast-align
8875 @opindex Wcast-align
8876 @opindex Wno-cast-align
8877 Warn whenever a pointer is cast such that the required alignment of the
8878 target is increased.  For example, warn if a @code{char *} is cast to
8879 an @code{int *} on machines where integers can only be accessed at
8880 two- or four-byte boundaries.
8882 @item -Wcast-align=strict
8883 @opindex Wcast-align=strict
8884 Warn whenever a pointer is cast such that the required alignment of the
8885 target is increased.  For example, warn if a @code{char *} is cast to
8886 an @code{int *} regardless of the target machine.
8888 @item -Wcast-function-type
8889 @opindex Wcast-function-type
8890 @opindex Wno-cast-function-type
8891 Warn when a function pointer is cast to an incompatible function pointer.
8892 In a cast involving function types with a variable argument list only
8893 the types of initial arguments that are provided are considered.
8894 Any parameter of pointer-type matches any other pointer-type.  Any benign
8895 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8896 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
8897 type @code{void (*) (void)} is special and matches everything, which can
8898 be used to suppress this warning.
8899 In a cast involving pointer to member types this warning warns whenever
8900 the type cast is changing the pointer to member type.
8901 This warning is enabled by @option{-Wextra}.
8903 @item -Wwrite-strings
8904 @opindex Wwrite-strings
8905 @opindex Wno-write-strings
8906 When compiling C, give string constants the type @code{const
8907 char[@var{length}]} so that copying the address of one into a
8908 non-@code{const} @code{char *} pointer produces a warning.  These
8909 warnings help you find at compile time code that can try to write
8910 into a string constant, but only if you have been very careful about
8911 using @code{const} in declarations and prototypes.  Otherwise, it is
8912 just a nuisance. This is why we did not make @option{-Wall} request
8913 these warnings.
8915 When compiling C++, warn about the deprecated conversion from string
8916 literals to @code{char *}.  This warning is enabled by default for C++
8917 programs.
8919 @item -Wclobbered
8920 @opindex Wclobbered
8921 @opindex Wno-clobbered
8922 Warn for variables that might be changed by @code{longjmp} or
8923 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
8925 @item -Wconversion
8926 @opindex Wconversion
8927 @opindex Wno-conversion
8928 Warn for implicit conversions that may alter a value. This includes
8929 conversions between real and integer, like @code{abs (x)} when
8930 @code{x} is @code{double}; conversions between signed and unsigned,
8931 like @code{unsigned ui = -1}; and conversions to smaller types, like
8932 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8933 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8934 changed by the conversion like in @code{abs (2.0)}.  Warnings about
8935 conversions between signed and unsigned integers can be disabled by
8936 using @option{-Wno-sign-conversion}.
8938 For C++, also warn for confusing overload resolution for user-defined
8939 conversions; and conversions that never use a type conversion
8940 operator: conversions to @code{void}, the same type, a base class or a
8941 reference to them. Warnings about conversions between signed and
8942 unsigned integers are disabled by default in C++ unless
8943 @option{-Wsign-conversion} is explicitly enabled.
8945 Warnings about conversion from arithmetic on a small type back to that
8946 type are only given with @option{-Warith-conversion}.
8948 @item -Wdangling-else
8949 @opindex Wdangling-else
8950 @opindex Wno-dangling-else
8951 Warn about constructions where there may be confusion to which
8952 @code{if} statement an @code{else} branch belongs.  Here is an example of
8953 such a case:
8955 @smallexample
8956 @group
8958   if (a)
8959     if (b)
8960       foo ();
8961   else
8962     bar ();
8964 @end group
8965 @end smallexample
8967 In C/C++, every @code{else} branch belongs to the innermost possible
8968 @code{if} statement, which in this example is @code{if (b)}.  This is
8969 often not what the programmer expected, as illustrated in the above
8970 example by indentation the programmer chose.  When there is the
8971 potential for this confusion, GCC issues a warning when this flag
8972 is specified.  To eliminate the warning, add explicit braces around
8973 the innermost @code{if} statement so there is no way the @code{else}
8974 can belong to the enclosing @code{if}.  The resulting code
8975 looks like this:
8977 @smallexample
8978 @group
8980   if (a)
8981     @{
8982       if (b)
8983         foo ();
8984       else
8985         bar ();
8986     @}
8988 @end group
8989 @end smallexample
8991 This warning is enabled by @option{-Wparentheses}.
8993 @item -Wdangling-pointer
8994 @itemx -Wdangling-pointer=@var{n}
8995 @opindex Wdangling-pointer
8996 @opindex Wno-dangling-pointer
8997 Warn about uses of pointers (or C++ references) to objects with automatic
8998 storage duration after their lifetime has ended.  This includes local
8999 variables declared in nested blocks, compound literals and other unnamed
9000 temporary objects.  In addition, warn about storing the address of such
9001 objects in escaped pointers.  The warning is enabled at all optimization
9002 levels but may yield different results with optimization than without.
9004 @table @gcctabopt
9005 @item -Wdangling-pointer=1
9006 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
9007 For example
9008 @smallexample
9009 int f (int c1, int c2, x)
9011   char *p = strchr ((char[])@{ c1, c2 @}, c3);
9012   return p ? *p : 'x';   // warning: dangling pointer to a compound literal
9014 @end smallexample
9015 In the following function the store of the address of the local variable
9016 @code{x} in the escaped pointer @code{*p} also triggers the warning.
9017 @smallexample
9018 void g (int **p)
9020   int x = 7;
9021   *p = &x;   // warning: storing the address of a local variable in *p
9023 @end smallexample
9025 @item -Wdangling-pointer=2
9026 At level 2, in addition to unconditional uses the warning also diagnoses
9027 conditional uses of dangling pointers.
9029 For example, because the array @var{a} in the following function is out of
9030 scope when the pointer @var{s} that was set to point is used, the warning
9031 triggers at this level.
9033 @smallexample
9034 void f (char *s)
9036   if (!s)
9037     @{
9038       char a[12] = "tmpname";
9039       s = a;
9040     @}
9041   strcat (s, ".tmp");   // warning: dangling pointer to a may be used
9042   ...
9044 @end smallexample
9045 @end table
9047 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9049 @item -Wdate-time
9050 @opindex Wdate-time
9051 @opindex Wno-date-time
9052 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9053 are encountered as they might prevent bit-wise-identical reproducible
9054 compilations.
9056 @item -Wempty-body
9057 @opindex Wempty-body
9058 @opindex Wno-empty-body
9059 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9060 while} statement.  This warning is also enabled by @option{-Wextra}.
9062 @item -Wno-endif-labels
9063 @opindex Wendif-labels
9064 @opindex Wno-endif-labels
9065 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9067 @item -Wenum-compare
9068 @opindex Wenum-compare
9069 @opindex Wno-enum-compare
9070 Warn about a comparison between values of different enumerated types.
9071 In C++ enumerated type mismatches in conditional expressions are also
9072 diagnosed and the warning is enabled by default.  In C this warning is 
9073 enabled by @option{-Wall}.
9075 @item -Wenum-conversion
9076 @opindex Wenum-conversion
9077 @opindex Wno-enum-conversion
9078 Warn when a value of enumerated type is implicitly converted to a 
9079 different enumerated type.  This warning is enabled by @option{-Wextra}
9080 in C@.
9082 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9083 @opindex Wenum-int-mismatch
9084 @opindex Wno-enum-int-mismatch
9085 Warn about mismatches between an enumerated type and an integer type in
9086 declarations.  For example:
9088 @smallexample
9089 enum E @{ l = -1, z = 0, g = 1 @};
9090 int foo(void);
9091 enum E foo(void);
9092 @end smallexample
9094 In C, an enumerated type is compatible with @code{char}, a signed
9095 integer type, or an unsigned integer type.  However, since the choice
9096 of the underlying type of an enumerated type is implementation-defined,
9097 such mismatches may cause portability issues.  In C++, such mismatches
9098 are an error.  In C, this warning is enabled by @option{-Wall} and
9099 @option{-Wc++-compat}.
9101 @item -Wjump-misses-init @r{(C, Objective-C only)}
9102 @opindex Wjump-misses-init
9103 @opindex Wno-jump-misses-init
9104 Warn if a @code{goto} statement or a @code{switch} statement jumps
9105 forward across the initialization of a variable, or jumps backward to a
9106 label after the variable has been initialized.  This only warns about
9107 variables that are initialized when they are declared.  This warning is
9108 only supported for C and Objective-C; in C++ this sort of branch is an
9109 error in any case.
9111 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9112 can be disabled with the @option{-Wno-jump-misses-init} option.
9114 @item -Wsign-compare
9115 @opindex Wsign-compare
9116 @opindex Wno-sign-compare
9117 @cindex warning for comparison of signed and unsigned values
9118 @cindex comparison of signed and unsigned values, warning
9119 @cindex signed and unsigned values, comparison warning
9120 Warn when a comparison between signed and unsigned values could produce
9121 an incorrect result when the signed value is converted to unsigned.
9122 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9123 also enabled by @option{-Wextra}.
9125 @item -Wsign-conversion
9126 @opindex Wsign-conversion
9127 @opindex Wno-sign-conversion
9128 Warn for implicit conversions that may change the sign of an integer
9129 value, like assigning a signed integer expression to an unsigned
9130 integer variable. An explicit cast silences the warning. In C, this
9131 option is enabled also by @option{-Wconversion}.
9133 @item -Wfloat-conversion
9134 @opindex Wfloat-conversion
9135 @opindex Wno-float-conversion
9136 Warn for implicit conversions that reduce the precision of a real value.
9137 This includes conversions from real to integer, and from higher precision
9138 real to lower precision real values.  This option is also enabled by
9139 @option{-Wconversion}.
9141 @item -Wno-scalar-storage-order
9142 @opindex Wno-scalar-storage-order
9143 @opindex Wscalar-storage-order
9144 Do not warn on suspicious constructs involving reverse scalar storage order.
9146 @item -Wsizeof-array-div
9147 @opindex Wsizeof-array-div
9148 @opindex Wno-sizeof-array-div
9149 Warn about divisions of two sizeof operators when the first one is applied
9150 to an array and the divisor does not equal the size of the array element.
9151 In such a case, the computation will not yield the number of elements in the
9152 array, which is likely what the user intended.  This warning warns e.g. about
9153 @smallexample
9154 int fn ()
9156   int arr[10];
9157   return sizeof (arr) / sizeof (short);
9159 @end smallexample
9161 This warning is enabled by @option{-Wall}.
9163 @item -Wsizeof-pointer-div
9164 @opindex Wsizeof-pointer-div
9165 @opindex Wno-sizeof-pointer-div
9166 Warn for suspicious divisions of two sizeof expressions that divide
9167 the pointer size by the element size, which is the usual way to compute
9168 the array size but won't work out correctly with pointers.  This warning
9169 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9170 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9172 @item -Wsizeof-pointer-memaccess
9173 @opindex Wsizeof-pointer-memaccess
9174 @opindex Wno-sizeof-pointer-memaccess
9175 Warn for suspicious length parameters to certain string and memory built-in
9176 functions if the argument uses @code{sizeof}.  This warning triggers for
9177 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9178 an array, but a pointer, and suggests a possible fix, or about
9179 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9180 also warns about calls to bounded string copy functions like @code{strncat}
9181 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9182 the source array.  For example, in the following function the call to
9183 @code{strncat} specifies the size of the source string as the bound.  That
9184 is almost certainly a mistake and so the call is diagnosed.
9185 @smallexample
9186 void make_file (const char *name)
9188   char path[PATH_MAX];
9189   strncpy (path, name, sizeof path - 1);
9190   strncat (path, ".text", sizeof ".text");
9191   @dots{}
9193 @end smallexample
9195 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9197 @item -Wno-sizeof-array-argument
9198 @opindex Wsizeof-array-argument
9199 @opindex Wno-sizeof-array-argument
9200 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9201 declared as an array in a function definition.  This warning is enabled by
9202 default for C and C++ programs.
9204 @item -Wmemset-elt-size
9205 @opindex Wmemset-elt-size
9206 @opindex Wno-memset-elt-size
9207 Warn for suspicious calls to the @code{memset} built-in function, if the
9208 first argument references an array, and the third argument is a number
9209 equal to the number of elements, but not equal to the size of the array
9210 in memory.  This indicates that the user has omitted a multiplication by
9211 the element size.  This warning is enabled by @option{-Wall}.
9213 @item -Wmemset-transposed-args
9214 @opindex Wmemset-transposed-args
9215 @opindex Wno-memset-transposed-args
9216 Warn for suspicious calls to the @code{memset} built-in function where
9217 the second argument is not zero and the third argument is zero.  For
9218 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9219 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9220 is only emitted if the third argument is a literal zero.  Otherwise, if
9221 it is an expression that is folded to zero, or a cast of zero to some
9222 type, it is far less likely that the arguments have been mistakenly
9223 transposed and no warning is emitted.  This warning is enabled
9224 by @option{-Wall}.
9226 @item -Waddress
9227 @opindex Waddress
9228 @opindex Wno-address
9229 Warn about suspicious uses of address expressions. These include comparing
9230 the address of a function or a declared object to the null pointer constant
9231 such as in
9232 @smallexample
9233 void f (void);
9234 void g (void)
9236   if (!f)   // warning: expression evaluates to false
9237     abort ();
9239 @end smallexample
9240 comparisons of a pointer to a string literal, such as in
9241 @smallexample
9242 void f (const char *x)
9244   if (x == "abc")   // warning: expression evaluates to false
9245     puts ("equal");
9247 @end smallexample
9248 and tests of the results of pointer addition or subtraction for equality
9249 to null, such as in
9250 @smallexample
9251 void f (const int *p, int i)
9253   return p + i == NULL;
9255 @end smallexample
9256 Such uses typically indicate a programmer error: the address of most
9257 functions and objects necessarily evaluates to true (the exception are
9258 weak symbols), so their use in a conditional might indicate missing
9259 parentheses in a function call or a missing dereference in an array
9260 expression.  The subset of the warning for object pointers can be
9261 suppressed by casting the pointer operand to an integer type such
9262 as @code{intptr_t} or @code{uintptr_t}.
9263 Comparisons against string literals result in unspecified behavior
9264 and are not portable, and suggest the intent was to call @code{strcmp}.
9265 The warning is suppressed if the suspicious expression is the result
9266 of macro expansion.
9267 @option{-Waddress} warning is enabled by @option{-Wall}.
9269 @item -Wno-address-of-packed-member
9270 @opindex Waddress-of-packed-member
9271 @opindex Wno-address-of-packed-member
9272 Do not warn when the address of packed member of struct or union is taken,
9273 which usually results in an unaligned pointer value.  This is
9274 enabled by default.
9276 @item -Wlogical-op
9277 @opindex Wlogical-op
9278 @opindex Wno-logical-op
9279 Warn about suspicious uses of logical operators in expressions.
9280 This includes using logical operators in contexts where a
9281 bit-wise operator is likely to be expected.  Also warns when
9282 the operands of a logical operator are the same:
9283 @smallexample
9284 extern int a;
9285 if (a < 0 && a < 0) @{ @dots{} @}
9286 @end smallexample
9288 @item -Wlogical-not-parentheses
9289 @opindex Wlogical-not-parentheses
9290 @opindex Wno-logical-not-parentheses
9291 Warn about logical not used on the left hand side operand of a comparison.
9292 This option does not warn if the right operand is considered to be a boolean
9293 expression.  Its purpose is to detect suspicious code like the following:
9294 @smallexample
9295 int a;
9296 @dots{}
9297 if (!a > 1) @{ @dots{} @}
9298 @end smallexample
9300 It is possible to suppress the warning by wrapping the LHS into
9301 parentheses:
9302 @smallexample
9303 if ((!a) > 1) @{ @dots{} @}
9304 @end smallexample
9306 This warning is enabled by @option{-Wall}.
9308 @item -Waggregate-return
9309 @opindex Waggregate-return
9310 @opindex Wno-aggregate-return
9311 Warn if any functions that return structures or unions are defined or
9312 called.  (In languages where you can return an array, this also elicits
9313 a warning.)
9315 @item -Wno-aggressive-loop-optimizations
9316 @opindex Wno-aggressive-loop-optimizations
9317 @opindex Waggressive-loop-optimizations
9318 Warn if in a loop with constant number of iterations the compiler detects
9319 undefined behavior in some statement during one or more of the iterations.
9321 @item -Wno-attributes
9322 @opindex Wno-attributes
9323 @opindex Wattributes
9324 Do not warn if an unexpected @code{__attribute__} is used, such as
9325 unrecognized attributes, function attributes applied to variables,
9326 etc.  This does not stop errors for incorrect use of supported
9327 attributes.
9329 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9330 warnings about unknown scoped attributes (in C++11 and C2X).  For example,
9331 @option{-Wno-attributes=vendor::attr} disables warning about the following
9332 declaration:
9334 @smallexample
9335 [[vendor::attr]] void f();
9336 @end smallexample
9338 It is also possible to disable warning about all attributes in a namespace
9339 using @option{-Wno-attributes=vendor::} which prevents warning about both
9340 of these declarations:
9342 @smallexample
9343 [[vendor::safe]] void f();
9344 [[vendor::unsafe]] void f2();
9345 @end smallexample
9347 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9349 @item -Wno-builtin-declaration-mismatch
9350 @opindex Wno-builtin-declaration-mismatch
9351 @opindex Wbuiltin-declaration-mismatch
9352 Warn if a built-in function is declared with an incompatible signature
9353 or as a non-function, or when a built-in function declared with a type
9354 that does not include a prototype is called with arguments whose promoted
9355 types do not match those expected by the function.  When @option{-Wextra}
9356 is specified, also warn when a built-in function that takes arguments is
9357 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9358 warning is enabled by default.  To avoid the warning include the appropriate
9359 header to bring the prototypes of built-in functions into scope.
9361 For example, the call to @code{memset} below is diagnosed by the warning
9362 because the function expects a value of type @code{size_t} as its argument
9363 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9364 the declaration of the function is diagnosed as well.
9365 @smallexample
9366 extern void* memset ();
9367 void f (void *d)
9369   memset (d, '\0', 32);
9371 @end smallexample
9373 @item -Wno-builtin-macro-redefined
9374 @opindex Wno-builtin-macro-redefined
9375 @opindex Wbuiltin-macro-redefined
9376 Do not warn if certain built-in macros are redefined.  This suppresses
9377 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9378 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9380 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9381 @opindex Wstrict-prototypes
9382 @opindex Wno-strict-prototypes
9383 Warn if a function is declared or defined without specifying the
9384 argument types.  (An old-style function definition is permitted without
9385 a warning if preceded by a declaration that specifies the argument
9386 types.)
9388 @item -Wold-style-declaration @r{(C and Objective-C only)}
9389 @opindex Wold-style-declaration
9390 @opindex Wno-old-style-declaration
9391 Warn for obsolescent usages, according to the C Standard, in a
9392 declaration. For example, warn if storage-class specifiers like
9393 @code{static} are not the first things in a declaration.  This warning
9394 is also enabled by @option{-Wextra}.
9396 @item -Wold-style-definition @r{(C and Objective-C only)}
9397 @opindex Wold-style-definition
9398 @opindex Wno-old-style-definition
9399 Warn if an old-style function definition is used.  A warning is given
9400 even if there is a previous prototype.  A definition using @samp{()}
9401 is not considered an old-style definition in C2X mode, because it is
9402 equivalent to @samp{(void)} in that case, but is considered an
9403 old-style definition for older standards.
9405 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9406 @opindex Wmissing-parameter-type
9407 @opindex Wno-missing-parameter-type
9408 A function parameter is declared without a type specifier in K&R-style
9409 functions:
9411 @smallexample
9412 void foo(bar) @{ @}
9413 @end smallexample
9415 This warning is also enabled by @option{-Wextra}.
9417 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9418 @opindex Wmissing-prototypes
9419 @opindex Wno-missing-prototypes
9420 Warn if a global function is defined without a previous prototype
9421 declaration.  This warning is issued even if the definition itself
9422 provides a prototype.  Use this option to detect global functions
9423 that do not have a matching prototype declaration in a header file.
9424 This option is not valid for C++ because all function declarations
9425 provide prototypes and a non-matching declaration declares an
9426 overload rather than conflict with an earlier declaration.
9427 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9429 @item -Wmissing-declarations
9430 @opindex Wmissing-declarations
9431 @opindex Wno-missing-declarations
9432 Warn if a global function is defined without a previous declaration.
9433 Do so even if the definition itself provides a prototype.
9434 Use this option to detect global functions that are not declared in
9435 header files.  In C, no warnings are issued for functions with previous
9436 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9437 missing prototypes.  In C++, no warnings are issued for function templates,
9438 or for inline functions, or for functions in anonymous namespaces.
9440 @item -Wmissing-field-initializers
9441 @opindex Wmissing-field-initializers
9442 @opindex Wno-missing-field-initializers
9443 @opindex W
9444 @opindex Wextra
9445 @opindex Wno-extra
9446 Warn if a structure's initializer has some fields missing.  For
9447 example, the following code causes such a warning, because
9448 @code{x.h} is implicitly zero:
9450 @smallexample
9451 struct s @{ int f, g, h; @};
9452 struct s x = @{ 3, 4 @};
9453 @end smallexample
9455 This option does not warn about designated initializers, so the following
9456 modification does not trigger a warning:
9458 @smallexample
9459 struct s @{ int f, g, h; @};
9460 struct s x = @{ .f = 3, .g = 4 @};
9461 @end smallexample
9463 In C this option does not warn about the universal zero initializer
9464 @samp{@{ 0 @}}:
9466 @smallexample
9467 struct s @{ int f, g, h; @};
9468 struct s x = @{ 0 @};
9469 @end smallexample
9471 Likewise, in C++ this option does not warn about the empty @{ @}
9472 initializer, for example:
9474 @smallexample
9475 struct s @{ int f, g, h; @};
9476 s x = @{ @};
9477 @end smallexample
9479 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
9480 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9482 @item -Wno-missing-requires
9483 @opindex Wmissing-requires
9484 @opindex Wno-missing-requires
9486 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9488 @smallexample
9489 bool satisfied = requires @{ C<T> @};
9490 @end smallexample
9492 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9493 expression, which it is for all T.  Presumably the user meant to write
9495 @smallexample
9496 bool satisfied = requires @{ requires C<T> @};
9497 @end smallexample
9499 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9500 type @samp{T}.
9502 This warning can be disabled with @option{-Wno-missing-requires}.
9504 @item -Wno-missing-template-keyword
9505 @opindex Wmissing-template-keyword
9506 @opindex Wno-missing-template-keyword
9508 The member access tokens ., -> and :: must be followed by the @code{template}
9509 keyword if the parent object is dependent and the member being named is a
9510 template.
9512 @smallexample
9513 template <class X>
9514 void DoStuff (X x)
9516   x.template DoSomeOtherStuff<X>(); // Good.
9517   x.DoMoreStuff<X>(); // Warning, x is dependent.
9519 @end smallexample
9521 In rare cases it is possible to get false positives. To silence this, wrap
9522 the expression in parentheses. For example, the following is treated as a
9523 template, even where m and N are integers:
9525 @smallexample
9526 void NotATemplate (my_class t)
9528   int N = 5;
9530   bool test = t.m < N > (0); // Treated as a template.
9531   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9533 @end smallexample
9535 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9537 @item -Wno-multichar
9538 @opindex Wno-multichar
9539 @opindex Wmultichar
9540 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9541 Usually they indicate a typo in the user's code, as they have
9542 implementation-defined values, and should not be used in portable code.
9544 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9545 @opindex Wnormalized=
9546 @opindex Wnormalized
9547 @opindex Wno-normalized
9548 @cindex NFC
9549 @cindex NFKC
9550 @cindex character set, input normalization
9551 In ISO C and ISO C++, two identifiers are different if they are
9552 different sequences of characters.  However, sometimes when characters
9553 outside the basic ASCII character set are used, you can have two
9554 different character sequences that look the same.  To avoid confusion,
9555 the ISO 10646 standard sets out some @dfn{normalization rules} which
9556 when applied ensure that two sequences that look the same are turned into
9557 the same sequence.  GCC can warn you if you are using identifiers that
9558 have not been normalized; this option controls that warning.
9560 There are four levels of warning supported by GCC@.  The default is
9561 @option{-Wnormalized=nfc}, which warns about any identifier that is
9562 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
9563 recommended form for most uses.  It is equivalent to
9564 @option{-Wnormalized}.
9566 Unfortunately, there are some characters allowed in identifiers by
9567 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
9568 identifiers.  That is, there's no way to use these symbols in portable
9569 ISO C or C++ and have all your identifiers in NFC@.
9570 @option{-Wnormalized=id} suppresses the warning for these characters.
9571 It is hoped that future versions of the standards involved will correct
9572 this, which is why this option is not the default.
9574 You can switch the warning off for all characters by writing
9575 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
9576 only do this if you are using some other normalization scheme (like
9577 ``D''), because otherwise you can easily create bugs that are
9578 literally impossible to see.
9580 Some characters in ISO 10646 have distinct meanings but look identical
9581 in some fonts or display methodologies, especially once formatting has
9582 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9583 LETTER N'', displays just like a regular @code{n} that has been
9584 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
9585 normalization scheme to convert all these into a standard form as
9586 well, and GCC warns if your code is not in NFKC if you use
9587 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
9588 about every identifier that contains the letter O because it might be
9589 confused with the digit 0, and so is not the default, but may be
9590 useful as a local coding convention if the programming environment 
9591 cannot be fixed to display these characters distinctly.
9593 @item -Wno-attribute-warning
9594 @opindex Wno-attribute-warning
9595 @opindex Wattribute-warning
9596 Do not warn about usage of functions (@pxref{Function Attributes})
9597 declared with @code{warning} attribute.  By default, this warning is
9598 enabled.  @option{-Wno-attribute-warning} can be used to disable the
9599 warning or @option{-Wno-error=attribute-warning} can be used to
9600 disable the error when compiled with @option{-Werror} flag.
9602 @item -Wno-deprecated
9603 @opindex Wno-deprecated
9604 @opindex Wdeprecated
9605 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
9607 @item -Wno-deprecated-declarations
9608 @opindex Wno-deprecated-declarations
9609 @opindex Wdeprecated-declarations
9610 Do not warn about uses of functions (@pxref{Function Attributes}),
9611 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9612 Attributes}) marked as deprecated by using the @code{deprecated}
9613 attribute.
9615 @item -Wno-overflow
9616 @opindex Wno-overflow
9617 @opindex Woverflow
9618 Do not warn about compile-time overflow in constant expressions.
9620 @item -Wno-odr
9621 @opindex Wno-odr
9622 @opindex Wodr
9623 Warn about One Definition Rule violations during link-time optimization.
9624 Enabled by default.
9626 @item -Wopenacc-parallelism
9627 @opindex Wopenacc-parallelism
9628 @opindex Wno-openacc-parallelism
9629 @cindex OpenACC accelerator programming
9630 Warn about potentially suboptimal choices related to OpenACC parallelism.
9632 @item -Wopenmp-simd
9633 @opindex Wopenmp-simd
9634 @opindex Wno-openmp-simd
9635 Warn if the vectorizer cost model overrides the OpenMP
9636 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
9637 option can be used to relax the cost model.
9639 @item -Woverride-init @r{(C and Objective-C only)}
9640 @opindex Woverride-init
9641 @opindex Wno-override-init
9642 @opindex W
9643 @opindex Wextra
9644 @opindex Wno-extra
9645 Warn if an initialized field without side effects is overridden when
9646 using designated initializers (@pxref{Designated Inits, , Designated
9647 Initializers}).
9649 This warning is included in @option{-Wextra}.  To get other
9650 @option{-Wextra} warnings without this one, use @option{-Wextra
9651 -Wno-override-init}.
9653 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9654 @opindex Woverride-init-side-effects
9655 @opindex Wno-override-init-side-effects
9656 Do not warn if an initialized field with side effects is overridden when
9657 using designated initializers (@pxref{Designated Inits, , Designated
9658 Initializers}).  This warning is enabled by default.
9660 @item -Wpacked
9661 @opindex Wpacked
9662 @opindex Wno-packed
9663 Warn if a structure is given the packed attribute, but the packed
9664 attribute has no effect on the layout or size of the structure.
9665 Such structures may be mis-aligned for little benefit.  For
9666 instance, in this code, the variable @code{f.x} in @code{struct bar}
9667 is misaligned even though @code{struct bar} does not itself
9668 have the packed attribute:
9670 @smallexample
9671 @group
9672 struct foo @{
9673   int x;
9674   char a, b, c, d;
9675 @} __attribute__((packed));
9676 struct bar @{
9677   char z;
9678   struct foo f;
9680 @end group
9681 @end smallexample
9683 @item -Wnopacked-bitfield-compat
9684 @opindex Wpacked-bitfield-compat
9685 @opindex Wno-packed-bitfield-compat
9686 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9687 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
9688 the change can lead to differences in the structure layout.  GCC
9689 informs you when the offset of such a field has changed in GCC 4.4.
9690 For example there is no longer a 4-bit padding between field @code{a}
9691 and @code{b} in this structure:
9693 @smallexample
9694 struct foo
9696   char a:4;
9697   char b:8;
9698 @} __attribute__ ((packed));
9699 @end smallexample
9701 This warning is enabled by default.  Use
9702 @option{-Wno-packed-bitfield-compat} to disable this warning.
9704 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9705 @opindex Wpacked-not-aligned
9706 @opindex Wno-packed-not-aligned
9707 Warn if a structure field with explicitly specified alignment in a
9708 packed struct or union is misaligned.  For example, a warning will
9709 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9710 'struct S' is less than 8}, in this code:
9712 @smallexample
9713 @group
9714 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9715 struct __attribute__ ((packed)) S @{
9716   struct S8 s8;
9718 @end group
9719 @end smallexample
9721 This warning is enabled by @option{-Wall}.
9723 @item -Wpadded
9724 @opindex Wpadded
9725 @opindex Wno-padded
9726 Warn if padding is included in a structure, either to align an element
9727 of the structure or to align the whole structure.  Sometimes when this
9728 happens it is possible to rearrange the fields of the structure to
9729 reduce the padding and so make the structure smaller.
9731 @item -Wredundant-decls
9732 @opindex Wredundant-decls
9733 @opindex Wno-redundant-decls
9734 Warn if anything is declared more than once in the same scope, even in
9735 cases where multiple declaration is valid and changes nothing.
9737 @item -Wrestrict
9738 @opindex Wrestrict
9739 @opindex Wno-restrict
9740 Warn when an object referenced by a @code{restrict}-qualified parameter
9741 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9742 argument, or when copies between such objects overlap.  For example,
9743 the call to the @code{strcpy} function below attempts to truncate the string
9744 by replacing its initial characters with the last four.  However, because
9745 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9746 the call is diagnosed.
9748 @smallexample
9749 void foo (void)
9751   char a[] = "abcd1234";
9752   strcpy (a, a + 4);
9753   @dots{}
9755 @end smallexample
9756 The @option{-Wrestrict} option detects some instances of simple overlap
9757 even without optimization but works best at @option{-O2} and above.  It
9758 is included in @option{-Wall}.
9760 @item -Wnested-externs @r{(C and Objective-C only)}
9761 @opindex Wnested-externs
9762 @opindex Wno-nested-externs
9763 Warn if an @code{extern} declaration is encountered within a function.
9765 @item -Winline
9766 @opindex Winline
9767 @opindex Wno-inline
9768 Warn if a function that is declared as inline cannot be inlined.
9769 Even with this option, the compiler does not warn about failures to
9770 inline functions declared in system headers.
9772 The compiler uses a variety of heuristics to determine whether or not
9773 to inline a function.  For example, the compiler takes into account
9774 the size of the function being inlined and the amount of inlining
9775 that has already been done in the current function.  Therefore,
9776 seemingly insignificant changes in the source program can cause the
9777 warnings produced by @option{-Winline} to appear or disappear.
9779 @item -Winterference-size
9780 @opindex Winterference-size
9781 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9782 without specifying its value with @option{--param destructive-interference-size}.
9783 Also warn about questionable values for that option.
9785 This variable is intended to be used for controlling class layout, to
9786 avoid false sharing in concurrent code:
9788 @smallexample
9789 struct independent_fields @{
9790   alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
9791   alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
9793 @end smallexample
9795 Here @samp{one} and @samp{two} are intended to be far enough apart
9796 that stores to one won't require accesses to the other to reload the
9797 cache line.
9799 By default, @option{--param destructive-interference-size} and
9800 @option{--param constructive-interference-size} are set based on the
9801 current @option{-mtune} option, typically to the L1 cache line size
9802 for the particular target CPU, sometimes to a range if tuning for a
9803 generic target.  So all translation units that depend on ABI
9804 compatibility for the use of these variables must be compiled with
9805 the same @option{-mtune} (or @option{-mcpu}).
9807 If ABI stability is important, such as if the use is in a header for a
9808 library, you should probably not use the hardware interference size
9809 variables at all.  Alternatively, you can force a particular value
9810 with @option{--param}.
9812 If you are confident that your use of the variable does not affect ABI
9813 outside a single build of your project, you can turn off the warning
9814 with @option{-Wno-interference-size}.
9816 @item -Wint-in-bool-context
9817 @opindex Wint-in-bool-context
9818 @opindex Wno-int-in-bool-context
9819 Warn for suspicious use of integer values where boolean values are expected,
9820 such as conditional expressions (?:) using non-boolean integer constants in
9821 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
9822 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
9823 for all kinds of multiplications regardless of the data type.
9824 This warning is enabled by @option{-Wall}.
9826 @item -Wno-int-to-pointer-cast
9827 @opindex Wno-int-to-pointer-cast
9828 @opindex Wint-to-pointer-cast
9829 Suppress warnings from casts to pointer type of an integer of a
9830 different size. In C++, casting to a pointer type of smaller size is
9831 an error. @option{Wint-to-pointer-cast} is enabled by default.
9834 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9835 @opindex Wno-pointer-to-int-cast
9836 @opindex Wpointer-to-int-cast
9837 Suppress warnings from casts from a pointer to an integer type of a
9838 different size.
9840 @item -Winvalid-pch
9841 @opindex Winvalid-pch
9842 @opindex Wno-invalid-pch
9843 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9844 the search path but cannot be used.
9846 @item -Winvalid-utf8
9847 @opindex Winvalid-utf8
9848 @opindex Wno-invalid-utf8
9849 Warn if an invalid UTF-8 character is found.
9850 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
9851 is used and turned into error with @option{-pedantic-errors}.
9853 @item -Wno-unicode
9854 @opindex Wunicode
9855 @opindex Wno-unicode
9856 Don't diagnose invalid forms of delimited or named escape sequences which are
9857 treated as separate tokens.  @option{Wunicode} is enabled by default.
9859 @item -Wlong-long
9860 @opindex Wlong-long
9861 @opindex Wno-long-long
9862 Warn if @code{long long} type is used.  This is enabled by either
9863 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9864 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
9866 @item -Wvariadic-macros
9867 @opindex Wvariadic-macros
9868 @opindex Wno-variadic-macros
9869 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9870 alternate syntax is used in ISO C99 mode.  This is enabled by either
9871 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
9872 messages, use @option{-Wno-variadic-macros}.
9874 @item -Wno-varargs
9875 @opindex Wvarargs
9876 @opindex Wno-varargs
9877 Do not warn upon questionable usage of the macros used to handle variable
9878 arguments like @code{va_start}.  These warnings are enabled by default.
9880 @item -Wvector-operation-performance
9881 @opindex Wvector-operation-performance
9882 @opindex Wno-vector-operation-performance
9883 Warn if vector operation is not implemented via SIMD capabilities of the
9884 architecture.  Mainly useful for the performance tuning.
9885 Vector operation can be implemented @code{piecewise}, which means that the
9886 scalar operation is performed on every vector element; 
9887 @code{in parallel}, which means that the vector operation is implemented
9888 using scalars of wider type, which normally is more performance efficient;
9889 and @code{as a single scalar}, which means that vector fits into a
9890 scalar type.
9892 @item -Wvla
9893 @opindex Wvla
9894 @opindex Wno-vla
9895 Warn if a variable-length array is used in the code.
9896 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9897 the variable-length array.
9899 @item -Wvla-larger-than=@var{byte-size}
9900 @opindex Wvla-larger-than=
9901 @opindex Wno-vla-larger-than
9902 If this option is used, the compiler warns for declarations of
9903 variable-length arrays whose size is either unbounded, or bounded
9904 by an argument that allows the array size to exceed @var{byte-size}
9905 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9906 works, but with variable-length arrays.
9908 Note that GCC may optimize small variable-length arrays of a known
9909 value into plain arrays, so this warning may not get triggered for
9910 such arrays.
9912 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9913 is typically only effective when @option{-ftree-vrp} is active (default
9914 for @option{-O2} and above).
9916 See also @option{-Walloca-larger-than=@var{byte-size}}.
9918 @item -Wno-vla-larger-than
9919 @opindex Wno-vla-larger-than
9920 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
9921 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9923 @item -Wvla-parameter
9924 @opindex Wno-vla-parameter
9925 Warn about redeclarations of functions involving arguments of Variable
9926 Length Array types of inconsistent kinds or forms, and enable the detection
9927 of out-of-bounds accesses to such parameters by warnings such as
9928 @option{-Warray-bounds}.
9930 If the first function declaration uses the VLA form the bound specified
9931 in the array is assumed to be the minimum number of elements expected to
9932 be provided in calls to the function and the maximum number of elements
9933 accessed by it.  Failing to provide arguments of sufficient size or
9934 accessing more than the maximum number of elements may be diagnosed.
9936 For example, the warning triggers for the following redeclarations because
9937 the first one allows an array of any size to be passed to @code{f} while
9938 the second one specifies that the array argument must have at least @code{n}
9939 elements.  In addition, calling @code{f} with the associated VLA bound
9940 parameter in excess of the actual VLA bound triggers a warning as well.
9942 @smallexample
9943 void f (int n, int[n]);
9944 void f (int, int[]);     // warning: argument 2 previously declared as a VLA
9946 void g (int n)
9948     if (n > 4)
9949       return;
9950     int a[n];
9951     f (sizeof a, a);     // warning: access to a by f may be out of bounds
9952   @dots{}
9955 @end smallexample
9957 @option{-Wvla-parameter} is included in @option{-Wall}.  The
9958 @option{-Warray-parameter} option triggers warnings for similar problems
9959 involving ordinary array arguments.
9961 @item -Wvolatile-register-var
9962 @opindex Wvolatile-register-var
9963 @opindex Wno-volatile-register-var
9964 Warn if a register variable is declared volatile.  The volatile
9965 modifier does not inhibit all optimizations that may eliminate reads
9966 and/or writes to register variables.  This warning is enabled by
9967 @option{-Wall}.
9969 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
9970 @opindex Wxor-used-as-pow
9971 @opindex Wno-xor-used-as-pow
9972 Warn about uses of @code{^}, the exclusive or operator, where it appears
9973 the user meant exponentiation.  Specifically, the warning occurs when the
9974 left-hand side is the decimal constant 2 or 10 and the right-hand side
9975 is also a decimal constant.
9977 In C and C++, @code{^} means exclusive or, whereas in some other languages
9978 (e.g. TeX and some versions of BASIC) it means exponentiation.
9980 This warning is enabled by default.  It can be silenced by converting one
9981 of the operands to hexadecimal.
9983 @item -Wdisabled-optimization
9984 @opindex Wdisabled-optimization
9985 @opindex Wno-disabled-optimization
9986 Warn if a requested optimization pass is disabled.  This warning does
9987 not generally indicate that there is anything wrong with your code; it
9988 merely indicates that GCC's optimizers are unable to handle the code
9989 effectively.  Often, the problem is that your code is too big or too
9990 complex; GCC refuses to optimize programs when the optimization
9991 itself is likely to take inordinate amounts of time.
9993 @item -Wpointer-sign @r{(C and Objective-C only)}
9994 @opindex Wpointer-sign
9995 @opindex Wno-pointer-sign
9996 Warn for pointer argument passing or assignment with different signedness.
9997 This option is only supported for C and Objective-C@.  It is implied by
9998 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9999 @option{-Wno-pointer-sign}.
10001 @item -Wstack-protector
10002 @opindex Wstack-protector
10003 @opindex Wno-stack-protector
10004 This option is only active when @option{-fstack-protector} is active.  It
10005 warns about functions that are not protected against stack smashing.
10007 @item -Woverlength-strings
10008 @opindex Woverlength-strings
10009 @opindex Wno-overlength-strings
10010 Warn about string constants that are longer than the ``minimum
10011 maximum'' length specified in the C standard.  Modern compilers
10012 generally allow string constants that are much longer than the
10013 standard's minimum limit, but very portable programs should avoid
10014 using longer strings.
10016 The limit applies @emph{after} string constant concatenation, and does
10017 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10018 C99, it was raised to 4095.  C++98 does not specify a normative
10019 minimum maximum, so we do not diagnose overlength strings in C++@.
10021 This option is implied by @option{-Wpedantic}, and can be disabled with
10022 @option{-Wno-overlength-strings}.
10024 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10025 @opindex Wunsuffixed-float-constants
10026 @opindex Wno-unsuffixed-float-constants
10028 Issue a warning for any floating constant that does not have
10029 a suffix.  When used together with @option{-Wsystem-headers} it
10030 warns about such constants in system header files.  This can be useful
10031 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10032 from the decimal floating-point extension to C99.
10034 @item -Wno-lto-type-mismatch
10035 @opindex Wlto-type-mismatch
10036 @opindex Wno-lto-type-mismatch
10038 During the link-time optimization, do not warn about type mismatches in
10039 global declarations from different compilation units.
10040 Requires @option{-flto} to be enabled.  Enabled by default.
10042 @item -Wno-designated-init @r{(C and Objective-C only)}
10043 @opindex Wdesignated-init
10044 @opindex Wno-designated-init
10045 Suppress warnings when a positional initializer is used to initialize
10046 a structure that has been marked with the @code{designated_init}
10047 attribute.
10049 @end table
10051 @node Static Analyzer Options
10052 @section Options That Control Static Analysis
10054 @table @gcctabopt
10055 @item -fanalyzer
10056 @opindex analyzer
10057 @opindex fanalyzer
10058 @opindex fno-analyzer
10059 This option enables an static analysis of program flow which looks
10060 for ``interesting'' interprocedural paths through the
10061 code, and issues warnings for problems found on them.
10063 This analysis is much more expensive than other GCC warnings.
10065 Enabling this option effectively enables the following warnings:
10067 @gccoptlist{ @gol
10068 -Wanalyzer-allocation-size @gol
10069 -Wanalyzer-deref-before-check @gol
10070 -Wanalyzer-double-fclose @gol
10071 -Wanalyzer-double-free @gol
10072 -Wanalyzer-exposure-through-output-file @gol
10073 -Wanalyzer-exposure-through-uninit-copy @gol
10074 -Wanalyzer-fd-access-mode-mismatch @gol
10075 -Wanalyzer-fd-double-close @gol
10076 -Wanalyzer-fd-leak @gol
10077 -Wanalyzer-fd-phase-mismatch @gol
10078 -Wanalyzer-fd-type-mismatch @gol
10079 -Wanalyzer-fd-use-after-close @gol
10080 -Wanalyzer-fd-use-without-check @gol
10081 -Wanalyzer-file-leak @gol
10082 -Wanalyzer-free-of-non-heap @gol
10083 -Wanalyzer-imprecise-fp-arithmetic @gol
10084 -Wanalyzer-infinite-recursion @gol
10085 -Wanalyzer-jump-through-null @gol
10086 -Wanalyzer-malloc-leak @gol
10087 -Wanalyzer-mismatching-deallocation @gol
10088 -Wanalyzer-null-argument @gol
10089 -Wanalyzer-null-dereference @gol
10090 -Wanalyzer-out-of-bounds @gol
10091 -Wanalyzer-possible-null-argument @gol
10092 -Wanalyzer-possible-null-dereference @gol
10093 -Wanalyzer-putenv-of-auto-var @gol
10094 -Wanalyzer-shift-count-negative @gol
10095 -Wanalyzer-shift-count-overflow @gol
10096 -Wanalyzer-stale-setjmp-buffer @gol
10097 -Wanalyzer-unsafe-call-within-signal-handler @gol
10098 -Wanalyzer-use-after-free @gol
10099 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
10100 -Wanalyzer-use-of-uninitialized-value @gol
10101 -Wanalyzer-va-arg-type-mismatch @gol
10102 -Wanalyzer-va-list-exhausted @gol
10103 -Wanalyzer-va-list-leak @gol
10104 -Wanalyzer-va-list-use-after-va-end @gol
10105 -Wanalyzer-write-to-const @gol
10106 -Wanalyzer-write-to-string-literal @gol
10108 @ignore
10109 -Wanalyzer-tainted-allocation-size @gol
10110 -Wanalyzer-tainted-array-index @gol
10111 -Wanalyzer-tainted-divisor @gol
10112 -Wanalyzer-tainted-offset @gol
10113 -Wanalyzer-tainted-size @gol
10114 @end ignore
10116 This option is only available if GCC was configured with analyzer
10117 support enabled.
10119 @item -Wanalyzer-too-complex
10120 @opindex Wanalyzer-too-complex
10121 @opindex Wno-analyzer-too-complex
10122 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10123 to attempt to explore the control flow and data flow in the program,
10124 but these can be defeated by sufficiently complicated code.
10126 By default, the analysis silently stops if the code is too
10127 complicated for the analyzer to fully explore and it reaches an internal
10128 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10130 @item -Wno-analyzer-allocation-size
10131 @opindex Wanalyzer-allocation-size
10132 @opindex Wno-analyzer-allocation-size
10133 This warning requires @option{-fanalyzer}, which enables it; use
10134 @option{-Wno-analyzer-allocation-size}
10135 to disable it.
10137 This diagnostic warns for paths through the code in which a pointer to
10138 a buffer is assigned to point at a buffer with a size that is not a
10139 multiple of @code{sizeof (*pointer)}.
10141 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10143 @item -Wno-analyzer-deref-before-check
10144 @opindex Wanalyzer-deref-before-check
10145 @opindex Wno-analyzer-deref-before-check
10146 This warning requires @option{-fanalyzer}, which enables it; use
10147 @option{-Wno-analyzer-deref-before-check}
10148 to disable it.
10150 This diagnostic warns for paths through the code in which a pointer
10151 is checked for @code{NULL} *after* it has already been
10152 dereferenced, suggesting that the pointer could have been NULL.
10153 Such cases suggest that the check for NULL is either redundant,
10154 or that it needs to be moved to before the pointer is dereferenced.
10156 This diagnostic also considers values passed to a function argument
10157 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10158 value, and thus will complain if such values are checked for @code{NULL}
10159 after returning from such a function call.
10161 This diagnostic is unlikely to be reported when any level of optimization
10162 is enabled, as GCC's optimization logic will typically consider such
10163 checks for NULL as being redundant, and optimize them away before the
10164 analyzer "sees" them.  Hence optimization should be disabled when
10165 attempting to trigger this diagnostic.
10167 @item -Wno-analyzer-double-fclose
10168 @opindex Wanalyzer-double-fclose
10169 @opindex Wno-analyzer-double-fclose
10170 This warning requires @option{-fanalyzer}, which enables it; use
10171 @option{-Wno-analyzer-double-fclose} to disable it.
10173 This diagnostic warns for paths through the code in which a @code{FILE *}
10174 can have @code{fclose} called on it more than once.
10176 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10178 @item -Wno-analyzer-double-free
10179 @opindex Wanalyzer-double-free
10180 @opindex Wno-analyzer-double-free
10181 This warning requires @option{-fanalyzer}, which enables it; use
10182 @option{-Wno-analyzer-double-free} to disable it.
10184 This diagnostic warns for paths through the code in which a pointer
10185 can have a deallocator called on it more than once, either @code{free},
10186 or a deallocator referenced by attribute @code{malloc}.
10188 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10190 @item -Wno-analyzer-exposure-through-output-file
10191 @opindex Wanalyzer-exposure-through-output-file
10192 @opindex Wno-analyzer-exposure-through-output-file
10193 This warning requires @option{-fanalyzer}, which enables it; use
10194 @option{-Wno-analyzer-exposure-through-output-file}
10195 to disable it.
10197 This diagnostic warns for paths through the code in which a
10198 security-sensitive value is written to an output file
10199 (such as writing a password to a log file).
10201 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10203 @item -Wanalyzer-exposure-through-uninit-copy
10204 @opindex Wanalyzer-exposure-through-uninit-copy
10205 @opindex Wno-analyzer-exposure-through-uninit-copy
10206 This warning requires both @option{-fanalyzer} and the use of a plugin
10207 to specify a function that copies across a ``trust boundary''.  Use
10208 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10210 This diagnostic warns for ``infoleaks'' - paths through the code in which
10211 uninitialized values are copied across a security boundary
10212 (such as code within an OS kernel that copies a partially-initialized
10213 struct on the stack to user space).
10215 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10217 @item -Wno-analyzer-fd-access-mode-mismatch
10218 @opindex Wanalyzer-fd-access-mode-mismatch
10219 @opindex Wno-analyzer-fd-access-mode-mismatch
10220 This warning requires @option{-fanalyzer}, which enables it; use
10221 @option{-Wno-analyzer-fd-access-mode-mismatch}
10222 to disable it.
10224 This diagnostic warns for paths through code in which a
10225 @code{read} on a write-only file descriptor is attempted, or vice versa.
10227 This diagnostic also warns for code paths in a which a function with attribute
10228 @code{fd_arg_read (N)} is called with a file descriptor opened with
10229 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10230 @code{fd_arg_write (N)} is called with a file descriptor opened with
10231 @code{O_RDONLY} at referenced argument @var{N}.
10233 @item -Wno-analyzer-fd-double-close
10234 @opindex Wanalyzer-fd-double-close
10235 @opindex Wno-analyzer-fd-double-close
10236 This warning requires @option{-fanalyzer}, which enables it; use
10237 @option{-Wno-analyzer-fd-double-close}
10238 to disable it.
10240 This diagnostic warns for paths through code in which a
10241 file descriptor can be closed more than once.
10243 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10245 @item -Wno-analyzer-fd-leak
10246 @opindex Wanalyzer-fd-leak
10247 @opindex Wno-analyzer-fd-leak
10248 This warning requires @option{-fanalyzer}, which enables it; use
10249 @option{-Wno-analyzer-fd-leak}
10250 to disable it.
10252 This diagnostic warns for paths through code in which an
10253 open file descriptor is leaked.
10255 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10257 @item -Wno-analyzer-fd-phase-mismatch
10258 @opindex Wanalyzer-fd-phase-mismatch
10259 @opindex Wno-analyzer-fd-phase-mismatch
10260 This warning requires @option{-fanalyzer}, which enables it; use
10261 @option{-Wno-analyzer-fd-phase-mismatch}
10262 to disable it.
10264 This diagnostic warns for paths through code in which an operation is
10265 attempted in the wrong phase of a file descriptor's lifetime.
10266 For example, it will warn on attempts to call @code{accept} on a stream
10267 socket that has not yet had @code{listen} successfully called on it.
10269 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10271 @item -Wno-analyzer-fd-type-mismatch
10272 @opindex Wanalyzer-fd-type-mismatch
10273 @opindex Wno-analyzer-fd-type-mismatch
10274 This warning requires @option{-fanalyzer}, which enables it; use
10275 @option{-Wno-analyzer-fd-type-mismatch}
10276 to disable it.
10278 This diagnostic warns for paths through code in which an
10279 operation is attempted on the wrong type of file descriptor.
10280 For example, it will warn on attempts to use socket operations
10281 on a file descriptor obtained via @code{open}, or when attempting
10282 to use a stream socket operation on a datagram socket.
10284 @item -Wno-analyzer-fd-use-after-close
10285 @opindex Wanalyzer-fd-use-after-close
10286 @opindex Wno-analyzer-fd-use-after-close
10287 This warning requires @option{-fanalyzer}, which enables it; use
10288 @option{-Wno-analyzer-fd-use-after-close}
10289 to disable it.
10291 This diagnostic warns for paths through code in which a
10292 read or write is called on a closed file descriptor.
10294 This diagnostic also warns for paths through code in which
10295 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10296 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10297 referenced argument @code{N}.
10299 @item -Wno-analyzer-fd-use-without-check
10300 @opindex Wanalyzer-fd-use-without-check
10301 @opindex Wno-analyzer-fd-use-without-check
10302 This warning requires @option{-fanalyzer}, which enables it; use
10303 @option{-Wno-analyzer-fd-use-without-check}
10304 to disable it.
10306 This diagnostic warns for paths through code in which a
10307 file descriptor is used without being checked for validity.
10309 This diagnostic also warns for paths through code in which
10310 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10311 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10312 argument @code{N}, without being checked for validity.
10314 @item -Wno-analyzer-file-leak
10315 @opindex Wanalyzer-file-leak
10316 @opindex Wno-analyzer-file-leak
10317 This warning requires @option{-fanalyzer}, which enables it; use
10318 @option{-Wno-analyzer-file-leak}
10319 to disable it.
10321 This diagnostic warns for paths through the code in which a
10322 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10324 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10326 @item -Wno-analyzer-free-of-non-heap
10327 @opindex Wanalyzer-free-of-non-heap
10328 @opindex Wno-analyzer-free-of-non-heap
10329 This warning requires @option{-fanalyzer}, which enables it; use
10330 @option{-Wno-analyzer-free-of-non-heap}
10331 to disable it.
10333 This diagnostic warns for paths through the code in which @code{free}
10334 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10336 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10338 @item -Wno-analyzer-imprecise-fp-arithmetic
10339 @opindex Wanalyzer-imprecise-fp-arithmetic
10340 @opindex Wno-analyzer-imprecise-fp-arithmetic
10341 This warning requires @option{-fanalyzer}, which enables it; use
10342 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10343 to disable it.
10345 This diagnostic warns for paths through the code in which floating-point
10346 arithmetic is used in locations where precise computation is needed.  This
10347 diagnostic only warns on use of floating-point operands inside the
10348 calculation of an allocation size at the moment.
10350 @item -Wno-analyzer-infinite-recursion
10351 @opindex Wanalyzer-infinite-recursion
10352 @opindex Wno-analyzer-infinite-recursion
10353 This warning requires @option{-fanalyzer}, which enables it; use
10354 @option{-Wno-analyzer-infinite-recursion} to disable it.
10356 This diagnostics warns for paths through the code which appear to
10357 lead to infinite recursion.
10359 Specifically, when the analyzer "sees" a recursive call, it will compare
10360 the state of memory at the entry to the new frame with that at the entry
10361 to the previous frame of that function on the stack.  The warning is
10362 issued if nothing in memory appears to be changing; any changes observed
10363 to parameters or globals are assumed to lead to termination of the
10364 recursion and thus suppress the warning.
10366 This diagnostic is likely to miss cases of infinite recursion that
10367 are convered to iteration by the optimizer before the analyzer "sees"
10368 them.  Hence optimization should be disabled when attempting to trigger
10369 this diagnostic.
10371 Compare with @option{-Winfinite-recursion}, which provides a similar
10372 diagnostic, but is implemented in a different way.
10374 @item -Wno-analyzer-jump-through-null
10375 @opindex Wanalyzer-jump-through-null
10376 @opindex Wno-analyzer-jump-through-null
10377 This warning requires @option{-fanalyzer}, which enables it; use
10378 @option{-Wno-analyzer-jump-through-null}
10379 to disable it.
10381 This diagnostic warns for paths through the code in which a @code{NULL}
10382 function pointer is called.
10384 @item -Wno-analyzer-malloc-leak
10385 @opindex Wanalyzer-malloc-leak
10386 @opindex Wno-analyzer-malloc-leak
10387 This warning requires @option{-fanalyzer}, which enables it; use
10388 @option{-Wno-analyzer-malloc-leak}
10389 to disable it.
10391 This diagnostic warns for paths through the code in which a
10392 pointer allocated via an allocator is leaked: either @code{malloc},
10393 or a function marked with attribute @code{malloc}.
10395 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10397 @item -Wno-analyzer-mismatching-deallocation
10398 @opindex Wanalyzer-mismatching-deallocation
10399 @opindex Wno-analyzer-mismatching-deallocation
10400 This warning requires @option{-fanalyzer}, which enables it; use
10401 @option{-Wno-analyzer-mismatching-deallocation}
10402 to disable it.
10404 This diagnostic warns for paths through the code in which the
10405 wrong deallocation function is called on a pointer value, based on
10406 which function was used to allocate the pointer value.  The diagnostic
10407 will warn about mismatches between @code{free}, scalar @code{delete}
10408 and vector @code{delete[]}, and those marked as allocator/deallocator
10409 pairs using attribute @code{malloc}.
10411 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10413 @item -Wno-analyzer-out-of-bounds
10414 @opindex Wanalyzer-out-of-bounds
10415 @opindex Wno-analyzer-out-of-bounds
10416 This warning requires @option{-fanalyzer} to enable it; use
10417 @option{-Wno-analyzer-out-of-bounds} to disable it.
10419 This diagnostic warns for path through the code in which a buffer is
10420 definitely read or written out-of-bounds.  The diagnostic applies for
10421 cases where the analyzer is able to determine a constant offset and for
10422 accesses past the end of a buffer, also a constant capacity.  Further,
10423 the diagnostic does limited checking for accesses past the end when the
10424 offset as well as the capacity is symbolic.
10426 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10428 @item -Wno-analyzer-possible-null-argument
10429 @opindex Wanalyzer-possible-null-argument
10430 @opindex Wno-analyzer-possible-null-argument
10431 This warning requires @option{-fanalyzer}, which enables it; use
10432 @option{-Wno-analyzer-possible-null-argument} to disable it.
10434 This diagnostic warns for paths through the code in which a
10435 possibly-NULL value is passed to a function argument marked
10436 with @code{__attribute__((nonnull))} as requiring a non-NULL
10437 value.
10439 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10441 @item -Wno-analyzer-possible-null-dereference
10442 @opindex Wanalyzer-possible-null-dereference
10443 @opindex Wno-analyzer-possible-null-dereference
10444 This warning requires @option{-fanalyzer}, which enables it; use
10445 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10447 This diagnostic warns for paths through the code in which a
10448 possibly-NULL value is dereferenced.
10450 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10452 @item -Wno-analyzer-null-argument
10453 @opindex Wanalyzer-null-argument
10454 @opindex Wno-analyzer-null-argument
10455 This warning requires @option{-fanalyzer}, which enables it; use
10456 @option{-Wno-analyzer-null-argument} to disable it.
10458 This diagnostic warns for paths through the code in which a
10459 value known to be NULL is passed to a function argument marked
10460 with @code{__attribute__((nonnull))} as requiring a non-NULL
10461 value.
10463 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10465 @item -Wno-analyzer-null-dereference
10466 @opindex Wanalyzer-null-dereference
10467 @opindex Wno-analyzer-null-dereference
10468 This warning requires @option{-fanalyzer}, which enables it; use
10469 @option{-Wno-analyzer-null-dereference} to disable it.
10471 This diagnostic warns for paths through the code in which a
10472 value known to be NULL is dereferenced.
10474 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10476 @item -Wno-analyzer-putenv-of-auto-var
10477 @opindex Wanalyzer-putenv-of-auto-var
10478 @opindex Wno-analyzer-putenv-of-auto-var
10479 This warning requires @option{-fanalyzer}, which enables it; use
10480 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10482 This diagnostic warns for paths through the code in which a
10483 call to @code{putenv} is passed a pointer to an automatic variable
10484 or an on-stack buffer.
10486 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}.
10488 @item -Wno-analyzer-shift-count-negative
10489 @opindex Wanalyzer-shift-count-negative
10490 @opindex Wno-analyzer-shift-count-negative
10491 This warning requires @option{-fanalyzer}, which enables it; use
10492 @option{-Wno-analyzer-shift-count-negative} to disable it.
10494 This diagnostic warns for paths through the code in which a
10495 shift is attempted with a negative count.  It is analogous to
10496 the @option{-Wshift-count-negative} diagnostic implemented in
10497 the C/C++ front ends, but is implemented based on analyzing
10498 interprocedural paths, rather than merely parsing the syntax tree.
10499 However, the analyzer does not prioritize detection of such paths, so
10500 false negatives are more likely relative to other warnings.
10502 @item -Wno-analyzer-shift-count-overflow
10503 @opindex Wanalyzer-shift-count-overflow
10504 @opindex Wno-analyzer-shift-count-overflow
10505 This warning requires @option{-fanalyzer}, which enables it; use
10506 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10508 This diagnostic warns for paths through the code in which a
10509 shift is attempted with a count greater than or equal to the
10510 precision of the operand's type.  It is analogous to
10511 the @option{-Wshift-count-overflow} diagnostic implemented in
10512 the C/C++ front ends, but is implemented based on analyzing
10513 interprocedural paths, rather than merely parsing the syntax tree.
10514 However, the analyzer does not prioritize detection of such paths, so
10515 false negatives are more likely relative to other warnings.
10517 @item -Wno-analyzer-stale-setjmp-buffer
10518 @opindex Wanalyzer-stale-setjmp-buffer
10519 @opindex Wno-analyzer-stale-setjmp-buffer
10520 This warning requires @option{-fanalyzer}, which enables it; use
10521 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10523 This diagnostic warns for paths through the code in which
10524 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10525 to a @code{setjmp} call in a function that has returned.
10527 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10528 location, it records the stack frame.  The stack frame becomes invalid
10529 when the function containing the @code{setjmp} call returns.  Attempting
10530 to rewind to it via @code{longjmp} would reference a stack frame that
10531 no longer exists, and likely lead to a crash (or worse).
10533 @item -Wno-analyzer-tainted-allocation-size
10534 @opindex Wanalyzer-tainted-allocation-size
10535 @opindex Wno-analyzer-tainted-allocation-size
10536 This warning requires both @option{-fanalyzer} and
10537 @option{-fanalyzer-checker=taint} to enable it;
10538 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10540 This diagnostic warns for paths through the code in which a value
10541 that could be under an attacker's control is used as the size
10542 of an allocation without being sanitized, so that an attacker could
10543 inject an excessively large allocation and potentially cause a denial
10544 of service attack.
10546 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10548 @item -Wno-analyzer-tainted-assertion
10549 @opindex Wanalyzer-tainted-assertion
10550 @opindex Wno-analyzer-tainted-assertion
10552 This warning requires both @option{-fanalyzer} and
10553 @option{-fanalyzer-checker=taint} to enable it;
10554 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10556 This diagnostic warns for paths through the code in which a value
10557 that could be under an attacker's control is used as part of a
10558 condition without being first sanitized, and that condition guards a
10559 call to a function marked with attribute @code{noreturn}
10560 (such as the function @code{__builtin_unreachable}).  Such functions
10561 typically indicate abnormal termination of the program, such as for
10562 assertion failure handlers.  For example:
10564 @smallexample
10565 assert (some_tainted_value < SOME_LIMIT);
10566 @end smallexample
10568 In such cases:
10570 @itemize
10571 @item
10572 when assertion-checking is enabled: an attacker could trigger
10573 a denial of service by injecting an assertion failure
10575 @item
10576 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10577 an attacker could inject data that subverts the process, since it
10578 presumably violates a precondition that is being assumed by the code.
10580 @end itemize
10582 Note that when assertion-checking is disabled, the assertions are
10583 typically removed by the preprocessor before the analyzer has a chance
10584 to "see" them, so this diagnostic can only generate warnings on builds
10585 in which assertion-checking is enabled.
10587 For the purpose of this warning, any function marked with attribute
10588 @code{noreturn} is considered as a possible assertion failure
10589 handler, including @code{__builtin_unreachable}.  Note that these functions
10590 are sometimes removed by the optimizer before the analyzer "sees" them.
10591 Hence optimization should be disabled when attempting to trigger this
10592 diagnostic.
10594 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10596 The warning can also report problematic constructions such as
10598 @smallexample
10599 switch (some_tainted_value) @{
10600 case 0:
10601   /* [...etc; various valid cases omitted...] */
10602   break;
10604 default:
10605   __builtin_unreachable (); /* BUG: attacker can trigger this  */
10607 @end smallexample
10609 despite the above not being an assertion failure, strictly speaking.
10611 @item -Wno-analyzer-tainted-array-index
10612 @opindex Wanalyzer-tainted-array-index
10613 @opindex Wno-analyzer-tainted-array-index
10614 This warning requires both @option{-fanalyzer} and
10615 @option{-fanalyzer-checker=taint} to enable it;
10616 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10618 This diagnostic warns for paths through the code in which a value
10619 that could be under an attacker's control is used as the index
10620 of an array access without being sanitized, so that an attacker
10621 could inject an out-of-bounds access.
10623 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10625 @item -Wno-analyzer-tainted-divisor
10626 @opindex Wanalyzer-tainted-divisor
10627 @opindex Wno-analyzer-tainted-divisor
10628 This warning requires both @option{-fanalyzer} and
10629 @option{-fanalyzer-checker=taint} to enable it;
10630 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10632 This diagnostic warns for paths through the code in which a value
10633 that could be under an attacker's control is used as the divisor
10634 in a division or modulus operation without being sanitized, so that
10635 an attacker could inject a division-by-zero.
10637 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10639 @item -Wno-analyzer-tainted-offset
10640 @opindex Wanalyzer-tainted-offset
10641 @opindex Wno-analyzer-tainted-offset
10642 This warning requires both @option{-fanalyzer} and
10643 @option{-fanalyzer-checker=taint} to enable it;
10644 use @option{-Wno-analyzer-tainted-offset} to disable it.
10646 This diagnostic warns for paths through the code in which a value
10647 that could be under an attacker's control is used as a pointer offset
10648 without being sanitized, so that an attacker could inject an out-of-bounds
10649 access.
10651 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10653 @item -Wno-analyzer-tainted-size
10654 @opindex Wanalyzer-tainted-size
10655 @opindex Wno-analyzer-tainted-size
10656 This warning requires both @option{-fanalyzer} and
10657 @option{-fanalyzer-checker=taint} to enable it;
10658 use @option{-Wno-analyzer-tainted-size} to disable it.
10660 This diagnostic warns for paths through the code in which a value
10661 that could be under an attacker's control is used as the size of
10662 an operation such as @code{memset} without being sanitized, so that an
10663 attacker could inject an out-of-bounds access.
10665 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10667 @item -Wno-analyzer-unsafe-call-within-signal-handler
10668 @opindex Wanalyzer-unsafe-call-within-signal-handler
10669 @opindex Wno-analyzer-unsafe-call-within-signal-handler
10670 This warning requires @option{-fanalyzer}, which enables it; use
10671 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
10673 This diagnostic warns for paths through the code in which a
10674 function known to be async-signal-unsafe (such as @code{fprintf}) is
10675 called from a signal handler.
10677 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
10679 @item -Wno-analyzer-use-after-free
10680 @opindex Wanalyzer-use-after-free
10681 @opindex Wno-analyzer-use-after-free
10682 This warning requires @option{-fanalyzer}, which enables it; use
10683 @option{-Wno-analyzer-use-after-free} to disable it.
10685 This diagnostic warns for paths through the code in which a
10686 pointer is used after a deallocator is called on it: either @code{free},
10687 or a deallocator referenced by attribute @code{malloc}.
10689 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
10691 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
10692 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
10693 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
10694 This warning requires @option{-fanalyzer}, which enables it; use
10695 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
10696 to disable it.
10698 This diagnostic warns for paths through the code in which a pointer
10699 is dereferenced that points to a variable in a stale stack frame.
10701 @item -Wno-analyzer-va-arg-type-mismatch
10702 @opindex Wanalyzer-va-arg-type-mismatch
10703 @opindex Wno-analyzer-va-arg-type-mismatch
10704 This warning requires @option{-fanalyzer}, which enables it; use
10705 @option{-Wno-analyzer-va-arg-type-mismatch}
10706 to disable it.
10708 This diagnostic warns for interprocedural paths through the code for which
10709 the analyzer detects an attempt to use @code{va_arg} to extract a value
10710 passed to a variadic call, but uses a type that does not match that of
10711 the expression passed to the call.
10713 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
10715 @item -Wno-analyzer-va-list-exhausted
10716 @opindex Wanalyzer-va-list-exhausted
10717 @opindex Wno-analyzer-va-list-exhausted
10718 This warning requires @option{-fanalyzer}, which enables it; use
10719 @option{-Wno-analyzer-va-list-exhausted}
10720 to disable it.
10722 This diagnostic warns for interprocedural paths through the code for which
10723 the analyzer detects an attempt to use @code{va_arg} to access the next
10724 value passed to a variadic call, but all of the values in the
10725 @code{va_list} have already been consumed.
10727 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
10729 @item -Wno-analyzer-va-list-leak
10730 @opindex Wanalyzer-va-list-leak
10731 @opindex Wno-analyzer-va-list-leak
10732 This warning requires @option{-fanalyzer}, which enables it; use
10733 @option{-Wno-analyzer-va-list-leak}
10734 to disable it.
10736 This diagnostic warns for interprocedural paths through the code for which
10737 the analyzer detects that @code{va_start} or @code{va_copy} has been called
10738 on a @code{va_list} without a corresponding call to @code{va_end}.
10740 @item -Wno-analyzer-va-list-use-after-va-end
10741 @opindex Wanalyzer-va-list-use-after-va-end
10742 @opindex Wno-analyzer-va-list-use-after-va-end
10743 This warning requires @option{-fanalyzer}, which enables it; use
10744 @option{-Wno-analyzer-va-list-use-after-va-end}
10745 to disable it.
10747 This diagnostic warns for interprocedural paths through the code for which
10748 the analyzer detects an attempt to use a @code{va_list}  after
10749 @code{va_end} has been called on it.
10750 @code{va_list}.
10752 @item -Wno-analyzer-write-to-const
10753 @opindex Wanalyzer-write-to-const
10754 @opindex Wno-analyzer-write-to-const
10755 This warning requires @option{-fanalyzer}, which enables it; use
10756 @option{-Wno-analyzer-write-to-const}
10757 to disable it.
10759 This diagnostic warns for paths through the code in which the analyzer
10760 detects an attempt to write through a pointer to a @code{const} object.
10761 However, the analyzer does not prioritize detection of such paths, so
10762 false negatives are more likely relative to other warnings.
10764 @item -Wno-analyzer-write-to-string-literal
10765 @opindex Wanalyzer-write-to-string-literal
10766 @opindex Wno-analyzer-write-to-string-literal
10767 This warning requires @option{-fanalyzer}, which enables it; use
10768 @option{-Wno-analyzer-write-to-string-literal}
10769 to disable it.
10771 This diagnostic warns for paths through the code in which the analyzer
10772 detects an attempt to write through a pointer to a string literal.
10773 However, the analyzer does not prioritize detection of such paths, so
10774 false negatives are more likely relative to other warnings.
10776 @item -Wno-analyzer-use-of-uninitialized-value
10777 @opindex Wanalyzer-use-of-uninitialized-value
10778 @opindex Wno-analyzer-use-of-uninitialized-value
10779 This warning requires @option{-fanalyzer}, which enables it; use
10780 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
10782 This diagnostic warns for paths through the code in which an uninitialized
10783 value is used.
10785 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
10787 @end table
10789 The analyzer has hardcoded knowledge about the behavior of the following
10790 memory-management functions:
10792 @itemize @bullet
10793 @item @code{alloca}
10794 @item The built-in functions @code{__builtin_alloc},
10795 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
10796 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
10797 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
10798 @code{__builtin_memset_chk}, @code{__builtin_realloc},
10799 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
10800 @item @code{calloc}
10801 @item @code{free}
10802 @item @code{malloc}
10803 @item @code{memset}
10804 @item @code{operator delete}
10805 @item @code{operator delete []}
10806 @item @code{operator new}
10807 @item @code{operator new []}
10808 @item @code{realloc}
10809 @item @code{strdup}
10810 @item @code{strndup}
10811 @end itemize
10813 of the following functions for working with file descriptors:
10815 @itemize @bullet
10816 @item @code{open}
10817 @item @code{close}
10818 @item @code{creat}
10819 @item @code{dup}, @code{dup2} and @code{dup3}
10820 @item @code{isatty}
10821 @item @code{pipe}, and @code{pipe2}
10822 @item @code{read}
10823 @item @code{write}
10824 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
10825 @end itemize
10827 of the following functions for working with @code{<stdio.h>} streams:
10828 @itemize @bullet
10829 @item The built-in functions @code{__builtin_fprintf},
10830 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
10831 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
10832 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
10833 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
10834 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
10835 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
10836 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
10837 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
10838 @code{__builtin_vprintf}
10839 @item @code{fopen}
10840 @item @code{fclose}
10841 @item @code{ferror}
10842 @item @code{fgets}
10843 @item @code{fgets_unlocked}
10844 @item @code{fileno}
10845 @item @code{fread}
10846 @item @code{getc}
10847 @item @code{getchar}
10848 @item @code{fprintf}
10849 @item @code{printf}
10850 @item @code{fwrite}
10851 @end itemize
10853 and of the following functions:
10855 @itemize @bullet
10856 @item The built-in functions @code{__builtin_expect},
10857 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
10858 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
10859 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
10860 @code{__builtin_va_start}
10861 @item The GNU extensions @code{error} and @code{error_at_line}
10862 @item @code{getpass}
10863 @item @code{longjmp}
10864 @item @code{putenv}
10865 @item @code{setjmp}
10866 @item @code{siglongjmp}
10867 @item @code{signal}
10868 @item @code{sigsetjmp}
10869 @item @code{strchr}
10870 @item @code{strlen}
10871 @end itemize
10873 In addition, various functions with an @code{__analyzer_} prefix have
10874 special meaning to the analyzer, described in the GCC Internals manual.
10876 Pertinent parameters for controlling the exploration are:
10877 @option{--param analyzer-bb-explosion-factor=@var{value}},
10878 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
10879 @option{--param analyzer-max-recursion-depth=@var{value}}, and
10880 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
10882 The following options control the analyzer.
10884 @table @gcctabopt
10886 @item -fanalyzer-call-summaries
10887 @opindex fanalyzer-call-summaries
10888 @opindex fno-analyzer-call-summaries
10889 Simplify interprocedural analysis by computing the effect of certain calls,
10890 rather than exploring all paths through the function from callsite to each
10891 possible return.
10893 If enabled, call summaries are only used for functions with more than one
10894 call site, and that are sufficiently complicated (as per
10895 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
10897 @item -fanalyzer-checker=@var{name}
10898 @opindex fanalyzer-checker
10899 Restrict the analyzer to run just the named checker, and enable it.
10901 Some checkers are disabled by default (even with @option{-fanalyzer}),
10902 such as the @code{taint} checker that implements
10903 @option{-Wanalyzer-tainted-array-index}, and this option is required
10904 to enable them.
10906 @emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
10907 following warnings from @option{-fanalyzer}:
10909 @gccoptlist{ @gol
10910 -Wanalyzer-deref-before-check @gol
10911 -Wanalyzer-double-fclose @gol
10912 -Wanalyzer-double-free @gol
10913 -Wanalyzer-exposure-through-output-file @gol
10914 -Wanalyzer-fd-access-mode-mismatch @gol
10915 -Wanalyzer-fd-double-close @gol
10916 -Wanalyzer-fd-leak @gol
10917 -Wanalyzer-fd-use-after-close @gol
10918 -Wanalyzer-fd-use-without-check @gol
10919 -Wanalyzer-file-leak @gol
10920 -Wanalyzer-free-of-non-heap @gol
10921 -Wanalyzer-malloc-leak @gol
10922 -Wanalyzer-mismatching-deallocation @gol
10923 -Wanalyzer-null-argument @gol
10924 -Wanalyzer-null-dereference @gol
10925 -Wanalyzer-possible-null-argument @gol
10926 -Wanalyzer-possible-null-dereference @gol
10927 -Wanalyzer-unsafe-call-within-signal-handler @gol
10928 -Wanalyzer-use-after-free @gol
10929 -Wanalyzer-va-list-leak @gol
10930 -Wanalyzer-va-list-use-after-va-end @gol
10933 @item -fno-analyzer-feasibility
10934 @opindex fanalyzer-feasibility
10935 @opindex fno-analyzer-feasibility
10936 This option is intended for analyzer developers.
10938 By default the analyzer verifies that there is a feasible control flow path
10939 for each diagnostic it emits: that the conditions that hold are not mutually
10940 exclusive.  Diagnostics for which no feasible path can be found are rejected.
10941 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
10942 debugging issues in this code.
10944 @item -fanalyzer-fine-grained
10945 @opindex fanalyzer-fine-grained
10946 @opindex fno-analyzer-fine-grained
10947 This option is intended for analyzer developers.
10949 Internally the analyzer builds an ``exploded graph'' that combines
10950 control flow graphs with data flow information.
10952 By default, an edge in this graph can contain the effects of a run
10953 of multiple statements within a basic block.  With
10954 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
10956 @item -fanalyzer-show-duplicate-count
10957 @opindex fanalyzer-show-duplicate-count
10958 @opindex fno-analyzer-show-duplicate-count
10959 This option is intended for analyzer developers: if multiple diagnostics
10960 have been detected as being duplicates of each other, it emits a note when
10961 reporting the best diagnostic, giving the number of additional diagnostics
10962 that were suppressed by the deduplication logic.
10964 @item -fno-analyzer-state-merge
10965 @opindex fanalyzer-state-merge
10966 @opindex fno-analyzer-state-merge
10967 This option is intended for analyzer developers.
10969 By default the analyzer attempts to simplify analysis by merging
10970 sufficiently similar states at each program point as it builds its
10971 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
10972 merging can be suppressed, for debugging state-handling issues.
10974 @item -fno-analyzer-state-purge
10975 @opindex fanalyzer-state-purge
10976 @opindex fno-analyzer-state-purge
10977 This option is intended for analyzer developers.
10979 By default the analyzer attempts to simplify analysis by purging
10980 aspects of state at a program point that appear to no longer be relevant
10981 e.g. the values of locals that aren't accessed later in the function
10982 and which aren't relevant to leak analysis.
10984 With @option{-fno-analyzer-state-purge} this purging of state can
10985 be suppressed, for debugging state-handling issues.
10987 @item -fanalyzer-transitivity
10988 @opindex fanalyzer-transitivity
10989 @opindex fno-analyzer-transitivity
10990 This option enables transitivity of constraints within the analyzer.
10992 @item -fno-analyzer-undo-inlining
10993 @opindex fanalyzer-undo-inlining
10994 @opindex fno-analyzer-undo-inlining
10995 This option is intended for analyzer developers.
10997 @option{-fanalyzer} runs relatively late compared to other code analysis
10998 tools, and some optimizations have already been applied to the code.  In
10999 particular function inlining may have occurred, leading to the
11000 interprocedural execution paths emitted by the analyzer containing
11001 function frames that don't correspond to those in the original source
11002 code.
11004 By default the analyzer attempts to reconstruct the original function
11005 frames, and to emit events showing the inlined calls.
11007 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11008 the original frame information can be be disabled, which may be of help
11009 when debugging issues in the analyzer.
11011 @item -fanalyzer-verbose-edges
11012 This option is intended for analyzer developers.  It enables more
11013 verbose, lower-level detail in the descriptions of control flow
11014 within diagnostic paths.
11016 @item -fanalyzer-verbose-state-changes
11017 This option is intended for analyzer developers.  It enables more
11018 verbose, lower-level detail in the descriptions of events relating
11019 to state machines within diagnostic paths.
11021 @item -fanalyzer-verbosity=@var{level}
11022 This option controls the complexity of the control flow paths that are
11023 emitted for analyzer diagnostics.
11025 The @var{level} can be one of:
11027 @table @samp
11028 @item 0
11029 At this level, interprocedural call and return events are displayed,
11030 along with the most pertinent state-change events relating to
11031 a diagnostic.  For example, for a double-@code{free} diagnostic,
11032 both calls to @code{free} will be shown.
11034 @item 1
11035 As per the previous level, but also show events for the entry
11036 to each function.
11038 @item 2
11039 As per the previous level, but also show events relating to
11040 control flow that are significant to triggering the issue
11041 (e.g. ``true path taken'' at a conditional).
11043 This level is the default.
11045 @item 3
11046 As per the previous level, but show all control flow events, not
11047 just significant ones.
11049 @item 4
11050 This level is intended for analyzer developers; it adds various
11051 other events intended for debugging the analyzer.
11053 @end table
11055 @item -fdump-analyzer
11056 @opindex fdump-analyzer
11057 Dump internal details about what the analyzer is doing to
11058 @file{@var{file}.analyzer.txt}.
11059 This option is overridden by @option{-fdump-analyzer-stderr}.
11061 @item -fdump-analyzer-stderr
11062 @opindex fdump-analyzer-stderr
11063 Dump internal details about what the analyzer is doing to stderr.
11064 This option overrides @option{-fdump-analyzer}.
11066 @item -fdump-analyzer-callgraph
11067 @opindex fdump-analyzer-callgraph
11068 Dump a representation of the call graph suitable for viewing with
11069 GraphViz to @file{@var{file}.callgraph.dot}.
11071 @item -fdump-analyzer-exploded-graph
11072 @opindex fdump-analyzer-exploded-graph
11073 Dump a representation of the ``exploded graph'' suitable for viewing with
11074 GraphViz to @file{@var{file}.eg.dot}.
11075 Nodes are color-coded based on state-machine states to emphasize
11076 state changes.
11078 @item -fdump-analyzer-exploded-nodes
11079 @opindex dump-analyzer-exploded-nodes
11080 Emit diagnostics showing where nodes in the ``exploded graph'' are
11081 in relation to the program source.
11083 @item -fdump-analyzer-exploded-nodes-2
11084 @opindex dump-analyzer-exploded-nodes-2
11085 Dump a textual representation of the ``exploded graph'' to
11086 @file{@var{file}.eg.txt}.
11088 @item -fdump-analyzer-exploded-nodes-3
11089 @opindex dump-analyzer-exploded-nodes-3
11090 Dump a textual representation of the ``exploded graph'' to
11091 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11092 This is typically a large number of dump files.
11094 @item -fdump-analyzer-exploded-paths
11095 @opindex fdump-analyzer-exploded-paths
11096 Dump a textual representation of the ``exploded path'' for each
11097 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11099 @item -fdump-analyzer-feasibility
11100 @opindex dump-analyzer-feasibility
11101 Dump internal details about the analyzer's search for feasible paths.
11102 The details are written in a form suitable for viewing with GraphViz
11103 to filenames of the form @file{@var{file}.*.fg.dot},
11104 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11106 @item -fdump-analyzer-json
11107 @opindex fdump-analyzer-json
11108 Dump a compressed JSON representation of analyzer internals to
11109 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11110 to change.
11112 @item -fdump-analyzer-state-purge
11113 @opindex fdump-analyzer-state-purge
11114 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11115 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11116 graph with information on what state will be purged at each node.
11117 The graph is written to @file{@var{file}.state-purge.dot}.
11119 @item -fdump-analyzer-supergraph
11120 @opindex fdump-analyzer-supergraph
11121 Dump representations of the ``supergraph'' suitable for viewing with
11122 GraphViz to @file{@var{file}.supergraph.dot} and to
11123 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11124 control flow graphs in the program, with interprocedural edges for
11125 calls and returns.  The second dump contains annotations showing nodes
11126 in the ``exploded graph'' and diagnostics associated with them.
11128 @item -fdump-analyzer-untracked
11129 @opindex fdump-analyzer-untracked
11130 Emit custom warnings with internal details intended for analyzer developers.
11132 @end table
11134 @node Debugging Options
11135 @section Options for Debugging Your Program
11136 @cindex options, debugging
11137 @cindex debugging information options
11139 To tell GCC to emit extra information for use by a debugger, in almost 
11140 all cases you need only to add @option{-g} to your other options.  Some debug
11141 formats can co-exist (like DWARF with CTF) when each of them is enabled
11142 explicitly by adding the respective command line option to your other options.
11144 GCC allows you to use @option{-g} with
11145 @option{-O}.  The shortcuts taken by optimized code may occasionally
11146 be surprising: some variables you declared may not exist
11147 at all; flow of control may briefly move where you did not expect it;
11148 some statements may not be executed because they compute constant
11149 results or their values are already at hand; some statements may
11150 execute in different places because they have been moved out of loops.
11151 Nevertheless it is possible to debug optimized output.  This makes
11152 it reasonable to use the optimizer for programs that might have bugs.
11154 If you are not using some other optimization option, consider
11155 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11156 With no @option{-O} option at all, some compiler passes that collect
11157 information useful for debugging do not run at all, so that
11158 @option{-Og} may result in a better debugging experience.
11160 @table @gcctabopt
11161 @item -g
11162 @opindex g
11163 Produce debugging information in the operating system's native format
11164 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11165 information.
11167 On most systems that use stabs format, @option{-g} enables use of extra
11168 debugging information that only GDB can use; this extra information
11169 makes debugging work better in GDB but probably makes other debuggers
11170 crash or refuse to read the program.  If you want to control for certain whether
11171 to generate the extra information, use @option{-gvms} (see below).
11173 @item -ggdb
11174 @opindex ggdb
11175 Produce debugging information for use by GDB@.  This means to use the
11176 most expressive format available (DWARF, stabs, or the native format
11177 if neither of those are supported), including GDB extensions if at all
11178 possible.
11180 @item -gdwarf
11181 @itemx -gdwarf-@var{version}
11182 @opindex gdwarf
11183 Produce debugging information in DWARF format (if that is supported).
11184 The value of @var{version} may be either 2, 3, 4 or 5; the default
11185 version for most targets is 5 (with the exception of VxWorks, TPF and
11186 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
11187 to version 4).
11189 Note that with DWARF Version 2, some ports require and always
11190 use some non-conflicting DWARF 3 extensions in the unwind tables.
11192 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11193 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11195 GCC no longer supports DWARF Version 1, which is substantially
11196 different than Version 2 and later.  For historical reasons, some
11197 other DWARF-related options such as
11198 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11199 in their names, but apply to all currently-supported versions of DWARF.
11201 @item -gbtf
11202 @opindex gbtf
11203 Request BTF debug information.  BTF is the default debugging format for the
11204 eBPF target.  On other targets, like x86, BTF debug information can be
11205 generated along with DWARF debug information when both of the debug formats are
11206 enabled explicitly via their respective command line options.
11208 @item -gctf
11209 @itemx -gctf@var{level}
11210 @opindex gctf
11211 Request CTF debug information and use level to specify how much CTF debug
11212 information should be produced.  If @option{-gctf} is specified
11213 without a value for level, the default level of CTF debug information is 2.
11215 CTF debug information can be generated along with DWARF debug information when
11216 both of the debug formats are enabled explicitly via their respective command
11217 line options.
11219 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11220 negates @option{-gctf}.
11222 Level 1 produces CTF information for tracebacks only.  This includes callsite
11223 information, but does not include type information.
11225 Level 2 produces type information for entities (functions, data objects etc.)
11226 at file-scope or global-scope only.
11228 @item -gvms
11229 @opindex gvms
11230 Produce debugging information in Alpha/VMS debug format (if that is
11231 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11233 @item -g@var{level}
11234 @itemx -ggdb@var{level}
11235 @itemx -gvms@var{level}
11236 Request debugging information and also use @var{level} to specify how
11237 much information.  The default level is 2.
11239 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11240 @option{-g}.
11242 Level 1 produces minimal information, enough for making backtraces in
11243 parts of the program that you don't plan to debug.  This includes
11244 descriptions of functions and external variables, and line number
11245 tables, but no information about local variables.
11247 Level 3 includes extra information, such as all the macro definitions
11248 present in the program.  Some debuggers support macro expansion when
11249 you use @option{-g3}.
11251 If you use multiple @option{-g} options, with or without level numbers,
11252 the last such option is the one that is effective.
11254 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11255 confusion with @option{-gdwarf-@var{level}}.
11256 Instead use an additional @option{-g@var{level}} option to change the
11257 debug level for DWARF.
11259 @item -fno-eliminate-unused-debug-symbols
11260 @opindex feliminate-unused-debug-symbols
11261 @opindex fno-eliminate-unused-debug-symbols
11262 By default, no debug information is produced for symbols that are not actually
11263 used. Use this option if you want debug information for all symbols.
11265 @item -femit-class-debug-always
11266 @opindex femit-class-debug-always
11267 Instead of emitting debugging information for a C++ class in only one
11268 object file, emit it in all object files using the class.  This option
11269 should be used only with debuggers that are unable to handle the way GCC
11270 normally emits debugging information for classes because using this
11271 option increases the size of debugging information by as much as a
11272 factor of two.
11274 @item -fno-merge-debug-strings
11275 @opindex fmerge-debug-strings
11276 @opindex fno-merge-debug-strings
11277 Direct the linker to not merge together strings in the debugging
11278 information that are identical in different object files.  Merging is
11279 not supported by all assemblers or linkers.  Merging decreases the size
11280 of the debug information in the output file at the cost of increasing
11281 link processing time.  Merging is enabled by default.
11283 @item -fdebug-prefix-map=@var{old}=@var{new}
11284 @opindex fdebug-prefix-map
11285 When compiling files residing in directory @file{@var{old}}, record
11286 debugging information describing them as if the files resided in
11287 directory @file{@var{new}} instead.  This can be used to replace a
11288 build-time path with an install-time path in the debug info.  It can
11289 also be used to change an absolute path to a relative path by using
11290 @file{.} for @var{new}.  This can give more reproducible builds, which
11291 are location independent, but may require an extra command to tell GDB
11292 where to find the source files. See also @option{-ffile-prefix-map}.
11294 @item -fvar-tracking
11295 @opindex fvar-tracking
11296 Run variable tracking pass.  It computes where variables are stored at each
11297 position in code.  Better debugging information is then generated
11298 (if the debugging information format supports this information).
11300 It is enabled by default when compiling with optimization (@option{-Os},
11301 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11302 the debug info format supports it.
11304 @item -fvar-tracking-assignments
11305 @opindex fvar-tracking-assignments
11306 @opindex fno-var-tracking-assignments
11307 Annotate assignments to user variables early in the compilation and
11308 attempt to carry the annotations over throughout the compilation all the
11309 way to the end, in an attempt to improve debug information while
11310 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
11312 It can be enabled even if var-tracking is disabled, in which case
11313 annotations are created and maintained, but discarded at the end.
11314 By default, this flag is enabled together with @option{-fvar-tracking},
11315 except when selective scheduling is enabled.
11317 @item -gsplit-dwarf
11318 @opindex gsplit-dwarf
11319 If DWARF debugging information is enabled, separate as much debugging
11320 information as possible into a separate output file with the extension
11321 @file{.dwo}.  This option allows the build system to avoid linking files with
11322 debug information.  To be useful, this option requires a debugger capable of
11323 reading @file{.dwo} files.
11325 @item -gdwarf32
11326 @itemx -gdwarf64
11327 @opindex gdwarf32
11328 @opindex gdwarf64
11329 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11330 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11331 DWARF format.  The default is target specific, on most targets it is
11332 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
11333 can't support more than 2GiB of debug information in any of the DWARF
11334 debug information sections.  The 64-bit DWARF format allows larger debug
11335 information and might not be well supported by all consumers yet.
11337 @item -gdescribe-dies
11338 @opindex gdescribe-dies
11339 Add description attributes to some DWARF DIEs that have no name attribute,
11340 such as artificial variables, external references and call site
11341 parameter DIEs.
11343 @item -gpubnames
11344 @opindex gpubnames
11345 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11347 @item -ggnu-pubnames
11348 @opindex ggnu-pubnames
11349 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11350 suitable for conversion into a GDB@ index.  This option is only useful
11351 with a linker that can produce GDB@ index version 7.
11353 @item -fdebug-types-section
11354 @opindex fdebug-types-section
11355 @opindex fno-debug-types-section
11356 When using DWARF Version 4 or higher, type DIEs can be put into
11357 their own @code{.debug_types} section instead of making them part of the
11358 @code{.debug_info} section.  It is more efficient to put them in a separate
11359 comdat section since the linker can then remove duplicates.
11360 But not all DWARF consumers support @code{.debug_types} sections yet
11361 and on some objects @code{.debug_types} produces larger instead of smaller
11362 debugging information.
11364 @item -grecord-gcc-switches
11365 @itemx -gno-record-gcc-switches
11366 @opindex grecord-gcc-switches
11367 @opindex gno-record-gcc-switches
11368 This switch causes the command-line options used to invoke the
11369 compiler that may affect code generation to be appended to the
11370 DW_AT_producer attribute in DWARF debugging information.  The options
11371 are concatenated with spaces separating them from each other and from
11372 the compiler version.  
11373 It is enabled by default.
11374 See also @option{-frecord-gcc-switches} for another
11375 way of storing compiler options into the object file.  
11377 @item -gstrict-dwarf
11378 @opindex gstrict-dwarf
11379 Disallow using extensions of later DWARF standard version than selected
11380 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
11381 DWARF extensions from later standard versions is allowed.
11383 @item -gno-strict-dwarf
11384 @opindex gno-strict-dwarf
11385 Allow using extensions of later DWARF standard version than selected with
11386 @option{-gdwarf-@var{version}}.
11388 @item -gas-loc-support
11389 @opindex gas-loc-support
11390 Inform the compiler that the assembler supports @code{.loc} directives.
11391 It may then use them for the assembler to generate DWARF2+ line number
11392 tables.
11394 This is generally desirable, because assembler-generated line-number
11395 tables are a lot more compact than those the compiler can generate
11396 itself.
11398 This option will be enabled by default if, at GCC configure time, the
11399 assembler was found to support such directives.
11401 @item -gno-as-loc-support
11402 @opindex gno-as-loc-support
11403 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11404 line number tables are to be generated.
11406 @item -gas-locview-support
11407 @opindex gas-locview-support
11408 Inform the compiler that the assembler supports @code{view} assignment
11409 and reset assertion checking in @code{.loc} directives.
11411 This option will be enabled by default if, at GCC configure time, the
11412 assembler was found to support them.
11414 @item -gno-as-locview-support
11415 Force GCC to assign view numbers internally, if
11416 @option{-gvariable-location-views} are explicitly requested.
11418 @item -gcolumn-info
11419 @itemx -gno-column-info
11420 @opindex gcolumn-info
11421 @opindex gno-column-info
11422 Emit location column information into DWARF debugging information, rather
11423 than just file and line.
11424 This option is enabled by default.
11426 @item -gstatement-frontiers
11427 @itemx -gno-statement-frontiers
11428 @opindex gstatement-frontiers
11429 @opindex gno-statement-frontiers
11430 This option causes GCC to create markers in the internal representation
11431 at the beginning of statements, and to keep them roughly in place
11432 throughout compilation, using them to guide the output of @code{is_stmt}
11433 markers in the line number table.  This is enabled by default when
11434 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11435 @dots{}), and outputting DWARF 2 debug information at the normal level.
11437 @item -gvariable-location-views
11438 @itemx -gvariable-location-views=incompat5
11439 @itemx -gno-variable-location-views
11440 @opindex gvariable-location-views
11441 @opindex gvariable-location-views=incompat5
11442 @opindex gno-variable-location-views
11443 Augment variable location lists with progressive view numbers implied
11444 from the line number table.  This enables debug information consumers to
11445 inspect state at certain points of the program, even if no instructions
11446 associated with the corresponding source locations are present at that
11447 point.  If the assembler lacks support for view numbers in line number
11448 tables, this will cause the compiler to emit the line number table,
11449 which generally makes them somewhat less compact.  The augmented line
11450 number tables and location lists are fully backward-compatible, so they
11451 can be consumed by debug information consumers that are not aware of
11452 these augmentations, but they won't derive any benefit from them either.
11454 This is enabled by default when outputting DWARF 2 debug information at
11455 the normal level, as long as there is assembler support,
11456 @option{-fvar-tracking-assignments} is enabled and
11457 @option{-gstrict-dwarf} is not.  When assembler support is not
11458 available, this may still be enabled, but it will force GCC to output
11459 internal line number tables, and if
11460 @option{-ginternal-reset-location-views} is not enabled, that will most
11461 certainly lead to silently mismatching location views.
11463 There is a proposed representation for view numbers that is not backward
11464 compatible with the location list format introduced in DWARF 5, that can
11465 be enabled with @option{-gvariable-location-views=incompat5}.  This
11466 option may be removed in the future, is only provided as a reference
11467 implementation of the proposed representation.  Debug information
11468 consumers are not expected to support this extended format, and they
11469 would be rendered unable to decode location lists using it.
11471 @item -ginternal-reset-location-views
11472 @itemx -gno-internal-reset-location-views
11473 @opindex ginternal-reset-location-views
11474 @opindex gno-internal-reset-location-views
11475 Attempt to determine location views that can be omitted from location
11476 view lists.  This requires the compiler to have very accurate insn
11477 length estimates, which isn't always the case, and it may cause
11478 incorrect view lists to be generated silently when using an assembler
11479 that does not support location view lists.  The GNU assembler will flag
11480 any such error as a @code{view number mismatch}.  This is only enabled
11481 on ports that define a reliable estimation function.
11483 @item -ginline-points
11484 @itemx -gno-inline-points
11485 @opindex ginline-points
11486 @opindex gno-inline-points
11487 Generate extended debug information for inlined functions.  Location
11488 view tracking markers are inserted at inlined entry points, so that
11489 address and view numbers can be computed and output in debug
11490 information.  This can be enabled independently of location views, in
11491 which case the view numbers won't be output, but it can only be enabled
11492 along with statement frontiers, and it is only enabled by default if
11493 location views are enabled.
11495 @item -gz@r{[}=@var{type}@r{]}
11496 @opindex gz
11497 Produce compressed debug sections in DWARF format, if that is supported.
11498 If @var{type} is not given, the default type depends on the capabilities
11499 of the assembler and linker used.  @var{type} may be one of
11500 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11501 compression in ELF gABI format).  If the linker doesn't support writing
11502 compressed debug sections, the option is rejected.  Otherwise, if the
11503 assembler does not support them, @option{-gz} is silently ignored when
11504 producing object files.
11506 @item -femit-struct-debug-baseonly
11507 @opindex femit-struct-debug-baseonly
11508 Emit debug information for struct-like types
11509 only when the base name of the compilation source file
11510 matches the base name of file in which the struct is defined.
11512 This option substantially reduces the size of debugging information,
11513 but at significant potential loss in type information to the debugger.
11514 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11515 See @option{-femit-struct-debug-detailed} for more detailed control.
11517 This option works only with DWARF debug output.
11519 @item -femit-struct-debug-reduced
11520 @opindex femit-struct-debug-reduced
11521 Emit debug information for struct-like types
11522 only when the base name of the compilation source file
11523 matches the base name of file in which the type is defined,
11524 unless the struct is a template or defined in a system header.
11526 This option significantly reduces the size of debugging information,
11527 with some potential loss in type information to the debugger.
11528 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11529 See @option{-femit-struct-debug-detailed} for more detailed control.
11531 This option works only with DWARF debug output.
11533 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11534 @opindex femit-struct-debug-detailed
11535 Specify the struct-like types
11536 for which the compiler generates debug information.
11537 The intent is to reduce duplicate struct debug information
11538 between different object files within the same program.
11540 This option is a detailed version of
11541 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11542 which serves for most needs.
11544 A specification has the syntax@*
11545 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11547 The optional first word limits the specification to
11548 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11549 A struct type is used directly when it is the type of a variable, member.
11550 Indirect uses arise through pointers to structs.
11551 That is, when use of an incomplete struct is valid, the use is indirect.
11552 An example is
11553 @samp{struct one direct; struct two * indirect;}.
11555 The optional second word limits the specification to
11556 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11557 Generic structs are a bit complicated to explain.
11558 For C++, these are non-explicit specializations of template classes,
11559 or non-template classes within the above.
11560 Other programming languages have generics,
11561 but @option{-femit-struct-debug-detailed} does not yet implement them.
11563 The third word specifies the source files for those
11564 structs for which the compiler should emit debug information.
11565 The values @samp{none} and @samp{any} have the normal meaning.
11566 The value @samp{base} means that
11567 the base of name of the file in which the type declaration appears
11568 must match the base of the name of the main compilation file.
11569 In practice, this means that when compiling @file{foo.c}, debug information
11570 is generated for types declared in that file and @file{foo.h},
11571 but not other header files.
11572 The value @samp{sys} means those types satisfying @samp{base}
11573 or declared in system or compiler headers.
11575 You may need to experiment to determine the best settings for your application.
11577 The default is @option{-femit-struct-debug-detailed=all}.
11579 This option works only with DWARF debug output.
11581 @item -fno-dwarf2-cfi-asm
11582 @opindex fdwarf2-cfi-asm
11583 @opindex fno-dwarf2-cfi-asm
11584 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11585 instead of using GAS @code{.cfi_*} directives.
11587 @item -fno-eliminate-unused-debug-types
11588 @opindex feliminate-unused-debug-types
11589 @opindex fno-eliminate-unused-debug-types
11590 Normally, when producing DWARF output, GCC avoids producing debug symbol 
11591 output for types that are nowhere used in the source file being compiled.
11592 Sometimes it is useful to have GCC emit debugging
11593 information for all types declared in a compilation
11594 unit, regardless of whether or not they are actually used
11595 in that compilation unit, for example 
11596 if, in the debugger, you want to cast a value to a type that is
11597 not actually used in your program (but is declared).  More often,
11598 however, this results in a significant amount of wasted space.
11599 @end table
11601 @node Optimize Options
11602 @section Options That Control Optimization
11603 @cindex optimize options
11604 @cindex options, optimization
11606 These options control various sorts of optimizations.
11608 Without any optimization option, the compiler's goal is to reduce the
11609 cost of compilation and to make debugging produce the expected
11610 results.  Statements are independent: if you stop the program with a
11611 breakpoint between statements, you can then assign a new value to any
11612 variable or change the program counter to any other statement in the
11613 function and get exactly the results you expect from the source
11614 code.
11616 Turning on optimization flags makes the compiler attempt to improve
11617 the performance and/or code size at the expense of compilation time
11618 and possibly the ability to debug the program.
11620 The compiler performs optimization based on the knowledge it has of the
11621 program.  Compiling multiple files at once to a single output file mode allows
11622 the compiler to use information gained from all of the files when compiling
11623 each of them.
11625 Not all optimizations are controlled directly by a flag.  Only
11626 optimizations that have a flag are listed in this section.
11628 Most optimizations are completely disabled at @option{-O0} or if an
11629 @option{-O} level is not set on the command line, even if individual
11630 optimization flags are specified.  Similarly, @option{-Og} suppresses
11631 many optimization passes.
11633 Depending on the target and how GCC was configured, a slightly different
11634 set of optimizations may be enabled at each @option{-O} level than
11635 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
11636 to find out the exact set of optimizations that are enabled at each level.
11637 @xref{Overall Options}, for examples.
11639 @table @gcctabopt
11640 @item -O
11641 @itemx -O1
11642 @opindex O
11643 @opindex O1
11644 Optimize.  Optimizing compilation takes somewhat more time, and a lot
11645 more memory for a large function.
11647 With @option{-O}, the compiler tries to reduce code size and execution
11648 time, without performing any optimizations that take a great deal of
11649 compilation time.
11651 @c Note that in addition to the default_options_table list in opts.cc,
11652 @c several optimization flags default to true but control optimization
11653 @c passes that are explicitly disabled at -O0.
11655 @option{-O} turns on the following optimization flags:
11657 @c Please keep the following list alphabetized.
11658 @gccoptlist{-fauto-inc-dec @gol
11659 -fbranch-count-reg @gol
11660 -fcombine-stack-adjustments @gol
11661 -fcompare-elim @gol
11662 -fcprop-registers @gol
11663 -fdce @gol
11664 -fdefer-pop @gol
11665 -fdelayed-branch @gol
11666 -fdse @gol
11667 -fforward-propagate @gol
11668 -fguess-branch-probability @gol
11669 -fif-conversion @gol
11670 -fif-conversion2 @gol
11671 -finline-functions-called-once @gol
11672 -fipa-modref @gol
11673 -fipa-profile @gol
11674 -fipa-pure-const @gol
11675 -fipa-reference @gol
11676 -fipa-reference-addressable @gol
11677 -fmerge-constants @gol
11678 -fmove-loop-invariants @gol
11679 -fmove-loop-stores@gol
11680 -fomit-frame-pointer @gol
11681 -freorder-blocks @gol
11682 -fshrink-wrap @gol
11683 -fshrink-wrap-separate @gol
11684 -fsplit-wide-types @gol
11685 -fssa-backprop @gol
11686 -fssa-phiopt @gol
11687 -ftree-bit-ccp @gol
11688 -ftree-ccp @gol
11689 -ftree-ch @gol
11690 -ftree-coalesce-vars @gol
11691 -ftree-copy-prop @gol
11692 -ftree-dce @gol
11693 -ftree-dominator-opts @gol
11694 -ftree-dse @gol
11695 -ftree-forwprop @gol
11696 -ftree-fre @gol
11697 -ftree-phiprop @gol
11698 -ftree-pta @gol
11699 -ftree-scev-cprop @gol
11700 -ftree-sink @gol
11701 -ftree-slsr @gol
11702 -ftree-sra @gol
11703 -ftree-ter @gol
11704 -funit-at-a-time}
11706 @item -O2
11707 @opindex O2
11708 Optimize even more.  GCC performs nearly all supported optimizations
11709 that do not involve a space-speed tradeoff.
11710 As compared to @option{-O}, this option increases both compilation time
11711 and the performance of the generated code.
11713 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
11714 also turns on the following optimization flags:
11716 @c Please keep the following list alphabetized!
11717 @gccoptlist{-falign-functions  -falign-jumps @gol
11718 -falign-labels  -falign-loops @gol
11719 -fcaller-saves @gol
11720 -fcode-hoisting @gol
11721 -fcrossjumping @gol
11722 -fcse-follow-jumps  -fcse-skip-blocks @gol
11723 -fdelete-null-pointer-checks @gol
11724 -fdevirtualize  -fdevirtualize-speculatively @gol
11725 -fexpensive-optimizations @gol
11726 -ffinite-loops @gol
11727 -fgcse  -fgcse-lm  @gol
11728 -fhoist-adjacent-loads @gol
11729 -finline-functions @gol
11730 -finline-small-functions @gol
11731 -findirect-inlining @gol
11732 -fipa-bit-cp  -fipa-cp  -fipa-icf @gol
11733 -fipa-ra  -fipa-sra  -fipa-vrp @gol
11734 -fisolate-erroneous-paths-dereference @gol
11735 -flra-remat @gol
11736 -foptimize-sibling-calls @gol
11737 -foptimize-strlen @gol
11738 -fpartial-inlining @gol
11739 -fpeephole2 @gol
11740 -freorder-blocks-algorithm=stc @gol
11741 -freorder-blocks-and-partition  -freorder-functions @gol
11742 -frerun-cse-after-loop  @gol
11743 -fschedule-insns  -fschedule-insns2 @gol
11744 -fsched-interblock  -fsched-spec @gol
11745 -fstore-merging @gol
11746 -fstrict-aliasing @gol
11747 -fthread-jumps @gol
11748 -ftree-builtin-call-dce @gol
11749 -ftree-loop-vectorize @gol
11750 -ftree-pre @gol
11751 -ftree-slp-vectorize @gol
11752 -ftree-switch-conversion  -ftree-tail-merge @gol
11753 -ftree-vrp @gol
11754 -fvect-cost-model=very-cheap}
11756 Please note the warning under @option{-fgcse} about
11757 invoking @option{-O2} on programs that use computed gotos.
11759 @item -O3
11760 @opindex O3
11761 Optimize yet more.  @option{-O3} turns on all optimizations specified
11762 by @option{-O2} and also turns on the following optimization flags:
11764 @c Please keep the following list alphabetized!
11765 @gccoptlist{-fgcse-after-reload @gol
11766 -fipa-cp-clone
11767 -floop-interchange @gol
11768 -floop-unroll-and-jam @gol
11769 -fpeel-loops @gol
11770 -fpredictive-commoning @gol
11771 -fsplit-loops @gol
11772 -fsplit-paths @gol
11773 -ftree-loop-distribution @gol
11774 -ftree-partial-pre @gol
11775 -funswitch-loops @gol
11776 -fvect-cost-model=dynamic @gol
11777 -fversion-loops-for-strides}
11779 @item -O0
11780 @opindex O0
11781 Reduce compilation time and make debugging produce the expected
11782 results.  This is the default.
11784 @item -Os
11785 @opindex Os
11786 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
11787 except those that often increase code size:
11789 @gccoptlist{-falign-functions  -falign-jumps @gol
11790 -falign-labels  -falign-loops @gol
11791 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
11793 It also enables @option{-finline-functions}, causes the compiler to tune for
11794 code size rather than execution speed, and performs further optimizations
11795 designed to reduce code size.
11797 @item -Ofast
11798 @opindex Ofast
11799 Disregard strict standards compliance.  @option{-Ofast} enables all
11800 @option{-O3} optimizations.  It also enables optimizations that are not
11801 valid for all standard-compliant programs.
11802 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
11803 and the Fortran-specific @option{-fstack-arrays}, unless
11804 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
11805 It turns off @option{-fsemantic-interposition}.
11807 @item -Og
11808 @opindex Og
11809 Optimize debugging experience.  @option{-Og} should be the optimization
11810 level of choice for the standard edit-compile-debug cycle, offering
11811 a reasonable level of optimization while maintaining fast compilation
11812 and a good debugging experience.  It is a better choice than @option{-O0}
11813 for producing debuggable code because some compiler passes
11814 that collect debug information are disabled at @option{-O0}.
11816 Like @option{-O0}, @option{-Og} completely disables a number of 
11817 optimization passes so that individual options controlling them have
11818 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
11819 optimization flags except for those that may interfere with debugging:
11821 @gccoptlist{-fbranch-count-reg  -fdelayed-branch @gol
11822 -fdse  -fif-conversion  -fif-conversion2  @gol
11823 -finline-functions-called-once @gol
11824 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt @gol
11825 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
11827 @item -Oz
11828 @opindex Oz
11829 Optimize aggressively for size rather than speed.  This may increase
11830 the number of instructions executed if those instructions require
11831 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
11832 including enabling most @option{-O2} optimizations.
11834 @end table
11836 If you use multiple @option{-O} options, with or without level numbers,
11837 the last such option is the one that is effective.
11839 Options of the form @option{-f@var{flag}} specify machine-independent
11840 flags.  Most flags have both positive and negative forms; the negative
11841 form of @option{-ffoo} is @option{-fno-foo}.  In the table
11842 below, only one of the forms is listed---the one you typically 
11843 use.  You can figure out the other form by either removing @samp{no-}
11844 or adding it.
11846 The following options control specific optimizations.  They are either
11847 activated by @option{-O} options or are related to ones that are.  You
11848 can use the following flags in the rare cases when ``fine-tuning'' of
11849 optimizations to be performed is desired.
11851 @table @gcctabopt
11852 @item -fno-defer-pop
11853 @opindex fno-defer-pop
11854 @opindex fdefer-pop
11855 For machines that must pop arguments after a function call, always pop 
11856 the arguments as soon as each function returns.  
11857 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
11858 this allows the compiler to let arguments accumulate on the stack for several
11859 function calls and pop them all at once.
11861 @item -fforward-propagate
11862 @opindex fforward-propagate
11863 Perform a forward propagation pass on RTL@.  The pass tries to combine two
11864 instructions and checks if the result can be simplified.  If loop unrolling
11865 is active, two passes are performed and the second is scheduled after
11866 loop unrolling.
11868 This option is enabled by default at optimization levels @option{-O1},
11869 @option{-O2}, @option{-O3}, @option{-Os}.
11871 @item -ffp-contract=@var{style}
11872 @opindex ffp-contract
11873 @option{-ffp-contract=off} disables floating-point expression contraction.
11874 @option{-ffp-contract=fast} enables floating-point expression contraction
11875 such as forming of fused multiply-add operations if the target has
11876 native support for them.
11877 @option{-ffp-contract=on} enables floating-point expression contraction
11878 if allowed by the language standard.  This is currently not implemented
11879 and treated equal to @option{-ffp-contract=off}.
11881 The default is @option{-ffp-contract=fast}.
11883 @item -fomit-frame-pointer
11884 @opindex fomit-frame-pointer
11885 Omit the frame pointer in functions that don't need one.  This avoids the
11886 instructions to save, set up and restore the frame pointer; on many targets
11887 it also makes an extra register available.
11889 On some targets this flag has no effect because the standard calling sequence
11890 always uses a frame pointer, so it cannot be omitted.
11892 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
11893 is used in all functions.  Several targets always omit the frame pointer in
11894 leaf functions.
11896 Enabled by default at @option{-O1} and higher.
11898 @item -foptimize-sibling-calls
11899 @opindex foptimize-sibling-calls
11900 Optimize sibling and tail recursive calls.
11902 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11904 @item -foptimize-strlen
11905 @opindex foptimize-strlen
11906 Optimize various standard C string functions (e.g.@: @code{strlen},
11907 @code{strchr} or @code{strcpy}) and
11908 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
11910 Enabled at levels @option{-O2}, @option{-O3}.
11912 @item -fno-inline
11913 @opindex fno-inline
11914 @opindex finline
11915 Do not expand any functions inline apart from those marked with
11916 the @code{always_inline} attribute.  This is the default when not
11917 optimizing.
11919 Single functions can be exempted from inlining by marking them
11920 with the @code{noinline} attribute.
11922 @item -finline-small-functions
11923 @opindex finline-small-functions
11924 Integrate functions into their callers when their body is smaller than expected
11925 function call code (so overall size of program gets smaller).  The compiler
11926 heuristically decides which functions are simple enough to be worth integrating
11927 in this way.  This inlining applies to all functions, even those not declared
11928 inline.
11930 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11932 @item -findirect-inlining
11933 @opindex findirect-inlining
11934 Inline also indirect calls that are discovered to be known at compile
11935 time thanks to previous inlining.  This option has any effect only
11936 when inlining itself is turned on by the @option{-finline-functions}
11937 or @option{-finline-small-functions} options.
11939 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11941 @item -finline-functions
11942 @opindex finline-functions
11943 Consider all functions for inlining, even if they are not declared inline.
11944 The compiler heuristically decides which functions are worth integrating
11945 in this way.
11947 If all calls to a given function are integrated, and the function is
11948 declared @code{static}, then the function is normally not output as
11949 assembler code in its own right.
11951 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
11952 by @option{-fprofile-use} and @option{-fauto-profile}.
11954 @item -finline-functions-called-once
11955 @opindex finline-functions-called-once
11956 Consider all @code{static} functions called once for inlining into their
11957 caller even if they are not marked @code{inline}.  If a call to a given
11958 function is integrated, then the function is not output as assembler code
11959 in its own right.
11961 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
11962 but not @option{-Og}.
11964 @item -fearly-inlining
11965 @opindex fearly-inlining
11966 Inline functions marked by @code{always_inline} and functions whose body seems
11967 smaller than the function call overhead early before doing
11968 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
11969 makes profiling significantly cheaper and usually inlining faster on programs
11970 having large chains of nested wrapper functions.
11972 Enabled by default.
11974 @item -fipa-sra
11975 @opindex fipa-sra
11976 Perform interprocedural scalar replacement of aggregates, removal of
11977 unused parameters and replacement of parameters passed by reference
11978 by parameters passed by value.
11980 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
11982 @item -finline-limit=@var{n}
11983 @opindex finline-limit
11984 By default, GCC limits the size of functions that can be inlined.  This flag
11985 allows coarse control of this limit.  @var{n} is the size of functions that
11986 can be inlined in number of pseudo instructions.
11988 Inlining is actually controlled by a number of parameters, which may be
11989 specified individually by using @option{--param @var{name}=@var{value}}.
11990 The @option{-finline-limit=@var{n}} option sets some of these parameters
11991 as follows:
11993 @table @gcctabopt
11994 @item max-inline-insns-single
11995 is set to @var{n}/2.
11996 @item max-inline-insns-auto
11997 is set to @var{n}/2.
11998 @end table
12000 See below for a documentation of the individual
12001 parameters controlling inlining and for the defaults of these parameters.
12003 @emph{Note:} there may be no value to @option{-finline-limit} that results
12004 in default behavior.
12006 @emph{Note:} pseudo instruction represents, in this particular context, an
12007 abstract measurement of function's size.  In no way does it represent a count
12008 of assembly instructions and as such its exact meaning might change from one
12009 release to an another.
12011 @item -fno-keep-inline-dllexport
12012 @opindex fno-keep-inline-dllexport
12013 @opindex fkeep-inline-dllexport
12014 This is a more fine-grained version of @option{-fkeep-inline-functions},
12015 which applies only to functions that are declared using the @code{dllexport}
12016 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12017 Functions}.
12019 @item -fkeep-inline-functions
12020 @opindex fkeep-inline-functions
12021 In C, emit @code{static} functions that are declared @code{inline}
12022 into the object file, even if the function has been inlined into all
12023 of its callers.  This switch does not affect functions using the
12024 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12025 inline functions into the object file.
12027 @item -fkeep-static-functions
12028 @opindex fkeep-static-functions
12029 Emit @code{static} functions into the object file, even if the function
12030 is never used.
12032 @item -fkeep-static-consts
12033 @opindex fkeep-static-consts
12034 Emit variables declared @code{static const} when optimization isn't turned
12035 on, even if the variables aren't referenced.
12037 GCC enables this option by default.  If you want to force the compiler to
12038 check if a variable is referenced, regardless of whether or not
12039 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12041 @item -fmerge-constants
12042 @opindex fmerge-constants
12043 Attempt to merge identical constants (string constants and floating-point
12044 constants) across compilation units.
12046 This option is the default for optimized compilation if the assembler and
12047 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12048 behavior.
12050 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12052 @item -fmerge-all-constants
12053 @opindex fmerge-all-constants
12054 Attempt to merge identical constants and identical variables.
12056 This option implies @option{-fmerge-constants}.  In addition to
12057 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12058 arrays or initialized constant variables with integral or floating-point
12059 types.  Languages like C or C++ require each variable, including multiple
12060 instances of the same variable in recursive calls, to have distinct locations,
12061 so using this option results in non-conforming
12062 behavior.
12064 @item -fmodulo-sched
12065 @opindex fmodulo-sched
12066 Perform swing modulo scheduling immediately before the first scheduling
12067 pass.  This pass looks at innermost loops and reorders their
12068 instructions by overlapping different iterations.
12070 @item -fmodulo-sched-allow-regmoves
12071 @opindex fmodulo-sched-allow-regmoves
12072 Perform more aggressive SMS-based modulo scheduling with register moves
12073 allowed.  By setting this flag certain anti-dependences edges are
12074 deleted, which triggers the generation of reg-moves based on the
12075 life-range analysis.  This option is effective only with
12076 @option{-fmodulo-sched} enabled.
12078 @item -fno-branch-count-reg
12079 @opindex fno-branch-count-reg
12080 @opindex fbranch-count-reg
12081 Disable the optimization pass that scans for opportunities to use 
12082 ``decrement and branch'' instructions on a count register instead of
12083 instruction sequences that decrement a register, compare it against zero, and
12084 then branch based upon the result.  This option is only meaningful on
12085 architectures that support such instructions, which include x86, PowerPC,
12086 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12087 doesn't remove the decrement and branch instructions from the generated
12088 instruction stream introduced by other optimization passes.
12090 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12091 except for @option{-Og}.
12093 @item -fno-function-cse
12094 @opindex fno-function-cse
12095 @opindex ffunction-cse
12096 Do not put function addresses in registers; make each instruction that
12097 calls a constant function contain the function's address explicitly.
12099 This option results in less efficient code, but some strange hacks
12100 that alter the assembler output may be confused by the optimizations
12101 performed when this option is not used.
12103 The default is @option{-ffunction-cse}
12105 @item -fno-zero-initialized-in-bss
12106 @opindex fno-zero-initialized-in-bss
12107 @opindex fzero-initialized-in-bss
12108 If the target supports a BSS section, GCC by default puts variables that
12109 are initialized to zero into BSS@.  This can save space in the resulting
12110 code.
12112 This option turns off this behavior because some programs explicitly
12113 rely on variables going to the data section---e.g., so that the
12114 resulting executable can find the beginning of that section and/or make
12115 assumptions based on that.
12117 The default is @option{-fzero-initialized-in-bss}.
12119 @item -fthread-jumps
12120 @opindex fthread-jumps
12121 Perform optimizations that check to see if a jump branches to a
12122 location where another comparison subsumed by the first is found.  If
12123 so, the first branch is redirected to either the destination of the
12124 second branch or a point immediately following it, depending on whether
12125 the condition is known to be true or false.
12127 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12129 @item -fsplit-wide-types
12130 @opindex fsplit-wide-types
12131 When using a type that occupies multiple registers, such as @code{long
12132 long} on a 32-bit system, split the registers apart and allocate them
12133 independently.  This normally generates better code for those types,
12134 but may make debugging more difficult.
12136 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12137 @option{-Os}.
12139 @item -fsplit-wide-types-early
12140 @opindex fsplit-wide-types-early
12141 Fully split wide types early, instead of very late.
12142 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12144 This is the default on some targets.
12146 @item -fcse-follow-jumps
12147 @opindex fcse-follow-jumps
12148 In common subexpression elimination (CSE), scan through jump instructions
12149 when the target of the jump is not reached by any other path.  For
12150 example, when CSE encounters an @code{if} statement with an
12151 @code{else} clause, CSE follows the jump when the condition
12152 tested is false.
12154 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12156 @item -fcse-skip-blocks
12157 @opindex fcse-skip-blocks
12158 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12159 follow jumps that conditionally skip over blocks.  When CSE
12160 encounters a simple @code{if} statement with no else clause,
12161 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12162 body of the @code{if}.
12164 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12166 @item -frerun-cse-after-loop
12167 @opindex frerun-cse-after-loop
12168 Re-run common subexpression elimination after loop optimizations are
12169 performed.
12171 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12173 @item -fgcse
12174 @opindex fgcse
12175 Perform a global common subexpression elimination pass.
12176 This pass also performs global constant and copy propagation.
12178 @emph{Note:} When compiling a program using computed gotos, a GCC
12179 extension, you may get better run-time performance if you disable
12180 the global common subexpression elimination pass by adding
12181 @option{-fno-gcse} to the command line.
12183 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12185 @item -fgcse-lm
12186 @opindex fgcse-lm
12187 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12188 attempts to move loads that are only killed by stores into themselves.  This
12189 allows a loop containing a load/store sequence to be changed to a load outside
12190 the loop, and a copy/store within the loop.
12192 Enabled by default when @option{-fgcse} is enabled.
12194 @item -fgcse-sm
12195 @opindex fgcse-sm
12196 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12197 global common subexpression elimination.  This pass attempts to move
12198 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12199 loops containing a load/store sequence can be changed to a load before
12200 the loop and a store after the loop.
12202 Not enabled at any optimization level.
12204 @item -fgcse-las
12205 @opindex fgcse-las
12206 When @option{-fgcse-las} is enabled, the global common subexpression
12207 elimination pass eliminates redundant loads that come after stores to the
12208 same memory location (both partial and full redundancies).
12210 Not enabled at any optimization level.
12212 @item -fgcse-after-reload
12213 @opindex fgcse-after-reload
12214 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12215 pass is performed after reload.  The purpose of this pass is to clean up
12216 redundant spilling.
12218 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12220 @item -faggressive-loop-optimizations
12221 @opindex faggressive-loop-optimizations
12222 This option tells the loop optimizer to use language constraints to
12223 derive bounds for the number of iterations of a loop.  This assumes that
12224 loop code does not invoke undefined behavior by for example causing signed
12225 integer overflows or out-of-bound array accesses.  The bounds for the
12226 number of iterations of a loop are used to guide loop unrolling and peeling
12227 and loop exit test optimizations.
12228 This option is enabled by default.
12230 @item -funconstrained-commons
12231 @opindex funconstrained-commons
12232 This option tells the compiler that variables declared in common blocks
12233 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12234 prevents certain optimizations that depend on knowing the array bounds.
12236 @item -fcrossjumping
12237 @opindex fcrossjumping
12238 Perform cross-jumping transformation.
12239 This transformation unifies equivalent code and saves code size.  The
12240 resulting code may or may not perform better than without cross-jumping.
12242 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12244 @item -fauto-inc-dec
12245 @opindex fauto-inc-dec
12246 Combine increments or decrements of addresses with memory accesses.
12247 This pass is always skipped on architectures that do not have
12248 instructions to support this.  Enabled by default at @option{-O1} and
12249 higher on architectures that support this.
12251 @item -fdce
12252 @opindex fdce
12253 Perform dead code elimination (DCE) on RTL@.
12254 Enabled by default at @option{-O1} and higher.
12256 @item -fdse
12257 @opindex fdse
12258 Perform dead store elimination (DSE) on RTL@.
12259 Enabled by default at @option{-O1} and higher.
12261 @item -fif-conversion
12262 @opindex fif-conversion
12263 Attempt to transform conditional jumps into branch-less equivalents.  This
12264 includes use of conditional moves, min, max, set flags and abs instructions, and
12265 some tricks doable by standard arithmetics.  The use of conditional execution
12266 on chips where it is available is controlled by @option{-fif-conversion2}.
12268 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12269 not with @option{-Og}.
12271 @item -fif-conversion2
12272 @opindex fif-conversion2
12273 Use conditional execution (where available) to transform conditional jumps into
12274 branch-less equivalents.
12276 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12277 not with @option{-Og}.
12279 @item -fdeclone-ctor-dtor
12280 @opindex fdeclone-ctor-dtor
12281 The C++ ABI requires multiple entry points for constructors and
12282 destructors: one for a base subobject, one for a complete object, and
12283 one for a virtual destructor that calls operator delete afterwards.
12284 For a hierarchy with virtual bases, the base and complete variants are
12285 clones, which means two copies of the function.  With this option, the
12286 base and complete variants are changed to be thunks that call a common
12287 implementation.
12289 Enabled by @option{-Os}.
12291 @item -fdelete-null-pointer-checks
12292 @opindex fdelete-null-pointer-checks
12293 Assume that programs cannot safely dereference null pointers, and that
12294 no code or data element resides at address zero.
12295 This option enables simple constant
12296 folding optimizations at all optimization levels.  In addition, other
12297 optimization passes in GCC use this flag to control global dataflow
12298 analyses that eliminate useless checks for null pointers; these assume
12299 that a memory access to address zero always results in a trap, so
12300 that if a pointer is checked after it has already been dereferenced,
12301 it cannot be null.
12303 Note however that in some environments this assumption is not true.
12304 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12305 for programs that depend on that behavior.
12307 This option is enabled by default on most targets.  On Nios II ELF, it
12308 defaults to off.  On AVR and MSP430, this option is completely disabled.
12310 Passes that use the dataflow information
12311 are enabled independently at different optimization levels.
12313 @item -fdevirtualize
12314 @opindex fdevirtualize
12315 Attempt to convert calls to virtual functions to direct calls.  This
12316 is done both within a procedure and interprocedurally as part of
12317 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12318 propagation (@option{-fipa-cp}).
12319 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12321 @item -fdevirtualize-speculatively
12322 @opindex fdevirtualize-speculatively
12323 Attempt to convert calls to virtual functions to speculative direct calls.
12324 Based on the analysis of the type inheritance graph, determine for a given call
12325 the set of likely targets. If the set is small, preferably of size 1, change
12326 the call into a conditional deciding between direct and indirect calls.  The
12327 speculative calls enable more optimizations, such as inlining.  When they seem
12328 useless after further optimization, they are converted back into original form.
12330 @item -fdevirtualize-at-ltrans
12331 @opindex fdevirtualize-at-ltrans
12332 Stream extra information needed for aggressive devirtualization when running
12333 the link-time optimizer in local transformation mode.  
12334 This option enables more devirtualization but
12335 significantly increases the size of streamed data. For this reason it is
12336 disabled by default.
12338 @item -fexpensive-optimizations
12339 @opindex fexpensive-optimizations
12340 Perform a number of minor optimizations that are relatively expensive.
12342 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12344 @item -free
12345 @opindex free
12346 Attempt to remove redundant extension instructions.  This is especially
12347 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12348 registers after writing to their lower 32-bit half.
12350 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
12351 @option{-O3}, @option{-Os}.
12353 @item -fno-lifetime-dse
12354 @opindex fno-lifetime-dse
12355 @opindex flifetime-dse
12356 In C++ the value of an object is only affected by changes within its
12357 lifetime: when the constructor begins, the object has an indeterminate
12358 value, and any changes during the lifetime of the object are dead when
12359 the object is destroyed.  Normally dead store elimination will take
12360 advantage of this; if your code relies on the value of the object
12361 storage persisting beyond the lifetime of the object, you can use this
12362 flag to disable this optimization.  To preserve stores before the
12363 constructor starts (e.g.@: because your operator new clears the object
12364 storage) but still treat the object as dead after the destructor, you
12365 can use @option{-flifetime-dse=1}.  The default behavior can be
12366 explicitly selected with @option{-flifetime-dse=2}.
12367 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12369 @item -flive-range-shrinkage
12370 @opindex flive-range-shrinkage
12371 Attempt to decrease register pressure through register live range
12372 shrinkage.  This is helpful for fast processors with small or moderate
12373 size register sets.
12375 @item -fira-algorithm=@var{algorithm}
12376 @opindex fira-algorithm
12377 Use the specified coloring algorithm for the integrated register
12378 allocator.  The @var{algorithm} argument can be @samp{priority}, which
12379 specifies Chow's priority coloring, or @samp{CB}, which specifies
12380 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
12381 for all architectures, but for those targets that do support it, it is
12382 the default because it generates better code.
12384 @item -fira-region=@var{region}
12385 @opindex fira-region
12386 Use specified regions for the integrated register allocator.  The
12387 @var{region} argument should be one of the following:
12389 @table @samp
12391 @item all
12392 Use all loops as register allocation regions.
12393 This can give the best results for machines with a small and/or
12394 irregular register set.
12396 @item mixed
12397 Use all loops except for loops with small register pressure 
12398 as the regions.  This value usually gives
12399 the best results in most cases and for most architectures,
12400 and is enabled by default when compiling with optimization for speed
12401 (@option{-O}, @option{-O2}, @dots{}).
12403 @item one
12404 Use all functions as a single region.  
12405 This typically results in the smallest code size, and is enabled by default for
12406 @option{-Os} or @option{-O0}.
12408 @end table
12410 @item -fira-hoist-pressure
12411 @opindex fira-hoist-pressure
12412 Use IRA to evaluate register pressure in the code hoisting pass for
12413 decisions to hoist expressions.  This option usually results in smaller
12414 code, but it can slow the compiler down.
12416 This option is enabled at level @option{-Os} for all targets.
12418 @item -fira-loop-pressure
12419 @opindex fira-loop-pressure
12420 Use IRA to evaluate register pressure in loops for decisions to move
12421 loop invariants.  This option usually results in generation
12422 of faster and smaller code on machines with large register files (>= 32
12423 registers), but it can slow the compiler down.
12425 This option is enabled at level @option{-O3} for some targets.
12427 @item -fno-ira-share-save-slots
12428 @opindex fno-ira-share-save-slots
12429 @opindex fira-share-save-slots
12430 Disable sharing of stack slots used for saving call-used hard
12431 registers living through a call.  Each hard register gets a
12432 separate stack slot, and as a result function stack frames are
12433 larger.
12435 @item -fno-ira-share-spill-slots
12436 @opindex fno-ira-share-spill-slots
12437 @opindex fira-share-spill-slots
12438 Disable sharing of stack slots allocated for pseudo-registers.  Each
12439 pseudo-register that does not get a hard register gets a separate
12440 stack slot, and as a result function stack frames are larger.
12442 @item -flra-remat
12443 @opindex flra-remat
12444 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
12445 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12446 values if it is profitable.
12448 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12450 @item -fdelayed-branch
12451 @opindex fdelayed-branch
12452 If supported for the target machine, attempt to reorder instructions
12453 to exploit instruction slots available after delayed branch
12454 instructions.
12456 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12457 but not at @option{-Og}.
12459 @item -fschedule-insns
12460 @opindex fschedule-insns
12461 If supported for the target machine, attempt to reorder instructions to
12462 eliminate execution stalls due to required data being unavailable.  This
12463 helps machines that have slow floating point or memory load instructions
12464 by allowing other instructions to be issued until the result of the load
12465 or floating-point instruction is required.
12467 Enabled at levels @option{-O2}, @option{-O3}.
12469 @item -fschedule-insns2
12470 @opindex fschedule-insns2
12471 Similar to @option{-fschedule-insns}, but requests an additional pass of
12472 instruction scheduling after register allocation has been done.  This is
12473 especially useful on machines with a relatively small number of
12474 registers and where memory load instructions take more than one cycle.
12476 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12478 @item -fno-sched-interblock
12479 @opindex fno-sched-interblock
12480 @opindex fsched-interblock
12481 Disable instruction scheduling across basic blocks, which
12482 is normally enabled when scheduling before register allocation, i.e.@:
12483 with @option{-fschedule-insns} or at @option{-O2} or higher.
12485 @item -fno-sched-spec
12486 @opindex fno-sched-spec
12487 @opindex fsched-spec
12488 Disable speculative motion of non-load instructions, which
12489 is normally enabled when scheduling before register allocation, i.e.@:
12490 with @option{-fschedule-insns} or at @option{-O2} or higher.
12492 @item -fsched-pressure
12493 @opindex fsched-pressure
12494 Enable register pressure sensitive insn scheduling before register
12495 allocation.  This only makes sense when scheduling before register
12496 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12497 @option{-O2} or higher.  Usage of this option can improve the
12498 generated code and decrease its size by preventing register pressure
12499 increase above the number of available hard registers and subsequent
12500 spills in register allocation.
12502 @item -fsched-spec-load
12503 @opindex fsched-spec-load
12504 Allow speculative motion of some load instructions.  This only makes
12505 sense when scheduling before register allocation, i.e.@: with
12506 @option{-fschedule-insns} or at @option{-O2} or higher.
12508 @item -fsched-spec-load-dangerous
12509 @opindex fsched-spec-load-dangerous
12510 Allow speculative motion of more load instructions.  This only makes
12511 sense when scheduling before register allocation, i.e.@: with
12512 @option{-fschedule-insns} or at @option{-O2} or higher.
12514 @item -fsched-stalled-insns
12515 @itemx -fsched-stalled-insns=@var{n}
12516 @opindex fsched-stalled-insns
12517 Define how many insns (if any) can be moved prematurely from the queue
12518 of stalled insns into the ready list during the second scheduling pass.
12519 @option{-fno-sched-stalled-insns} means that no insns are moved
12520 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12521 on how many queued insns can be moved prematurely.
12522 @option{-fsched-stalled-insns} without a value is equivalent to
12523 @option{-fsched-stalled-insns=1}.
12525 @item -fsched-stalled-insns-dep
12526 @itemx -fsched-stalled-insns-dep=@var{n}
12527 @opindex fsched-stalled-insns-dep
12528 Define how many insn groups (cycles) are examined for a dependency
12529 on a stalled insn that is a candidate for premature removal from the queue
12530 of stalled insns.  This has an effect only during the second scheduling pass,
12531 and only if @option{-fsched-stalled-insns} is used.
12532 @option{-fno-sched-stalled-insns-dep} is equivalent to
12533 @option{-fsched-stalled-insns-dep=0}.
12534 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12535 @option{-fsched-stalled-insns-dep=1}.
12537 @item -fsched2-use-superblocks
12538 @opindex fsched2-use-superblocks
12539 When scheduling after register allocation, use superblock scheduling.
12540 This allows motion across basic block boundaries,
12541 resulting in faster schedules.  This option is experimental, as not all machine
12542 descriptions used by GCC model the CPU closely enough to avoid unreliable
12543 results from the algorithm.
12545 This only makes sense when scheduling after register allocation, i.e.@: with
12546 @option{-fschedule-insns2} or at @option{-O2} or higher.
12548 @item -fsched-group-heuristic
12549 @opindex fsched-group-heuristic
12550 Enable the group heuristic in the scheduler.  This heuristic favors
12551 the instruction that belongs to a schedule group.  This is enabled
12552 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12553 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12555 @item -fsched-critical-path-heuristic
12556 @opindex fsched-critical-path-heuristic
12557 Enable the critical-path heuristic in the scheduler.  This heuristic favors
12558 instructions on the critical path.  This is enabled by default when
12559 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12560 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12562 @item -fsched-spec-insn-heuristic
12563 @opindex fsched-spec-insn-heuristic
12564 Enable the speculative instruction heuristic in the scheduler.  This
12565 heuristic favors speculative instructions with greater dependency weakness.
12566 This is enabled by default when scheduling is enabled, i.e.@:
12567 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12568 or at @option{-O2} or higher.
12570 @item -fsched-rank-heuristic
12571 @opindex fsched-rank-heuristic
12572 Enable the rank heuristic in the scheduler.  This heuristic favors
12573 the instruction belonging to a basic block with greater size or frequency.
12574 This is enabled by default when scheduling is enabled, i.e.@:
12575 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12576 at @option{-O2} or higher.
12578 @item -fsched-last-insn-heuristic
12579 @opindex fsched-last-insn-heuristic
12580 Enable the last-instruction heuristic in the scheduler.  This heuristic
12581 favors the instruction that is less dependent on the last instruction
12582 scheduled.  This is enabled by default when scheduling is enabled,
12583 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12584 at @option{-O2} or higher.
12586 @item -fsched-dep-count-heuristic
12587 @opindex fsched-dep-count-heuristic
12588 Enable the dependent-count heuristic in the scheduler.  This heuristic
12589 favors the instruction that has more instructions depending on it.
12590 This is enabled by default when scheduling is enabled, i.e.@:
12591 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12592 at @option{-O2} or higher.
12594 @item -freschedule-modulo-scheduled-loops
12595 @opindex freschedule-modulo-scheduled-loops
12596 Modulo scheduling is performed before traditional scheduling.  If a loop
12597 is modulo scheduled, later scheduling passes may change its schedule.  
12598 Use this option to control that behavior.
12600 @item -fselective-scheduling
12601 @opindex fselective-scheduling
12602 Schedule instructions using selective scheduling algorithm.  Selective
12603 scheduling runs instead of the first scheduler pass.
12605 @item -fselective-scheduling2
12606 @opindex fselective-scheduling2
12607 Schedule instructions using selective scheduling algorithm.  Selective
12608 scheduling runs instead of the second scheduler pass.
12610 @item -fsel-sched-pipelining
12611 @opindex fsel-sched-pipelining
12612 Enable software pipelining of innermost loops during selective scheduling.
12613 This option has no effect unless one of @option{-fselective-scheduling} or
12614 @option{-fselective-scheduling2} is turned on.
12616 @item -fsel-sched-pipelining-outer-loops
12617 @opindex fsel-sched-pipelining-outer-loops
12618 When pipelining loops during selective scheduling, also pipeline outer loops.
12619 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
12621 @item -fsemantic-interposition
12622 @opindex fsemantic-interposition
12623 Some object formats, like ELF, allow interposing of symbols by the 
12624 dynamic linker.
12625 This means that for symbols exported from the DSO, the compiler cannot perform
12626 interprocedural propagation, inlining and other optimizations in anticipation
12627 that the function or variable in question may change. While this feature is
12628 useful, for example, to rewrite memory allocation functions by a debugging
12629 implementation, it is expensive in the terms of code quality.
12630 With @option{-fno-semantic-interposition} the compiler assumes that 
12631 if interposition happens for functions the overwriting function will have 
12632 precisely the same semantics (and side effects). 
12633 Similarly if interposition happens
12634 for variables, the constructor of the variable will be the same. The flag
12635 has no effect for functions explicitly declared inline 
12636 (where it is never allowed for interposition to change semantics) 
12637 and for symbols explicitly declared weak.
12639 @item -fshrink-wrap
12640 @opindex fshrink-wrap
12641 Emit function prologues only before parts of the function that need it,
12642 rather than at the top of the function.  This flag is enabled by default at
12643 @option{-O} and higher.
12645 @item -fshrink-wrap-separate
12646 @opindex fshrink-wrap-separate
12647 Shrink-wrap separate parts of the prologue and epilogue separately, so that
12648 those parts are only executed when needed.
12649 This option is on by default, but has no effect unless @option{-fshrink-wrap}
12650 is also turned on and the target supports this.
12652 @item -fcaller-saves
12653 @opindex fcaller-saves
12654 Enable allocation of values to registers that are clobbered by
12655 function calls, by emitting extra instructions to save and restore the
12656 registers around such calls.  Such allocation is done only when it
12657 seems to result in better code.
12659 This option is always enabled by default on certain machines, usually
12660 those which have no call-preserved registers to use instead.
12662 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12664 @item -fcombine-stack-adjustments
12665 @opindex fcombine-stack-adjustments
12666 Tracks stack adjustments (pushes and pops) and stack memory references
12667 and then tries to find ways to combine them.
12669 Enabled by default at @option{-O1} and higher.
12671 @item -fipa-ra
12672 @opindex fipa-ra
12673 Use caller save registers for allocation if those registers are not used by
12674 any called function.  In that case it is not necessary to save and restore
12675 them around calls.  This is only possible if called functions are part of
12676 same compilation unit as current function and they are compiled before it.
12678 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
12679 is disabled if generated code will be instrumented for profiling
12680 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
12681 exactly (this happens on targets that do not expose prologues
12682 and epilogues in RTL).
12684 @item -fconserve-stack
12685 @opindex fconserve-stack
12686 Attempt to minimize stack usage.  The compiler attempts to use less
12687 stack space, even if that makes the program slower.  This option
12688 implies setting the @option{large-stack-frame} parameter to 100
12689 and the @option{large-stack-frame-growth} parameter to 400.
12691 @item -ftree-reassoc
12692 @opindex ftree-reassoc
12693 Perform reassociation on trees.  This flag is enabled by default
12694 at @option{-O1} and higher.
12696 @item -fcode-hoisting
12697 @opindex fcode-hoisting
12698 Perform code hoisting.  Code hoisting tries to move the
12699 evaluation of expressions executed on all paths to the function exit
12700 as early as possible.  This is especially useful as a code size
12701 optimization, but it often helps for code speed as well.
12702 This flag is enabled by default at @option{-O2} and higher.
12704 @item -ftree-pre
12705 @opindex ftree-pre
12706 Perform partial redundancy elimination (PRE) on trees.  This flag is
12707 enabled by default at @option{-O2} and @option{-O3}.
12709 @item -ftree-partial-pre
12710 @opindex ftree-partial-pre
12711 Make partial redundancy elimination (PRE) more aggressive.  This flag is
12712 enabled by default at @option{-O3}.
12714 @item -ftree-forwprop
12715 @opindex ftree-forwprop
12716 Perform forward propagation on trees.  This flag is enabled by default
12717 at @option{-O1} and higher.
12719 @item -ftree-fre
12720 @opindex ftree-fre
12721 Perform full redundancy elimination (FRE) on trees.  The difference
12722 between FRE and PRE is that FRE only considers expressions
12723 that are computed on all paths leading to the redundant computation.
12724 This analysis is faster than PRE, though it exposes fewer redundancies.
12725 This flag is enabled by default at @option{-O1} and higher.
12727 @item -ftree-phiprop
12728 @opindex ftree-phiprop
12729 Perform hoisting of loads from conditional pointers on trees.  This
12730 pass is enabled by default at @option{-O1} and higher.
12732 @item -fhoist-adjacent-loads
12733 @opindex fhoist-adjacent-loads
12734 Speculatively hoist loads from both branches of an if-then-else if the
12735 loads are from adjacent locations in the same structure and the target
12736 architecture has a conditional move instruction.  This flag is enabled
12737 by default at @option{-O2} and higher.
12739 @item -ftree-copy-prop
12740 @opindex ftree-copy-prop
12741 Perform copy propagation on trees.  This pass eliminates unnecessary
12742 copy operations.  This flag is enabled by default at @option{-O1} and
12743 higher.
12745 @item -fipa-pure-const
12746 @opindex fipa-pure-const
12747 Discover which functions are pure or constant.
12748 Enabled by default at @option{-O1} and higher.
12750 @item -fipa-reference
12751 @opindex fipa-reference
12752 Discover which static variables do not escape the
12753 compilation unit.
12754 Enabled by default at @option{-O1} and higher.
12756 @item -fipa-reference-addressable
12757 @opindex fipa-reference-addressable
12758 Discover read-only, write-only and non-addressable static variables.
12759 Enabled by default at @option{-O1} and higher.
12761 @item -fipa-stack-alignment
12762 @opindex fipa-stack-alignment
12763 Reduce stack alignment on call sites if possible.
12764 Enabled by default.
12766 @item -fipa-pta
12767 @opindex fipa-pta
12768 Perform interprocedural pointer analysis and interprocedural modification
12769 and reference analysis.  This option can cause excessive memory and
12770 compile-time usage on large compilation units.  It is not enabled by
12771 default at any optimization level.
12773 @item -fipa-profile
12774 @opindex fipa-profile
12775 Perform interprocedural profile propagation.  The functions called only from
12776 cold functions are marked as cold. Also functions executed once (such as
12777 @code{cold}, @code{noreturn}, static constructors or destructors) are
12778 identified. Cold functions and loop less parts of functions executed once are
12779 then optimized for size.
12780 Enabled by default at @option{-O1} and higher.
12782 @item -fipa-modref
12783 @opindex fipa-modref
12784 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
12785 effects of functions (memory locations that are modified or referenced) and
12786 enables better optimization across the function call boundary.  This flag is
12787 enabled by default at @option{-O1} and higher.
12789 @item -fipa-cp
12790 @opindex fipa-cp
12791 Perform interprocedural constant propagation.
12792 This optimization analyzes the program to determine when values passed
12793 to functions are constants and then optimizes accordingly.
12794 This optimization can substantially increase performance
12795 if the application has constants passed to functions.
12796 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
12797 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12799 @item -fipa-cp-clone
12800 @opindex fipa-cp-clone
12801 Perform function cloning to make interprocedural constant propagation stronger.
12802 When enabled, interprocedural constant propagation performs function cloning
12803 when externally visible function can be called with constant arguments.
12804 Because this optimization can create multiple copies of functions,
12805 it may significantly increase code size
12806 (see @option{--param ipa-cp-unit-growth=@var{value}}).
12807 This flag is enabled by default at @option{-O3}.
12808 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12810 @item -fipa-bit-cp
12811 @opindex fipa-bit-cp
12812 When enabled, perform interprocedural bitwise constant
12813 propagation. This flag is enabled by default at @option{-O2} and
12814 by @option{-fprofile-use} and @option{-fauto-profile}.
12815 It requires that @option{-fipa-cp} is enabled.  
12817 @item -fipa-vrp
12818 @opindex fipa-vrp
12819 When enabled, perform interprocedural propagation of value
12820 ranges. This flag is enabled by default at @option{-O2}. It requires
12821 that @option{-fipa-cp} is enabled.
12823 @item -fipa-icf
12824 @opindex fipa-icf
12825 Perform Identical Code Folding for functions and read-only variables.
12826 The optimization reduces code size and may disturb unwind stacks by replacing
12827 a function by equivalent one with a different name. The optimization works
12828 more effectively with link-time optimization enabled.
12830 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
12831 works on different levels and thus the optimizations are not same - there are
12832 equivalences that are found only by GCC and equivalences found only by Gold.
12834 This flag is enabled by default at @option{-O2} and @option{-Os}.
12836 @item -flive-patching=@var{level}
12837 @opindex flive-patching
12838 Control GCC's optimizations to produce output suitable for live-patching.
12840 If the compiler's optimization uses a function's body or information extracted
12841 from its body to optimize/change another function, the latter is called an
12842 impacted function of the former.  If a function is patched, its impacted
12843 functions should be patched too.
12845 The impacted functions are determined by the compiler's interprocedural
12846 optimizations.  For example, a caller is impacted when inlining a function
12847 into its caller,
12848 cloning a function and changing its caller to call this new clone,
12849 or extracting a function's pureness/constness information to optimize
12850 its direct or indirect callers, etc.
12852 Usually, the more IPA optimizations enabled, the larger the number of
12853 impacted functions for each function.  In order to control the number of
12854 impacted functions and more easily compute the list of impacted function,
12855 IPA optimizations can be partially enabled at two different levels.
12857 The @var{level} argument should be one of the following:
12859 @table @samp
12861 @item inline-clone
12863 Only enable inlining and cloning optimizations, which includes inlining,
12864 cloning, interprocedural scalar replacement of aggregates and partial inlining.
12865 As a result, when patching a function, all its callers and its clones'
12866 callers are impacted, therefore need to be patched as well.
12868 @option{-flive-patching=inline-clone} disables the following optimization flags:
12869 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra @gol
12870 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables @gol
12871 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const  -fipa-reference-addressable @gol
12872 -fipa-stack-alignment -fipa-modref}
12874 @item inline-only-static
12876 Only enable inlining of static functions.
12877 As a result, when patching a static function, all its callers are impacted
12878 and so need to be patched as well.
12880 In addition to all the flags that @option{-flive-patching=inline-clone}
12881 disables,
12882 @option{-flive-patching=inline-only-static} disables the following additional
12883 optimization flags:
12884 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
12886 @end table
12888 When @option{-flive-patching} is specified without any value, the default value
12889 is @var{inline-clone}.
12891 This flag is disabled by default.
12893 Note that @option{-flive-patching} is not supported with link-time optimization
12894 (@option{-flto}).
12896 @item -fisolate-erroneous-paths-dereference
12897 @opindex fisolate-erroneous-paths-dereference
12898 Detect paths that trigger erroneous or undefined behavior due to
12899 dereferencing a null pointer.  Isolate those paths from the main control
12900 flow and turn the statement with erroneous or undefined behavior into a trap.
12901 This flag is enabled by default at @option{-O2} and higher and depends on
12902 @option{-fdelete-null-pointer-checks} also being enabled.
12904 @item -fisolate-erroneous-paths-attribute
12905 @opindex fisolate-erroneous-paths-attribute
12906 Detect paths that trigger erroneous or undefined behavior due to a null value
12907 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
12908 attribute.  Isolate those paths from the main control flow and turn the
12909 statement with erroneous or undefined behavior into a trap.  This is not
12910 currently enabled, but may be enabled by @option{-O2} in the future.
12912 @item -ftree-sink
12913 @opindex ftree-sink
12914 Perform forward store motion on trees.  This flag is
12915 enabled by default at @option{-O1} and higher.
12917 @item -ftree-bit-ccp
12918 @opindex ftree-bit-ccp
12919 Perform sparse conditional bit constant propagation on trees and propagate
12920 pointer alignment information.
12921 This pass only operates on local scalar variables and is enabled by default
12922 at @option{-O1} and higher, except for @option{-Og}.
12923 It requires that @option{-ftree-ccp} is enabled.
12925 @item -ftree-ccp
12926 @opindex ftree-ccp
12927 Perform sparse conditional constant propagation (CCP) on trees.  This
12928 pass only operates on local scalar variables and is enabled by default
12929 at @option{-O1} and higher.
12931 @item -fssa-backprop
12932 @opindex fssa-backprop
12933 Propagate information about uses of a value up the definition chain
12934 in order to simplify the definitions.  For example, this pass strips
12935 sign operations if the sign of a value never matters.  The flag is
12936 enabled by default at @option{-O1} and higher.
12938 @item -fssa-phiopt
12939 @opindex fssa-phiopt
12940 Perform pattern matching on SSA PHI nodes to optimize conditional
12941 code.  This pass is enabled by default at @option{-O1} and higher,
12942 except for @option{-Og}.
12944 @item -ftree-switch-conversion
12945 @opindex ftree-switch-conversion
12946 Perform conversion of simple initializations in a switch to
12947 initializations from a scalar array.  This flag is enabled by default
12948 at @option{-O2} and higher.
12950 @item -ftree-tail-merge
12951 @opindex ftree-tail-merge
12952 Look for identical code sequences.  When found, replace one with a jump to the
12953 other.  This optimization is known as tail merging or cross jumping.  This flag
12954 is enabled by default at @option{-O2} and higher.  The compilation time
12955 in this pass can
12956 be limited using @option{max-tail-merge-comparisons} parameter and
12957 @option{max-tail-merge-iterations} parameter.
12959 @item -ftree-dce
12960 @opindex ftree-dce
12961 Perform dead code elimination (DCE) on trees.  This flag is enabled by
12962 default at @option{-O1} and higher.
12964 @item -ftree-builtin-call-dce
12965 @opindex ftree-builtin-call-dce
12966 Perform conditional dead code elimination (DCE) for calls to built-in functions
12967 that may set @code{errno} but are otherwise free of side effects.  This flag is
12968 enabled by default at @option{-O2} and higher if @option{-Os} is not also
12969 specified.
12971 @item -ffinite-loops
12972 @opindex ffinite-loops
12973 @opindex fno-finite-loops
12974 Assume that a loop with an exit will eventually take the exit and not loop
12975 indefinitely.  This allows the compiler to remove loops that otherwise have
12976 no side-effects, not considering eventual endless looping as such.
12978 This option is enabled by default at @option{-O2} for C++ with -std=c++11
12979 or higher.
12981 @item -ftree-dominator-opts
12982 @opindex ftree-dominator-opts
12983 Perform a variety of simple scalar cleanups (constant/copy
12984 propagation, redundancy elimination, range propagation and expression
12985 simplification) based on a dominator tree traversal.  This also
12986 performs jump threading (to reduce jumps to jumps). This flag is
12987 enabled by default at @option{-O1} and higher.
12989 @item -ftree-dse
12990 @opindex ftree-dse
12991 Perform dead store elimination (DSE) on trees.  A dead store is a store into
12992 a memory location that is later overwritten by another store without
12993 any intervening loads.  In this case the earlier store can be deleted.  This
12994 flag is enabled by default at @option{-O1} and higher.
12996 @item -ftree-ch
12997 @opindex ftree-ch
12998 Perform loop header copying on trees.  This is beneficial since it increases
12999 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13000 is enabled by default at @option{-O1} and higher.  It is not enabled
13001 for @option{-Os}, since it usually increases code size.
13003 @item -ftree-loop-optimize
13004 @opindex ftree-loop-optimize
13005 Perform loop optimizations on trees.  This flag is enabled by default
13006 at @option{-O1} and higher.
13008 @item -ftree-loop-linear
13009 @itemx -floop-strip-mine
13010 @itemx -floop-block
13011 @opindex ftree-loop-linear
13012 @opindex floop-strip-mine
13013 @opindex floop-block
13014 Perform loop nest optimizations.  Same as
13015 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13016 to be configured with @option{--with-isl} to enable the Graphite loop
13017 transformation infrastructure.
13019 @item -fgraphite-identity
13020 @opindex fgraphite-identity
13021 Enable the identity transformation for graphite.  For every SCoP we generate
13022 the polyhedral representation and transform it back to gimple.  Using
13023 @option{-fgraphite-identity} we can check the costs or benefits of the
13024 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13025 are also performed by the code generator isl, like index splitting and
13026 dead code elimination in loops.
13028 @item -floop-nest-optimize
13029 @opindex floop-nest-optimize
13030 Enable the isl based loop nest optimizer.  This is a generic loop nest
13031 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13032 structure optimized for data-locality and parallelism.  This option
13033 is experimental.
13035 @item -floop-parallelize-all
13036 @opindex floop-parallelize-all
13037 Use the Graphite data dependence analysis to identify loops that can
13038 be parallelized.  Parallelize all the loops that can be analyzed to
13039 not contain loop carried dependences without checking that it is
13040 profitable to parallelize the loops.
13042 @item -ftree-coalesce-vars
13043 @opindex ftree-coalesce-vars
13044 While transforming the program out of the SSA representation, attempt to
13045 reduce copying by coalescing versions of different user-defined
13046 variables, instead of just compiler temporaries.  This may severely
13047 limit the ability to debug an optimized program compiled with
13048 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13049 prevents SSA coalescing of user variables.  This option is enabled by
13050 default if optimization is enabled, and it does very little otherwise.
13052 @item -ftree-loop-if-convert
13053 @opindex ftree-loop-if-convert
13054 Attempt to transform conditional jumps in the innermost loops to
13055 branch-less equivalents.  The intent is to remove control-flow from
13056 the innermost loops in order to improve the ability of the
13057 vectorization pass to handle these loops.  This is enabled by default
13058 if vectorization is enabled.
13060 @item -ftree-loop-distribution
13061 @opindex ftree-loop-distribution
13062 Perform loop distribution.  This flag can improve cache performance on
13063 big loop bodies and allow further loop optimizations, like
13064 parallelization or vectorization, to take place.  For example, the loop
13065 @smallexample
13066 DO I = 1, N
13067   A(I) = B(I) + C
13068   D(I) = E(I) * F
13069 ENDDO
13070 @end smallexample
13071 is transformed to
13072 @smallexample
13073 DO I = 1, N
13074    A(I) = B(I) + C
13075 ENDDO
13076 DO I = 1, N
13077    D(I) = E(I) * F
13078 ENDDO
13079 @end smallexample
13080 This flag is enabled by default at @option{-O3}.
13081 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13083 @item -ftree-loop-distribute-patterns
13084 @opindex ftree-loop-distribute-patterns
13085 Perform loop distribution of patterns that can be code generated with
13086 calls to a library.  This flag is enabled by default at @option{-O2} and
13087 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13089 This pass distributes the initialization loops and generates a call to
13090 memset zero.  For example, the loop
13091 @smallexample
13092 DO I = 1, N
13093   A(I) = 0
13094   B(I) = A(I) + I
13095 ENDDO
13096 @end smallexample
13097 is transformed to
13098 @smallexample
13099 DO I = 1, N
13100    A(I) = 0
13101 ENDDO
13102 DO I = 1, N
13103    B(I) = A(I) + I
13104 ENDDO
13105 @end smallexample
13106 and the initialization loop is transformed into a call to memset zero.
13107 This flag is enabled by default at @option{-O3}.
13108 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13110 @item -floop-interchange
13111 @opindex floop-interchange
13112 Perform loop interchange outside of graphite.  This flag can improve cache
13113 performance on loop nest and allow further loop optimizations, like
13114 vectorization, to take place.  For example, the loop
13115 @smallexample
13116 for (int i = 0; i < N; i++)
13117   for (int j = 0; j < N; j++)
13118     for (int k = 0; k < N; k++)
13119       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13120 @end smallexample
13121 is transformed to
13122 @smallexample
13123 for (int i = 0; i < N; i++)
13124   for (int k = 0; k < N; k++)
13125     for (int j = 0; j < N; j++)
13126       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13127 @end smallexample
13128 This flag is enabled by default at @option{-O3}.
13129 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13131 @item -floop-unroll-and-jam
13132 @opindex floop-unroll-and-jam
13133 Apply unroll and jam transformations on feasible loops.  In a loop
13134 nest this unrolls the outer loop by some factor and fuses the resulting
13135 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13136 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13138 @item -ftree-loop-im
13139 @opindex ftree-loop-im
13140 Perform loop invariant motion on trees.  This pass moves only invariants that
13141 are hard to handle at RTL level (function calls, operations that expand to
13142 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13143 operands of conditions that are invariant out of the loop, so that we can use
13144 just trivial invariantness analysis in loop unswitching.  The pass also includes
13145 store motion.
13147 @item -ftree-loop-ivcanon
13148 @opindex ftree-loop-ivcanon
13149 Create a canonical counter for number of iterations in loops for which
13150 determining number of iterations requires complicated analysis.  Later
13151 optimizations then may determine the number easily.  Useful especially
13152 in connection with unrolling.
13154 @item -ftree-scev-cprop
13155 @opindex ftree-scev-cprop
13156 Perform final value replacement.  If a variable is modified in a loop
13157 in such a way that its value when exiting the loop can be determined using
13158 only its initial value and the number of loop iterations, replace uses of
13159 the final value by such a computation, provided it is sufficiently cheap.
13160 This reduces data dependencies and may allow further simplifications.
13161 Enabled by default at @option{-O1} and higher.
13163 @item -fivopts
13164 @opindex fivopts
13165 Perform induction variable optimizations (strength reduction, induction
13166 variable merging and induction variable elimination) on trees.
13168 @item -ftree-parallelize-loops=n
13169 @opindex ftree-parallelize-loops
13170 Parallelize loops, i.e., split their iteration space to run in n threads.
13171 This is only possible for loops whose iterations are independent
13172 and can be arbitrarily reordered.  The optimization is only
13173 profitable on multiprocessor machines, for loops that are CPU-intensive,
13174 rather than constrained e.g.@: by memory bandwidth.  This option
13175 implies @option{-pthread}, and thus is only supported on targets
13176 that have support for @option{-pthread}.
13178 @item -ftree-pta
13179 @opindex ftree-pta
13180 Perform function-local points-to analysis on trees.  This flag is
13181 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13183 @item -ftree-sra
13184 @opindex ftree-sra
13185 Perform scalar replacement of aggregates.  This pass replaces structure
13186 references with scalars to prevent committing structures to memory too
13187 early.  This flag is enabled by default at @option{-O1} and higher,
13188 except for @option{-Og}.
13190 @item -fstore-merging
13191 @opindex fstore-merging
13192 Perform merging of narrow stores to consecutive memory addresses.  This pass
13193 merges contiguous stores of immediate values narrower than a word into fewer
13194 wider stores to reduce the number of instructions.  This is enabled by default
13195 at @option{-O2} and higher as well as @option{-Os}.
13197 @item -ftree-ter
13198 @opindex ftree-ter
13199 Perform temporary expression replacement during the SSA->normal phase.  Single
13200 use/single def temporaries are replaced at their use location with their
13201 defining expression.  This results in non-GIMPLE code, but gives the expanders
13202 much more complex trees to work on resulting in better RTL generation.  This is
13203 enabled by default at @option{-O1} and higher.
13205 @item -ftree-slsr
13206 @opindex ftree-slsr
13207 Perform straight-line strength reduction on trees.  This recognizes related
13208 expressions involving multiplications and replaces them by less expensive
13209 calculations when possible.  This is enabled by default at @option{-O1} and
13210 higher.
13212 @item -ftree-vectorize
13213 @opindex ftree-vectorize
13214 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13215 and @option{-ftree-slp-vectorize} if not explicitly specified.
13217 @item -ftree-loop-vectorize
13218 @opindex ftree-loop-vectorize
13219 Perform loop vectorization on trees. This flag is enabled by default at
13220 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13221 and @option{-fauto-profile}.
13223 @item -ftree-slp-vectorize
13224 @opindex ftree-slp-vectorize
13225 Perform basic block vectorization on trees. This flag is enabled by default at
13226 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13227 and @option{-fauto-profile}.
13229 @item -ftrivial-auto-var-init=@var{choice}
13230 @opindex ftrivial-auto-var-init
13231 Initialize automatic variables with either a pattern or with zeroes to increase
13232 the security and predictability of a program by preventing uninitialized memory
13233 disclosure and use.
13234 GCC still considers an automatic variable that doesn't have an explicit
13235 initializer as uninitialized, @option{-Wuninitialized} and
13236 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13237 warning messages on such automatic variables and the compiler will
13238 perform optimization as if the variable were uninitialized.
13239 With this option, GCC will also initialize any padding of automatic variables
13240 that have structure or union types to zeroes.
13241 However, the current implementation cannot initialize automatic variables that
13242 are declared between the controlling expression and the first case of a
13243 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13244 such cases.
13246 The three values of @var{choice} are:
13248 @itemize @bullet
13249 @item
13250 @samp{uninitialized} doesn't initialize any automatic variables.
13251 This is C and C++'s default.
13253 @item
13254 @samp{pattern} Initialize automatic variables with values which will likely
13255 transform logic bugs into crashes down the line, are easily recognized in a
13256 crash dump and without being values that programmers can rely on for useful
13257 program semantics.
13258 The current value is byte-repeatable pattern with byte "0xFE".
13259 The values used for pattern initialization might be changed in the future.
13261 @item
13262 @samp{zero} Initialize automatic variables with zeroes.
13263 @end itemize
13265 The default is @samp{uninitialized}.
13267 You can control this behavior for a specific variable by using the variable
13268 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13270 @item -fvect-cost-model=@var{model}
13271 @opindex fvect-cost-model
13272 Alter the cost model used for vectorization.  The @var{model} argument
13273 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13274 @samp{very-cheap}.
13275 With the @samp{unlimited} model the vectorized code-path is assumed
13276 to be profitable while with the @samp{dynamic} model a runtime check
13277 guards the vectorized code-path to enable it only for iteration
13278 counts that will likely execute faster than when executing the original
13279 scalar loop.  The @samp{cheap} model disables vectorization of
13280 loops where doing so would be cost prohibitive for example due to
13281 required runtime checks for data dependence or alignment but otherwise
13282 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
13283 allows vectorization if the vector code would entirely replace the
13284 scalar code that is being vectorized.  For example, if each iteration
13285 of a vectorized loop would only be able to handle exactly four iterations
13286 of the scalar loop, the @samp{very-cheap} model would only allow
13287 vectorization if the scalar iteration count is known to be a multiple
13288 of four.
13290 The default cost model depends on other optimization flags and is
13291 either @samp{dynamic} or @samp{cheap}.
13293 @item -fsimd-cost-model=@var{model}
13294 @opindex fsimd-cost-model
13295 Alter the cost model used for vectorization of loops marked with the OpenMP
13296 simd directive.  The @var{model} argument should be one of
13297 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
13298 have the same meaning as described in @option{-fvect-cost-model} and by
13299 default a cost model defined with @option{-fvect-cost-model} is used.
13301 @item -ftree-vrp
13302 @opindex ftree-vrp
13303 Perform Value Range Propagation on trees.  This is similar to the
13304 constant propagation pass, but instead of values, ranges of values are
13305 propagated.  This allows the optimizers to remove unnecessary range
13306 checks like array bound checks and null pointer checks.  This is
13307 enabled by default at @option{-O2} and higher.  Null pointer check
13308 elimination is only done if @option{-fdelete-null-pointer-checks} is
13309 enabled.
13311 @item -fsplit-paths
13312 @opindex fsplit-paths
13313 Split paths leading to loop backedges.  This can improve dead code
13314 elimination and common subexpression elimination.  This is enabled by
13315 default at @option{-O3} and above.
13317 @item -fsplit-ivs-in-unroller
13318 @opindex fsplit-ivs-in-unroller
13319 Enables expression of values of induction variables in later iterations
13320 of the unrolled loop using the value in the first iteration.  This breaks
13321 long dependency chains, thus improving efficiency of the scheduling passes.
13323 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13324 same effect.  However, that is not reliable in cases where the loop body
13325 is more complicated than a single basic block.  It also does not work at all
13326 on some architectures due to restrictions in the CSE pass.
13328 This optimization is enabled by default.
13330 @item -fvariable-expansion-in-unroller
13331 @opindex fvariable-expansion-in-unroller
13332 With this option, the compiler creates multiple copies of some
13333 local variables when unrolling a loop, which can result in superior code.
13335 This optimization is enabled by default for PowerPC targets, but disabled
13336 by default otherwise.
13338 @item -fpartial-inlining
13339 @opindex fpartial-inlining
13340 Inline parts of functions.  This option has any effect only
13341 when inlining itself is turned on by the @option{-finline-functions}
13342 or @option{-finline-small-functions} options.
13344 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13346 @item -fpredictive-commoning
13347 @opindex fpredictive-commoning
13348 Perform predictive commoning optimization, i.e., reusing computations
13349 (especially memory loads and stores) performed in previous
13350 iterations of loops.
13352 This option is enabled at level @option{-O3}.
13353 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13355 @item -fprefetch-loop-arrays
13356 @opindex fprefetch-loop-arrays
13357 If supported by the target machine, generate instructions to prefetch
13358 memory to improve the performance of loops that access large arrays.
13360 This option may generate better or worse code; results are highly
13361 dependent on the structure of loops within the source code.
13363 Disabled at level @option{-Os}.
13365 @item -fno-printf-return-value
13366 @opindex fno-printf-return-value
13367 @opindex fprintf-return-value
13368 Do not substitute constants for known return value of formatted output
13369 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13370 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
13371 transformation allows GCC to optimize or even eliminate branches based
13372 on the known return value of these functions called with arguments that
13373 are either constant, or whose values are known to be in a range that
13374 makes determining the exact return value possible.  For example, when
13375 @option{-fprintf-return-value} is in effect, both the branch and the
13376 body of the @code{if} statement (but not the call to @code{snprint})
13377 can be optimized away when @code{i} is a 32-bit or smaller integer
13378 because the return value is guaranteed to be at most 8.
13380 @smallexample
13381 char buf[9];
13382 if (snprintf (buf, "%08x", i) >= sizeof buf)
13383   @dots{}
13384 @end smallexample
13386 The @option{-fprintf-return-value} option relies on other optimizations
13387 and yields best results with @option{-O2} and above.  It works in tandem
13388 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13389 options.  The @option{-fprintf-return-value} option is enabled by default.
13391 @item -fno-peephole
13392 @itemx -fno-peephole2
13393 @opindex fno-peephole
13394 @opindex fpeephole
13395 @opindex fno-peephole2
13396 @opindex fpeephole2
13397 Disable any machine-specific peephole optimizations.  The difference
13398 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13399 are implemented in the compiler; some targets use one, some use the
13400 other, a few use both.
13402 @option{-fpeephole} is enabled by default.
13403 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13405 @item -fno-guess-branch-probability
13406 @opindex fno-guess-branch-probability
13407 @opindex fguess-branch-probability
13408 Do not guess branch probabilities using heuristics.
13410 GCC uses heuristics to guess branch probabilities if they are
13411 not provided by profiling feedback (@option{-fprofile-arcs}).  These
13412 heuristics are based on the control flow graph.  If some branch probabilities
13413 are specified by @code{__builtin_expect}, then the heuristics are
13414 used to guess branch probabilities for the rest of the control flow graph,
13415 taking the @code{__builtin_expect} info into account.  The interactions
13416 between the heuristics and @code{__builtin_expect} can be complex, and in
13417 some cases, it may be useful to disable the heuristics so that the effects
13418 of @code{__builtin_expect} are easier to understand.
13420 It is also possible to specify expected probability of the expression
13421 with @code{__builtin_expect_with_probability} built-in function.
13423 The default is @option{-fguess-branch-probability} at levels
13424 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13426 @item -freorder-blocks
13427 @opindex freorder-blocks
13428 Reorder basic blocks in the compiled function in order to reduce number of
13429 taken branches and improve code locality.
13431 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13433 @item -freorder-blocks-algorithm=@var{algorithm}
13434 @opindex freorder-blocks-algorithm
13435 Use the specified algorithm for basic block reordering.  The
13436 @var{algorithm} argument can be @samp{simple}, which does not increase
13437 code size (except sometimes due to secondary effects like alignment),
13438 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13439 put all often executed code together, minimizing the number of branches
13440 executed by making extra copies of code.
13442 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13443 @samp{stc} at levels @option{-O2}, @option{-O3}.
13445 @item -freorder-blocks-and-partition
13446 @opindex freorder-blocks-and-partition
13447 In addition to reordering basic blocks in the compiled function, in order
13448 to reduce number of taken branches, partitions hot and cold basic blocks
13449 into separate sections of the assembly and @file{.o} files, to improve
13450 paging and cache locality performance.
13452 This optimization is automatically turned off in the presence of
13453 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13454 section attribute and on any architecture that does not support named
13455 sections.  When @option{-fsplit-stack} is used this option is not
13456 enabled by default (to avoid linker errors), but may be enabled
13457 explicitly (if using a working linker).
13459 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13461 @item -freorder-functions
13462 @opindex freorder-functions
13463 Reorder functions in the object file in order to
13464 improve code locality.  This is implemented by using special
13465 subsections @code{.text.hot} for most frequently executed functions and
13466 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
13467 the linker so object file format must support named sections and linker must
13468 place them in a reasonable way.
13470 This option isn't effective unless you either provide profile feedback
13471 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
13472 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13474 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13476 @item -fstrict-aliasing
13477 @opindex fstrict-aliasing
13478 Allow the compiler to assume the strictest aliasing rules applicable to
13479 the language being compiled.  For C (and C++), this activates
13480 optimizations based on the type of expressions.  In particular, an
13481 object of one type is assumed never to reside at the same address as an
13482 object of a different type, unless the types are almost the same.  For
13483 example, an @code{unsigned int} can alias an @code{int}, but not a
13484 @code{void*} or a @code{double}.  A character type may alias any other
13485 type.
13487 @anchor{Type-punning}Pay special attention to code like this:
13488 @smallexample
13489 union a_union @{
13490   int i;
13491   double d;
13494 int f() @{
13495   union a_union t;
13496   t.d = 3.0;
13497   return t.i;
13499 @end smallexample
13500 The practice of reading from a different union member than the one most
13501 recently written to (called ``type-punning'') is common.  Even with
13502 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13503 is accessed through the union type.  So, the code above works as
13504 expected.  @xref{Structures unions enumerations and bit-fields
13505 implementation}.  However, this code might not:
13506 @smallexample
13507 int f() @{
13508   union a_union t;
13509   int* ip;
13510   t.d = 3.0;
13511   ip = &t.i;
13512   return *ip;
13514 @end smallexample
13516 Similarly, access by taking the address, casting the resulting pointer
13517 and dereferencing the result has undefined behavior, even if the cast
13518 uses a union type, e.g.:
13519 @smallexample
13520 int f() @{
13521   double d = 3.0;
13522   return ((union a_union *) &d)->i;
13524 @end smallexample
13526 The @option{-fstrict-aliasing} option is enabled at levels
13527 @option{-O2}, @option{-O3}, @option{-Os}.
13529 @item -fipa-strict-aliasing
13530 @opindex fipa-strict-aliasing
13531 Controls whether rules of @option{-fstrict-aliasing} are applied across
13532 function boundaries.  Note that if multiple functions gets inlined into a
13533 single function the memory accesses are no longer considered to be crossing a
13534 function boundary.
13536 The @option{-fipa-strict-aliasing} option is enabled by default and is
13537 effective only in combination with @option{-fstrict-aliasing}.
13539 @item -falign-functions
13540 @itemx -falign-functions=@var{n}
13541 @itemx -falign-functions=@var{n}:@var{m}
13542 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13543 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13544 @opindex falign-functions
13545 Align the start of functions to the next power-of-two greater than or
13546 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
13547 least the first @var{m} bytes of the function can be fetched by the CPU
13548 without crossing an @var{n}-byte alignment boundary.
13550 If @var{m} is not specified, it defaults to @var{n}.
13552 Examples: @option{-falign-functions=32} aligns functions to the next
13553 32-byte boundary, @option{-falign-functions=24} aligns to the next
13554 32-byte boundary only if this can be done by skipping 23 bytes or less,
13555 @option{-falign-functions=32:7} aligns to the next
13556 32-byte boundary only if this can be done by skipping 6 bytes or less.
13558 The second pair of @var{n2}:@var{m2} values allows you to specify
13559 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13560 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13561 otherwise aligns to the next 32-byte boundary if this can be done
13562 by skipping 2 bytes or less.
13563 If @var{m2} is not specified, it defaults to @var{n2}.
13565 Some assemblers only support this flag when @var{n} is a power of two;
13566 in that case, it is rounded up.
13568 @option{-fno-align-functions} and @option{-falign-functions=1} are
13569 equivalent and mean that functions are not aligned.
13571 If @var{n} is not specified or is zero, use a machine-dependent default.
13572 The maximum allowed @var{n} option value is 65536.
13574 Enabled at levels @option{-O2}, @option{-O3}.
13576 @item -flimit-function-alignment
13577 If this option is enabled, the compiler tries to avoid unnecessarily
13578 overaligning functions. It attempts to instruct the assembler to align
13579 by the amount specified by @option{-falign-functions}, but not to
13580 skip more bytes than the size of the function.
13582 @item -falign-labels
13583 @itemx -falign-labels=@var{n}
13584 @itemx -falign-labels=@var{n}:@var{m}
13585 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13586 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13587 @opindex falign-labels
13588 Align all branch targets to a power-of-two boundary.
13590 Parameters of this option are analogous to the @option{-falign-functions} option.
13591 @option{-fno-align-labels} and @option{-falign-labels=1} are
13592 equivalent and mean that labels are not aligned.
13594 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13595 are greater than this value, then their values are used instead.
13597 If @var{n} is not specified or is zero, use a machine-dependent default
13598 which is very likely to be @samp{1}, meaning no alignment.
13599 The maximum allowed @var{n} option value is 65536.
13601 Enabled at levels @option{-O2}, @option{-O3}.
13603 @item -falign-loops
13604 @itemx -falign-loops=@var{n}
13605 @itemx -falign-loops=@var{n}:@var{m}
13606 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
13607 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
13608 @opindex falign-loops
13609 Align loops to a power-of-two boundary.  If the loops are executed
13610 many times, this makes up for any execution of the dummy padding
13611 instructions.
13613 If @option{-falign-labels} is greater than this value, then its value
13614 is used instead.
13616 Parameters of this option are analogous to the @option{-falign-functions} option.
13617 @option{-fno-align-loops} and @option{-falign-loops=1} are
13618 equivalent and mean that loops are not aligned.
13619 The maximum allowed @var{n} option value is 65536.
13621 If @var{n} is not specified or is zero, use a machine-dependent default.
13623 Enabled at levels @option{-O2}, @option{-O3}.
13625 @item -falign-jumps
13626 @itemx -falign-jumps=@var{n}
13627 @itemx -falign-jumps=@var{n}:@var{m}
13628 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
13629 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
13630 @opindex falign-jumps
13631 Align branch targets to a power-of-two boundary, for branch targets
13632 where the targets can only be reached by jumping.  In this case,
13633 no dummy operations need be executed.
13635 If @option{-falign-labels} is greater than this value, then its value
13636 is used instead.
13638 Parameters of this option are analogous to the @option{-falign-functions} option.
13639 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
13640 equivalent and mean that loops are not aligned.
13642 If @var{n} is not specified or is zero, use a machine-dependent default.
13643 The maximum allowed @var{n} option value is 65536.
13645 Enabled at levels @option{-O2}, @option{-O3}.
13647 @item -fno-allocation-dce
13648 @opindex fno-allocation-dce
13649 Do not remove unused C++ allocations in dead code elimination.
13651 @item -fallow-store-data-races
13652 @opindex fallow-store-data-races
13653 Allow the compiler to perform optimizations that may introduce new data races
13654 on stores, without proving that the variable cannot be concurrently accessed
13655 by other threads.  Does not affect optimization of local data.  It is safe to
13656 use this option if it is known that global data will not be accessed by
13657 multiple threads.
13659 Examples of optimizations enabled by @option{-fallow-store-data-races} include
13660 hoisting or if-conversions that may cause a value that was already in memory
13661 to be re-written with that same value.  Such re-writing is safe in a single
13662 threaded context but may be unsafe in a multi-threaded context.  Note that on
13663 some processors, if-conversions may be required in order to enable
13664 vectorization.
13666 Enabled at level @option{-Ofast}.
13668 @item -funit-at-a-time
13669 @opindex funit-at-a-time
13670 This option is left for compatibility reasons. @option{-funit-at-a-time}
13671 has no effect, while @option{-fno-unit-at-a-time} implies
13672 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
13674 Enabled by default.
13676 @item -fno-toplevel-reorder
13677 @opindex fno-toplevel-reorder
13678 @opindex ftoplevel-reorder
13679 Do not reorder top-level functions, variables, and @code{asm}
13680 statements.  Output them in the same order that they appear in the
13681 input file.  When this option is used, unreferenced static variables
13682 are not removed.  This option is intended to support existing code
13683 that relies on a particular ordering.  For new code, it is better to
13684 use attributes when possible.
13686 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
13687 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
13688 Additionally @option{-fno-toplevel-reorder} implies
13689 @option{-fno-section-anchors}.
13691 @item -funreachable-traps
13692 @opindex funreachable-traps
13693 With this option, the compiler turns calls to
13694 @code{__builtin_unreachable} into traps, instead of using them for
13695 optimization.  This also affects any such calls implicitly generated
13696 by the compiler.
13698 This option has the same effect as @option{-fsanitize=unreachable
13699 -fsanitize-trap=unreachable}, but does not affect the values of those
13700 options.  If @option{-fsanitize=unreachable} is enabled, that option
13701 takes priority over this one.
13703 This option is enabled by default at @option{-O0} and @option{-Og}.
13705 @item -fweb
13706 @opindex fweb
13707 Constructs webs as commonly used for register allocation purposes and assign
13708 each web individual pseudo register.  This allows the register allocation pass
13709 to operate on pseudos directly, but also strengthens several other optimization
13710 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
13711 however, make debugging impossible, since variables no longer stay in a
13712 ``home register''.
13714 Enabled by default with @option{-funroll-loops}.
13716 @item -fwhole-program
13717 @opindex fwhole-program
13718 Assume that the current compilation unit represents the whole program being
13719 compiled.  All public functions and variables with the exception of @code{main}
13720 and those merged by attribute @code{externally_visible} become static functions
13721 and in effect are optimized more aggressively by interprocedural optimizers.
13723 With @option{-flto} this option has a limited use.  In most cases the
13724 precise list of symbols used or exported from the binary is known the
13725 resolution info passed to the link-time optimizer by the linker plugin.  It is
13726 still useful if no linker plugin is used or during incremental link step when
13727 final code is produced (with @option{-flto}
13728 @option{-flinker-output=nolto-rel}).
13730 @item -flto[=@var{n}]
13731 @opindex flto
13732 This option runs the standard link-time optimizer.  When invoked
13733 with source code, it generates GIMPLE (one of GCC's internal
13734 representations) and writes it to special ELF sections in the object
13735 file.  When the object files are linked together, all the function
13736 bodies are read from these ELF sections and instantiated as if they
13737 had been part of the same translation unit.
13739 To use the link-time optimizer, @option{-flto} and optimization
13740 options should be specified at compile time and during the final link.
13741 It is recommended that you compile all the files participating in the
13742 same link with the same options and also specify those options at
13743 link time.  
13744 For example:
13746 @smallexample
13747 gcc -c -O2 -flto foo.c
13748 gcc -c -O2 -flto bar.c
13749 gcc -o myprog -flto -O2 foo.o bar.o
13750 @end smallexample
13752 The first two invocations to GCC save a bytecode representation
13753 of GIMPLE into special ELF sections inside @file{foo.o} and
13754 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
13755 @file{foo.o} and @file{bar.o}, merges the two files into a single
13756 internal image, and compiles the result as usual.  Since both
13757 @file{foo.o} and @file{bar.o} are merged into a single image, this
13758 causes all the interprocedural analyses and optimizations in GCC to
13759 work across the two files as if they were a single one.  This means,
13760 for example, that the inliner is able to inline functions in
13761 @file{bar.o} into functions in @file{foo.o} and vice-versa.
13763 Another (simpler) way to enable link-time optimization is:
13765 @smallexample
13766 gcc -o myprog -flto -O2 foo.c bar.c
13767 @end smallexample
13769 The above generates bytecode for @file{foo.c} and @file{bar.c},
13770 merges them together into a single GIMPLE representation and optimizes
13771 them as usual to produce @file{myprog}.
13773 The important thing to keep in mind is that to enable link-time
13774 optimizations you need to use the GCC driver to perform the link step.
13775 GCC automatically performs link-time optimization if any of the
13776 objects involved were compiled with the @option{-flto} command-line option.  
13777 You can always override
13778 the automatic decision to do link-time optimization
13779 by passing @option{-fno-lto} to the link command.
13781 To make whole program optimization effective, it is necessary to make
13782 certain whole program assumptions.  The compiler needs to know
13783 what functions and variables can be accessed by libraries and runtime
13784 outside of the link-time optimized unit.  When supported by the linker,
13785 the linker plugin (see @option{-fuse-linker-plugin}) passes information
13786 to the compiler about used and externally visible symbols.  When
13787 the linker plugin is not available, @option{-fwhole-program} should be
13788 used to allow the compiler to make these assumptions, which leads
13789 to more aggressive optimization decisions.
13791 When a file is compiled with @option{-flto} without
13792 @option{-fuse-linker-plugin}, the generated object file is larger than
13793 a regular object file because it contains GIMPLE bytecodes and the usual
13794 final code (see @option{-ffat-lto-objects}).  This means that
13795 object files with LTO information can be linked as normal object
13796 files; if @option{-fno-lto} is passed to the linker, no
13797 interprocedural optimizations are applied.  Note that when
13798 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
13799 but you cannot perform a regular, non-LTO link on them.
13801 When producing the final binary, GCC only
13802 applies link-time optimizations to those files that contain bytecode.
13803 Therefore, you can mix and match object files and libraries with
13804 GIMPLE bytecodes and final object code.  GCC automatically selects
13805 which files to optimize in LTO mode and which files to link without
13806 further processing.
13808 Generally, options specified at link time override those
13809 specified at compile time, although in some cases GCC attempts to infer
13810 link-time options from the settings used to compile the input files.
13812 If you do not specify an optimization level option @option{-O} at
13813 link time, then GCC uses the highest optimization level 
13814 used when compiling the object files.  Note that it is generally 
13815 ineffective to specify an optimization level option only at link time and 
13816 not at compile time, for two reasons.  First, compiling without 
13817 optimization suppresses compiler passes that gather information 
13818 needed for effective optimization at link time.  Second, some early
13819 optimization passes can be performed only at compile time and 
13820 not at link time.
13822 There are some code generation flags preserved by GCC when
13823 generating bytecodes, as they need to be used during the final link.
13824 Currently, the following options and their settings are taken from
13825 the first object file that explicitly specifies them: 
13826 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
13827 @option{-fgnu-tm} and all the @option{-m} target flags.
13829 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
13830 @option{-fPIE} are combined based on the following scheme:
13832 @smallexample
13833 @option{-fPIC} + @option{-fpic} = @option{-fpic}
13834 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
13835 @option{-fpic/-fPIC} + (no option) = (no option)
13836 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
13837 @option{-fpic} + @option{-fPIE} = @option{-fpie}
13838 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
13839 @end smallexample
13841 Certain ABI-changing flags are required to match in all compilation units,
13842 and trying to override this at link time with a conflicting value
13843 is ignored.  This includes options such as @option{-freg-struct-return}
13844 and @option{-fpcc-struct-return}. 
13846 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
13847 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
13848 are passed through to the link stage and merged conservatively for
13849 conflicting translation units.  Specifically
13850 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
13851 precedence; and for example @option{-ffp-contract=off} takes precedence
13852 over @option{-ffp-contract=fast}.  You can override them at link time.
13854 Diagnostic options such as @option{-Wstringop-overflow} are passed
13855 through to the link stage and their setting matches that of the
13856 compile-step at function granularity.  Note that this matters only
13857 for diagnostics emitted during optimization.  Note that code
13858 transforms such as inlining can lead to warnings being enabled
13859 or disabled for regions if code not consistent with the setting
13860 at compile time.
13862 When you need to pass options to the assembler via @option{-Wa} or
13863 @option{-Xassembler} make sure to either compile such translation
13864 units with @option{-fno-lto} or consistently use the same assembler
13865 options on all translation units.  You can alternatively also
13866 specify assembler options at LTO link time.
13868 To enable debug info generation you need to supply @option{-g} at
13869 compile time.  If any of the input files at link time were built
13870 with debug info generation enabled the link will enable debug info
13871 generation as well.  Any elaborate debug info settings
13872 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
13873 at the linker command line and mixing different settings in different
13874 translation units is discouraged.
13876 If LTO encounters objects with C linkage declared with incompatible
13877 types in separate translation units to be linked together (undefined
13878 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
13879 issued.  The behavior is still undefined at run time.  Similar
13880 diagnostics may be raised for other languages.
13882 Another feature of LTO is that it is possible to apply interprocedural
13883 optimizations on files written in different languages:
13885 @smallexample
13886 gcc -c -flto foo.c
13887 g++ -c -flto bar.cc
13888 gfortran -c -flto baz.f90
13889 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
13890 @end smallexample
13892 Notice that the final link is done with @command{g++} to get the C++
13893 runtime libraries and @option{-lgfortran} is added to get the Fortran
13894 runtime libraries.  In general, when mixing languages in LTO mode, you
13895 should use the same link command options as when mixing languages in a
13896 regular (non-LTO) compilation.
13898 If object files containing GIMPLE bytecode are stored in a library archive, say
13899 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
13900 are using a linker with plugin support.  To create static libraries suitable
13901 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
13902 and @command{ranlib}; 
13903 to show the symbols of object files with GIMPLE bytecode, use
13904 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
13905 and @command{nm} have been compiled with plugin support.  At link time, use the
13906 flag @option{-fuse-linker-plugin} to ensure that the library participates in
13907 the LTO optimization process:
13909 @smallexample
13910 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
13911 @end smallexample
13913 With the linker plugin enabled, the linker extracts the needed
13914 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
13915 to make them part of the aggregated GIMPLE image to be optimized.
13917 If you are not using a linker with plugin support and/or do not
13918 enable the linker plugin, then the objects inside @file{libfoo.a}
13919 are extracted and linked as usual, but they do not participate
13920 in the LTO optimization process.  In order to make a static library suitable
13921 for both LTO optimization and usual linkage, compile its object files with
13922 @option{-flto} @option{-ffat-lto-objects}.
13924 Link-time optimizations do not require the presence of the whole program to
13925 operate.  If the program does not require any symbols to be exported, it is
13926 possible to combine @option{-flto} and @option{-fwhole-program} to allow
13927 the interprocedural optimizers to use more aggressive assumptions which may
13928 lead to improved optimization opportunities.
13929 Use of @option{-fwhole-program} is not needed when linker plugin is
13930 active (see @option{-fuse-linker-plugin}).
13932 The current implementation of LTO makes no
13933 attempt to generate bytecode that is portable between different
13934 types of hosts.  The bytecode files are versioned and there is a
13935 strict version check, so bytecode files generated in one version of
13936 GCC do not work with an older or newer version of GCC.
13938 Link-time optimization does not work well with generation of debugging
13939 information on systems other than those using a combination of ELF and
13940 DWARF.
13942 If you specify the optional @var{n}, the optimization and code
13943 generation done at link time is executed in parallel using @var{n}
13944 parallel jobs by utilizing an installed @command{make} program.  The
13945 environment variable @env{MAKE} may be used to override the program
13946 used.
13948 You can also specify @option{-flto=jobserver} to use GNU make's
13949 job server mode to determine the number of parallel jobs. This
13950 is useful when the Makefile calling GCC is already executing in parallel.
13951 You must prepend a @samp{+} to the command recipe in the parent Makefile
13952 for this to work.  This option likely only works if @env{MAKE} is
13953 GNU make.  Even without the option value, GCC tries to automatically
13954 detect a running GNU make's job server.
13956 Use @option{-flto=auto} to use GNU make's job server, if available,
13957 or otherwise fall back to autodetection of the number of CPU threads
13958 present in your system.
13960 @item -flto-partition=@var{alg}
13961 @opindex flto-partition
13962 Specify the partitioning algorithm used by the link-time optimizer.
13963 The value is either @samp{1to1} to specify a partitioning mirroring
13964 the original source files or @samp{balanced} to specify partitioning
13965 into equally sized chunks (whenever possible) or @samp{max} to create
13966 new partition for every symbol where possible.  Specifying @samp{none}
13967 as an algorithm disables partitioning and streaming completely. 
13968 The default value is @samp{balanced}. While @samp{1to1} can be used
13969 as an workaround for various code ordering issues, the @samp{max}
13970 partitioning is intended for internal testing only.
13971 The value @samp{one} specifies that exactly one partition should be
13972 used while the value @samp{none} bypasses partitioning and executes
13973 the link-time optimization step directly from the WPA phase.
13975 @item -flto-compression-level=@var{n}
13976 @opindex flto-compression-level
13977 This option specifies the level of compression used for intermediate
13978 language written to LTO object files, and is only meaningful in
13979 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
13980 LTO compression algorithms. For zstd, valid values are 0 (no compression)
13981 to 19 (maximum compression), while zlib supports values from 0 to 9.
13982 Values outside this range are clamped to either minimum or maximum
13983 of the supported values.  If the option is not given,
13984 a default balanced compression setting is used.
13986 @item -fuse-linker-plugin
13987 @opindex fuse-linker-plugin
13988 Enables the use of a linker plugin during link-time optimization.  This
13989 option relies on plugin support in the linker, which is available in gold
13990 or in GNU ld 2.21 or newer.
13992 This option enables the extraction of object files with GIMPLE bytecode out
13993 of library archives. This improves the quality of optimization by exposing
13994 more code to the link-time optimizer.  This information specifies what
13995 symbols can be accessed externally (by non-LTO object or during dynamic
13996 linking).  Resulting code quality improvements on binaries (and shared
13997 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
13998 See @option{-flto} for a description of the effect of this flag and how to
13999 use it.
14001 This option is enabled by default when LTO support in GCC is enabled
14002 and GCC was configured for use with
14003 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14005 @item -ffat-lto-objects
14006 @opindex ffat-lto-objects
14007 Fat LTO objects are object files that contain both the intermediate language
14008 and the object code. This makes them usable for both LTO linking and normal
14009 linking. This option is effective only when compiling with @option{-flto}
14010 and is ignored at link time.
14012 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14013 requires the complete toolchain to be aware of LTO. It requires a linker with
14014 linker plugin support for basic functionality.  Additionally,
14015 @command{nm}, @command{ar} and @command{ranlib}
14016 need to support linker plugins to allow a full-featured build environment
14017 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14018 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14019 to these tools. With non fat LTO makefiles need to be modified to use them.
14021 Note that modern binutils provide plugin auto-load mechanism.
14022 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14023 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14024 @command{gcc-ranlib}).
14026 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14027 support.
14029 @item -fcompare-elim
14030 @opindex fcompare-elim
14031 After register allocation and post-register allocation instruction splitting,
14032 identify arithmetic instructions that compute processor flags similar to a
14033 comparison operation based on that arithmetic.  If possible, eliminate the
14034 explicit comparison operation.
14036 This pass only applies to certain targets that cannot explicitly represent
14037 the comparison operation before register allocation is complete.
14039 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14041 @item -fcprop-registers
14042 @opindex fcprop-registers
14043 After register allocation and post-register allocation instruction splitting,
14044 perform a copy-propagation pass to try to reduce scheduling dependencies
14045 and occasionally eliminate the copy.
14047 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14049 @item -fprofile-correction
14050 @opindex fprofile-correction
14051 Profiles collected using an instrumented binary for multi-threaded programs may
14052 be inconsistent due to missed counter updates. When this option is specified,
14053 GCC uses heuristics to correct or smooth out such inconsistencies. By
14054 default, GCC emits an error message when an inconsistent profile is detected.
14056 This option is enabled by @option{-fauto-profile}.
14058 @item -fprofile-partial-training
14059 @opindex fprofile-partial-training
14060 With @code{-fprofile-use} all portions of programs not executed during train
14061 run are optimized agressively for size rather than speed.  In some cases it is
14062 not practical to train all possible hot paths in the program. (For
14063 example, program may contain functions specific for a given hardware and
14064 trianing may not cover all hardware configurations program is run on.)  With
14065 @code{-fprofile-partial-training} profile feedback will be ignored for all
14066 functions not executed during the train run leading them to be optimized as if
14067 they were compiled without profile feedback. This leads to better performance
14068 when train run is not representative but also leads to significantly bigger
14069 code.
14071 @item -fprofile-use
14072 @itemx -fprofile-use=@var{path}
14073 @opindex fprofile-use
14074 Enable profile feedback-directed optimizations, 
14075 and the following optimizations, many of which
14076 are generally profitable only with profile feedback available:
14078 @gccoptlist{-fbranch-probabilities  -fprofile-values @gol
14079 -funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
14080 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
14081 -fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
14082 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
14083 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
14084 -fprofile-reorder-functions}
14086 Before you can use this option, you must first generate profiling information.
14087 @xref{Instrumentation Options}, for information about the
14088 @option{-fprofile-generate} option.
14090 By default, GCC emits an error message if the feedback profiles do not
14091 match the source code.  This error can be turned into a warning by using
14092 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14093 optimized code.  Additionally, by default, GCC also emits a warning message if
14094 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14096 If @var{path} is specified, GCC looks at the @var{path} to find
14097 the profile feedback data files. See @option{-fprofile-dir}.
14099 @item -fauto-profile
14100 @itemx -fauto-profile=@var{path}
14101 @opindex fauto-profile
14102 Enable sampling-based feedback-directed optimizations, 
14103 and the following optimizations,
14104 many of which are generally profitable only with profile feedback available:
14106 @gccoptlist{-fbranch-probabilities  -fprofile-values @gol
14107 -funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
14108 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
14109 -fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
14110 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
14111 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
14112 -fprofile-correction}
14114 @var{path} is the name of a file containing AutoFDO profile information.
14115 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14117 Producing an AutoFDO profile data file requires running your program
14118 with the @command{perf} utility on a supported GNU/Linux target system.
14119 For more information, see @uref{https://perf.wiki.kernel.org/}.
14121 E.g.
14122 @smallexample
14123 perf record -e br_inst_retired:near_taken -b -o perf.data \
14124     -- your_program
14125 @end smallexample
14127 Then use the @command{create_gcov} tool to convert the raw profile data
14128 to a format that can be used by GCC.@  You must also supply the 
14129 unstripped binary for your program to this tool.  
14130 See @uref{https://github.com/google/autofdo}.
14132 E.g.
14133 @smallexample
14134 create_gcov --binary=your_program.unstripped --profile=perf.data \
14135     --gcov=profile.afdo
14136 @end smallexample
14137 @end table
14139 The following options control compiler behavior regarding floating-point 
14140 arithmetic.  These options trade off between speed and
14141 correctness.  All must be specifically enabled.
14143 @table @gcctabopt
14144 @item -ffloat-store
14145 @opindex ffloat-store
14146 Do not store floating-point variables in registers, and inhibit other
14147 options that might change whether a floating-point value is taken from a
14148 register or memory.
14150 @cindex floating-point precision
14151 This option prevents undesirable excess precision on machines such as
14152 the 68000 where the floating registers (of the 68881) keep more
14153 precision than a @code{double} is supposed to have.  Similarly for the
14154 x86 architecture.  For most programs, the excess precision does only
14155 good, but a few programs rely on the precise definition of IEEE floating
14156 point.  Use @option{-ffloat-store} for such programs, after modifying
14157 them to store all pertinent intermediate computations into variables.
14159 @item -fexcess-precision=@var{style}
14160 @opindex fexcess-precision
14161 This option allows further control over excess precision on machines
14162 where floating-point operations occur in a format with more precision or
14163 range than the IEEE standard and interchange floating-point types.  By
14164 default, @option{-fexcess-precision=fast} is in effect; this means that
14165 operations may be carried out in a wider precision than the types specified
14166 in the source if that would result in faster code, and it is unpredictable
14167 when rounding to the types specified in the source code takes place.
14168 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14169 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14170 both casts and assignments cause values to be rounded to their
14171 semantic types (whereas @option{-ffloat-store} only affects
14172 assignments).  This option is enabled by default for C or C++ if a strict
14173 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14174 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14175 regardless of whether a strict conformance option is used.
14177 @opindex mfpmath
14178 @option{-fexcess-precision=standard} is not implemented for languages
14179 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14180 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14181 semantics apply without excess precision, and in the latter, rounding
14182 is unpredictable.
14184 @item -ffast-math
14185 @opindex ffast-math
14186 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14187 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14188 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14189 @option{-fexcess-precision=fast}.
14191 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14193 This option is not turned on by any @option{-O} option besides
14194 @option{-Ofast} since it can result in incorrect output for programs
14195 that depend on an exact implementation of IEEE or ISO rules/specifications
14196 for math functions. It may, however, yield faster code for programs
14197 that do not require the guarantees of these specifications.
14199 @item -fno-math-errno
14200 @opindex fno-math-errno
14201 @opindex fmath-errno
14202 Do not set @code{errno} after calling math functions that are executed
14203 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14204 IEEE exceptions for math error handling may want to use this flag
14205 for speed while maintaining IEEE arithmetic compatibility.
14207 This option is not turned on by any @option{-O} option since
14208 it can result in incorrect output for programs that depend on
14209 an exact implementation of IEEE or ISO rules/specifications for
14210 math functions. It may, however, yield faster code for programs
14211 that do not require the guarantees of these specifications.
14213 The default is @option{-fmath-errno}.
14215 On Darwin systems, the math library never sets @code{errno}.  There is
14216 therefore no reason for the compiler to consider the possibility that
14217 it might, and @option{-fno-math-errno} is the default.
14219 @item -funsafe-math-optimizations
14220 @opindex funsafe-math-optimizations
14222 Allow optimizations for floating-point arithmetic that (a) assume
14223 that arguments and results are valid and (b) may violate IEEE or
14224 ANSI standards.  When used at link time, it may include libraries
14225 or startup files that change the default FPU control word or other
14226 similar optimizations.
14228 This option is not turned on by any @option{-O} option since
14229 it can result in incorrect output for programs that depend on
14230 an exact implementation of IEEE or ISO rules/specifications for
14231 math functions. It may, however, yield faster code for programs
14232 that do not require the guarantees of these specifications.
14233 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14234 @option{-fassociative-math} and @option{-freciprocal-math}.
14236 The default is @option{-fno-unsafe-math-optimizations}.
14238 @item -fassociative-math
14239 @opindex fassociative-math
14241 Allow re-association of operands in series of floating-point operations.
14242 This violates the ISO C and C++ language standard by possibly changing
14243 computation result.  NOTE: re-ordering may change the sign of zero as
14244 well as ignore NaNs and inhibit or create underflow or overflow (and
14245 thus cannot be used on code that relies on rounding behavior like
14246 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
14247 and thus may not be used when ordered comparisons are required.
14248 This option requires that both @option{-fno-signed-zeros} and
14249 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
14250 much sense with @option{-frounding-math}. For Fortran the option
14251 is automatically enabled when both @option{-fno-signed-zeros} and
14252 @option{-fno-trapping-math} are in effect.
14254 The default is @option{-fno-associative-math}.
14256 @item -freciprocal-math
14257 @opindex freciprocal-math
14259 Allow the reciprocal of a value to be used instead of dividing by
14260 the value if this enables optimizations.  For example @code{x / y}
14261 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14262 is subject to common subexpression elimination.  Note that this loses
14263 precision and increases the number of flops operating on the value.
14265 The default is @option{-fno-reciprocal-math}.
14267 @item -ffinite-math-only
14268 @opindex ffinite-math-only
14269 Allow optimizations for floating-point arithmetic that assume
14270 that arguments and results are not NaNs or +-Infs.
14272 This option is not turned on by any @option{-O} option since
14273 it can result in incorrect output for programs that depend on
14274 an exact implementation of IEEE or ISO rules/specifications for
14275 math functions. It may, however, yield faster code for programs
14276 that do not require the guarantees of these specifications.
14278 The default is @option{-fno-finite-math-only}.
14280 @item -fno-signed-zeros
14281 @opindex fno-signed-zeros
14282 @opindex fsigned-zeros
14283 Allow optimizations for floating-point arithmetic that ignore the
14284 signedness of zero.  IEEE arithmetic specifies the behavior of
14285 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14286 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14287 This option implies that the sign of a zero result isn't significant.
14289 The default is @option{-fsigned-zeros}.
14291 @item -fno-trapping-math
14292 @opindex fno-trapping-math
14293 @opindex ftrapping-math
14294 Compile code assuming that floating-point operations cannot generate
14295 user-visible traps.  These traps include division by zero, overflow,
14296 underflow, inexact result and invalid operation.  This option requires
14297 that @option{-fno-signaling-nans} be in effect.  Setting this option may
14298 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14300 This option should never be turned on by any @option{-O} option since
14301 it can result in incorrect output for programs that depend on
14302 an exact implementation of IEEE or ISO rules/specifications for
14303 math functions.
14305 The default is @option{-ftrapping-math}.
14307 Future versions of GCC may provide finer control of this setting
14308 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14309 will be used along with @option{-frounding-math} to specify the
14310 default state for @code{FENV_ACCESS}.
14312 @item -frounding-math
14313 @opindex frounding-math
14314 Disable transformations and optimizations that assume default floating-point
14315 rounding behavior.  This is round-to-zero for all floating point
14316 to integer conversions, and round-to-nearest for all other arithmetic
14317 truncations.  This option should be specified for programs that change
14318 the FP rounding mode dynamically, or that may be executed with a
14319 non-default rounding mode.  This option disables constant folding of
14320 floating-point expressions at compile time (which may be affected by
14321 rounding mode) and arithmetic transformations that are unsafe in the
14322 presence of sign-dependent rounding modes.
14324 The default is @option{-fno-rounding-math}.
14326 This option is experimental and does not currently guarantee to
14327 disable all GCC optimizations that are affected by rounding mode.
14328 Future versions of GCC may provide finer control of this setting
14329 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14330 will be used along with @option{-ftrapping-math} to specify the
14331 default state for @code{FENV_ACCESS}.
14333 @item -fsignaling-nans
14334 @opindex fsignaling-nans
14335 Compile code assuming that IEEE signaling NaNs may generate user-visible
14336 traps during floating-point operations.  Setting this option disables
14337 optimizations that may change the number of exceptions visible with
14338 signaling NaNs.  This option implies @option{-ftrapping-math}.
14340 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14341 be defined.
14343 The default is @option{-fno-signaling-nans}.
14345 This option is experimental and does not currently guarantee to
14346 disable all GCC optimizations that affect signaling NaN behavior.
14348 @item -fno-fp-int-builtin-inexact
14349 @opindex fno-fp-int-builtin-inexact
14350 @opindex ffp-int-builtin-inexact
14351 Do not allow the built-in functions @code{ceil}, @code{floor},
14352 @code{round} and @code{trunc}, and their @code{float} and @code{long
14353 double} variants, to generate code that raises the ``inexact''
14354 floating-point exception for noninteger arguments.  ISO C99 and C11
14355 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14356 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14357 ISO C2X, does not allow these functions to do so.
14359 The default is @option{-ffp-int-builtin-inexact}, allowing the
14360 exception to be raised, unless C2X or a later C standard is selected.
14361 This option does nothing unless @option{-ftrapping-math} is in effect.
14363 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14364 generate a call to a library function then the ``inexact'' exception
14365 may be raised if the library implementation does not follow TS 18661.
14367 @item -fsingle-precision-constant
14368 @opindex fsingle-precision-constant
14369 Treat floating-point constants as single precision instead of
14370 implicitly converting them to double-precision constants.
14372 @item -fcx-limited-range
14373 @opindex fcx-limited-range
14374 When enabled, this option states that a range reduction step is not
14375 needed when performing complex division.  Also, there is no checking
14376 whether the result of a complex multiplication or division is @code{NaN
14377 + I*NaN}, with an attempt to rescue the situation in that case.  The
14378 default is @option{-fno-cx-limited-range}, but is enabled by
14379 @option{-ffast-math}.
14381 This option controls the default setting of the ISO C99
14382 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
14383 all languages.
14385 @item -fcx-fortran-rules
14386 @opindex fcx-fortran-rules
14387 Complex multiplication and division follow Fortran rules.  Range
14388 reduction is done as part of complex division, but there is no checking
14389 whether the result of a complex multiplication or division is @code{NaN
14390 + I*NaN}, with an attempt to rescue the situation in that case.
14392 The default is @option{-fno-cx-fortran-rules}.
14394 @end table
14396 The following options control optimizations that may improve
14397 performance, but are not enabled by any @option{-O} options.  This
14398 section includes experimental options that may produce broken code.
14400 @table @gcctabopt
14401 @item -fbranch-probabilities
14402 @opindex fbranch-probabilities
14403 After running a program compiled with @option{-fprofile-arcs}
14404 (@pxref{Instrumentation Options}),
14405 you can compile it a second time using
14406 @option{-fbranch-probabilities}, to improve optimizations based on
14407 the number of times each branch was taken.  When a program
14408 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14409 counts to a file called @file{@var{sourcename}.gcda} for each source
14410 file.  The information in this data file is very dependent on the
14411 structure of the generated code, so you must use the same source code
14412 and the same optimization options for both compilations.
14413 See details about the file naming in @option{-fprofile-arcs}.
14415 With @option{-fbranch-probabilities}, GCC puts a
14416 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14417 These can be used to improve optimization.  Currently, they are only
14418 used in one place: in @file{reorg.cc}, instead of guessing which path a
14419 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14420 exactly determine which path is taken more often.
14422 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14424 @item -fprofile-values
14425 @opindex fprofile-values
14426 If combined with @option{-fprofile-arcs}, it adds code so that some
14427 data about values of expressions in the program is gathered.
14429 With @option{-fbranch-probabilities}, it reads back the data gathered
14430 from profiling values of expressions for usage in optimizations.
14432 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14433 @option{-fauto-profile}.
14435 @item -fprofile-reorder-functions
14436 @opindex fprofile-reorder-functions
14437 Function reordering based on profile instrumentation collects
14438 first time of execution of a function and orders these functions
14439 in ascending order.
14441 Enabled with @option{-fprofile-use}.
14443 @item -fvpt
14444 @opindex fvpt
14445 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14446 to add code to gather information about values of expressions.
14448 With @option{-fbranch-probabilities}, it reads back the data gathered
14449 and actually performs the optimizations based on them.
14450 Currently the optimizations include specialization of division operations
14451 using the knowledge about the value of the denominator.
14453 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14455 @item -frename-registers
14456 @opindex frename-registers
14457 Attempt to avoid false dependencies in scheduled code by making use
14458 of registers left over after register allocation.  This optimization
14459 most benefits processors with lots of registers.  Depending on the
14460 debug information format adopted by the target, however, it can
14461 make debugging impossible, since variables no longer stay in
14462 a ``home register''.
14464 Enabled by default with @option{-funroll-loops}.
14466 @item -fschedule-fusion
14467 @opindex fschedule-fusion
14468 Performs a target dependent pass over the instruction stream to schedule
14469 instructions of same type together because target machine can execute them
14470 more efficiently if they are adjacent to each other in the instruction flow.
14472 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14474 @item -ftracer
14475 @opindex ftracer
14476 Perform tail duplication to enlarge superblock size.  This transformation
14477 simplifies the control flow of the function allowing other optimizations to do
14478 a better job.
14480 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14482 @item -funroll-loops
14483 @opindex funroll-loops
14484 Unroll loops whose number of iterations can be determined at compile time or
14485 upon entry to the loop.  @option{-funroll-loops} implies
14486 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14487 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14488 a small constant number of iterations).  This option makes code larger, and may
14489 or may not make it run faster.
14491 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14493 @item -funroll-all-loops
14494 @opindex funroll-all-loops
14495 Unroll all loops, even if their number of iterations is uncertain when
14496 the loop is entered.  This usually makes programs run more slowly.
14497 @option{-funroll-all-loops} implies the same options as
14498 @option{-funroll-loops}.
14500 @item -fpeel-loops
14501 @opindex fpeel-loops
14502 Peels loops for which there is enough information that they do not
14503 roll much (from profile feedback or static analysis).  It also turns on
14504 complete loop peeling (i.e.@: complete removal of loops with small constant
14505 number of iterations).
14507 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14509 @item -fmove-loop-invariants
14510 @opindex fmove-loop-invariants
14511 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
14512 at level @option{-O1} and higher, except for @option{-Og}.
14514 @item -fmove-loop-stores
14515 @opindex fmove-loop-stores
14516 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
14517 moves invariant stores to after the end of the loop in exchange for
14518 carrying the stored value in a register across the iteration.
14519 Note for this option to have an effect @option{-ftree-loop-im} has to
14520 be enabled as well.  Enabled at level @option{-O1} and higher, except
14521 for @option{-Og}.
14523 @item -fsplit-loops
14524 @opindex fsplit-loops
14525 Split a loop into two if it contains a condition that's always true
14526 for one side of the iteration space and false for the other.
14528 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14530 @item -funswitch-loops
14531 @opindex funswitch-loops
14532 Move branches with loop invariant conditions out of the loop, with duplicates
14533 of the loop on both branches (modified according to result of the condition).
14535 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14537 @item -fversion-loops-for-strides
14538 @opindex fversion-loops-for-strides
14539 If a loop iterates over an array with a variable stride, create another
14540 version of the loop that assumes the stride is always one.  For example:
14542 @smallexample
14543 for (int i = 0; i < n; ++i)
14544   x[i * stride] = @dots{};
14545 @end smallexample
14547 becomes:
14549 @smallexample
14550 if (stride == 1)
14551   for (int i = 0; i < n; ++i)
14552     x[i] = @dots{};
14553 else
14554   for (int i = 0; i < n; ++i)
14555     x[i * stride] = @dots{};
14556 @end smallexample
14558 This is particularly useful for assumed-shape arrays in Fortran where
14559 (for example) it allows better vectorization assuming contiguous accesses.
14560 This flag is enabled by default at @option{-O3}.
14561 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14563 @item -ffunction-sections
14564 @itemx -fdata-sections
14565 @opindex ffunction-sections
14566 @opindex fdata-sections
14567 Place each function or data item into its own section in the output
14568 file if the target supports arbitrary sections.  The name of the
14569 function or the name of the data item determines the section's name
14570 in the output file.
14572 Use these options on systems where the linker can perform optimizations to
14573 improve locality of reference in the instruction space.  Most systems using the
14574 ELF object format have linkers with such optimizations.  On AIX, the linker
14575 rearranges sections (CSECTs) based on the call graph.  The performance impact
14576 varies.
14578 Together with a linker garbage collection (linker @option{--gc-sections}
14579 option) these options may lead to smaller statically-linked executables (after
14580 stripping).
14582 On ELF/DWARF systems these options do not degenerate the quality of the debug
14583 information.  There could be issues with other object files/debug info formats.
14585 Only use these options when there are significant benefits from doing so.  When
14586 you specify these options, the assembler and linker create larger object and
14587 executable files and are also slower.  These options affect code generation.
14588 They prevent optimizations by the compiler and assembler using relative
14589 locations inside a translation unit since the locations are unknown until
14590 link time.  An example of such an optimization is relaxing calls to short call
14591 instructions.
14593 @item -fstdarg-opt
14594 @opindex fstdarg-opt
14595 Optimize the prologue of variadic argument functions with respect to usage of
14596 those arguments.
14598 @item -fsection-anchors
14599 @opindex fsection-anchors
14600 Try to reduce the number of symbolic address calculations by using
14601 shared ``anchor'' symbols to address nearby objects.  This transformation
14602 can help to reduce the number of GOT entries and GOT accesses on some
14603 targets.
14605 For example, the implementation of the following function @code{foo}:
14607 @smallexample
14608 static int a, b, c;
14609 int foo (void) @{ return a + b + c; @}
14610 @end smallexample
14612 @noindent
14613 usually calculates the addresses of all three variables, but if you
14614 compile it with @option{-fsection-anchors}, it accesses the variables
14615 from a common anchor point instead.  The effect is similar to the
14616 following pseudocode (which isn't valid C):
14618 @smallexample
14619 int foo (void)
14621   register int *xr = &x;
14622   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
14624 @end smallexample
14626 Not all targets support this option.
14628 @item -fzero-call-used-regs=@var{choice}
14629 @opindex fzero-call-used-regs
14630 Zero call-used registers at function return to increase program
14631 security by either mitigating Return-Oriented Programming (ROP)
14632 attacks or preventing information leakage through registers.
14634 The possible values of @var{choice} are the same as for the
14635 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
14636 The default is @samp{skip}.
14638 You can control this behavior for a specific function by using the function
14639 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
14641 @item --param @var{name}=@var{value}
14642 @opindex param
14643 In some places, GCC uses various constants to control the amount of
14644 optimization that is done.  For example, GCC does not inline functions
14645 that contain more than a certain number of instructions.  You can
14646 control some of these constants on the command line using the
14647 @option{--param} option.
14649 The names of specific parameters, and the meaning of the values, are
14650 tied to the internals of the compiler, and are subject to change
14651 without notice in future releases.
14653 In order to get minimal, maximal and default value of a parameter,
14654 one can use @option{--help=param -Q} options.
14656 In each case, the @var{value} is an integer.  The following choices
14657 of @var{name} are recognized for all targets:
14659 @table @gcctabopt
14660 @item predictable-branch-outcome
14661 When branch is predicted to be taken with probability lower than this threshold
14662 (in percent), then it is considered well predictable.
14664 @item max-rtl-if-conversion-insns
14665 RTL if-conversion tries to remove conditional branches around a block and
14666 replace them with conditionally executed instructions.  This parameter
14667 gives the maximum number of instructions in a block which should be
14668 considered for if-conversion.  The compiler will
14669 also use other heuristics to decide whether if-conversion is likely to be
14670 profitable.
14672 @item max-rtl-if-conversion-predictable-cost
14673 RTL if-conversion will try to remove conditional branches around a block
14674 and replace them with conditionally executed instructions.  These parameters
14675 give the maximum permissible cost for the sequence that would be generated
14676 by if-conversion depending on whether the branch is statically determined
14677 to be predictable or not.  The units for this parameter are the same as
14678 those for the GCC internal seq_cost metric.  The compiler will try to
14679 provide a reasonable default for this parameter using the BRANCH_COST
14680 target macro.
14682 @item max-crossjump-edges
14683 The maximum number of incoming edges to consider for cross-jumping.
14684 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
14685 the number of edges incoming to each block.  Increasing values mean
14686 more aggressive optimization, making the compilation time increase with
14687 probably small improvement in executable size.
14689 @item min-crossjump-insns
14690 The minimum number of instructions that must be matched at the end
14691 of two blocks before cross-jumping is performed on them.  This
14692 value is ignored in the case where all instructions in the block being
14693 cross-jumped from are matched.
14695 @item max-grow-copy-bb-insns
14696 The maximum code size expansion factor when copying basic blocks
14697 instead of jumping.  The expansion is relative to a jump instruction.
14699 @item max-goto-duplication-insns
14700 The maximum number of instructions to duplicate to a block that jumps
14701 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
14702 passes, GCC factors computed gotos early in the compilation process,
14703 and unfactors them as late as possible.  Only computed jumps at the
14704 end of a basic blocks with no more than max-goto-duplication-insns are
14705 unfactored.
14707 @item max-delay-slot-insn-search
14708 The maximum number of instructions to consider when looking for an
14709 instruction to fill a delay slot.  If more than this arbitrary number of
14710 instructions are searched, the time savings from filling the delay slot
14711 are minimal, so stop searching.  Increasing values mean more
14712 aggressive optimization, making the compilation time increase with probably
14713 small improvement in execution time.
14715 @item max-delay-slot-live-search
14716 When trying to fill delay slots, the maximum number of instructions to
14717 consider when searching for a block with valid live register
14718 information.  Increasing this arbitrarily chosen value means more
14719 aggressive optimization, increasing the compilation time.  This parameter
14720 should be removed when the delay slot code is rewritten to maintain the
14721 control-flow graph.
14723 @item max-gcse-memory
14724 The approximate maximum amount of memory in @code{kB} that can be allocated in
14725 order to perform the global common subexpression elimination
14726 optimization.  If more memory than specified is required, the
14727 optimization is not done.
14729 @item max-gcse-insertion-ratio
14730 If the ratio of expression insertions to deletions is larger than this value
14731 for any expression, then RTL PRE inserts or removes the expression and thus
14732 leaves partially redundant computations in the instruction stream.
14734 @item max-pending-list-length
14735 The maximum number of pending dependencies scheduling allows
14736 before flushing the current state and starting over.  Large functions
14737 with few branches or calls can create excessively large lists which
14738 needlessly consume memory and resources.
14740 @item max-modulo-backtrack-attempts
14741 The maximum number of backtrack attempts the scheduler should make
14742 when modulo scheduling a loop.  Larger values can exponentially increase
14743 compilation time.
14745 @item max-inline-functions-called-once-loop-depth
14746 Maximal loop depth of a call considered by inline heuristics that tries to
14747 inline all functions called once.
14749 @item max-inline-functions-called-once-insns
14750 Maximal estimated size of functions produced while inlining functions called
14751 once.
14753 @item max-inline-insns-single
14754 Several parameters control the tree inliner used in GCC@.  This number sets the
14755 maximum number of instructions (counted in GCC's internal representation) in a
14756 single function that the tree inliner considers for inlining.  This only
14757 affects functions declared inline and methods implemented in a class
14758 declaration (C++). 
14761 @item max-inline-insns-auto
14762 When you use @option{-finline-functions} (included in @option{-O3}),
14763 a lot of functions that would otherwise not be considered for inlining
14764 by the compiler are investigated.  To those functions, a different
14765 (more restrictive) limit compared to functions declared inline can
14766 be applied (@option{--param max-inline-insns-auto}).
14768 @item max-inline-insns-small
14769 This is bound applied to calls which are considered relevant with
14770 @option{-finline-small-functions}.
14772 @item max-inline-insns-size
14773 This is bound applied to calls which are optimized for size. Small growth
14774 may be desirable to anticipate optimization oppurtunities exposed by inlining.
14776 @item uninlined-function-insns
14777 Number of instructions accounted by inliner for function overhead such as
14778 function prologue and epilogue.
14780 @item uninlined-function-time
14781 Extra time accounted by inliner for function overhead such as time needed to
14782 execute function prologue and epilogue.
14784 @item inline-heuristics-hint-percent
14785 The scale (in percents) applied to @option{inline-insns-single},
14786 @option{inline-insns-single-O2}, @option{inline-insns-auto}
14787 when inline heuristics hints that inlining is
14788 very profitable (will enable later optimizations).
14790 @item uninlined-thunk-insns
14791 @item uninlined-thunk-time
14792 Same as @option{--param uninlined-function-insns} and
14793 @option{--param uninlined-function-time} but applied to function thunks.
14795 @item inline-min-speedup
14796 When estimated performance improvement of caller + callee runtime exceeds this
14797 threshold (in percent), the function can be inlined regardless of the limit on
14798 @option{--param max-inline-insns-single} and @option{--param
14799 max-inline-insns-auto}.
14801 @item large-function-insns
14802 The limit specifying really large functions.  For functions larger than this
14803 limit after inlining, inlining is constrained by
14804 @option{--param large-function-growth}.  This parameter is useful primarily
14805 to avoid extreme compilation time caused by non-linear algorithms used by the
14806 back end.
14808 @item large-function-growth
14809 Specifies maximal growth of large function caused by inlining in percents.
14810 For example, parameter value 100 limits large function growth to 2.0 times
14811 the original size.
14813 @item large-unit-insns
14814 The limit specifying large translation unit.  Growth caused by inlining of
14815 units larger than this limit is limited by @option{--param inline-unit-growth}.
14816 For small units this might be too tight.
14817 For example, consider a unit consisting of function A
14818 that is inline and B that just calls A three times.  If B is small relative to
14819 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
14820 large units consisting of small inlineable functions, however, the overall unit
14821 growth limit is needed to avoid exponential explosion of code size.  Thus for
14822 smaller units, the size is increased to @option{--param large-unit-insns}
14823 before applying @option{--param inline-unit-growth}.
14825 @item lazy-modules
14826 Maximum number of concurrently open C++ module files when lazy loading.
14828 @item inline-unit-growth
14829 Specifies maximal overall growth of the compilation unit caused by inlining.
14830 For example, parameter value 20 limits unit growth to 1.2 times the original
14831 size. Cold functions (either marked cold via an attribute or by profile
14832 feedback) are not accounted into the unit size.
14834 @item ipa-cp-unit-growth
14835 Specifies maximal overall growth of the compilation unit caused by
14836 interprocedural constant propagation.  For example, parameter value 10 limits
14837 unit growth to 1.1 times the original size.
14839 @item ipa-cp-large-unit-insns
14840 The size of translation unit that IPA-CP pass considers large.
14842 @item large-stack-frame
14843 The limit specifying large stack frames.  While inlining the algorithm is trying
14844 to not grow past this limit too much.
14846 @item large-stack-frame-growth
14847 Specifies maximal growth of large stack frames caused by inlining in percents.
14848 For example, parameter value 1000 limits large stack frame growth to 11 times
14849 the original size.
14851 @item max-inline-insns-recursive
14852 @itemx max-inline-insns-recursive-auto
14853 Specifies the maximum number of instructions an out-of-line copy of a
14854 self-recursive inline
14855 function can grow into by performing recursive inlining.
14857 @option{--param max-inline-insns-recursive} applies to functions
14858 declared inline.
14859 For functions not declared inline, recursive inlining
14860 happens only when @option{-finline-functions} (included in @option{-O3}) is
14861 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
14863 @item max-inline-recursive-depth
14864 @itemx max-inline-recursive-depth-auto
14865 Specifies the maximum recursion depth used for recursive inlining.
14867 @option{--param max-inline-recursive-depth} applies to functions
14868 declared inline.  For functions not declared inline, recursive inlining
14869 happens only when @option{-finline-functions} (included in @option{-O3}) is
14870 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
14872 @item min-inline-recursive-probability
14873 Recursive inlining is profitable only for function having deep recursion
14874 in average and can hurt for function having little recursion depth by
14875 increasing the prologue size or complexity of function body to other
14876 optimizers.
14878 When profile feedback is available (see @option{-fprofile-generate}) the actual
14879 recursion depth can be guessed from the probability that function recurses
14880 via a given call expression.  This parameter limits inlining only to call
14881 expressions whose probability exceeds the given threshold (in percents).
14883 @item early-inlining-insns
14884 Specify growth that the early inliner can make.  In effect it increases
14885 the amount of inlining for code having a large abstraction penalty.
14887 @item max-early-inliner-iterations
14888 Limit of iterations of the early inliner.  This basically bounds
14889 the number of nested indirect calls the early inliner can resolve.
14890 Deeper chains are still handled by late inlining.
14892 @item comdat-sharing-probability
14893 Probability (in percent) that C++ inline function with comdat visibility
14894 are shared across multiple compilation units.
14896 @item modref-max-bases
14897 @item modref-max-refs
14898 @item modref-max-accesses
14899 Specifies the maximal number of base pointers, references and accesses stored
14900 for a single function by mod/ref analysis.
14902 @item modref-max-tests
14903 Specifies the maxmal number of tests alias oracle can perform to disambiguate
14904 memory locations using the mod/ref information.  This parameter ought to be
14905 bigger than @option{--param modref-max-bases} and @option{--param
14906 modref-max-refs}.
14908 @item modref-max-depth
14909 Specifies the maximum depth of DFS walk used by modref escape analysis.
14910 Setting to 0 disables the analysis completely.
14912 @item modref-max-escape-points
14913 Specifies the maximum number of escape points tracked by modref per SSA-name.
14915 @item modref-max-adjustments
14916 Specifies the maximum number the access range is enlarged during modref dataflow
14917 analysis.
14919 @item profile-func-internal-id
14920 A parameter to control whether to use function internal id in profile
14921 database lookup. If the value is 0, the compiler uses an id that
14922 is based on function assembler name and filename, which makes old profile
14923 data more tolerant to source changes such as function reordering etc.
14925 @item min-vect-loop-bound
14926 The minimum number of iterations under which loops are not vectorized
14927 when @option{-ftree-vectorize} is used.  The number of iterations after
14928 vectorization needs to be greater than the value specified by this option
14929 to allow vectorization.
14931 @item gcse-cost-distance-ratio
14932 Scaling factor in calculation of maximum distance an expression
14933 can be moved by GCSE optimizations.  This is currently supported only in the
14934 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
14935 is with simple expressions, i.e., the expressions that have cost
14936 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
14937 hoisting of simple expressions.
14939 @item gcse-unrestricted-cost
14940 Cost, roughly measured as the cost of a single typical machine
14941 instruction, at which GCSE optimizations do not constrain
14942 the distance an expression can travel.  This is currently
14943 supported only in the code hoisting pass.  The lesser the cost,
14944 the more aggressive code hoisting is.  Specifying 0 
14945 allows all expressions to travel unrestricted distances.
14947 @item max-hoist-depth
14948 The depth of search in the dominator tree for expressions to hoist.
14949 This is used to avoid quadratic behavior in hoisting algorithm.
14950 The value of 0 does not limit on the search, but may slow down compilation
14951 of huge functions.
14953 @item max-tail-merge-comparisons
14954 The maximum amount of similar bbs to compare a bb with.  This is used to
14955 avoid quadratic behavior in tree tail merging.
14957 @item max-tail-merge-iterations
14958 The maximum amount of iterations of the pass over the function.  This is used to
14959 limit compilation time in tree tail merging.
14961 @item store-merging-allow-unaligned
14962 Allow the store merging pass to introduce unaligned stores if it is legal to
14963 do so.
14965 @item max-stores-to-merge
14966 The maximum number of stores to attempt to merge into wider stores in the store
14967 merging pass.
14969 @item max-store-chains-to-track
14970 The maximum number of store chains to track at the same time in the attempt
14971 to merge them into wider stores in the store merging pass.
14973 @item max-stores-to-track
14974 The maximum number of stores to track at the same time in the attemt to
14975 to merge them into wider stores in the store merging pass.
14977 @item max-unrolled-insns
14978 The maximum number of instructions that a loop may have to be unrolled.
14979 If a loop is unrolled, this parameter also determines how many times
14980 the loop code is unrolled.
14982 @item max-average-unrolled-insns
14983 The maximum number of instructions biased by probabilities of their execution
14984 that a loop may have to be unrolled.  If a loop is unrolled,
14985 this parameter also determines how many times the loop code is unrolled.
14987 @item max-unroll-times
14988 The maximum number of unrollings of a single loop.
14990 @item max-peeled-insns
14991 The maximum number of instructions that a loop may have to be peeled.
14992 If a loop is peeled, this parameter also determines how many times
14993 the loop code is peeled.
14995 @item max-peel-times
14996 The maximum number of peelings of a single loop.
14998 @item max-peel-branches
14999 The maximum number of branches on the hot path through the peeled sequence.
15001 @item max-completely-peeled-insns
15002 The maximum number of insns of a completely peeled loop.
15004 @item max-completely-peel-times
15005 The maximum number of iterations of a loop to be suitable for complete peeling.
15007 @item max-completely-peel-loop-nest-depth
15008 The maximum depth of a loop nest suitable for complete peeling.
15010 @item max-unswitch-insns
15011 The maximum number of insns of an unswitched loop.
15013 @item max-unswitch-depth
15014 The maximum depth of a loop nest to be unswitched.
15016 @item lim-expensive
15017 The minimum cost of an expensive expression in the loop invariant motion.
15019 @item min-loop-cond-split-prob
15020 When FDO profile information is available, @option{min-loop-cond-split-prob}
15021 specifies minimum threshold for probability of semi-invariant condition
15022 statement to trigger loop split.
15024 @item iv-consider-all-candidates-bound
15025 Bound on number of candidates for induction variables, below which
15026 all candidates are considered for each use in induction variable
15027 optimizations.  If there are more candidates than this,
15028 only the most relevant ones are considered to avoid quadratic time complexity.
15030 @item iv-max-considered-uses
15031 The induction variable optimizations give up on loops that contain more
15032 induction variable uses.
15034 @item iv-always-prune-cand-set-bound
15035 If the number of candidates in the set is smaller than this value,
15036 always try to remove unnecessary ivs from the set
15037 when adding a new one.
15039 @item avg-loop-niter
15040 Average number of iterations of a loop.
15042 @item dse-max-object-size
15043 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15044 Larger values may result in larger compilation times.
15046 @item dse-max-alias-queries-per-store
15047 Maximum number of queries into the alias oracle per store.
15048 Larger values result in larger compilation times and may result in more
15049 removed dead stores.
15051 @item scev-max-expr-size
15052 Bound on size of expressions used in the scalar evolutions analyzer.
15053 Large expressions slow the analyzer.
15055 @item scev-max-expr-complexity
15056 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15057 Complex expressions slow the analyzer.
15059 @item max-tree-if-conversion-phi-args
15060 Maximum number of arguments in a PHI supported by TREE if conversion
15061 unless the loop is marked with simd pragma.
15063 @item vect-max-layout-candidates
15064 The maximum number of possible vector layouts (such as permutations)
15065 to consider when optimizing to-be-vectorized code.
15067 @item vect-max-version-for-alignment-checks
15068 The maximum number of run-time checks that can be performed when
15069 doing loop versioning for alignment in the vectorizer.
15071 @item vect-max-version-for-alias-checks
15072 The maximum number of run-time checks that can be performed when
15073 doing loop versioning for alias in the vectorizer.
15075 @item vect-max-peeling-for-alignment
15076 The maximum number of loop peels to enhance access alignment
15077 for vectorizer. Value -1 means no limit.
15079 @item max-iterations-to-track
15080 The maximum number of iterations of a loop the brute-force algorithm
15081 for analysis of the number of iterations of the loop tries to evaluate.
15083 @item hot-bb-count-fraction
15084 The denominator n of fraction 1/n of the maximal execution count of a
15085 basic block in the entire program that a basic block needs to at least
15086 have in order to be considered hot.  The default is 10000, which means
15087 that a basic block is considered hot if its execution count is greater
15088 than 1/10000 of the maximal execution count.  0 means that it is never
15089 considered hot.  Used in non-LTO mode.
15091 @item hot-bb-count-ws-permille
15092 The number of most executed permilles, ranging from 0 to 1000, of the
15093 profiled execution of the entire program to which the execution count
15094 of a basic block must be part of in order to be considered hot.  The
15095 default is 990, which means that a basic block is considered hot if
15096 its execution count contributes to the upper 990 permilles, or 99.0%,
15097 of the profiled execution of the entire program.  0 means that it is
15098 never considered hot.  Used in LTO mode.
15100 @item hot-bb-frequency-fraction
15101 The denominator n of fraction 1/n of the execution frequency of the
15102 entry block of a function that a basic block of this function needs
15103 to at least have in order to be considered hot.  The default is 1000,
15104 which means that a basic block is considered hot in a function if it
15105 is executed more frequently than 1/1000 of the frequency of the entry
15106 block of the function.  0 means that it is never considered hot.
15108 @item unlikely-bb-count-fraction
15109 The denominator n of fraction 1/n of the number of profiled runs of
15110 the entire program below which the execution count of a basic block
15111 must be in order for the basic block to be considered unlikely executed.
15112 The default is 20, which means that a basic block is considered unlikely
15113 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15114 the program.  0 means that it is always considered unlikely executed.
15116 @item max-predicted-iterations
15117 The maximum number of loop iterations we predict statically.  This is useful
15118 in cases where a function contains a single loop with known bound and
15119 another loop with unknown bound.
15120 The known number of iterations is predicted correctly, while
15121 the unknown number of iterations average to roughly 10.  This means that the
15122 loop without bounds appears artificially cold relative to the other one.
15124 @item builtin-expect-probability
15125 Control the probability of the expression having the specified value. This
15126 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15128 @item builtin-string-cmp-inline-length
15129 The maximum length of a constant string for a builtin string cmp call 
15130 eligible for inlining.
15132 @item align-threshold
15134 Select fraction of the maximal frequency of executions of a basic block in
15135 a function to align the basic block.
15137 @item align-loop-iterations
15139 A loop expected to iterate at least the selected number of iterations is
15140 aligned.
15142 @item tracer-dynamic-coverage
15143 @itemx tracer-dynamic-coverage-feedback
15145 This value is used to limit superblock formation once the given percentage of
15146 executed instructions is covered.  This limits unnecessary code size
15147 expansion.
15149 The @option{tracer-dynamic-coverage-feedback} parameter
15150 is used only when profile
15151 feedback is available.  The real profiles (as opposed to statically estimated
15152 ones) are much less balanced allowing the threshold to be larger value.
15154 @item tracer-max-code-growth
15155 Stop tail duplication once code growth has reached given percentage.  This is
15156 a rather artificial limit, as most of the duplicates are eliminated later in
15157 cross jumping, so it may be set to much higher values than is the desired code
15158 growth.
15160 @item tracer-min-branch-ratio
15162 Stop reverse growth when the reverse probability of best edge is less than this
15163 threshold (in percent).
15165 @item tracer-min-branch-probability
15166 @itemx tracer-min-branch-probability-feedback
15168 Stop forward growth if the best edge has probability lower than this
15169 threshold.
15171 Similarly to @option{tracer-dynamic-coverage} two parameters are
15172 provided.  @option{tracer-min-branch-probability-feedback} is used for
15173 compilation with profile feedback and @option{tracer-min-branch-probability}
15174 compilation without.  The value for compilation with profile feedback
15175 needs to be more conservative (higher) in order to make tracer
15176 effective.
15178 @item stack-clash-protection-guard-size
15179 Specify the size of the operating system provided stack guard as
15180 2 raised to @var{num} bytes.  Higher values may reduce the
15181 number of explicit probes, but a value larger than the operating system
15182 provided guard will leave code vulnerable to stack clash style attacks.
15184 @item stack-clash-protection-probe-interval
15185 Stack clash protection involves probing stack space as it is allocated.  This
15186 param controls the maximum distance between probes into the stack as 2 raised
15187 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15188 larger than the operating system provided guard will leave code vulnerable to
15189 stack clash style attacks.
15191 @item max-cse-path-length
15193 The maximum number of basic blocks on path that CSE considers.
15195 @item max-cse-insns
15196 The maximum number of instructions CSE processes before flushing.
15198 @item ggc-min-expand
15200 GCC uses a garbage collector to manage its own memory allocation.  This
15201 parameter specifies the minimum percentage by which the garbage
15202 collector's heap should be allowed to expand between collections.
15203 Tuning this may improve compilation speed; it has no effect on code
15204 generation.
15206 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15207 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
15208 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
15209 GCC is not able to calculate RAM on a particular platform, the lower
15210 bound of 30% is used.  Setting this parameter and
15211 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15212 every opportunity.  This is extremely slow, but can be useful for
15213 debugging.
15215 @item ggc-min-heapsize
15217 Minimum size of the garbage collector's heap before it begins bothering
15218 to collect garbage.  The first collection occurs after the heap expands
15219 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
15220 tuning this may improve compilation speed, and has no effect on code
15221 generation.
15223 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15224 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15225 with a lower bound of 4096 (four megabytes) and an upper bound of
15226 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
15227 particular platform, the lower bound is used.  Setting this parameter
15228 very large effectively disables garbage collection.  Setting this
15229 parameter and @option{ggc-min-expand} to zero causes a full collection
15230 to occur at every opportunity.
15232 @item max-reload-search-insns
15233 The maximum number of instruction reload should look backward for equivalent
15234 register.  Increasing values mean more aggressive optimization, making the
15235 compilation time increase with probably slightly better performance.
15237 @item max-cselib-memory-locations
15238 The maximum number of memory locations cselib should take into account.
15239 Increasing values mean more aggressive optimization, making the compilation time
15240 increase with probably slightly better performance.
15242 @item max-sched-ready-insns
15243 The maximum number of instructions ready to be issued the scheduler should
15244 consider at any given time during the first scheduling pass.  Increasing
15245 values mean more thorough searches, making the compilation time increase
15246 with probably little benefit.
15248 @item max-sched-region-blocks
15249 The maximum number of blocks in a region to be considered for
15250 interblock scheduling.
15252 @item max-pipeline-region-blocks
15253 The maximum number of blocks in a region to be considered for
15254 pipelining in the selective scheduler.
15256 @item max-sched-region-insns
15257 The maximum number of insns in a region to be considered for
15258 interblock scheduling.
15260 @item max-pipeline-region-insns
15261 The maximum number of insns in a region to be considered for
15262 pipelining in the selective scheduler.
15264 @item min-spec-prob
15265 The minimum probability (in percents) of reaching a source block
15266 for interblock speculative scheduling.
15268 @item max-sched-extend-regions-iters
15269 The maximum number of iterations through CFG to extend regions.
15270 A value of 0 disables region extensions.
15272 @item max-sched-insn-conflict-delay
15273 The maximum conflict delay for an insn to be considered for speculative motion.
15275 @item sched-spec-prob-cutoff
15276 The minimal probability of speculation success (in percents), so that
15277 speculative insns are scheduled.
15279 @item sched-state-edge-prob-cutoff
15280 The minimum probability an edge must have for the scheduler to save its
15281 state across it.
15283 @item sched-mem-true-dep-cost
15284 Minimal distance (in CPU cycles) between store and load targeting same
15285 memory locations.
15287 @item selsched-max-lookahead
15288 The maximum size of the lookahead window of selective scheduling.  It is a
15289 depth of search for available instructions.
15291 @item selsched-max-sched-times
15292 The maximum number of times that an instruction is scheduled during
15293 selective scheduling.  This is the limit on the number of iterations
15294 through which the instruction may be pipelined.
15296 @item selsched-insns-to-rename
15297 The maximum number of best instructions in the ready list that are considered
15298 for renaming in the selective scheduler.
15300 @item sms-min-sc
15301 The minimum value of stage count that swing modulo scheduler
15302 generates.
15304 @item max-last-value-rtl
15305 The maximum size measured as number of RTLs that can be recorded in an expression
15306 in combiner for a pseudo register as last known value of that register.
15308 @item max-combine-insns
15309 The maximum number of instructions the RTL combiner tries to combine.
15311 @item integer-share-limit
15312 Small integer constants can use a shared data structure, reducing the
15313 compiler's memory usage and increasing its speed.  This sets the maximum
15314 value of a shared integer constant.
15316 @item ssp-buffer-size
15317 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15318 protection when @option{-fstack-protector} is used.
15320 @item min-size-for-stack-sharing
15321 The minimum size of variables taking part in stack slot sharing when not
15322 optimizing.
15324 @item max-jump-thread-duplication-stmts
15325 Maximum number of statements allowed in a block that needs to be
15326 duplicated when threading jumps.
15328 @item max-jump-thread-paths
15329 The maximum number of paths to consider when searching for jump threading
15330 opportunities.  When arriving at a block, incoming edges are only considered
15331 if the number of paths to be searched so far multiplied by the number of
15332 incoming edges does not exhaust the specified maximum number of paths to
15333 consider.
15335 @item max-fields-for-field-sensitive
15336 Maximum number of fields in a structure treated in
15337 a field sensitive manner during pointer analysis.
15339 @item prefetch-latency
15340 Estimate on average number of instructions that are executed before
15341 prefetch finishes.  The distance prefetched ahead is proportional
15342 to this constant.  Increasing this number may also lead to less
15343 streams being prefetched (see @option{simultaneous-prefetches}).
15345 @item simultaneous-prefetches
15346 Maximum number of prefetches that can run at the same time.
15348 @item l1-cache-line-size
15349 The size of cache line in L1 data cache, in bytes.
15351 @item l1-cache-size
15352 The size of L1 data cache, in kilobytes.
15354 @item l2-cache-size
15355 The size of L2 data cache, in kilobytes.
15357 @item prefetch-dynamic-strides
15358 Whether the loop array prefetch pass should issue software prefetch hints
15359 for strides that are non-constant.  In some cases this may be
15360 beneficial, though the fact the stride is non-constant may make it
15361 hard to predict when there is clear benefit to issuing these hints.
15363 Set to 1 if the prefetch hints should be issued for non-constant
15364 strides.  Set to 0 if prefetch hints should be issued only for strides that
15365 are known to be constant and below @option{prefetch-minimum-stride}.
15367 @item prefetch-minimum-stride
15368 Minimum constant stride, in bytes, to start using prefetch hints for.  If
15369 the stride is less than this threshold, prefetch hints will not be issued.
15371 This setting is useful for processors that have hardware prefetchers, in
15372 which case there may be conflicts between the hardware prefetchers and
15373 the software prefetchers.  If the hardware prefetchers have a maximum
15374 stride they can handle, it should be used here to improve the use of
15375 software prefetchers.
15377 A value of -1 means we don't have a threshold and therefore
15378 prefetch hints can be issued for any constant stride.
15380 This setting is only useful for strides that are known and constant.
15382 @item destructive-interference-size
15383 @item constructive-interference-size
15384 The values for the C++17 variables
15385 @code{std::hardware_destructive_interference_size} and
15386 @code{std::hardware_constructive_interference_size}.  The destructive
15387 interference size is the minimum recommended offset between two
15388 independent concurrently-accessed objects; the constructive
15389 interference size is the maximum recommended size of contiguous memory
15390 accessed together.  Typically both will be the size of an L1 cache
15391 line for the target, in bytes.  For a generic target covering a range of L1
15392 cache line sizes, typically the constructive interference size will be
15393 the small end of the range and the destructive size will be the large
15394 end.
15396 The destructive interference size is intended to be used for layout,
15397 and thus has ABI impact.  The default value is not expected to be
15398 stable, and on some targets varies with @option{-mtune}, so use of
15399 this variable in a context where ABI stability is important, such as
15400 the public interface of a library, is strongly discouraged; if it is
15401 used in that context, users can stabilize the value using this
15402 option.
15404 The constructive interference size is less sensitive, as it is
15405 typically only used in a @samp{static_assert} to make sure that a type
15406 fits within a cache line.
15408 See also @option{-Winterference-size}.
15410 @item loop-interchange-max-num-stmts
15411 The maximum number of stmts in a loop to be interchanged.
15413 @item loop-interchange-stride-ratio
15414 The minimum ratio between stride of two loops for interchange to be profitable.
15416 @item min-insn-to-prefetch-ratio
15417 The minimum ratio between the number of instructions and the
15418 number of prefetches to enable prefetching in a loop.
15420 @item prefetch-min-insn-to-mem-ratio
15421 The minimum ratio between the number of instructions and the
15422 number of memory references to enable prefetching in a loop.
15424 @item use-canonical-types
15425 Whether the compiler should use the ``canonical'' type system.
15426 Should always be 1, which uses a more efficient internal
15427 mechanism for comparing types in C++ and Objective-C++.  However, if
15428 bugs in the canonical type system are causing compilation failures,
15429 set this value to 0 to disable canonical types.
15431 @item switch-conversion-max-branch-ratio
15432 Switch initialization conversion refuses to create arrays that are
15433 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15434 branches in the switch.
15436 @item max-partial-antic-length
15437 Maximum length of the partial antic set computed during the tree
15438 partial redundancy elimination optimization (@option{-ftree-pre}) when
15439 optimizing at @option{-O3} and above.  For some sorts of source code
15440 the enhanced partial redundancy elimination optimization can run away,
15441 consuming all of the memory available on the host machine.  This
15442 parameter sets a limit on the length of the sets that are computed,
15443 which prevents the runaway behavior.  Setting a value of 0 for
15444 this parameter allows an unlimited set length.
15446 @item rpo-vn-max-loop-depth
15447 Maximum loop depth that is value-numbered optimistically.
15448 When the limit hits the innermost
15449 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15450 loop nest are value-numbered optimistically and the remaining ones not.
15452 @item sccvn-max-alias-queries-per-access
15453 Maximum number of alias-oracle queries we perform when looking for
15454 redundancies for loads and stores.  If this limit is hit the search
15455 is aborted and the load or store is not considered redundant.  The
15456 number of queries is algorithmically limited to the number of
15457 stores on all paths from the load to the function entry.
15459 @item ira-max-loops-num
15460 IRA uses regional register allocation by default.  If a function
15461 contains more loops than the number given by this parameter, only at most
15462 the given number of the most frequently-executed loops form regions
15463 for regional register allocation.
15465 @item ira-max-conflict-table-size 
15466 Although IRA uses a sophisticated algorithm to compress the conflict
15467 table, the table can still require excessive amounts of memory for
15468 huge functions.  If the conflict table for a function could be more
15469 than the size in MB given by this parameter, the register allocator
15470 instead uses a faster, simpler, and lower-quality
15471 algorithm that does not require building a pseudo-register conflict table.  
15473 @item ira-loop-reserved-regs
15474 IRA can be used to evaluate more accurate register pressure in loops
15475 for decisions to move loop invariants (see @option{-O3}).  The number
15476 of available registers reserved for some other purposes is given
15477 by this parameter.  Default of the parameter
15478 is the best found from numerous experiments.
15480 @item ira-consider-dup-in-all-alts
15481 Make IRA to consider matching constraint (duplicated operand number)
15482 heavily in all available alternatives for preferred register class.
15483 If it is set as zero, it means IRA only respects the matching
15484 constraint when it's in the only available alternative with an
15485 appropriate register class.  Otherwise, it means IRA will check all
15486 available alternatives for preferred register class even if it has
15487 found some choice with an appropriate register class and respect the
15488 found qualified matching constraint.
15490 @item lra-inheritance-ebb-probability-cutoff
15491 LRA tries to reuse values reloaded in registers in subsequent insns.
15492 This optimization is called inheritance.  EBB is used as a region to
15493 do this optimization.  The parameter defines a minimal fall-through
15494 edge probability in percentage used to add BB to inheritance EBB in
15495 LRA.  The default value was chosen
15496 from numerous runs of SPEC2000 on x86-64.
15498 @item loop-invariant-max-bbs-in-loop
15499 Loop invariant motion can be very expensive, both in compilation time and
15500 in amount of needed compile-time memory, with very large loops.  Loops
15501 with more basic blocks than this parameter won't have loop invariant
15502 motion optimization performed on them.
15504 @item loop-max-datarefs-for-datadeps
15505 Building data dependencies is expensive for very large loops.  This
15506 parameter limits the number of data references in loops that are
15507 considered for data dependence analysis.  These large loops are no
15508 handled by the optimizations using loop data dependencies.
15510 @item max-vartrack-size
15511 Sets a maximum number of hash table slots to use during variable
15512 tracking dataflow analysis of any function.  If this limit is exceeded
15513 with variable tracking at assignments enabled, analysis for that
15514 function is retried without it, after removing all debug insns from
15515 the function.  If the limit is exceeded even without debug insns, var
15516 tracking analysis is completely disabled for the function.  Setting
15517 the parameter to zero makes it unlimited.
15519 @item max-vartrack-expr-depth
15520 Sets a maximum number of recursion levels when attempting to map
15521 variable names or debug temporaries to value expressions.  This trades
15522 compilation time for more complete debug information.  If this is set too
15523 low, value expressions that are available and could be represented in
15524 debug information may end up not being used; setting this higher may
15525 enable the compiler to find more complex debug expressions, but compile
15526 time and memory use may grow.
15528 @item max-debug-marker-count
15529 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15530 markers) to avoid complexity explosion at inlining or expanding to RTL.
15531 If a function has more such gimple stmts than the set limit, such stmts
15532 will be dropped from the inlined copy of a function, and from its RTL
15533 expansion.
15535 @item min-nondebug-insn-uid
15536 Use uids starting at this parameter for nondebug insns.  The range below
15537 the parameter is reserved exclusively for debug insns created by
15538 @option{-fvar-tracking-assignments}, but debug insns may get
15539 (non-overlapping) uids above it if the reserved range is exhausted.
15541 @item ipa-sra-deref-prob-threshold
15542 IPA-SRA replaces a pointer which is known not be NULL with one or more
15543 new parameters only when the probability (in percent, relative to
15544 function entry) of it being dereferenced is higher than this parameter.
15546 @item ipa-sra-ptr-growth-factor
15547 IPA-SRA replaces a pointer to an aggregate with one or more new
15548 parameters only when their cumulative size is less or equal to
15549 @option{ipa-sra-ptr-growth-factor} times the size of the original
15550 pointer parameter.
15552 @item ipa-sra-ptrwrap-growth-factor
15553 Additional maximum allowed growth of total size of new parameters
15554 that ipa-sra replaces a pointer to an aggregate with,
15555 if it points to a local variable that the caller only writes to and
15556 passes it as an argument to other functions.
15558 @item ipa-sra-max-replacements
15559 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
15560 consequence, it is also the maximum number of replacements of a formal
15561 parameter.
15563 @item sra-max-scalarization-size-Ospeed
15564 @itemx sra-max-scalarization-size-Osize
15565 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15566 replace scalar parts of aggregates with uses of independent scalar
15567 variables.  These parameters control the maximum size, in storage units,
15568 of aggregate which is considered for replacement when compiling for
15569 speed
15570 (@option{sra-max-scalarization-size-Ospeed}) or size
15571 (@option{sra-max-scalarization-size-Osize}) respectively.
15573 @item sra-max-propagations
15574 The maximum number of artificial accesses that Scalar Replacement of
15575 Aggregates (SRA) will track, per one local variable, in order to
15576 facilitate copy propagation.
15578 @item tm-max-aggregate-size
15579 When making copies of thread-local variables in a transaction, this
15580 parameter specifies the size in bytes after which variables are
15581 saved with the logging functions as opposed to save/restore code
15582 sequence pairs.  This option only applies when using
15583 @option{-fgnu-tm}.
15585 @item graphite-max-nb-scop-params
15586 To avoid exponential effects in the Graphite loop transforms, the
15587 number of parameters in a Static Control Part (SCoP) is bounded.
15588 A value of zero can be used to lift
15589 the bound.  A variable whose value is unknown at compilation time and
15590 defined outside a SCoP is a parameter of the SCoP.
15592 @item loop-block-tile-size
15593 Loop blocking or strip mining transforms, enabled with
15594 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
15595 loop in the loop nest by a given number of iterations.  The strip
15596 length can be changed using the @option{loop-block-tile-size}
15597 parameter.
15599 @item ipa-jump-function-lookups
15600 Specifies number of statements visited during jump function offset discovery.
15602 @item ipa-cp-value-list-size
15603 IPA-CP attempts to track all possible values and types passed to a function's
15604 parameter in order to propagate them and perform devirtualization.
15605 @option{ipa-cp-value-list-size} is the maximum number of values and types it
15606 stores per one formal parameter of a function.
15608 @item ipa-cp-eval-threshold
15609 IPA-CP calculates its own score of cloning profitability heuristics
15610 and performs those cloning opportunities with scores that exceed
15611 @option{ipa-cp-eval-threshold}.
15613 @item ipa-cp-max-recursive-depth
15614 Maximum depth of recursive cloning for self-recursive function.
15616 @item ipa-cp-min-recursive-probability
15617 Recursive cloning only when the probability of call being executed exceeds
15618 the parameter.
15620 @item ipa-cp-profile-count-base
15621 When using @option{-fprofile-use} option, IPA-CP will consider the measured
15622 execution count of a call graph edge at this percentage position in their
15623 histogram as the basis for its heuristics calculation.
15625 @item ipa-cp-recursive-freq-factor
15626 The number of times interprocedural copy propagation expects recursive
15627 functions to call themselves.
15629 @item ipa-cp-recursion-penalty
15630 Percentage penalty the recursive functions will receive when they
15631 are evaluated for cloning.
15633 @item ipa-cp-single-call-penalty
15634 Percentage penalty functions containing a single call to another
15635 function will receive when they are evaluated for cloning.
15637 @item ipa-max-agg-items
15638 IPA-CP is also capable to propagate a number of scalar values passed
15639 in an aggregate. @option{ipa-max-agg-items} controls the maximum
15640 number of such values per one parameter.
15642 @item ipa-cp-loop-hint-bonus
15643 When IPA-CP determines that a cloning candidate would make the number
15644 of iterations of a loop known, it adds a bonus of
15645 @option{ipa-cp-loop-hint-bonus} to the profitability score of
15646 the candidate.
15648 @item ipa-max-loop-predicates
15649 The maximum number of different predicates IPA will use to describe when
15650 loops in a function have known properties.
15652 @item ipa-max-aa-steps
15653 During its analysis of function bodies, IPA-CP employs alias analysis
15654 in order to track values pointed to by function parameters.  In order
15655 not spend too much time analyzing huge functions, it gives up and
15656 consider all memory clobbered after examining
15657 @option{ipa-max-aa-steps} statements modifying memory.
15659 @item ipa-max-switch-predicate-bounds
15660 Maximal number of boundary endpoints of case ranges of switch statement.
15661 For switch exceeding this limit, IPA-CP will not construct cloning cost
15662 predicate, which is used to estimate cloning benefit, for default case
15663 of the switch statement.
15665 @item ipa-max-param-expr-ops
15666 IPA-CP will analyze conditional statement that references some function
15667 parameter to estimate benefit for cloning upon certain constant value.
15668 But if number of operations in a parameter expression exceeds
15669 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
15670 one, and is not handled by IPA analysis.
15672 @item lto-partitions
15673 Specify desired number of partitions produced during WHOPR compilation.
15674 The number of partitions should exceed the number of CPUs used for compilation.
15676 @item lto-min-partition
15677 Size of minimal partition for WHOPR (in estimated instructions).
15678 This prevents expenses of splitting very small programs into too many
15679 partitions.
15681 @item lto-max-partition
15682 Size of max partition for WHOPR (in estimated instructions).
15683 to provide an upper bound for individual size of partition.
15684 Meant to be used only with balanced partitioning.
15686 @item lto-max-streaming-parallelism
15687 Maximal number of parallel processes used for LTO streaming.
15689 @item cxx-max-namespaces-for-diagnostic-help
15690 The maximum number of namespaces to consult for suggestions when C++
15691 name lookup fails for an identifier.
15693 @item sink-frequency-threshold
15694 The maximum relative execution frequency (in percents) of the target block
15695 relative to a statement's original block to allow statement sinking of a
15696 statement.  Larger numbers result in more aggressive statement sinking.
15697 A small positive adjustment is applied for
15698 statements with memory operands as those are even more profitable so sink.
15700 @item max-stores-to-sink
15701 The maximum number of conditional store pairs that can be sunk.  Set to 0
15702 if either vectorization (@option{-ftree-vectorize}) or if-conversion
15703 (@option{-ftree-loop-if-convert}) is disabled.
15705 @item case-values-threshold
15706 The smallest number of different values for which it is best to use a
15707 jump-table instead of a tree of conditional branches.  If the value is
15708 0, use the default for the machine.
15710 @item jump-table-max-growth-ratio-for-size
15711 The maximum code size growth ratio when expanding
15712 into a jump table (in percent).  The parameter is used when
15713 optimizing for size.
15715 @item jump-table-max-growth-ratio-for-speed
15716 The maximum code size growth ratio when expanding
15717 into a jump table (in percent).  The parameter is used when
15718 optimizing for speed.
15720 @item tree-reassoc-width
15721 Set the maximum number of instructions executed in parallel in
15722 reassociated tree. This parameter overrides target dependent
15723 heuristics used by default if has non zero value.
15725 @item sched-pressure-algorithm
15726 Choose between the two available implementations of
15727 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
15728 and is the more likely to prevent instructions from being reordered.
15729 Algorithm 2 was designed to be a compromise between the relatively
15730 conservative approach taken by algorithm 1 and the rather aggressive
15731 approach taken by the default scheduler.  It relies more heavily on
15732 having a regular register file and accurate register pressure classes.
15733 See @file{haifa-sched.cc} in the GCC sources for more details.
15735 The default choice depends on the target.
15737 @item max-slsr-cand-scan
15738 Set the maximum number of existing candidates that are considered when
15739 seeking a basis for a new straight-line strength reduction candidate.
15741 @item asan-globals
15742 Enable buffer overflow detection for global objects.  This kind
15743 of protection is enabled by default if you are using
15744 @option{-fsanitize=address} option.
15745 To disable global objects protection use @option{--param asan-globals=0}.
15747 @item asan-stack
15748 Enable buffer overflow detection for stack objects.  This kind of
15749 protection is enabled by default when using @option{-fsanitize=address}.
15750 To disable stack protection use @option{--param asan-stack=0} option.
15752 @item asan-instrument-reads
15753 Enable buffer overflow detection for memory reads.  This kind of
15754 protection is enabled by default when using @option{-fsanitize=address}.
15755 To disable memory reads protection use
15756 @option{--param asan-instrument-reads=0}.
15758 @item asan-instrument-writes
15759 Enable buffer overflow detection for memory writes.  This kind of
15760 protection is enabled by default when using @option{-fsanitize=address}.
15761 To disable memory writes protection use
15762 @option{--param asan-instrument-writes=0} option.
15764 @item asan-memintrin
15765 Enable detection for built-in functions.  This kind of protection
15766 is enabled by default when using @option{-fsanitize=address}.
15767 To disable built-in functions protection use
15768 @option{--param asan-memintrin=0}.
15770 @item asan-use-after-return
15771 Enable detection of use-after-return.  This kind of protection
15772 is enabled by default when using the @option{-fsanitize=address} option.
15773 To disable it use @option{--param asan-use-after-return=0}.
15775 Note: By default the check is disabled at run time.  To enable it,
15776 add @code{detect_stack_use_after_return=1} to the environment variable
15777 @env{ASAN_OPTIONS}.
15779 @item asan-instrumentation-with-call-threshold
15780 If number of memory accesses in function being instrumented
15781 is greater or equal to this number, use callbacks instead of inline checks.
15782 E.g. to disable inline code use
15783 @option{--param asan-instrumentation-with-call-threshold=0}.
15785 @item hwasan-instrument-stack
15786 Enable hwasan instrumentation of statically sized stack-allocated variables.
15787 This kind of instrumentation is enabled by default when using
15788 @option{-fsanitize=hwaddress} and disabled by default when using
15789 @option{-fsanitize=kernel-hwaddress}.
15790 To disable stack instrumentation use
15791 @option{--param hwasan-instrument-stack=0}, and to enable it use
15792 @option{--param hwasan-instrument-stack=1}.
15794 @item hwasan-random-frame-tag
15795 When using stack instrumentation, decide tags for stack variables using a
15796 deterministic sequence beginning at a random tag for each frame.  With this
15797 parameter unset tags are chosen using the same sequence but beginning from 1.
15798 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
15799 for @option{-fsanitize=kernel-hwaddress}.
15800 To disable it use @option{--param hwasan-random-frame-tag=0}.
15802 @item hwasan-instrument-allocas
15803 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
15804 This kind of instrumentation is enabled by default when using
15805 @option{-fsanitize=hwaddress} and disabled by default when using
15806 @option{-fsanitize=kernel-hwaddress}.
15807 To disable instrumentation of such variables use
15808 @option{--param hwasan-instrument-allocas=0}, and to enable it use
15809 @option{--param hwasan-instrument-allocas=1}.
15811 @item hwasan-instrument-reads
15812 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
15813 default for both @option{-fsanitize=hwaddress} and
15814 @option{-fsanitize=kernel-hwaddress}.
15815 To disable checking memory reads use
15816 @option{--param hwasan-instrument-reads=0}.
15818 @item hwasan-instrument-writes
15819 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
15820 default for both @option{-fsanitize=hwaddress} and
15821 @option{-fsanitize=kernel-hwaddress}.
15822 To disable checking memory writes use
15823 @option{--param hwasan-instrument-writes=0}.
15825 @item hwasan-instrument-mem-intrinsics
15826 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
15827 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
15828 and @option{-fsanitize=kernel-hwaddress}.
15829 To disable instrumentation of builtin functions use
15830 @option{--param hwasan-instrument-mem-intrinsics=0}.
15832 @item use-after-scope-direct-emission-threshold
15833 If the size of a local variable in bytes is smaller or equal to this
15834 number, directly poison (or unpoison) shadow memory instead of using
15835 run-time callbacks.
15837 @item tsan-distinguish-volatile
15838 Emit special instrumentation for accesses to volatiles.
15840 @item tsan-instrument-func-entry-exit
15841 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
15843 @item max-fsm-thread-path-insns
15844 Maximum number of instructions to copy when duplicating blocks on a
15845 finite state automaton jump thread path.
15847 @item threader-debug
15848 threader-debug=[none|all] Enables verbose dumping of the threader solver.
15850 @item parloops-chunk-size
15851 Chunk size of omp schedule for loops parallelized by parloops.
15853 @item parloops-schedule
15854 Schedule type of omp schedule for loops parallelized by parloops (static,
15855 dynamic, guided, auto, runtime).
15857 @item parloops-min-per-thread
15858 The minimum number of iterations per thread of an innermost parallelized
15859 loop for which the parallelized variant is preferred over the single threaded
15860 one.  Note that for a parallelized loop nest the
15861 minimum number of iterations of the outermost loop per thread is two.
15863 @item max-ssa-name-query-depth
15864 Maximum depth of recursion when querying properties of SSA names in things
15865 like fold routines.  One level of recursion corresponds to following a
15866 use-def chain.
15868 @item max-speculative-devirt-maydefs
15869 The maximum number of may-defs we analyze when looking for a must-def
15870 specifying the dynamic type of an object that invokes a virtual call
15871 we may be able to devirtualize speculatively.
15873 @item evrp-sparse-threshold
15874 Maximum number of basic blocks before EVRP uses a sparse cache.
15876 @item ranger-debug
15877 Specifies the type of debug output to be issued for ranges.
15879 @item evrp-switch-limit
15880 Specifies the maximum number of switch cases before EVRP ignores a switch.
15882 @item unroll-jam-min-percent
15883 The minimum percentage of memory references that must be optimized
15884 away for the unroll-and-jam transformation to be considered profitable.
15886 @item unroll-jam-max-unroll
15887 The maximum number of times the outer loop should be unrolled by
15888 the unroll-and-jam transformation.
15890 @item max-rtl-if-conversion-unpredictable-cost
15891 Maximum permissible cost for the sequence that would be generated
15892 by the RTL if-conversion pass for a branch that is considered unpredictable.
15894 @item max-variable-expansions-in-unroller
15895 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
15896 of times that an individual variable will be expanded during loop unrolling.
15898 @item partial-inlining-entry-probability
15899 Maximum probability of the entry BB of split region
15900 (in percent relative to entry BB of the function)
15901 to make partial inlining happen.
15903 @item max-tracked-strlens
15904 Maximum number of strings for which strlen optimization pass will
15905 track string lengths.
15907 @item gcse-after-reload-partial-fraction
15908 The threshold ratio for performing partial redundancy
15909 elimination after reload.
15911 @item gcse-after-reload-critical-fraction
15912 The threshold ratio of critical edges execution count that
15913 permit performing redundancy elimination after reload.
15915 @item max-loop-header-insns
15916 The maximum number of insns in loop header duplicated
15917 by the copy loop headers pass.
15919 @item vect-epilogues-nomask
15920 Enable loop epilogue vectorization using smaller vector size.
15922 @item vect-partial-vector-usage
15923 Controls when the loop vectorizer considers using partial vector loads
15924 and stores as an alternative to falling back to scalar code.  0 stops
15925 the vectorizer from ever using partial vector loads and stores.  1 allows
15926 partial vector loads and stores if vectorization removes the need for the
15927 code to iterate.  2 allows partial vector loads and stores in all loops.
15928 The parameter only has an effect on targets that support partial
15929 vector loads and stores.
15931 @item vect-inner-loop-cost-factor
15932 The maximum factor which the loop vectorizer applies to the cost of statements
15933 in an inner loop relative to the loop being vectorized.  The factor applied
15934 is the maximum of the estimated number of iterations of the inner loop and
15935 this parameter.  The default value of this parameter is 50.
15937 @item vect-induction-float
15938 Enable loop vectorization of floating point inductions.
15940 @item avoid-fma-max-bits
15941 Maximum number of bits for which we avoid creating FMAs.
15943 @item sms-loop-average-count-threshold
15944 A threshold on the average loop count considered by the swing modulo scheduler.
15946 @item sms-dfa-history
15947 The number of cycles the swing modulo scheduler considers when checking
15948 conflicts using DFA.
15950 @item graphite-allow-codegen-errors
15951 Whether codegen errors should be ICEs when @option{-fchecking}.
15953 @item sms-max-ii-factor
15954 A factor for tuning the upper bound that swing modulo scheduler
15955 uses for scheduling a loop.
15957 @item lra-max-considered-reload-pseudos
15958 The max number of reload pseudos which are considered during
15959 spilling a non-reload pseudo.
15961 @item max-pow-sqrt-depth
15962 Maximum depth of sqrt chains to use when synthesizing exponentiation
15963 by a real constant.
15965 @item max-dse-active-local-stores
15966 Maximum number of active local stores in RTL dead store elimination.
15968 @item asan-instrument-allocas
15969 Enable asan allocas/VLAs protection.
15971 @item max-iterations-computation-cost
15972 Bound on the cost of an expression to compute the number of iterations.
15974 @item max-isl-operations
15975 Maximum number of isl operations, 0 means unlimited.
15977 @item graphite-max-arrays-per-scop
15978 Maximum number of arrays per scop.
15980 @item max-vartrack-reverse-op-size
15981 Max. size of loc list for which reverse ops should be added.
15983 @item fsm-scale-path-stmts
15984 Scale factor to apply to the number of statements in a threading path
15985 crossing a loop backedge when comparing to
15986 @option{--param=max-jump-thread-duplication-stmts}.
15988 @item uninit-control-dep-attempts
15989 Maximum number of nested calls to search for control dependencies
15990 during uninitialized variable analysis.
15992 @item sched-autopref-queue-depth
15993 Hardware autoprefetcher scheduler model control flag.
15994 Number of lookahead cycles the model looks into; at '
15995 ' only enable instruction sorting heuristic.
15997 @item loop-versioning-max-inner-insns
15998 The maximum number of instructions that an inner loop can have
15999 before the loop versioning pass considers it too big to copy.
16001 @item loop-versioning-max-outer-insns
16002 The maximum number of instructions that an outer loop can have
16003 before the loop versioning pass considers it too big to copy,
16004 discounting any instructions in inner loops that directly benefit
16005 from versioning.
16007 @item ssa-name-def-chain-limit
16008 The maximum number of SSA_NAME assignments to follow in determining
16009 a property of a variable such as its value.  This limits the number
16010 of iterations or recursive calls GCC performs when optimizing certain
16011 statements or when determining their validity prior to issuing
16012 diagnostics.
16014 @item store-merging-max-size
16015 Maximum size of a single store merging region in bytes.
16017 @item hash-table-verification-limit
16018 The number of elements for which hash table verification is done
16019 for each searched element.
16021 @item max-find-base-term-values
16022 Maximum number of VALUEs handled during a single find_base_term call.
16024 @item analyzer-max-enodes-per-program-point
16025 The maximum number of exploded nodes per program point within
16026 the analyzer, before terminating analysis of that point.
16028 @item analyzer-max-constraints
16029 The maximum number of constraints per state.
16031 @item analyzer-min-snodes-for-call-summary
16032 The minimum number of supernodes within a function for the
16033 analyzer to consider summarizing its effects at call sites.
16035 @item analyzer-max-enodes-for-full-dump
16036 The maximum depth of exploded nodes that should appear in a dot dump
16037 before switching to a less verbose format.
16039 @item analyzer-max-recursion-depth
16040 The maximum number of times a callsite can appear in a call stack
16041 within the analyzer, before terminating analysis of a call that would
16042 recurse deeper.
16044 @item analyzer-max-svalue-depth
16045 The maximum depth of a symbolic value, before approximating
16046 the value as unknown.
16048 @item analyzer-max-infeasible-edges
16049 The maximum number of infeasible edges to reject before declaring
16050 a diagnostic as infeasible.
16052 @item gimple-fe-computed-hot-bb-threshold
16053 The number of executions of a basic block which is considered hot.
16054 The parameter is used only in GIMPLE FE.
16056 @item analyzer-bb-explosion-factor
16057 The maximum number of 'after supernode' exploded nodes within the analyzer
16058 per supernode, before terminating analysis.
16060 @item ranger-logical-depth
16061 Maximum depth of logical expression evaluation ranger will look through
16062 when evaluating outgoing edge ranges.
16064 @item relation-block-limit
16065 Maximum number of relations the oracle will register in a basic block.
16067 @item min-pagesize
16068 Minimum page size for warning purposes.
16070 @item openacc-kernels
16071 Specify mode of OpenACC `kernels' constructs handling.
16072 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16073 constructs are decomposed into parts, a sequence of compute
16074 constructs, each then handled individually.
16075 This is work in progress.
16076 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16077 constructs are handled by the @samp{parloops} pass, en bloc.
16078 This is the current default.
16080 @item openacc-privatization
16081 Specify mode of OpenACC privatization diagnostics for
16082 @option{-fopt-info-omp-note} and applicable
16083 @option{-fdump-tree-*-details}.
16084 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16085 This is the current default.
16086 With @option{--param=openacc-privatization=noisy}, do diagnose.
16088 @end table
16090 The following choices of @var{name} are available on AArch64 targets:
16092 @table @gcctabopt
16093 @item aarch64-sve-compare-costs
16094 When vectorizing for SVE, consider using ``unpacked'' vectors for
16095 smaller elements and use the cost model to pick the cheapest approach.
16096 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16098 Using unpacked vectors includes storing smaller elements in larger
16099 containers and accessing elements with extending loads and truncating
16100 stores.
16102 @item aarch64-float-recp-precision
16103 The number of Newton iterations for calculating the reciprocal for float type.
16104 The precision of division is proportional to this param when division
16105 approximation is enabled.  The default value is 1.
16107 @item aarch64-double-recp-precision
16108 The number of Newton iterations for calculating the reciprocal for double type.
16109 The precision of division is propotional to this param when division
16110 approximation is enabled.  The default value is 2.
16112 @item aarch64-autovec-preference
16113 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16114 0 to 4, inclusive.
16115 @table @samp
16116 @item 0
16117 Use the default heuristics.
16118 @item 1
16119 Use only Advanced SIMD for auto-vectorization.
16120 @item 2
16121 Use only SVE for auto-vectorization.
16122 @item 3
16123 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16124 deemed equal.
16125 @item 4
16126 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16127 @end table
16128 The default value is 0.
16130 @item aarch64-loop-vect-issue-rate-niters
16131 The tuning for some AArch64 CPUs tries to take both latencies and issue
16132 rates into account when deciding whether a loop should be vectorized
16133 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16134 If this parameter is set to @var{n}, GCC will not use this heuristic
16135 for loops that are known to execute in fewer than @var{n} Advanced
16136 SIMD iterations.
16138 @item aarch64-vect-unroll-limit
16139 The vectorizer will use available tuning information to determine whether it
16140 would be beneficial to unroll the main vectorized loop and by how much.  This
16141 parameter set's the upper bound of how much the vectorizer will unroll the main
16142 loop.  The default value is four.
16144 @end table
16146 The following choices of @var{name} are available on i386 and x86_64 targets:
16148 @table @gcctabopt
16149 @item x86-stlf-window-ninsns
16150 Instructions number above which STFL stall penalty can be compensated.
16152 @end table
16154 @end table
16156 @node Instrumentation Options
16157 @section Program Instrumentation Options
16158 @cindex instrumentation options
16159 @cindex program instrumentation options
16160 @cindex run-time error checking options
16161 @cindex profiling options
16162 @cindex options, program instrumentation
16163 @cindex options, run-time error checking
16164 @cindex options, profiling
16166 GCC supports a number of command-line options that control adding
16167 run-time instrumentation to the code it normally generates.  
16168 For example, one purpose of instrumentation is collect profiling
16169 statistics for use in finding program hot spots, code coverage
16170 analysis, or profile-guided optimizations.
16171 Another class of program instrumentation is adding run-time checking 
16172 to detect programming errors like invalid pointer
16173 dereferences or out-of-bounds array accesses, as well as deliberately
16174 hostile attacks such as stack smashing or C++ vtable hijacking.
16175 There is also a general hook which can be used to implement other
16176 forms of tracing or function-level instrumentation for debug or
16177 program analysis purposes.
16179 @table @gcctabopt
16180 @cindex @command{prof}
16181 @cindex @command{gprof}
16182 @item -p
16183 @itemx -pg
16184 @opindex p
16185 @opindex pg
16186 Generate extra code to write profile information suitable for the
16187 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16188 (for @option{-pg}).  You must use this option when compiling
16189 the source files you want data about, and you must also use it when
16190 linking.
16192 You can use the function attribute @code{no_instrument_function} to
16193 suppress profiling of individual functions when compiling with these options.
16194 @xref{Common Function Attributes}.
16196 @item -fprofile-arcs
16197 @opindex fprofile-arcs
16198 Add code so that program flow @dfn{arcs} are instrumented.  During
16199 execution the program records how many times each branch and call is
16200 executed and how many times it is taken or returns.  On targets that support
16201 constructors with priority support, profiling properly handles constructors,
16202 destructors and C++ constructors (and destructors) of classes which are used
16203 as a type of a global variable.
16205 When the compiled
16206 program exits it saves this data to a file called
16207 @file{@var{auxname}.gcda} for each source file.  The data may be used for
16208 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16209 test coverage analysis (@option{-ftest-coverage}).  Each object file's
16210 @var{auxname} is generated from the name of the output file, if
16211 explicitly specified and it is not the final executable, otherwise it is
16212 the basename of the source file.  In both cases any suffix is removed
16213 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16214 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16216 Note that if a command line directly links source files, the corresponding
16217 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16218 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16219 @file{binary-b.gcda} files.
16221 @xref{Cross-profiling}.
16223 @cindex @command{gcov}
16224 @item --coverage
16225 @opindex coverage
16227 This option is used to compile and link code instrumented for coverage
16228 analysis.  The option is a synonym for @option{-fprofile-arcs}
16229 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16230 linking).  See the documentation for those options for more details.
16232 @itemize
16234 @item
16235 Compile the source files with @option{-fprofile-arcs} plus optimization
16236 and code generation options.  For test coverage analysis, use the
16237 additional @option{-ftest-coverage} option.  You do not need to profile
16238 every source file in a program.
16240 @item
16241 Compile the source files additionally with @option{-fprofile-abs-path}
16242 to create absolute path names in the @file{.gcno} files.  This allows
16243 @command{gcov} to find the correct sources in projects where compilations
16244 occur with different working directories.
16246 @item
16247 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16248 (the latter implies the former).
16250 @item
16251 Run the program on a representative workload to generate the arc profile
16252 information.  This may be repeated any number of times.  You can run
16253 concurrent instances of your program, and provided that the file system
16254 supports locking, the data files will be correctly updated.  Unless
16255 a strict ISO C dialect option is in effect, @code{fork} calls are
16256 detected and correctly handled without double counting.
16258 Moreover, an object file can be recompiled multiple times
16259 and the corresponding @file{.gcda} file merges as long as
16260 the source file and the compiler options are unchanged.
16262 @item
16263 For profile-directed optimizations, compile the source files again with
16264 the same optimization and code generation options plus
16265 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16266 Control Optimization}).
16268 @item
16269 For test coverage analysis, use @command{gcov} to produce human readable
16270 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
16271 @command{gcov} documentation for further information.
16273 @end itemize
16275 With @option{-fprofile-arcs}, for each function of your program GCC
16276 creates a program flow graph, then finds a spanning tree for the graph.
16277 Only arcs that are not on the spanning tree have to be instrumented: the
16278 compiler adds code to count the number of times that these arcs are
16279 executed.  When an arc is the only exit or only entrance to a block, the
16280 instrumentation code can be added to the block; otherwise, a new basic
16281 block must be created to hold the instrumentation code.
16283 @need 2000
16284 @item -ftest-coverage
16285 @opindex ftest-coverage
16286 Produce a notes file that the @command{gcov} code-coverage utility
16287 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16288 show program coverage.  Each source file's note file is called
16289 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
16290 above for a description of @var{auxname} and instructions on how to
16291 generate test coverage data.  Coverage data matches the source files
16292 more closely if you do not optimize.
16294 @item -fprofile-abs-path
16295 @opindex fprofile-abs-path
16296 Automatically convert relative source file names to absolute path names
16297 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
16298 sources in projects where compilations occur with different working
16299 directories.
16301 @item -fprofile-dir=@var{path}
16302 @opindex fprofile-dir
16304 Set the directory to search for the profile data files in to @var{path}.
16305 This option affects only the profile data generated by
16306 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16307 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16308 and its related options.  Both absolute and relative paths can be used.
16309 By default, GCC uses the current directory as @var{path}, thus the
16310 profile data file appears in the same directory as the object file.
16311 In order to prevent the file name clashing, if the object file name is
16312 not an absolute path, we mangle the absolute path of the
16313 @file{@var{sourcename}.gcda} file and use it as the file name of a
16314 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
16315 See similar option @option{-fprofile-note}.
16317 When an executable is run in a massive parallel environment, it is recommended
16318 to save profile to different folders.  That can be done with variables
16319 in @var{path} that are exported during run-time:
16321 @table @gcctabopt
16323 @item %p
16324 process ID.
16326 @item %q@{VAR@}
16327 value of environment variable @var{VAR}
16329 @end table
16331 @item -fprofile-generate
16332 @itemx -fprofile-generate=@var{path}
16333 @opindex fprofile-generate
16335 Enable options usually used for instrumenting application to produce
16336 profile useful for later recompilation with profile feedback based
16337 optimization.  You must use @option{-fprofile-generate} both when
16338 compiling and when linking your program.
16340 The following options are enabled:
16341 @option{-fprofile-arcs}, @option{-fprofile-values},
16342 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16344 If @var{path} is specified, GCC looks at the @var{path} to find
16345 the profile feedback data files. See @option{-fprofile-dir}.
16347 To optimize the program based on the collected profile information, use
16348 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
16350 @item -fprofile-info-section
16351 @itemx -fprofile-info-section=@var{name}
16352 @opindex fprofile-info-section
16354 Register the profile information in the specified section instead of using a
16355 constructor/destructor.  The section name is @var{name} if it is specified,
16356 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
16357 profile information generated by @option{-fprofile-arcs} is placed in the
16358 specified section for each translation unit.  This option disables the profile
16359 information registration through a constructor and it disables the profile
16360 information processing through a destructor.  This option is not intended to be
16361 used in hosted environments such as GNU/Linux.  It targets freestanding
16362 environments (for example embedded systems) with limited resources which do not
16363 support constructors/destructors or the C library file I/O.
16365 The linker could collect the input sections in a continuous memory block and
16366 define start and end symbols.  A GNU linker script example which defines a
16367 linker output section follows:
16369 @smallexample
16370   .gcov_info      :
16371   @{
16372     PROVIDE (__gcov_info_start = .);
16373     KEEP (*(.gcov_info))
16374     PROVIDE (__gcov_info_end = .);
16375   @}
16376 @end smallexample
16378 The program could dump the profiling information registered in this linker set
16379 for example like this:
16381 @smallexample
16382 #include <gcov.h>
16383 #include <stdio.h>
16384 #include <stdlib.h>
16386 extern const struct gcov_info *const __gcov_info_start[];
16387 extern const struct gcov_info *const __gcov_info_end[];
16389 static void
16390 dump (const void *d, unsigned n, void *arg)
16392   const unsigned char *c = d;
16394   for (unsigned i = 0; i < n; ++i)
16395     printf ("%02x", c[i]);
16398 static void
16399 filename (const char *f, void *arg)
16401   __gcov_filename_to_gcfn (f, dump, arg );
16404 static void *
16405 allocate (unsigned length, void *arg)
16407   return malloc (length);
16410 static void
16411 dump_gcov_info (void)
16413   const struct gcov_info *const *info = __gcov_info_start;
16414   const struct gcov_info *const *end = __gcov_info_end;
16416   /* Obfuscate variable to prevent compiler optimizations.  */
16417   __asm__ ("" : "+r" (info));
16419   while (info != end)
16420   @{
16421     void *arg = NULL;
16422     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16423     putchar ('\n');
16424     ++info;
16425   @}
16429 main (void)
16431   dump_gcov_info ();
16432   return 0;
16434 @end smallexample
16436 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16437 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16438 @code{__gcov_info_to_gcda} functions and merge the profile information into
16439 @file{.gcda} files on the host filesystem.
16441 @item -fprofile-note=@var{path}
16442 @opindex fprofile-note
16444 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16445 location.  If you combine the option with multiple source files,
16446 the @file{.gcno} file will be overwritten.
16448 @item -fprofile-prefix-path=@var{path}
16449 @opindex fprofile-prefix-path
16451 This option can be used in combination with
16452 @option{profile-generate=}@var{profile_dir} and
16453 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16454 directory of built source tree.  By default @var{profile_dir} will contain
16455 files with mangled absolute paths of all object files in the built project.
16456 This is not desirable when directory used to build the instrumented binary
16457 differs from the directory used to build the binary optimized with profile
16458 feedback because the profile data will not be found during the optimized build.
16459 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16460 pointing to the base directory of the build can be used to strip the irrelevant
16461 part of the path and keep all file names relative to the main build directory.
16463 @item -fprofile-prefix-map=@var{old}=@var{new}
16464 @opindex fprofile-prefix-map
16465 When compiling files residing in directory @file{@var{old}}, record
16466 profiling information (with @option{--coverage})
16467 describing them as if the files resided in
16468 directory @file{@var{new}} instead.
16469 See also @option{-ffile-prefix-map}.
16471 @item -fprofile-update=@var{method}
16472 @opindex fprofile-update
16474 Alter the update method for an application instrumented for profile
16475 feedback based optimization.  The @var{method} argument should be one of
16476 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16477 The first one is useful for single-threaded applications,
16478 while the second one prevents profile corruption by emitting thread-safe code.
16480 @strong{Warning:} When an application does not properly join all threads
16481 (or creates an detached thread), a profile file can be still corrupted.
16483 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16484 when supported by a target, or to @samp{single} otherwise.  The GCC driver
16485 automatically selects @samp{prefer-atomic} when @option{-pthread}
16486 is present in the command line.
16488 @item -fprofile-filter-files=@var{regex}
16489 @opindex fprofile-filter-files
16491 Instrument only functions from files whose name matches
16492 any of the regular expressions (separated by semi-colons).
16494 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16495 only @file{main.c} and all C files starting with 'module'.
16497 @item -fprofile-exclude-files=@var{regex}
16498 @opindex fprofile-exclude-files
16500 Instrument only functions from files whose name does not match
16501 any of the regular expressions (separated by semi-colons).
16503 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16504 of all files that are located in the @file{/usr/} folder.
16506 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16507 @opindex fprofile-reproducible
16508 Control level of reproducibility of profile gathered by
16509 @code{-fprofile-generate}.  This makes it possible to rebuild program
16510 with same outcome which is useful, for example, for distribution
16511 packages.
16513 With @option{-fprofile-reproducible=serial} the profile gathered by
16514 @option{-fprofile-generate} is reproducible provided the trained program
16515 behaves the same at each invocation of the train run, it is not
16516 multi-threaded and profile data streaming is always done in the same
16517 order.  Note that profile streaming happens at the end of program run but
16518 also before @code{fork} function is invoked.
16520 Note that it is quite common that execution counts of some part of
16521 programs depends, for example, on length of temporary file names or
16522 memory space randomization (that may affect hash-table collision rate).
16523 Such non-reproducible part of programs may be annotated by
16524 @code{no_instrument_function} function attribute. @command{gcov-dump} with
16525 @option{-l} can be used to dump gathered data and verify that they are
16526 indeed reproducible.
16528 With @option{-fprofile-reproducible=parallel-runs} collected profile
16529 stays reproducible regardless the order of streaming of the data into
16530 gcda files.  This setting makes it possible to run multiple instances of
16531 instrumented program in parallel (such as with @code{make -j}). This
16532 reduces quality of gathered data, in particular of indirect call
16533 profiling.
16535 @item -fsanitize=address
16536 @opindex fsanitize=address
16537 Enable AddressSanitizer, a fast memory error detector.
16538 Memory access instructions are instrumented to detect
16539 out-of-bounds and use-after-free bugs.
16540 The option enables @option{-fsanitize-address-use-after-scope}.
16541 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
16542 more details.  The run-time behavior can be influenced using the
16543 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
16544 the available options are shown at startup of the instrumented program.  See
16545 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
16546 for a list of supported options.
16547 The option cannot be combined with @option{-fsanitize=thread} or
16548 @option{-fsanitize=hwaddress}.  Note that the only target
16549 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
16551 To get more accurate stack traces, it is possible to use options such as
16552 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
16553 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
16554 optimizing sibling and tail recursive calls; this option is implicit for
16555 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
16556 disables Identical Code Folding for functions).  Since multiple runs of the
16557 program may yield backtraces with different addresses due to ASLR (Address
16558 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
16559 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
16561 @item -fsanitize=kernel-address
16562 @opindex fsanitize=kernel-address
16563 Enable AddressSanitizer for Linux kernel.
16564 See @uref{https://github.com/google/kasan} for more details.
16566 @item -fsanitize=hwaddress
16567 @opindex fsanitize=hwaddress
16568 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
16569 ignore the top byte of a pointer to allow the detection of memory errors with
16570 a low memory overhead.
16571 Memory access instructions are instrumented to detect out-of-bounds and
16572 use-after-free bugs.
16573 The option enables @option{-fsanitize-address-use-after-scope}.
16575 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
16576 for more details.  The run-time behavior can be influenced using the
16577 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
16578 the available options are shown at startup of the instrumented program.
16579 The option cannot be combined with @option{-fsanitize=thread} or
16580 @option{-fsanitize=address}, and is currently only available on AArch64.
16582 @item -fsanitize=kernel-hwaddress
16583 @opindex fsanitize=kernel-hwaddress
16584 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
16585 Similar to @option{-fsanitize=kernel-address} but using an alternate
16586 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
16587 instrumentation differences necessary for compiling the Linux kernel.
16588 These differences are to avoid hwasan library initialization calls and to
16589 account for the stack pointer having a different value in its top byte.
16591 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
16592 Instrumenting the stack and alloca calls are not on by default but are still
16593 possible by specifying the command-line options
16594 @option{--param hwasan-instrument-stack=1} and
16595 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
16596 tag is not implemented for kernel instrumentation.
16598 @item -fsanitize=pointer-compare
16599 @opindex fsanitize=pointer-compare
16600 Instrument comparison operation (<, <=, >, >=) with pointer operands.
16601 The option must be combined with either @option{-fsanitize=kernel-address} or
16602 @option{-fsanitize=address}
16603 The option cannot be combined with @option{-fsanitize=thread}.
16604 Note: By default the check is disabled at run time.  To enable it,
16605 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16606 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16607 invalid operation only when both pointers are non-null.
16609 @item -fsanitize=pointer-subtract
16610 @opindex fsanitize=pointer-subtract
16611 Instrument subtraction with pointer operands.
16612 The option must be combined with either @option{-fsanitize=kernel-address} or
16613 @option{-fsanitize=address}
16614 The option cannot be combined with @option{-fsanitize=thread}.
16615 Note: By default the check is disabled at run time.  To enable it,
16616 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16617 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16618 invalid operation only when both pointers are non-null.
16620 @item -fsanitize=shadow-call-stack
16621 @opindex fsanitize=shadow-call-stack
16622 Enable ShadowCallStack, a security enhancement mechanism used to protect
16623 programs against return address overwrites (e.g. stack buffer overflows.)
16624 It works by saving a function's return address to a separately allocated
16625 shadow call stack in the function prologue and restoring the return address
16626 from the shadow call stack in the function epilogue.  Instrumentation only
16627 occurs in functions that need to save the return address to the stack.
16629 Currently it only supports the aarch64 platform.  It is specifically
16630 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
16631 For the user space programs, runtime support is not currently provided
16632 in libc and libgcc.  Users who want to use this feature in user space need
16633 to provide their own support for the runtime.  It should be noted that
16634 this may cause the ABI rules to be broken.
16636 On aarch64, the instrumentation makes use of the platform register @code{x18}.
16637 This generally means that any code that may run on the same thread as code
16638 compiled with ShadowCallStack must be compiled with the flag
16639 @option{-ffixed-x18}, otherwise functions compiled without
16640 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
16641 stack pointer.
16643 Also, because there is no userspace runtime support, code compiled with
16644 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
16645 to turn off exceptions.
16647 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
16648 details.
16650 @item -fsanitize=thread
16651 @opindex fsanitize=thread
16652 Enable ThreadSanitizer, a fast data race detector.
16653 Memory access instructions are instrumented to detect
16654 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
16655 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
16656 environment variable; see
16657 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
16658 supported options.
16659 The option cannot be combined with @option{-fsanitize=address},
16660 @option{-fsanitize=leak}.
16662 Note that sanitized atomic builtins cannot throw exceptions when
16663 operating on invalid memory addresses with non-call exceptions
16664 (@option{-fnon-call-exceptions}).
16666 @item -fsanitize=leak
16667 @opindex fsanitize=leak
16668 Enable LeakSanitizer, a memory leak detector.
16669 This option only matters for linking of executables and
16670 the executable is linked against a library that overrides @code{malloc}
16671 and other allocator functions.  See
16672 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
16673 details.  The run-time behavior can be influenced using the
16674 @env{LSAN_OPTIONS} environment variable.
16675 The option cannot be combined with @option{-fsanitize=thread}.
16677 @item -fsanitize=undefined
16678 @opindex fsanitize=undefined
16679 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
16680 Various computations are instrumented to detect undefined behavior
16681 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
16682 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
16684 @table @gcctabopt
16686 @item -fsanitize=shift
16687 @opindex fsanitize=shift
16688 This option enables checking that the result of a shift operation is
16689 not undefined.  Note that what exactly is considered undefined differs
16690 slightly between C and C++, as well as between ISO C90 and C99, etc.
16691 This option has two suboptions, @option{-fsanitize=shift-base} and
16692 @option{-fsanitize=shift-exponent}.
16694 @item -fsanitize=shift-exponent
16695 @opindex fsanitize=shift-exponent
16696 This option enables checking that the second argument of a shift operation
16697 is not negative and is smaller than the precision of the promoted first
16698 argument.
16700 @item -fsanitize=shift-base
16701 @opindex fsanitize=shift-base
16702 If the second argument of a shift operation is within range, check that the
16703 result of a shift operation is not undefined.  Note that what exactly is
16704 considered undefined differs slightly between C and C++, as well as between
16705 ISO C90 and C99, etc.
16707 @item -fsanitize=integer-divide-by-zero
16708 @opindex fsanitize=integer-divide-by-zero
16709 Detect integer division by zero.
16711 @item -fsanitize=unreachable
16712 @opindex fsanitize=unreachable
16713 With this option, the compiler turns the @code{__builtin_unreachable}
16714 call into a diagnostics message call instead.  When reaching the
16715 @code{__builtin_unreachable} call, the behavior is undefined.
16717 @item -fsanitize=vla-bound
16718 @opindex fsanitize=vla-bound
16719 This option instructs the compiler to check that the size of a variable
16720 length array is positive.
16722 @item -fsanitize=null
16723 @opindex fsanitize=null
16724 This option enables pointer checking.  Particularly, the application
16725 built with this option turned on will issue an error message when it
16726 tries to dereference a NULL pointer, or if a reference (possibly an
16727 rvalue reference) is bound to a NULL pointer, or if a method is invoked
16728 on an object pointed by a NULL pointer.
16730 @item -fsanitize=return
16731 @opindex fsanitize=return
16732 This option enables return statement checking.  Programs
16733 built with this option turned on will issue an error message
16734 when the end of a non-void function is reached without actually
16735 returning a value.  This option works in C++ only.
16737 @item -fsanitize=signed-integer-overflow
16738 @opindex fsanitize=signed-integer-overflow
16739 This option enables signed integer overflow checking.  We check that
16740 the result of @code{+}, @code{*}, and both unary and binary @code{-}
16741 does not overflow in the signed arithmetics.  This also detects
16742 @code{INT_MIN / -1} signed division.  Note, integer promotion
16743 rules must be taken into account.  That is, the following is not an
16744 overflow:
16745 @smallexample
16746 signed char a = SCHAR_MAX;
16747 a++;
16748 @end smallexample
16750 @item -fsanitize=bounds
16751 @opindex fsanitize=bounds
16752 This option enables instrumentation of array bounds.  Various out of bounds
16753 accesses are detected.  Flexible array members, flexible array member-like
16754 arrays, and initializers of variables with static storage are not instrumented.
16756 @item -fsanitize=bounds-strict
16757 @opindex fsanitize=bounds-strict
16758 This option enables strict instrumentation of array bounds.  Most out of bounds
16759 accesses are detected, including flexible array members and flexible array
16760 member-like arrays.  Initializers of variables with static storage are not
16761 instrumented.
16763 @item -fsanitize=alignment
16764 @opindex fsanitize=alignment
16766 This option enables checking of alignment of pointers when they are
16767 dereferenced, or when a reference is bound to insufficiently aligned target,
16768 or when a method or constructor is invoked on insufficiently aligned object.
16770 @item -fsanitize=object-size
16771 @opindex fsanitize=object-size
16772 This option enables instrumentation of memory references using the
16773 @code{__builtin_dynamic_object_size} function.  Various out of bounds
16774 pointer accesses are detected.
16776 @item -fsanitize=float-divide-by-zero
16777 @opindex fsanitize=float-divide-by-zero
16778 Detect floating-point division by zero.  Unlike other similar options,
16779 @option{-fsanitize=float-divide-by-zero} is not enabled by
16780 @option{-fsanitize=undefined}, since floating-point division by zero can
16781 be a legitimate way of obtaining infinities and NaNs.
16783 @item -fsanitize=float-cast-overflow
16784 @opindex fsanitize=float-cast-overflow
16785 This option enables floating-point type to integer conversion checking.
16786 We check that the result of the conversion does not overflow.
16787 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
16788 not enabled by @option{-fsanitize=undefined}.
16789 This option does not work well with @code{FE_INVALID} exceptions enabled.
16791 @item -fsanitize=nonnull-attribute
16792 @opindex fsanitize=nonnull-attribute
16794 This option enables instrumentation of calls, checking whether null values
16795 are not passed to arguments marked as requiring a non-null value by the
16796 @code{nonnull} function attribute.
16798 @item -fsanitize=returns-nonnull-attribute
16799 @opindex fsanitize=returns-nonnull-attribute
16801 This option enables instrumentation of return statements in functions
16802 marked with @code{returns_nonnull} function attribute, to detect returning
16803 of null values from such functions.
16805 @item -fsanitize=bool
16806 @opindex fsanitize=bool
16808 This option enables instrumentation of loads from bool.  If a value other
16809 than 0/1 is loaded, a run-time error is issued.
16811 @item -fsanitize=enum
16812 @opindex fsanitize=enum
16814 This option enables instrumentation of loads from an enum type.  If
16815 a value outside the range of values for the enum type is loaded,
16816 a run-time error is issued.
16818 @item -fsanitize=vptr
16819 @opindex fsanitize=vptr
16821 This option enables instrumentation of C++ member function calls, member
16822 accesses and some conversions between pointers to base and derived classes,
16823 to verify the referenced object has the correct dynamic type.
16825 @item -fsanitize=pointer-overflow
16826 @opindex fsanitize=pointer-overflow
16828 This option enables instrumentation of pointer arithmetics.  If the pointer
16829 arithmetics overflows, a run-time error is issued.
16831 @item -fsanitize=builtin
16832 @opindex fsanitize=builtin
16834 This option enables instrumentation of arguments to selected builtin
16835 functions.  If an invalid value is passed to such arguments, a run-time
16836 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
16837 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
16838 by this option.
16840 @end table
16842 Note that sanitizers tend to increase the rate of false positive
16843 warnings, most notably those around @option{-Wmaybe-uninitialized}.
16844 We recommend against combining @option{-Werror} and [the use of]
16845 sanitizers.
16847 While @option{-ftrapv} causes traps for signed overflows to be emitted,
16848 @option{-fsanitize=undefined} gives a diagnostic message.
16849 This currently works only for the C family of languages.
16851 @item -fno-sanitize=all
16852 @opindex fno-sanitize=all
16854 This option disables all previously enabled sanitizers.
16855 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
16856 together.
16858 @item -fasan-shadow-offset=@var{number}
16859 @opindex fasan-shadow-offset
16860 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
16861 It is useful for experimenting with different shadow memory layouts in
16862 Kernel AddressSanitizer.
16864 @item -fsanitize-sections=@var{s1},@var{s2},...
16865 @opindex fsanitize-sections
16866 Sanitize global variables in selected user-defined sections.  @var{si} may
16867 contain wildcards.
16869 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
16870 @opindex fsanitize-recover
16871 @opindex fno-sanitize-recover
16872 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
16873 mentioned in comma-separated list of @var{opts}.  Enabling this option
16874 for a sanitizer component causes it to attempt to continue
16875 running the program as if no error happened.  This means multiple
16876 runtime errors can be reported in a single program run, and the exit
16877 code of the program may indicate success even when errors
16878 have been reported.  The @option{-fno-sanitize-recover=} option
16879 can be used to alter
16880 this behavior: only the first detected error is reported
16881 and program then exits with a non-zero exit code.
16883 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
16884 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
16885 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
16886 @option{-fsanitize=bounds-strict},
16887 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
16888 For these sanitizers error recovery is turned on by default,
16889 except @option{-fsanitize=address}, for which this feature is experimental.
16890 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
16891 accepted, the former enables recovery for all sanitizers that support it,
16892 the latter disables recovery for all sanitizers that support it.
16894 Even if a recovery mode is turned on the compiler side, it needs to be also
16895 enabled on the runtime library side, otherwise the failures are still fatal.
16896 The runtime library defaults to @code{halt_on_error=0} for
16897 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
16898 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
16899 setting the @code{halt_on_error} flag in the corresponding environment variable.
16901 Syntax without an explicit @var{opts} parameter is deprecated.  It is
16902 equivalent to specifying an @var{opts} list of:
16904 @smallexample
16905 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
16906 @end smallexample
16908 @item -fsanitize-address-use-after-scope
16909 @opindex fsanitize-address-use-after-scope
16910 Enable sanitization of local variables to detect use-after-scope bugs.
16911 The option sets @option{-fstack-reuse} to @samp{none}.
16913 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
16914 @opindex fsanitize-trap
16915 @opindex fno-sanitize-trap
16916 The @option{-fsanitize-trap=} option instructs the compiler to
16917 report for sanitizers mentioned in comma-separated list of @var{opts}
16918 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
16919 library routine.  If this option is enabled for certain sanitizer,
16920 it takes precedence over the @option{-fsanitizer-recover=} for that
16921 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
16922 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
16924 The advantage of this is that the @code{libubsan} library is not needed
16925 and is not linked in, so this is usable even in freestanding environments.
16927 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
16928 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
16929 @option{-fsanitize=float-divide-by-zero} and
16930 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
16931 specified, which enables it for @code{undefined} suboptions,
16932 @option{-fsanitize=float-cast-overflow},
16933 @option{-fsanitize=float-divide-by-zero} and
16934 @option{-fsanitize=bounds-strict}.
16935 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
16936 and @code{-fsanitize=vptr} is enabled on the command line, the
16937 instrumentation is silently ignored as the instrumentation always needs
16938 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
16940 @item -fsanitize-undefined-trap-on-error
16941 @opindex fsanitize-undefined-trap-on-error
16942 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
16943 equivalent of @option{-fsanitize-trap=all}.
16945 @item -fsanitize-coverage=trace-pc
16946 @opindex fsanitize-coverage=trace-pc
16947 Enable coverage-guided fuzzing code instrumentation.
16948 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
16950 @item -fsanitize-coverage=trace-cmp
16951 @opindex fsanitize-coverage=trace-cmp
16952 Enable dataflow guided fuzzing code instrumentation.
16953 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
16954 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
16955 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
16956 variable or @code{__sanitizer_cov_trace_const_cmp1},
16957 @code{__sanitizer_cov_trace_const_cmp2},
16958 @code{__sanitizer_cov_trace_const_cmp4} or
16959 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
16960 operand constant, @code{__sanitizer_cov_trace_cmpf} or
16961 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
16962 @code{__sanitizer_cov_trace_switch} for switch statements.
16964 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
16965 @opindex fcf-protection
16966 Enable code instrumentation of control-flow transfers to increase
16967 program security by checking that target addresses of control-flow
16968 transfer instructions (such as indirect function call, function return,
16969 indirect jump) are valid.  This prevents diverting the flow of control
16970 to an unexpected target.  This is intended to protect against such
16971 threats as Return-oriented Programming (ROP), and similarly
16972 call/jmp-oriented programming (COP/JOP).
16974 The value @code{branch} tells the compiler to implement checking of
16975 validity of control-flow transfer at the point of indirect branch
16976 instructions, i.e.@: call/jmp instructions.  The value @code{return}
16977 implements checking of validity at the point of returning from a
16978 function.  The value @code{full} is an alias for specifying both
16979 @code{branch} and @code{return}. The value @code{none} turns off
16980 instrumentation.
16982 The value @code{check} is used for the final link with link-time
16983 optimization (LTO).  An error is issued if LTO object files are
16984 compiled with different @option{-fcf-protection} values.  The
16985 value @code{check} is ignored at the compile time.
16987 The macro @code{__CET__} is defined when @option{-fcf-protection} is
16988 used.  The first bit of @code{__CET__} is set to 1 for the value
16989 @code{branch} and the second bit of @code{__CET__} is set to 1 for
16990 the @code{return}.
16992 You can also use the @code{nocf_check} attribute to identify
16993 which functions and calls should be skipped from instrumentation
16994 (@pxref{Function Attributes}).
16996 Currently the x86 GNU/Linux target provides an implementation based
16997 on Intel Control-flow Enforcement Technology (CET) which works for
16998 i686 processor or newer.
17000 @item -fharden-compares
17001 @opindex fharden-compares
17002 For every logical test that survives gimple optimizations and is
17003 @emph{not} the condition in a conditional branch (for example,
17004 conditions tested for conditional moves, or to store in boolean
17005 variables), emit extra code to compute and verify the reversed
17006 condition, and to call @code{__builtin_trap} if the results do not
17007 match.  Use with @samp{-fharden-conditional-branches} to cover all
17008 conditionals.
17010 @item -fharden-conditional-branches
17011 @opindex fharden-conditional-branches
17012 For every non-vectorized conditional branch that survives gimple
17013 optimizations, emit extra code to compute and verify the reversed
17014 condition, and to call @code{__builtin_trap} if the result is
17015 unexpected.  Use with @samp{-fharden-compares} to cover all
17016 conditionals.
17018 @item -fstack-protector
17019 @opindex fstack-protector
17020 Emit extra code to check for buffer overflows, such as stack smashing
17021 attacks.  This is done by adding a guard variable to functions with
17022 vulnerable objects.  This includes functions that call @code{alloca}, and
17023 functions with buffers larger than or equal to 8 bytes.  The guards are
17024 initialized when a function is entered and then checked when the function
17025 exits.  If a guard check fails, an error message is printed and the program
17026 exits.  Only variables that are actually allocated on the stack are
17027 considered, optimized away variables or variables allocated in registers
17028 don't count.
17030 @item -fstack-protector-all
17031 @opindex fstack-protector-all
17032 Like @option{-fstack-protector} except that all functions are protected.
17034 @item -fstack-protector-strong
17035 @opindex fstack-protector-strong
17036 Like @option{-fstack-protector} but includes additional functions to
17037 be protected --- those that have local array definitions, or have
17038 references to local frame addresses.  Only variables that are actually
17039 allocated on the stack are considered, optimized away variables or variables
17040 allocated in registers don't count.
17042 @item -fstack-protector-explicit
17043 @opindex fstack-protector-explicit
17044 Like @option{-fstack-protector} but only protects those functions which
17045 have the @code{stack_protect} attribute.
17047 @item -fstack-check
17048 @opindex fstack-check
17049 Generate code to verify that you do not go beyond the boundary of the
17050 stack.  You should specify this flag if you are running in an
17051 environment with multiple threads, but you only rarely need to specify it in
17052 a single-threaded environment since stack overflow is automatically
17053 detected on nearly all systems if there is only one stack.
17055 Note that this switch does not actually cause checking to be done; the
17056 operating system or the language runtime must do that.  The switch causes
17057 generation of code to ensure that they see the stack being extended.
17059 You can additionally specify a string parameter: @samp{no} means no
17060 checking, @samp{generic} means force the use of old-style checking,
17061 @samp{specific} means use the best checking method and is equivalent
17062 to bare @option{-fstack-check}.
17064 Old-style checking is a generic mechanism that requires no specific
17065 target support in the compiler but comes with the following drawbacks:
17067 @enumerate
17068 @item
17069 Modified allocation strategy for large objects: they are always
17070 allocated dynamically if their size exceeds a fixed threshold.  Note this
17071 may change the semantics of some code.
17073 @item
17074 Fixed limit on the size of the static frame of functions: when it is
17075 topped by a particular function, stack checking is not reliable and
17076 a warning is issued by the compiler.
17078 @item
17079 Inefficiency: because of both the modified allocation strategy and the
17080 generic implementation, code performance is hampered.
17081 @end enumerate
17083 Note that old-style stack checking is also the fallback method for
17084 @samp{specific} if no target support has been added in the compiler.
17086 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17087 and stack overflows.  @samp{specific} is an excellent choice when compiling
17088 Ada code.  It is not generally sufficient to protect against stack-clash
17089 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
17091 @item -fstack-clash-protection
17092 @opindex fstack-clash-protection
17093 Generate code to prevent stack clash style attacks.  When this option is
17094 enabled, the compiler will only allocate one page of stack space at a time
17095 and each page is accessed immediately after allocation.  Thus, it prevents
17096 allocations from jumping over any stack guard page provided by the
17097 operating system.
17099 Most targets do not fully support stack clash protection.  However, on
17100 those targets @option{-fstack-clash-protection} will protect dynamic stack
17101 allocations.  @option{-fstack-clash-protection} may also provide limited
17102 protection for static stack allocations if the target supports
17103 @option{-fstack-check=specific}.
17105 @item -fstack-limit-register=@var{reg}
17106 @itemx -fstack-limit-symbol=@var{sym}
17107 @itemx -fno-stack-limit
17108 @opindex fstack-limit-register
17109 @opindex fstack-limit-symbol
17110 @opindex fno-stack-limit
17111 Generate code to ensure that the stack does not grow beyond a certain value,
17112 either the value of a register or the address of a symbol.  If a larger
17113 stack is required, a signal is raised at run time.  For most targets,
17114 the signal is raised before the stack overruns the boundary, so
17115 it is possible to catch the signal without taking special precautions.
17117 For instance, if the stack starts at absolute address @samp{0x80000000}
17118 and grows downwards, you can use the flags
17119 @option{-fstack-limit-symbol=__stack_limit} and
17120 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17121 of 128KB@.  Note that this may only work with the GNU linker.
17123 You can locally override stack limit checking by using the
17124 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17126 @item -fsplit-stack
17127 @opindex fsplit-stack
17128 Generate code to automatically split the stack before it overflows.
17129 The resulting program has a discontiguous stack which can only
17130 overflow if the program is unable to allocate any more memory.  This
17131 is most useful when running threaded programs, as it is no longer
17132 necessary to calculate a good stack size to use for each thread.  This
17133 is currently only implemented for the x86 targets running
17134 GNU/Linux.
17136 When code compiled with @option{-fsplit-stack} calls code compiled
17137 without @option{-fsplit-stack}, there may not be much stack space
17138 available for the latter code to run.  If compiling all code,
17139 including library code, with @option{-fsplit-stack} is not an option,
17140 then the linker can fix up these calls so that the code compiled
17141 without @option{-fsplit-stack} always has a large stack.  Support for
17142 this is implemented in the gold linker in GNU binutils release 2.21
17143 and later.
17145 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17146 @opindex fvtable-verify
17147 This option is only available when compiling C++ code.
17148 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17149 feature that verifies at run time, for every virtual call, that
17150 the vtable pointer through which the call is made is valid for the type of
17151 the object, and has not been corrupted or overwritten.  If an invalid vtable
17152 pointer is detected at run time, an error is reported and execution of the
17153 program is immediately halted.
17155 This option causes run-time data structures to be built at program startup,
17156 which are used for verifying the vtable pointers.  
17157 The options @samp{std} and @samp{preinit}
17158 control the timing of when these data structures are built.  In both cases the
17159 data structures are built before execution reaches @code{main}.  Using
17160 @option{-fvtable-verify=std} causes the data structures to be built after
17161 shared libraries have been loaded and initialized.
17162 @option{-fvtable-verify=preinit} causes them to be built before shared
17163 libraries have been loaded and initialized.
17165 If this option appears multiple times in the command line with different
17166 values specified, @samp{none} takes highest priority over both @samp{std} and
17167 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17169 @item -fvtv-debug
17170 @opindex fvtv-debug
17171 When used in conjunction with @option{-fvtable-verify=std} or 
17172 @option{-fvtable-verify=preinit}, causes debug versions of the 
17173 runtime functions for the vtable verification feature to be called.  
17174 This flag also causes the compiler to log information about which 
17175 vtable pointers it finds for each class.
17176 This information is written to a file named @file{vtv_set_ptr_data.log} 
17177 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
17178 if that is defined or the current working directory otherwise.
17180 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
17181 file, be sure to delete any existing one.
17183 @item -fvtv-counts
17184 @opindex fvtv-counts
17185 This is a debugging flag.  When used in conjunction with
17186 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17187 causes the compiler to keep track of the total number of virtual calls
17188 it encounters and the number of verifications it inserts.  It also
17189 counts the number of calls to certain run-time library functions
17190 that it inserts and logs this information for each compilation unit.
17191 The compiler writes this information to a file named
17192 @file{vtv_count_data.log} in the directory named by the environment
17193 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17194 directory otherwise.  It also counts the size of the vtable pointer sets
17195 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17196 in the same directory.
17198 Note:  This feature @emph{appends} data to the log files.  To get fresh log
17199 files, be sure to delete any existing ones.
17201 @item -finstrument-functions
17202 @opindex finstrument-functions
17203 Generate instrumentation calls for entry and exit to functions.  Just
17204 after function entry and just before function exit, the following
17205 profiling functions are called with the address of the current
17206 function and its call site.  (On some platforms,
17207 @code{__builtin_return_address} does not work beyond the current
17208 function, so the call site information may not be available to the
17209 profiling functions otherwise.)
17211 @smallexample
17212 void __cyg_profile_func_enter (void *this_fn,
17213                                void *call_site);
17214 void __cyg_profile_func_exit  (void *this_fn,
17215                                void *call_site);
17216 @end smallexample
17218 The first argument is the address of the start of the current function,
17219 which may be looked up exactly in the symbol table.
17221 This instrumentation is also done for functions expanded inline in other
17222 functions.  The profiling calls indicate where, conceptually, the
17223 inline function is entered and exited.  This means that addressable
17224 versions of such functions must be available.  If all your uses of a
17225 function are expanded inline, this may mean an additional expansion of
17226 code size.  If you use @code{extern inline} in your C code, an
17227 addressable version of such functions must be provided.  (This is
17228 normally the case anyway, but if you get lucky and the optimizer always
17229 expands the functions inline, you might have gotten away without
17230 providing static copies.)
17232 A function may be given the attribute @code{no_instrument_function}, in
17233 which case this instrumentation is not done.  This can be used, for
17234 example, for the profiling functions listed above, high-priority
17235 interrupt routines, and any functions from which the profiling functions
17236 cannot safely be called (perhaps signal handlers, if the profiling
17237 routines generate output or allocate memory).
17238 @xref{Common Function Attributes}.
17240 @item -finstrument-functions-once
17241 @opindex finstrument-functions-once
17242 This is similar to @option{-finstrument-functions}, but the profiling
17243 functions are called only once per instrumented function, i.e. the first
17244 profiling function is called after the first entry into the instrumented
17245 function and the second profiling function is called before the exit
17246 corresponding to this first entry.
17248 The definition of @code{once} for the purpose of this option is a little
17249 vague because the implementation is not protected against data races.
17250 As a result, the implementation only guarantees that the profiling
17251 functions are called at @emph{least} once per process and at @emph{most}
17252 once per thread, but the calls are always paired, that is to say, if a
17253 thread calls the first function, then it will call the second function,
17254 unless it never reaches the exit of the instrumented function.
17256 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17257 @opindex finstrument-functions-exclude-file-list
17259 Set the list of functions that are excluded from instrumentation (see
17260 the description of @option{-finstrument-functions}).  If the file that
17261 contains a function definition matches with one of @var{file}, then
17262 that function is not instrumented.  The match is done on substrings:
17263 if the @var{file} parameter is a substring of the file name, it is
17264 considered to be a match.
17266 For example:
17268 @smallexample
17269 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17270 @end smallexample
17272 @noindent
17273 excludes any inline function defined in files whose pathnames
17274 contain @file{/bits/stl} or @file{include/sys}.
17276 If, for some reason, you want to include letter @samp{,} in one of
17277 @var{sym}, write @samp{\,}. For example,
17278 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17279 (note the single quote surrounding the option).
17281 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17282 @opindex finstrument-functions-exclude-function-list
17284 This is similar to @option{-finstrument-functions-exclude-file-list},
17285 but this option sets the list of function names to be excluded from
17286 instrumentation.  The function name to be matched is its user-visible
17287 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17288 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
17289 match is done on substrings: if the @var{sym} parameter is a substring
17290 of the function name, it is considered to be a match.  For C99 and C++
17291 extended identifiers, the function name must be given in UTF-8, not
17292 using universal character names.
17294 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17295 @opindex fpatchable-function-entry
17296 Generate @var{N} NOPs right at the beginning
17297 of each function, with the function entry point before the @var{M}th NOP.
17298 If @var{M} is omitted, it defaults to @code{0} so the
17299 function entry points to the address just at the first NOP.
17300 The NOP instructions reserve extra space which can be used to patch in
17301 any desired instrumentation at run time, provided that the code segment
17302 is writable.  The amount of space is controllable indirectly via
17303 the number of NOPs; the NOP instruction used corresponds to the instruction
17304 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
17305 is target-specific and may also depend on the architecture variant and/or
17306 other compilation options.
17308 For run-time identification, the starting addresses of these areas,
17309 which correspond to their respective function entries minus @var{M},
17310 are additionally collected in the @code{__patchable_function_entries}
17311 section of the resulting binary.
17313 Note that the value of @code{__attribute__ ((patchable_function_entry
17314 (N,M)))} takes precedence over command-line option
17315 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
17316 the area size or to remove it completely on a single function.
17317 If @code{N=0}, no pad location is recorded.
17319 The NOP instructions are inserted at---and maybe before, depending on
17320 @var{M}---the function entry address, even before the prologue.  On
17321 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17322 the local entry point is this function entry address.
17324 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
17325 ELFv2 ABI, for a function with dual entry points, the supported values
17326 for @var{M} are 0, 2, 6 and 14.
17327 @end table
17330 @node Preprocessor Options
17331 @section Options Controlling the Preprocessor
17332 @cindex preprocessor options
17333 @cindex options, preprocessor
17335 These options control the C preprocessor, which is run on each C source
17336 file before actual compilation.
17338 If you use the @option{-E} option, nothing is done except preprocessing.
17339 Some of these options make sense only together with @option{-E} because
17340 they cause the preprocessor output to be unsuitable for actual
17341 compilation.
17343 In addition to the options listed here, there are a number of options 
17344 to control search paths for include files documented in 
17345 @ref{Directory Options}.  
17346 Options to control preprocessor diagnostics are listed in 
17347 @ref{Warning Options}.
17349 @table @gcctabopt
17350 @include cppopts.texi
17352 @item -Wp,@var{option}
17353 @opindex Wp
17354 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17355 and pass @var{option} directly through to the preprocessor.  If
17356 @var{option} contains commas, it is split into multiple options at the
17357 commas.  However, many options are modified, translated or interpreted
17358 by the compiler driver before being passed to the preprocessor, and
17359 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
17360 interface is undocumented and subject to change, so whenever possible
17361 you should avoid using @option{-Wp} and let the driver handle the
17362 options instead.
17364 @item -Xpreprocessor @var{option}
17365 @opindex Xpreprocessor
17366 Pass @var{option} as an option to the preprocessor.  You can use this to
17367 supply system-specific preprocessor options that GCC does not 
17368 recognize.
17370 If you want to pass an option that takes an argument, you must use
17371 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17373 @item -no-integrated-cpp
17374 @opindex no-integrated-cpp
17375 Perform preprocessing as a separate pass before compilation.
17376 By default, GCC performs preprocessing as an integrated part of
17377 input tokenization and parsing.
17378 If this option is provided, the appropriate language front end
17379 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17380 and Objective-C, respectively) is instead invoked twice,
17381 once for preprocessing only and once for actual compilation
17382 of the preprocessed input.
17383 This option may be useful in conjunction with the @option{-B} or
17384 @option{-wrapper} options to specify an alternate preprocessor or
17385 perform additional processing of the program source between
17386 normal preprocessing and compilation.
17388 @item -flarge-source-files
17389 @opindex flarge-source-files
17390 Adjust GCC to expect large source files, at the expense of slower
17391 compilation and higher memory usage.
17393 Specifically, GCC normally tracks both column numbers and line numbers
17394 within source files and it normally prints both of these numbers in
17395 diagnostics.  However, once it has processed a certain number of source
17396 lines, it stops tracking column numbers and only tracks line numbers.
17397 This means that diagnostics for later lines do not include column numbers.
17398 It also means that options like @option{-Wmisleading-indentation} cease to work
17399 at that point, although the compiler prints a note if this happens.
17400 Passing @option{-flarge-source-files} significantly increases the number
17401 of source lines that GCC can process before it stops tracking columns.
17403 @end table
17405 @node Assembler Options
17406 @section Passing Options to the Assembler
17408 @c prevent bad page break with this line
17409 You can pass options to the assembler.
17411 @table @gcctabopt
17412 @item -Wa,@var{option}
17413 @opindex Wa
17414 Pass @var{option} as an option to the assembler.  If @var{option}
17415 contains commas, it is split into multiple options at the commas.
17417 @item -Xassembler @var{option}
17418 @opindex Xassembler
17419 Pass @var{option} as an option to the assembler.  You can use this to
17420 supply system-specific assembler options that GCC does not
17421 recognize.
17423 If you want to pass an option that takes an argument, you must use
17424 @option{-Xassembler} twice, once for the option and once for the argument.
17426 @end table
17428 @node Link Options
17429 @section Options for Linking
17430 @cindex link options
17431 @cindex options, linking
17433 These options come into play when the compiler links object files into
17434 an executable output file.  They are meaningless if the compiler is
17435 not doing a link step.
17437 @table @gcctabopt
17438 @cindex file names
17439 @item @var{object-file-name}
17440 A file name that does not end in a special recognized suffix is
17441 considered to name an object file or library.  (Object files are
17442 distinguished from libraries by the linker according to the file
17443 contents.)  If linking is done, these object files are used as input
17444 to the linker.
17446 @item -c
17447 @itemx -S
17448 @itemx -E
17449 @opindex c
17450 @opindex S
17451 @opindex E
17452 If any of these options is used, then the linker is not run, and
17453 object file names should not be used as arguments.  @xref{Overall
17454 Options}.
17456 @item -flinker-output=@var{type}
17457 @opindex flinker-output
17458 This option controls code generation of the link-time optimizer.  By
17459 default the linker output is automatically determined by the linker
17460 plugin.  For debugging the compiler and if incremental linking with a 
17461 non-LTO object file is desired, it may be useful to control the type
17462 manually.
17464 If @var{type} is @samp{exec}, code generation produces a static
17465 binary. In this case @option{-fpic} and @option{-fpie} are both
17466 disabled.
17468 If @var{type} is @samp{dyn}, code generation produces a shared
17469 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
17470 but not enabled automatically.  This allows to build shared libraries
17471 without position-independent code on architectures where this is
17472 possible, i.e.@: on x86.
17474 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
17475 executable. This results in similar optimizations as @samp{exec}
17476 except that @option{-fpie} is not disabled if specified at compilation
17477 time.
17479 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
17480 done.  The sections containing intermediate code for link-time optimization are
17481 merged, pre-optimized, and output to the resulting object file. In addition, if
17482 @option{-ffat-lto-objects} is specified, binary code is produced for future
17483 non-LTO linking. The object file produced by incremental linking is smaller
17484 than a static library produced from the same object files.  At link time the
17485 result of incremental linking also loads faster than a static
17486 library assuming that the majority of objects in the library are used.
17488 Finally @samp{nolto-rel} configures the compiler for incremental linking where
17489 code generation is forced, a final binary is produced, and the intermediate
17490 code for later link-time optimization is stripped. When multiple object files
17491 are linked together the resulting code is better optimized than with
17492 link-time optimizations disabled (for example, cross-module inlining 
17493 happens), but most of benefits of whole program optimizations are lost. 
17495 During the incremental link (by @option{-r}) the linker plugin defaults to
17496 @option{rel}. With current interfaces to GNU Binutils it is however not
17497 possible to incrementally link LTO objects and non-LTO objects into a single
17498 mixed object file.  If any of object files in incremental link cannot
17499 be used for link-time optimization, the linker plugin issues a warning and
17500 uses @samp{nolto-rel}. To maintain whole program optimization, it is
17501 recommended to link such objects into static library instead. Alternatively it
17502 is possible to use H.J. Lu's binutils with support for mixed objects.
17504 @item -fuse-ld=bfd
17505 @opindex fuse-ld=bfd
17506 Use the @command{bfd} linker instead of the default linker.
17508 @item -fuse-ld=gold
17509 @opindex fuse-ld=gold
17510 Use the @command{gold} linker instead of the default linker.
17512 @item -fuse-ld=lld
17513 @opindex fuse-ld=lld
17514 Use the LLVM @command{lld} linker instead of the default linker.
17516 @item -fuse-ld=mold
17517 @opindex fuse-ld=mold
17518 Use the Modern Linker (@command{mold}) instead of the default linker.
17520 @cindex Libraries
17521 @item -l@var{library}
17522 @itemx -l @var{library}
17523 @opindex l
17524 Search the library named @var{library} when linking.  (The second
17525 alternative with the library as a separate argument is only for
17526 POSIX compliance and is not recommended.)
17528 The @option{-l} option is passed directly to the linker by GCC.  Refer
17529 to your linker documentation for exact details.  The general
17530 description below applies to the GNU linker.  
17532 The linker searches a standard list of directories for the library.
17533 The directories searched include several standard system directories
17534 plus any that you specify with @option{-L}.
17536 Static libraries are archives of object files, and have file names
17537 like @file{lib@var{library}.a}.  Some targets also support shared
17538 libraries, which typically have names like @file{lib@var{library}.so}.
17539 If both static and shared libraries are found, the linker gives
17540 preference to linking with the shared library unless the
17541 @option{-static} option is used.
17543 It makes a difference where in the command you write this option; the
17544 linker searches and processes libraries and object files in the order they
17545 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
17546 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
17547 to functions in @samp{z}, those functions may not be loaded.
17549 @item -lobjc
17550 @opindex lobjc
17551 You need this special case of the @option{-l} option in order to
17552 link an Objective-C or Objective-C++ program.
17554 @item -nostartfiles
17555 @opindex nostartfiles
17556 Do not use the standard system startup files when linking.
17557 The standard system libraries are used normally, unless @option{-nostdlib},
17558 @option{-nolibc}, or @option{-nodefaultlibs} is used.
17560 @item -nodefaultlibs
17561 @opindex nodefaultlibs
17562 Do not use the standard system libraries when linking.
17563 Only the libraries you specify are passed to the linker, and options
17564 specifying linkage of the system libraries, such as @option{-static-libgcc}
17565 or @option{-shared-libgcc}, are ignored.  
17566 The standard startup files are used normally, unless @option{-nostartfiles}
17567 is used.  
17569 The compiler may generate calls to @code{memcmp},
17570 @code{memset}, @code{memcpy} and @code{memmove}.
17571 These entries are usually resolved by entries in
17572 libc.  These entry points should be supplied through some other
17573 mechanism when this option is specified.
17575 @item -nolibc
17576 @opindex nolibc
17577 Do not use the C library or system libraries tightly coupled with it when
17578 linking.  Still link with the startup files, @file{libgcc} or toolchain
17579 provided language support libraries such as @file{libgnat}, @file{libgfortran}
17580 or @file{libstdc++} unless options preventing their inclusion are used as
17581 well.  This typically removes @option{-lc} from the link command line, as well
17582 as system libraries that normally go with it and become meaningless when
17583 absence of a C library is assumed, for example @option{-lpthread} or
17584 @option{-lm} in some configurations.  This is intended for bare-board
17585 targets when there is indeed no C library available.
17587 @item -nostdlib
17588 @opindex nostdlib
17589 Do not use the standard system startup files or libraries when linking.
17590 No startup files and only the libraries you specify are passed to
17591 the linker, and options specifying linkage of the system libraries, such as
17592 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
17594 The compiler may generate calls to @code{memcmp}, @code{memset},
17595 @code{memcpy} and @code{memmove}.
17596 These entries are usually resolved by entries in
17597 libc.  These entry points should be supplied through some other
17598 mechanism when this option is specified.
17600 @cindex @option{-lgcc}, use with @option{-nostdlib}
17601 @cindex @option{-nostdlib} and unresolved references
17602 @cindex unresolved references and @option{-nostdlib}
17603 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
17604 @cindex @option{-nodefaultlibs} and unresolved references
17605 @cindex unresolved references and @option{-nodefaultlibs}
17606 One of the standard libraries bypassed by @option{-nostdlib} and
17607 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
17608 which GCC uses to overcome shortcomings of particular machines, or special
17609 needs for some languages.
17610 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
17611 Collection (GCC) Internals},
17612 for more discussion of @file{libgcc.a}.)
17613 In most cases, you need @file{libgcc.a} even when you want to avoid
17614 other standard libraries.  In other words, when you specify @option{-nostdlib}
17615 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
17616 This ensures that you have no unresolved references to internal GCC
17617 library subroutines.
17618 (An example of such an internal subroutine is @code{__main}, used to ensure C++
17619 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
17620 GNU Compiler Collection (GCC) Internals}.)
17622 @item -nostdlib++
17623 @opindex nostdlib++
17624 Do not implicitly link with standard C++ libraries.
17626 @item -e @var{entry}
17627 @itemx --entry=@var{entry}
17628 @opindex e
17629 @opindex entry
17631 Specify that the program entry point is @var{entry}.  The argument is
17632 interpreted by the linker; the GNU linker accepts either a symbol name
17633 or an address.
17635 @item -pie
17636 @opindex pie
17637 Produce a dynamically linked position independent executable on targets
17638 that support it.  For predictable results, you must also specify the same
17639 set of options used for compilation (@option{-fpie}, @option{-fPIE},
17640 or model suboptions) when you specify this linker option.
17642 @item -no-pie
17643 @opindex no-pie
17644 Don't produce a dynamically linked position independent executable.
17646 @item -static-pie
17647 @opindex static-pie
17648 Produce a static position independent executable on targets that support
17649 it.  A static position independent executable is similar to a static
17650 executable, but can be loaded at any address without a dynamic linker.
17651 For predictable results, you must also specify the same set of options
17652 used for compilation (@option{-fpie}, @option{-fPIE}, or model
17653 suboptions) when you specify this linker option.
17655 @item -pthread
17656 @opindex pthread
17657 Link with the POSIX threads library.  This option is supported on 
17658 GNU/Linux targets, most other Unix derivatives, and also on 
17659 x86 Cygwin and MinGW targets.  On some targets this option also sets 
17660 flags for the preprocessor, so it should be used consistently for both
17661 compilation and linking.
17663 @item -r
17664 @opindex r
17665 Produce a relocatable object as output.  This is also known as partial
17666 linking.
17668 @item -rdynamic
17669 @opindex rdynamic
17670 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
17671 that support it. This instructs the linker to add all symbols, not
17672 only used ones, to the dynamic symbol table. This option is needed
17673 for some uses of @code{dlopen} or to allow obtaining backtraces
17674 from within a program.
17676 @item -s
17677 @opindex s
17678 Remove all symbol table and relocation information from the executable.
17680 @item -static
17681 @opindex static
17682 On systems that support dynamic linking, this overrides @option{-pie}
17683 and prevents linking with the shared libraries.  On other systems, this
17684 option has no effect.
17686 @item -shared
17687 @opindex shared
17688 Produce a shared object which can then be linked with other objects to
17689 form an executable.  Not all systems support this option.  For predictable
17690 results, you must also specify the same set of options used for compilation
17691 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
17692 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
17693 needs to build supplementary stub code for constructors to work.  On
17694 multi-libbed systems, @samp{gcc -shared} must select the correct support
17695 libraries to link against.  Failing to supply the correct flags may lead
17696 to subtle defects.  Supplying them in cases where they are not necessary
17697 is innocuous. For x86, crtfastmath.o will not be added when
17698 @option{-shared} is specified. }
17700 @item -shared-libgcc
17701 @itemx -static-libgcc
17702 @opindex shared-libgcc
17703 @opindex static-libgcc
17704 On systems that provide @file{libgcc} as a shared library, these options
17705 force the use of either the shared or static version, respectively.
17706 If no shared version of @file{libgcc} was built when the compiler was
17707 configured, these options have no effect.
17709 There are several situations in which an application should use the
17710 shared @file{libgcc} instead of the static version.  The most common
17711 of these is when the application wishes to throw and catch exceptions
17712 across different shared libraries.  In that case, each of the libraries
17713 as well as the application itself should use the shared @file{libgcc}.
17715 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
17716 whenever you build a shared library or a main executable, because C++
17717 programs typically use exceptions, so this is the right thing to do.
17719 If, instead, you use the GCC driver to create shared libraries, you may
17720 find that they are not always linked with the shared @file{libgcc}.
17721 If GCC finds, at its configuration time, that you have a non-GNU linker
17722 or a GNU linker that does not support option @option{--eh-frame-hdr},
17723 it links the shared version of @file{libgcc} into shared libraries
17724 by default.  Otherwise, it takes advantage of the linker and optimizes
17725 away the linking with the shared version of @file{libgcc}, linking with
17726 the static version of libgcc by default.  This allows exceptions to
17727 propagate through such shared libraries, without incurring relocation
17728 costs at library load time.
17730 However, if a library or main executable is supposed to throw or catch
17731 exceptions, you must link it using the G++ driver, or using the option
17732 @option{-shared-libgcc}, such that it is linked with the shared
17733 @file{libgcc}.
17735 @item -static-libasan
17736 @opindex static-libasan
17737 When the @option{-fsanitize=address} option is used to link a program,
17738 the GCC driver automatically links against @option{libasan}.  If
17739 @file{libasan} is available as a shared library, and the @option{-static}
17740 option is not used, then this links against the shared version of
17741 @file{libasan}.  The @option{-static-libasan} option directs the GCC
17742 driver to link @file{libasan} statically, without necessarily linking
17743 other libraries statically.
17745 @item -static-libtsan
17746 @opindex static-libtsan
17747 When the @option{-fsanitize=thread} option is used to link a program,
17748 the GCC driver automatically links against @option{libtsan}.  If
17749 @file{libtsan} is available as a shared library, and the @option{-static}
17750 option is not used, then this links against the shared version of
17751 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
17752 driver to link @file{libtsan} statically, without necessarily linking
17753 other libraries statically.
17755 @item -static-liblsan
17756 @opindex static-liblsan
17757 When the @option{-fsanitize=leak} option is used to link a program,
17758 the GCC driver automatically links against @option{liblsan}.  If
17759 @file{liblsan} is available as a shared library, and the @option{-static}
17760 option is not used, then this links against the shared version of
17761 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
17762 driver to link @file{liblsan} statically, without necessarily linking
17763 other libraries statically.
17765 @item -static-libubsan
17766 @opindex static-libubsan
17767 When the @option{-fsanitize=undefined} option is used to link a program,
17768 the GCC driver automatically links against @option{libubsan}.  If
17769 @file{libubsan} is available as a shared library, and the @option{-static}
17770 option is not used, then this links against the shared version of
17771 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
17772 driver to link @file{libubsan} statically, without necessarily linking
17773 other libraries statically.
17775 @item -static-libstdc++
17776 @opindex static-libstdc++
17777 When the @command{g++} program is used to link a C++ program, it
17778 normally automatically links against @option{libstdc++}.  If
17779 @file{libstdc++} is available as a shared library, and the
17780 @option{-static} option is not used, then this links against the
17781 shared version of @file{libstdc++}.  That is normally fine.  However, it
17782 is sometimes useful to freeze the version of @file{libstdc++} used by
17783 the program without going all the way to a fully static link.  The
17784 @option{-static-libstdc++} option directs the @command{g++} driver to
17785 link @file{libstdc++} statically, without necessarily linking other
17786 libraries statically.
17788 @item -symbolic
17789 @opindex symbolic
17790 Bind references to global symbols when building a shared object.  Warn
17791 about any unresolved references (unless overridden by the link editor
17792 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
17793 this option.
17795 @item -T @var{script}
17796 @opindex T
17797 @cindex linker script
17798 Use @var{script} as the linker script.  This option is supported by most
17799 systems using the GNU linker.  On some targets, such as bare-board
17800 targets without an operating system, the @option{-T} option may be required
17801 when linking to avoid references to undefined symbols.
17803 @item -Xlinker @var{option}
17804 @opindex Xlinker
17805 Pass @var{option} as an option to the linker.  You can use this to
17806 supply system-specific linker options that GCC does not recognize.
17808 If you want to pass an option that takes a separate argument, you must use
17809 @option{-Xlinker} twice, once for the option and once for the argument.
17810 For example, to pass @option{-assert definitions}, you must write
17811 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
17812 @option{-Xlinker "-assert definitions"}, because this passes the entire
17813 string as a single argument, which is not what the linker expects.
17815 When using the GNU linker, it is usually more convenient to pass
17816 arguments to linker options using the @option{@var{option}=@var{value}}
17817 syntax than as separate arguments.  For example, you can specify
17818 @option{-Xlinker -Map=output.map} rather than
17819 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
17820 this syntax for command-line options.
17822 @item -Wl,@var{option}
17823 @opindex Wl
17824 Pass @var{option} as an option to the linker.  If @var{option} contains
17825 commas, it is split into multiple options at the commas.  You can use this
17826 syntax to pass an argument to the option.
17827 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
17828 linker.  When using the GNU linker, you can also get the same effect with
17829 @option{-Wl,-Map=output.map}.
17831 @item -u @var{symbol}
17832 @opindex u
17833 Pretend the symbol @var{symbol} is undefined, to force linking of
17834 library modules to define it.  You can use @option{-u} multiple times with
17835 different symbols to force loading of additional library modules.
17837 @item -z @var{keyword}
17838 @opindex z
17839 @option{-z} is passed directly on to the linker along with the keyword
17840 @var{keyword}. See the section in the documentation of your linker for
17841 permitted values and their meanings.
17842 @end table
17844 @node Directory Options
17845 @section Options for Directory Search
17846 @cindex directory options
17847 @cindex options, directory search
17848 @cindex search path
17850 These options specify directories to search for header files, for
17851 libraries and for parts of the compiler:
17853 @table @gcctabopt
17854 @include cppdiropts.texi
17856 @item -iplugindir=@var{dir}
17857 @opindex iplugindir=
17858 Set the directory to search for plugins that are passed
17859 by @option{-fplugin=@var{name}} instead of
17860 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
17861 to be used by the user, but only passed by the driver.
17863 @item -L@var{dir}
17864 @opindex L
17865 Add directory @var{dir} to the list of directories to be searched
17866 for @option{-l}.
17868 @item -B@var{prefix}
17869 @opindex B
17870 This option specifies where to find the executables, libraries,
17871 include files, and data files of the compiler itself.
17873 The compiler driver program runs one or more of the subprograms
17874 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
17875 @var{prefix} as a prefix for each program it tries to run, both with and
17876 without @samp{@var{machine}/@var{version}/} for the corresponding target
17877 machine and compiler version.
17879 For each subprogram to be run, the compiler driver first tries the
17880 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
17881 is not specified, the driver tries two standard prefixes, 
17882 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
17883 those results in a file name that is found, the unmodified program
17884 name is searched for using the directories specified in your
17885 @env{PATH} environment variable.
17887 The compiler checks to see if the path provided by @option{-B}
17888 refers to a directory, and if necessary it adds a directory
17889 separator character at the end of the path.
17891 @option{-B} prefixes that effectively specify directory names also apply
17892 to libraries in the linker, because the compiler translates these
17893 options into @option{-L} options for the linker.  They also apply to
17894 include files in the preprocessor, because the compiler translates these
17895 options into @option{-isystem} options for the preprocessor.  In this case,
17896 the compiler appends @samp{include} to the prefix.
17898 The runtime support file @file{libgcc.a} can also be searched for using
17899 the @option{-B} prefix, if needed.  If it is not found there, the two
17900 standard prefixes above are tried, and that is all.  The file is left
17901 out of the link if it is not found by those means.
17903 Another way to specify a prefix much like the @option{-B} prefix is to use
17904 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
17905 Variables}.
17907 As a special kludge, if the path provided by @option{-B} is
17908 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
17909 9, then it is replaced by @file{[dir/]include}.  This is to help
17910 with boot-strapping the compiler.
17912 @item -no-canonical-prefixes
17913 @opindex no-canonical-prefixes
17914 Do not expand any symbolic links, resolve references to @samp{/../}
17915 or @samp{/./}, or make the path absolute when generating a relative
17916 prefix.
17918 @item --sysroot=@var{dir}
17919 @opindex sysroot
17920 Use @var{dir} as the logical root directory for headers and libraries.
17921 For example, if the compiler normally searches for headers in
17922 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
17923 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
17925 If you use both this option and the @option{-isysroot} option, then
17926 the @option{--sysroot} option applies to libraries, but the
17927 @option{-isysroot} option applies to header files.
17929 The GNU linker (beginning with version 2.16) has the necessary support
17930 for this option.  If your linker does not support this option, the
17931 header file aspect of @option{--sysroot} still works, but the
17932 library aspect does not.
17934 @item --no-sysroot-suffix
17935 @opindex no-sysroot-suffix
17936 For some targets, a suffix is added to the root directory specified
17937 with @option{--sysroot}, depending on the other options used, so that
17938 headers may for example be found in
17939 @file{@var{dir}/@var{suffix}/usr/include} instead of
17940 @file{@var{dir}/usr/include}.  This option disables the addition of
17941 such a suffix.
17943 @end table
17945 @node Code Gen Options
17946 @section Options for Code Generation Conventions
17947 @cindex code generation conventions
17948 @cindex options, code generation
17949 @cindex run-time options
17951 These machine-independent options control the interface conventions
17952 used in code generation.
17954 Most of them have both positive and negative forms; the negative form
17955 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
17956 one of the forms is listed---the one that is not the default.  You
17957 can figure out the other form by either removing @samp{no-} or adding
17960 @table @gcctabopt
17961 @item -fstack-reuse=@var{reuse-level}
17962 @opindex fstack_reuse
17963 This option controls stack space reuse for user declared local/auto variables
17964 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
17965 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
17966 local variables and temporaries, @samp{named_vars} enables the reuse only for
17967 user defined local variables with names, and @samp{none} disables stack reuse
17968 completely. The default value is @samp{all}. The option is needed when the
17969 program extends the lifetime of a scoped local variable or a compiler generated
17970 temporary beyond the end point defined by the language.  When a lifetime of
17971 a variable ends, and if the variable lives in memory, the optimizing compiler
17972 has the freedom to reuse its stack space with other temporaries or scoped
17973 local variables whose live range does not overlap with it. Legacy code extending
17974 local lifetime is likely to break with the stack reuse optimization.
17976 For example,
17978 @smallexample
17979    int *p;
17980    @{
17981      int local1;
17983      p = &local1;
17984      local1 = 10;
17985      ....
17986    @}
17987    @{
17988       int local2;
17989       local2 = 20;
17990       ...
17991    @}
17993    if (*p == 10)  // out of scope use of local1
17994      @{
17996      @}
17997 @end smallexample
17999 Another example:
18000 @smallexample
18002    struct A
18003    @{
18004        A(int k) : i(k), j(k) @{ @}
18005        int i;
18006        int j;
18007    @};
18009    A *ap;
18011    void foo(const A& ar)
18012    @{
18013       ap = &ar;
18014    @}
18016    void bar()
18017    @{
18018       foo(A(10)); // temp object's lifetime ends when foo returns
18020       @{
18021         A a(20);
18022         ....
18023       @}
18024       ap->i+= 10;  // ap references out of scope temp whose space
18025                    // is reused with a. What is the value of ap->i?
18026    @}
18028 @end smallexample
18030 The lifetime of a compiler generated temporary is well defined by the C++
18031 standard. When a lifetime of a temporary ends, and if the temporary lives
18032 in memory, the optimizing compiler has the freedom to reuse its stack
18033 space with other temporaries or scoped local variables whose live range
18034 does not overlap with it. However some of the legacy code relies on
18035 the behavior of older compilers in which temporaries' stack space is
18036 not reused, the aggressive stack reuse can lead to runtime errors. This
18037 option is used to control the temporary stack reuse optimization.
18039 @item -ftrapv
18040 @opindex ftrapv
18041 This option generates traps for signed overflow on addition, subtraction,
18042 multiplication operations.
18043 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18044 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18045 @option{-fwrapv} being effective.  Note that only active options override, so
18046 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18047 results in @option{-ftrapv} being effective.
18049 @item -fwrapv
18050 @opindex fwrapv
18051 This option instructs the compiler to assume that signed arithmetic
18052 overflow of addition, subtraction and multiplication wraps around
18053 using twos-complement representation.  This flag enables some optimizations
18054 and disables others.
18055 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18056 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18057 @option{-fwrapv} being effective.  Note that only active options override, so
18058 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18059 results in @option{-ftrapv} being effective.
18061 @item -fwrapv-pointer
18062 @opindex fwrapv-pointer
18063 This option instructs the compiler to assume that pointer arithmetic
18064 overflow on addition and subtraction wraps around using twos-complement
18065 representation.  This flag disables some optimizations which assume
18066 pointer overflow is invalid.
18068 @item -fstrict-overflow
18069 @opindex fstrict-overflow
18070 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18071 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18073 @item -fexceptions
18074 @opindex fexceptions
18075 Enable exception handling.  Generates extra code needed to propagate
18076 exceptions.  For some targets, this implies GCC generates frame
18077 unwind information for all functions, which can produce significant data
18078 size overhead, although it does not affect execution.  If you do not
18079 specify this option, GCC enables it by default for languages like
18080 C++ that normally require exception handling, and disables it for
18081 languages like C that do not normally require it.  However, you may need
18082 to enable this option when compiling C code that needs to interoperate
18083 properly with exception handlers written in C++.  You may also wish to
18084 disable this option if you are compiling older C++ programs that don't
18085 use exception handling.
18087 @item -fnon-call-exceptions
18088 @opindex fnon-call-exceptions
18089 Generate code that allows trapping instructions to throw exceptions.
18090 Note that this requires platform-specific runtime support that does
18091 not exist everywhere.  Moreover, it only allows @emph{trapping}
18092 instructions to throw exceptions, i.e.@: memory references or floating-point
18093 instructions.  It does not allow exceptions to be thrown from
18094 arbitrary signal handlers such as @code{SIGALRM}.  This enables
18095 @option{-fexceptions}.
18097 @item -fdelete-dead-exceptions
18098 @opindex fdelete-dead-exceptions
18099 Consider that instructions that may throw exceptions but don't otherwise
18100 contribute to the execution of the program can be optimized away.
18101 This does not affect calls to functions except those with the
18102 @code{pure} or @code{const} attributes.
18103 This option is enabled by default for the Ada and C++ compilers, as permitted by
18104 the language specifications.
18105 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18107 @item -funwind-tables
18108 @opindex funwind-tables
18109 Similar to @option{-fexceptions}, except that it just generates any needed
18110 static data, but does not affect the generated code in any other way.
18111 You normally do not need to enable this option; instead, a language processor
18112 that needs this handling enables it on your behalf.
18114 @item -fasynchronous-unwind-tables
18115 @opindex fasynchronous-unwind-tables
18116 Generate unwind table in DWARF format, if supported by target machine.  The
18117 table is exact at each instruction boundary, so it can be used for stack
18118 unwinding from asynchronous events (such as debugger or garbage collector).
18120 @item -fno-gnu-unique
18121 @opindex fno-gnu-unique
18122 @opindex fgnu-unique
18123 On systems with recent GNU assembler and C library, the C++ compiler
18124 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18125 of template static data members and static local variables in inline
18126 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18127 is necessary to avoid problems with a library used by two different
18128 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18129 therefore disagreeing with the other one about the binding of the
18130 symbol.  But this causes @code{dlclose} to be ignored for affected
18131 DSOs; if your program relies on reinitialization of a DSO via
18132 @code{dlclose} and @code{dlopen}, you can use
18133 @option{-fno-gnu-unique}.
18135 @item -fpcc-struct-return
18136 @opindex fpcc-struct-return
18137 Return ``short'' @code{struct} and @code{union} values in memory like
18138 longer ones, rather than in registers.  This convention is less
18139 efficient, but it has the advantage of allowing intercallability between
18140 GCC-compiled files and files compiled with other compilers, particularly
18141 the Portable C Compiler (pcc).
18143 The precise convention for returning structures in memory depends
18144 on the target configuration macros.
18146 Short structures and unions are those whose size and alignment match
18147 that of some integer type.
18149 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18150 switch is not binary compatible with code compiled with the
18151 @option{-freg-struct-return} switch.
18152 Use it to conform to a non-default application binary interface.
18154 @item -freg-struct-return
18155 @opindex freg-struct-return
18156 Return @code{struct} and @code{union} values in registers when possible.
18157 This is more efficient for small structures than
18158 @option{-fpcc-struct-return}.
18160 If you specify neither @option{-fpcc-struct-return} nor
18161 @option{-freg-struct-return}, GCC defaults to whichever convention is
18162 standard for the target.  If there is no standard convention, GCC
18163 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18164 the principal compiler.  In those cases, we can choose the standard, and
18165 we chose the more efficient register return alternative.
18167 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18168 switch is not binary compatible with code compiled with the
18169 @option{-fpcc-struct-return} switch.
18170 Use it to conform to a non-default application binary interface.
18172 @item -fshort-enums
18173 @opindex fshort-enums
18174 Allocate to an @code{enum} type only as many bytes as it needs for the
18175 declared range of possible values.  Specifically, the @code{enum} type
18176 is equivalent to the smallest integer type that has enough room.
18178 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18179 code that is not binary compatible with code generated without that switch.
18180 Use it to conform to a non-default application binary interface.
18182 @item -fshort-wchar
18183 @opindex fshort-wchar
18184 Override the underlying type for @code{wchar_t} to be @code{short
18185 unsigned int} instead of the default for the target.  This option is
18186 useful for building programs to run under WINE@.
18188 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18189 code that is not binary compatible with code generated without that switch.
18190 Use it to conform to a non-default application binary interface.
18192 @item -fcommon
18193 @opindex fcommon
18194 @opindex fno-common
18195 @cindex tentative definitions
18196 In C code, this option controls the placement of global variables
18197 defined without an initializer, known as @dfn{tentative definitions}
18198 in the C standard.  Tentative definitions are distinct from declarations
18199 of a variable with the @code{extern} keyword, which do not allocate storage.
18201 The default is @option{-fno-common}, which specifies that the compiler places
18202 uninitialized global variables in the BSS section of the object file.
18203 This inhibits the merging of tentative definitions by the linker so you get a
18204 multiple-definition error if the same variable is accidentally defined in more
18205 than one compilation unit.
18207 The @option{-fcommon} places uninitialized global variables in a common block.
18208 This allows the linker to resolve all tentative definitions of the same variable
18209 in different compilation units to the same object, or to a non-tentative
18210 definition.  This behavior is inconsistent with C++, and on many targets implies
18211 a speed and code size penalty on global variable references.  It is mainly
18212 useful to enable legacy code to link without errors.
18214 @item -fno-ident
18215 @opindex fno-ident
18216 @opindex fident
18217 Ignore the @code{#ident} directive.
18219 @item -finhibit-size-directive
18220 @opindex finhibit-size-directive
18221 Don't output a @code{.size} assembler directive, or anything else that
18222 would cause trouble if the function is split in the middle, and the
18223 two halves are placed at locations far apart in memory.  This option is
18224 used when compiling @file{crtstuff.c}; you should not need to use it
18225 for anything else.
18227 @item -fverbose-asm
18228 @opindex fverbose-asm
18229 Put extra commentary information in the generated assembly code to
18230 make it more readable.  This option is generally only of use to those
18231 who actually need to read the generated assembly code (perhaps while
18232 debugging the compiler itself).
18234 @option{-fno-verbose-asm}, the default, causes the
18235 extra information to be omitted and is useful when comparing two assembler
18236 files.
18238 The added comments include:
18240 @itemize @bullet
18242 @item
18243 information on the compiler version and command-line options,
18245 @item
18246 the source code lines associated with the assembly instructions,
18247 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18249 @item
18250 hints on which high-level expressions correspond to
18251 the various assembly instruction operands.
18253 @end itemize
18255 For example, given this C source file:
18257 @smallexample
18258 int test (int n)
18260   int i;
18261   int total = 0;
18263   for (i = 0; i < n; i++)
18264     total += i * i;
18266   return total;
18268 @end smallexample
18270 compiling to (x86_64) assembly via @option{-S} and emitting the result
18271 direct to stdout via @option{-o} @option{-}
18273 @smallexample
18274 gcc -S test.c -fverbose-asm -Os -o -
18275 @end smallexample
18277 gives output similar to this:
18279 @smallexample
18280         .file   "test.c"
18281 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18282   [...snip...]
18283 # options passed:
18284   [...snip...]
18286         .text
18287         .globl  test
18288         .type   test, @@function
18289 test:
18290 .LFB0:
18291         .cfi_startproc
18292 # test.c:4:   int total = 0;
18293         xorl    %eax, %eax      # <retval>
18294 # test.c:6:   for (i = 0; i < n; i++)
18295         xorl    %edx, %edx      # i
18296 .L2:
18297 # test.c:6:   for (i = 0; i < n; i++)
18298         cmpl    %edi, %edx      # n, i
18299         jge     .L5     #,
18300 # test.c:7:     total += i * i;
18301         movl    %edx, %ecx      # i, tmp92
18302         imull   %edx, %ecx      # i, tmp92
18303 # test.c:6:   for (i = 0; i < n; i++)
18304         incl    %edx    # i
18305 # test.c:7:     total += i * i;
18306         addl    %ecx, %eax      # tmp92, <retval>
18307         jmp     .L2     #
18308 .L5:
18309 # test.c:10: @}
18310         ret
18311         .cfi_endproc
18312 .LFE0:
18313         .size   test, .-test
18314         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
18315         .section        .note.GNU-stack,"",@@progbits
18316 @end smallexample
18318 The comments are intended for humans rather than machines and hence the
18319 precise format of the comments is subject to change.
18321 @item -frecord-gcc-switches
18322 @opindex frecord-gcc-switches
18323 This switch causes the command line used to invoke the
18324 compiler to be recorded into the object file that is being created.
18325 This switch is only implemented on some targets and the exact format
18326 of the recording is target and binary file format dependent, but it
18327 usually takes the form of a section containing ASCII text.  This
18328 switch is related to the @option{-fverbose-asm} switch, but that
18329 switch only records information in the assembler output file as
18330 comments, so it never reaches the object file.
18331 See also @option{-grecord-gcc-switches} for another
18332 way of storing compiler options into the object file.
18334 @item -fpic
18335 @opindex fpic
18336 @cindex global offset table
18337 @cindex PIC
18338 Generate position-independent code (PIC) suitable for use in a shared
18339 library, if supported for the target machine.  Such code accesses all
18340 constant addresses through a global offset table (GOT)@.  The dynamic
18341 loader resolves the GOT entries when the program starts (the dynamic
18342 loader is not part of GCC; it is part of the operating system).  If
18343 the GOT size for the linked executable exceeds a machine-specific
18344 maximum size, you get an error message from the linker indicating that
18345 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18346 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18347 on the m68k and RS/6000.  The x86 has no such limit.)
18349 Position-independent code requires special support, and therefore works
18350 only on certain machines.  For the x86, GCC supports PIC for System V
18351 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
18352 position-independent.
18354 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18355 are defined to 1.
18357 @item -fPIC
18358 @opindex fPIC
18359 If supported for the target machine, emit position-independent code,
18360 suitable for dynamic linking and avoiding any limit on the size of the
18361 global offset table.  This option makes a difference on AArch64, m68k,
18362 PowerPC and SPARC@.
18364 Position-independent code requires special support, and therefore works
18365 only on certain machines.
18367 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18368 are defined to 2.
18370 @item -fpie
18371 @itemx -fPIE
18372 @opindex fpie
18373 @opindex fPIE
18374 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18375 generated position-independent code can be only linked into executables.
18376 Usually these options are used to compile code that will be linked using
18377 the @option{-pie} GCC option.
18379 @option{-fpie} and @option{-fPIE} both define the macros
18380 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
18381 for @option{-fpie} and 2 for @option{-fPIE}.
18383 @item -fno-plt
18384 @opindex fno-plt
18385 @opindex fplt
18386 Do not use the PLT for external function calls in position-independent code.
18387 Instead, load the callee address at call sites from the GOT and branch to it.
18388 This leads to more efficient code by eliminating PLT stubs and exposing
18389 GOT loads to optimizations.  On architectures such as 32-bit x86 where
18390 PLT stubs expect the GOT pointer in a specific register, this gives more
18391 register allocation freedom to the compiler.
18392 Lazy binding requires use of the PLT; 
18393 with @option{-fno-plt} all external symbols are resolved at load time.
18395 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18396 through the PLT for specific external functions.
18398 In position-dependent code, a few targets also convert calls to
18399 functions that are marked to not use the PLT to use the GOT instead.
18401 @item -fno-jump-tables
18402 @opindex fno-jump-tables
18403 @opindex fjump-tables
18404 Do not use jump tables for switch statements even where it would be
18405 more efficient than other code generation strategies.  This option is
18406 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18407 building code that forms part of a dynamic linker and cannot
18408 reference the address of a jump table.  On some targets, jump tables
18409 do not require a GOT and this option is not needed.
18411 @item -fno-bit-tests
18412 @opindex fno-bit-tests
18413 @opindex fbit-tests
18414 Do not use bit tests for switch statements even where it would be
18415 more efficient than other code generation strategies.
18417 @item -ffixed-@var{reg}
18418 @opindex ffixed
18419 Treat the register named @var{reg} as a fixed register; generated code
18420 should never refer to it (except perhaps as a stack pointer, frame
18421 pointer or in some other fixed role).
18423 @var{reg} must be the name of a register.  The register names accepted
18424 are machine-specific and are defined in the @code{REGISTER_NAMES}
18425 macro in the machine description macro file.
18427 This flag does not have a negative form, because it specifies a
18428 three-way choice.
18430 @item -fcall-used-@var{reg}
18431 @opindex fcall-used
18432 Treat the register named @var{reg} as an allocable register that is
18433 clobbered by function calls.  It may be allocated for temporaries or
18434 variables that do not live across a call.  Functions compiled this way
18435 do not save and restore the register @var{reg}.
18437 It is an error to use this flag with the frame pointer or stack pointer.
18438 Use of this flag for other registers that have fixed pervasive roles in
18439 the machine's execution model produces disastrous results.
18441 This flag does not have a negative form, because it specifies a
18442 three-way choice.
18444 @item -fcall-saved-@var{reg}
18445 @opindex fcall-saved
18446 Treat the register named @var{reg} as an allocable register saved by
18447 functions.  It may be allocated even for temporaries or variables that
18448 live across a call.  Functions compiled this way save and restore
18449 the register @var{reg} if they use it.
18451 It is an error to use this flag with the frame pointer or stack pointer.
18452 Use of this flag for other registers that have fixed pervasive roles in
18453 the machine's execution model produces disastrous results.
18455 A different sort of disaster results from the use of this flag for
18456 a register in which function values may be returned.
18458 This flag does not have a negative form, because it specifies a
18459 three-way choice.
18461 @item -fpack-struct[=@var{n}]
18462 @opindex fpack-struct
18463 Without a value specified, pack all structure members together without
18464 holes.  When a value is specified (which must be a small power of two), pack
18465 structure members according to this value, representing the maximum
18466 alignment (that is, objects with default alignment requirements larger than
18467 this are output potentially unaligned at the next fitting location.
18469 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18470 code that is not binary compatible with code generated without that switch.
18471 Additionally, it makes the code suboptimal.
18472 Use it to conform to a non-default application binary interface.
18474 @item -fleading-underscore
18475 @opindex fleading-underscore
18476 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18477 change the way C symbols are represented in the object file.  One use
18478 is to help link with legacy assembly code.
18480 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18481 generate code that is not binary compatible with code generated without that
18482 switch.  Use it to conform to a non-default application binary interface.
18483 Not all targets provide complete support for this switch.
18485 @item -ftls-model=@var{model}
18486 @opindex ftls-model
18487 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18488 The @var{model} argument should be one of @samp{global-dynamic},
18489 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
18490 Note that the choice is subject to optimization: the compiler may use
18491 a more efficient model for symbols not visible outside of the translation
18492 unit, or if @option{-fpic} is not given on the command line.
18494 The default without @option{-fpic} is @samp{initial-exec}; with
18495 @option{-fpic} the default is @samp{global-dynamic}.
18497 @item -ftrampolines
18498 @opindex ftrampolines
18499 For targets that normally need trampolines for nested functions, always
18500 generate them instead of using descriptors.  Otherwise, for targets that
18501 do not need them, like for example HP-PA or IA-64, do nothing.
18503 A trampoline is a small piece of code that is created at run time on the
18504 stack when the address of a nested function is taken, and is used to call
18505 the nested function indirectly.  Therefore, it requires the stack to be
18506 made executable in order for the program to work properly.
18508 @option{-fno-trampolines} is enabled by default on a language by language
18509 basis to let the compiler avoid generating them, if it computes that this
18510 is safe, and replace them with descriptors.  Descriptors are made up of data
18511 only, but the generated code must be prepared to deal with them.  As of this
18512 writing, @option{-fno-trampolines} is enabled by default only for Ada.
18514 Moreover, code compiled with @option{-ftrampolines} and code compiled with
18515 @option{-fno-trampolines} are not binary compatible if nested functions are
18516 present.  This option must therefore be used on a program-wide basis and be
18517 manipulated with extreme care.
18519 For languages other than Ada, the @code{-ftrampolines} and
18520 @code{-fno-trampolines} options currently have no effect, and
18521 trampolines are always generated on platforms that need them
18522 for nested functions.
18524 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
18525 @opindex fvisibility
18526 Set the default ELF image symbol visibility to the specified option---all
18527 symbols are marked with this unless overridden within the code.
18528 Using this feature can very substantially improve linking and
18529 load times of shared object libraries, produce more optimized
18530 code, provide near-perfect API export and prevent symbol clashes.
18531 It is @strong{strongly} recommended that you use this in any shared objects
18532 you distribute.
18534 Despite the nomenclature, @samp{default} always means public; i.e.,
18535 available to be linked against from outside the shared object.
18536 @samp{protected} and @samp{internal} are pretty useless in real-world
18537 usage so the only other commonly used option is @samp{hidden}.
18538 The default if @option{-fvisibility} isn't specified is
18539 @samp{default}, i.e., make every symbol public.
18541 A good explanation of the benefits offered by ensuring ELF
18542 symbols have the correct visibility is given by ``How To Write
18543 Shared Libraries'' by Ulrich Drepper (which can be found at
18544 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
18545 solution made possible by this option to marking things hidden when
18546 the default is public is to make the default hidden and mark things
18547 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
18548 and @code{__attribute__ ((visibility("default")))} instead of
18549 @code{__declspec(dllexport)} you get almost identical semantics with
18550 identical syntax.  This is a great boon to those working with
18551 cross-platform projects.
18553 For those adding visibility support to existing code, you may find
18554 @code{#pragma GCC visibility} of use.  This works by you enclosing
18555 the declarations you wish to set visibility for with (for example)
18556 @code{#pragma GCC visibility push(hidden)} and
18557 @code{#pragma GCC visibility pop}.
18558 Bear in mind that symbol visibility should be viewed @strong{as
18559 part of the API interface contract} and thus all new code should
18560 always specify visibility when it is not the default; i.e., declarations
18561 only for use within the local DSO should @strong{always} be marked explicitly
18562 as hidden as so to avoid PLT indirection overheads---making this
18563 abundantly clear also aids readability and self-documentation of the code.
18564 Note that due to ISO C++ specification requirements, @code{operator new} and
18565 @code{operator delete} must always be of default visibility.
18567 Be aware that headers from outside your project, in particular system
18568 headers and headers from any other library you use, may not be
18569 expecting to be compiled with visibility other than the default.  You
18570 may need to explicitly say @code{#pragma GCC visibility push(default)}
18571 before including any such headers.
18573 @code{extern} declarations are not affected by @option{-fvisibility}, so
18574 a lot of code can be recompiled with @option{-fvisibility=hidden} with
18575 no modifications.  However, this means that calls to @code{extern}
18576 functions with no explicit visibility use the PLT, so it is more
18577 effective to use @code{__attribute ((visibility))} and/or
18578 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
18579 declarations should be treated as hidden.
18581 Note that @option{-fvisibility} does affect C++ vague linkage
18582 entities. This means that, for instance, an exception class that is
18583 be thrown between DSOs must be explicitly marked with default
18584 visibility so that the @samp{type_info} nodes are unified between
18585 the DSOs.
18587 An overview of these techniques, their benefits and how to use them
18588 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
18590 @item -fstrict-volatile-bitfields
18591 @opindex fstrict-volatile-bitfields
18592 This option should be used if accesses to volatile bit-fields (or other
18593 structure fields, although the compiler usually honors those types
18594 anyway) should use a single access of the width of the
18595 field's type, aligned to a natural alignment if possible.  For
18596 example, targets with memory-mapped peripheral registers might require
18597 all such accesses to be 16 bits wide; with this flag you can
18598 declare all peripheral bit-fields as @code{unsigned short} (assuming short
18599 is 16 bits on these targets) to force GCC to use 16-bit accesses
18600 instead of, perhaps, a more efficient 32-bit access.
18602 If this option is disabled, the compiler uses the most efficient
18603 instruction.  In the previous example, that might be a 32-bit load
18604 instruction, even though that accesses bytes that do not contain
18605 any portion of the bit-field, or memory-mapped registers unrelated to
18606 the one being updated.
18608 In some cases, such as when the @code{packed} attribute is applied to a 
18609 structure field, it may not be possible to access the field with a single
18610 read or write that is correctly aligned for the target machine.  In this
18611 case GCC falls back to generating multiple accesses rather than code that 
18612 will fault or truncate the result at run time.
18614 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
18615 not allowed to touch non bit-field members.  It is therefore recommended
18616 to define all bits of the field's type as bit-field members.
18618 The default value of this option is determined by the application binary
18619 interface for the target processor.
18621 @item -fsync-libcalls
18622 @opindex fsync-libcalls
18623 This option controls whether any out-of-line instance of the @code{__sync}
18624 family of functions may be used to implement the C++11 @code{__atomic}
18625 family of functions.
18627 The default value of this option is enabled, thus the only useful form
18628 of the option is @option{-fno-sync-libcalls}.  This option is used in
18629 the implementation of the @file{libatomic} runtime library.
18631 @end table
18633 @node Developer Options
18634 @section GCC Developer Options
18635 @cindex developer options
18636 @cindex debugging GCC
18637 @cindex debug dump options
18638 @cindex dump options
18639 @cindex compilation statistics
18641 This section describes command-line options that are primarily of
18642 interest to GCC developers, including options to support compiler
18643 testing and investigation of compiler bugs and compile-time
18644 performance problems.  This includes options that produce debug dumps
18645 at various points in the compilation; that print statistics such as
18646 memory use and execution time; and that print information about GCC's
18647 configuration, such as where it searches for libraries.  You should
18648 rarely need to use any of these options for ordinary compilation and
18649 linking tasks.
18651 Many developer options that cause GCC to dump output to a file take an
18652 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
18653 or @samp{-} to dump to standard output, and @samp{stderr} for standard
18654 error.
18656 If @samp{=@var{filename}} is omitted, a default dump file name is
18657 constructed by concatenating the base dump file name, a pass number,
18658 phase letter, and pass name.  The base dump file name is the name of
18659 output file produced by the compiler if explicitly specified and not
18660 an executable; otherwise it is the source file name.
18661 The pass number is determined by the order passes are registered with
18662 the compiler's pass manager. 
18663 This is generally the same as the order of execution, but passes
18664 registered by plugins, target-specific passes, or passes that are
18665 otherwise registered late are numbered higher than the pass named
18666 @samp{final}, even if they are executed earlier.  The phase letter is
18667 one of @samp{i} (inter-procedural analysis), @samp{l}
18668 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
18669 The files are created in the directory of the output file. 
18671 @table @gcctabopt
18673 @item -fcallgraph-info
18674 @itemx -fcallgraph-info=@var{MARKERS}
18675 @opindex fcallgraph-info
18676 Makes the compiler output callgraph information for the program, on a
18677 per-object-file basis.  The information is generated in the common VCG
18678 format.  It can be decorated with additional, per-node and/or per-edge
18679 information, if a list of comma-separated markers is additionally
18680 specified.  When the @code{su} marker is specified, the callgraph is
18681 decorated with stack usage information; it is equivalent to
18682 @option{-fstack-usage}.  When the @code{da} marker is specified, the
18683 callgraph is decorated with information about dynamically allocated
18684 objects.
18686 When compiling with @option{-flto}, no callgraph information is output
18687 along with the object file.  At LTO link time, @option{-fcallgraph-info}
18688 may generate multiple callgraph information files next to intermediate
18689 LTO output files.
18691 @item -d@var{letters}
18692 @itemx -fdump-rtl-@var{pass}
18693 @itemx -fdump-rtl-@var{pass}=@var{filename}
18694 @opindex d
18695 @opindex fdump-rtl-@var{pass}
18696 Says to make debugging dumps during compilation at times specified by
18697 @var{letters}.  This is used for debugging the RTL-based passes of the
18698 compiler.
18700 Some @option{-d@var{letters}} switches have different meaning when
18701 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
18702 for information about preprocessor-specific dump options.
18704 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
18705 @option{-d} option @var{letters}.  Here are the possible
18706 letters for use in @var{pass} and @var{letters}, and their meanings:
18708 @table @gcctabopt
18710 @item -fdump-rtl-alignments
18711 @opindex fdump-rtl-alignments
18712 Dump after branch alignments have been computed.
18714 @item -fdump-rtl-asmcons
18715 @opindex fdump-rtl-asmcons
18716 Dump after fixing rtl statements that have unsatisfied in/out constraints.
18718 @item -fdump-rtl-auto_inc_dec
18719 @opindex fdump-rtl-auto_inc_dec
18720 Dump after auto-inc-dec discovery.  This pass is only run on
18721 architectures that have auto inc or auto dec instructions.
18723 @item -fdump-rtl-barriers
18724 @opindex fdump-rtl-barriers
18725 Dump after cleaning up the barrier instructions.
18727 @item -fdump-rtl-bbpart
18728 @opindex fdump-rtl-bbpart
18729 Dump after partitioning hot and cold basic blocks.
18731 @item -fdump-rtl-bbro
18732 @opindex fdump-rtl-bbro
18733 Dump after block reordering.
18735 @item -fdump-rtl-btl1
18736 @itemx -fdump-rtl-btl2
18737 @opindex fdump-rtl-btl2
18738 @opindex fdump-rtl-btl2
18739 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
18740 after the two branch
18741 target load optimization passes.
18743 @item -fdump-rtl-bypass
18744 @opindex fdump-rtl-bypass
18745 Dump after jump bypassing and control flow optimizations.
18747 @item -fdump-rtl-combine
18748 @opindex fdump-rtl-combine
18749 Dump after the RTL instruction combination pass.
18751 @item -fdump-rtl-compgotos
18752 @opindex fdump-rtl-compgotos
18753 Dump after duplicating the computed gotos.
18755 @item -fdump-rtl-ce1
18756 @itemx -fdump-rtl-ce2
18757 @itemx -fdump-rtl-ce3
18758 @opindex fdump-rtl-ce1
18759 @opindex fdump-rtl-ce2
18760 @opindex fdump-rtl-ce3
18761 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
18762 @option{-fdump-rtl-ce3} enable dumping after the three
18763 if conversion passes.
18765 @item -fdump-rtl-cprop_hardreg
18766 @opindex fdump-rtl-cprop_hardreg
18767 Dump after hard register copy propagation.
18769 @item -fdump-rtl-csa
18770 @opindex fdump-rtl-csa
18771 Dump after combining stack adjustments.
18773 @item -fdump-rtl-cse1
18774 @itemx -fdump-rtl-cse2
18775 @opindex fdump-rtl-cse1
18776 @opindex fdump-rtl-cse2
18777 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
18778 the two common subexpression elimination passes.
18780 @item -fdump-rtl-dce
18781 @opindex fdump-rtl-dce
18782 Dump after the standalone dead code elimination passes.
18784 @item -fdump-rtl-dbr
18785 @opindex fdump-rtl-dbr
18786 Dump after delayed branch scheduling.
18788 @item -fdump-rtl-dce1
18789 @itemx -fdump-rtl-dce2
18790 @opindex fdump-rtl-dce1
18791 @opindex fdump-rtl-dce2
18792 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
18793 the two dead store elimination passes.
18795 @item -fdump-rtl-eh
18796 @opindex fdump-rtl-eh
18797 Dump after finalization of EH handling code.
18799 @item -fdump-rtl-eh_ranges
18800 @opindex fdump-rtl-eh_ranges
18801 Dump after conversion of EH handling range regions.
18803 @item -fdump-rtl-expand
18804 @opindex fdump-rtl-expand
18805 Dump after RTL generation.
18807 @item -fdump-rtl-fwprop1
18808 @itemx -fdump-rtl-fwprop2
18809 @opindex fdump-rtl-fwprop1
18810 @opindex fdump-rtl-fwprop2
18811 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
18812 dumping after the two forward propagation passes.
18814 @item -fdump-rtl-gcse1
18815 @itemx -fdump-rtl-gcse2
18816 @opindex fdump-rtl-gcse1
18817 @opindex fdump-rtl-gcse2
18818 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
18819 after global common subexpression elimination.
18821 @item -fdump-rtl-init-regs
18822 @opindex fdump-rtl-init-regs
18823 Dump after the initialization of the registers.
18825 @item -fdump-rtl-initvals
18826 @opindex fdump-rtl-initvals
18827 Dump after the computation of the initial value sets.
18829 @item -fdump-rtl-into_cfglayout
18830 @opindex fdump-rtl-into_cfglayout
18831 Dump after converting to cfglayout mode.
18833 @item -fdump-rtl-ira
18834 @opindex fdump-rtl-ira
18835 Dump after iterated register allocation.
18837 @item -fdump-rtl-jump
18838 @opindex fdump-rtl-jump
18839 Dump after the second jump optimization.
18841 @item -fdump-rtl-loop2
18842 @opindex fdump-rtl-loop2
18843 @option{-fdump-rtl-loop2} enables dumping after the rtl
18844 loop optimization passes.
18846 @item -fdump-rtl-mach
18847 @opindex fdump-rtl-mach
18848 Dump after performing the machine dependent reorganization pass, if that
18849 pass exists.
18851 @item -fdump-rtl-mode_sw
18852 @opindex fdump-rtl-mode_sw
18853 Dump after removing redundant mode switches.
18855 @item -fdump-rtl-rnreg
18856 @opindex fdump-rtl-rnreg
18857 Dump after register renumbering.
18859 @item -fdump-rtl-outof_cfglayout
18860 @opindex fdump-rtl-outof_cfglayout
18861 Dump after converting from cfglayout mode.
18863 @item -fdump-rtl-peephole2
18864 @opindex fdump-rtl-peephole2
18865 Dump after the peephole pass.
18867 @item -fdump-rtl-postreload
18868 @opindex fdump-rtl-postreload
18869 Dump after post-reload optimizations.
18871 @item -fdump-rtl-pro_and_epilogue
18872 @opindex fdump-rtl-pro_and_epilogue
18873 Dump after generating the function prologues and epilogues.
18875 @item -fdump-rtl-sched1
18876 @itemx -fdump-rtl-sched2
18877 @opindex fdump-rtl-sched1
18878 @opindex fdump-rtl-sched2
18879 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
18880 after the basic block scheduling passes.
18882 @item -fdump-rtl-ree
18883 @opindex fdump-rtl-ree
18884 Dump after sign/zero extension elimination.
18886 @item -fdump-rtl-seqabstr
18887 @opindex fdump-rtl-seqabstr
18888 Dump after common sequence discovery.
18890 @item -fdump-rtl-shorten
18891 @opindex fdump-rtl-shorten
18892 Dump after shortening branches.
18894 @item -fdump-rtl-sibling
18895 @opindex fdump-rtl-sibling
18896 Dump after sibling call optimizations.
18898 @item -fdump-rtl-split1
18899 @itemx -fdump-rtl-split2
18900 @itemx -fdump-rtl-split3
18901 @itemx -fdump-rtl-split4
18902 @itemx -fdump-rtl-split5
18903 @opindex fdump-rtl-split1
18904 @opindex fdump-rtl-split2
18905 @opindex fdump-rtl-split3
18906 @opindex fdump-rtl-split4
18907 @opindex fdump-rtl-split5
18908 These options enable dumping after five rounds of
18909 instruction splitting.
18911 @item -fdump-rtl-sms
18912 @opindex fdump-rtl-sms
18913 Dump after modulo scheduling.  This pass is only run on some
18914 architectures.
18916 @item -fdump-rtl-stack
18917 @opindex fdump-rtl-stack
18918 Dump after conversion from GCC's ``flat register file'' registers to the
18919 x87's stack-like registers.  This pass is only run on x86 variants.
18921 @item -fdump-rtl-subreg1
18922 @itemx -fdump-rtl-subreg2
18923 @opindex fdump-rtl-subreg1
18924 @opindex fdump-rtl-subreg2
18925 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
18926 the two subreg expansion passes.
18928 @item -fdump-rtl-unshare
18929 @opindex fdump-rtl-unshare
18930 Dump after all rtl has been unshared.
18932 @item -fdump-rtl-vartrack
18933 @opindex fdump-rtl-vartrack
18934 Dump after variable tracking.
18936 @item -fdump-rtl-vregs
18937 @opindex fdump-rtl-vregs
18938 Dump after converting virtual registers to hard registers.
18940 @item -fdump-rtl-web
18941 @opindex fdump-rtl-web
18942 Dump after live range splitting.
18944 @item -fdump-rtl-regclass
18945 @itemx -fdump-rtl-subregs_of_mode_init
18946 @itemx -fdump-rtl-subregs_of_mode_finish
18947 @itemx -fdump-rtl-dfinit
18948 @itemx -fdump-rtl-dfinish
18949 @opindex fdump-rtl-regclass
18950 @opindex fdump-rtl-subregs_of_mode_init
18951 @opindex fdump-rtl-subregs_of_mode_finish
18952 @opindex fdump-rtl-dfinit
18953 @opindex fdump-rtl-dfinish
18954 These dumps are defined but always produce empty files.
18956 @item -da
18957 @itemx -fdump-rtl-all
18958 @opindex da
18959 @opindex fdump-rtl-all
18960 Produce all the dumps listed above.
18962 @item -dA
18963 @opindex dA
18964 Annotate the assembler output with miscellaneous debugging information.
18966 @item -dD
18967 @opindex dD
18968 Dump all macro definitions, at the end of preprocessing, in addition to
18969 normal output.
18971 @item -dH
18972 @opindex dH
18973 Produce a core dump whenever an error occurs.
18975 @item -dp
18976 @opindex dp
18977 Annotate the assembler output with a comment indicating which
18978 pattern and alternative is used.  The length and cost of each instruction are
18979 also printed.
18981 @item -dP
18982 @opindex dP
18983 Dump the RTL in the assembler output as a comment before each instruction.
18984 Also turns on @option{-dp} annotation.
18986 @item -dx
18987 @opindex dx
18988 Just generate RTL for a function instead of compiling it.  Usually used
18989 with @option{-fdump-rtl-expand}.
18990 @end table
18992 @item -fdump-debug
18993 @opindex fdump-debug
18994 Dump debugging information generated during the debug
18995 generation phase.
18997 @item -fdump-earlydebug
18998 @opindex fdump-earlydebug
18999 Dump debugging information generated during the early debug
19000 generation phase.
19002 @item -fdump-noaddr
19003 @opindex fdump-noaddr
19004 When doing debugging dumps, suppress address output.  This makes it more
19005 feasible to use diff on debugging dumps for compiler invocations with
19006 different compiler binaries and/or different
19007 text / bss / data / heap / stack / dso start locations.
19009 @item -freport-bug
19010 @opindex freport-bug
19011 Collect and dump debug information into a temporary file if an
19012 internal compiler error (ICE) occurs.
19014 @item -fdump-unnumbered
19015 @opindex fdump-unnumbered
19016 When doing debugging dumps, suppress instruction numbers and address output.
19017 This makes it more feasible to use diff on debugging dumps for compiler
19018 invocations with different options, in particular with and without
19019 @option{-g}.
19021 @item -fdump-unnumbered-links
19022 @opindex fdump-unnumbered-links
19023 When doing debugging dumps (see @option{-d} option above), suppress
19024 instruction numbers for the links to the previous and next instructions
19025 in a sequence.
19027 @item -fdump-ipa-@var{switch}
19028 @itemx -fdump-ipa-@var{switch}-@var{options}
19029 @opindex fdump-ipa
19030 Control the dumping at various stages of inter-procedural analysis
19031 language tree to a file.  The file name is generated by appending a
19032 switch specific suffix to the source file name, and the file is created
19033 in the same directory as the output file.  The following dumps are
19034 possible:
19036 @table @samp
19037 @item all
19038 Enables all inter-procedural analysis dumps.
19040 @item cgraph
19041 Dumps information about call-graph optimization, unused function removal,
19042 and inlining decisions.
19044 @item inline
19045 Dump after function inlining.
19047 @end table
19049 Additionally, the options @option{-optimized}, @option{-missed},
19050 @option{-note}, and @option{-all} can be provided, with the same meaning
19051 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19053 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19054 information on callsites that were inlined, along with callsites
19055 that were not inlined.
19057 By default, the dump will contain messages about successful
19058 optimizations (equivalent to @option{-optimized}) together with
19059 low-level details about the analysis.
19061 @item -fdump-lang
19062 @opindex fdump-lang
19063 Dump language-specific information.  The file name is made by appending
19064 @file{.lang} to the source file name.
19066 @item -fdump-lang-all
19067 @itemx -fdump-lang-@var{switch}
19068 @itemx -fdump-lang-@var{switch}-@var{options}
19069 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19070 @opindex fdump-lang-all
19071 @opindex fdump-lang
19072 Control the dumping of language-specific information.  The @var{options}
19073 and @var{filename} portions behave as described in the
19074 @option{-fdump-tree} option.  The following @var{switch} values are
19075 accepted:
19077 @table @samp
19078 @item all
19080 Enable all language-specific dumps.
19082 @item class
19083 Dump class hierarchy information.  Virtual table information is emitted
19084 unless '@option{slim}' is specified.  This option is applicable to C++ only.
19086 @item module
19087 Dump module information.  Options @option{lineno} (locations),
19088 @option{graph} (reachability), @option{blocks} (clusters),
19089 @option{uid} (serialization), @option{alias} (mergeable),
19090 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19091 (macros) may provide additional information.  This option is
19092 applicable to C++ only.
19094 @item raw
19095 Dump the raw internal tree data.  This option is applicable to C++ only.
19097 @end table
19099 @item -fdump-passes
19100 @opindex fdump-passes
19101 Print on @file{stderr} the list of optimization passes that are turned
19102 on and off by the current command-line options.
19104 @item -fdump-statistics-@var{option}
19105 @opindex fdump-statistics
19106 Enable and control dumping of pass statistics in a separate file.  The
19107 file name is generated by appending a suffix ending in
19108 @samp{.statistics} to the source file name, and the file is created in
19109 the same directory as the output file.  If the @samp{-@var{option}}
19110 form is used, @samp{-stats} causes counters to be summed over the
19111 whole compilation unit while @samp{-details} dumps every event as
19112 the passes generate them.  The default with no option is to sum
19113 counters for each function compiled.
19115 @item -fdump-tree-all
19116 @itemx -fdump-tree-@var{switch}
19117 @itemx -fdump-tree-@var{switch}-@var{options}
19118 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19119 @opindex fdump-tree-all
19120 @opindex fdump-tree
19121 Control the dumping at various stages of processing the intermediate
19122 language tree to a file.  If the @samp{-@var{options}}
19123 form is used, @var{options} is a list of @samp{-} separated options
19124 which control the details of the dump.  Not all options are applicable
19125 to all dumps; those that are not meaningful are ignored.  The
19126 following options are available
19128 @table @samp
19129 @item address
19130 Print the address of each node.  Usually this is not meaningful as it
19131 changes according to the environment and source file.  Its primary use
19132 is for tying up a dump file with a debug environment.
19133 @item asmname
19134 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19135 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
19136 use working backward from mangled names in the assembly file.
19137 @item slim
19138 When dumping front-end intermediate representations, inhibit dumping
19139 of members of a scope or body of a function merely because that scope
19140 has been reached.  Only dump such items when they are directly reachable
19141 by some other path.
19143 When dumping pretty-printed trees, this option inhibits dumping the
19144 bodies of control structures.
19146 When dumping RTL, print the RTL in slim (condensed) form instead of
19147 the default LISP-like representation.
19148 @item raw
19149 Print a raw representation of the tree.  By default, trees are
19150 pretty-printed into a C-like representation.
19151 @item details
19152 Enable more detailed dumps (not honored by every dump option). Also
19153 include information from the optimization passes.
19154 @item stats
19155 Enable dumping various statistics about the pass (not honored by every dump
19156 option).
19157 @item blocks
19158 Enable showing basic block boundaries (disabled in raw dumps).
19159 @item graph
19160 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19161 dump a representation of the control flow graph suitable for viewing with
19162 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
19163 the file is pretty-printed as a subgraph, so that GraphViz can render them
19164 all in a single plot.
19166 This option currently only works for RTL dumps, and the RTL is always
19167 dumped in slim form.
19168 @item vops
19169 Enable showing virtual operands for every statement.
19170 @item lineno
19171 Enable showing line numbers for statements.
19172 @item uid
19173 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19174 @item verbose
19175 Enable showing the tree dump for each statement.
19176 @item eh
19177 Enable showing the EH region number holding each statement.
19178 @item scev
19179 Enable showing scalar evolution analysis details.
19180 @item optimized
19181 Enable showing optimization information (only available in certain
19182 passes).
19183 @item missed
19184 Enable showing missed optimization information (only available in certain
19185 passes).
19186 @item note
19187 Enable other detailed optimization information (only available in
19188 certain passes).
19189 @item all
19190 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19191 and @option{lineno}.
19192 @item optall
19193 Turn on all optimization options, i.e., @option{optimized},
19194 @option{missed}, and @option{note}.
19195 @end table
19197 To determine what tree dumps are available or find the dump for a pass
19198 of interest follow the steps below.
19200 @enumerate
19201 @item
19202 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19203 look for a code that corresponds to the pass you are interested in.
19204 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19205 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19206 The number at the end distinguishes distinct invocations of the same pass.
19207 @item
19208 To enable the creation of the dump file, append the pass code to
19209 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
19210 to enable the dump from the Early Value Range Propagation pass, invoke
19211 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
19212 specify the name of the dump file.  If you don't specify one, GCC
19213 creates as described below.
19214 @item
19215 Find the pass dump in a file whose name is composed of three components
19216 separated by a period: the name of the source file GCC was invoked to
19217 compile, a numeric suffix indicating the pass number followed by the
19218 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19219 and finally the pass code.  For example, the Early VRP pass dump might
19220 be in a file named @file{myfile.c.038t.evrp} in the current working
19221 directory.  Note that the numeric codes are not stable and may change
19222 from one version of GCC to another.
19223 @end enumerate
19225 @item -fopt-info
19226 @itemx -fopt-info-@var{options}
19227 @itemx -fopt-info-@var{options}=@var{filename}
19228 @opindex fopt-info
19229 Controls optimization dumps from various optimization passes. If the
19230 @samp{-@var{options}} form is used, @var{options} is a list of
19231 @samp{-} separated option keywords to select the dump details and
19232 optimizations.  
19234 The @var{options} can be divided into three groups:
19235 @enumerate
19236 @item
19237 options describing what kinds of messages should be emitted,
19238 @item
19239 options describing the verbosity of the dump, and
19240 @item
19241 options describing which optimizations should be included.
19242 @end enumerate
19243 The options from each group can be freely mixed as they are
19244 non-overlapping. However, in case of any conflicts,
19245 the later options override the earlier options on the command
19246 line. 
19248 The following options control which kinds of messages should be emitted:
19250 @table @samp
19251 @item optimized
19252 Print information when an optimization is successfully applied. It is
19253 up to a pass to decide which information is relevant. For example, the
19254 vectorizer passes print the source location of loops which are
19255 successfully vectorized.
19256 @item missed
19257 Print information about missed optimizations. Individual passes
19258 control which information to include in the output. 
19259 @item note
19260 Print verbose information about optimizations, such as certain
19261 transformations, more detailed messages about decisions etc.
19262 @item all
19263 Print detailed optimization information. This includes
19264 @samp{optimized}, @samp{missed}, and @samp{note}.
19265 @end table
19267 The following option controls the dump verbosity:
19269 @table @samp
19270 @item internals
19271 By default, only ``high-level'' messages are emitted. This option enables
19272 additional, more detailed, messages, which are likely to only be of interest
19273 to GCC developers.
19274 @end table
19276 One or more of the following option keywords can be used to describe a
19277 group of optimizations:
19279 @table @samp
19280 @item ipa
19281 Enable dumps from all interprocedural optimizations.
19282 @item loop
19283 Enable dumps from all loop optimizations.
19284 @item inline
19285 Enable dumps from all inlining optimizations.
19286 @item omp
19287 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19288 @item vec
19289 Enable dumps from all vectorization optimizations.
19290 @item optall
19291 Enable dumps from all optimizations. This is a superset of
19292 the optimization groups listed above.
19293 @end table
19295 If @var{options} is
19296 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19297 about successful optimizations from all the passes, omitting messages
19298 that are treated as ``internals''.
19300 If the @var{filename} is provided, then the dumps from all the
19301 applicable optimizations are concatenated into the @var{filename}.
19302 Otherwise the dump is output onto @file{stderr}. Though multiple
19303 @option{-fopt-info} options are accepted, only one of them can include
19304 a @var{filename}. If other filenames are provided then all but the
19305 first such option are ignored.
19307 Note that the output @var{filename} is overwritten
19308 in case of multiple translation units. If a combined output from
19309 multiple translation units is desired, @file{stderr} should be used
19310 instead.
19312 In the following example, the optimization info is output to
19313 @file{stderr}:
19315 @smallexample
19316 gcc -O3 -fopt-info
19317 @end smallexample
19319 This example:
19320 @smallexample
19321 gcc -O3 -fopt-info-missed=missed.all
19322 @end smallexample
19324 @noindent
19325 outputs missed optimization report from all the passes into
19326 @file{missed.all}, and this one:
19328 @smallexample
19329 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19330 @end smallexample
19332 @noindent
19333 prints information about missed optimization opportunities from
19334 vectorization passes on @file{stderr}.  
19335 Note that @option{-fopt-info-vec-missed} is equivalent to 
19336 @option{-fopt-info-missed-vec}.  The order of the optimization group
19337 names and message types listed after @option{-fopt-info} does not matter.
19339 As another example,
19340 @smallexample
19341 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19342 @end smallexample
19344 @noindent
19345 outputs information about missed optimizations as well as
19346 optimized locations from all the inlining passes into
19347 @file{inline.txt}.
19349 Finally, consider:
19351 @smallexample
19352 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19353 @end smallexample
19355 @noindent
19356 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19357 in conflict since only one output file is allowed. In this case, only
19358 the first option takes effect and the subsequent options are
19359 ignored. Thus only @file{vec.miss} is produced which contains
19360 dumps from the vectorizer about missed opportunities.
19362 @item -fsave-optimization-record
19363 @opindex fsave-optimization-record
19364 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19365 were performed, for those optimizations that support @option{-fopt-info}.
19367 This option is experimental and the format of the data within the
19368 compressed JSON file is subject to change.
19370 It is roughly equivalent to a machine-readable version of
19371 @option{-fopt-info-all}, as a collection of messages with source file,
19372 line number and column number, with the following additional data for
19373 each message:
19375 @itemize @bullet
19377 @item
19378 the execution count of the code being optimized, along with metadata about
19379 whether this was from actual profile data, or just an estimate, allowing
19380 consumers to prioritize messages by code hotness,
19382 @item
19383 the function name of the code being optimized, where applicable,
19385 @item
19386 the ``inlining chain'' for the code being optimized, so that when
19387 a function is inlined into several different places (which might
19388 themselves be inlined), the reader can distinguish between the copies,
19390 @item
19391 objects identifying those parts of the message that refer to expressions,
19392 statements or symbol-table nodes, which of these categories they are, and,
19393 when available, their source code location,
19395 @item
19396 the GCC pass that emitted the message, and
19398 @item
19399 the location in GCC's own code from which the message was emitted
19401 @end itemize
19403 Additionally, some messages are logically nested within other
19404 messages, reflecting implementation details of the optimization
19405 passes.
19407 @item -fsched-verbose=@var{n}
19408 @opindex fsched-verbose
19409 On targets that use instruction scheduling, this option controls the
19410 amount of debugging output the scheduler prints to the dump files.
19412 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19413 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19414 For @var{n} greater than one, it also output basic block probabilities,
19415 detailed ready list information and unit/insn info.  For @var{n} greater
19416 than two, it includes RTL at abort point, control-flow and regions info.
19417 And for @var{n} over four, @option{-fsched-verbose} also includes
19418 dependence info.
19422 @item -fenable-@var{kind}-@var{pass}
19423 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
19424 @opindex fdisable-
19425 @opindex fenable-
19427 This is a set of options that are used to explicitly disable/enable
19428 optimization passes.  These options are intended for use for debugging GCC.
19429 Compiler users should use regular options for enabling/disabling
19430 passes instead.
19432 @table @gcctabopt
19434 @item -fdisable-ipa-@var{pass}
19435 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
19436 statically invoked in the compiler multiple times, the pass name should be
19437 appended with a sequential number starting from 1.
19439 @item -fdisable-rtl-@var{pass}
19440 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
19441 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19442 statically invoked in the compiler multiple times, the pass name should be
19443 appended with a sequential number starting from 1.  @var{range-list} is a 
19444 comma-separated list of function ranges or assembler names.  Each range is a number
19445 pair separated by a colon.  The range is inclusive in both ends.  If the range
19446 is trivial, the number pair can be simplified as a single number.  If the
19447 function's call graph node's @var{uid} falls within one of the specified ranges,
19448 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
19449 function header of a dump file, and the pass names can be dumped by using
19450 option @option{-fdump-passes}.
19452 @item -fdisable-tree-@var{pass}
19453 @itemx -fdisable-tree-@var{pass}=@var{range-list}
19454 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
19455 option arguments.
19457 @item -fenable-ipa-@var{pass}
19458 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19459 statically invoked in the compiler multiple times, the pass name should be
19460 appended with a sequential number starting from 1.
19462 @item -fenable-rtl-@var{pass}
19463 @itemx -fenable-rtl-@var{pass}=@var{range-list}
19464 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
19465 description and examples.
19467 @item -fenable-tree-@var{pass}
19468 @itemx -fenable-tree-@var{pass}=@var{range-list}
19469 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
19470 of option arguments.
19472 @end table
19474 Here are some examples showing uses of these options.
19476 @smallexample
19478 # disable ccp1 for all functions
19479    -fdisable-tree-ccp1
19480 # disable complete unroll for function whose cgraph node uid is 1
19481    -fenable-tree-cunroll=1
19482 # disable gcse2 for functions at the following ranges [1,1],
19483 # [300,400], and [400,1000]
19484 # disable gcse2 for functions foo and foo2
19485    -fdisable-rtl-gcse2=foo,foo2
19486 # disable early inlining
19487    -fdisable-tree-einline
19488 # disable ipa inlining
19489    -fdisable-ipa-inline
19490 # enable tree full unroll
19491    -fenable-tree-unroll
19493 @end smallexample
19495 @item -fchecking
19496 @itemx -fchecking=@var{n}
19497 @opindex fchecking
19498 @opindex fno-checking
19499 Enable internal consistency checking.  The default depends on
19500 the compiler configuration.  @option{-fchecking=2} enables further
19501 internal consistency checking that might affect code generation.
19503 @item -frandom-seed=@var{string}
19504 @opindex frandom-seed
19505 This option provides a seed that GCC uses in place of
19506 random numbers in generating certain symbol names
19507 that have to be different in every compiled file.  It is also used to
19508 place unique stamps in coverage data files and the object files that
19509 produce them.  You can use the @option{-frandom-seed} option to produce
19510 reproducibly identical object files.
19512 The @var{string} can either be a number (decimal, octal or hex) or an
19513 arbitrary string (in which case it's converted to a number by
19514 computing CRC32).
19516 The @var{string} should be different for every file you compile.
19518 @item -save-temps
19519 @opindex save-temps
19520 Store the usual ``temporary'' intermediate files permanently; name them
19521 as auxiliary output files, as specified described under
19522 @option{-dumpbase} and @option{-dumpdir}.
19524 When used in combination with the @option{-x} command-line option,
19525 @option{-save-temps} is sensible enough to avoid overwriting an
19526 input source file with the same extension as an intermediate file.
19527 The corresponding intermediate file may be obtained by renaming the
19528 source file before using @option{-save-temps}.
19530 @item -save-temps=cwd
19531 @opindex save-temps=cwd
19532 Equivalent to @option{-save-temps -dumpdir ./}.
19534 @item -save-temps=obj
19535 @opindex save-temps=obj
19536 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
19537 @file{outdir/} is the directory of the output file specified after the
19538 @option{-o} option, including any directory separators.  If the
19539 @option{-o} option is not used, the @option{-save-temps=obj} switch
19540 behaves like @option{-save-temps=cwd}.
19542 @item -time@r{[}=@var{file}@r{]}
19543 @opindex time
19544 Report the CPU time taken by each subprocess in the compilation
19545 sequence.  For C source files, this is the compiler proper and assembler
19546 (plus the linker if linking is done).
19548 Without the specification of an output file, the output looks like this:
19550 @smallexample
19551 # cc1 0.12 0.01
19552 # as 0.00 0.01
19553 @end smallexample
19555 The first number on each line is the ``user time'', that is time spent
19556 executing the program itself.  The second number is ``system time'',
19557 time spent executing operating system routines on behalf of the program.
19558 Both numbers are in seconds.
19560 With the specification of an output file, the output is appended to the
19561 named file, and it looks like this:
19563 @smallexample
19564 0.12 0.01 cc1 @var{options}
19565 0.00 0.01 as @var{options}
19566 @end smallexample
19568 The ``user time'' and the ``system time'' are moved before the program
19569 name, and the options passed to the program are displayed, so that one
19570 can later tell what file was being compiled, and with which options.
19572 @item -fdump-final-insns@r{[}=@var{file}@r{]}
19573 @opindex fdump-final-insns
19574 Dump the final internal representation (RTL) to @var{file}.  If the
19575 optional argument is omitted (or if @var{file} is @code{.}), the name
19576 of the dump file is determined by appending @code{.gkd} to the
19577 dump base name, see @option{-dumpbase}.
19579 @item -fcompare-debug@r{[}=@var{opts}@r{]}
19580 @opindex fcompare-debug
19581 @opindex fno-compare-debug
19582 If no error occurs during compilation, run the compiler a second time,
19583 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
19584 passed to the second compilation.  Dump the final internal
19585 representation in both compilations, and print an error if they differ.
19587 If the equal sign is omitted, the default @option{-gtoggle} is used.
19589 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
19590 and nonzero, implicitly enables @option{-fcompare-debug}.  If
19591 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
19592 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
19593 is used.
19595 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
19596 is equivalent to @option{-fno-compare-debug}, which disables the dumping
19597 of the final representation and the second compilation, preventing even
19598 @env{GCC_COMPARE_DEBUG} from taking effect.
19600 To verify full coverage during @option{-fcompare-debug} testing, set
19601 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
19602 which GCC rejects as an invalid option in any actual compilation
19603 (rather than preprocessing, assembly or linking).  To get just a
19604 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
19605 not overridden} will do.
19607 @item -fcompare-debug-second
19608 @opindex fcompare-debug-second
19609 This option is implicitly passed to the compiler for the second
19610 compilation requested by @option{-fcompare-debug}, along with options to
19611 silence warnings, and omitting other options that would cause the compiler
19612 to produce output to files or to standard output as a side effect.  Dump
19613 files and preserved temporary files are renamed so as to contain the
19614 @code{.gk} additional extension during the second compilation, to avoid
19615 overwriting those generated by the first.
19617 When this option is passed to the compiler driver, it causes the
19618 @emph{first} compilation to be skipped, which makes it useful for little
19619 other than debugging the compiler proper.
19621 @item -gtoggle
19622 @opindex gtoggle
19623 Turn off generation of debug info, if leaving out this option
19624 generates it, or turn it on at level 2 otherwise.  The position of this
19625 argument in the command line does not matter; it takes effect after all
19626 other options are processed, and it does so only once, no matter how
19627 many times it is given.  This is mainly intended to be used with
19628 @option{-fcompare-debug}.
19630 @item -fvar-tracking-assignments-toggle
19631 @opindex fvar-tracking-assignments-toggle
19632 @opindex fno-var-tracking-assignments-toggle
19633 Toggle @option{-fvar-tracking-assignments}, in the same way that
19634 @option{-gtoggle} toggles @option{-g}.
19636 @item -Q
19637 @opindex Q
19638 Makes the compiler print out each function name as it is compiled, and
19639 print some statistics about each pass when it finishes.
19641 @item -ftime-report
19642 @opindex ftime-report
19643 Makes the compiler print some statistics about the time consumed by each
19644 pass when it finishes.
19646 @item -ftime-report-details
19647 @opindex ftime-report-details
19648 Record the time consumed by infrastructure parts separately for each pass.
19650 @item -fira-verbose=@var{n}
19651 @opindex fira-verbose
19652 Control the verbosity of the dump file for the integrated register allocator.
19653 The default value is 5.  If the value @var{n} is greater or equal to 10,
19654 the dump output is sent to stderr using the same format as @var{n} minus 10.
19656 @item -flto-report
19657 @opindex flto-report
19658 Prints a report with internal details on the workings of the link-time
19659 optimizer.  The contents of this report vary from version to version.
19660 It is meant to be useful to GCC developers when processing object
19661 files in LTO mode (via @option{-flto}).
19663 Disabled by default.
19665 @item -flto-report-wpa
19666 @opindex flto-report-wpa
19667 Like @option{-flto-report}, but only print for the WPA phase of link-time
19668 optimization.
19670 @item -fmem-report
19671 @opindex fmem-report
19672 Makes the compiler print some statistics about permanent memory
19673 allocation when it finishes.
19675 @item -fmem-report-wpa
19676 @opindex fmem-report-wpa
19677 Makes the compiler print some statistics about permanent memory
19678 allocation for the WPA phase only.
19680 @item -fpre-ipa-mem-report
19681 @opindex fpre-ipa-mem-report
19682 @item -fpost-ipa-mem-report
19683 @opindex fpost-ipa-mem-report
19684 Makes the compiler print some statistics about permanent memory
19685 allocation before or after interprocedural optimization.
19687 @item -fmultiflags
19688 @opindex fmultiflags
19689 This option enables multilib-aware @code{TFLAGS} to be used to build
19690 target libraries with options different from those the compiler is
19691 configured to use by default, through the use of specs (@xref{Spec
19692 Files}) set up by compiler internals, by the target, or by builders at
19693 configure time.
19695 Like @code{TFLAGS}, this allows the target libraries to be built for
19696 portable baseline environments, while the compiler defaults to more
19697 demanding ones.  That's useful because users can easily override the
19698 defaults the compiler is configured to use to build their own programs,
19699 if the defaults are not ideal for their target environment, whereas
19700 rebuilding the runtime libraries is usually not as easy or desirable.
19702 Unlike @code{TFLAGS}, the use of specs enables different flags to be
19703 selected for different multilibs.  The way to accomplish that is to
19704 build with @samp{make TFLAGS=-fmultiflags}, after configuring
19705 @samp{--with-specs=%@{fmultiflags:...@}}.
19707 This option is discarded by the driver once it's done processing driver
19708 self spec.
19710 It is also useful to check that @code{TFLAGS} are being used to build
19711 all target libraries, by configuring a non-bootstrap compiler
19712 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
19713 the compiler and target libraries.
19715 @item -fprofile-report
19716 @opindex fprofile-report
19717 Makes the compiler print some statistics about consistency of the
19718 (estimated) profile and effect of individual passes.
19720 @item -fstack-usage
19721 @opindex fstack-usage
19722 Makes the compiler output stack usage information for the program, on a
19723 per-function basis.  The filename for the dump is made by appending
19724 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
19725 the output file, if explicitly specified and it is not an executable,
19726 otherwise it is the basename of the source file.  An entry is made up
19727 of three fields:
19729 @itemize
19730 @item
19731 The name of the function.
19732 @item
19733 A number of bytes.
19734 @item
19735 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
19736 @end itemize
19738 The qualifier @code{static} means that the function manipulates the stack
19739 statically: a fixed number of bytes are allocated for the frame on function
19740 entry and released on function exit; no stack adjustments are otherwise made
19741 in the function.  The second field is this fixed number of bytes.
19743 The qualifier @code{dynamic} means that the function manipulates the stack
19744 dynamically: in addition to the static allocation described above, stack
19745 adjustments are made in the body of the function, for example to push/pop
19746 arguments around function calls.  If the qualifier @code{bounded} is also
19747 present, the amount of these adjustments is bounded at compile time and
19748 the second field is an upper bound of the total amount of stack used by
19749 the function.  If it is not present, the amount of these adjustments is
19750 not bounded at compile time and the second field only represents the
19751 bounded part.
19753 @item -fstats
19754 @opindex fstats
19755 Emit statistics about front-end processing at the end of the compilation.
19756 This option is supported only by the C++ front end, and
19757 the information is generally only useful to the G++ development team.
19759 @item -fdbg-cnt-list
19760 @opindex fdbg-cnt-list
19761 Print the name and the counter upper bound for all debug counters.
19764 @item -fdbg-cnt=@var{counter-value-list}
19765 @opindex fdbg-cnt
19766 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
19767 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
19768 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
19769 the name of the counter and list of closed intervals.
19770 The @var{lower_bound} is optional and is zero
19771 initialized if not set.
19772 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
19773 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
19774 eleventh invocation.
19775 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
19777 @item -print-file-name=@var{library}
19778 @opindex print-file-name
19779 Print the full absolute name of the library file @var{library} that
19780 would be used when linking---and don't do anything else.  With this
19781 option, GCC does not compile or link anything; it just prints the
19782 file name.
19784 @item -print-multi-directory
19785 @opindex print-multi-directory
19786 Print the directory name corresponding to the multilib selected by any
19787 other switches present in the command line.  This directory is supposed
19788 to exist in @env{GCC_EXEC_PREFIX}.
19790 @item -print-multi-lib
19791 @opindex print-multi-lib
19792 Print the mapping from multilib directory names to compiler switches
19793 that enable them.  The directory name is separated from the switches by
19794 @samp{;}, and each switch starts with an @samp{@@} instead of the
19795 @samp{-}, without spaces between multiple switches.  This is supposed to
19796 ease shell processing.
19798 @item -print-multi-os-directory
19799 @opindex print-multi-os-directory
19800 Print the path to OS libraries for the selected
19801 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
19802 present in the @file{lib} subdirectory and no multilibs are used, this is
19803 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
19804 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
19805 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
19806 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
19808 @item -print-multiarch
19809 @opindex print-multiarch
19810 Print the path to OS libraries for the selected multiarch,
19811 relative to some @file{lib} subdirectory.
19813 @item -print-prog-name=@var{program}
19814 @opindex print-prog-name
19815 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
19817 @item -print-libgcc-file-name
19818 @opindex print-libgcc-file-name
19819 Same as @option{-print-file-name=libgcc.a}.
19821 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
19822 but you do want to link with @file{libgcc.a}.  You can do:
19824 @smallexample
19825 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
19826 @end smallexample
19828 @item -print-search-dirs
19829 @opindex print-search-dirs
19830 Print the name of the configured installation directory and a list of
19831 program and library directories @command{gcc} searches---and don't do anything else.
19833 This is useful when @command{gcc} prints the error message
19834 @samp{installation problem, cannot exec cpp0: No such file or directory}.
19835 To resolve this you either need to put @file{cpp0} and the other compiler
19836 components where @command{gcc} expects to find them, or you can set the environment
19837 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
19838 Don't forget the trailing @samp{/}.
19839 @xref{Environment Variables}.
19841 @item -print-sysroot
19842 @opindex print-sysroot
19843 Print the target sysroot directory that is used during
19844 compilation.  This is the target sysroot specified either at configure
19845 time or using the @option{--sysroot} option, possibly with an extra
19846 suffix that depends on compilation options.  If no target sysroot is
19847 specified, the option prints nothing.
19849 @item -print-sysroot-headers-suffix
19850 @opindex print-sysroot-headers-suffix
19851 Print the suffix added to the target sysroot when searching for
19852 headers, or give an error if the compiler is not configured with such
19853 a suffix---and don't do anything else.
19855 @item -dumpmachine
19856 @opindex dumpmachine
19857 Print the compiler's target machine (for example,
19858 @samp{i686-pc-linux-gnu})---and don't do anything else.
19860 @item -dumpversion
19861 @opindex dumpversion
19862 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
19863 anything else.  This is the compiler version used in filesystem paths and
19864 specs. Depending on how the compiler has been configured it can be just
19865 a single number (major version), two numbers separated by a dot (major and
19866 minor version) or three numbers separated by dots (major, minor and patchlevel
19867 version).
19869 @item -dumpfullversion
19870 @opindex dumpfullversion
19871 Print the full compiler version---and don't do anything else. The output is
19872 always three numbers separated by dots, major, minor and patchlevel version.
19874 @item -dumpspecs
19875 @opindex dumpspecs
19876 Print the compiler's built-in specs---and don't do anything else.  (This
19877 is used when GCC itself is being built.)  @xref{Spec Files}.
19878 @end table
19880 @node Submodel Options
19881 @section Machine-Dependent Options
19882 @cindex submodel options
19883 @cindex specifying hardware config
19884 @cindex hardware models and configurations, specifying
19885 @cindex target-dependent options
19886 @cindex machine-dependent options
19888 Each target machine supported by GCC can have its own options---for
19889 example, to allow you to compile for a particular processor variant or
19890 ABI, or to control optimizations specific to that machine.  By
19891 convention, the names of machine-specific options start with
19892 @samp{-m}.
19894 Some configurations of the compiler also support additional target-specific
19895 options, usually for compatibility with other compilers on the same
19896 platform.
19898 @c This list is ordered alphanumerically by subsection name.
19899 @c It should be the same order and spelling as these options are listed
19900 @c in Machine Dependent Options
19902 @menu
19903 * AArch64 Options::
19904 * Adapteva Epiphany Options::
19905 * AMD GCN Options::
19906 * ARC Options::
19907 * ARM Options::
19908 * AVR Options::
19909 * Blackfin Options::
19910 * C6X Options::
19911 * CRIS Options::
19912 * C-SKY Options::
19913 * Darwin Options::
19914 * DEC Alpha Options::
19915 * eBPF Options::
19916 * FR30 Options::
19917 * FT32 Options::
19918 * FRV Options::
19919 * GNU/Linux Options::
19920 * H8/300 Options::
19921 * HPPA Options::
19922 * IA-64 Options::
19923 * LM32 Options::
19924 * LoongArch Options::
19925 * M32C Options::
19926 * M32R/D Options::
19927 * M680x0 Options::
19928 * MCore Options::
19929 * MicroBlaze Options::
19930 * MIPS Options::
19931 * MMIX Options::
19932 * MN10300 Options::
19933 * Moxie Options::
19934 * MSP430 Options::
19935 * NDS32 Options::
19936 * Nios II Options::
19937 * Nvidia PTX Options::
19938 * OpenRISC Options::
19939 * PDP-11 Options::
19940 * PowerPC Options::
19941 * PRU Options::
19942 * RISC-V Options::
19943 * RL78 Options::
19944 * RS/6000 and PowerPC Options::
19945 * RX Options::
19946 * S/390 and zSeries Options::
19947 * SH Options::
19948 * Solaris 2 Options::
19949 * SPARC Options::
19950 * System V Options::
19951 * V850 Options::
19952 * VAX Options::
19953 * Visium Options::
19954 * VMS Options::
19955 * VxWorks Options::
19956 * x86 Options::
19957 * x86 Windows Options::
19958 * Xstormy16 Options::
19959 * Xtensa Options::
19960 * zSeries Options::
19961 @end menu
19963 @node AArch64 Options
19964 @subsection AArch64 Options
19965 @cindex AArch64 Options
19967 These options are defined for AArch64 implementations:
19969 @table @gcctabopt
19971 @item -mabi=@var{name}
19972 @opindex mabi
19973 Generate code for the specified data model.  Permissible values
19974 are @samp{ilp32} for SysV-like data model where int, long int and pointers
19975 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
19976 but long int and pointers are 64 bits.
19978 The default depends on the specific target configuration.  Note that
19979 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
19980 entire program with the same ABI, and link with a compatible set of libraries.
19982 @item -mbig-endian
19983 @opindex mbig-endian
19984 Generate big-endian code.  This is the default when GCC is configured for an
19985 @samp{aarch64_be-*-*} target.
19987 @item -mgeneral-regs-only
19988 @opindex mgeneral-regs-only
19989 Generate code which uses only the general-purpose registers.  This will prevent
19990 the compiler from using floating-point and Advanced SIMD registers but will not
19991 impose any restrictions on the assembler.
19993 @item -mlittle-endian
19994 @opindex mlittle-endian
19995 Generate little-endian code.  This is the default when GCC is configured for an
19996 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
19998 @item -mcmodel=tiny
19999 @opindex mcmodel=tiny
20000 Generate code for the tiny code model.  The program and its statically defined
20001 symbols must be within 1MB of each other.  Programs can be statically or
20002 dynamically linked.
20004 @item -mcmodel=small
20005 @opindex mcmodel=small
20006 Generate code for the small code model.  The program and its statically defined
20007 symbols must be within 4GB of each other.  Programs can be statically or
20008 dynamically linked.  This is the default code model.
20010 @item -mcmodel=large
20011 @opindex mcmodel=large
20012 Generate code for the large code model.  This makes no assumptions about
20013 addresses and sizes of sections.  Programs can be statically linked only.  The
20014 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
20015 @option{-fpic} and @option{-fPIC}.
20017 @item -mstrict-align
20018 @itemx -mno-strict-align
20019 @opindex mstrict-align
20020 @opindex mno-strict-align
20021 Avoid or allow generating memory accesses that may not be aligned on a natural
20022 object boundary as described in the architecture specification.
20024 @item -momit-leaf-frame-pointer
20025 @itemx -mno-omit-leaf-frame-pointer
20026 @opindex momit-leaf-frame-pointer
20027 @opindex mno-omit-leaf-frame-pointer
20028 Omit or keep the frame pointer in leaf functions.  The former behavior is the
20029 default.
20031 @item -mstack-protector-guard=@var{guard}
20032 @itemx -mstack-protector-guard-reg=@var{reg}
20033 @itemx -mstack-protector-guard-offset=@var{offset}
20034 @opindex mstack-protector-guard
20035 @opindex mstack-protector-guard-reg
20036 @opindex mstack-protector-guard-offset
20037 Generate stack protection code using canary at @var{guard}.  Supported
20038 locations are @samp{global} for a global canary or @samp{sysreg} for a
20039 canary in an appropriate system register.
20041 With the latter choice the options
20042 @option{-mstack-protector-guard-reg=@var{reg}} and
20043 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20044 which system register to use as base register for reading the canary,
20045 and from what offset from that base register. There is no default
20046 register or offset as this is entirely for use within the Linux
20047 kernel.
20049 @item -mtls-dialect=desc
20050 @opindex mtls-dialect=desc
20051 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20052 of TLS variables.  This is the default.
20054 @item -mtls-dialect=traditional
20055 @opindex mtls-dialect=traditional
20056 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20057 of TLS variables.
20059 @item -mtls-size=@var{size}
20060 @opindex mtls-size
20061 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
20062 This option requires binutils 2.26 or newer.
20064 @item -mfix-cortex-a53-835769
20065 @itemx -mno-fix-cortex-a53-835769
20066 @opindex mfix-cortex-a53-835769
20067 @opindex mno-fix-cortex-a53-835769
20068 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20069 This involves inserting a NOP instruction between memory instructions and
20070 64-bit integer multiply-accumulate instructions.
20072 @item -mfix-cortex-a53-843419
20073 @itemx -mno-fix-cortex-a53-843419
20074 @opindex mfix-cortex-a53-843419
20075 @opindex mno-fix-cortex-a53-843419
20076 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20077 This erratum workaround is made at link time and this will only pass the
20078 corresponding flag to the linker.
20080 @item -mlow-precision-recip-sqrt
20081 @itemx -mno-low-precision-recip-sqrt
20082 @opindex mlow-precision-recip-sqrt
20083 @opindex mno-low-precision-recip-sqrt
20084 Enable or disable the reciprocal square root approximation.
20085 This option only has an effect if @option{-ffast-math} or
20086 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20087 precision of reciprocal square root results to about 16 bits for
20088 single precision and to 32 bits for double precision.
20090 @item -mlow-precision-sqrt
20091 @itemx -mno-low-precision-sqrt
20092 @opindex mlow-precision-sqrt
20093 @opindex mno-low-precision-sqrt
20094 Enable or disable the square root approximation.
20095 This option only has an effect if @option{-ffast-math} or
20096 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20097 precision of square root results to about 16 bits for
20098 single precision and to 32 bits for double precision.
20099 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20101 @item -mlow-precision-div
20102 @itemx -mno-low-precision-div
20103 @opindex mlow-precision-div
20104 @opindex mno-low-precision-div
20105 Enable or disable the division approximation.
20106 This option only has an effect if @option{-ffast-math} or
20107 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20108 precision of division results to about 16 bits for
20109 single precision and to 32 bits for double precision.
20111 @item -mtrack-speculation
20112 @itemx -mno-track-speculation
20113 Enable or disable generation of additional code to track speculative
20114 execution through conditional branches.  The tracking state can then
20115 be used by the compiler when expanding calls to
20116 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20117 sequence to be generated.
20119 @item -moutline-atomics
20120 @itemx -mno-outline-atomics
20121 Enable or disable calls to out-of-line helpers to implement atomic operations.
20122 These helpers will, at runtime, determine if the LSE instructions from
20123 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20124 instructions that are present in the base ARMv8.0 ISA.
20126 This option is only applicable when compiling for the base ARMv8.0
20127 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
20128 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20129 used directly.  The same applies when using @option{-mcpu=} when the
20130 selected cpu supports the @samp{lse} feature.
20131 This option is on by default.
20133 @item -march=@var{name}
20134 @opindex march
20135 Specify the name of the target architecture and, optionally, one or
20136 more feature modifiers.  This option has the form
20137 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20139 The table below summarizes the permissible values for @var{arch}
20140 and the features that they enable by default:
20142 @multitable @columnfractions 0.20 0.20 0.60
20143 @headitem @var{arch} value @tab Architecture @tab Includes by default
20144 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20145 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20146 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20147 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20148 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20149 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20150 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20151 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20152 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20153 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20154 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20155 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20156 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20157 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20158 @end multitable
20160 The value @samp{native} is available on native AArch64 GNU/Linux and
20161 causes the compiler to pick the architecture of the host system.  This
20162 option has no effect if the compiler is unable to recognize the
20163 architecture of the host system,
20165 The permissible values for @var{feature} are listed in the sub-section
20166 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20167 Feature Modifiers}.  Where conflicting feature modifiers are
20168 specified, the right-most feature is used.
20170 GCC uses @var{name} to determine what kind of instructions it can emit
20171 when generating assembly code.  If @option{-march} is specified
20172 without either of @option{-mtune} or @option{-mcpu} also being
20173 specified, the code is tuned to perform well across a range of target
20174 processors implementing the target architecture.
20176 @item -mtune=@var{name}
20177 @opindex mtune
20178 Specify the name of the target processor for which GCC should tune the
20179 performance of the code.  Permissible values for this option are:
20180 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20181 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20182 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20183 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20184 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20185 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20186 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20187 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20188 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20189 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
20190 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20191 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20192 @samp{octeontx2f95mm},
20193 @samp{a64fx},
20194 @samp{thunderx}, @samp{thunderxt88},
20195 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20196 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20197 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20198 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20199 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20200 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20201 @samp{cortex-x3}, @samp{cortex-a510}, @samp{cortex-a710}, @samp{cortex-a715},
20202 @samp{ampere1}, @samp{ampere1a}, and @samp{native}.
20204 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20205 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20206 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20207 should tune for a big.LITTLE system.
20209 The value @samp{neoverse-512tvb} specifies that GCC should tune
20210 for Neoverse cores that (a) implement SVE and (b) have a total vector
20211 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
20212 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20213 instructions a cycle and that can execute an equivalent number of SVE
20214 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20215 This is more general than tuning for a specific core like Neoverse V1
20216 but is more specific than the default tuning described below.
20218 Additionally on native AArch64 GNU/Linux systems the value
20219 @samp{native} tunes performance to the host system.  This option has no effect
20220 if the compiler is unable to recognize the processor of the host system.
20222 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20223 are specified, the code is tuned to perform well across a range
20224 of target processors.
20226 This option cannot be suffixed by feature modifiers.
20228 @item -mcpu=@var{name}
20229 @opindex mcpu
20230 Specify the name of the target processor, optionally suffixed by one
20231 or more feature modifiers.  This option has the form
20232 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20233 the permissible values for @var{cpu} are the same as those available
20234 for @option{-mtune}.  The permissible values for @var{feature} are
20235 documented in the sub-section on
20236 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20237 Feature Modifiers}.  Where conflicting feature modifiers are
20238 specified, the right-most feature is used.
20240 GCC uses @var{name} to determine what kind of instructions it can emit when
20241 generating assembly code (as if by @option{-march}) and to determine
20242 the target processor for which to tune for performance (as if
20243 by @option{-mtune}).  Where this option is used in conjunction
20244 with @option{-march} or @option{-mtune}, those options take precedence
20245 over the appropriate part of this option.
20247 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20248 to a specific core, but instead refers to all Neoverse cores that
20249 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20250 a cycle.  Unless overridden by @option{-march},
20251 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20252 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20253 these properties.  Unless overridden by @option{-mtune},
20254 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20255 @option{-mtune=neoverse-512tvb}.
20257 @item -moverride=@var{string}
20258 @opindex moverride
20259 Override tuning decisions made by the back-end in response to a
20260 @option{-mtune=} switch.  The syntax, semantics, and accepted values
20261 for @var{string} in this option are not guaranteed to be consistent
20262 across releases.
20264 This option is only intended to be useful when developing GCC.
20266 @item -mverbose-cost-dump
20267 @opindex mverbose-cost-dump
20268 Enable verbose cost model dumping in the debug dump files.  This option is
20269 provided for use in debugging the compiler.
20271 @item -mpc-relative-literal-loads
20272 @itemx -mno-pc-relative-literal-loads
20273 @opindex mpc-relative-literal-loads
20274 @opindex mno-pc-relative-literal-loads
20275 Enable or disable PC-relative literal loads.  With this option literal pools are
20276 accessed using a single instruction and emitted after each function.  This
20277 limits the maximum size of functions to 1MB.  This is enabled by default for
20278 @option{-mcmodel=tiny}.
20280 @item -msign-return-address=@var{scope}
20281 @opindex msign-return-address
20282 Select the function scope on which return address signing will be applied.
20283 Permissible values are @samp{none}, which disables return address signing,
20284 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20285 functions, and @samp{all}, which enables pointer signing for all functions.  The
20286 default value is @samp{none}. This option has been deprecated by
20287 -mbranch-protection.
20289 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20290 @opindex mbranch-protection
20291 Select the branch protection features to use.
20292 @samp{none} is the default and turns off all types of branch protection.
20293 @samp{standard} turns on all types of branch protection features.  If a feature
20294 has additional tuning options, then @samp{standard} sets it to its standard
20295 level.
20296 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20297 level: signing functions that save the return address to memory (non-leaf
20298 functions will practically always do this) using the a-key.  The optional
20299 argument @samp{leaf} can be used to extend the signing to include leaf
20300 functions.  The optional argument @samp{b-key} can be used to sign the functions
20301 with the B-key instead of the A-key.
20302 @samp{bti} turns on branch target identification mechanism.
20304 @item -mharden-sls=@var{opts}
20305 @opindex mharden-sls
20306 Enable compiler hardening against straight line speculation (SLS).
20307 @var{opts} is a comma-separated list of the following options:
20308 @table @samp
20309 @item retbr
20310 @item blr
20311 @end table
20312 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20313 @samp{-mharden-sls=none} disables all SLS hardening.
20315 @item -msve-vector-bits=@var{bits}
20316 @opindex msve-vector-bits
20317 Specify the number of bits in an SVE vector register.  This option only has
20318 an effect when SVE is enabled.
20320 GCC supports two forms of SVE code generation: ``vector-length
20321 agnostic'' output that works with any size of vector register and
20322 ``vector-length specific'' output that allows GCC to make assumptions
20323 about the vector length when it is useful for optimization reasons.
20324 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20325 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20326 Specifying @samp{scalable} selects vector-length agnostic
20327 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
20328 agnostic output for big-endian targets.  All other values generate
20329 vector-length specific code.  The behavior of these values may change
20330 in future releases and no value except @samp{scalable} should be
20331 relied on for producing code that is portable across different
20332 hardware SVE vector lengths.
20334 The default is @samp{-msve-vector-bits=scalable}, which produces
20335 vector-length agnostic code.
20336 @end table
20338 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20339 @anchor{aarch64-feature-modifiers}
20340 @cindex @option{-march} feature modifiers
20341 @cindex @option{-mcpu} feature modifiers
20342 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20343 the following and their inverses @option{no@var{feature}}:
20345 @table @samp
20346 @item crc
20347 Enable CRC extension.  This is on by default for
20348 @option{-march=armv8.1-a}.
20349 @item crypto
20350 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
20351 instructions.
20352 @item fp
20353 Enable floating-point instructions.  This is on by default for all possible
20354 values for options @option{-march} and @option{-mcpu}.
20355 @item simd
20356 Enable Advanced SIMD instructions.  This also enables floating-point
20357 instructions.  This is on by default for all possible values for options
20358 @option{-march} and @option{-mcpu}.
20359 @item sve
20360 Enable Scalable Vector Extension instructions.  This also enables Advanced
20361 SIMD and floating-point instructions.
20362 @item lse
20363 Enable Large System Extension instructions.  This is on by default for
20364 @option{-march=armv8.1-a}.
20365 @item rdma
20366 Enable Round Double Multiply Accumulate instructions.  This is on by default
20367 for @option{-march=armv8.1-a}.
20368 @item fp16
20369 Enable FP16 extension.  This also enables floating-point instructions.
20370 @item fp16fml
20371 Enable FP16 fmla extension.  This also enables FP16 extensions and
20372 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.
20374 @item rcpc
20375 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
20376 load-acquire atomic semantics, and passes it on to the assembler, enabling
20377 inline asm statements to use instructions from the RCpc extension.
20378 @item dotprod
20379 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
20380 @item aes
20381 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
20382 SIMD instructions.
20383 @item sha2
20384 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
20385 @item sha3
20386 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
20387 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20388 @item sm4
20389 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
20390 Use of this option with architectures prior to Armv8.2-A is not supported.
20391 @item profile
20392 Enable the Statistical Profiling extension.  This option is only to enable the
20393 extension at the assembler level and does not affect code generation.
20394 @item rng
20395 Enable the Armv8.5-a Random Number instructions.  This option is only to
20396 enable the extension at the assembler level and does not affect code
20397 generation.
20398 @item memtag
20399 Enable the Armv8.5-a Memory Tagging Extensions.
20400 Use of this option with architectures prior to Armv8.5-A is not supported.
20401 @item sb
20402 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
20403 enable the extension at the assembler level and does not affect code
20404 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20405 @item ssbs
20406 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
20407 is only to enable the extension at the assembler level and does not affect code
20408 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20409 @item predres
20410 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
20411 This option is only to enable the extension at the assembler level and does
20412 not affect code generation.  This option is enabled by default for
20413 @option{-march=armv8.5-a}.
20414 @item sve2
20415 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
20416 instructions.
20417 @item sve2-bitperm
20418 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
20419 @item sve2-sm4
20420 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
20421 @item sve2-aes
20422 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
20423 @item sve2-sha3
20424 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
20425 @item tme
20426 Enable the Transactional Memory Extension.
20427 @item i8mm
20428 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
20429 Advanced SIMD and floating-point instructions.  This option is enabled by
20430 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20431 prior to Armv8.2-A is not supported.
20432 @item f32mm
20433 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
20434 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20435 not supported.
20436 @item f64mm
20437 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
20438 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20439 not supported.
20440 @item bf16
20441 Enable brain half-precision floating-point instructions.  This also enables
20442 Advanced SIMD and floating-point instructions.  This option is enabled by
20443 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20444 prior to Armv8.2-A is not supported.
20445 @item ls64
20446 Enable the 64-byte atomic load and store instructions for accelerators.
20447 This option is enabled by default for @option{-march=armv8.7-a}.
20448 @item mops
20449 Enable the instructions to accelerate memory operations like @code{memcpy},
20450 @code{memmove}, @code{memset}.  This option is enabled by default for
20451 @option{-march=armv8.8-a}
20452 @item flagm
20453 Enable the Flag Manipulation instructions Extension.
20454 @item pauth
20455 Enable the Pointer Authentication Extension.
20456 @item cssc
20457 Enable the Common Short Sequence Compression instructions.
20459 @end table
20461 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
20462 which implies @option{fp}.
20463 Conversely, @option{nofp} implies @option{nosimd}, which implies
20464 @option{nocrypto}, @option{noaes} and @option{nosha2}.
20466 @node Adapteva Epiphany Options
20467 @subsection Adapteva Epiphany Options
20469 These @samp{-m} options are defined for Adapteva Epiphany:
20471 @table @gcctabopt
20472 @item -mhalf-reg-file
20473 @opindex mhalf-reg-file
20474 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
20475 That allows code to run on hardware variants that lack these registers.
20477 @item -mprefer-short-insn-regs
20478 @opindex mprefer-short-insn-regs
20479 Preferentially allocate registers that allow short instruction generation.
20480 This can result in increased instruction count, so this may either reduce or
20481 increase overall code size.
20483 @item -mbranch-cost=@var{num}
20484 @opindex mbranch-cost
20485 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20486 This cost is only a heuristic and is not guaranteed to produce
20487 consistent results across releases.
20489 @item -mcmove
20490 @opindex mcmove
20491 Enable the generation of conditional moves.
20493 @item -mnops=@var{num}
20494 @opindex mnops
20495 Emit @var{num} NOPs before every other generated instruction.
20497 @item -mno-soft-cmpsf
20498 @opindex mno-soft-cmpsf
20499 @opindex msoft-cmpsf
20500 For single-precision floating-point comparisons, emit an @code{fsub} instruction
20501 and test the flags.  This is faster than a software comparison, but can
20502 get incorrect results in the presence of NaNs, or when two different small
20503 numbers are compared such that their difference is calculated as zero.
20504 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
20505 software comparisons.
20507 @item -mstack-offset=@var{num}
20508 @opindex mstack-offset
20509 Set the offset between the top of the stack and the stack pointer.
20510 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
20511 can be used by leaf functions without stack allocation.
20512 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
20513 Note also that this option changes the ABI; compiling a program with a
20514 different stack offset than the libraries have been compiled with
20515 generally does not work.
20516 This option can be useful if you want to evaluate if a different stack
20517 offset would give you better code, but to actually use a different stack
20518 offset to build working programs, it is recommended to configure the
20519 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
20521 @item -mno-round-nearest
20522 @opindex mno-round-nearest
20523 @opindex mround-nearest
20524 Make the scheduler assume that the rounding mode has been set to
20525 truncating.  The default is @option{-mround-nearest}.
20527 @item -mlong-calls
20528 @opindex mlong-calls
20529 If not otherwise specified by an attribute, assume all calls might be beyond
20530 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
20531 function address into a register before performing a (otherwise direct) call.
20532 This is the default.
20534 @item -mshort-calls
20535 @opindex short-calls
20536 If not otherwise specified by an attribute, assume all direct calls are
20537 in the range of the @code{b} / @code{bl} instructions, so use these instructions
20538 for direct calls.  The default is @option{-mlong-calls}.
20540 @item -msmall16
20541 @opindex msmall16
20542 Assume addresses can be loaded as 16-bit unsigned values.  This does not
20543 apply to function addresses for which @option{-mlong-calls} semantics
20544 are in effect.
20546 @item -mfp-mode=@var{mode}
20547 @opindex mfp-mode
20548 Set the prevailing mode of the floating-point unit.
20549 This determines the floating-point mode that is provided and expected
20550 at function call and return time.  Making this mode match the mode you
20551 predominantly need at function start can make your programs smaller and
20552 faster by avoiding unnecessary mode switches.
20554 @var{mode} can be set to one the following values:
20556 @table @samp
20557 @item caller
20558 Any mode at function entry is valid, and retained or restored when
20559 the function returns, and when it calls other functions.
20560 This mode is useful for compiling libraries or other compilation units
20561 you might want to incorporate into different programs with different
20562 prevailing FPU modes, and the convenience of being able to use a single
20563 object file outweighs the size and speed overhead for any extra
20564 mode switching that might be needed, compared with what would be needed
20565 with a more specific choice of prevailing FPU mode.
20567 @item truncate
20568 This is the mode used for floating-point calculations with
20569 truncating (i.e.@: round towards zero) rounding mode.  That includes
20570 conversion from floating point to integer.
20572 @item round-nearest
20573 This is the mode used for floating-point calculations with
20574 round-to-nearest-or-even rounding mode.
20576 @item int
20577 This is the mode used to perform integer calculations in the FPU, e.g.@:
20578 integer multiply, or integer multiply-and-accumulate.
20579 @end table
20581 The default is @option{-mfp-mode=caller}
20583 @item -mno-split-lohi
20584 @itemx -mno-postinc
20585 @itemx -mno-postmodify
20586 @opindex mno-split-lohi
20587 @opindex msplit-lohi
20588 @opindex mno-postinc
20589 @opindex mpostinc
20590 @opindex mno-postmodify
20591 @opindex mpostmodify
20592 Code generation tweaks that disable, respectively, splitting of 32-bit
20593 loads, generation of post-increment addresses, and generation of
20594 post-modify addresses.  The defaults are @option{msplit-lohi},
20595 @option{-mpost-inc}, and @option{-mpost-modify}.
20597 @item -mnovect-double
20598 @opindex mno-vect-double
20599 @opindex mvect-double
20600 Change the preferred SIMD mode to SImode.  The default is
20601 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
20603 @item -max-vect-align=@var{num}
20604 @opindex max-vect-align
20605 The maximum alignment for SIMD vector mode types.
20606 @var{num} may be 4 or 8.  The default is 8.
20607 Note that this is an ABI change, even though many library function
20608 interfaces are unaffected if they don't use SIMD vector modes
20609 in places that affect size and/or alignment of relevant types.
20611 @item -msplit-vecmove-early
20612 @opindex msplit-vecmove-early
20613 Split vector moves into single word moves before reload.  In theory this
20614 can give better register allocation, but so far the reverse seems to be
20615 generally the case.
20617 @item -m1reg-@var{reg}
20618 @opindex m1reg-
20619 Specify a register to hold the constant @minus{}1, which makes loading small negative
20620 constants and certain bitmasks faster.
20621 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
20622 which specify use of that register as a fixed register,
20623 and @samp{none}, which means that no register is used for this
20624 purpose.  The default is @option{-m1reg-none}.
20626 @end table
20628 @node AMD GCN Options
20629 @subsection AMD GCN Options
20630 @cindex AMD GCN Options
20632 These options are defined specifically for the AMD GCN port.
20634 @table @gcctabopt
20636 @item -march=@var{gpu}
20637 @opindex march
20638 @itemx -mtune=@var{gpu}
20639 @opindex mtune
20640 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
20643 @table @samp
20644 @item fiji
20645 Compile for GCN3 Fiji devices (gfx803).
20647 @item gfx900
20648 Compile for GCN5 Vega 10 devices (gfx900).
20650 @item gfx906
20651 Compile for GCN5 Vega 20 devices (gfx906).
20653 @item gfx908
20654 Compile for CDNA1 Instinct MI100 series devices (gfx908).
20656 @item gfx90a
20657 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
20659 @end table
20661 @item -msram-ecc=on
20662 @itemx -msram-ecc=off
20663 @itemx -msram-ecc=any
20664 @opindex msram-ecc
20665 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
20666 disabled, or either mode.  This feature can be enabled per-process on some
20667 devices.  The compiled code must match the device mode. The default is
20668 @samp{any}, for devices that support it.
20670 @item -mstack-size=@var{bytes}
20671 @opindex mstack-size
20672 Specify how many @var{bytes} of stack space will be requested for each GPU
20673 thread (wave-front).  Beware that there may be many threads and limited memory
20674 available.  The size of the stack allocation may also have an impact on
20675 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
20676 1MB otherwise.
20678 @item -mxnack
20679 @opindex mxnack
20680 Compile binaries suitable for devices with the XNACK feature enabled.  Some
20681 devices always require XNACK and some allow the user to configure XNACK.  The
20682 compiled code must match the device mode.  The default is @samp{-mno-xnack}.
20683 At present this option is a placeholder for support that is not yet
20684 implemented.
20686 @end table
20688 @node ARC Options
20689 @subsection ARC Options
20690 @cindex ARC options
20692 The following options control the architecture variant for which code
20693 is being compiled:
20695 @c architecture variants
20696 @table @gcctabopt
20698 @item -mbarrel-shifter
20699 @opindex mbarrel-shifter
20700 Generate instructions supported by barrel shifter.  This is the default
20701 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
20703 @item -mjli-always
20704 @opindex mjli-always
20705 Force to call a function using jli_s instruction.  This option is
20706 valid only for ARCv2 architecture.
20708 @item -mcpu=@var{cpu}
20709 @opindex mcpu
20710 Set architecture type, register usage, and instruction scheduling
20711 parameters for @var{cpu}.  There are also shortcut alias options
20712 available for backward compatibility and convenience.  Supported
20713 values for @var{cpu} are
20715 @table @samp
20716 @opindex mA6
20717 @opindex mARC600
20718 @item arc600
20719 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
20721 @item arc601
20722 @opindex mARC601
20723 Compile for ARC601.  Alias: @option{-mARC601}.
20725 @item arc700
20726 @opindex mA7
20727 @opindex mARC700
20728 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
20729 This is the default when configured with @option{--with-cpu=arc700}@.
20731 @item arcem
20732 Compile for ARC EM.
20734 @item archs
20735 Compile for ARC HS.
20737 @item em
20738 Compile for ARC EM CPU with no hardware extensions.
20740 @item em4
20741 Compile for ARC EM4 CPU.
20743 @item em4_dmips
20744 Compile for ARC EM4 DMIPS CPU.
20746 @item em4_fpus
20747 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
20748 extension.
20750 @item em4_fpuda
20751 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
20752 double assist instructions.
20754 @item hs
20755 Compile for ARC HS CPU with no hardware extensions except the atomic
20756 instructions.
20758 @item hs34
20759 Compile for ARC HS34 CPU.
20761 @item hs38
20762 Compile for ARC HS38 CPU.
20764 @item hs38_linux
20765 Compile for ARC HS38 CPU with all hardware extensions on.
20767 @item hs4x
20768 Compile for ARC HS4x CPU.
20770 @item hs4xd
20771 Compile for ARC HS4xD CPU.
20773 @item hs4x_rel31
20774 Compile for ARC HS4x CPU release 3.10a.
20776 @item arc600_norm
20777 Compile for ARC 600 CPU with @code{norm} instructions enabled.
20779 @item arc600_mul32x16
20780 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
20781 instructions enabled.
20783 @item arc600_mul64
20784 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
20785 instructions enabled.
20787 @item arc601_norm
20788 Compile for ARC 601 CPU with @code{norm} instructions enabled.
20790 @item arc601_mul32x16
20791 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
20792 instructions enabled.
20794 @item arc601_mul64
20795 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
20796 instructions enabled.
20798 @item nps400
20799 Compile for ARC 700 on NPS400 chip.
20801 @item em_mini
20802 Compile for ARC EM minimalist configuration featuring reduced register
20803 set.
20805 @end table
20807 @item -mdpfp
20808 @opindex mdpfp
20809 @itemx -mdpfp-compact
20810 @opindex mdpfp-compact
20811 Generate double-precision FPX instructions, tuned for the compact
20812 implementation.
20814 @item -mdpfp-fast
20815 @opindex mdpfp-fast
20816 Generate double-precision FPX instructions, tuned for the fast
20817 implementation.
20819 @item -mno-dpfp-lrsr
20820 @opindex mno-dpfp-lrsr
20821 Disable @code{lr} and @code{sr} instructions from using FPX extension
20822 aux registers.
20824 @item -mea
20825 @opindex mea
20826 Generate extended arithmetic instructions.  Currently only
20827 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
20828 supported.  Only valid for @option{-mcpu=ARC700}.
20830 @item -mno-mpy
20831 @opindex mno-mpy
20832 @opindex mmpy
20833 Do not generate @code{mpy}-family instructions for ARC700.  This option is
20834 deprecated.
20836 @item -mmul32x16
20837 @opindex mmul32x16
20838 Generate 32x16-bit multiply and multiply-accumulate instructions.
20840 @item -mmul64
20841 @opindex mmul64
20842 Generate @code{mul64} and @code{mulu64} instructions.  
20843 Only valid for @option{-mcpu=ARC600}.
20845 @item -mnorm
20846 @opindex mnorm
20847 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
20848 is in effect.
20850 @item -mspfp
20851 @opindex mspfp
20852 @itemx -mspfp-compact
20853 @opindex mspfp-compact
20854 Generate single-precision FPX instructions, tuned for the compact
20855 implementation.
20857 @item -mspfp-fast
20858 @opindex mspfp-fast
20859 Generate single-precision FPX instructions, tuned for the fast
20860 implementation.
20862 @item -msimd
20863 @opindex msimd
20864 Enable generation of ARC SIMD instructions via target-specific
20865 builtins.  Only valid for @option{-mcpu=ARC700}.
20867 @item -msoft-float
20868 @opindex msoft-float
20869 This option ignored; it is provided for compatibility purposes only.
20870 Software floating-point code is emitted by default, and this default
20871 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
20872 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
20873 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
20875 @item -mswap
20876 @opindex mswap
20877 Generate @code{swap} instructions.
20879 @item -matomic
20880 @opindex matomic
20881 This enables use of the locked load/store conditional extension to implement
20882 atomic memory built-in functions.  Not available for ARC 6xx or ARC
20883 EM cores.
20885 @item -mdiv-rem
20886 @opindex mdiv-rem
20887 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
20889 @item -mcode-density
20890 @opindex mcode-density
20891 Enable code density instructions for ARC EM.  
20892 This option is on by default for ARC HS.
20894 @item -mll64
20895 @opindex mll64
20896 Enable double load/store operations for ARC HS cores.
20898 @item -mtp-regno=@var{regno}
20899 @opindex mtp-regno
20900 Specify thread pointer register number.
20902 @item -mmpy-option=@var{multo}
20903 @opindex mmpy-option
20904 Compile ARCv2 code with a multiplier design option.  You can specify 
20905 the option using either a string or numeric value for @var{multo}.  
20906 @samp{wlh1} is the default value.  The recognized values are:
20908 @table @samp
20909 @item 0
20910 @itemx none
20911 No multiplier available.
20913 @item 1
20914 @itemx w
20915 16x16 multiplier, fully pipelined.
20916 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
20918 @item 2
20919 @itemx wlh1
20920 32x32 multiplier, fully
20921 pipelined (1 stage).  The following instructions are additionally
20922 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20924 @item 3
20925 @itemx wlh2
20926 32x32 multiplier, fully pipelined
20927 (2 stages).  The following instructions are additionally enabled: @code{mpy},
20928 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20930 @item 4
20931 @itemx wlh3
20932 Two 16x16 multipliers, blocking,
20933 sequential.  The following instructions are additionally enabled: @code{mpy},
20934 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20936 @item 5
20937 @itemx wlh4
20938 One 16x16 multiplier, blocking,
20939 sequential.  The following instructions are additionally enabled: @code{mpy},
20940 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20942 @item 6
20943 @itemx wlh5
20944 One 32x4 multiplier, blocking,
20945 sequential.  The following instructions are additionally enabled: @code{mpy},
20946 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20948 @item 7
20949 @itemx plus_dmpy
20950 ARC HS SIMD support.
20952 @item 8
20953 @itemx plus_macd
20954 ARC HS SIMD support.
20956 @item 9
20957 @itemx plus_qmacw
20958 ARC HS SIMD support.
20960 @end table
20962 This option is only available for ARCv2 cores@.
20964 @item -mfpu=@var{fpu}
20965 @opindex mfpu
20966 Enables support for specific floating-point hardware extensions for ARCv2
20967 cores.  Supported values for @var{fpu} are:
20969 @table @samp
20971 @item fpus
20972 Enables support for single-precision floating-point hardware
20973 extensions@.
20975 @item fpud
20976 Enables support for double-precision floating-point hardware
20977 extensions.  The single-precision floating-point extension is also
20978 enabled.  Not available for ARC EM@.
20980 @item fpuda
20981 Enables support for double-precision floating-point hardware
20982 extensions using double-precision assist instructions.  The single-precision
20983 floating-point extension is also enabled.  This option is
20984 only available for ARC EM@.
20986 @item fpuda_div
20987 Enables support for double-precision floating-point hardware
20988 extensions using double-precision assist instructions.
20989 The single-precision floating-point, square-root, and divide 
20990 extensions are also enabled.  This option is
20991 only available for ARC EM@.
20993 @item fpuda_fma
20994 Enables support for double-precision floating-point hardware
20995 extensions using double-precision assist instructions.
20996 The single-precision floating-point and fused multiply and add 
20997 hardware extensions are also enabled.  This option is
20998 only available for ARC EM@.
21000 @item fpuda_all
21001 Enables support for double-precision floating-point hardware
21002 extensions using double-precision assist instructions.
21003 All single-precision floating-point hardware extensions are also
21004 enabled.  This option is only available for ARC EM@.
21006 @item fpus_div
21007 Enables support for single-precision floating-point, square-root and divide 
21008 hardware extensions@.
21010 @item fpud_div
21011 Enables support for double-precision floating-point, square-root and divide 
21012 hardware extensions.  This option
21013 includes option @samp{fpus_div}. Not available for ARC EM@.
21015 @item fpus_fma
21016 Enables support for single-precision floating-point and 
21017 fused multiply and add hardware extensions@.
21019 @item fpud_fma
21020 Enables support for double-precision floating-point and 
21021 fused multiply and add hardware extensions.  This option
21022 includes option @samp{fpus_fma}.  Not available for ARC EM@.
21024 @item fpus_all
21025 Enables support for all single-precision floating-point hardware
21026 extensions@.
21028 @item fpud_all
21029 Enables support for all single- and double-precision floating-point
21030 hardware extensions.  Not available for ARC EM@.
21032 @end table
21034 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
21035 @opindex mirq-ctrl-saved
21036 Specifies general-purposes registers that the processor automatically
21037 saves/restores on interrupt entry and exit.  @var{register-range} is
21038 specified as two registers separated by a dash.  The register range
21039 always starts with @code{r0}, the upper limit is @code{fp} register.
21040 @var{blink} and @var{lp_count} are optional.  This option is only
21041 valid for ARC EM and ARC HS cores.
21043 @item -mrgf-banked-regs=@var{number}
21044 @opindex mrgf-banked-regs
21045 Specifies the number of registers replicated in second register bank
21046 on entry to fast interrupt.  Fast interrupts are interrupts with the
21047 highest priority level P0.  These interrupts save only PC and STATUS32
21048 registers to avoid memory transactions during interrupt entry and exit
21049 sequences.  Use this option when you are using fast interrupts in an
21050 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
21052 @item -mlpc-width=@var{width}
21053 @opindex mlpc-width
21054 Specify the width of the @code{lp_count} register.  Valid values for
21055 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
21056 fixed to 32 bits.  If the width is less than 32, the compiler does not
21057 attempt to transform loops in your program to use the zero-delay loop
21058 mechanism unless it is known that the @code{lp_count} register can
21059 hold the required loop-counter value.  Depending on the width
21060 specified, the compiler and run-time library might continue to use the
21061 loop mechanism for various needs.  This option defines macro
21062 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21064 @item -mrf16
21065 @opindex mrf16
21066 This option instructs the compiler to generate code for a 16-entry
21067 register file.  This option defines the @code{__ARC_RF16__}
21068 preprocessor macro.
21070 @item -mbranch-index
21071 @opindex mbranch-index
21072 Enable use of @code{bi} or @code{bih} instructions to implement jump
21073 tables.
21075 @end table
21077 The following options are passed through to the assembler, and also
21078 define preprocessor macro symbols.
21080 @c Flags used by the assembler, but for which we define preprocessor
21081 @c macro symbols as well.
21082 @table @gcctabopt
21083 @item -mdsp-packa
21084 @opindex mdsp-packa
21085 Passed down to the assembler to enable the DSP Pack A extensions.
21086 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
21087 deprecated.
21089 @item -mdvbf
21090 @opindex mdvbf
21091 Passed down to the assembler to enable the dual Viterbi butterfly
21092 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
21093 option is deprecated.
21095 @c ARC700 4.10 extension instruction
21096 @item -mlock
21097 @opindex mlock
21098 Passed down to the assembler to enable the locked load/store
21099 conditional extension.  Also sets the preprocessor symbol
21100 @code{__Xlock}.
21102 @item -mmac-d16
21103 @opindex mmac-d16
21104 Passed down to the assembler.  Also sets the preprocessor symbol
21105 @code{__Xxmac_d16}.  This option is deprecated.
21107 @item -mmac-24
21108 @opindex mmac-24
21109 Passed down to the assembler.  Also sets the preprocessor symbol
21110 @code{__Xxmac_24}.  This option is deprecated.
21112 @c ARC700 4.10 extension instruction
21113 @item -mrtsc
21114 @opindex mrtsc
21115 Passed down to the assembler to enable the 64-bit time-stamp counter
21116 extension instruction.  Also sets the preprocessor symbol
21117 @code{__Xrtsc}.  This option is deprecated.
21119 @c ARC700 4.10 extension instruction
21120 @item -mswape
21121 @opindex mswape
21122 Passed down to the assembler to enable the swap byte ordering
21123 extension instruction.  Also sets the preprocessor symbol
21124 @code{__Xswape}.
21126 @item -mtelephony
21127 @opindex mtelephony
21128 Passed down to the assembler to enable dual- and single-operand
21129 instructions for telephony.  Also sets the preprocessor symbol
21130 @code{__Xtelephony}.  This option is deprecated.
21132 @item -mxy
21133 @opindex mxy
21134 Passed down to the assembler to enable the XY memory extension.  Also
21135 sets the preprocessor symbol @code{__Xxy}.
21137 @end table
21139 The following options control how the assembly code is annotated:
21141 @c Assembly annotation options
21142 @table @gcctabopt
21143 @item -misize
21144 @opindex misize
21145 Annotate assembler instructions with estimated addresses.
21147 @item -mannotate-align
21148 @opindex mannotate-align
21149 Explain what alignment considerations lead to the decision to make an
21150 instruction short or long.
21152 @end table
21154 The following options are passed through to the linker:
21156 @c options passed through to the linker
21157 @table @gcctabopt
21158 @item -marclinux
21159 @opindex marclinux
21160 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21161 This option is enabled by default in tool chains built for
21162 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21163 when profiling is not requested.
21165 @item -marclinux_prof
21166 @opindex marclinux_prof
21167 Passed through to the linker, to specify use of the
21168 @code{arclinux_prof} emulation.  This option is enabled by default in
21169 tool chains built for @w{@code{arc-linux-uclibc}} and
21170 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21172 @end table
21174 The following options control the semantics of generated code:
21176 @c semantically relevant code generation options
21177 @table @gcctabopt
21178 @item -mlong-calls
21179 @opindex mlong-calls
21180 Generate calls as register indirect calls, thus providing access
21181 to the full 32-bit address range.
21183 @item -mmedium-calls
21184 @opindex mmedium-calls
21185 Don't use less than 25-bit addressing range for calls, which is the
21186 offset available for an unconditional branch-and-link
21187 instruction.  Conditional execution of function calls is suppressed, to
21188 allow use of the 25-bit range, rather than the 21-bit range with
21189 conditional branch-and-link.  This is the default for tool chains built
21190 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21192 @item -G @var{num}
21193 @opindex G
21194 Put definitions of externally-visible data in a small data section if
21195 that data is no bigger than @var{num} bytes.  The default value of
21196 @var{num} is 4 for any ARC configuration, or 8 when we have double
21197 load/store operations.
21199 @item -mno-sdata
21200 @opindex mno-sdata
21201 @opindex msdata
21202 Do not generate sdata references.  This is the default for tool chains
21203 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21204 targets.
21206 @item -mvolatile-cache
21207 @opindex mvolatile-cache
21208 Use ordinarily cached memory accesses for volatile references.  This is the
21209 default.
21211 @item -mno-volatile-cache
21212 @opindex mno-volatile-cache
21213 @opindex mvolatile-cache
21214 Enable cache bypass for volatile references.
21216 @end table
21218 The following options fine tune code generation:
21219 @c code generation tuning options
21220 @table @gcctabopt
21221 @item -malign-call
21222 @opindex malign-call
21223 Does nothing.  Preserved for backward compatibility.
21225 @item -mauto-modify-reg
21226 @opindex mauto-modify-reg
21227 Enable the use of pre/post modify with register displacement.
21229 @item -mbbit-peephole
21230 @opindex mbbit-peephole
21231 Enable bbit peephole2.
21233 @item -mno-brcc
21234 @opindex mno-brcc
21235 This option disables a target-specific pass in @file{arc_reorg} to
21236 generate compare-and-branch (@code{br@var{cc}}) instructions.  
21237 It has no effect on
21238 generation of these instructions driven by the combiner pass.
21240 @item -mcase-vector-pcrel
21241 @opindex mcase-vector-pcrel
21242 Use PC-relative switch case tables to enable case table shortening.
21243 This is the default for @option{-Os}.
21245 @item -mcompact-casesi
21246 @opindex mcompact-casesi
21247 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
21248 and only available for ARCv1 cores.  This option is deprecated.
21250 @item -mno-cond-exec
21251 @opindex mno-cond-exec
21252 Disable the ARCompact-specific pass to generate conditional 
21253 execution instructions.
21255 Due to delay slot scheduling and interactions between operand numbers,
21256 literal sizes, instruction lengths, and the support for conditional execution,
21257 the target-independent pass to generate conditional execution is often lacking,
21258 so the ARC port has kept a special pass around that tries to find more
21259 conditional execution generation opportunities after register allocation,
21260 branch shortening, and delay slot scheduling have been done.  This pass
21261 generally, but not always, improves performance and code size, at the cost of
21262 extra compilation time, which is why there is an option to switch it off.
21263 If you have a problem with call instructions exceeding their allowable
21264 offset range because they are conditionalized, you should consider using
21265 @option{-mmedium-calls} instead.
21267 @item -mearly-cbranchsi
21268 @opindex mearly-cbranchsi
21269 Enable pre-reload use of the @code{cbranchsi} pattern.
21271 @item -mexpand-adddi
21272 @opindex mexpand-adddi
21273 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21274 @code{add.f}, @code{adc} etc.  This option is deprecated.
21276 @item -mindexed-loads
21277 @opindex mindexed-loads
21278 Enable the use of indexed loads.  This can be problematic because some
21279 optimizers then assume that indexed stores exist, which is not
21280 the case.
21282 @item -mlra
21283 @opindex mlra
21284 Enable Local Register Allocation.  This is still experimental for ARC,
21285 so by default the compiler uses standard reload
21286 (i.e.@: @option{-mno-lra}).
21288 @item -mlra-priority-none
21289 @opindex mlra-priority-none
21290 Don't indicate any priority for target registers.
21292 @item -mlra-priority-compact
21293 @opindex mlra-priority-compact
21294 Indicate target register priority for r0..r3 / r12..r15.
21296 @item -mlra-priority-noncompact
21297 @opindex mlra-priority-noncompact
21298 Reduce target register priority for r0..r3 / r12..r15.
21300 @item -mmillicode
21301 @opindex mmillicode
21302 When optimizing for size (using @option{-Os}), prologues and epilogues
21303 that have to save or restore a large number of registers are often
21304 shortened by using call to a special function in libgcc; this is
21305 referred to as a @emph{millicode} call.  As these calls can pose
21306 performance issues, and/or cause linking issues when linking in a
21307 nonstandard way, this option is provided to turn on or off millicode
21308 call generation.
21310 @item -mcode-density-frame
21311 @opindex mcode-density-frame
21312 This option enable the compiler to emit @code{enter} and @code{leave}
21313 instructions.  These instructions are only valid for CPUs with
21314 code-density feature.
21316 @item -mmixed-code
21317 @opindex mmixed-code
21318 Does nothing.  Preserved for backward compatibility.
21320 @item -mq-class
21321 @opindex mq-class
21322 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
21323 This is the default for @option{-Os}.
21325 @item -mRcq
21326 @opindex mRcq
21327 Does nothing.  Preserved for backward compatibility.
21329 @item -mRcw
21330 @opindex mRcw
21331 Does nothing.  Preserved for backward compatibility.
21333 @item -msize-level=@var{level}
21334 @opindex msize-level
21335 Fine-tune size optimization with regards to instruction lengths and alignment.
21336 The recognized values for @var{level} are:
21337 @table @samp
21338 @item 0
21339 No size optimization.  This level is deprecated and treated like @samp{1}.
21341 @item 1
21342 Short instructions are used opportunistically.
21344 @item 2
21345 In addition, alignment of loops and of code after barriers are dropped.
21347 @item 3
21348 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21350 @end table
21352 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
21353 the behavior when this is not set is equivalent to level @samp{1}.
21355 @item -mtune=@var{cpu}
21356 @opindex mtune
21357 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21358 by @option{-mcpu=}.
21360 Supported values for @var{cpu} are
21362 @table @samp
21363 @item ARC600
21364 Tune for ARC600 CPU.
21366 @item ARC601
21367 Tune for ARC601 CPU.
21369 @item ARC700
21370 Tune for ARC700 CPU with standard multiplier block.
21372 @item ARC700-xmac
21373 Tune for ARC700 CPU with XMAC block.
21375 @item ARC725D
21376 Tune for ARC725D CPU.
21378 @item ARC750D
21379 Tune for ARC750D CPU.
21381 @item core3
21382 Tune for ARCv2 core3 type CPU.  This option enable usage of
21383 @code{dbnz} instruction.
21385 @item release31a
21386 Tune for ARC4x release 3.10a.
21388 @end table
21390 @item -mmultcost=@var{num}
21391 @opindex mmultcost
21392 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21393 normal instruction.
21395 @item -munalign-prob-threshold=@var{probability}
21396 @opindex munalign-prob-threshold
21397 Does nothing.  Preserved for backward compatibility.
21399 @end table
21401 The following options are maintained for backward compatibility, but
21402 are now deprecated and will be removed in a future release:
21404 @c Deprecated options
21405 @table @gcctabopt
21407 @item -margonaut
21408 @opindex margonaut
21409 Obsolete FPX.
21411 @item -mbig-endian
21412 @opindex mbig-endian
21413 @itemx -EB
21414 @opindex EB
21415 Compile code for big-endian targets.  Use of these options is now
21416 deprecated.  Big-endian code is supported by configuring GCC to build
21417 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
21418 for which big endian is the default.
21420 @item -mlittle-endian
21421 @opindex mlittle-endian
21422 @itemx -EL
21423 @opindex EL
21424 Compile code for little-endian targets.  Use of these options is now
21425 deprecated.  Little-endian code is supported by configuring GCC to build 
21426 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
21427 for which little endian is the default.
21429 @item -mbarrel_shifter
21430 @opindex mbarrel_shifter
21431 Replaced by @option{-mbarrel-shifter}.
21433 @item -mdpfp_compact
21434 @opindex mdpfp_compact
21435 Replaced by @option{-mdpfp-compact}.
21437 @item -mdpfp_fast
21438 @opindex mdpfp_fast
21439 Replaced by @option{-mdpfp-fast}.
21441 @item -mdsp_packa
21442 @opindex mdsp_packa
21443 Replaced by @option{-mdsp-packa}.
21445 @item -mEA
21446 @opindex mEA
21447 Replaced by @option{-mea}.
21449 @item -mmac_24
21450 @opindex mmac_24
21451 Replaced by @option{-mmac-24}.
21453 @item -mmac_d16
21454 @opindex mmac_d16
21455 Replaced by @option{-mmac-d16}.
21457 @item -mspfp_compact
21458 @opindex mspfp_compact
21459 Replaced by @option{-mspfp-compact}.
21461 @item -mspfp_fast
21462 @opindex mspfp_fast
21463 Replaced by @option{-mspfp-fast}.
21465 @item -mtune=@var{cpu}
21466 @opindex mtune
21467 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
21468 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
21469 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
21471 @item -multcost=@var{num}
21472 @opindex multcost
21473 Replaced by @option{-mmultcost}.
21475 @end table
21477 @node ARM Options
21478 @subsection ARM Options
21479 @cindex ARM options
21481 These @samp{-m} options are defined for the ARM port:
21483 @table @gcctabopt
21484 @item -mabi=@var{name}
21485 @opindex mabi
21486 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
21487 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
21489 @item -mapcs-frame
21490 @opindex mapcs-frame
21491 Generate a stack frame that is compliant with the ARM Procedure Call
21492 Standard for all functions, even if this is not strictly necessary for
21493 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
21494 with this option causes the stack frames not to be generated for
21495 leaf functions.  The default is @option{-mno-apcs-frame}.
21496 This option is deprecated.
21498 @item -mapcs
21499 @opindex mapcs
21500 This is a synonym for @option{-mapcs-frame} and is deprecated.
21502 @ignore
21503 @c not currently implemented
21504 @item -mapcs-stack-check
21505 @opindex mapcs-stack-check
21506 Generate code to check the amount of stack space available upon entry to
21507 every function (that actually uses some stack space).  If there is
21508 insufficient space available then either the function
21509 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
21510 called, depending upon the amount of stack space required.  The runtime
21511 system is required to provide these functions.  The default is
21512 @option{-mno-apcs-stack-check}, since this produces smaller code.
21514 @c not currently implemented
21515 @item -mapcs-reentrant
21516 @opindex mapcs-reentrant
21517 Generate reentrant, position-independent code.  The default is
21518 @option{-mno-apcs-reentrant}.
21519 @end ignore
21521 @item -mthumb-interwork
21522 @opindex mthumb-interwork
21523 Generate code that supports calling between the ARM and Thumb
21524 instruction sets.  Without this option, on pre-v5 architectures, the
21525 two instruction sets cannot be reliably used inside one program.  The
21526 default is @option{-mno-thumb-interwork}, since slightly larger code
21527 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
21528 configurations this option is meaningless.
21530 @item -mno-sched-prolog
21531 @opindex mno-sched-prolog
21532 @opindex msched-prolog
21533 Prevent the reordering of instructions in the function prologue, or the
21534 merging of those instruction with the instructions in the function's
21535 body.  This means that all functions start with a recognizable set
21536 of instructions (or in fact one of a choice from a small set of
21537 different function prologues), and this information can be used to
21538 locate the start of functions inside an executable piece of code.  The
21539 default is @option{-msched-prolog}.
21541 @item -mfloat-abi=@var{name}
21542 @opindex mfloat-abi
21543 Specifies which floating-point ABI to use.  Permissible values
21544 are: @samp{soft}, @samp{softfp} and @samp{hard}.
21546 Specifying @samp{soft} causes GCC to generate output containing
21547 library calls for floating-point operations.
21548 @samp{softfp} allows the generation of code using hardware floating-point
21549 instructions, but still uses the soft-float calling conventions.
21550 @samp{hard} allows generation of floating-point instructions
21551 and uses FPU-specific calling conventions.
21553 The default depends on the specific target configuration.  Note that
21554 the hard-float and soft-float ABIs are not link-compatible; you must
21555 compile your entire program with the same ABI, and link with a
21556 compatible set of libraries.
21558 @item -mgeneral-regs-only
21559 @opindex mgeneral-regs-only
21560 Generate code which uses only the general-purpose registers.  This will prevent
21561 the compiler from using floating-point and Advanced SIMD registers but will not
21562 impose any restrictions on the assembler.
21564 @item -mlittle-endian
21565 @opindex mlittle-endian
21566 Generate code for a processor running in little-endian mode.  This is
21567 the default for all standard configurations.
21569 @item -mbig-endian
21570 @opindex mbig-endian
21571 Generate code for a processor running in big-endian mode; the default is
21572 to compile code for a little-endian processor.
21574 @item -mbe8
21575 @itemx -mbe32
21576 @opindex mbe8
21577 When linking a big-endian image select between BE8 and BE32 formats.
21578 The option has no effect for little-endian images and is ignored.  The
21579 default is dependent on the selected target architecture.  For ARMv6
21580 and later architectures the default is BE8, for older architectures
21581 the default is BE32.  BE32 format has been deprecated by ARM.
21583 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
21584 @opindex march
21585 This specifies the name of the target ARM architecture.  GCC uses this
21586 name to determine what kind of instructions it can emit when generating
21587 assembly code.  This option can be used in conjunction with or instead
21588 of the @option{-mcpu=} option.
21590 Permissible names are:
21591 @samp{armv4t},
21592 @samp{armv5t}, @samp{armv5te},
21593 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
21594 @samp{armv6z}, @samp{armv6zk},
21595 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
21596 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
21597 @samp{armv8.4-a},
21598 @samp{armv8.5-a},
21599 @samp{armv8.6-a},
21600 @samp{armv9-a},
21601 @samp{armv7-r},
21602 @samp{armv8-r},
21603 @samp{armv6-m}, @samp{armv6s-m},
21604 @samp{armv7-m}, @samp{armv7e-m},
21605 @samp{armv8-m.base}, @samp{armv8-m.main},
21606 @samp{armv8.1-m.main},
21607 @samp{armv9-a},
21608 @samp{iwmmxt} and @samp{iwmmxt2}.
21610 Additionally, the following architectures, which lack support for the
21611 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
21613 Many of the architectures support extensions.  These can be added by
21614 appending @samp{+@var{extension}} to the architecture name.  Extension
21615 options are processed in order and capabilities accumulate.  An extension
21616 will also enable any necessary base extensions
21617 upon which it depends.  For example, the @samp{+crypto} extension
21618 will always enable the @samp{+simd} extension.  The exception to the
21619 additive construction is for extensions that are prefixed with
21620 @samp{+no@dots{}}: these extensions disable the specified option and
21621 any other extensions that may depend on the presence of that
21622 extension.
21624 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
21625 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
21626 entirely disabled by the @samp{+nofp} option that follows it.
21628 Most extension names are generically named, but have an effect that is
21629 dependent upon the architecture to which it is applied.  For example,
21630 the @samp{+simd} option can be applied to both @samp{armv7-a} and
21631 @samp{armv8-a} architectures, but will enable the original ARMv7-A
21632 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
21633 variant for @samp{armv8-a}.
21635 The table below lists the supported extensions for each architecture.
21636 Architectures not mentioned do not support any extensions.
21638 @table @samp
21639 @item armv5te
21640 @itemx armv6
21641 @itemx armv6j
21642 @itemx armv6k
21643 @itemx armv6kz
21644 @itemx armv6t2
21645 @itemx armv6z
21646 @itemx armv6zk
21647 @table @samp
21648 @item +fp
21649 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
21650 used as an alias for this extension.
21652 @item +nofp
21653 Disable the floating-point instructions.
21654 @end table
21656 @item armv7
21657 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
21658 @table @samp
21659 @item +fp
21660 The VFPv3 floating-point instructions, with 16 double-precision
21661 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
21662 for this extension.  Note that floating-point is not supported by the
21663 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
21664 ARMv7-R architectures.
21666 @item +nofp
21667 Disable the floating-point instructions.
21668 @end table
21670 @item armv7-a
21671 @table @samp
21672 @item +mp
21673 The multiprocessing extension.
21675 @item +sec
21676 The security extension.
21678 @item +fp
21679 The VFPv3 floating-point instructions, with 16 double-precision
21680 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
21681 for this extension.
21683 @item +simd
21684 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21685 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
21686 for this extension.
21688 @item +vfpv3
21689 The VFPv3 floating-point instructions, with 32 double-precision
21690 registers.
21692 @item +vfpv3-d16-fp16
21693 The VFPv3 floating-point instructions, with 16 double-precision
21694 registers and the half-precision floating-point conversion operations.
21696 @item +vfpv3-fp16
21697 The VFPv3 floating-point instructions, with 32 double-precision
21698 registers and the half-precision floating-point conversion operations.
21700 @item +vfpv4-d16
21701 The VFPv4 floating-point instructions, with 16 double-precision
21702 registers.
21704 @item +vfpv4
21705 The VFPv4 floating-point instructions, with 32 double-precision
21706 registers.
21708 @item +neon-fp16
21709 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21710 the half-precision floating-point conversion operations.
21712 @item +neon-vfpv4
21713 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
21715 @item +nosimd
21716 Disable the Advanced SIMD instructions (does not disable floating point).
21718 @item +nofp
21719 Disable the floating-point and Advanced SIMD instructions.
21720 @end table
21722 @item armv7ve
21723 The extended version of the ARMv7-A architecture with support for
21724 virtualization.
21725 @table @samp
21726 @item +fp
21727 The VFPv4 floating-point instructions, with 16 double-precision registers.
21728 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
21730 @item +simd
21731 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
21732 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
21734 @item +vfpv3-d16
21735 The VFPv3 floating-point instructions, with 16 double-precision
21736 registers.
21738 @item +vfpv3
21739 The VFPv3 floating-point instructions, with 32 double-precision
21740 registers.
21742 @item +vfpv3-d16-fp16
21743 The VFPv3 floating-point instructions, with 16 double-precision
21744 registers and the half-precision floating-point conversion operations.
21746 @item +vfpv3-fp16
21747 The VFPv3 floating-point instructions, with 32 double-precision
21748 registers and the half-precision floating-point conversion operations.
21750 @item +vfpv4-d16
21751 The VFPv4 floating-point instructions, with 16 double-precision
21752 registers.
21754 @item +vfpv4
21755 The VFPv4 floating-point instructions, with 32 double-precision
21756 registers.
21758 @item +neon
21759 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21760 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
21762 @item +neon-fp16
21763 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21764 the half-precision floating-point conversion operations.
21766 @item +nosimd
21767 Disable the Advanced SIMD instructions (does not disable floating point).
21769 @item +nofp
21770 Disable the floating-point and Advanced SIMD instructions.
21771 @end table
21773 @item armv8-a
21774 @table @samp
21775 @item +crc
21776 The Cyclic Redundancy Check (CRC) instructions.
21777 @item +simd
21778 The ARMv8-A Advanced SIMD and floating-point instructions.
21779 @item +crypto
21780 The cryptographic instructions.
21781 @item +nocrypto
21782 Disable the cryptographic instructions.
21783 @item +nofp
21784 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21785 @item +sb
21786 Speculation Barrier Instruction.
21787 @item +predres
21788 Execution and Data Prediction Restriction Instructions.
21789 @end table
21791 @item armv8.1-a
21792 @table @samp
21793 @item +simd
21794 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21796 @item +crypto
21797 The cryptographic instructions.  This also enables the Advanced SIMD and
21798 floating-point instructions.
21800 @item +nocrypto
21801 Disable the cryptographic instructions.
21803 @item +nofp
21804 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21806 @item +sb
21807 Speculation Barrier Instruction.
21809 @item +predres
21810 Execution and Data Prediction Restriction Instructions.
21811 @end table
21813 @item armv8.2-a
21814 @itemx armv8.3-a
21815 @table @samp
21816 @item +fp16
21817 The half-precision floating-point data processing instructions.
21818 This also enables the Advanced SIMD and floating-point instructions.
21820 @item +fp16fml
21821 The half-precision floating-point fmla extension.  This also enables
21822 the half-precision floating-point extension and Advanced SIMD and
21823 floating-point instructions.
21825 @item +simd
21826 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21828 @item +crypto
21829 The cryptographic instructions.  This also enables the Advanced SIMD and
21830 floating-point instructions.
21832 @item +dotprod
21833 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
21835 @item +nocrypto
21836 Disable the cryptographic extension.
21838 @item +nofp
21839 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21841 @item +sb
21842 Speculation Barrier Instruction.
21844 @item +predres
21845 Execution and Data Prediction Restriction Instructions.
21847 @item +i8mm
21848 8-bit Integer Matrix Multiply instructions.
21849 This also enables Advanced SIMD and floating-point instructions.
21851 @item +bf16
21852 Brain half-precision floating-point instructions.
21853 This also enables Advanced SIMD and floating-point instructions.
21854 @end table
21856 @item armv8.4-a
21857 @table @samp
21858 @item +fp16
21859 The half-precision floating-point data processing instructions.
21860 This also enables the Advanced SIMD and floating-point instructions as well
21861 as the Dot Product extension and the half-precision floating-point fmla
21862 extension.
21864 @item +simd
21865 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21866 Dot Product extension.
21868 @item +crypto
21869 The cryptographic instructions.  This also enables the Advanced SIMD and
21870 floating-point instructions as well as the Dot Product extension.
21872 @item +nocrypto
21873 Disable the cryptographic extension.
21875 @item +nofp
21876 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21878 @item +sb
21879 Speculation Barrier Instruction.
21881 @item +predres
21882 Execution and Data Prediction Restriction Instructions.
21884 @item +i8mm
21885 8-bit Integer Matrix Multiply instructions.
21886 This also enables Advanced SIMD and floating-point instructions.
21888 @item +bf16
21889 Brain half-precision floating-point instructions.
21890 This also enables Advanced SIMD and floating-point instructions.
21891 @end table
21893 @item armv8.5-a
21894 @table @samp
21895 @item +fp16
21896 The half-precision floating-point data processing instructions.
21897 This also enables the Advanced SIMD and floating-point instructions as well
21898 as the Dot Product extension and the half-precision floating-point fmla
21899 extension.
21901 @item +simd
21902 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21903 Dot Product extension.
21905 @item +crypto
21906 The cryptographic instructions.  This also enables the Advanced SIMD and
21907 floating-point instructions as well as the Dot Product extension.
21909 @item +nocrypto
21910 Disable the cryptographic extension.
21912 @item +nofp
21913 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21915 @item +i8mm
21916 8-bit Integer Matrix Multiply instructions.
21917 This also enables Advanced SIMD and floating-point instructions.
21919 @item +bf16
21920 Brain half-precision floating-point instructions.
21921 This also enables Advanced SIMD and floating-point instructions.
21922 @end table
21924 @item armv8.6-a
21925 @table @samp
21926 @item +fp16
21927 The half-precision floating-point data processing instructions.
21928 This also enables the Advanced SIMD and floating-point instructions as well
21929 as the Dot Product extension and the half-precision floating-point fmla
21930 extension.
21932 @item +simd
21933 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21934 Dot Product extension.
21936 @item +crypto
21937 The cryptographic instructions.  This also enables the Advanced SIMD and
21938 floating-point instructions as well as the Dot Product extension.
21940 @item +nocrypto
21941 Disable the cryptographic extension.
21943 @item +nofp
21944 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21946 @item +i8mm
21947 8-bit Integer Matrix Multiply instructions.
21948 This also enables Advanced SIMD and floating-point instructions.
21950 @item +bf16
21951 Brain half-precision floating-point instructions.
21952 This also enables Advanced SIMD and floating-point instructions.
21953 @end table
21955 @item armv7-r
21956 @table @samp
21957 @item +fp.sp
21958 The single-precision VFPv3 floating-point instructions.  The extension
21959 @samp{+vfpv3xd} can be used as an alias for this extension.
21961 @item +fp
21962 The VFPv3 floating-point instructions with 16 double-precision registers.
21963 The extension +vfpv3-d16 can be used as an alias for this extension.
21965 @item +vfpv3xd-d16-fp16
21966 The single-precision VFPv3 floating-point instructions with 16 double-precision
21967 registers and the half-precision floating-point conversion operations.
21969 @item +vfpv3-d16-fp16
21970 The VFPv3 floating-point instructions with 16 double-precision
21971 registers and the half-precision floating-point conversion operations.
21973 @item +nofp
21974 Disable the floating-point extension.
21976 @item +idiv
21977 The ARM-state integer division instructions.
21979 @item +noidiv
21980 Disable the ARM-state integer division extension.
21981 @end table
21983 @item armv7e-m
21984 @table @samp
21985 @item +fp
21986 The single-precision VFPv4 floating-point instructions.
21988 @item +fpv5
21989 The single-precision FPv5 floating-point instructions.
21991 @item +fp.dp
21992 The single- and double-precision FPv5 floating-point instructions.
21994 @item +nofp
21995 Disable the floating-point extensions.
21996 @end table
21998 @item  armv8.1-m.main
21999 @table @samp
22001 @item +dsp
22002 The DSP instructions.
22004 @item +mve
22005 The M-Profile Vector Extension (MVE) integer instructions.
22007 @item +mve.fp
22008 The M-Profile Vector Extension (MVE) integer and single precision
22009 floating-point instructions.
22011 @item +fp
22012 The single-precision floating-point instructions.
22014 @item +fp.dp
22015 The single- and double-precision floating-point instructions.
22017 @item +nofp
22018 Disable the floating-point extension.
22020 @item +cdecp0, +cdecp1, ... , +cdecp7
22021 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22022 to the numbers given in the options in the range 0 to 7.
22023 @end table
22025 @item  armv8-m.main
22026 @table @samp
22027 @item +dsp
22028 The DSP instructions.
22030 @item +nodsp
22031 Disable the DSP extension.
22033 @item +fp
22034 The single-precision floating-point instructions.
22036 @item +fp.dp
22037 The single- and double-precision floating-point instructions.
22039 @item +nofp
22040 Disable the floating-point extension.
22042 @item +cdecp0, +cdecp1, ... , +cdecp7
22043 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22044 to the numbers given in the options in the range 0 to 7.
22045 @end table
22047 @item armv8-r
22048 @table @samp
22049 @item +crc
22050 The Cyclic Redundancy Check (CRC) instructions.
22051 @item +fp.sp
22052 The single-precision FPv5 floating-point instructions.
22053 @item +simd
22054 The ARMv8-A Advanced SIMD and floating-point instructions.
22055 @item +crypto
22056 The cryptographic instructions.
22057 @item +nocrypto
22058 Disable the cryptographic instructions.
22059 @item +nofp
22060 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22061 @end table
22063 @end table
22065 @option{-march=native} causes the compiler to auto-detect the architecture
22066 of the build computer.  At present, this feature is only supported on
22067 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22068 is unsuccessful the option has no effect.
22070 @item -mtune=@var{name}
22071 @opindex mtune
22072 This option specifies the name of the target ARM processor for
22073 which GCC should tune the performance of the code.
22074 For some ARM implementations better performance can be obtained by using
22075 this option.
22076 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22077 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22078 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22079 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22080 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22081 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22082 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22083 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22084 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22085 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22086 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22087 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22088 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22089 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22090 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22091 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22092 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22093 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22094 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22095 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1}, @samp{cortex-x1c},
22096 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22097 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22098 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22099 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22100 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22101 @samp{xgene1}.
22103 Additionally, this option can specify that GCC should tune the performance
22104 of the code for a big.LITTLE system.  Permissible names are:
22105 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22106 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22107 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22108 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22110 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22111 performance for a blend of processors within architecture @var{arch}.
22112 The aim is to generate code that run well on the current most popular
22113 processors, balancing between optimizations that benefit some CPUs in the
22114 range, and avoiding performance pitfalls of other CPUs.  The effects of
22115 this option may change in future GCC versions as CPU models come and go.
22117 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22118 the extension options do not affect the tuning of the generated code.
22120 @option{-mtune=native} causes the compiler to auto-detect the CPU
22121 of the build computer.  At present, this feature is only supported on
22122 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
22123 unsuccessful the option has no effect.
22125 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22126 @opindex mcpu
22127 This specifies the name of the target ARM processor.  GCC uses this name
22128 to derive the name of the target ARM architecture (as if specified
22129 by @option{-march}) and the ARM processor type for which to tune for
22130 performance (as if specified by @option{-mtune}).  Where this option
22131 is used in conjunction with @option{-march} or @option{-mtune},
22132 those options take precedence over the appropriate part of this option.
22134 Many of the supported CPUs implement optional architectural
22135 extensions.  Where this is so the architectural extensions are
22136 normally enabled by default.  If implementations that lack the
22137 extension exist, then the extension syntax can be used to disable
22138 those extensions that have been omitted.  For floating-point and
22139 Advanced SIMD (Neon) instructions, the settings of the options
22140 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22141 floating-point and Advanced SIMD instructions will only be used if
22142 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22143 @option{-mfpu} other than @samp{auto} will override the available
22144 floating-point and SIMD extension instructions.
22146 For example, @samp{cortex-a9} can be found in three major
22147 configurations: integer only, with just a floating-point unit or with
22148 floating-point and Advanced SIMD.  The default is to enable all the
22149 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22150 be used to disable just the SIMD or both the SIMD and floating-point
22151 instructions respectively.
22153 Permissible names for this option are the same as those for
22154 @option{-mtune}.
22156 The following extension options are common to the listed CPUs:
22158 @table @samp
22159 @item +nodsp
22160 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}
22161 and @samp{cortex-m55}. Also disable the M-Profile Vector Extension (MVE)
22162 integer and single precision floating-point instructions on @samp{cortex-m55}.
22164 @item +nomve
22165 Disable the M-Profile Vector Extension (MVE) integer and single precision
22166 floating-point instructions on @samp{cortex-m55}.
22168 @item +nomve.fp
22169 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22170 instructions on @samp{cortex-m55}.
22172 @item +cdecp0, +cdecp1, ... , +cdecp7
22173 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22174 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m55}.
22176 @item  +nofp
22177 Disables the floating-point instructions on @samp{arm9e},
22178 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22179 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22180 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22181 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22182 and @samp{cortex-m55}.
22183 Disables the floating-point and SIMD instructions on
22184 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22185 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22186 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22187 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22188 @samp{cortex-a53} and @samp{cortex-a55}.
22190 @item +nofp.dp
22191 Disables the double-precision component of the floating-point instructions
22192 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22193 @samp{cortex-r52plus} and @samp{cortex-m7}.
22195 @item +nosimd
22196 Disables the SIMD (but not floating-point) instructions on
22197 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22198 and @samp{cortex-a9}.
22200 @item +crypto
22201 Enables the cryptographic instructions on @samp{cortex-a32},
22202 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22203 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22204 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22205 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22206 @samp{cortex-a75.cortex-a55}.
22207 @end table
22209 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22210 VFPv3 with 16 double-precision registers.  It supports the following
22211 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22212 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22213 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22214 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
22215 the extensions to @option{-march=armv7-a}.
22217 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22218 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22219 See @option{-mtune} for more information.
22221 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22222 of the build computer.  At present, this feature is only supported on
22223 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22224 is unsuccessful the option has no effect.
22226 @item -mfpu=@var{name}
22227 @opindex mfpu
22228 This specifies what floating-point hardware (or hardware emulation) is
22229 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
22230 @samp{vfpv3},
22231 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22232 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22233 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22234 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22235 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22236 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22237 is an alias for @samp{vfpv2}.
22239 The setting @samp{auto} is the default and is special.  It causes the
22240 compiler to select the floating-point and Advanced SIMD instructions
22241 based on the settings of @option{-mcpu} and @option{-march}.
22243 If the selected floating-point hardware includes the NEON extension
22244 (e.g.@: @option{-mfpu=neon}), note that floating-point
22245 operations are not generated by GCC's auto-vectorization pass unless
22246 @option{-funsafe-math-optimizations} is also specified.  This is
22247 because NEON hardware does not fully implement the IEEE 754 standard for
22248 floating-point arithmetic (in particular denormal values are treated as
22249 zero), so the use of NEON instructions may lead to a loss of precision.
22251 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}).
22253 @item -mfp16-format=@var{name}
22254 @opindex mfp16-format
22255 Specify the format of the @code{__fp16} half-precision floating-point type.
22256 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22257 the default is @samp{none}, in which case the @code{__fp16} type is not
22258 defined.  @xref{Half-Precision}, for more information.
22260 @item -mstructure-size-boundary=@var{n}
22261 @opindex mstructure-size-boundary
22262 The sizes of all structures and unions are rounded up to a multiple
22263 of the number of bits set by this option.  Permissible values are 8, 32
22264 and 64.  The default value varies for different toolchains.  For the COFF
22265 targeted toolchain the default value is 8.  A value of 64 is only allowed
22266 if the underlying ABI supports it.
22268 Specifying a larger number can produce faster, more efficient code, but
22269 can also increase the size of the program.  Different values are potentially
22270 incompatible.  Code compiled with one value cannot necessarily expect to
22271 work with code or libraries compiled with another value, if they exchange
22272 information using structures or unions.
22274 This option is deprecated.
22276 @item -mabort-on-noreturn
22277 @opindex mabort-on-noreturn
22278 Generate a call to the function @code{abort} at the end of a
22279 @code{noreturn} function.  It is executed if the function tries to
22280 return.
22282 @item -mlong-calls
22283 @itemx -mno-long-calls
22284 @opindex mlong-calls
22285 @opindex mno-long-calls
22286 Tells the compiler to perform function calls by first loading the
22287 address of the function into a register and then performing a subroutine
22288 call on this register.  This switch is needed if the target function
22289 lies outside of the 64-megabyte addressing range of the offset-based
22290 version of subroutine call instruction.
22292 Even if this switch is enabled, not all function calls are turned
22293 into long calls.  The heuristic is that static functions, functions
22294 that have the @code{short_call} attribute, functions that are inside
22295 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22296 definitions have already been compiled within the current compilation
22297 unit are not turned into long calls.  The exceptions to this rule are
22298 that weak function definitions, functions with the @code{long_call}
22299 attribute or the @code{section} attribute, and functions that are within
22300 the scope of a @code{#pragma long_calls} directive are always
22301 turned into long calls.
22303 This feature is not enabled by default.  Specifying
22304 @option{-mno-long-calls} restores the default behavior, as does
22305 placing the function calls within the scope of a @code{#pragma
22306 long_calls_off} directive.  Note these switches have no effect on how
22307 the compiler generates code to handle function calls via function
22308 pointers.
22310 @item -msingle-pic-base
22311 @opindex msingle-pic-base
22312 Treat the register used for PIC addressing as read-only, rather than
22313 loading it in the prologue for each function.  The runtime system is
22314 responsible for initializing this register with an appropriate value
22315 before execution begins.
22317 @item -mpic-register=@var{reg}
22318 @opindex mpic-register
22319 Specify the register to be used for PIC addressing.
22320 For standard PIC base case, the default is any suitable register
22321 determined by compiler.  For single PIC base case, the default is
22322 @samp{R9} if target is EABI based or stack-checking is enabled,
22323 otherwise the default is @samp{R10}.
22325 @item -mpic-data-is-text-relative
22326 @opindex mpic-data-is-text-relative
22327 Assume that the displacement between the text and data segments is fixed
22328 at static link time.  This permits using PC-relative addressing
22329 operations to access data known to be in the data segment.  For
22330 non-VxWorks RTP targets, this option is enabled by default.  When
22331 disabled on such targets, it will enable @option{-msingle-pic-base} by
22332 default.
22334 @item -mpoke-function-name
22335 @opindex mpoke-function-name
22336 Write the name of each function into the text section, directly
22337 preceding the function prologue.  The generated code is similar to this:
22339 @smallexample
22340      t0
22341          .ascii "arm_poke_function_name", 0
22342          .align
22343      t1
22344          .word 0xff000000 + (t1 - t0)
22345      arm_poke_function_name
22346          mov     ip, sp
22347          stmfd   sp!, @{fp, ip, lr, pc@}
22348          sub     fp, ip, #4
22349 @end smallexample
22351 When performing a stack backtrace, code can inspect the value of
22352 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
22353 location @code{pc - 12} and the top 8 bits are set, then we know that
22354 there is a function name embedded immediately preceding this location
22355 and has length @code{((pc[-3]) & 0xff000000)}.
22357 @item -mthumb
22358 @itemx -marm
22359 @opindex marm
22360 @opindex mthumb
22362 Select between generating code that executes in ARM and Thumb
22363 states.  The default for most configurations is to generate code
22364 that executes in ARM state, but the default can be changed by
22365 configuring GCC with the @option{--with-mode=}@var{state}
22366 configure option.
22368 You can also override the ARM and Thumb mode for each function
22369 by using the @code{target("thumb")} and @code{target("arm")} function attributes
22370 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22372 @item -mflip-thumb 
22373 @opindex mflip-thumb
22374 Switch ARM/Thumb modes on alternating functions.
22375 This option is provided for regression testing of mixed Thumb/ARM code
22376 generation, and is not intended for ordinary use in compiling code.
22378 @item -mtpcs-frame
22379 @opindex mtpcs-frame
22380 Generate a stack frame that is compliant with the Thumb Procedure Call
22381 Standard for all non-leaf functions.  (A leaf function is one that does
22382 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
22384 @item -mtpcs-leaf-frame
22385 @opindex mtpcs-leaf-frame
22386 Generate a stack frame that is compliant with the Thumb Procedure Call
22387 Standard for all leaf functions.  (A leaf function is one that does
22388 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
22390 @item -mcallee-super-interworking
22391 @opindex mcallee-super-interworking
22392 Gives all externally visible functions in the file being compiled an ARM
22393 instruction set header which switches to Thumb mode before executing the
22394 rest of the function.  This allows these functions to be called from
22395 non-interworking code.  This option is not valid in AAPCS configurations
22396 because interworking is enabled by default.
22398 @item -mcaller-super-interworking
22399 @opindex mcaller-super-interworking
22400 Allows calls via function pointers (including virtual functions) to
22401 execute correctly regardless of whether the target code has been
22402 compiled for interworking or not.  There is a small overhead in the cost
22403 of executing a function pointer if this option is enabled.  This option
22404 is not valid in AAPCS configurations because interworking is enabled
22405 by default.
22407 @item -mtp=@var{name}
22408 @opindex mtp
22409 Specify the access model for the thread local storage pointer.  The valid
22410 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
22411 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
22412 (supported in the arm6k architecture), and @samp{auto}, which uses the
22413 best available method for the selected processor.  The default setting is
22414 @samp{auto}.
22416 @item -mtls-dialect=@var{dialect}
22417 @opindex mtls-dialect
22418 Specify the dialect to use for accessing thread local storage.  Two
22419 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
22420 @samp{gnu} dialect selects the original GNU scheme for supporting
22421 local and global dynamic TLS models.  The @samp{gnu2} dialect
22422 selects the GNU descriptor scheme, which provides better performance
22423 for shared libraries.  The GNU descriptor scheme is compatible with
22424 the original scheme, but does require new assembler, linker and
22425 library support.  Initial and local exec TLS models are unaffected by
22426 this option and always use the original scheme.
22428 @item -mword-relocations
22429 @opindex mword-relocations
22430 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
22431 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
22432 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
22433 is specified. This option conflicts with @option{-mslow-flash-data}.
22435 @item -mfix-cortex-m3-ldrd
22436 @opindex mfix-cortex-m3-ldrd
22437 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
22438 with overlapping destination and base registers are used.  This option avoids
22439 generating these instructions.  This option is enabled by default when
22440 @option{-mcpu=cortex-m3} is specified.
22442 @item -mfix-cortex-a57-aes-1742098
22443 @itemx -mno-fix-cortex-a57-aes-1742098
22444 @itemx -mfix-cortex-a72-aes-1655431
22445 @itemx -mno-fix-cortex-a72-aes-1655431
22446 Enable (disable) mitigation for an erratum on Cortex-A57 and
22447 Cortex-A72 that affects the AES cryptographic instructions.  This
22448 option is enabled by default when either @option{-mcpu=cortex-a57} or
22449 @option{-mcpu=cortex-a72} is specified.
22451 @item -munaligned-access
22452 @itemx -mno-unaligned-access
22453 @opindex munaligned-access
22454 @opindex mno-unaligned-access
22455 Enables (or disables) reading and writing of 16- and 32- bit values
22456 from addresses that are not 16- or 32- bit aligned.  By default
22457 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
22458 ARMv8-M Baseline architectures, and enabled for all other
22459 architectures.  If unaligned access is not enabled then words in packed
22460 data structures are accessed a byte at a time.
22462 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
22463 generated object file to either true or false, depending upon the
22464 setting of this option.  If unaligned access is enabled then the
22465 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
22466 defined.
22468 @item -mneon-for-64bits
22469 @opindex mneon-for-64bits
22470 This option is deprecated and has no effect.
22472 @item -mslow-flash-data
22473 @opindex mslow-flash-data
22474 Assume loading data from flash is slower than fetching instruction.
22475 Therefore literal load is minimized for better performance.
22476 This option is only supported when compiling for ARMv7 M-profile and
22477 off by default. It conflicts with @option{-mword-relocations}.
22479 @item -masm-syntax-unified
22480 @opindex masm-syntax-unified
22481 Assume inline assembler is using unified asm syntax.  The default is
22482 currently off which implies divided syntax.  This option has no impact
22483 on Thumb2. However, this may change in future releases of GCC.
22484 Divided syntax should be considered deprecated.
22486 @item -mrestrict-it
22487 @opindex mrestrict-it
22488 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
22489 IT blocks can only contain a single 16-bit instruction from a select
22490 set of instructions. This option is on by default for ARMv8-A Thumb mode.
22492 @item -mprint-tune-info
22493 @opindex mprint-tune-info
22494 Print CPU tuning information as comment in assembler file.  This is
22495 an option used only for regression testing of the compiler and not
22496 intended for ordinary use in compiling code.  This option is disabled
22497 by default.
22499 @item -mverbose-cost-dump
22500 @opindex mverbose-cost-dump
22501 Enable verbose cost model dumping in the debug dump files.  This option is
22502 provided for use in debugging the compiler.
22504 @item -mpure-code
22505 @opindex mpure-code
22506 Do not allow constant data to be placed in code sections.
22507 Additionally, when compiling for ELF object format give all text sections the
22508 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
22509 is only available when generating non-pic code for M-profile targets.
22511 @item -mcmse
22512 @opindex mcmse
22513 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
22514 Development Tools Engineering Specification", which can be found on
22515 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
22517 @item -mfix-cmse-cve-2021-35465
22518 @opindex mfix-cmse-cve-2021-35465
22519 Mitigate against a potential security issue with the @code{VLLDM} instruction
22520 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
22521 enabled by default when the option @option{-mcpu=} is used with
22522 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55} or @code{star-mc1}.
22523 The option @option{-mno-fix-cmse-cve-2021-35465} can be used to disable
22524 the mitigation.
22526 @item -mstack-protector-guard=@var{guard}
22527 @itemx -mstack-protector-guard-offset=@var{offset}
22528 @opindex mstack-protector-guard
22529 @opindex mstack-protector-guard-offset
22530 Generate stack protection code using canary at @var{guard}.  Supported
22531 locations are @samp{global} for a global canary or @samp{tls} for a
22532 canary accessible via the TLS register. The option
22533 @option{-mstack-protector-guard-offset=} is for use with
22534 @option{-fstack-protector-guard=tls} and not for use in user-land code.
22536 @item -mfdpic
22537 @itemx -mno-fdpic
22538 @opindex mfdpic
22539 @opindex mno-fdpic
22540 Select the FDPIC ABI, which uses 64-bit function descriptors to
22541 represent pointers to functions.  When the compiler is configured for
22542 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
22543 and implies @option{-fPIE} if none of the PIC/PIE-related options is
22544 provided.  On other targets, it only enables the FDPIC-specific code
22545 generation features, and the user should explicitly provide the
22546 PIC/PIE-related options as needed.
22548 Note that static linking is not supported because it would still
22549 involve the dynamic linker when the program self-relocates.  If such
22550 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
22552 The opposite @option{-mno-fdpic} option is useful (and required) to
22553 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
22554 toolchain as the one used to build the userland programs.
22556 @end table
22558 @node AVR Options
22559 @subsection AVR Options
22560 @cindex AVR Options
22562 These options are defined for AVR implementations:
22564 @table @gcctabopt
22565 @item -mmcu=@var{mcu}
22566 @opindex mmcu
22567 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
22569 The default for this option is@tie{}@samp{avr2}.
22571 GCC supports the following AVR devices and ISAs:
22573 @include avr-mmcu.texi
22575 @item -mabsdata
22576 @opindex mabsdata
22578 Assume that all data in static storage can be accessed by LDS / STS
22579 instructions.  This option has only an effect on reduced Tiny devices like
22580 ATtiny40.  See also the @code{absdata}
22581 @ref{AVR Variable Attributes,variable attribute}.
22583 @item -maccumulate-args
22584 @opindex maccumulate-args
22585 Accumulate outgoing function arguments and acquire/release the needed
22586 stack space for outgoing function arguments once in function
22587 prologue/epilogue.  Without this option, outgoing arguments are pushed
22588 before calling a function and popped afterwards.
22590 Popping the arguments after the function call can be expensive on
22591 AVR so that accumulating the stack space might lead to smaller
22592 executables because arguments need not be removed from the
22593 stack after such a function call.
22595 This option can lead to reduced code size for functions that perform
22596 several calls to functions that get their arguments on the stack like
22597 calls to printf-like functions.
22599 @item -mbranch-cost=@var{cost}
22600 @opindex mbranch-cost
22601 Set the branch costs for conditional branch instructions to
22602 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
22603 integers. The default branch cost is 0.
22605 @item -mcall-prologues
22606 @opindex mcall-prologues
22607 Functions prologues/epilogues are expanded as calls to appropriate
22608 subroutines.  Code size is smaller.
22610 @item -mdouble=@var{bits}
22611 @itemx -mlong-double=@var{bits}
22612 @opindex mdouble
22613 @opindex mlong-double
22614 Set the size (in bits) of the @code{double} or @code{long double} type,
22615 respectively.  Possible values for @var{bits} are 32 and 64.
22616 Whether or not a specific value for @var{bits} is allowed depends on
22617 the @code{--with-double=} and @code{--with-long-double=}
22618 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
22619 and the same applies for the default values of the options.
22621 @item -mgas-isr-prologues
22622 @opindex mgas-isr-prologues
22623 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
22624 instruction supported by GNU Binutils.
22625 If this option is on, the feature can still be disabled for individual
22626 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
22627 function attribute.  This feature is activated per default
22628 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
22629 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
22631 @item -mint8
22632 @opindex mint8
22633 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
22634 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
22635 and @code{long long} is 4 bytes.  Please note that this option does not
22636 conform to the C standards, but it results in smaller code
22637 size.
22639 @item -mmain-is-OS_task
22640 @opindex mmain-is-OS_task
22641 Do not save registers in @code{main}.  The effect is the same like
22642 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
22643 to @code{main}. It is activated per default if optimization is on.
22645 @item -mn-flash=@var{num}
22646 @opindex mn-flash
22647 Assume that the flash memory has a size of 
22648 @var{num} times 64@tie{}KiB.
22650 @item -mno-interrupts
22651 @opindex mno-interrupts
22652 Generated code is not compatible with hardware interrupts.
22653 Code size is smaller.
22655 @item -mrelax
22656 @opindex mrelax
22657 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
22658 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
22659 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
22660 the assembler's command line and the @option{--relax} option to the
22661 linker's command line.
22663 Jump relaxing is performed by the linker because jump offsets are not
22664 known before code is located. Therefore, the assembler code generated by the
22665 compiler is the same, but the instructions in the executable may
22666 differ from instructions in the assembler code.
22668 Relaxing must be turned on if linker stubs are needed, see the
22669 section on @code{EIND} and linker stubs below.
22671 @item -mrmw
22672 @opindex mrmw
22673 Assume that the device supports the Read-Modify-Write
22674 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
22676 @item -mshort-calls
22677 @opindex mshort-calls
22679 Assume that @code{RJMP} and @code{RCALL} can target the whole
22680 program memory.
22682 This option is used internally for multilib selection.  It is
22683 not an optimization option, and you don't need to set it by hand.
22685 @item -msp8
22686 @opindex msp8
22687 Treat the stack pointer register as an 8-bit register,
22688 i.e.@: assume the high byte of the stack pointer is zero.
22689 In general, you don't need to set this option by hand.
22691 This option is used internally by the compiler to select and
22692 build multilibs for architectures @code{avr2} and @code{avr25}.
22693 These architectures mix devices with and without @code{SPH}.
22694 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
22695 the compiler driver adds or removes this option from the compiler
22696 proper's command line, because the compiler then knows if the device
22697 or architecture has an 8-bit stack pointer and thus no @code{SPH}
22698 register or not.
22700 @item -mstrict-X
22701 @opindex mstrict-X
22702 Use address register @code{X} in a way proposed by the hardware.  This means
22703 that @code{X} is only used in indirect, post-increment or
22704 pre-decrement addressing.
22706 Without this option, the @code{X} register may be used in the same way
22707 as @code{Y} or @code{Z} which then is emulated by additional
22708 instructions.  
22709 For example, loading a value with @code{X+const} addressing with a
22710 small non-negative @code{const < 64} to a register @var{Rn} is
22711 performed as
22713 @example
22714 adiw r26, const   ; X += const
22715 ld   @var{Rn}, X        ; @var{Rn} = *X
22716 sbiw r26, const   ; X -= const
22717 @end example
22719 @item -mtiny-stack
22720 @opindex mtiny-stack
22721 Only change the lower 8@tie{}bits of the stack pointer.
22723 @item -mfract-convert-truncate
22724 @opindex mfract-convert-truncate
22725 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
22727 @item -nodevicelib
22728 @opindex nodevicelib
22729 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
22731 @item -nodevicespecs
22732 @opindex nodevicespecs
22733 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
22734 command line.  The user takes responsibility for supplying the sub-processes
22735 like compiler proper, assembler and linker with appropriate command line
22736 options.  This means that the user has to supply her private device specs
22737 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
22738 more need for option @option{-mmcu=@var{mcu}}.
22740 This option can also serve as a replacement for the older way of
22741 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
22742 which contains a folder named @code{device-specs} which contains a specs file named
22743 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
22745 @item -Waddr-space-convert
22746 @opindex Waddr-space-convert
22747 @opindex Wno-addr-space-convert
22748 Warn about conversions between address spaces in the case where the
22749 resulting address space is not contained in the incoming address space.
22751 @item -Wmisspelled-isr
22752 @opindex Wmisspelled-isr
22753 @opindex Wno-misspelled-isr
22754 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
22755 Enabled by default.
22756 @end table
22758 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
22759 @cindex @code{EIND}
22760 Pointers in the implementation are 16@tie{}bits wide.
22761 The address of a function or label is represented as word address so
22762 that indirect jumps and calls can target any code address in the
22763 range of 64@tie{}Ki words.
22765 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
22766 bytes of program memory space, there is a special function register called
22767 @code{EIND} that serves as most significant part of the target address
22768 when @code{EICALL} or @code{EIJMP} instructions are used.
22770 Indirect jumps and calls on these devices are handled as follows by
22771 the compiler and are subject to some limitations:
22773 @itemize @bullet
22775 @item
22776 The compiler never sets @code{EIND}.
22778 @item
22779 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
22780 instructions or might read @code{EIND} directly in order to emulate an
22781 indirect call/jump by means of a @code{RET} instruction.
22783 @item
22784 The compiler assumes that @code{EIND} never changes during the startup
22785 code or during the application. In particular, @code{EIND} is not
22786 saved/restored in function or interrupt service routine
22787 prologue/epilogue.
22789 @item
22790 For indirect calls to functions and computed goto, the linker
22791 generates @emph{stubs}. Stubs are jump pads sometimes also called
22792 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
22793 The stub contains a direct jump to the desired address.
22795 @item
22796 Linker relaxation must be turned on so that the linker generates
22797 the stubs correctly in all situations. See the compiler option
22798 @option{-mrelax} and the linker option @option{--relax}.
22799 There are corner cases where the linker is supposed to generate stubs
22800 but aborts without relaxation and without a helpful error message.
22802 @item
22803 The default linker script is arranged for code with @code{EIND = 0}.
22804 If code is supposed to work for a setup with @code{EIND != 0}, a custom
22805 linker script has to be used in order to place the sections whose
22806 name start with @code{.trampolines} into the segment where @code{EIND}
22807 points to.
22809 @item
22810 The startup code from libgcc never sets @code{EIND}.
22811 Notice that startup code is a blend of code from libgcc and AVR-LibC.
22812 For the impact of AVR-LibC on @code{EIND}, see the
22813 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
22815 @item
22816 It is legitimate for user-specific startup code to set up @code{EIND}
22817 early, for example by means of initialization code located in
22818 section @code{.init3}. Such code runs prior to general startup code
22819 that initializes RAM and calls constructors, but after the bit
22820 of startup code from AVR-LibC that sets @code{EIND} to the segment
22821 where the vector table is located.
22822 @example
22823 #include <avr/io.h>
22825 static void
22826 __attribute__((section(".init3"),naked,used,no_instrument_function))
22827 init3_set_eind (void)
22829   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
22830                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
22832 @end example
22834 @noindent
22835 The @code{__trampolines_start} symbol is defined in the linker script.
22837 @item
22838 Stubs are generated automatically by the linker if
22839 the following two conditions are met:
22840 @itemize @minus
22842 @item The address of a label is taken by means of the @code{gs} modifier
22843 (short for @emph{generate stubs}) like so:
22844 @example
22845 LDI r24, lo8(gs(@var{func}))
22846 LDI r25, hi8(gs(@var{func}))
22847 @end example
22848 @item The final location of that label is in a code segment
22849 @emph{outside} the segment where the stubs are located.
22850 @end itemize
22852 @item
22853 The compiler emits such @code{gs} modifiers for code labels in the
22854 following situations:
22855 @itemize @minus
22856 @item Taking address of a function or code label.
22857 @item Computed goto.
22858 @item If prologue-save function is used, see @option{-mcall-prologues}
22859 command-line option.
22860 @item Switch/case dispatch tables. If you do not want such dispatch
22861 tables you can specify the @option{-fno-jump-tables} command-line option.
22862 @item C and C++ constructors/destructors called during startup/shutdown.
22863 @item If the tools hit a @code{gs()} modifier explained above.
22864 @end itemize
22866 @item
22867 Jumping to non-symbolic addresses like so is @emph{not} supported:
22869 @example
22870 int main (void)
22872     /* Call function at word address 0x2 */
22873     return ((int(*)(void)) 0x2)();
22875 @end example
22877 Instead, a stub has to be set up, i.e.@: the function has to be called
22878 through a symbol (@code{func_4} in the example):
22880 @example
22881 int main (void)
22883     extern int func_4 (void);
22885     /* Call function at byte address 0x4 */
22886     return func_4();
22888 @end example
22890 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
22891 Alternatively, @code{func_4} can be defined in the linker script.
22892 @end itemize
22894 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
22895 @cindex @code{RAMPD}
22896 @cindex @code{RAMPX}
22897 @cindex @code{RAMPY}
22898 @cindex @code{RAMPZ}
22899 Some AVR devices support memories larger than the 64@tie{}KiB range
22900 that can be accessed with 16-bit pointers.  To access memory locations
22901 outside this 64@tie{}KiB range, the content of a @code{RAMP}
22902 register is used as high part of the address:
22903 The @code{X}, @code{Y}, @code{Z} address register is concatenated
22904 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
22905 register, respectively, to get a wide address. Similarly,
22906 @code{RAMPD} is used together with direct addressing.
22908 @itemize
22909 @item
22910 The startup code initializes the @code{RAMP} special function
22911 registers with zero.
22913 @item
22914 If a @ref{AVR Named Address Spaces,named address space} other than
22915 generic or @code{__flash} is used, then @code{RAMPZ} is set
22916 as needed before the operation.
22918 @item
22919 If the device supports RAM larger than 64@tie{}KiB and the compiler
22920 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
22921 is reset to zero after the operation.
22923 @item
22924 If the device comes with a specific @code{RAMP} register, the ISR
22925 prologue/epilogue saves/restores that SFR and initializes it with
22926 zero in case the ISR code might (implicitly) use it.
22928 @item
22929 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
22930 If you use inline assembler to read from locations outside the
22931 16-bit address range and change one of the @code{RAMP} registers,
22932 you must reset it to zero after the access.
22934 @end itemize
22936 @subsubsection AVR Built-in Macros
22938 GCC defines several built-in macros so that the user code can test
22939 for the presence or absence of features.  Almost any of the following
22940 built-in macros are deduced from device capabilities and thus
22941 triggered by the @option{-mmcu=} command-line option.
22943 For even more AVR-specific built-in macros see
22944 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
22946 @table @code
22948 @item __AVR_ARCH__
22949 Build-in macro that resolves to a decimal number that identifies the
22950 architecture and depends on the @option{-mmcu=@var{mcu}} option.
22951 Possible values are:
22953 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
22954 @code{4}, @code{5}, @code{51}, @code{6}
22956 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
22957 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
22959 respectively and
22961 @code{100},
22962 @code{102}, @code{103}, @code{104},
22963 @code{105}, @code{106}, @code{107}
22965 for @var{mcu}=@code{avrtiny},
22966 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
22967 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
22968 If @var{mcu} specifies a device, this built-in macro is set
22969 accordingly. For example, with @option{-mmcu=atmega8} the macro is
22970 defined to @code{4}.
22972 @item __AVR_@var{Device}__
22973 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
22974 the device's name. For example, @option{-mmcu=atmega8} defines the
22975 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
22976 @code{__AVR_ATtiny261A__}, etc.
22978 The built-in macros' names follow
22979 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
22980 the device name as from the AVR user manual. The difference between
22981 @var{Device} in the built-in macro and @var{device} in
22982 @option{-mmcu=@var{device}} is that the latter is always lowercase.
22984 If @var{device} is not a device but only a core architecture like
22985 @samp{avr51}, this macro is not defined.
22987 @item __AVR_DEVICE_NAME__
22988 Setting @option{-mmcu=@var{device}} defines this built-in macro to
22989 the device's name. For example, with @option{-mmcu=atmega8} the macro
22990 is defined to @code{atmega8}.
22992 If @var{device} is not a device but only a core architecture like
22993 @samp{avr51}, this macro is not defined.
22995 @item __AVR_XMEGA__
22996 The device / architecture belongs to the XMEGA family of devices.
22998 @item __AVR_HAVE_ELPM__
22999 The device has the @code{ELPM} instruction.
23001 @item __AVR_HAVE_ELPMX__
23002 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
23003 R@var{n},Z+} instructions.
23005 @item __AVR_HAVE_MOVW__
23006 The device has the @code{MOVW} instruction to perform 16-bit
23007 register-register moves.
23009 @item __AVR_HAVE_LPMX__
23010 The device has the @code{LPM R@var{n},Z} and
23011 @code{LPM R@var{n},Z+} instructions.
23013 @item __AVR_HAVE_MUL__
23014 The device has a hardware multiplier. 
23016 @item __AVR_HAVE_JMP_CALL__
23017 The device has the @code{JMP} and @code{CALL} instructions.
23018 This is the case for devices with more than 8@tie{}KiB of program
23019 memory.
23021 @item __AVR_HAVE_EIJMP_EICALL__
23022 @itemx __AVR_3_BYTE_PC__
23023 The device has the @code{EIJMP} and @code{EICALL} instructions.
23024 This is the case for devices with more than 128@tie{}KiB of program memory.
23025 This also means that the program counter
23026 (PC) is 3@tie{}bytes wide.
23028 @item __AVR_2_BYTE_PC__
23029 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
23030 with up to 128@tie{}KiB of program memory.
23032 @item __AVR_HAVE_8BIT_SP__
23033 @itemx __AVR_HAVE_16BIT_SP__
23034 The stack pointer (SP) register is treated as 8-bit respectively
23035 16-bit register by the compiler.
23036 The definition of these macros is affected by @option{-mtiny-stack}.
23038 @item __AVR_HAVE_SPH__
23039 @itemx __AVR_SP8__
23040 The device has the SPH (high part of stack pointer) special function
23041 register or has an 8-bit stack pointer, respectively.
23042 The definition of these macros is affected by @option{-mmcu=} and
23043 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23044 by @option{-msp8}.
23046 @item __AVR_HAVE_RAMPD__
23047 @itemx __AVR_HAVE_RAMPX__
23048 @itemx __AVR_HAVE_RAMPY__
23049 @itemx __AVR_HAVE_RAMPZ__
23050 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23051 @code{RAMPZ} special function register, respectively.
23053 @item __NO_INTERRUPTS__
23054 This macro reflects the @option{-mno-interrupts} command-line option.
23056 @item __AVR_ERRATA_SKIP__
23057 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23058 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23059 instructions because of a hardware erratum.  Skip instructions are
23060 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23061 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23062 set.
23064 @item __AVR_ISA_RMW__
23065 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23067 @item __AVR_SFR_OFFSET__=@var{offset}
23068 Instructions that can address I/O special function registers directly
23069 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23070 address as if addressed by an instruction to access RAM like @code{LD}
23071 or @code{STS}. This offset depends on the device architecture and has
23072 to be subtracted from the RAM address in order to get the
23073 respective I/O@tie{}address.
23075 @item __AVR_SHORT_CALLS__
23076 The @option{-mshort-calls} command line option is set.
23078 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23079 Some devices support reading from flash memory by means of @code{LD*}
23080 instructions.  The flash memory is seen in the data address space
23081 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
23082 is not defined, this feature is not available.  If defined,
23083 the address space is linear and there is no need to put
23084 @code{.rodata} into RAM.  This is handled by the default linker
23085 description file, and is currently available for
23086 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
23087 there is no need to use address spaces like @code{__flash} or
23088 features like attribute @code{progmem} and @code{pgm_read_*}.
23090 @item __WITH_AVRLIBC__
23091 The compiler is configured to be used together with AVR-Libc.
23092 See the @option{--with-avrlibc} configure option.
23094 @item __HAVE_DOUBLE_MULTILIB__
23095 Defined if @option{-mdouble=} acts as a multilib option.
23097 @item __HAVE_DOUBLE32__
23098 @itemx __HAVE_DOUBLE64__
23099 Defined if the compiler supports 32-bit double resp. 64-bit double.
23100 The actual layout is specified by option @option{-mdouble=}.
23102 @item __DEFAULT_DOUBLE__
23103 The size in bits of @code{double} if @option{-mdouble=} is not set.
23104 To test the layout of @code{double} in a program, use the built-in
23105 macro @code{__SIZEOF_DOUBLE__}.
23107 @item __HAVE_LONG_DOUBLE32__
23108 @itemx __HAVE_LONG_DOUBLE64__
23109 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23110 @itemx __DEFAULT_LONG_DOUBLE__
23111 Same as above, but for @code{long double} instead of @code{double}.
23113 @item __WITH_DOUBLE_COMPARISON__
23114 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23115 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23116 and is defined to @code{2} or @code{3}.
23118 @item __WITH_LIBF7_LIBGCC__
23119 @itemx __WITH_LIBF7_MATH__
23120 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23121 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23122 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23124 @end table
23126 @node Blackfin Options
23127 @subsection Blackfin Options
23128 @cindex Blackfin Options
23130 @table @gcctabopt
23131 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23132 @opindex mcpu=
23133 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
23134 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23135 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23136 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23137 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23138 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23139 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23140 @samp{bf561}, @samp{bf592}.
23142 The optional @var{sirevision} specifies the silicon revision of the target
23143 Blackfin processor.  Any workarounds available for the targeted silicon revision
23144 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
23145 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23146 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
23147 hexadecimal digits representing the major and minor numbers in the silicon
23148 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23149 is not defined.  If @var{sirevision} is @samp{any}, the
23150 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23151 If this optional @var{sirevision} is not used, GCC assumes the latest known
23152 silicon revision of the targeted Blackfin processor.
23154 GCC defines a preprocessor macro for the specified @var{cpu}.
23155 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23156 provided by libgloss to be linked in if @option{-msim} is not given.
23158 Without this option, @samp{bf532} is used as the processor by default.
23160 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
23161 only the preprocessor macro is defined.
23163 @item -msim
23164 @opindex msim
23165 Specifies that the program will be run on the simulator.  This causes
23166 the simulator BSP provided by libgloss to be linked in.  This option
23167 has effect only for @samp{bfin-elf} toolchain.
23168 Certain other options, such as @option{-mid-shared-library} and
23169 @option{-mfdpic}, imply @option{-msim}.
23171 @item -momit-leaf-frame-pointer
23172 @opindex momit-leaf-frame-pointer
23173 Don't keep the frame pointer in a register for leaf functions.  This
23174 avoids the instructions to save, set up and restore frame pointers and
23175 makes an extra register available in leaf functions.
23177 @item -mspecld-anomaly
23178 @opindex mspecld-anomaly
23179 When enabled, the compiler ensures that the generated code does not
23180 contain speculative loads after jump instructions. If this option is used,
23181 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23183 @item -mno-specld-anomaly
23184 @opindex mno-specld-anomaly
23185 @opindex mspecld-anomaly
23186 Don't generate extra code to prevent speculative loads from occurring.
23188 @item -mcsync-anomaly
23189 @opindex mcsync-anomaly
23190 When enabled, the compiler ensures that the generated code does not
23191 contain CSYNC or SSYNC instructions too soon after conditional branches.
23192 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23194 @item -mno-csync-anomaly
23195 @opindex mno-csync-anomaly
23196 @opindex mcsync-anomaly
23197 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23198 occurring too soon after a conditional branch.
23200 @item -mlow64k
23201 @opindex mlow64k
23202 When enabled, the compiler is free to take advantage of the knowledge that
23203 the entire program fits into the low 64k of memory.
23205 @item -mno-low64k
23206 @opindex mno-low64k
23207 Assume that the program is arbitrarily large.  This is the default.
23209 @item -mstack-check-l1
23210 @opindex mstack-check-l1
23211 Do stack checking using information placed into L1 scratchpad memory by the
23212 uClinux kernel.
23214 @item -mid-shared-library
23215 @opindex mid-shared-library
23216 Generate code that supports shared libraries via the library ID method.
23217 This allows for execute in place and shared libraries in an environment
23218 without virtual memory management.  This option implies @option{-fPIC}.
23219 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23221 @item -mno-id-shared-library
23222 @opindex mno-id-shared-library
23223 @opindex mid-shared-library
23224 Generate code that doesn't assume ID-based shared libraries are being used.
23225 This is the default.
23227 @item -mleaf-id-shared-library
23228 @opindex mleaf-id-shared-library
23229 Generate code that supports shared libraries via the library ID method,
23230 but assumes that this library or executable won't link against any other
23231 ID shared libraries.  That allows the compiler to use faster code for jumps
23232 and calls.
23234 @item -mno-leaf-id-shared-library
23235 @opindex mno-leaf-id-shared-library
23236 @opindex mleaf-id-shared-library
23237 Do not assume that the code being compiled won't link against any ID shared
23238 libraries.  Slower code is generated for jump and call insns.
23240 @item -mshared-library-id=n
23241 @opindex mshared-library-id
23242 Specifies the identification number of the ID-based shared library being
23243 compiled.  Specifying a value of 0 generates more compact code; specifying
23244 other values forces the allocation of that number to the current
23245 library but is no more space- or time-efficient than omitting this option.
23247 @item -msep-data
23248 @opindex msep-data
23249 Generate code that allows the data segment to be located in a different
23250 area of memory from the text segment.  This allows for execute in place in
23251 an environment without virtual memory management by eliminating relocations
23252 against the text section.
23254 @item -mno-sep-data
23255 @opindex mno-sep-data
23256 @opindex msep-data
23257 Generate code that assumes that the data segment follows the text segment.
23258 This is the default.
23260 @item -mlong-calls
23261 @itemx -mno-long-calls
23262 @opindex mlong-calls
23263 @opindex mno-long-calls
23264 Tells the compiler to perform function calls by first loading the
23265 address of the function into a register and then performing a subroutine
23266 call on this register.  This switch is needed if the target function
23267 lies outside of the 24-bit addressing range of the offset-based
23268 version of subroutine call instruction.
23270 This feature is not enabled by default.  Specifying
23271 @option{-mno-long-calls} restores the default behavior.  Note these
23272 switches have no effect on how the compiler generates code to handle
23273 function calls via function pointers.
23275 @item -mfast-fp
23276 @opindex mfast-fp
23277 Link with the fast floating-point library. This library relaxes some of
23278 the IEEE floating-point standard's rules for checking inputs against
23279 Not-a-Number (NAN), in the interest of performance.
23281 @item -minline-plt
23282 @opindex minline-plt
23283 Enable inlining of PLT entries in function calls to functions that are
23284 not known to bind locally.  It has no effect without @option{-mfdpic}.
23286 @item -mmulticore
23287 @opindex mmulticore
23288 Build a standalone application for multicore Blackfin processors. 
23289 This option causes proper start files and link scripts supporting 
23290 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
23291 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
23293 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23294 selects the one-application-per-core programming model.  Without
23295 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23296 programming model is used. In this model, the main function of Core B
23297 should be named as @code{coreb_main}.
23299 If this option is not used, the single-core application programming
23300 model is used.
23302 @item -mcorea
23303 @opindex mcorea
23304 Build a standalone application for Core A of BF561 when using
23305 the one-application-per-core programming model. Proper start files
23306 and link scripts are used to support Core A, and the macro
23307 @code{__BFIN_COREA} is defined.
23308 This option can only be used in conjunction with @option{-mmulticore}.
23310 @item -mcoreb
23311 @opindex mcoreb
23312 Build a standalone application for Core B of BF561 when using
23313 the one-application-per-core programming model. Proper start files
23314 and link scripts are used to support Core B, and the macro
23315 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23316 should be used instead of @code{main}. 
23317 This option can only be used in conjunction with @option{-mmulticore}.
23319 @item -msdram
23320 @opindex msdram
23321 Build a standalone application for SDRAM. Proper start files and
23322 link scripts are used to put the application into SDRAM, and the macro
23323 @code{__BFIN_SDRAM} is defined.
23324 The loader should initialize SDRAM before loading the application.
23326 @item -micplb
23327 @opindex micplb
23328 Assume that ICPLBs are enabled at run time.  This has an effect on certain
23329 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
23330 are enabled; for standalone applications the default is off.
23331 @end table
23333 @node C6X Options
23334 @subsection C6X Options
23335 @cindex C6X Options
23337 @table @gcctabopt
23338 @item -march=@var{name}
23339 @opindex march
23340 This specifies the name of the target architecture.  GCC uses this
23341 name to determine what kind of instructions it can emit when generating
23342 assembly code.  Permissible names are: @samp{c62x},
23343 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
23345 @item -mbig-endian
23346 @opindex mbig-endian
23347 Generate code for a big-endian target.
23349 @item -mlittle-endian
23350 @opindex mlittle-endian
23351 Generate code for a little-endian target.  This is the default.
23353 @item -msim
23354 @opindex msim
23355 Choose startup files and linker script suitable for the simulator.
23357 @item -msdata=default
23358 @opindex msdata=default
23359 Put small global and static data in the @code{.neardata} section,
23360 which is pointed to by register @code{B14}.  Put small uninitialized
23361 global and static data in the @code{.bss} section, which is adjacent
23362 to the @code{.neardata} section.  Put small read-only data into the
23363 @code{.rodata} section.  The corresponding sections used for large
23364 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
23366 @item -msdata=all
23367 @opindex msdata=all
23368 Put all data, not just small objects, into the sections reserved for
23369 small data, and use addressing relative to the @code{B14} register to
23370 access them.
23372 @item -msdata=none
23373 @opindex msdata=none
23374 Make no use of the sections reserved for small data, and use absolute
23375 addresses to access all data.  Put all initialized global and static
23376 data in the @code{.fardata} section, and all uninitialized data in the
23377 @code{.far} section.  Put all constant data into the @code{.const}
23378 section.
23379 @end table
23381 @node CRIS Options
23382 @subsection CRIS Options
23383 @cindex CRIS Options
23385 These options are defined specifically for the CRIS ports.
23387 @table @gcctabopt
23388 @item -march=@var{architecture-type}
23389 @itemx -mcpu=@var{architecture-type}
23390 @opindex march
23391 @opindex mcpu
23392 Generate code for the specified architecture.  The choices for
23393 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
23394 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
23395 Default is @samp{v0}.
23397 @item -mtune=@var{architecture-type}
23398 @opindex mtune
23399 Tune to @var{architecture-type} everything applicable about the generated
23400 code, except for the ABI and the set of available instructions.  The
23401 choices for @var{architecture-type} are the same as for
23402 @option{-march=@var{architecture-type}}.
23404 @item -mmax-stack-frame=@var{n}
23405 @opindex mmax-stack-frame
23406 Warn when the stack frame of a function exceeds @var{n} bytes.
23408 @item -metrax4
23409 @itemx -metrax100
23410 @opindex metrax4
23411 @opindex metrax100
23412 The options @option{-metrax4} and @option{-metrax100} are synonyms for
23413 @option{-march=v3} and @option{-march=v8} respectively.
23415 @item -mmul-bug-workaround
23416 @itemx -mno-mul-bug-workaround
23417 @opindex mmul-bug-workaround
23418 @opindex mno-mul-bug-workaround
23419 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
23420 models where it applies.  This option is disabled by default.
23422 @item -mpdebug
23423 @opindex mpdebug
23424 Enable CRIS-specific verbose debug-related information in the assembly
23425 code.  This option also has the effect of turning off the @samp{#NO_APP}
23426 formatted-code indicator to the assembler at the beginning of the
23427 assembly file.
23429 @item -mcc-init
23430 @opindex mcc-init
23431 Do not use condition-code results from previous instruction; always emit
23432 compare and test instructions before use of condition codes.
23434 @item -mno-side-effects
23435 @opindex mno-side-effects
23436 @opindex mside-effects
23437 Do not emit instructions with side effects in addressing modes other than
23438 post-increment.
23440 @item -mstack-align
23441 @itemx -mno-stack-align
23442 @itemx -mdata-align
23443 @itemx -mno-data-align
23444 @itemx -mconst-align
23445 @itemx -mno-const-align
23446 @opindex mstack-align
23447 @opindex mno-stack-align
23448 @opindex mdata-align
23449 @opindex mno-data-align
23450 @opindex mconst-align
23451 @opindex mno-const-align
23452 These options (@samp{no-} options) arrange (eliminate arrangements) for the
23453 stack frame, individual data and constants to be aligned for the maximum
23454 single data access size for the chosen CPU model.  The default is to
23455 arrange for 32-bit alignment.  ABI details such as structure layout are
23456 not affected by these options.
23458 @item -m32-bit
23459 @itemx -m16-bit
23460 @itemx -m8-bit
23461 @opindex m32-bit
23462 @opindex m16-bit
23463 @opindex m8-bit
23464 Similar to the stack- data- and const-align options above, these options
23465 arrange for stack frame, writable data and constants to all be 32-bit,
23466 16-bit or 8-bit aligned.  The default is 32-bit alignment.
23468 @item -mno-prologue-epilogue
23469 @itemx -mprologue-epilogue
23470 @opindex mno-prologue-epilogue
23471 @opindex mprologue-epilogue
23472 With @option{-mno-prologue-epilogue}, the normal function prologue and
23473 epilogue which set up the stack frame are omitted and no return
23474 instructions or return sequences are generated in the code.  Use this
23475 option only together with visual inspection of the compiled code: no
23476 warnings or errors are generated when call-saved registers must be saved,
23477 or storage for local variables needs to be allocated.
23479 @item -melf
23480 @opindex melf
23481 Legacy no-op option.
23483 @item -sim
23484 @opindex sim
23485 This option arranges
23486 to link with input-output functions from a simulator library.  Code,
23487 initialized data and zero-initialized data are allocated consecutively.
23489 @item -sim2
23490 @opindex sim2
23491 Like @option{-sim}, but pass linker options to locate initialized data at
23492 0x40000000 and zero-initialized data at 0x80000000.
23493 @end table
23495 @node C-SKY Options
23496 @subsection C-SKY Options
23497 @cindex C-SKY Options
23499 GCC supports these options when compiling for C-SKY V2 processors.
23501 @table @gcctabopt
23503 @item -march=@var{arch}
23504 @opindex march=
23505 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
23506 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
23507 The default is @samp{ck810}.
23509 @item -mcpu=@var{cpu}
23510 @opindex mcpu=
23511 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
23512 @samp{ck801}, @samp{ck801t},
23513 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
23514 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
23515 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
23516 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
23517 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
23518 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
23519 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
23520 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
23521 @samp{ck803eftr1}, @samp{ck803efhtr1},
23522 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
23523 @samp{ck803sef}, @samp{ck803seft},
23524 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
23525 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
23526 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
23527 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
23529 @item -mbig-endian
23530 @opindex mbig-endian
23531 @itemx -EB
23532 @opindex EB
23533 @itemx -mlittle-endian
23534 @opindex mlittle-endian
23535 @itemx -EL
23536 @opindex EL
23538 Select big- or little-endian code.  The default is little-endian.
23540 @item -mfloat-abi=@var{name}
23541 @opindex mfloat-abi
23542 Specifies which floating-point ABI to use.  Permissible values
23543 are: @samp{soft}, @samp{softfp} and @samp{hard}.
23545 Specifying @samp{soft} causes GCC to generate output containing
23546 library calls for floating-point operations.
23547 @samp{softfp} allows the generation of code using hardware floating-point
23548 instructions, but still uses the soft-float calling conventions.
23549 @samp{hard} allows generation of floating-point instructions
23550 and uses FPU-specific calling conventions.
23552 The default depends on the specific target configuration.  Note that
23553 the hard-float and soft-float ABIs are not link-compatible; you must
23554 compile your entire program with the same ABI, and link with a
23555 compatible set of libraries.
23557 @item -mhard-float
23558 @opindex mhard-float
23559 @itemx -msoft-float
23560 @opindex msoft-float
23562 Select hardware or software floating-point implementations.
23563 The default is soft float.
23565 @item -mdouble-float
23566 @itemx -mno-double-float
23567 @opindex mdouble-float
23568 When @option{-mhard-float} is in effect, enable generation of
23569 double-precision float instructions.  This is the default except
23570 when compiling for CK803.
23572 @item -mfdivdu
23573 @itemx -mno-fdivdu
23574 @opindex mfdivdu
23575 When @option{-mhard-float} is in effect, enable generation of
23576 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
23577 This is the default except when compiling for CK803.
23579 @item -mfpu=@var{fpu}
23580 @opindex mfpu=
23581 Select the floating-point processor.  This option can only be used with
23582 @option{-mhard-float}.
23583 Values for @var{fpu} are
23584 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
23585 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
23586 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
23588 @item -melrw
23589 @itemx -mno-elrw
23590 @opindex melrw
23591 Enable the extended @code{lrw} instruction.  This option defaults to on
23592 for CK801 and off otherwise.
23594 @item -mistack
23595 @itemx -mno-istack
23596 @opindex mistack
23597 Enable interrupt stack instructions; the default is off.
23599 The @option{-mistack} option is required to handle the
23600 @code{interrupt} and @code{isr} function attributes
23601 (@pxref{C-SKY Function Attributes}).
23603 @item -mmp
23604 @opindex mmp
23605 Enable multiprocessor instructions; the default is off.
23607 @item -mcp
23608 @opindex mcp
23609 Enable coprocessor instructions; the default is off.
23611 @item -mcache
23612 @opindex mcache
23613 Enable coprocessor instructions; the default is off.
23615 @item -msecurity
23616 @opindex msecurity
23617 Enable C-SKY security instructions; the default is off.
23619 @item -mtrust
23620 @opindex mtrust
23621 Enable C-SKY trust instructions; the default is off.
23623 @item -mdsp
23624 @opindex mdsp
23625 @itemx -medsp
23626 @opindex medsp
23627 @itemx -mvdsp
23628 @opindex mvdsp
23629 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
23630 All of these options default to off.
23632 @item -mdiv
23633 @itemx -mno-div
23634 @opindex mdiv
23635 Generate divide instructions.  Default is off.
23637 @item -msmart
23638 @itemx -mno-smart
23639 @opindex msmart
23640 Generate code for Smart Mode, using only registers numbered 0-7 to allow
23641 use of 16-bit instructions.  This option is ignored for CK801 where this
23642 is the required behavior, and it defaults to on for CK802.
23643 For other targets, the default is off.
23645 @item -mhigh-registers
23646 @itemx -mno-high-registers
23647 @opindex mhigh-registers
23648 Generate code using the high registers numbered 16-31.  This option
23649 is not supported on CK801, CK802, or CK803, and is enabled by default
23650 for other processors.
23652 @item -manchor
23653 @itemx -mno-anchor
23654 @opindex manchor
23655 Generate code using global anchor symbol addresses.
23657 @item -mpushpop
23658 @itemx -mno-pushpop
23659 @opindex mpushpop
23660 Generate code using @code{push} and @code{pop} instructions.  This option
23661 defaults to on.
23663 @item -mmultiple-stld
23664 @itemx -mstm
23665 @itemx -mno-multiple-stld
23666 @itemx -mno-stm
23667 @opindex mmultiple-stld
23668 Generate code using @code{stm} and @code{ldm} instructions.  This option
23669 isn't supported on CK801 but is enabled by default on other processors.
23671 @item -mconstpool
23672 @itemx -mno-constpool
23673 @opindex mconstpool
23674 Create constant pools in the compiler instead of deferring it to the
23675 assembler.  This option is the default and required for correct code
23676 generation on CK801 and CK802, and is optional on other processors.
23678 @item -mstack-size
23679 @item -mno-stack-size
23680 @opindex mstack-size
23681 Emit @code{.stack_size} directives for each function in the assembly
23682 output.  This option defaults to off.
23684 @item -mccrt
23685 @itemx -mno-ccrt
23686 @opindex mccrt
23687 Generate code for the C-SKY compiler runtime instead of libgcc.  This
23688 option defaults to off.
23690 @item -mbranch-cost=@var{n}
23691 @opindex mbranch-cost=
23692 Set the branch costs to roughly @code{n} instructions.  The default is 1.
23694 @item -msched-prolog
23695 @itemx -mno-sched-prolog
23696 @opindex msched-prolog
23697 Permit scheduling of function prologue and epilogue sequences.  Using
23698 this option can result in code that is not compliant with the C-SKY V2 ABI
23699 prologue requirements and that cannot be debugged or backtraced.
23700 It is disabled by default.
23702 @item -msim
23703 @opindex msim
23704 Links the library libsemi.a which is in compatible with simulator. Applicable
23705 to ELF compiler only.
23707 @end table
23709 @node Darwin Options
23710 @subsection Darwin Options
23711 @cindex Darwin options
23713 These options are defined for all architectures running the Darwin operating
23714 system.
23716 FSF GCC on Darwin does not create ``fat'' object files; it creates
23717 an object file for the single architecture that GCC was built to
23718 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
23719 @option{-arch} options are used; it does so by running the compiler or
23720 linker multiple times and joining the results together with
23721 @file{lipo}.
23723 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
23724 @samp{i686}) is determined by the flags that specify the ISA
23725 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
23726 @option{-force_cpusubtype_ALL} option can be used to override this.
23728 The Darwin tools vary in their behavior when presented with an ISA
23729 mismatch.  The assembler, @file{as}, only permits instructions to
23730 be used that are valid for the subtype of the file it is generating,
23731 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
23732 The linker for shared libraries, @file{/usr/bin/libtool}, fails
23733 and prints an error if asked to create a shared library with a less
23734 restrictive subtype than its input files (for instance, trying to put
23735 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
23736 for executables, @command{ld}, quietly gives the executable the most
23737 restrictive subtype of any of its input files.
23739 @table @gcctabopt
23740 @item -F@var{dir}
23741 @opindex F
23742 Add the framework directory @var{dir} to the head of the list of
23743 directories to be searched for header files.  These directories are
23744 interleaved with those specified by @option{-I} options and are
23745 scanned in a left-to-right order.
23747 A framework directory is a directory with frameworks in it.  A
23748 framework is a directory with a @file{Headers} and/or
23749 @file{PrivateHeaders} directory contained directly in it that ends
23750 in @file{.framework}.  The name of a framework is the name of this
23751 directory excluding the @file{.framework}.  Headers associated with
23752 the framework are found in one of those two directories, with
23753 @file{Headers} being searched first.  A subframework is a framework
23754 directory that is in a framework's @file{Frameworks} directory.
23755 Includes of subframework headers can only appear in a header of a
23756 framework that contains the subframework, or in a sibling subframework
23757 header.  Two subframeworks are siblings if they occur in the same
23758 framework.  A subframework should not have the same name as a
23759 framework; a warning is issued if this is violated.  Currently a
23760 subframework cannot have subframeworks; in the future, the mechanism
23761 may be extended to support this.  The standard frameworks can be found
23762 in @file{/System/Library/Frameworks} and
23763 @file{/Library/Frameworks}.  An example include looks like
23764 @code{#include <Framework/header.h>}, where @file{Framework} denotes
23765 the name of the framework and @file{header.h} is found in the
23766 @file{PrivateHeaders} or @file{Headers} directory.
23768 @item -iframework@var{dir}
23769 @opindex iframework
23770 Like @option{-F} except the directory is a treated as a system
23771 directory.  The main difference between this @option{-iframework} and
23772 @option{-F} is that with @option{-iframework} the compiler does not
23773 warn about constructs contained within header files found via
23774 @var{dir}.  This option is valid only for the C family of languages.
23776 @item -gused
23777 @opindex gused
23778 Emit debugging information for symbols that are used.  For stabs
23779 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
23780 This is by default ON@.
23782 @item -gfull
23783 @opindex gfull
23784 Emit debugging information for all symbols and types.
23786 @item -mmacosx-version-min=@var{version}
23787 The earliest version of MacOS X that this executable will run on
23788 is @var{version}.  Typical values of @var{version} include @code{10.1},
23789 @code{10.2}, and @code{10.3.9}.
23791 If the compiler was built to use the system's headers by default,
23792 then the default for this option is the system version on which the
23793 compiler is running, otherwise the default is to make choices that
23794 are compatible with as many systems and code bases as possible.
23796 @item -mkernel
23797 @opindex mkernel
23798 Enable kernel development mode.  The @option{-mkernel} option sets
23799 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
23800 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
23801 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
23802 applicable.  This mode also sets @option{-mno-altivec},
23803 @option{-msoft-float}, @option{-fno-builtin} and
23804 @option{-mlong-branch} for PowerPC targets.
23806 @item -mone-byte-bool
23807 @opindex mone-byte-bool
23808 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
23809 By default @code{sizeof(bool)} is @code{4} when compiling for
23810 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
23811 option has no effect on x86.
23813 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
23814 to generate code that is not binary compatible with code generated
23815 without that switch.  Using this switch may require recompiling all
23816 other modules in a program, including system libraries.  Use this
23817 switch to conform to a non-default data model.
23819 @item -mfix-and-continue
23820 @itemx -ffix-and-continue
23821 @itemx -findirect-data
23822 @opindex mfix-and-continue
23823 @opindex ffix-and-continue
23824 @opindex findirect-data
23825 Generate code suitable for fast turnaround development, such as to
23826 allow GDB to dynamically load @file{.o} files into already-running
23827 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
23828 are provided for backwards compatibility.
23830 @item -all_load
23831 @opindex all_load
23832 Loads all members of static archive libraries.
23833 See man ld(1) for more information.
23835 @item -arch_errors_fatal
23836 @opindex arch_errors_fatal
23837 Cause the errors having to do with files that have the wrong architecture
23838 to be fatal.
23840 @item -bind_at_load
23841 @opindex bind_at_load
23842 Causes the output file to be marked such that the dynamic linker will
23843 bind all undefined references when the file is loaded or launched.
23845 @item -bundle
23846 @opindex bundle
23847 Produce a Mach-o bundle format file.
23848 See man ld(1) for more information.
23850 @item -bundle_loader @var{executable}
23851 @opindex bundle_loader
23852 This option specifies the @var{executable} that will load the build
23853 output file being linked.  See man ld(1) for more information.
23855 @item -dynamiclib
23856 @opindex dynamiclib
23857 When passed this option, GCC produces a dynamic library instead of
23858 an executable when linking, using the Darwin @file{libtool} command.
23860 @item -force_cpusubtype_ALL
23861 @opindex force_cpusubtype_ALL
23862 This causes GCC's output file to have the @samp{ALL} subtype, instead of
23863 one controlled by the @option{-mcpu} or @option{-march} option.
23865 @item -allowable_client  @var{client_name}
23866 @itemx -client_name
23867 @itemx -compatibility_version
23868 @itemx -current_version
23869 @itemx -dead_strip
23870 @itemx -dependency-file
23871 @itemx -dylib_file
23872 @itemx -dylinker_install_name
23873 @itemx -dynamic
23874 @itemx -exported_symbols_list
23875 @itemx -filelist
23876 @need 800
23877 @itemx -flat_namespace
23878 @itemx -force_flat_namespace
23879 @itemx -headerpad_max_install_names
23880 @itemx -image_base
23881 @itemx -init
23882 @itemx -install_name
23883 @itemx -keep_private_externs
23884 @itemx -multi_module
23885 @itemx -multiply_defined
23886 @itemx -multiply_defined_unused
23887 @need 800
23888 @itemx -noall_load
23889 @itemx -no_dead_strip_inits_and_terms
23890 @itemx -nofixprebinding
23891 @itemx -nomultidefs
23892 @itemx -noprebind
23893 @itemx -noseglinkedit
23894 @itemx -pagezero_size
23895 @itemx -prebind
23896 @itemx -prebind_all_twolevel_modules
23897 @itemx -private_bundle
23898 @need 800
23899 @itemx -read_only_relocs
23900 @itemx -sectalign
23901 @itemx -sectobjectsymbols
23902 @itemx -whyload
23903 @itemx -seg1addr
23904 @itemx -sectcreate
23905 @itemx -sectobjectsymbols
23906 @itemx -sectorder
23907 @itemx -segaddr
23908 @itemx -segs_read_only_addr
23909 @need 800
23910 @itemx -segs_read_write_addr
23911 @itemx -seg_addr_table
23912 @itemx -seg_addr_table_filename
23913 @itemx -seglinkedit
23914 @itemx -segprot
23915 @itemx -segs_read_only_addr
23916 @itemx -segs_read_write_addr
23917 @itemx -single_module
23918 @itemx -static
23919 @itemx -sub_library
23920 @need 800
23921 @itemx -sub_umbrella
23922 @itemx -twolevel_namespace
23923 @itemx -umbrella
23924 @itemx -undefined
23925 @itemx -unexported_symbols_list
23926 @itemx -weak_reference_mismatches
23927 @itemx -whatsloaded
23928 @opindex allowable_client
23929 @opindex client_name
23930 @opindex compatibility_version
23931 @opindex current_version
23932 @opindex dead_strip
23933 @opindex dependency-file
23934 @opindex dylib_file
23935 @opindex dylinker_install_name
23936 @opindex dynamic
23937 @opindex exported_symbols_list
23938 @opindex filelist
23939 @opindex flat_namespace
23940 @opindex force_flat_namespace
23941 @opindex headerpad_max_install_names
23942 @opindex image_base
23943 @opindex init
23944 @opindex install_name
23945 @opindex keep_private_externs
23946 @opindex multi_module
23947 @opindex multiply_defined
23948 @opindex multiply_defined_unused
23949 @opindex noall_load
23950 @opindex no_dead_strip_inits_and_terms
23951 @opindex nofixprebinding
23952 @opindex nomultidefs
23953 @opindex noprebind
23954 @opindex noseglinkedit
23955 @opindex pagezero_size
23956 @opindex prebind
23957 @opindex prebind_all_twolevel_modules
23958 @opindex private_bundle
23959 @opindex read_only_relocs
23960 @opindex sectalign
23961 @opindex sectobjectsymbols
23962 @opindex whyload
23963 @opindex seg1addr
23964 @opindex sectcreate
23965 @opindex sectobjectsymbols
23966 @opindex sectorder
23967 @opindex segaddr
23968 @opindex segs_read_only_addr
23969 @opindex segs_read_write_addr
23970 @opindex seg_addr_table
23971 @opindex seg_addr_table_filename
23972 @opindex seglinkedit
23973 @opindex segprot
23974 @opindex segs_read_only_addr
23975 @opindex segs_read_write_addr
23976 @opindex single_module
23977 @opindex static
23978 @opindex sub_library
23979 @opindex sub_umbrella
23980 @opindex twolevel_namespace
23981 @opindex umbrella
23982 @opindex undefined
23983 @opindex unexported_symbols_list
23984 @opindex weak_reference_mismatches
23985 @opindex whatsloaded
23986 These options are passed to the Darwin linker.  The Darwin linker man page
23987 describes them in detail.
23988 @end table
23990 @node DEC Alpha Options
23991 @subsection DEC Alpha Options
23993 These @samp{-m} options are defined for the DEC Alpha implementations:
23995 @table @gcctabopt
23996 @item -mno-soft-float
23997 @itemx -msoft-float
23998 @opindex mno-soft-float
23999 @opindex msoft-float
24000 Use (do not use) the hardware floating-point instructions for
24001 floating-point operations.  When @option{-msoft-float} is specified,
24002 functions in @file{libgcc.a} are used to perform floating-point
24003 operations.  Unless they are replaced by routines that emulate the
24004 floating-point operations, or compiled in such a way as to call such
24005 emulations routines, these routines issue floating-point
24006 operations.   If you are compiling for an Alpha without floating-point
24007 operations, you must ensure that the library is built so as not to call
24008 them.
24010 Note that Alpha implementations without floating-point operations are
24011 required to have floating-point registers.
24013 @item -mfp-reg
24014 @itemx -mno-fp-regs
24015 @opindex mfp-reg
24016 @opindex mno-fp-regs
24017 Generate code that uses (does not use) the floating-point register set.
24018 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
24019 register set is not used, floating-point operands are passed in integer
24020 registers as if they were integers and floating-point results are passed
24021 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
24022 so any function with a floating-point argument or return value called by code
24023 compiled with @option{-mno-fp-regs} must also be compiled with that
24024 option.
24026 A typical use of this option is building a kernel that does not use,
24027 and hence need not save and restore, any floating-point registers.
24029 @item -mieee
24030 @opindex mieee
24031 The Alpha architecture implements floating-point hardware optimized for
24032 maximum performance.  It is mostly compliant with the IEEE floating-point
24033 standard.  However, for full compliance, software assistance is
24034 required.  This option generates code fully IEEE-compliant code
24035 @emph{except} that the @var{inexact-flag} is not maintained (see below).
24036 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
24037 defined during compilation.  The resulting code is less efficient but is
24038 able to correctly support denormalized numbers and exceptional IEEE
24039 values such as not-a-number and plus/minus infinity.  Other Alpha
24040 compilers call this option @option{-ieee_with_no_inexact}.
24042 @item -mieee-with-inexact
24043 @opindex mieee-with-inexact
24044 This is like @option{-mieee} except the generated code also maintains
24045 the IEEE @var{inexact-flag}.  Turning on this option causes the
24046 generated code to implement fully-compliant IEEE math.  In addition to
24047 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24048 macro.  On some Alpha implementations the resulting code may execute
24049 significantly slower than the code generated by default.  Since there is
24050 very little code that depends on the @var{inexact-flag}, you should
24051 normally not specify this option.  Other Alpha compilers call this
24052 option @option{-ieee_with_inexact}.
24054 @item -mfp-trap-mode=@var{trap-mode}
24055 @opindex mfp-trap-mode
24056 This option controls what floating-point related traps are enabled.
24057 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24058 The trap mode can be set to one of four values:
24060 @table @samp
24061 @item n
24062 This is the default (normal) setting.  The only traps that are enabled
24063 are the ones that cannot be disabled in software (e.g., division by zero
24064 trap).
24066 @item u
24067 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24068 as well.
24070 @item su
24071 Like @samp{u}, but the instructions are marked to be safe for software
24072 completion (see Alpha architecture manual for details).
24074 @item sui
24075 Like @samp{su}, but inexact traps are enabled as well.
24076 @end table
24078 @item -mfp-rounding-mode=@var{rounding-mode}
24079 @opindex mfp-rounding-mode
24080 Selects the IEEE rounding mode.  Other Alpha compilers call this option
24081 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
24084 @table @samp
24085 @item n
24086 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
24087 the nearest machine number or towards the even machine number in case
24088 of a tie.
24090 @item m
24091 Round towards minus infinity.
24093 @item c
24094 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
24096 @item d
24097 Dynamic rounding mode.  A field in the floating-point control register
24098 (@var{fpcr}, see Alpha architecture reference manual) controls the
24099 rounding mode in effect.  The C library initializes this register for
24100 rounding towards plus infinity.  Thus, unless your program modifies the
24101 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24102 @end table
24104 @item -mtrap-precision=@var{trap-precision}
24105 @opindex mtrap-precision
24106 In the Alpha architecture, floating-point traps are imprecise.  This
24107 means without software assistance it is impossible to recover from a
24108 floating trap and program execution normally needs to be terminated.
24109 GCC can generate code that can assist operating system trap handlers
24110 in determining the exact location that caused a floating-point trap.
24111 Depending on the requirements of an application, different levels of
24112 precisions can be selected:
24114 @table @samp
24115 @item p
24116 Program precision.  This option is the default and means a trap handler
24117 can only identify which program caused a floating-point exception.
24119 @item f
24120 Function precision.  The trap handler can determine the function that
24121 caused a floating-point exception.
24123 @item i
24124 Instruction precision.  The trap handler can determine the exact
24125 instruction that caused a floating-point exception.
24126 @end table
24128 Other Alpha compilers provide the equivalent options called
24129 @option{-scope_safe} and @option{-resumption_safe}.
24131 @item -mieee-conformant
24132 @opindex mieee-conformant
24133 This option marks the generated code as IEEE conformant.  You must not
24134 use this option unless you also specify @option{-mtrap-precision=i} and either
24135 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
24136 is to emit the line @samp{.eflag 48} in the function prologue of the
24137 generated assembly file.
24139 @item -mbuild-constants
24140 @opindex mbuild-constants
24141 Normally GCC examines a 32- or 64-bit integer constant to
24142 see if it can construct it from smaller constants in two or three
24143 instructions.  If it cannot, it outputs the constant as a literal and
24144 generates code to load it from the data segment at run time.
24146 Use this option to require GCC to construct @emph{all} integer constants
24147 using code, even if it takes more instructions (the maximum is six).
24149 You typically use this option to build a shared library dynamic
24150 loader.  Itself a shared library, it must relocate itself in memory
24151 before it can find the variables and constants in its own data segment.
24153 @item -mbwx
24154 @itemx -mno-bwx
24155 @itemx -mcix
24156 @itemx -mno-cix
24157 @itemx -mfix
24158 @itemx -mno-fix
24159 @itemx -mmax
24160 @itemx -mno-max
24161 @opindex mbwx
24162 @opindex mno-bwx
24163 @opindex mcix
24164 @opindex mno-cix
24165 @opindex mfix
24166 @opindex mno-fix
24167 @opindex mmax
24168 @opindex mno-max
24169 Indicate whether GCC should generate code to use the optional BWX,
24170 CIX, FIX and MAX instruction sets.  The default is to use the instruction
24171 sets supported by the CPU type specified via @option{-mcpu=} option or that
24172 of the CPU on which GCC was built if none is specified.
24174 @item -mfloat-vax
24175 @itemx -mfloat-ieee
24176 @opindex mfloat-vax
24177 @opindex mfloat-ieee
24178 Generate code that uses (does not use) VAX F and G floating-point
24179 arithmetic instead of IEEE single and double precision.
24181 @item -mexplicit-relocs
24182 @itemx -mno-explicit-relocs
24183 @opindex mexplicit-relocs
24184 @opindex mno-explicit-relocs
24185 Older Alpha assemblers provided no way to generate symbol relocations
24186 except via assembler macros.  Use of these macros does not allow
24187 optimal instruction scheduling.  GNU binutils as of version 2.12
24188 supports a new syntax that allows the compiler to explicitly mark
24189 which relocations should apply to which instructions.  This option
24190 is mostly useful for debugging, as GCC detects the capabilities of
24191 the assembler when it is built and sets the default accordingly.
24193 @item -msmall-data
24194 @itemx -mlarge-data
24195 @opindex msmall-data
24196 @opindex mlarge-data
24197 When @option{-mexplicit-relocs} is in effect, static data is
24198 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
24199 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24200 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24201 16-bit relocations off of the @code{$gp} register.  This limits the
24202 size of the small data area to 64KB, but allows the variables to be
24203 directly accessed via a single instruction.
24205 The default is @option{-mlarge-data}.  With this option the data area
24206 is limited to just below 2GB@.  Programs that require more than 2GB of
24207 data must use @code{malloc} or @code{mmap} to allocate the data in the
24208 heap instead of in the program's data segment.
24210 When generating code for shared libraries, @option{-fpic} implies
24211 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24213 @item -msmall-text
24214 @itemx -mlarge-text
24215 @opindex msmall-text
24216 @opindex mlarge-text
24217 When @option{-msmall-text} is used, the compiler assumes that the
24218 code of the entire program (or shared library) fits in 4MB, and is
24219 thus reachable with a branch instruction.  When @option{-msmall-data}
24220 is used, the compiler can assume that all local symbols share the
24221 same @code{$gp} value, and thus reduce the number of instructions
24222 required for a function call from 4 to 1.
24224 The default is @option{-mlarge-text}.
24226 @item -mcpu=@var{cpu_type}
24227 @opindex mcpu
24228 Set the instruction set and instruction scheduling parameters for
24229 machine type @var{cpu_type}.  You can specify either the @samp{EV}
24230 style name or the corresponding chip number.  GCC supports scheduling
24231 parameters for the EV4, EV5 and EV6 family of processors and
24232 chooses the default values for the instruction set from the processor
24233 you specify.  If you do not specify a processor type, GCC defaults
24234 to the processor on which the compiler was built.
24236 Supported values for @var{cpu_type} are
24238 @table @samp
24239 @item ev4
24240 @itemx ev45
24241 @itemx 21064
24242 Schedules as an EV4 and has no instruction set extensions.
24244 @item ev5
24245 @itemx 21164
24246 Schedules as an EV5 and has no instruction set extensions.
24248 @item ev56
24249 @itemx 21164a
24250 Schedules as an EV5 and supports the BWX extension.
24252 @item pca56
24253 @itemx 21164pc
24254 @itemx 21164PC
24255 Schedules as an EV5 and supports the BWX and MAX extensions.
24257 @item ev6
24258 @itemx 21264
24259 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24261 @item ev67
24262 @itemx 21264a
24263 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24264 @end table
24266 Native toolchains also support the value @samp{native},
24267 which selects the best architecture option for the host processor.
24268 @option{-mcpu=native} has no effect if GCC does not recognize
24269 the processor.
24271 @item -mtune=@var{cpu_type}
24272 @opindex mtune
24273 Set only the instruction scheduling parameters for machine type
24274 @var{cpu_type}.  The instruction set is not changed.
24276 Native toolchains also support the value @samp{native},
24277 which selects the best architecture option for the host processor.
24278 @option{-mtune=native} has no effect if GCC does not recognize
24279 the processor.
24281 @item -mmemory-latency=@var{time}
24282 @opindex mmemory-latency
24283 Sets the latency the scheduler should assume for typical memory
24284 references as seen by the application.  This number is highly
24285 dependent on the memory access patterns used by the application
24286 and the size of the external cache on the machine.
24288 Valid options for @var{time} are
24290 @table @samp
24291 @item @var{number}
24292 A decimal number representing clock cycles.
24294 @item L1
24295 @itemx L2
24296 @itemx L3
24297 @itemx main
24298 The compiler contains estimates of the number of clock cycles for
24299 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
24300 (also called Dcache, Scache, and Bcache), as well as to main memory.
24301 Note that L3 is only valid for EV5.
24303 @end table
24304 @end table
24306 @node eBPF Options
24307 @subsection eBPF Options
24308 @cindex eBPF Options
24310 @table @gcctabopt
24311 @item -mframe-limit=@var{bytes}
24312 This specifies the hard limit for frame sizes, in bytes.  Currently,
24313 the value that can be specified should be less than or equal to
24314 @samp{32767}.  Defaults to whatever limit is imposed by the version of
24315 the Linux kernel targeted.
24317 @item -mkernel=@var{version}
24318 @opindex mkernel
24319 This specifies the minimum version of the kernel that will run the
24320 compiled program.  GCC uses this version to determine which
24321 instructions to use, what kernel helpers to allow, etc.  Currently,
24322 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
24323 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
24324 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
24325 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
24326 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
24327 @samp{5.2}, @samp{latest} and @samp{native}.
24329 @item -mbig-endian
24330 @opindex mbig-endian
24331 Generate code for a big-endian target.
24333 @item -mlittle-endian
24334 @opindex mlittle-endian
24335 Generate code for a little-endian target.  This is the default.
24337 @item -mjmpext
24338 @opindex mjmpext
24339 Enable generation of extra conditional-branch instructions.
24340 Enabled for CPU v2 and above.
24342 @item -mjmp32
24343 @opindex mjmp32
24344 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
24346 @item -malu32
24347 @opindex malu32
24348 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
24350 @item -mcpu=@var{version}
24351 @opindex mcpu
24352 This specifies which version of the eBPF ISA to target. Newer versions
24353 may not be supported by all kernels. The default is @samp{v3}.
24355 Supported values for @var{version} are:
24357 @table @samp
24358 @item v1
24359 The first stable eBPF ISA with no special features or extensions.
24361 @item v2
24362 Supports the jump extensions, as in @option{-mjmpext}.
24364 @item v3
24365 All features of v2, plus:
24366 @itemize @minus
24367 @item 32-bit jump operations, as in @option{-mjmp32}
24368 @item 32-bit ALU operations, as in @option{-malu32}
24369 @end itemize
24371 @end table
24373 @item -mco-re
24374 @opindex mco-re
24375 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
24376 is implied by @option{-gbtf}.
24378 @item -mno-co-re
24379 @opindex mno-co-re
24380 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
24381 support is enabled by default when generating BTF debug information for
24382 the BPF target.
24384 @item -mxbpf
24385 Generate code for an expanded version of BPF, which relaxes some of
24386 the restrictions imposed by the BPF architecture:
24387 @itemize @minus
24388 @item Save and restore callee-saved registers at function entry and
24389 exit, respectively.
24390 @end itemize
24391 @end table
24393 @node FR30 Options
24394 @subsection FR30 Options
24395 @cindex FR30 Options
24397 These options are defined specifically for the FR30 port.
24399 @table @gcctabopt
24401 @item -msmall-model
24402 @opindex msmall-model
24403 Use the small address space model.  This can produce smaller code, but
24404 it does assume that all symbolic values and addresses fit into a
24405 20-bit range.
24407 @item -mno-lsim
24408 @opindex mno-lsim
24409 Assume that runtime support has been provided and so there is no need
24410 to include the simulator library (@file{libsim.a}) on the linker
24411 command line.
24413 @end table
24415 @node FT32 Options
24416 @subsection FT32 Options
24417 @cindex FT32 Options
24419 These options are defined specifically for the FT32 port.
24421 @table @gcctabopt
24423 @item -msim
24424 @opindex msim
24425 Specifies that the program will be run on the simulator.  This causes
24426 an alternate runtime startup and library to be linked.
24427 You must not use this option when generating programs that will run on
24428 real hardware; you must provide your own runtime library for whatever
24429 I/O functions are needed.
24431 @item -mlra
24432 @opindex mlra
24433 Enable Local Register Allocation.  This is still experimental for FT32,
24434 so by default the compiler uses standard reload.
24436 @item -mnodiv
24437 @opindex mnodiv
24438 Do not use div and mod instructions.
24440 @item -mft32b
24441 @opindex mft32b
24442 Enable use of the extended instructions of the FT32B processor.
24444 @item -mcompress
24445 @opindex mcompress
24446 Compress all code using the Ft32B code compression scheme.
24448 @item -mnopm
24449 @opindex  mnopm
24450 Do not generate code that reads program memory.
24452 @end table
24454 @node FRV Options
24455 @subsection FRV Options
24456 @cindex FRV Options
24458 @table @gcctabopt
24459 @item -mgpr-32
24460 @opindex mgpr-32
24462 Only use the first 32 general-purpose registers.
24464 @item -mgpr-64
24465 @opindex mgpr-64
24467 Use all 64 general-purpose registers.
24469 @item -mfpr-32
24470 @opindex mfpr-32
24472 Use only the first 32 floating-point registers.
24474 @item -mfpr-64
24475 @opindex mfpr-64
24477 Use all 64 floating-point registers.
24479 @item -mhard-float
24480 @opindex mhard-float
24482 Use hardware instructions for floating-point operations.
24484 @item -msoft-float
24485 @opindex msoft-float
24487 Use library routines for floating-point operations.
24489 @item -malloc-cc
24490 @opindex malloc-cc
24492 Dynamically allocate condition code registers.
24494 @item -mfixed-cc
24495 @opindex mfixed-cc
24497 Do not try to dynamically allocate condition code registers, only
24498 use @code{icc0} and @code{fcc0}.
24500 @item -mdword
24501 @opindex mdword
24503 Change ABI to use double word insns.
24505 @item -mno-dword
24506 @opindex mno-dword
24507 @opindex mdword
24509 Do not use double word instructions.
24511 @item -mdouble
24512 @opindex mdouble
24514 Use floating-point double instructions.
24516 @item -mno-double
24517 @opindex mno-double
24519 Do not use floating-point double instructions.
24521 @item -mmedia
24522 @opindex mmedia
24524 Use media instructions.
24526 @item -mno-media
24527 @opindex mno-media
24529 Do not use media instructions.
24531 @item -mmuladd
24532 @opindex mmuladd
24534 Use multiply and add/subtract instructions.
24536 @item -mno-muladd
24537 @opindex mno-muladd
24539 Do not use multiply and add/subtract instructions.
24541 @item -mfdpic
24542 @opindex mfdpic
24544 Select the FDPIC ABI, which uses function descriptors to represent
24545 pointers to functions.  Without any PIC/PIE-related options, it
24546 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
24547 assumes GOT entries and small data are within a 12-bit range from the
24548 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
24549 are computed with 32 bits.
24550 With a @samp{bfin-elf} target, this option implies @option{-msim}.
24552 @item -minline-plt
24553 @opindex minline-plt
24555 Enable inlining of PLT entries in function calls to functions that are
24556 not known to bind locally.  It has no effect without @option{-mfdpic}.
24557 It's enabled by default if optimizing for speed and compiling for
24558 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
24559 optimization option such as @option{-O3} or above is present in the
24560 command line.
24562 @item -mTLS
24563 @opindex mTLS
24565 Assume a large TLS segment when generating thread-local code.
24567 @item -mtls
24568 @opindex mtls
24570 Do not assume a large TLS segment when generating thread-local code.
24572 @item -mgprel-ro
24573 @opindex mgprel-ro
24575 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
24576 that is known to be in read-only sections.  It's enabled by default,
24577 except for @option{-fpic} or @option{-fpie}: even though it may help
24578 make the global offset table smaller, it trades 1 instruction for 4.
24579 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
24580 one of which may be shared by multiple symbols, and it avoids the need
24581 for a GOT entry for the referenced symbol, so it's more likely to be a
24582 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
24584 @item -multilib-library-pic
24585 @opindex multilib-library-pic
24587 Link with the (library, not FD) pic libraries.  It's implied by
24588 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
24589 @option{-fpic} without @option{-mfdpic}.  You should never have to use
24590 it explicitly.
24592 @item -mlinked-fp
24593 @opindex mlinked-fp
24595 Follow the EABI requirement of always creating a frame pointer whenever
24596 a stack frame is allocated.  This option is enabled by default and can
24597 be disabled with @option{-mno-linked-fp}.
24599 @item -mlong-calls
24600 @opindex mlong-calls
24602 Use indirect addressing to call functions outside the current
24603 compilation unit.  This allows the functions to be placed anywhere
24604 within the 32-bit address space.
24606 @item -malign-labels
24607 @opindex malign-labels
24609 Try to align labels to an 8-byte boundary by inserting NOPs into the
24610 previous packet.  This option only has an effect when VLIW packing
24611 is enabled.  It doesn't create new packets; it merely adds NOPs to
24612 existing ones.
24614 @item -mlibrary-pic
24615 @opindex mlibrary-pic
24617 Generate position-independent EABI code.
24619 @item -macc-4
24620 @opindex macc-4
24622 Use only the first four media accumulator registers.
24624 @item -macc-8
24625 @opindex macc-8
24627 Use all eight media accumulator registers.
24629 @item -mpack
24630 @opindex mpack
24632 Pack VLIW instructions.
24634 @item -mno-pack
24635 @opindex mno-pack
24637 Do not pack VLIW instructions.
24639 @item -mno-eflags
24640 @opindex mno-eflags
24642 Do not mark ABI switches in e_flags.
24644 @item -mcond-move
24645 @opindex mcond-move
24647 Enable the use of conditional-move instructions (default).
24649 This switch is mainly for debugging the compiler and will likely be removed
24650 in a future version.
24652 @item -mno-cond-move
24653 @opindex mno-cond-move
24655 Disable the use of conditional-move instructions.
24657 This switch is mainly for debugging the compiler and will likely be removed
24658 in a future version.
24660 @item -mscc
24661 @opindex mscc
24663 Enable the use of conditional set instructions (default).
24665 This switch is mainly for debugging the compiler and will likely be removed
24666 in a future version.
24668 @item -mno-scc
24669 @opindex mno-scc
24671 Disable the use of conditional set instructions.
24673 This switch is mainly for debugging the compiler and will likely be removed
24674 in a future version.
24676 @item -mcond-exec
24677 @opindex mcond-exec
24679 Enable the use of conditional execution (default).
24681 This switch is mainly for debugging the compiler and will likely be removed
24682 in a future version.
24684 @item -mno-cond-exec
24685 @opindex mno-cond-exec
24687 Disable the use of conditional execution.
24689 This switch is mainly for debugging the compiler and will likely be removed
24690 in a future version.
24692 @item -mvliw-branch
24693 @opindex mvliw-branch
24695 Run a pass to pack branches into VLIW instructions (default).
24697 This switch is mainly for debugging the compiler and will likely be removed
24698 in a future version.
24700 @item -mno-vliw-branch
24701 @opindex mno-vliw-branch
24703 Do not run a pass to pack branches into VLIW instructions.
24705 This switch is mainly for debugging the compiler and will likely be removed
24706 in a future version.
24708 @item -mmulti-cond-exec
24709 @opindex mmulti-cond-exec
24711 Enable optimization of @code{&&} and @code{||} in conditional execution
24712 (default).
24714 This switch is mainly for debugging the compiler and will likely be removed
24715 in a future version.
24717 @item -mno-multi-cond-exec
24718 @opindex mno-multi-cond-exec
24720 Disable optimization of @code{&&} and @code{||} in conditional execution.
24722 This switch is mainly for debugging the compiler and will likely be removed
24723 in a future version.
24725 @item -mnested-cond-exec
24726 @opindex mnested-cond-exec
24728 Enable nested conditional execution optimizations (default).
24730 This switch is mainly for debugging the compiler and will likely be removed
24731 in a future version.
24733 @item -mno-nested-cond-exec
24734 @opindex mno-nested-cond-exec
24736 Disable nested conditional execution optimizations.
24738 This switch is mainly for debugging the compiler and will likely be removed
24739 in a future version.
24741 @item -moptimize-membar
24742 @opindex moptimize-membar
24744 This switch removes redundant @code{membar} instructions from the
24745 compiler-generated code.  It is enabled by default.
24747 @item -mno-optimize-membar
24748 @opindex mno-optimize-membar
24749 @opindex moptimize-membar
24751 This switch disables the automatic removal of redundant @code{membar}
24752 instructions from the generated code.
24754 @item -mtomcat-stats
24755 @opindex mtomcat-stats
24757 Cause gas to print out tomcat statistics.
24759 @item -mcpu=@var{cpu}
24760 @opindex mcpu
24762 Select the processor type for which to generate code.  Possible values are
24763 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
24764 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
24766 @end table
24768 @node GNU/Linux Options
24769 @subsection GNU/Linux Options
24771 These @samp{-m} options are defined for GNU/Linux targets:
24773 @table @gcctabopt
24774 @item -mglibc
24775 @opindex mglibc
24776 Use the GNU C library.  This is the default except
24777 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
24778 @samp{*-*-linux-*android*} targets.
24780 @item -muclibc
24781 @opindex muclibc
24782 Use uClibc C library.  This is the default on
24783 @samp{*-*-linux-*uclibc*} targets.
24785 @item -mmusl
24786 @opindex mmusl
24787 Use the musl C library.  This is the default on
24788 @samp{*-*-linux-*musl*} targets.
24790 @item -mbionic
24791 @opindex mbionic
24792 Use Bionic C library.  This is the default on
24793 @samp{*-*-linux-*android*} targets.
24795 @item -mandroid
24796 @opindex mandroid
24797 Compile code compatible with Android platform.  This is the default on
24798 @samp{*-*-linux-*android*} targets.
24800 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
24801 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
24802 this option makes the GCC driver pass Android-specific options to the linker.
24803 Finally, this option causes the preprocessor macro @code{__ANDROID__}
24804 to be defined.
24806 @item -tno-android-cc
24807 @opindex tno-android-cc
24808 Disable compilation effects of @option{-mandroid}, i.e., do not enable
24809 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
24810 @option{-fno-rtti} by default.
24812 @item -tno-android-ld
24813 @opindex tno-android-ld
24814 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
24815 linking options to the linker.
24817 @end table
24819 @node H8/300 Options
24820 @subsection H8/300 Options
24822 These @samp{-m} options are defined for the H8/300 implementations:
24824 @table @gcctabopt
24825 @item -mrelax
24826 @opindex mrelax
24827 Shorten some address references at link time, when possible; uses the
24828 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
24829 ld, Using ld}, for a fuller description.
24831 @item -mh
24832 @opindex mh
24833 Generate code for the H8/300H@.
24835 @item -ms
24836 @opindex ms
24837 Generate code for the H8S@.
24839 @item -mn
24840 @opindex mn
24841 Generate code for the H8S and H8/300H in the normal mode.  This switch
24842 must be used either with @option{-mh} or @option{-ms}.
24844 @item -ms2600
24845 @opindex ms2600
24846 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
24848 @item -mexr
24849 @opindex mexr
24850 Extended registers are stored on stack before execution of function
24851 with monitor attribute. Default option is @option{-mexr}.
24852 This option is valid only for H8S targets.
24854 @item -mno-exr
24855 @opindex mno-exr
24856 @opindex mexr
24857 Extended registers are not stored on stack before execution of function 
24858 with monitor attribute. Default option is @option{-mno-exr}. 
24859 This option is valid only for H8S targets.
24861 @item -mint32
24862 @opindex mint32
24863 Make @code{int} data 32 bits by default.
24865 @item -malign-300
24866 @opindex malign-300
24867 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
24868 The default for the H8/300H and H8S is to align longs and floats on
24869 4-byte boundaries.
24870 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
24871 This option has no effect on the H8/300.
24872 @end table
24874 @node HPPA Options
24875 @subsection HPPA Options
24876 @cindex HPPA Options
24878 These @samp{-m} options are defined for the HPPA family of computers:
24880 @table @gcctabopt
24881 @item -march=@var{architecture-type}
24882 @opindex march
24883 Generate code for the specified architecture.  The choices for
24884 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
24885 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
24886 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
24887 architecture option for your machine.  Code compiled for lower numbered
24888 architectures runs on higher numbered architectures, but not the
24889 other way around.
24891 @item -mpa-risc-1-0
24892 @itemx -mpa-risc-1-1
24893 @itemx -mpa-risc-2-0
24894 @opindex mpa-risc-1-0
24895 @opindex mpa-risc-1-1
24896 @opindex mpa-risc-2-0
24897 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
24899 @item -matomic-libcalls
24900 @opindex matomic-libcalls
24901 @opindex mno-atomic-libcalls
24902 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
24903 This option is enabled by default.  It only affects the generation of
24904 atomic libcalls by the HPPA backend.
24906 Both the sync and @file{libatomic} libcall implementations use locking.
24907 As a result, processor stores are not atomic with respect to other
24908 atomic operations.  Processor loads up to DImode are atomic with
24909 respect to other atomic operations provided they are implemented as
24910 a single access.
24912 The PA-RISC architecture does not support any atomic operations in
24913 hardware except for the @code{ldcw} instruction.  Thus, all atomic
24914 support is implemented using sync and atomic libcalls.  Sync libcall
24915 support is in @file{libgcc.a}.  Atomic libcall support is in
24916 @file{libatomic}.
24918 This option generates @code{__atomic_exchange} calls for atomic stores.
24919 It also provides special handling for atomic DImode accesses on 32-bit
24920 targets.
24922 @item -mbig-switch
24923 @opindex mbig-switch
24924 Does nothing.  Preserved for backward compatibility.
24926 @item -mcaller-copies
24927 @opindex mcaller-copies
24928 The caller copies function arguments passed by hidden reference.  This
24929 option should be used with care as it is not compatible with the default
24930 32-bit runtime.  However, only aggregates larger than eight bytes are
24931 passed by hidden reference and the option provides better compatibility
24932 with OpenMP.
24934 @item -mcoherent-ldcw
24935 @opindex mcoherent-ldcw
24936 Use ldcw/ldcd coherent cache-control hint.
24938 @item -mdisable-fpregs
24939 @opindex mdisable-fpregs
24940 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
24942 @item -mdisable-indexing
24943 @opindex mdisable-indexing
24944 Prevent the compiler from using indexing address modes.  This avoids some
24945 rather obscure problems when compiling MIG generated code under MACH@.
24947 @item -mfast-indirect-calls
24948 @opindex mfast-indirect-calls
24949 Generate code that assumes calls never cross space boundaries.  This
24950 allows GCC to emit code that performs faster indirect calls.
24952 This option does not work in the presence of shared libraries or nested
24953 functions.
24955 @item -mfixed-range=@var{register-range}
24956 @opindex mfixed-range
24957 Generate code treating the given register range as fixed registers.
24958 A fixed register is one that the register allocator cannot use.  This is
24959 useful when compiling kernel code.  A register range is specified as
24960 two registers separated by a dash.  Multiple register ranges can be
24961 specified separated by a comma.
24963 @item -mgas
24964 @opindex mgas
24965 Enable the use of assembler directives only GAS understands.
24967 @item -mgnu-ld
24968 @opindex mgnu-ld
24969 Use options specific to GNU @command{ld}.
24970 This passes @option{-shared} to @command{ld} when
24971 building a shared library.  It is the default when GCC is configured,
24972 explicitly or implicitly, with the GNU linker.  This option does not
24973 affect which @command{ld} is called; it only changes what parameters
24974 are passed to that @command{ld}.
24975 The @command{ld} that is called is determined by the
24976 @option{--with-ld} configure option, GCC's program search path, and
24977 finally by the user's @env{PATH}.  The linker used by GCC can be printed
24978 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
24979 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
24981 @item -mhp-ld
24982 @opindex mhp-ld
24983 Use options specific to HP @command{ld}.
24984 This passes @option{-b} to @command{ld} when building
24985 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
24986 links.  It is the default when GCC is configured, explicitly or
24987 implicitly, with the HP linker.  This option does not affect
24988 which @command{ld} is called; it only changes what parameters are passed to that
24989 @command{ld}.
24990 The @command{ld} that is called is determined by the @option{--with-ld}
24991 configure option, GCC's program search path, and finally by the user's
24992 @env{PATH}.  The linker used by GCC can be printed using @samp{which
24993 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
24994 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
24996 @item -mlinker-opt
24997 @opindex mlinker-opt
24998 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
24999 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
25000 linkers in which they give bogus error messages when linking some programs.
25002 @item -mlong-calls
25003 @opindex mno-long-calls
25004 @opindex mlong-calls
25005 Generate code that uses long call sequences.  This ensures that a call
25006 is always able to reach linker generated stubs.  The default is to generate
25007 long calls only when the distance from the call site to the beginning
25008 of the function or translation unit, as the case may be, exceeds a
25009 predefined limit set by the branch type being used.  The limits for
25010 normal calls are 7,600,000 and 240,000 bytes, respectively for the
25011 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
25012 240,000 bytes.
25014 Distances are measured from the beginning of functions when using the
25015 @option{-ffunction-sections} option, or when using the @option{-mgas}
25016 and @option{-mno-portable-runtime} options together under HP-UX with
25017 the SOM linker.
25019 It is normally not desirable to use this option as it degrades
25020 performance.  However, it may be useful in large applications,
25021 particularly when partial linking is used to build the application.
25023 The types of long calls used depends on the capabilities of the
25024 assembler and linker, and the type of code being generated.  The
25025 impact on systems that support long absolute calls, and long pic
25026 symbol-difference or pc-relative calls should be relatively small.
25027 However, an indirect call is used on 32-bit ELF systems in pic code
25028 and it is quite long.
25030 @item -mlong-load-store
25031 @opindex mlong-load-store
25032 Generate 3-instruction load and store sequences as sometimes required by
25033 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
25034 the HP compilers.
25036 @item -mjump-in-delay
25037 @opindex mjump-in-delay
25038 This option is ignored and provided for compatibility purposes only.
25040 @item -mno-space-regs
25041 @opindex mno-space-regs
25042 @opindex mspace-regs
25043 Generate code that assumes the target has no space registers.  This allows
25044 GCC to generate faster indirect calls and use unscaled index address modes.
25046 Such code is suitable for level 0 PA systems and kernels.
25048 @item -mordered
25049 @opindex mordered
25050 Assume memory references are ordered and barriers are not needed.
25052 @item -mportable-runtime
25053 @opindex mportable-runtime
25054 Use the portable calling conventions proposed by HP for ELF systems.
25056 @item -mschedule=@var{cpu-type}
25057 @opindex mschedule
25058 Schedule code according to the constraints for the machine type
25059 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
25060 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
25061 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
25062 proper scheduling option for your machine.  The default scheduling is
25063 @samp{8000}.
25065 @item -msio
25066 @opindex msio
25067 Generate the predefine, @code{_SIO}, for server IO@.  The default is
25068 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
25069 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
25070 options are available under HP-UX and HI-UX@.
25072 @item -msoft-float
25073 @opindex msoft-float
25074 Generate output containing library calls for floating point.
25075 @strong{Warning:} the requisite libraries are not available for all HPPA
25076 targets.  Normally the facilities of the machine's usual C compiler are
25077 used, but this cannot be done directly in cross-compilation.  You must make
25078 your own arrangements to provide suitable library functions for
25079 cross-compilation.
25081 @option{-msoft-float} changes the calling convention in the output file;
25082 therefore, it is only useful if you compile @emph{all} of a program with
25083 this option.  In particular, you need to compile @file{libgcc.a}, the
25084 library that comes with GCC, with @option{-msoft-float} in order for
25085 this to work.
25087 @item -msoft-mult
25088 @opindex msoft-mult
25089 Use software integer multiplication.
25091 This disables the use of the @code{xmpyu} instruction.
25093 @item -munix=@var{unix-std}
25094 @opindex march
25095 Generate compiler predefines and select a startfile for the specified
25096 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
25097 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
25098 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
25099 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
25100 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25101 and later.
25103 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25104 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25105 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25106 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25107 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25108 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25110 It is @emph{important} to note that this option changes the interfaces
25111 for various library routines.  It also affects the operational behavior
25112 of the C library.  Thus, @emph{extreme} care is needed in using this
25113 option.
25115 Library code that is intended to operate with more than one UNIX
25116 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25117 as appropriate.  Most GNU software doesn't provide this capability.
25119 @item -nolibdld
25120 @opindex nolibdld
25121 Suppress the generation of link options to search libdld.sl when the
25122 @option{-static} option is specified on HP-UX 10 and later.
25124 @item -static
25125 @opindex static
25126 The HP-UX implementation of setlocale in libc has a dependency on
25127 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
25128 when the @option{-static} option is specified, special link options
25129 are needed to resolve this dependency.
25131 On HP-UX 10 and later, the GCC driver adds the necessary options to
25132 link with libdld.sl when the @option{-static} option is specified.
25133 This causes the resulting binary to be dynamic.  On the 64-bit port,
25134 the linkers generate dynamic binaries by default in any case.  The
25135 @option{-nolibdld} option can be used to prevent the GCC driver from
25136 adding these link options.
25138 @item -threads
25139 @opindex threads
25140 Add support for multithreading with the @dfn{dce thread} library
25141 under HP-UX@.  This option sets flags for both the preprocessor and
25142 linker.
25143 @end table
25145 @node IA-64 Options
25146 @subsection IA-64 Options
25147 @cindex IA-64 Options
25149 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25151 @table @gcctabopt
25152 @item -mbig-endian
25153 @opindex mbig-endian
25154 Generate code for a big-endian target.  This is the default for HP-UX@.
25156 @item -mlittle-endian
25157 @opindex mlittle-endian
25158 Generate code for a little-endian target.  This is the default for AIX5
25159 and GNU/Linux.
25161 @item -mgnu-as
25162 @itemx -mno-gnu-as
25163 @opindex mgnu-as
25164 @opindex mno-gnu-as
25165 Generate (or don't) code for the GNU assembler.  This is the default.
25166 @c Also, this is the default if the configure option @option{--with-gnu-as}
25167 @c is used.
25169 @item -mgnu-ld
25170 @itemx -mno-gnu-ld
25171 @opindex mgnu-ld
25172 @opindex mno-gnu-ld
25173 Generate (or don't) code for the GNU linker.  This is the default.
25174 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25175 @c is used.
25177 @item -mno-pic
25178 @opindex mno-pic
25179 Generate code that does not use a global pointer register.  The result
25180 is not position independent code, and violates the IA-64 ABI@.
25182 @item -mvolatile-asm-stop
25183 @itemx -mno-volatile-asm-stop
25184 @opindex mvolatile-asm-stop
25185 @opindex mno-volatile-asm-stop
25186 Generate (or don't) a stop bit immediately before and after volatile asm
25187 statements.
25189 @item -mregister-names
25190 @itemx -mno-register-names
25191 @opindex mregister-names
25192 @opindex mno-register-names
25193 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25194 the stacked registers.  This may make assembler output more readable.
25196 @item -mno-sdata
25197 @itemx -msdata
25198 @opindex mno-sdata
25199 @opindex msdata
25200 Disable (or enable) optimizations that use the small data section.  This may
25201 be useful for working around optimizer bugs.
25203 @item -mconstant-gp
25204 @opindex mconstant-gp
25205 Generate code that uses a single constant global pointer value.  This is
25206 useful when compiling kernel code.
25208 @item -mauto-pic
25209 @opindex mauto-pic
25210 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
25211 This is useful when compiling firmware code.
25213 @item -minline-float-divide-min-latency
25214 @opindex minline-float-divide-min-latency
25215 Generate code for inline divides of floating-point values
25216 using the minimum latency algorithm.
25218 @item -minline-float-divide-max-throughput
25219 @opindex minline-float-divide-max-throughput
25220 Generate code for inline divides of floating-point values
25221 using the maximum throughput algorithm.
25223 @item -mno-inline-float-divide
25224 @opindex mno-inline-float-divide
25225 Do not generate inline code for divides of floating-point values.
25227 @item -minline-int-divide-min-latency
25228 @opindex minline-int-divide-min-latency
25229 Generate code for inline divides of integer values
25230 using the minimum latency algorithm.
25232 @item -minline-int-divide-max-throughput
25233 @opindex minline-int-divide-max-throughput
25234 Generate code for inline divides of integer values
25235 using the maximum throughput algorithm.
25237 @item -mno-inline-int-divide
25238 @opindex mno-inline-int-divide
25239 @opindex minline-int-divide
25240 Do not generate inline code for divides of integer values.
25242 @item -minline-sqrt-min-latency
25243 @opindex minline-sqrt-min-latency
25244 Generate code for inline square roots
25245 using the minimum latency algorithm.
25247 @item -minline-sqrt-max-throughput
25248 @opindex minline-sqrt-max-throughput
25249 Generate code for inline square roots
25250 using the maximum throughput algorithm.
25252 @item -mno-inline-sqrt
25253 @opindex mno-inline-sqrt
25254 Do not generate inline code for @code{sqrt}.
25256 @item -mfused-madd
25257 @itemx -mno-fused-madd
25258 @opindex mfused-madd
25259 @opindex mno-fused-madd
25260 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
25261 instructions.  The default is to use these instructions.
25263 @item -mno-dwarf2-asm
25264 @itemx -mdwarf2-asm
25265 @opindex mno-dwarf2-asm
25266 @opindex mdwarf2-asm
25267 Don't (or do) generate assembler code for the DWARF line number debugging
25268 info.  This may be useful when not using the GNU assembler.
25270 @item -mearly-stop-bits
25271 @itemx -mno-early-stop-bits
25272 @opindex mearly-stop-bits
25273 @opindex mno-early-stop-bits
25274 Allow stop bits to be placed earlier than immediately preceding the
25275 instruction that triggered the stop bit.  This can improve instruction
25276 scheduling, but does not always do so.
25278 @item -mfixed-range=@var{register-range}
25279 @opindex mfixed-range
25280 Generate code treating the given register range as fixed registers.
25281 A fixed register is one that the register allocator cannot use.  This is
25282 useful when compiling kernel code.  A register range is specified as
25283 two registers separated by a dash.  Multiple register ranges can be
25284 specified separated by a comma.
25286 @item -mtls-size=@var{tls-size}
25287 @opindex mtls-size
25288 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
25291 @item -mtune=@var{cpu-type}
25292 @opindex mtune
25293 Tune the instruction scheduling for a particular CPU, Valid values are
25294 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
25295 and @samp{mckinley}.
25297 @item -milp32
25298 @itemx -mlp64
25299 @opindex milp32
25300 @opindex mlp64
25301 Generate code for a 32-bit or 64-bit environment.
25302 The 32-bit environment sets int, long and pointer to 32 bits.
25303 The 64-bit environment sets int to 32 bits and long and pointer
25304 to 64 bits.  These are HP-UX specific flags.
25306 @item -mno-sched-br-data-spec
25307 @itemx -msched-br-data-spec
25308 @opindex mno-sched-br-data-spec
25309 @opindex msched-br-data-spec
25310 (Dis/En)able data speculative scheduling before reload.
25311 This results in generation of @code{ld.a} instructions and
25312 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25313 The default setting is disabled.
25315 @item -msched-ar-data-spec
25316 @itemx -mno-sched-ar-data-spec
25317 @opindex msched-ar-data-spec
25318 @opindex mno-sched-ar-data-spec
25319 (En/Dis)able data speculative scheduling after reload.
25320 This results in generation of @code{ld.a} instructions and
25321 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25322 The default setting is enabled.
25324 @item -mno-sched-control-spec
25325 @itemx -msched-control-spec
25326 @opindex mno-sched-control-spec
25327 @opindex msched-control-spec
25328 (Dis/En)able control speculative scheduling.  This feature is
25329 available only during region scheduling (i.e.@: before reload).
25330 This results in generation of the @code{ld.s} instructions and
25331 the corresponding check instructions @code{chk.s}.
25332 The default setting is disabled.
25334 @item -msched-br-in-data-spec
25335 @itemx -mno-sched-br-in-data-spec
25336 @opindex msched-br-in-data-spec
25337 @opindex mno-sched-br-in-data-spec
25338 (En/Dis)able speculative scheduling of the instructions that
25339 are dependent on the data speculative loads before reload.
25340 This is effective only with @option{-msched-br-data-spec} enabled.
25341 The default setting is enabled.
25343 @item -msched-ar-in-data-spec
25344 @itemx -mno-sched-ar-in-data-spec
25345 @opindex msched-ar-in-data-spec
25346 @opindex mno-sched-ar-in-data-spec
25347 (En/Dis)able speculative scheduling of the instructions that
25348 are dependent on the data speculative loads after reload.
25349 This is effective only with @option{-msched-ar-data-spec} enabled.
25350 The default setting is enabled.
25352 @item -msched-in-control-spec
25353 @itemx -mno-sched-in-control-spec
25354 @opindex msched-in-control-spec
25355 @opindex mno-sched-in-control-spec
25356 (En/Dis)able speculative scheduling of the instructions that
25357 are dependent on the control speculative loads.
25358 This is effective only with @option{-msched-control-spec} enabled.
25359 The default setting is enabled.
25361 @item -mno-sched-prefer-non-data-spec-insns
25362 @itemx -msched-prefer-non-data-spec-insns
25363 @opindex mno-sched-prefer-non-data-spec-insns
25364 @opindex msched-prefer-non-data-spec-insns
25365 If enabled, data-speculative instructions are chosen for schedule
25366 only if there are no other choices at the moment.  This makes
25367 the use of the data speculation much more conservative.
25368 The default setting is disabled.
25370 @item -mno-sched-prefer-non-control-spec-insns
25371 @itemx -msched-prefer-non-control-spec-insns
25372 @opindex mno-sched-prefer-non-control-spec-insns
25373 @opindex msched-prefer-non-control-spec-insns
25374 If enabled, control-speculative instructions are chosen for schedule
25375 only if there are no other choices at the moment.  This makes
25376 the use of the control speculation much more conservative.
25377 The default setting is disabled.
25379 @item -mno-sched-count-spec-in-critical-path
25380 @itemx -msched-count-spec-in-critical-path
25381 @opindex mno-sched-count-spec-in-critical-path
25382 @opindex msched-count-spec-in-critical-path
25383 If enabled, speculative dependencies are considered during
25384 computation of the instructions priorities.  This makes the use of the
25385 speculation a bit more conservative.
25386 The default setting is disabled.
25388 @item -msched-spec-ldc
25389 @opindex msched-spec-ldc
25390 Use a simple data speculation check.  This option is on by default.
25392 @item -msched-control-spec-ldc
25393 @opindex msched-spec-ldc
25394 Use a simple check for control speculation.  This option is on by default.
25396 @item -msched-stop-bits-after-every-cycle
25397 @opindex msched-stop-bits-after-every-cycle
25398 Place a stop bit after every cycle when scheduling.  This option is on
25399 by default.
25401 @item -msched-fp-mem-deps-zero-cost
25402 @opindex msched-fp-mem-deps-zero-cost
25403 Assume that floating-point stores and loads are not likely to cause a conflict
25404 when placed into the same instruction group.  This option is disabled by
25405 default.
25407 @item -msel-sched-dont-check-control-spec
25408 @opindex msel-sched-dont-check-control-spec
25409 Generate checks for control speculation in selective scheduling.
25410 This flag is disabled by default.
25412 @item -msched-max-memory-insns=@var{max-insns}
25413 @opindex msched-max-memory-insns
25414 Limit on the number of memory insns per instruction group, giving lower
25415 priority to subsequent memory insns attempting to schedule in the same
25416 instruction group. Frequently useful to prevent cache bank conflicts.
25417 The default value is 1.
25419 @item -msched-max-memory-insns-hard-limit
25420 @opindex msched-max-memory-insns-hard-limit
25421 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
25422 disallowing more than that number in an instruction group.
25423 Otherwise, the limit is ``soft'', meaning that non-memory operations
25424 are preferred when the limit is reached, but memory operations may still
25425 be scheduled.
25427 @end table
25429 @node LM32 Options
25430 @subsection LM32 Options
25431 @cindex LM32 options
25433 These @option{-m} options are defined for the LatticeMico32 architecture:
25435 @table @gcctabopt
25436 @item -mbarrel-shift-enabled
25437 @opindex mbarrel-shift-enabled
25438 Enable barrel-shift instructions.
25440 @item -mdivide-enabled
25441 @opindex mdivide-enabled
25442 Enable divide and modulus instructions.
25444 @item -mmultiply-enabled
25445 @opindex multiply-enabled
25446 Enable multiply instructions.
25448 @item -msign-extend-enabled
25449 @opindex msign-extend-enabled
25450 Enable sign extend instructions.
25452 @item -muser-enabled
25453 @opindex muser-enabled
25454 Enable user-defined instructions.
25456 @end table
25458 @node LoongArch Options
25459 @subsection LoongArch Options
25460 @cindex LoongArch Options
25462 These command-line options are defined for LoongArch targets:
25464 @table @gcctabopt
25465 @item -march=@var{cpu-type}
25466 @opindex march
25467 Generate instructions for the machine type @var{cpu-type}.  In contrast to
25468 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
25469 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
25470 to generate code that may not run at all on processors other than the one
25471 indicated.  Specifying @option{-march=@var{cpu-type}} implies
25472 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
25474 The choices for @var{cpu-type} are:
25476 @table @samp
25477 @item native
25478 This selects the CPU to generate code for at compilation time by determining
25479 the processor type of the compiling machine.  Using @option{-march=native}
25480 enables all instruction subsets supported by the local machine (hence
25481 the result might not run on different machines).  Using @option{-mtune=native}
25482 produces code optimized for the local machine under the constraints
25483 of the selected instruction set.
25484 @item loongarch64
25485 A generic CPU with 64-bit extensions.
25486 @item la464
25487 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
25488 @end table
25490 @item -mtune=@var{cpu-type}
25491 @opindex mtune
25492 Optimize the output for the given processor, specified by microarchitecture
25493 name.
25495 @item -mabi=@var{base-abi-type}
25496 @opindex mabi
25497 Generate code for the specified calling convention.
25498 @var{base-abi-type} can be one of:
25499 @table @samp
25500 @item lp64d
25501 Uses 64-bit general purpose registers and 32/64-bit floating-point
25502 registers for parameter passing.  Data model is LP64, where @samp{int}
25503 is 32 bits, while @samp{long int} and pointers are 64 bits.
25504 @item lp64f
25505 Uses 64-bit general purpose registers and 32-bit floating-point
25506 registers for parameter passing.  Data model is LP64, where @samp{int}
25507 is 32 bits, while @samp{long int} and pointers are 64 bits.
25508 @item lp64s
25509 Uses 64-bit general purpose registers and no floating-point
25510 registers for parameter passing.  Data model is LP64, where @samp{int}
25511 is 32 bits, while @samp{long int} and pointers are 64 bits.
25512 @end table
25514 @item -mfpu=@var{fpu-type}
25515 @opindex mfpu
25516 Generate code for the specified FPU type, which can be one of:
25517 @table @samp
25518 @item 64
25519 Allow the use of hardware floating-point instructions for 32-bit
25520 and 64-bit operations.
25521 @item 32
25522 Allow the use of hardware floating-point instructions for 32-bit
25523 operations.
25524 @item none
25525 @item 0
25526 Prevent the use of hardware floating-point instructions.
25527 @end table
25529 @item -msoft-float
25530 @opindex msoft-float
25531 Force @option{-mfpu=none} and prevents the use of floating-point
25532 registers for parameter passing.  This option may change the target
25533 ABI.
25535 @item -msingle-float
25536 @opindex msingle-float
25537 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
25538 registers for parameter passing.  This option may change the target
25539 ABI.
25541 @item -mdouble-float
25542 @opindex mdouble-float
25543 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
25544 registers for parameter passing.  This option may change the target
25545 ABI.
25547 @item -mbranch-cost=@var{n}
25548 @opindex mbranch-cost
25549 Set the cost of branches to roughly @var{n} instructions.
25551 @item -mcheck-zero-division
25552 @itemx -mno-check-zero-divison
25553 @opindex mcheck-zero-division
25554 Trap (do not trap) on integer division by zero.  The default is
25555 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
25556 @option{-mno-check-zero-division} for other optimization levels.
25558 @item -mcond-move-int
25559 @itemx -mno-cond-move-int
25560 @opindex mcond-move-int
25561 Conditional moves for integral data in general-purpose registers
25562 are enabled (disabled).  The default is @option{-mcond-move-int}.
25564 @item -mcond-move-float
25565 @itemx -mno-cond-move-float
25566 @opindex mcond-move-float
25567 Conditional moves for floating-point registers are enabled (disabled).
25568 The default is @option{-mcond-move-float}.
25570 @item -mmemcpy
25571 @itemx -mno-memcpy
25572 @opindex mmemcpy
25573 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
25574 The default is @option{-mno-memcpy}, which allows GCC to inline most
25575 constant-sized copies.  Setting optimization level to @option{-Os} also
25576 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
25577 behavior if explicitly specified, regardless of the order these options on
25578 the command line.
25580 @item -mstrict-align
25581 @itemx -mno-strict-align
25582 @opindex mstrict-align
25583 Avoid or allow generating memory accesses that may not be aligned on a natural
25584 object boundary as described in the architecture specification. The default is
25585 @option{-mno-strict-align}.
25587 @item -msmall-data-limit=@var{number}
25588 @opindex msmall-data-limit
25589 Put global and static data smaller than @var{number} bytes into a special
25590 section (on some targets).  The default value is 0.
25592 @item -mmax-inline-memcpy-size=@var{n}
25593 @opindex mmax-inline-memcpy-size
25594 Inline all block moves (such as calls to @code{memcpy} or structure copies)
25595 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
25597 @item -mcmodel=@var{code-model}
25598 Set the code model to one of:
25599 @table @samp
25600 @item tiny-static (Not implemented yet)
25601 @item tiny (Not implemented yet)
25603 @item normal
25604 The text segment must be within 128MB addressing space.  The data segment must
25605 be within 2GB addressing space.
25607 @item medium
25608 The text segment and data segment must be within 2GB addressing space.
25610 @item large (Not implemented yet)
25612 @item extreme
25613 This mode does not limit the size of the code segment and data segment.
25614 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt} and
25615 @option{-mno-explicit-relocs}.
25616 @end table
25617 The default code model is @code{normal}.
25619 @item -mexplicit-relocs
25620 @itemx -mno-explicit-relocs
25621 @opindex mexplicit-relocs
25622 @opindex mno-explicit-relocs
25623 Use or do not use assembler relocation operators when dealing with symbolic
25624 addresses.  The alternative is to use assembler macros instead, which may
25625 limit optimization.  The default value for the option is determined during
25626 GCC build-time by detecting corresponding assembler support:
25627 @code{-mexplicit-relocs} if said support is present,
25628 @code{-mno-explicit-relocs} otherwise.  This option is mostly useful for
25629 debugging, or interoperation with assemblers different from the build-time
25630 one.
25632 @item -mdirect-extern-access
25633 @itemx -mno-direct-extern-access
25634 @opindex mdirect-extern-access
25635 Do not use or use GOT to access external symbols.  The default is
25636 @option{-mno-direct-extern-access}: GOT is used for external symbols with
25637 default visibility, but not used for other external symbols.
25639 With @option{-mdirect-extern-access}, GOT is not used and all external
25640 symbols are PC-relatively addressed.  It is @strong{only} suitable for
25641 environments where no dynamic link is performed, like firmwares, OS
25642 kernels, executables linked with @option{-static} or @option{-static-pie}.
25643 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
25644 @option{-fpic}.
25645 @end table
25647 @node M32C Options
25648 @subsection M32C Options
25649 @cindex M32C options
25651 @table @gcctabopt
25652 @item -mcpu=@var{name}
25653 @opindex mcpu=
25654 Select the CPU for which code is generated.  @var{name} may be one of
25655 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
25656 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
25657 the M32C/80 series.
25659 @item -msim
25660 @opindex msim
25661 Specifies that the program will be run on the simulator.  This causes
25662 an alternate runtime library to be linked in which supports, for
25663 example, file I/O@.  You must not use this option when generating
25664 programs that will run on real hardware; you must provide your own
25665 runtime library for whatever I/O functions are needed.
25667 @item -memregs=@var{number}
25668 @opindex memregs=
25669 Specifies the number of memory-based pseudo-registers GCC uses
25670 during code generation.  These pseudo-registers are used like real
25671 registers, so there is a tradeoff between GCC's ability to fit the
25672 code into available registers, and the performance penalty of using
25673 memory instead of registers.  Note that all modules in a program must
25674 be compiled with the same value for this option.  Because of that, you
25675 must not use this option with GCC's default runtime libraries.
25677 @end table
25679 @node M32R/D Options
25680 @subsection M32R/D Options
25681 @cindex M32R/D options
25683 These @option{-m} options are defined for Renesas M32R/D architectures:
25685 @table @gcctabopt
25686 @item -m32r2
25687 @opindex m32r2
25688 Generate code for the M32R/2@.
25690 @item -m32rx
25691 @opindex m32rx
25692 Generate code for the M32R/X@.
25694 @item -m32r
25695 @opindex m32r
25696 Generate code for the M32R@.  This is the default.
25698 @item -mmodel=small
25699 @opindex mmodel=small
25700 Assume all objects live in the lower 16MB of memory (so that their addresses
25701 can be loaded with the @code{ld24} instruction), and assume all subroutines
25702 are reachable with the @code{bl} instruction.
25703 This is the default.
25705 The addressability of a particular object can be set with the
25706 @code{model} attribute.
25708 @item -mmodel=medium
25709 @opindex mmodel=medium
25710 Assume objects may be anywhere in the 32-bit address space (the compiler
25711 generates @code{seth/add3} instructions to load their addresses), and
25712 assume all subroutines are reachable with the @code{bl} instruction.
25714 @item -mmodel=large
25715 @opindex mmodel=large
25716 Assume objects may be anywhere in the 32-bit address space (the compiler
25717 generates @code{seth/add3} instructions to load their addresses), and
25718 assume subroutines may not be reachable with the @code{bl} instruction
25719 (the compiler generates the much slower @code{seth/add3/jl}
25720 instruction sequence).
25722 @item -msdata=none
25723 @opindex msdata=none
25724 Disable use of the small data area.  Variables are put into
25725 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
25726 @code{section} attribute has been specified).
25727 This is the default.
25729 The small data area consists of sections @code{.sdata} and @code{.sbss}.
25730 Objects may be explicitly put in the small data area with the
25731 @code{section} attribute using one of these sections.
25733 @item -msdata=sdata
25734 @opindex msdata=sdata
25735 Put small global and static data in the small data area, but do not
25736 generate special code to reference them.
25738 @item -msdata=use
25739 @opindex msdata=use
25740 Put small global and static data in the small data area, and generate
25741 special instructions to reference them.
25743 @item -G @var{num}
25744 @opindex G
25745 @cindex smaller data references
25746 Put global and static objects less than or equal to @var{num} bytes
25747 into the small data or BSS sections instead of the normal data or BSS
25748 sections.  The default value of @var{num} is 8.
25749 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
25750 for this option to have any effect.
25752 All modules should be compiled with the same @option{-G @var{num}} value.
25753 Compiling with different values of @var{num} may or may not work; if it
25754 doesn't the linker gives an error message---incorrect code is not
25755 generated.
25757 @item -mdebug
25758 @opindex mdebug
25759 Makes the M32R-specific code in the compiler display some statistics
25760 that might help in debugging programs.
25762 @item -malign-loops
25763 @opindex malign-loops
25764 Align all loops to a 32-byte boundary.
25766 @item -mno-align-loops
25767 @opindex mno-align-loops
25768 Do not enforce a 32-byte alignment for loops.  This is the default.
25770 @item -missue-rate=@var{number}
25771 @opindex missue-rate=@var{number}
25772 Issue @var{number} instructions per cycle.  @var{number} can only be 1
25773 or 2.
25775 @item -mbranch-cost=@var{number}
25776 @opindex mbranch-cost=@var{number}
25777 @var{number} can only be 1 or 2.  If it is 1 then branches are
25778 preferred over conditional code, if it is 2, then the opposite applies.
25780 @item -mflush-trap=@var{number}
25781 @opindex mflush-trap=@var{number}
25782 Specifies the trap number to use to flush the cache.  The default is
25783 12.  Valid numbers are between 0 and 15 inclusive.
25785 @item -mno-flush-trap
25786 @opindex mno-flush-trap
25787 Specifies that the cache cannot be flushed by using a trap.
25789 @item -mflush-func=@var{name}
25790 @opindex mflush-func=@var{name}
25791 Specifies the name of the operating system function to call to flush
25792 the cache.  The default is @samp{_flush_cache}, but a function call
25793 is only used if a trap is not available.
25795 @item -mno-flush-func
25796 @opindex mno-flush-func
25797 Indicates that there is no OS function for flushing the cache.
25799 @end table
25801 @node M680x0 Options
25802 @subsection M680x0 Options
25803 @cindex M680x0 options
25805 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
25806 The default settings depend on which architecture was selected when
25807 the compiler was configured; the defaults for the most common choices
25808 are given below.
25810 @table @gcctabopt
25811 @item -march=@var{arch}
25812 @opindex march
25813 Generate code for a specific M680x0 or ColdFire instruction set
25814 architecture.  Permissible values of @var{arch} for M680x0
25815 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
25816 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
25817 architectures are selected according to Freescale's ISA classification
25818 and the permissible values are: @samp{isaa}, @samp{isaaplus},
25819 @samp{isab} and @samp{isac}.
25821 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
25822 code for a ColdFire target.  The @var{arch} in this macro is one of the
25823 @option{-march} arguments given above.
25825 When used together, @option{-march} and @option{-mtune} select code
25826 that runs on a family of similar processors but that is optimized
25827 for a particular microarchitecture.
25829 @item -mcpu=@var{cpu}
25830 @opindex mcpu
25831 Generate code for a specific M680x0 or ColdFire processor.
25832 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
25833 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
25834 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
25835 below, which also classifies the CPUs into families:
25837 @multitable @columnfractions 0.20 0.80
25838 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
25839 @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}
25840 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
25841 @item @samp{5206e} @tab @samp{5206e}
25842 @item @samp{5208} @tab @samp{5207} @samp{5208}
25843 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
25844 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
25845 @item @samp{5216} @tab @samp{5214} @samp{5216}
25846 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
25847 @item @samp{5225} @tab @samp{5224} @samp{5225}
25848 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
25849 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
25850 @item @samp{5249} @tab @samp{5249}
25851 @item @samp{5250} @tab @samp{5250}
25852 @item @samp{5271} @tab @samp{5270} @samp{5271}
25853 @item @samp{5272} @tab @samp{5272}
25854 @item @samp{5275} @tab @samp{5274} @samp{5275}
25855 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
25856 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
25857 @item @samp{5307} @tab @samp{5307}
25858 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
25859 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
25860 @item @samp{5407} @tab @samp{5407}
25861 @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}
25862 @end multitable
25864 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
25865 @var{arch} is compatible with @var{cpu}.  Other combinations of
25866 @option{-mcpu} and @option{-march} are rejected.
25868 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
25869 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
25870 where the value of @var{family} is given by the table above.
25872 @item -mtune=@var{tune}
25873 @opindex mtune
25874 Tune the code for a particular microarchitecture within the
25875 constraints set by @option{-march} and @option{-mcpu}.
25876 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
25877 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
25878 and @samp{cpu32}.  The ColdFire microarchitectures
25879 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
25881 You can also use @option{-mtune=68020-40} for code that needs
25882 to run relatively well on 68020, 68030 and 68040 targets.
25883 @option{-mtune=68020-60} is similar but includes 68060 targets
25884 as well.  These two options select the same tuning decisions as
25885 @option{-m68020-40} and @option{-m68020-60} respectively.
25887 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
25888 when tuning for 680x0 architecture @var{arch}.  It also defines
25889 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
25890 option is used.  If GCC is tuning for a range of architectures,
25891 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
25892 it defines the macros for every architecture in the range.
25894 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
25895 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
25896 of the arguments given above.
25898 @item -m68000
25899 @itemx -mc68000
25900 @opindex m68000
25901 @opindex mc68000
25902 Generate output for a 68000.  This is the default
25903 when the compiler is configured for 68000-based systems.
25904 It is equivalent to @option{-march=68000}.
25906 Use this option for microcontrollers with a 68000 or EC000 core,
25907 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
25909 @item -m68010
25910 @opindex m68010
25911 Generate output for a 68010.  This is the default
25912 when the compiler is configured for 68010-based systems.
25913 It is equivalent to @option{-march=68010}.
25915 @item -m68020
25916 @itemx -mc68020
25917 @opindex m68020
25918 @opindex mc68020
25919 Generate output for a 68020.  This is the default
25920 when the compiler is configured for 68020-based systems.
25921 It is equivalent to @option{-march=68020}.
25923 @item -m68030
25924 @opindex m68030
25925 Generate output for a 68030.  This is the default when the compiler is
25926 configured for 68030-based systems.  It is equivalent to
25927 @option{-march=68030}.
25929 @item -m68040
25930 @opindex m68040
25931 Generate output for a 68040.  This is the default when the compiler is
25932 configured for 68040-based systems.  It is equivalent to
25933 @option{-march=68040}.
25935 This option inhibits the use of 68881/68882 instructions that have to be
25936 emulated by software on the 68040.  Use this option if your 68040 does not
25937 have code to emulate those instructions.
25939 @item -m68060
25940 @opindex m68060
25941 Generate output for a 68060.  This is the default when the compiler is
25942 configured for 68060-based systems.  It is equivalent to
25943 @option{-march=68060}.
25945 This option inhibits the use of 68020 and 68881/68882 instructions that
25946 have to be emulated by software on the 68060.  Use this option if your 68060
25947 does not have code to emulate those instructions.
25949 @item -mcpu32
25950 @opindex mcpu32
25951 Generate output for a CPU32.  This is the default
25952 when the compiler is configured for CPU32-based systems.
25953 It is equivalent to @option{-march=cpu32}.
25955 Use this option for microcontrollers with a
25956 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
25957 68336, 68340, 68341, 68349 and 68360.
25959 @item -m5200
25960 @opindex m5200
25961 Generate output for a 520X ColdFire CPU@.  This is the default
25962 when the compiler is configured for 520X-based systems.
25963 It is equivalent to @option{-mcpu=5206}, and is now deprecated
25964 in favor of that option.
25966 Use this option for microcontroller with a 5200 core, including
25967 the MCF5202, MCF5203, MCF5204 and MCF5206.
25969 @item -m5206e
25970 @opindex m5206e
25971 Generate output for a 5206e ColdFire CPU@.  The option is now
25972 deprecated in favor of the equivalent @option{-mcpu=5206e}.
25974 @item -m528x
25975 @opindex m528x
25976 Generate output for a member of the ColdFire 528X family.
25977 The option is now deprecated in favor of the equivalent
25978 @option{-mcpu=528x}.
25980 @item -m5307
25981 @opindex m5307
25982 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
25983 in favor of the equivalent @option{-mcpu=5307}.
25985 @item -m5407
25986 @opindex m5407
25987 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
25988 in favor of the equivalent @option{-mcpu=5407}.
25990 @item -mcfv4e
25991 @opindex mcfv4e
25992 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
25993 This includes use of hardware floating-point instructions.
25994 The option is equivalent to @option{-mcpu=547x}, and is now
25995 deprecated in favor of that option.
25997 @item -m68020-40
25998 @opindex m68020-40
25999 Generate output for a 68040, without using any of the new instructions.
26000 This results in code that can run relatively efficiently on either a
26001 68020/68881 or a 68030 or a 68040.  The generated code does use the
26002 68881 instructions that are emulated on the 68040.
26004 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
26006 @item -m68020-60
26007 @opindex m68020-60
26008 Generate output for a 68060, without using any of the new instructions.
26009 This results in code that can run relatively efficiently on either a
26010 68020/68881 or a 68030 or a 68040.  The generated code does use the
26011 68881 instructions that are emulated on the 68060.
26013 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
26015 @item -mhard-float
26016 @itemx -m68881
26017 @opindex mhard-float
26018 @opindex m68881
26019 Generate floating-point instructions.  This is the default for 68020
26020 and above, and for ColdFire devices that have an FPU@.  It defines the
26021 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
26022 on ColdFire targets.
26024 @item -msoft-float
26025 @opindex msoft-float
26026 Do not generate floating-point instructions; use library calls instead.
26027 This is the default for 68000, 68010, and 68832 targets.  It is also
26028 the default for ColdFire devices that have no FPU.
26030 @item -mdiv
26031 @itemx -mno-div
26032 @opindex mdiv
26033 @opindex mno-div
26034 Generate (do not generate) ColdFire hardware divide and remainder
26035 instructions.  If @option{-march} is used without @option{-mcpu},
26036 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
26037 architectures.  Otherwise, the default is taken from the target CPU
26038 (either the default CPU, or the one specified by @option{-mcpu}).  For
26039 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
26040 @option{-mcpu=5206e}.
26042 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
26044 @item -mshort
26045 @opindex mshort
26046 Consider type @code{int} to be 16 bits wide, like @code{short int}.
26047 Additionally, parameters passed on the stack are also aligned to a
26048 16-bit boundary even on targets whose API mandates promotion to 32-bit.
26050 @item -mno-short
26051 @opindex mno-short
26052 Do not consider type @code{int} to be 16 bits wide.  This is the default.
26054 @item -mnobitfield
26055 @itemx -mno-bitfield
26056 @opindex mnobitfield
26057 @opindex mno-bitfield
26058 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
26059 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
26061 @item -mbitfield
26062 @opindex mbitfield
26063 Do use the bit-field instructions.  The @option{-m68020} option implies
26064 @option{-mbitfield}.  This is the default if you use a configuration
26065 designed for a 68020.
26067 @item -mrtd
26068 @opindex mrtd
26069 Use a different function-calling convention, in which functions
26070 that take a fixed number of arguments return with the @code{rtd}
26071 instruction, which pops their arguments while returning.  This
26072 saves one instruction in the caller since there is no need to pop
26073 the arguments there.
26075 This calling convention is incompatible with the one normally
26076 used on Unix, so you cannot use it if you need to call libraries
26077 compiled with the Unix compiler.
26079 Also, you must provide function prototypes for all functions that
26080 take variable numbers of arguments (including @code{printf});
26081 otherwise incorrect code is generated for calls to those
26082 functions.
26084 In addition, seriously incorrect code results if you call a
26085 function with too many arguments.  (Normally, extra arguments are
26086 harmlessly ignored.)
26088 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26089 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26091 The default is @option{-mno-rtd}.
26093 @item -malign-int
26094 @itemx -mno-align-int
26095 @opindex malign-int
26096 @opindex mno-align-int
26097 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26098 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26099 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26100 Aligning variables on 32-bit boundaries produces code that runs somewhat
26101 faster on processors with 32-bit busses at the expense of more memory.
26103 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26104 aligns structures containing the above types differently than
26105 most published application binary interface specifications for the m68k.
26107 @opindex mpcrel
26108 Use the pc-relative addressing mode of the 68000 directly, instead of
26109 using a global offset table.  At present, this option implies @option{-fpic},
26110 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
26111 not presently supported with @option{-mpcrel}, though this could be supported for
26112 68020 and higher processors.
26114 @item -mno-strict-align
26115 @itemx -mstrict-align
26116 @opindex mno-strict-align
26117 @opindex mstrict-align
26118 Do not (do) assume that unaligned memory references are handled by
26119 the system.
26121 @item -msep-data
26122 Generate code that allows the data segment to be located in a different
26123 area of memory from the text segment.  This allows for execute-in-place in
26124 an environment without virtual memory management.  This option implies
26125 @option{-fPIC}.
26127 @item -mno-sep-data
26128 Generate code that assumes that the data segment follows the text segment.
26129 This is the default.
26131 @item -mid-shared-library
26132 Generate code that supports shared libraries via the library ID method.
26133 This allows for execute-in-place and shared libraries in an environment
26134 without virtual memory management.  This option implies @option{-fPIC}.
26136 @item -mno-id-shared-library
26137 Generate code that doesn't assume ID-based shared libraries are being used.
26138 This is the default.
26140 @item -mshared-library-id=n
26141 Specifies the identification number of the ID-based shared library being
26142 compiled.  Specifying a value of 0 generates more compact code; specifying
26143 other values forces the allocation of that number to the current
26144 library, but is no more space- or time-efficient than omitting this option.
26146 @item -mxgot
26147 @itemx -mno-xgot
26148 @opindex mxgot
26149 @opindex mno-xgot
26150 When generating position-independent code for ColdFire, generate code
26151 that works if the GOT has more than 8192 entries.  This code is
26152 larger and slower than code generated without this option.  On M680x0
26153 processors, this option is not needed; @option{-fPIC} suffices.
26155 GCC normally uses a single instruction to load values from the GOT@.
26156 While this is relatively efficient, it only works if the GOT
26157 is smaller than about 64k.  Anything larger causes the linker
26158 to report an error such as:
26160 @cindex relocation truncated to fit (ColdFire)
26161 @smallexample
26162 relocation truncated to fit: R_68K_GOT16O foobar
26163 @end smallexample
26165 If this happens, you should recompile your code with @option{-mxgot}.
26166 It should then work with very large GOTs.  However, code generated with
26167 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26168 the value of a global symbol.
26170 Note that some linkers, including newer versions of the GNU linker,
26171 can create multiple GOTs and sort GOT entries.  If you have such a linker,
26172 you should only need to use @option{-mxgot} when compiling a single
26173 object file that accesses more than 8192 GOT entries.  Very few do.
26175 These options have no effect unless GCC is generating
26176 position-independent code.
26178 @item -mlong-jump-table-offsets
26179 @opindex mlong-jump-table-offsets
26180 Use 32-bit offsets in @code{switch} tables.  The default is to use
26181 16-bit offsets.
26183 @end table
26185 @node MCore Options
26186 @subsection MCore Options
26187 @cindex MCore options
26189 These are the @samp{-m} options defined for the Motorola M*Core
26190 processors.
26192 @table @gcctabopt
26194 @item -mhardlit
26195 @itemx -mno-hardlit
26196 @opindex mhardlit
26197 @opindex mno-hardlit
26198 Inline constants into the code stream if it can be done in two
26199 instructions or less.
26201 @item -mdiv
26202 @itemx -mno-div
26203 @opindex mdiv
26204 @opindex mno-div
26205 Use the divide instruction.  (Enabled by default).
26207 @item -mrelax-immediate
26208 @itemx -mno-relax-immediate
26209 @opindex mrelax-immediate
26210 @opindex mno-relax-immediate
26211 Allow arbitrary-sized immediates in bit operations.
26213 @item -mwide-bitfields
26214 @itemx -mno-wide-bitfields
26215 @opindex mwide-bitfields
26216 @opindex mno-wide-bitfields
26217 Always treat bit-fields as @code{int}-sized.
26219 @item -m4byte-functions
26220 @itemx -mno-4byte-functions
26221 @opindex m4byte-functions
26222 @opindex mno-4byte-functions
26223 Force all functions to be aligned to a 4-byte boundary.
26225 @item -mcallgraph-data
26226 @itemx -mno-callgraph-data
26227 @opindex mcallgraph-data
26228 @opindex mno-callgraph-data
26229 Emit callgraph information.
26231 @item -mslow-bytes
26232 @itemx -mno-slow-bytes
26233 @opindex mslow-bytes
26234 @opindex mno-slow-bytes
26235 Prefer word access when reading byte quantities.
26237 @item -mlittle-endian
26238 @itemx -mbig-endian
26239 @opindex mlittle-endian
26240 @opindex mbig-endian
26241 Generate code for a little-endian target.
26243 @item -m210
26244 @itemx -m340
26245 @opindex m210
26246 @opindex m340
26247 Generate code for the 210 processor.
26249 @item -mno-lsim
26250 @opindex mno-lsim
26251 Assume that runtime support has been provided and so omit the
26252 simulator library (@file{libsim.a)} from the linker command line.
26254 @item -mstack-increment=@var{size}
26255 @opindex mstack-increment
26256 Set the maximum amount for a single stack increment operation.  Large
26257 values can increase the speed of programs that contain functions
26258 that need a large amount of stack space, but they can also trigger a
26259 segmentation fault if the stack is extended too much.  The default
26260 value is 0x1000.
26262 @end table
26264 @node MicroBlaze Options
26265 @subsection MicroBlaze Options
26266 @cindex MicroBlaze Options
26268 @table @gcctabopt
26270 @item -msoft-float
26271 @opindex msoft-float
26272 Use software emulation for floating point (default).
26274 @item -mhard-float
26275 @opindex mhard-float
26276 Use hardware floating-point instructions.
26278 @item -mmemcpy
26279 @opindex mmemcpy
26280 Do not optimize block moves, use @code{memcpy}.
26282 @item -mno-clearbss
26283 @opindex mno-clearbss
26284 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
26286 @item -mcpu=@var{cpu-type}
26287 @opindex mcpu=
26288 Use features of, and schedule code for, the given CPU.
26289 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
26290 where @var{X} is a major version, @var{YY} is the minor version, and
26291 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
26292 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
26294 @item -mxl-soft-mul
26295 @opindex mxl-soft-mul
26296 Use software multiply emulation (default).
26298 @item -mxl-soft-div
26299 @opindex mxl-soft-div
26300 Use software emulation for divides (default).
26302 @item -mxl-barrel-shift
26303 @opindex mxl-barrel-shift
26304 Use the hardware barrel shifter.
26306 @item -mxl-pattern-compare
26307 @opindex mxl-pattern-compare
26308 Use pattern compare instructions.
26310 @item -msmall-divides
26311 @opindex msmall-divides
26312 Use table lookup optimization for small signed integer divisions.
26314 @item -mxl-stack-check
26315 @opindex mxl-stack-check
26316 This option is deprecated.  Use @option{-fstack-check} instead.
26318 @item -mxl-gp-opt
26319 @opindex mxl-gp-opt
26320 Use GP-relative @code{.sdata}/@code{.sbss} sections.
26322 @item -mxl-multiply-high
26323 @opindex mxl-multiply-high
26324 Use multiply high instructions for high part of 32x32 multiply.
26326 @item -mxl-float-convert
26327 @opindex mxl-float-convert
26328 Use hardware floating-point conversion instructions.
26330 @item -mxl-float-sqrt
26331 @opindex mxl-float-sqrt
26332 Use hardware floating-point square root instruction.
26334 @item -mbig-endian
26335 @opindex mbig-endian
26336 Generate code for a big-endian target.
26338 @item -mlittle-endian
26339 @opindex mlittle-endian
26340 Generate code for a little-endian target.
26342 @item -mxl-reorder
26343 @opindex mxl-reorder
26344 Use reorder instructions (swap and byte reversed load/store).
26346 @item -mxl-mode-@var{app-model}
26347 Select application model @var{app-model}.  Valid models are
26348 @table @samp
26349 @item executable
26350 normal executable (default), uses startup code @file{crt0.o}.
26352 @item xmdstub
26353 for use with Xilinx Microprocessor Debugger (XMD) based
26354 software intrusive debug agent called xmdstub. This uses startup file
26355 @file{crt1.o} and sets the start address of the program to 0x800.
26357 @item bootstrap
26358 for applications that are loaded using a bootloader.
26359 This model uses startup file @file{crt2.o} which does not contain a processor
26360 reset vector handler. This is suitable for transferring control on a
26361 processor reset to the bootloader rather than the application.
26363 @item novectors
26364 for applications that do not require any of the
26365 MicroBlaze vectors. This option may be useful for applications running
26366 within a monitoring application. This model uses @file{crt3.o} as a startup file.
26367 @end table
26369 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
26370 @option{-mxl-mode-@var{app-model}}.
26372 @item -mpic-data-is-text-relative
26373 @opindex mpic-data-is-text-relative
26374 Assume that the displacement between the text and data segments is fixed
26375 at static link time.  This allows data to be referenced by offset from start of
26376 text address instead of GOT since PC-relative addressing is not supported.
26378 @end table
26380 @node MIPS Options
26381 @subsection MIPS Options
26382 @cindex MIPS options
26384 @table @gcctabopt
26386 @item -EB
26387 @opindex EB
26388 Generate big-endian code.
26390 @item -EL
26391 @opindex EL
26392 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
26393 configurations.
26395 @item -march=@var{arch}
26396 @opindex march
26397 Generate code that runs on @var{arch}, which can be the name of a
26398 generic MIPS ISA, or the name of a particular processor.
26399 The ISA names are:
26400 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
26401 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
26402 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
26403 @samp{mips64r5} and @samp{mips64r6}.
26404 The processor names are:
26405 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
26406 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
26407 @samp{5kc}, @samp{5kf},
26408 @samp{20kc},
26409 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
26410 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
26411 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
26412 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
26413 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
26414 @samp{i6400}, @samp{i6500},
26415 @samp{interaptiv},
26416 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
26417 @samp{gs464e}, @samp{gs264e},
26418 @samp{m4k},
26419 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
26420 @samp{m5100}, @samp{m5101},
26421 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
26422 @samp{orion},
26423 @samp{p5600}, @samp{p6600},
26424 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
26425 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
26426 @samp{r6000}, @samp{r8000},
26427 @samp{rm7000}, @samp{rm9000},
26428 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
26429 @samp{sb1},
26430 @samp{sr71000},
26431 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
26432 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
26433 @samp{xlr} and @samp{xlp}.
26434 The special value @samp{from-abi} selects the
26435 most compatible architecture for the selected ABI (that is,
26436 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
26438 The native Linux/GNU toolchain also supports the value @samp{native},
26439 which selects the best architecture option for the host processor.
26440 @option{-march=native} has no effect if GCC does not recognize
26441 the processor.
26443 In processor names, a final @samp{000} can be abbreviated as @samp{k}
26444 (for example, @option{-march=r2k}).  Prefixes are optional, and
26445 @samp{vr} may be written @samp{r}.
26447 Names of the form @samp{@var{n}f2_1} refer to processors with
26448 FPUs clocked at half the rate of the core, names of the form
26449 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
26450 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
26451 processors with FPUs clocked a ratio of 3:2 with respect to the core.
26452 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
26453 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
26454 accepted as synonyms for @samp{@var{n}f1_1}.
26456 GCC defines two macros based on the value of this option.  The first
26457 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
26458 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
26459 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
26460 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
26461 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
26463 Note that the @code{_MIPS_ARCH} macro uses the processor names given
26464 above.  In other words, it has the full prefix and does not
26465 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
26466 the macro names the resolved architecture (either @code{"mips1"} or
26467 @code{"mips3"}).  It names the default architecture when no
26468 @option{-march} option is given.
26470 @item -mtune=@var{arch}
26471 @opindex mtune
26472 Optimize for @var{arch}.  Among other things, this option controls
26473 the way instructions are scheduled, and the perceived cost of arithmetic
26474 operations.  The list of @var{arch} values is the same as for
26475 @option{-march}.
26477 When this option is not used, GCC optimizes for the processor
26478 specified by @option{-march}.  By using @option{-march} and
26479 @option{-mtune} together, it is possible to generate code that
26480 runs on a family of processors, but optimize the code for one
26481 particular member of that family.
26483 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
26484 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
26485 @option{-march} ones described above.
26487 @item -mips1
26488 @opindex mips1
26489 Equivalent to @option{-march=mips1}.
26491 @item -mips2
26492 @opindex mips2
26493 Equivalent to @option{-march=mips2}.
26495 @item -mips3
26496 @opindex mips3
26497 Equivalent to @option{-march=mips3}.
26499 @item -mips4
26500 @opindex mips4
26501 Equivalent to @option{-march=mips4}.
26503 @item -mips32
26504 @opindex mips32
26505 Equivalent to @option{-march=mips32}.
26507 @item -mips32r3
26508 @opindex mips32r3
26509 Equivalent to @option{-march=mips32r3}.
26511 @item -mips32r5
26512 @opindex mips32r5
26513 Equivalent to @option{-march=mips32r5}.
26515 @item -mips32r6
26516 @opindex mips32r6
26517 Equivalent to @option{-march=mips32r6}.
26519 @item -mips64
26520 @opindex mips64
26521 Equivalent to @option{-march=mips64}.
26523 @item -mips64r2
26524 @opindex mips64r2
26525 Equivalent to @option{-march=mips64r2}.
26527 @item -mips64r3
26528 @opindex mips64r3
26529 Equivalent to @option{-march=mips64r3}.
26531 @item -mips64r5
26532 @opindex mips64r5
26533 Equivalent to @option{-march=mips64r5}.
26535 @item -mips64r6
26536 @opindex mips64r6
26537 Equivalent to @option{-march=mips64r6}.
26539 @item -mips16
26540 @itemx -mno-mips16
26541 @opindex mips16
26542 @opindex mno-mips16
26543 Generate (do not generate) MIPS16 code.  If GCC is targeting a
26544 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
26546 MIPS16 code generation can also be controlled on a per-function basis
26547 by means of @code{mips16} and @code{nomips16} attributes.
26548 @xref{Function Attributes}, for more information.
26550 @item -mflip-mips16
26551 @opindex mflip-mips16
26552 Generate MIPS16 code on alternating functions.  This option is provided
26553 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
26554 not intended for ordinary use in compiling user code.
26556 @item -minterlink-compressed
26557 @itemx -mno-interlink-compressed
26558 @opindex minterlink-compressed
26559 @opindex mno-interlink-compressed
26560 Require (do not require) that code using the standard (uncompressed) MIPS ISA
26561 be link-compatible with MIPS16 and microMIPS code, and vice versa.
26563 For example, code using the standard ISA encoding cannot jump directly
26564 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
26565 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
26566 knows that the target of the jump is not compressed.
26568 @item -minterlink-mips16
26569 @itemx -mno-interlink-mips16
26570 @opindex minterlink-mips16
26571 @opindex mno-interlink-mips16
26572 Aliases of @option{-minterlink-compressed} and
26573 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
26574 and are retained for backwards compatibility.
26576 @item -mabi=32
26577 @itemx -mabi=o64
26578 @itemx -mabi=n32
26579 @itemx -mabi=64
26580 @itemx -mabi=eabi
26581 @opindex mabi=32
26582 @opindex mabi=o64
26583 @opindex mabi=n32
26584 @opindex mabi=64
26585 @opindex mabi=eabi
26586 Generate code for the given ABI@.
26588 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
26589 generates 64-bit code when you select a 64-bit architecture, but you
26590 can use @option{-mgp32} to get 32-bit code instead.
26592 For information about the O64 ABI, see
26593 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
26595 GCC supports a variant of the o32 ABI in which floating-point registers
26596 are 64 rather than 32 bits wide.  You can select this combination with
26597 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
26598 and @code{mfhc1} instructions and is therefore only supported for
26599 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
26601 The register assignments for arguments and return values remain the
26602 same, but each scalar value is passed in a single 64-bit register
26603 rather than a pair of 32-bit registers.  For example, scalar
26604 floating-point values are returned in @samp{$f0} only, not a
26605 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
26606 remains the same in that the even-numbered double-precision registers
26607 are saved.
26609 Two additional variants of the o32 ABI are supported to enable
26610 a transition from 32-bit to 64-bit registers.  These are FPXX
26611 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
26612 The FPXX extension mandates that all code must execute correctly
26613 when run using 32-bit or 64-bit registers.  The code can be interlinked
26614 with either FP32 or FP64, but not both.
26615 The FP64A extension is similar to the FP64 extension but forbids the
26616 use of odd-numbered single-precision registers.  This can be used
26617 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
26618 processors and allows both FP32 and FP64A code to interlink and
26619 run in the same process without changing FPU modes.
26621 @item -mabicalls
26622 @itemx -mno-abicalls
26623 @opindex mabicalls
26624 @opindex mno-abicalls
26625 Generate (do not generate) code that is suitable for SVR4-style
26626 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
26627 systems.
26629 @item -mshared
26630 @itemx -mno-shared
26631 Generate (do not generate) code that is fully position-independent,
26632 and that can therefore be linked into shared libraries.  This option
26633 only affects @option{-mabicalls}.
26635 All @option{-mabicalls} code has traditionally been position-independent,
26636 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
26637 as an extension, the GNU toolchain allows executables to use absolute
26638 accesses for locally-binding symbols.  It can also use shorter GP
26639 initialization sequences and generate direct calls to locally-defined
26640 functions.  This mode is selected by @option{-mno-shared}.
26642 @option{-mno-shared} depends on binutils 2.16 or higher and generates
26643 objects that can only be linked by the GNU linker.  However, the option
26644 does not affect the ABI of the final executable; it only affects the ABI
26645 of relocatable objects.  Using @option{-mno-shared} generally makes
26646 executables both smaller and quicker.
26648 @option{-mshared} is the default.
26650 @item -mplt
26651 @itemx -mno-plt
26652 @opindex mplt
26653 @opindex mno-plt
26654 Assume (do not assume) that the static and dynamic linkers
26655 support PLTs and copy relocations.  This option only affects
26656 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
26657 has no effect without @option{-msym32}.
26659 You can make @option{-mplt} the default by configuring
26660 GCC with @option{--with-mips-plt}.  The default is
26661 @option{-mno-plt} otherwise.
26663 @item -mxgot
26664 @itemx -mno-xgot
26665 @opindex mxgot
26666 @opindex mno-xgot
26667 Lift (do not lift) the usual restrictions on the size of the global
26668 offset table.
26670 GCC normally uses a single instruction to load values from the GOT@.
26671 While this is relatively efficient, it only works if the GOT
26672 is smaller than about 64k.  Anything larger causes the linker
26673 to report an error such as:
26675 @cindex relocation truncated to fit (MIPS)
26676 @smallexample
26677 relocation truncated to fit: R_MIPS_GOT16 foobar
26678 @end smallexample
26680 If this happens, you should recompile your code with @option{-mxgot}.
26681 This works with very large GOTs, although the code is also
26682 less efficient, since it takes three instructions to fetch the
26683 value of a global symbol.
26685 Note that some linkers can create multiple GOTs.  If you have such a
26686 linker, you should only need to use @option{-mxgot} when a single object
26687 file accesses more than 64k's worth of GOT entries.  Very few do.
26689 These options have no effect unless GCC is generating position
26690 independent code.
26692 @item -mgp32
26693 @opindex mgp32
26694 Assume that general-purpose registers are 32 bits wide.
26696 @item -mgp64
26697 @opindex mgp64
26698 Assume that general-purpose registers are 64 bits wide.
26700 @item -mfp32
26701 @opindex mfp32
26702 Assume that floating-point registers are 32 bits wide.
26704 @item -mfp64
26705 @opindex mfp64
26706 Assume that floating-point registers are 64 bits wide.
26708 @item -mfpxx
26709 @opindex mfpxx
26710 Do not assume the width of floating-point registers.
26712 @item -mhard-float
26713 @opindex mhard-float
26714 Use floating-point coprocessor instructions.
26716 @item -msoft-float
26717 @opindex msoft-float
26718 Do not use floating-point coprocessor instructions.  Implement
26719 floating-point calculations using library calls instead.
26721 @item -mno-float
26722 @opindex mno-float
26723 Equivalent to @option{-msoft-float}, but additionally asserts that the
26724 program being compiled does not perform any floating-point operations.
26725 This option is presently supported only by some bare-metal MIPS
26726 configurations, where it may select a special set of libraries
26727 that lack all floating-point support (including, for example, the
26728 floating-point @code{printf} formats).  
26729 If code compiled with @option{-mno-float} accidentally contains
26730 floating-point operations, it is likely to suffer a link-time
26731 or run-time failure.
26733 @item -msingle-float
26734 @opindex msingle-float
26735 Assume that the floating-point coprocessor only supports single-precision
26736 operations.
26738 @item -mdouble-float
26739 @opindex mdouble-float
26740 Assume that the floating-point coprocessor supports double-precision
26741 operations.  This is the default.
26743 @item -modd-spreg
26744 @itemx -mno-odd-spreg
26745 @opindex modd-spreg
26746 @opindex mno-odd-spreg
26747 Enable the use of odd-numbered single-precision floating-point registers
26748 for the o32 ABI.  This is the default for processors that are known to
26749 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
26750 is set by default.
26752 @item -mabs=2008
26753 @itemx -mabs=legacy
26754 @opindex mabs=2008
26755 @opindex mabs=legacy
26756 These options control the treatment of the special not-a-number (NaN)
26757 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
26758 @code{neg.@i{fmt}} machine instructions.
26760 By default or when @option{-mabs=legacy} is used the legacy
26761 treatment is selected.  In this case these instructions are considered
26762 arithmetic and avoided where correct operation is required and the
26763 input operand might be a NaN.  A longer sequence of instructions that
26764 manipulate the sign bit of floating-point datum manually is used
26765 instead unless the @option{-ffinite-math-only} option has also been
26766 specified.
26768 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
26769 this case these instructions are considered non-arithmetic and therefore
26770 operating correctly in all cases, including in particular where the
26771 input operand is a NaN.  These instructions are therefore always used
26772 for the respective operations.
26774 @item -mnan=2008
26775 @itemx -mnan=legacy
26776 @opindex mnan=2008
26777 @opindex mnan=legacy
26778 These options control the encoding of the special not-a-number (NaN)
26779 IEEE 754 floating-point data.
26781 The @option{-mnan=legacy} option selects the legacy encoding.  In this
26782 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
26783 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
26784 by the first bit of their trailing significand field being 1.
26786 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
26787 this case qNaNs are denoted by the first bit of their trailing
26788 significand field being 1, whereas sNaNs are denoted by the first bit of
26789 their trailing significand field being 0.
26791 The default is @option{-mnan=legacy} unless GCC has been configured with
26792 @option{--with-nan=2008}.
26794 @item -mllsc
26795 @itemx -mno-llsc
26796 @opindex mllsc
26797 @opindex mno-llsc
26798 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
26799 implement atomic memory built-in functions.  When neither option is
26800 specified, GCC uses the instructions if the target architecture
26801 supports them.
26803 @option{-mllsc} is useful if the runtime environment can emulate the
26804 instructions and @option{-mno-llsc} can be useful when compiling for
26805 nonstandard ISAs.  You can make either option the default by
26806 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
26807 respectively.  @option{--with-llsc} is the default for some
26808 configurations; see the installation documentation for details.
26810 @item -mdsp
26811 @itemx -mno-dsp
26812 @opindex mdsp
26813 @opindex mno-dsp
26814 Use (do not use) revision 1 of the MIPS DSP ASE@.
26815 @xref{MIPS DSP Built-in Functions}.  This option defines the
26816 preprocessor macro @code{__mips_dsp}.  It also defines
26817 @code{__mips_dsp_rev} to 1.
26819 @item -mdspr2
26820 @itemx -mno-dspr2
26821 @opindex mdspr2
26822 @opindex mno-dspr2
26823 Use (do not use) revision 2 of the MIPS DSP ASE@.
26824 @xref{MIPS DSP Built-in Functions}.  This option defines the
26825 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
26826 It also defines @code{__mips_dsp_rev} to 2.
26828 @item -msmartmips
26829 @itemx -mno-smartmips
26830 @opindex msmartmips
26831 @opindex mno-smartmips
26832 Use (do not use) the MIPS SmartMIPS ASE.
26834 @item -mpaired-single
26835 @itemx -mno-paired-single
26836 @opindex mpaired-single
26837 @opindex mno-paired-single
26838 Use (do not use) paired-single floating-point instructions.
26839 @xref{MIPS Paired-Single Support}.  This option requires
26840 hardware floating-point support to be enabled.
26842 @item -mdmx
26843 @itemx -mno-mdmx
26844 @opindex mdmx
26845 @opindex mno-mdmx
26846 Use (do not use) MIPS Digital Media Extension instructions.
26847 This option can only be used when generating 64-bit code and requires
26848 hardware floating-point support to be enabled.
26850 @item -mips3d
26851 @itemx -mno-mips3d
26852 @opindex mips3d
26853 @opindex mno-mips3d
26854 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
26855 The option @option{-mips3d} implies @option{-mpaired-single}.
26857 @item -mmicromips
26858 @itemx -mno-micromips
26859 @opindex mmicromips
26860 @opindex mno-mmicromips
26861 Generate (do not generate) microMIPS code.
26863 MicroMIPS code generation can also be controlled on a per-function basis
26864 by means of @code{micromips} and @code{nomicromips} attributes.
26865 @xref{Function Attributes}, for more information.
26867 @item -mmt
26868 @itemx -mno-mt
26869 @opindex mmt
26870 @opindex mno-mt
26871 Use (do not use) MT Multithreading instructions.
26873 @item -mmcu
26874 @itemx -mno-mcu
26875 @opindex mmcu
26876 @opindex mno-mcu
26877 Use (do not use) the MIPS MCU ASE instructions.
26879 @item -meva
26880 @itemx -mno-eva
26881 @opindex meva
26882 @opindex mno-eva
26883 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
26885 @item -mvirt
26886 @itemx -mno-virt
26887 @opindex mvirt
26888 @opindex mno-virt
26889 Use (do not use) the MIPS Virtualization (VZ) instructions.
26891 @item -mxpa
26892 @itemx -mno-xpa
26893 @opindex mxpa
26894 @opindex mno-xpa
26895 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
26897 @item -mcrc
26898 @itemx -mno-crc
26899 @opindex mcrc
26900 @opindex mno-crc
26901 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
26903 @item -mginv
26904 @itemx -mno-ginv
26905 @opindex mginv
26906 @opindex mno-ginv
26907 Use (do not use) the MIPS Global INValidate (GINV) instructions.
26909 @item -mloongson-mmi
26910 @itemx -mno-loongson-mmi
26911 @opindex mloongson-mmi
26912 @opindex mno-loongson-mmi
26913 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
26915 @item -mloongson-ext
26916 @itemx -mno-loongson-ext
26917 @opindex mloongson-ext
26918 @opindex mno-loongson-ext
26919 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
26921 @item -mloongson-ext2
26922 @itemx -mno-loongson-ext2
26923 @opindex mloongson-ext2
26924 @opindex mno-loongson-ext2
26925 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
26927 @item -mlong64
26928 @opindex mlong64
26929 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
26930 an explanation of the default and the way that the pointer size is
26931 determined.
26933 @item -mlong32
26934 @opindex mlong32
26935 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
26937 The default size of @code{int}s, @code{long}s and pointers depends on
26938 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
26939 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
26940 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
26941 or the same size as integer registers, whichever is smaller.
26943 @item -msym32
26944 @itemx -mno-sym32
26945 @opindex msym32
26946 @opindex mno-sym32
26947 Assume (do not assume) that all symbols have 32-bit values, regardless
26948 of the selected ABI@.  This option is useful in combination with
26949 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
26950 to generate shorter and faster references to symbolic addresses.
26952 @item -G @var{num}
26953 @opindex G
26954 Put definitions of externally-visible data in a small data section
26955 if that data is no bigger than @var{num} bytes.  GCC can then generate
26956 more efficient accesses to the data; see @option{-mgpopt} for details.
26958 The default @option{-G} option depends on the configuration.
26960 @item -mlocal-sdata
26961 @itemx -mno-local-sdata
26962 @opindex mlocal-sdata
26963 @opindex mno-local-sdata
26964 Extend (do not extend) the @option{-G} behavior to local data too,
26965 such as to static variables in C@.  @option{-mlocal-sdata} is the
26966 default for all configurations.
26968 If the linker complains that an application is using too much small data,
26969 you might want to try rebuilding the less performance-critical parts with
26970 @option{-mno-local-sdata}.  You might also want to build large
26971 libraries with @option{-mno-local-sdata}, so that the libraries leave
26972 more room for the main program.
26974 @item -mextern-sdata
26975 @itemx -mno-extern-sdata
26976 @opindex mextern-sdata
26977 @opindex mno-extern-sdata
26978 Assume (do not assume) that externally-defined data is in
26979 a small data section if the size of that data is within the @option{-G} limit.
26980 @option{-mextern-sdata} is the default for all configurations.
26982 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
26983 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
26984 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
26985 is placed in a small data section.  If @var{Var} is defined by another
26986 module, you must either compile that module with a high-enough
26987 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
26988 definition.  If @var{Var} is common, you must link the application
26989 with a high-enough @option{-G} setting.
26991 The easiest way of satisfying these restrictions is to compile
26992 and link every module with the same @option{-G} option.  However,
26993 you may wish to build a library that supports several different
26994 small data limits.  You can do this by compiling the library with
26995 the highest supported @option{-G} setting and additionally using
26996 @option{-mno-extern-sdata} to stop the library from making assumptions
26997 about externally-defined data.
26999 @item -mgpopt
27000 @itemx -mno-gpopt
27001 @opindex mgpopt
27002 @opindex mno-gpopt
27003 Use (do not use) GP-relative accesses for symbols that are known to be
27004 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
27005 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
27006 configurations.
27008 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
27009 might not hold the value of @code{_gp}.  For example, if the code is
27010 part of a library that might be used in a boot monitor, programs that
27011 call boot monitor routines pass an unknown value in @code{$gp}.
27012 (In such situations, the boot monitor itself is usually compiled
27013 with @option{-G0}.)
27015 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
27016 @option{-mno-extern-sdata}.
27018 @item -membedded-data
27019 @itemx -mno-embedded-data
27020 @opindex membedded-data
27021 @opindex mno-embedded-data
27022 Allocate variables to the read-only data section first if possible, then
27023 next in the small data section if possible, otherwise in data.  This gives
27024 slightly slower code than the default, but reduces the amount of RAM required
27025 when executing, and thus may be preferred for some embedded systems.
27027 @item -muninit-const-in-rodata
27028 @itemx -mno-uninit-const-in-rodata
27029 @opindex muninit-const-in-rodata
27030 @opindex mno-uninit-const-in-rodata
27031 Put uninitialized @code{const} variables in the read-only data section.
27032 This option is only meaningful in conjunction with @option{-membedded-data}.
27034 @item -mcode-readable=@var{setting}
27035 @opindex mcode-readable
27036 Specify whether GCC may generate code that reads from executable sections.
27037 There are three possible settings:
27039 @table @gcctabopt
27040 @item -mcode-readable=yes
27041 Instructions may freely access executable sections.  This is the
27042 default setting.
27044 @item -mcode-readable=pcrel
27045 MIPS16 PC-relative load instructions can access executable sections,
27046 but other instructions must not do so.  This option is useful on 4KSc
27047 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
27048 It is also useful on processors that can be configured to have a dual
27049 instruction/data SRAM interface and that, like the M4K, automatically
27050 redirect PC-relative loads to the instruction RAM.
27052 @item -mcode-readable=no
27053 Instructions must not access executable sections.  This option can be
27054 useful on targets that are configured to have a dual instruction/data
27055 SRAM interface but that (unlike the M4K) do not automatically redirect
27056 PC-relative loads to the instruction RAM.
27057 @end table
27059 @item -msplit-addresses
27060 @itemx -mno-split-addresses
27061 @opindex msplit-addresses
27062 @opindex mno-split-addresses
27063 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
27064 relocation operators.  This option has been superseded by
27065 @option{-mexplicit-relocs} but is retained for backwards compatibility.
27067 @item -mexplicit-relocs
27068 @itemx -mno-explicit-relocs
27069 @opindex mexplicit-relocs
27070 @opindex mno-explicit-relocs
27071 Use (do not use) assembler relocation operators when dealing with symbolic
27072 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
27073 is to use assembler macros instead.
27075 @option{-mexplicit-relocs} is the default if GCC was configured
27076 to use an assembler that supports relocation operators.
27078 @item -mcheck-zero-division
27079 @itemx -mno-check-zero-division
27080 @opindex mcheck-zero-division
27081 @opindex mno-check-zero-division
27082 Trap (do not trap) on integer division by zero.
27084 The default is @option{-mcheck-zero-division}.
27086 @item -mdivide-traps
27087 @itemx -mdivide-breaks
27088 @opindex mdivide-traps
27089 @opindex mdivide-breaks
27090 MIPS systems check for division by zero by generating either a
27091 conditional trap or a break instruction.  Using traps results in
27092 smaller code, but is only supported on MIPS II and later.  Also, some
27093 versions of the Linux kernel have a bug that prevents trap from
27094 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
27095 allow conditional traps on architectures that support them and
27096 @option{-mdivide-breaks} to force the use of breaks.
27098 The default is usually @option{-mdivide-traps}, but this can be
27099 overridden at configure time using @option{--with-divide=breaks}.
27100 Divide-by-zero checks can be completely disabled using
27101 @option{-mno-check-zero-division}.
27103 @item -mload-store-pairs
27104 @itemx -mno-load-store-pairs
27105 @opindex mload-store-pairs
27106 @opindex mno-load-store-pairs
27107 Enable (disable) an optimization that pairs consecutive load or store
27108 instructions to enable load/store bonding.  This option is enabled by
27109 default but only takes effect when the selected architecture is known
27110 to support bonding.
27112 @item -munaligned-access
27113 @itemx -mno-unaligned-access
27114 @opindex munaligned-access
27115 @opindex mno-unaligned-access
27116 Enable (disable) direct unaligned access for MIPS Release 6.
27117 MIPSr6 requires load/store unaligned-access support,
27118 by hardware or trap&emulate.
27119 So @option{-mno-unaligned-access} may be needed by kernel.
27121 @item -mmemcpy
27122 @itemx -mno-memcpy
27123 @opindex mmemcpy
27124 @opindex mno-memcpy
27125 Force (do not force) the use of @code{memcpy} for non-trivial block
27126 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
27127 most constant-sized copies.
27129 @item -mlong-calls
27130 @itemx -mno-long-calls
27131 @opindex mlong-calls
27132 @opindex mno-long-calls
27133 Disable (do not disable) use of the @code{jal} instruction.  Calling
27134 functions using @code{jal} is more efficient but requires the caller
27135 and callee to be in the same 256 megabyte segment.
27137 This option has no effect on abicalls code.  The default is
27138 @option{-mno-long-calls}.
27140 @item -mmad
27141 @itemx -mno-mad
27142 @opindex mmad
27143 @opindex mno-mad
27144 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27145 instructions, as provided by the R4650 ISA@.
27147 @item -mimadd
27148 @itemx -mno-imadd
27149 @opindex mimadd
27150 @opindex mno-imadd
27151 Enable (disable) use of the @code{madd} and @code{msub} integer
27152 instructions.  The default is @option{-mimadd} on architectures
27153 that support @code{madd} and @code{msub} except for the 74k 
27154 architecture where it was found to generate slower code.
27156 @item -mfused-madd
27157 @itemx -mno-fused-madd
27158 @opindex mfused-madd
27159 @opindex mno-fused-madd
27160 Enable (disable) use of the floating-point multiply-accumulate
27161 instructions, when they are available.  The default is
27162 @option{-mfused-madd}.
27164 On the R8000 CPU when multiply-accumulate instructions are used,
27165 the intermediate product is calculated to infinite precision
27166 and is not subject to the FCSR Flush to Zero bit.  This may be
27167 undesirable in some circumstances.  On other processors the result
27168 is numerically identical to the equivalent computation using
27169 separate multiply, add, subtract and negate instructions.
27171 @item -nocpp
27172 @opindex nocpp
27173 Tell the MIPS assembler to not run its preprocessor over user
27174 assembler files (with a @samp{.s} suffix) when assembling them.
27176 @item -mfix-24k
27177 @itemx -mno-fix-24k
27178 @opindex mfix-24k
27179 @opindex mno-fix-24k
27180 Work around the 24K E48 (lost data on stores during refill) errata.
27181 The workarounds are implemented by the assembler rather than by GCC@.
27183 @item -mfix-r4000
27184 @itemx -mno-fix-r4000
27185 @opindex mfix-r4000
27186 @opindex mno-fix-r4000
27187 Work around certain R4000 CPU errata:
27188 @itemize @minus
27189 @item
27190 A double-word or a variable shift may give an incorrect result if executed
27191 immediately after starting an integer division.
27192 @item
27193 A double-word or a variable shift may give an incorrect result if executed
27194 while an integer multiplication is in progress.
27195 @item
27196 An integer division may give an incorrect result if started in a delay slot
27197 of a taken branch or a jump.
27198 @end itemize
27200 @item -mfix-r4400
27201 @itemx -mno-fix-r4400
27202 @opindex mfix-r4400
27203 @opindex mno-fix-r4400
27204 Work around certain R4400 CPU errata:
27205 @itemize @minus
27206 @item
27207 A double-word or a variable shift may give an incorrect result if executed
27208 immediately after starting an integer division.
27209 @end itemize
27211 @item -mfix-r10000
27212 @itemx -mno-fix-r10000
27213 @opindex mfix-r10000
27214 @opindex mno-fix-r10000
27215 Work around certain R10000 errata:
27216 @itemize @minus
27217 @item
27218 @code{ll}/@code{sc} sequences may not behave atomically on revisions
27219 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
27220 @end itemize
27222 This option can only be used if the target architecture supports
27223 branch-likely instructions.  @option{-mfix-r10000} is the default when
27224 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
27225 otherwise.
27227 @item -mfix-r5900
27228 @itemx -mno-fix-r5900
27229 @opindex mfix-r5900
27230 Do not attempt to schedule the preceding instruction into the delay slot
27231 of a branch instruction placed at the end of a short loop of six
27232 instructions or fewer and always schedule a @code{nop} instruction there
27233 instead.  The short loop bug under certain conditions causes loops to
27234 execute only once or twice, due to a hardware bug in the R5900 chip.  The
27235 workaround is implemented by the assembler rather than by GCC@.
27237 @item -mfix-rm7000
27238 @itemx -mno-fix-rm7000
27239 @opindex mfix-rm7000
27240 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
27241 workarounds are implemented by the assembler rather than by GCC@.
27243 @item -mfix-vr4120
27244 @itemx -mno-fix-vr4120
27245 @opindex mfix-vr4120
27246 Work around certain VR4120 errata:
27247 @itemize @minus
27248 @item
27249 @code{dmultu} does not always produce the correct result.
27250 @item
27251 @code{div} and @code{ddiv} do not always produce the correct result if one
27252 of the operands is negative.
27253 @end itemize
27254 The workarounds for the division errata rely on special functions in
27255 @file{libgcc.a}.  At present, these functions are only provided by
27256 the @code{mips64vr*-elf} configurations.
27258 Other VR4120 errata require a NOP to be inserted between certain pairs of
27259 instructions.  These errata are handled by the assembler, not by GCC itself.
27261 @item -mfix-vr4130
27262 @opindex mfix-vr4130
27263 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
27264 workarounds are implemented by the assembler rather than by GCC,
27265 although GCC avoids using @code{mflo} and @code{mfhi} if the
27266 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
27267 instructions are available instead.
27269 @item -mfix-sb1
27270 @itemx -mno-fix-sb1
27271 @opindex mfix-sb1
27272 Work around certain SB-1 CPU core errata.
27273 (This flag currently works around the SB-1 revision 2
27274 ``F1'' and ``F2'' floating-point errata.)
27276 @item -mr10k-cache-barrier=@var{setting}
27277 @opindex mr10k-cache-barrier
27278 Specify whether GCC should insert cache barriers to avoid the
27279 side effects of speculation on R10K processors.
27281 In common with many processors, the R10K tries to predict the outcome
27282 of a conditional branch and speculatively executes instructions from
27283 the ``taken'' branch.  It later aborts these instructions if the
27284 predicted outcome is wrong.  However, on the R10K, even aborted
27285 instructions can have side effects.
27287 This problem only affects kernel stores and, depending on the system,
27288 kernel loads.  As an example, a speculatively-executed store may load
27289 the target memory into cache and mark the cache line as dirty, even if
27290 the store itself is later aborted.  If a DMA operation writes to the
27291 same area of memory before the ``dirty'' line is flushed, the cached
27292 data overwrites the DMA-ed data.  See the R10K processor manual
27293 for a full description, including other potential problems.
27295 One workaround is to insert cache barrier instructions before every memory
27296 access that might be speculatively executed and that might have side
27297 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
27298 controls GCC's implementation of this workaround.  It assumes that
27299 aborted accesses to any byte in the following regions does not have
27300 side effects:
27302 @enumerate
27303 @item
27304 the memory occupied by the current function's stack frame;
27306 @item
27307 the memory occupied by an incoming stack argument;
27309 @item
27310 the memory occupied by an object with a link-time-constant address.
27311 @end enumerate
27313 It is the kernel's responsibility to ensure that speculative
27314 accesses to these regions are indeed safe.
27316 If the input program contains a function declaration such as:
27318 @smallexample
27319 void foo (void);
27320 @end smallexample
27322 then the implementation of @code{foo} must allow @code{j foo} and
27323 @code{jal foo} to be executed speculatively.  GCC honors this
27324 restriction for functions it compiles itself.  It expects non-GCC
27325 functions (such as hand-written assembly code) to do the same.
27327 The option has three forms:
27329 @table @gcctabopt
27330 @item -mr10k-cache-barrier=load-store
27331 Insert a cache barrier before a load or store that might be
27332 speculatively executed and that might have side effects even
27333 if aborted.
27335 @item -mr10k-cache-barrier=store
27336 Insert a cache barrier before a store that might be speculatively
27337 executed and that might have side effects even if aborted.
27339 @item -mr10k-cache-barrier=none
27340 Disable the insertion of cache barriers.  This is the default setting.
27341 @end table
27343 @item -mflush-func=@var{func}
27344 @itemx -mno-flush-func
27345 @opindex mflush-func
27346 Specifies the function to call to flush the I and D caches, or to not
27347 call any such function.  If called, the function must take the same
27348 arguments as the common @code{_flush_func}, that is, the address of the
27349 memory range for which the cache is being flushed, the size of the
27350 memory range, and the number 3 (to flush both caches).  The default
27351 depends on the target GCC was configured for, but commonly is either
27352 @code{_flush_func} or @code{__cpu_flush}.
27354 @item mbranch-cost=@var{num}
27355 @opindex mbranch-cost
27356 Set the cost of branches to roughly @var{num} ``simple'' instructions.
27357 This cost is only a heuristic and is not guaranteed to produce
27358 consistent results across releases.  A zero cost redundantly selects
27359 the default, which is based on the @option{-mtune} setting.
27361 @item -mbranch-likely
27362 @itemx -mno-branch-likely
27363 @opindex mbranch-likely
27364 @opindex mno-branch-likely
27365 Enable or disable use of Branch Likely instructions, regardless of the
27366 default for the selected architecture.  By default, Branch Likely
27367 instructions may be generated if they are supported by the selected
27368 architecture.  An exception is for the MIPS32 and MIPS64 architectures
27369 and processors that implement those architectures; for those, Branch
27370 Likely instructions are not be generated by default because the MIPS32
27371 and MIPS64 architectures specifically deprecate their use.
27373 @item -mcompact-branches=never
27374 @itemx -mcompact-branches=optimal
27375 @itemx -mcompact-branches=always
27376 @opindex mcompact-branches=never
27377 @opindex mcompact-branches=optimal
27378 @opindex mcompact-branches=always
27379 These options control which form of branches will be generated.  The
27380 default is @option{-mcompact-branches=optimal}.
27382 The @option{-mcompact-branches=never} option ensures that compact branch
27383 instructions will never be generated.
27385 The @option{-mcompact-branches=always} option ensures that a compact
27386 branch instruction will be generated if available for MIPS Release 6 onwards.
27387 If a compact branch instruction is not available (or pre-R6),
27388 a delay slot form of the branch will be used instead.
27390 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
27391 The behaviour for MIPS16/microMIPS may change in future,
27392 since they do have some compact branch instructions.
27394 The @option{-mcompact-branches=optimal} option will cause a delay slot
27395 branch to be used if one is available in the current ISA and the delay
27396 slot is successfully filled.  If the delay slot is not filled, a compact
27397 branch will be chosen if one is available.
27399 @item -mfp-exceptions
27400 @itemx -mno-fp-exceptions
27401 @opindex mfp-exceptions
27402 Specifies whether FP exceptions are enabled.  This affects how
27403 FP instructions are scheduled for some processors.
27404 The default is that FP exceptions are
27405 enabled.
27407 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
27408 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
27409 FP pipe.
27411 @item -mvr4130-align
27412 @itemx -mno-vr4130-align
27413 @opindex mvr4130-align
27414 The VR4130 pipeline is two-way superscalar, but can only issue two
27415 instructions together if the first one is 8-byte aligned.  When this
27416 option is enabled, GCC aligns pairs of instructions that it
27417 thinks should execute in parallel.
27419 This option only has an effect when optimizing for the VR4130.
27420 It normally makes code faster, but at the expense of making it bigger.
27421 It is enabled by default at optimization level @option{-O3}.
27423 @item -msynci
27424 @itemx -mno-synci
27425 @opindex msynci
27426 Enable (disable) generation of @code{synci} instructions on
27427 architectures that support it.  The @code{synci} instructions (if
27428 enabled) are generated when @code{__builtin___clear_cache} is
27429 compiled.
27431 This option defaults to @option{-mno-synci}, but the default can be
27432 overridden by configuring GCC with @option{--with-synci}.
27434 When compiling code for single processor systems, it is generally safe
27435 to use @code{synci}.  However, on many multi-core (SMP) systems, it
27436 does not invalidate the instruction caches on all cores and may lead
27437 to undefined behavior.
27439 @item -mrelax-pic-calls
27440 @itemx -mno-relax-pic-calls
27441 @opindex mrelax-pic-calls
27442 Try to turn PIC calls that are normally dispatched via register
27443 @code{$25} into direct calls.  This is only possible if the linker can
27444 resolve the destination at link time and if the destination is within
27445 range for a direct call.
27447 @option{-mrelax-pic-calls} is the default if GCC was configured to use
27448 an assembler and a linker that support the @code{.reloc} assembly
27449 directive and @option{-mexplicit-relocs} is in effect.  With
27450 @option{-mno-explicit-relocs}, this optimization can be performed by the
27451 assembler and the linker alone without help from the compiler.
27453 @item -mmcount-ra-address
27454 @itemx -mno-mcount-ra-address
27455 @opindex mmcount-ra-address
27456 @opindex mno-mcount-ra-address
27457 Emit (do not emit) code that allows @code{_mcount} to modify the
27458 calling function's return address.  When enabled, this option extends
27459 the usual @code{_mcount} interface with a new @var{ra-address}
27460 parameter, which has type @code{intptr_t *} and is passed in register
27461 @code{$12}.  @code{_mcount} can then modify the return address by
27462 doing both of the following:
27463 @itemize
27464 @item
27465 Returning the new address in register @code{$31}.
27466 @item
27467 Storing the new address in @code{*@var{ra-address}},
27468 if @var{ra-address} is nonnull.
27469 @end itemize
27471 The default is @option{-mno-mcount-ra-address}.
27473 @item -mframe-header-opt
27474 @itemx -mno-frame-header-opt
27475 @opindex mframe-header-opt
27476 Enable (disable) frame header optimization in the o32 ABI.  When using the
27477 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
27478 function to write out register arguments.  When enabled, this optimization
27479 will suppress the allocation of the frame header if it can be determined that
27480 it is unused.
27482 This optimization is off by default at all optimization levels.
27484 @item -mlxc1-sxc1
27485 @itemx -mno-lxc1-sxc1
27486 @opindex mlxc1-sxc1
27487 When applicable, enable (disable) the generation of @code{lwxc1},
27488 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
27490 @item -mmadd4
27491 @itemx -mno-madd4
27492 @opindex mmadd4
27493 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
27494 @code{madd.d} and related instructions.  Enabled by default.
27496 @end table
27498 @node MMIX Options
27499 @subsection MMIX Options
27500 @cindex MMIX Options
27502 These options are defined for the MMIX:
27504 @table @gcctabopt
27505 @item -mlibfuncs
27506 @itemx -mno-libfuncs
27507 @opindex mlibfuncs
27508 @opindex mno-libfuncs
27509 Specify that intrinsic library functions are being compiled, passing all
27510 values in registers, no matter the size.
27512 @item -mepsilon
27513 @itemx -mno-epsilon
27514 @opindex mepsilon
27515 @opindex mno-epsilon
27516 Generate floating-point comparison instructions that compare with respect
27517 to the @code{rE} epsilon register.
27519 @item -mabi=mmixware
27520 @itemx -mabi=gnu
27521 @opindex mabi=mmixware
27522 @opindex mabi=gnu
27523 Generate code that passes function parameters and return values that (in
27524 the called function) are seen as registers @code{$0} and up, as opposed to
27525 the GNU ABI which uses global registers @code{$231} and up.
27527 @item -mzero-extend
27528 @itemx -mno-zero-extend
27529 @opindex mzero-extend
27530 @opindex mno-zero-extend
27531 When reading data from memory in sizes shorter than 64 bits, use (do not
27532 use) zero-extending load instructions by default, rather than
27533 sign-extending ones.
27535 @item -mknuthdiv
27536 @itemx -mno-knuthdiv
27537 @opindex mknuthdiv
27538 @opindex mno-knuthdiv
27539 Make the result of a division yielding a remainder have the same sign as
27540 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
27541 remainder follows the sign of the dividend.  Both methods are
27542 arithmetically valid, the latter being almost exclusively used.
27544 @item -mtoplevel-symbols
27545 @itemx -mno-toplevel-symbols
27546 @opindex mtoplevel-symbols
27547 @opindex mno-toplevel-symbols
27548 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
27549 code can be used with the @code{PREFIX} assembly directive.
27551 @item -melf
27552 @opindex melf
27553 Generate an executable in the ELF format, rather than the default
27554 @samp{mmo} format used by the @command{mmix} simulator.
27556 @item -mbranch-predict
27557 @itemx -mno-branch-predict
27558 @opindex mbranch-predict
27559 @opindex mno-branch-predict
27560 Use (do not use) the probable-branch instructions, when static branch
27561 prediction indicates a probable branch.
27563 @item -mbase-addresses
27564 @itemx -mno-base-addresses
27565 @opindex mbase-addresses
27566 @opindex mno-base-addresses
27567 Generate (do not generate) code that uses @emph{base addresses}.  Using a
27568 base address automatically generates a request (handled by the assembler
27569 and the linker) for a constant to be set up in a global register.  The
27570 register is used for one or more base address requests within the range 0
27571 to 255 from the value held in the register.  The generally leads to short
27572 and fast code, but the number of different data items that can be
27573 addressed is limited.  This means that a program that uses lots of static
27574 data may require @option{-mno-base-addresses}.
27576 @item -msingle-exit
27577 @itemx -mno-single-exit
27578 @opindex msingle-exit
27579 @opindex mno-single-exit
27580 Force (do not force) generated code to have a single exit point in each
27581 function.
27582 @end table
27584 @node MN10300 Options
27585 @subsection MN10300 Options
27586 @cindex MN10300 options
27588 These @option{-m} options are defined for Matsushita MN10300 architectures:
27590 @table @gcctabopt
27591 @item -mmult-bug
27592 @opindex mmult-bug
27593 Generate code to avoid bugs in the multiply instructions for the MN10300
27594 processors.  This is the default.
27596 @item -mno-mult-bug
27597 @opindex mno-mult-bug
27598 Do not generate code to avoid bugs in the multiply instructions for the
27599 MN10300 processors.
27601 @item -mam33
27602 @opindex mam33
27603 Generate code using features specific to the AM33 processor.
27605 @item -mno-am33
27606 @opindex mno-am33
27607 Do not generate code using features specific to the AM33 processor.  This
27608 is the default.
27610 @item -mam33-2
27611 @opindex mam33-2
27612 Generate code using features specific to the AM33/2.0 processor.
27614 @item -mam34
27615 @opindex mam34
27616 Generate code using features specific to the AM34 processor.
27618 @item -mtune=@var{cpu-type}
27619 @opindex mtune
27620 Use the timing characteristics of the indicated CPU type when
27621 scheduling instructions.  This does not change the targeted processor
27622 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
27623 @samp{am33-2} or @samp{am34}.
27625 @item -mreturn-pointer-on-d0
27626 @opindex mreturn-pointer-on-d0
27627 When generating a function that returns a pointer, return the pointer
27628 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
27629 only in @code{a0}, and attempts to call such functions without a prototype
27630 result in errors.  Note that this option is on by default; use
27631 @option{-mno-return-pointer-on-d0} to disable it.
27633 @item -mno-crt0
27634 @opindex mno-crt0
27635 Do not link in the C run-time initialization object file.
27637 @item -mrelax
27638 @opindex mrelax
27639 Indicate to the linker that it should perform a relaxation optimization pass
27640 to shorten branches, calls and absolute memory addresses.  This option only
27641 has an effect when used on the command line for the final link step.
27643 This option makes symbolic debugging impossible.
27645 @item -mliw
27646 @opindex mliw
27647 Allow the compiler to generate @emph{Long Instruction Word}
27648 instructions if the target is the @samp{AM33} or later.  This is the
27649 default.  This option defines the preprocessor macro @code{__LIW__}.
27651 @item -mno-liw
27652 @opindex mno-liw
27653 Do not allow the compiler to generate @emph{Long Instruction Word}
27654 instructions.  This option defines the preprocessor macro
27655 @code{__NO_LIW__}.
27657 @item -msetlb
27658 @opindex msetlb
27659 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
27660 instructions if the target is the @samp{AM33} or later.  This is the
27661 default.  This option defines the preprocessor macro @code{__SETLB__}.
27663 @item -mno-setlb
27664 @opindex mno-setlb
27665 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
27666 instructions.  This option defines the preprocessor macro
27667 @code{__NO_SETLB__}.
27669 @end table
27671 @node Moxie Options
27672 @subsection Moxie Options
27673 @cindex Moxie Options
27675 @table @gcctabopt
27677 @item -meb
27678 @opindex meb
27679 Generate big-endian code.  This is the default for @samp{moxie-*-*}
27680 configurations.
27682 @item -mel
27683 @opindex mel
27684 Generate little-endian code.
27686 @item -mmul.x
27687 @opindex mmul.x
27688 Generate mul.x and umul.x instructions.  This is the default for
27689 @samp{moxiebox-*-*} configurations.
27691 @item -mno-crt0
27692 @opindex mno-crt0
27693 Do not link in the C run-time initialization object file.
27695 @end table
27697 @node MSP430 Options
27698 @subsection MSP430 Options
27699 @cindex MSP430 Options
27701 These options are defined for the MSP430:
27703 @table @gcctabopt
27705 @item -masm-hex
27706 @opindex masm-hex
27707 Force assembly output to always use hex constants.  Normally such
27708 constants are signed decimals, but this option is available for
27709 testsuite and/or aesthetic purposes.
27711 @item -mmcu=
27712 @opindex mmcu=
27713 Select the MCU to target.  This is used to create a C preprocessor
27714 symbol based upon the MCU name, converted to upper case and pre- and
27715 post-fixed with @samp{__}.  This in turn is used by the
27716 @file{msp430.h} header file to select an MCU-specific supplementary
27717 header file.
27719 The option also sets the ISA to use.  If the MCU name is one that is
27720 known to only support the 430 ISA then that is selected, otherwise the
27721 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
27722 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
27723 name selects the 430X ISA.
27725 In addition an MCU-specific linker script is added to the linker
27726 command line.  The script's name is the name of the MCU with
27727 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
27728 command line defines the C preprocessor symbol @code{__XXX__} and
27729 cause the linker to search for a script called @file{xxx.ld}.
27731 The ISA and hardware multiply supported for the different MCUs is hard-coded
27732 into GCC.  However, an external @samp{devices.csv} file can be used to
27733 extend device support beyond those that have been hard-coded.
27735 GCC searches for the @samp{devices.csv} file using the following methods in the
27736 given precedence order, where the first method takes precendence over the
27737 second which takes precedence over the third.
27739 @table @asis
27740 @item Include path specified with @code{-I} and @code{-L}
27741 @samp{devices.csv} will be searched for in each of the directories specified by
27742 include paths and linker library search paths.
27743 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
27744 Define the value of the global environment variable
27745 @samp{MSP430_GCC_INCLUDE_DIR}
27746 to the full path to the directory containing devices.csv, and GCC will search
27747 this directory for devices.csv.  If devices.csv is found, this directory will
27748 also be registered as an include path, and linker library path.  Header files
27749 and linker scripts in this directory can therefore be used without manually
27750 specifying @code{-I} and @code{-L} on the command line.
27751 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
27752 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
27753 toolchain root directory.  This directory does not exist in a default
27754 installation, but if the user has created it and copied @samp{devices.csv}
27755 there, then the MCU data will be read.  As above, this directory will
27756 also be registered as an include path, and linker library path.
27758 @end table
27759 If none of the above search methods find @samp{devices.csv}, then the
27760 hard-coded MCU data is used.
27763 @item -mwarn-mcu
27764 @itemx -mno-warn-mcu
27765 @opindex mwarn-mcu
27766 @opindex mno-warn-mcu
27767 This option enables or disables warnings about conflicts between the
27768 MCU name specified by the @option{-mmcu} option and the ISA set by the
27769 @option{-mcpu} option and/or the hardware multiply support set by the
27770 @option{-mhwmult} option.  It also toggles warnings about unrecognized
27771 MCU names.  This option is on by default.
27773 @item -mcpu=
27774 @opindex mcpu=
27775 Specifies the ISA to use.  Accepted values are @samp{msp430},
27776 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
27777 @option{-mmcu=} option should be used to select the ISA.
27779 @item -msim
27780 @opindex msim
27781 Link to the simulator runtime libraries and linker script.  Overrides
27782 any scripts that would be selected by the @option{-mmcu=} option.
27784 @item -mlarge
27785 @opindex mlarge
27786 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
27788 @item -msmall
27789 @opindex msmall
27790 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
27792 @item -mrelax
27793 @opindex mrelax
27794 This option is passed to the assembler and linker, and allows the
27795 linker to perform certain optimizations that cannot be done until
27796 the final link.
27798 @item mhwmult=
27799 @opindex mhwmult=
27800 Describes the type of hardware multiply supported by the target.
27801 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
27802 for the original 16-bit-only multiply supported by early MCUs.
27803 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
27804 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
27805 A value of @samp{auto} can also be given.  This tells GCC to deduce
27806 the hardware multiply support based upon the MCU name provided by the
27807 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
27808 the MCU name is not recognized then no hardware multiply support is
27809 assumed.  @code{auto} is the default setting.
27811 Hardware multiplies are normally performed by calling a library
27812 routine.  This saves space in the generated code.  When compiling at
27813 @option{-O3} or higher however the hardware multiplier is invoked
27814 inline.  This makes for bigger, but faster code.
27816 The hardware multiply routines disable interrupts whilst running and
27817 restore the previous interrupt state when they finish.  This makes
27818 them safe to use inside interrupt handlers as well as in normal code.
27820 @item -minrt
27821 @opindex minrt
27822 Enable the use of a minimum runtime environment - no static
27823 initializers or constructors.  This is intended for memory-constrained
27824 devices.  The compiler includes special symbols in some objects
27825 that tell the linker and runtime which code fragments are required.
27827 @item -mtiny-printf
27828 @opindex mtiny-printf
27829 Enable reduced code size @code{printf} and @code{puts} library functions.
27830 The @samp{tiny} implementations of these functions are not reentrant, so
27831 must be used with caution in multi-threaded applications.
27833 Support for streams has been removed and the string to be printed will
27834 always be sent to stdout via the @code{write} syscall.  The string is not
27835 buffered before it is sent to write.
27837 This option requires Newlib Nano IO, so GCC must be configured with
27838 @samp{--enable-newlib-nano-formatted-io}.
27840 @item -mmax-inline-shift=
27841 @opindex mmax-inline-shift=
27842 This option takes an integer between 0 and 64 inclusive, and sets
27843 the maximum number of inline shift instructions which should be emitted to
27844 perform a shift operation by a constant amount.  When this value needs to be
27845 exceeded, an mspabi helper function is used instead.  The default value is 4.
27847 This only affects cases where a shift by multiple positions cannot be
27848 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
27850 Shifts of a 32-bit value are at least twice as costly, so the value passed for
27851 this option is divided by 2 and the resulting value used instead.
27853 @item -mcode-region=
27854 @itemx -mdata-region=
27855 @opindex mcode-region
27856 @opindex mdata-region
27857 These options tell the compiler where to place functions and data that
27858 do not have one of the @code{lower}, @code{upper}, @code{either} or
27859 @code{section} attributes.  Possible values are @code{lower},
27860 @code{upper}, @code{either} or @code{any}.  The first three behave
27861 like the corresponding attribute.  The fourth possible value -
27862 @code{any} - is the default.  It leaves placement entirely up to the
27863 linker script and how it assigns the standard sections
27864 (@code{.text}, @code{.data}, etc) to the memory regions.
27866 @item -msilicon-errata=
27867 @opindex msilicon-errata
27868 This option passes on a request to assembler to enable the fixes for
27869 the named silicon errata.
27871 @item -msilicon-errata-warn=
27872 @opindex msilicon-errata-warn
27873 This option passes on a request to the assembler to enable warning
27874 messages when a silicon errata might need to be applied.
27876 @item -mwarn-devices-csv
27877 @itemx -mno-warn-devices-csv
27878 @opindex mwarn-devices-csv
27879 @opindex mno-warn-devices-csv
27880 Warn if @samp{devices.csv} is not found or there are problem parsing it
27881 (default: on).
27883 @end table
27885 @node NDS32 Options
27886 @subsection NDS32 Options
27887 @cindex NDS32 Options
27889 These options are defined for NDS32 implementations:
27891 @table @gcctabopt
27893 @item -mbig-endian
27894 @opindex mbig-endian
27895 Generate code in big-endian mode.
27897 @item -mlittle-endian
27898 @opindex mlittle-endian
27899 Generate code in little-endian mode.
27901 @item -mreduced-regs
27902 @opindex mreduced-regs
27903 Use reduced-set registers for register allocation.
27905 @item -mfull-regs
27906 @opindex mfull-regs
27907 Use full-set registers for register allocation.
27909 @item -mcmov
27910 @opindex mcmov
27911 Generate conditional move instructions.
27913 @item -mno-cmov
27914 @opindex mno-cmov
27915 Do not generate conditional move instructions.
27917 @item -mext-perf
27918 @opindex mext-perf
27919 Generate performance extension instructions.
27921 @item -mno-ext-perf
27922 @opindex mno-ext-perf
27923 Do not generate performance extension instructions.
27925 @item -mext-perf2
27926 @opindex mext-perf2
27927 Generate performance extension 2 instructions.
27929 @item -mno-ext-perf2
27930 @opindex mno-ext-perf2
27931 Do not generate performance extension 2 instructions.
27933 @item -mext-string
27934 @opindex mext-string
27935 Generate string extension instructions.
27937 @item -mno-ext-string
27938 @opindex mno-ext-string
27939 Do not generate string extension instructions.
27941 @item -mv3push
27942 @opindex mv3push
27943 Generate v3 push25/pop25 instructions.
27945 @item -mno-v3push
27946 @opindex mno-v3push
27947 Do not generate v3 push25/pop25 instructions.
27949 @item -m16-bit
27950 @opindex m16-bit
27951 Generate 16-bit instructions.
27953 @item -mno-16-bit
27954 @opindex mno-16-bit
27955 Do not generate 16-bit instructions.
27957 @item -misr-vector-size=@var{num}
27958 @opindex misr-vector-size
27959 Specify the size of each interrupt vector, which must be 4 or 16.
27961 @item -mcache-block-size=@var{num}
27962 @opindex mcache-block-size
27963 Specify the size of each cache block,
27964 which must be a power of 2 between 4 and 512.
27966 @item -march=@var{arch}
27967 @opindex march
27968 Specify the name of the target architecture.
27970 @item -mcmodel=@var{code-model}
27971 @opindex mcmodel
27972 Set the code model to one of
27973 @table @asis
27974 @item @samp{small}
27975 All the data and read-only data segments must be within 512KB addressing space.
27976 The text segment must be within 16MB addressing space.
27977 @item @samp{medium}
27978 The data segment must be within 512KB while the read-only data segment can be
27979 within 4GB addressing space.  The text segment should be still within 16MB
27980 addressing space.
27981 @item @samp{large}
27982 All the text and data segments can be within 4GB addressing space.
27983 @end table
27985 @item -mctor-dtor
27986 @opindex mctor-dtor
27987 Enable constructor/destructor feature.
27989 @item -mrelax
27990 @opindex mrelax
27991 Guide linker to relax instructions.
27993 @end table
27995 @node Nios II Options
27996 @subsection Nios II Options
27997 @cindex Nios II options
27998 @cindex Altera Nios II options
28000 These are the options defined for the Altera Nios II processor.
28002 @table @gcctabopt
28004 @item -G @var{num}
28005 @opindex G
28006 @cindex smaller data references
28007 Put global and static objects less than or equal to @var{num} bytes
28008 into the small data or BSS sections instead of the normal data or BSS
28009 sections.  The default value of @var{num} is 8.
28011 @item -mgpopt=@var{option}
28012 @itemx -mgpopt
28013 @itemx -mno-gpopt
28014 @opindex mgpopt
28015 @opindex mno-gpopt
28016 Generate (do not generate) GP-relative accesses.  The following 
28017 @var{option} names are recognized:
28019 @table @samp
28021 @item none
28022 Do not generate GP-relative accesses.
28024 @item local
28025 Generate GP-relative accesses for small data objects that are not 
28026 external, weak, or uninitialized common symbols.  
28027 Also use GP-relative addressing for objects that
28028 have been explicitly placed in a small data section via a @code{section}
28029 attribute.
28031 @item global
28032 As for @samp{local}, but also generate GP-relative accesses for
28033 small data objects that are external, weak, or common.  If you use this option,
28034 you must ensure that all parts of your program (including libraries) are
28035 compiled with the same @option{-G} setting.
28037 @item data
28038 Generate GP-relative accesses for all data objects in the program.  If you
28039 use this option, the entire data and BSS segments
28040 of your program must fit in 64K of memory and you must use an appropriate
28041 linker script to allocate them within the addressable range of the
28042 global pointer.
28044 @item all
28045 Generate GP-relative addresses for function pointers as well as data
28046 pointers.  If you use this option, the entire text, data, and BSS segments
28047 of your program must fit in 64K of memory and you must use an appropriate
28048 linker script to allocate them within the addressable range of the
28049 global pointer.
28051 @end table
28053 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
28054 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
28056 The default is @option{-mgpopt} except when @option{-fpic} or
28057 @option{-fPIC} is specified to generate position-independent code.
28058 Note that the Nios II ABI does not permit GP-relative accesses from
28059 shared libraries.
28061 You may need to specify @option{-mno-gpopt} explicitly when building
28062 programs that include large amounts of small data, including large
28063 GOT data sections.  In this case, the 16-bit offset for GP-relative
28064 addressing may not be large enough to allow access to the entire 
28065 small data section.
28067 @item -mgprel-sec=@var{regexp}
28068 @opindex mgprel-sec
28069 This option specifies additional section names that can be accessed via
28070 GP-relative addressing.  It is most useful in conjunction with 
28071 @code{section} attributes on variable declarations 
28072 (@pxref{Common Variable Attributes}) and a custom linker script.  
28073 The @var{regexp} is a POSIX Extended Regular Expression.
28075 This option does not affect the behavior of the @option{-G} option, and 
28076 the specified sections are in addition to the standard @code{.sdata}
28077 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
28079 @item -mr0rel-sec=@var{regexp}
28080 @opindex mr0rel-sec
28081 This option specifies names of sections that can be accessed via a 
28082 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
28083 of the 32-bit address space.  It is most useful in conjunction with 
28084 @code{section} attributes on variable declarations 
28085 (@pxref{Common Variable Attributes}) and a custom linker script.  
28086 The @var{regexp} is a POSIX Extended Regular Expression.
28088 In contrast to the use of GP-relative addressing for small data, 
28089 zero-based addressing is never generated by default and there are no 
28090 conventional section names used in standard linker scripts for sections
28091 in the low or high areas of memory.
28093 @item -mel
28094 @itemx -meb
28095 @opindex mel
28096 @opindex meb
28097 Generate little-endian (default) or big-endian (experimental) code,
28098 respectively.
28100 @item -march=@var{arch}
28101 @opindex march
28102 This specifies the name of the target Nios II architecture.  GCC uses this
28103 name to determine what kind of instructions it can emit when generating
28104 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
28106 The preprocessor macro @code{__nios2_arch__} is available to programs,
28107 with value 1 or 2, indicating the targeted ISA level.
28109 @item -mbypass-cache
28110 @itemx -mno-bypass-cache
28111 @opindex mno-bypass-cache
28112 @opindex mbypass-cache
28113 Force all load and store instructions to always bypass cache by 
28114 using I/O variants of the instructions. The default is not to
28115 bypass the cache.
28117 @item -mno-cache-volatile 
28118 @itemx -mcache-volatile       
28119 @opindex mcache-volatile 
28120 @opindex mno-cache-volatile
28121 Volatile memory access bypass the cache using the I/O variants of 
28122 the load and store instructions. The default is not to bypass the cache.
28124 @item -mno-fast-sw-div
28125 @itemx -mfast-sw-div
28126 @opindex mno-fast-sw-div
28127 @opindex mfast-sw-div
28128 Do not use table-based fast divide for small numbers. The default 
28129 is to use the fast divide at @option{-O3} and above.
28131 @item -mno-hw-mul
28132 @itemx -mhw-mul
28133 @itemx -mno-hw-mulx
28134 @itemx -mhw-mulx
28135 @itemx -mno-hw-div
28136 @itemx -mhw-div
28137 @opindex mno-hw-mul
28138 @opindex mhw-mul
28139 @opindex mno-hw-mulx
28140 @opindex mhw-mulx
28141 @opindex mno-hw-div
28142 @opindex mhw-div
28143 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
28144 instructions by the compiler. The default is to emit @code{mul}
28145 and not emit @code{div} and @code{mulx}.
28147 @item -mbmx
28148 @itemx -mno-bmx
28149 @itemx -mcdx
28150 @itemx -mno-cdx
28151 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28152 CDX (code density) instructions.  Enabling these instructions also
28153 requires @option{-march=r2}.  Since these instructions are optional
28154 extensions to the R2 architecture, the default is not to emit them.
28156 @item -mcustom-@var{insn}=@var{N}
28157 @itemx -mno-custom-@var{insn}
28158 @opindex mcustom-@var{insn}
28159 @opindex mno-custom-@var{insn}
28160 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28161 custom instruction with encoding @var{N} when generating code that uses 
28162 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
28163 instruction 253 for single-precision floating-point add operations instead
28164 of the default behavior of using a library call.
28166 The following values of @var{insn} are supported.  Except as otherwise
28167 noted, floating-point operations are expected to be implemented with
28168 normal IEEE 754 semantics and correspond directly to the C operators or the
28169 equivalent GCC built-in functions (@pxref{Other Builtins}).
28171 Single-precision floating point:
28172 @table @asis
28174 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28175 Binary arithmetic operations.
28177 @item @samp{fnegs}
28178 Unary negation.
28180 @item @samp{fabss}
28181 Unary absolute value.
28183 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
28184 Comparison operations.
28186 @item @samp{fmins}, @samp{fmaxs}
28187 Floating-point minimum and maximum.  These instructions are only
28188 generated if @option{-ffinite-math-only} is specified.
28190 @item @samp{fsqrts}
28191 Unary square root operation.
28193 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
28194 Floating-point trigonometric and exponential functions.  These instructions
28195 are only generated if @option{-funsafe-math-optimizations} is also specified.
28197 @end table
28199 Double-precision floating point:
28200 @table @asis
28202 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
28203 Binary arithmetic operations.
28205 @item @samp{fnegd}
28206 Unary negation.
28208 @item @samp{fabsd}
28209 Unary absolute value.
28211 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
28212 Comparison operations.
28214 @item @samp{fmind}, @samp{fmaxd}
28215 Double-precision minimum and maximum.  These instructions are only
28216 generated if @option{-ffinite-math-only} is specified.
28218 @item @samp{fsqrtd}
28219 Unary square root operation.
28221 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
28222 Double-precision trigonometric and exponential functions.  These instructions
28223 are only generated if @option{-funsafe-math-optimizations} is also specified.
28225 @end table
28227 Conversions:
28228 @table @asis
28229 @item @samp{fextsd}
28230 Conversion from single precision to double precision.
28232 @item @samp{ftruncds}
28233 Conversion from double precision to single precision.
28235 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
28236 Conversion from floating point to signed or unsigned integer types, with
28237 truncation towards zero.
28239 @item @samp{round}
28240 Conversion from single-precision floating point to signed integer,
28241 rounding to the nearest integer and ties away from zero.
28242 This corresponds to the @code{__builtin_lroundf} function when
28243 @option{-fno-math-errno} is used.
28245 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
28246 Conversion from signed or unsigned integer types to floating-point types.
28248 @end table
28250 In addition, all of the following transfer instructions for internal
28251 registers X and Y must be provided to use any of the double-precision
28252 floating-point instructions.  Custom instructions taking two
28253 double-precision source operands expect the first operand in the
28254 64-bit register X.  The other operand (or only operand of a unary
28255 operation) is given to the custom arithmetic instruction with the
28256 least significant half in source register @var{src1} and the most
28257 significant half in @var{src2}.  A custom instruction that returns a
28258 double-precision result returns the most significant 32 bits in the
28259 destination register and the other half in 32-bit register Y.  
28260 GCC automatically generates the necessary code sequences to write
28261 register X and/or read register Y when double-precision floating-point
28262 instructions are used.
28264 @table @asis
28266 @item @samp{fwrx}
28267 Write @var{src1} into the least significant half of X and @var{src2} into
28268 the most significant half of X.
28270 @item @samp{fwry}
28271 Write @var{src1} into Y.
28273 @item @samp{frdxhi}, @samp{frdxlo}
28274 Read the most or least (respectively) significant half of X and store it in
28275 @var{dest}.
28277 @item @samp{frdy}
28278 Read the value of Y and store it into @var{dest}.
28279 @end table
28281 Note that you can gain more local control over generation of Nios II custom
28282 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
28283 and @code{target("no-custom-@var{insn}")} function attributes
28284 (@pxref{Function Attributes})
28285 or pragmas (@pxref{Function Specific Option Pragmas}).
28287 @item -mcustom-fpu-cfg=@var{name}
28288 @opindex mcustom-fpu-cfg
28290 This option enables a predefined, named set of custom instruction encodings
28291 (see @option{-mcustom-@var{insn}} above).  
28292 Currently, the following sets are defined:
28294 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
28295 @gccoptlist{-mcustom-fmuls=252 @gol
28296 -mcustom-fadds=253 @gol
28297 -mcustom-fsubs=254 @gol
28298 -fsingle-precision-constant}
28300 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
28301 @gccoptlist{-mcustom-fmuls=252 @gol
28302 -mcustom-fadds=253 @gol
28303 -mcustom-fsubs=254 @gol
28304 -mcustom-fdivs=255 @gol
28305 -fsingle-precision-constant}
28307 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
28308 @gccoptlist{-mcustom-floatus=243 @gol
28309 -mcustom-fixsi=244 @gol
28310 -mcustom-floatis=245 @gol
28311 -mcustom-fcmpgts=246 @gol
28312 -mcustom-fcmples=249 @gol
28313 -mcustom-fcmpeqs=250 @gol
28314 -mcustom-fcmpnes=251 @gol
28315 -mcustom-fmuls=252 @gol
28316 -mcustom-fadds=253 @gol
28317 -mcustom-fsubs=254 @gol
28318 -mcustom-fdivs=255 @gol
28319 -fsingle-precision-constant}
28321 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
28322 @gccoptlist{-mcustom-fabss=224 @gol
28323 -mcustom-fnegs=225 @gol
28324 -mcustom-fcmpnes=226 @gol
28325 -mcustom-fcmpeqs=227 @gol
28326 -mcustom-fcmpges=228 @gol
28327 -mcustom-fcmpgts=229 @gol
28328 -mcustom-fcmples=230 @gol
28329 -mcustom-fcmplts=231 @gol
28330 -mcustom-fmaxs=232 @gol
28331 -mcustom-fmins=233 @gol
28332 -mcustom-round=248 @gol
28333 -mcustom-fixsi=249 @gol
28334 -mcustom-floatis=250 @gol
28335 -mcustom-fsqrts=251 @gol
28336 -mcustom-fmuls=252 @gol
28337 -mcustom-fadds=253 @gol
28338 -mcustom-fsubs=254 @gol
28339 -mcustom-fdivs=255 @gol}
28341 Custom instruction assignments given by individual
28342 @option{-mcustom-@var{insn}=} options override those given by
28343 @option{-mcustom-fpu-cfg=}, regardless of the
28344 order of the options on the command line.
28346 Note that you can gain more local control over selection of a FPU
28347 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
28348 function attribute (@pxref{Function Attributes})
28349 or pragma (@pxref{Function Specific Option Pragmas}).
28351 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
28352 Hardware 2 Component}.  Please note that the custom instructions enabled by
28353 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
28354 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
28355 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
28356 specified.  In contrast to the other configurations,
28357 @option{-fsingle-precision-constant} is not set.
28359 @end table
28361 These additional @samp{-m} options are available for the Altera Nios II
28362 ELF (bare-metal) target:
28364 @table @gcctabopt
28366 @item -mhal
28367 @opindex mhal
28368 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
28369 startup and termination code, and is typically used in conjunction with
28370 @option{-msys-crt0=} to specify the location of the alternate startup code
28371 provided by the HAL BSP.
28373 @item -msmallc
28374 @opindex msmallc
28375 Link with a limited version of the C library, @option{-lsmallc}, rather than
28376 Newlib.
28378 @item -msys-crt0=@var{startfile}
28379 @opindex msys-crt0
28380 @var{startfile} is the file name of the startfile (crt0) to use 
28381 when linking.  This option is only useful in conjunction with @option{-mhal}.
28383 @item -msys-lib=@var{systemlib}
28384 @opindex msys-lib
28385 @var{systemlib} is the library name of the library that provides
28386 low-level system calls required by the C library,
28387 e.g.@: @code{read} and @code{write}.
28388 This option is typically used to link with a library provided by a HAL BSP.
28390 @end table
28392 @node Nvidia PTX Options
28393 @subsection Nvidia PTX Options
28394 @cindex Nvidia PTX options
28395 @cindex nvptx options
28397 These options are defined for Nvidia PTX:
28399 @table @gcctabopt
28401 @item -m64
28402 @opindex m64
28403 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
28404 supported.
28406 @item -march=@var{architecture-string}
28407 @opindex march
28408 Generate code for the specified PTX ISA target architecture
28409 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
28410 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
28411 @samp{sm_80}.
28412 The default depends on how the compiler has been configured, see
28413 @option{--with-arch}.
28415 This option sets the value of the preprocessor macro
28416 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
28417 @samp{350}.
28419 @item -misa=@var{architecture-string}
28420 @opindex misa
28421 Alias of @option{-march=}.
28423 @item -march-map=@var{architecture-string}
28424 @opindex march
28425 Select the closest available @option{-march=} value that is not more
28426 capable.  For instance, for @option{-march-map=sm_50} select
28427 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
28428 @option{-march=sm_53}.
28430 @item -mptx=@var{version-string}
28431 @opindex mptx
28432 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
28433 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
28434 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
28435 version is required for specified PTX ISA target architecture via
28436 option @option{-march=}.
28438 This option sets the values of the preprocessor macros
28439 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
28440 for instance, for @samp{3.1} the macros have the values @samp{3} and
28441 @samp{1}, respectively.
28443 @item -mmainkernel
28444 @opindex mmainkernel
28445 Link in code for a __main kernel.  This is for stand-alone instead of
28446 offloading execution.
28448 @item -moptimize
28449 @opindex moptimize
28450 Apply partitioned execution optimizations.  This is the default when any
28451 level of optimization is selected.
28453 @item -msoft-stack
28454 @opindex msoft-stack
28455 Generate code that does not use @code{.local} memory
28456 directly for stack storage. Instead, a per-warp stack pointer is
28457 maintained explicitly. This enables variable-length stack allocation (with
28458 variable-length arrays or @code{alloca}), and when global memory is used for
28459 underlying storage, makes it possible to access automatic variables from other
28460 threads, or with atomic instructions. This code generation variant is used
28461 for OpenMP offloading, but the option is exposed on its own for the purpose
28462 of testing the compiler; to generate code suitable for linking into programs
28463 using OpenMP offloading, use option @option{-mgomp}.
28465 @item -muniform-simt
28466 @opindex muniform-simt
28467 Switch to code generation variant that allows to execute all threads in each
28468 warp, while maintaining memory state and side effects as if only one thread
28469 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
28470 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
28471 current lane index equals the master lane index), and the register being
28472 assigned is copied via a shuffle instruction from the master lane.  Outside of
28473 SIMD regions lane 0 is the master; inside, each thread sees itself as the
28474 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
28475 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
28476 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
28477 with current lane index to compute the master lane index.
28479 @item -mgomp
28480 @opindex mgomp
28481 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
28482 @option{-muniform-simt} options, and selects corresponding multilib variant.
28484 @end table
28486 @node OpenRISC Options
28487 @subsection OpenRISC Options
28488 @cindex OpenRISC Options
28490 These options are defined for OpenRISC:
28492 @table @gcctabopt
28494 @item -mboard=@var{name}
28495 @opindex mboard
28496 Configure a board specific runtime.  This will be passed to the linker for
28497 newlib board library linking.  The default is @code{or1ksim}.
28499 @item -mnewlib
28500 @opindex mnewlib
28501 This option is ignored; it is for compatibility purposes only.  This used to
28502 select linker and preprocessor options for use with newlib.
28504 @item -msoft-div
28505 @itemx -mhard-div
28506 @opindex msoft-div
28507 @opindex mhard-div
28508 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
28509 This default is hardware divide.
28511 @item -msoft-mul
28512 @itemx -mhard-mul
28513 @opindex msoft-mul
28514 @opindex mhard-mul
28515 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
28516 This default is hardware multiply.
28518 @item -msoft-float
28519 @itemx -mhard-float
28520 @opindex msoft-float
28521 @opindex mhard-float
28522 Select software or hardware for floating point operations.
28523 The default is software.
28525 @item -mdouble-float
28526 @opindex mdouble-float
28527 When @option{-mhard-float} is selected, enables generation of double-precision
28528 floating point instructions.  By default functions from @file{libgcc} are used
28529 to perform double-precision floating point operations.
28531 @item -munordered-float
28532 @opindex munordered-float
28533 When @option{-mhard-float} is selected, enables generation of unordered
28534 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
28535 functions from @file{libgcc} are used to perform unordered floating point
28536 compare and set flag operations.
28538 @item -mcmov
28539 @opindex mcmov
28540 Enable generation of conditional move (@code{l.cmov}) instructions.  By
28541 default the equivalent will be generated using set and branch.
28543 @item -mror
28544 @opindex mror
28545 Enable generation of rotate right (@code{l.ror}) instructions.  By default
28546 functions from @file{libgcc} are used to perform rotate right operations.
28548 @item -mrori
28549 @opindex mrori
28550 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
28551 By default functions from @file{libgcc} are used to perform rotate right with
28552 immediate operations.
28554 @item -msext
28555 @opindex msext
28556 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
28557 memory loads are used to perform sign extension.
28559 @item -msfimm
28560 @opindex msfimm
28561 Enable generation of compare and set flag with immediate (@code{l.sf*i})
28562 instructions.  By default extra instructions will be generated to store the
28563 immediate to a register first.
28565 @item -mshftimm
28566 @opindex mshftimm
28567 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
28568 @code{l.slli}) instructions.  By default extra instructions will be generated
28569 to store the immediate to a register first.
28571 @item -mcmodel=small
28572 @opindex mcmodel=small
28573 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
28574 the default model.
28576 @item -mcmodel=large
28577 @opindex mcmodel=large
28578 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
28581 @end table
28583 @node PDP-11 Options
28584 @subsection PDP-11 Options
28585 @cindex PDP-11 Options
28587 These options are defined for the PDP-11:
28589 @table @gcctabopt
28590 @item -mfpu
28591 @opindex mfpu
28592 Use hardware FPP floating point.  This is the default.  (FIS floating
28593 point on the PDP-11/40 is not supported.)  Implies -m45.
28595 @item -msoft-float
28596 @opindex msoft-float
28597 Do not use hardware floating point.
28599 @item -mac0
28600 @opindex mac0
28601 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
28603 @item -mno-ac0
28604 @opindex mno-ac0
28605 Return floating-point results in memory.  This is the default.
28607 @item -m40
28608 @opindex m40
28609 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
28611 @item -m45
28612 @opindex m45
28613 Generate code for a PDP-11/45.  This is the default.
28615 @item -m10
28616 @opindex m10
28617 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
28619 @item -mint16
28620 @itemx -mno-int32
28621 @opindex mint16
28622 @opindex mno-int32
28623 Use 16-bit @code{int}.  This is the default.
28625 @item -mint32
28626 @itemx -mno-int16
28627 @opindex mint32
28628 @opindex mno-int16
28629 Use 32-bit @code{int}.
28631 @item -msplit
28632 @opindex msplit
28633 Target has split instruction and data space.  Implies -m45.
28635 @item -munix-asm
28636 @opindex munix-asm
28637 Use Unix assembler syntax.
28639 @item -mdec-asm
28640 @opindex mdec-asm
28641 Use DEC assembler syntax.
28643 @item -mgnu-asm
28644 @opindex mgnu-asm
28645 Use GNU assembler syntax.  This is the default.
28647 @item -mlra
28648 @opindex mlra
28649 Use the new LRA register allocator.  By default, the old ``reload''
28650 allocator is used.
28651 @end table
28653 @node PowerPC Options
28654 @subsection PowerPC Options
28655 @cindex PowerPC options
28657 These are listed under @xref{RS/6000 and PowerPC Options}.
28659 @node PRU Options
28660 @subsection PRU Options
28661 @cindex PRU Options
28663 These command-line options are defined for PRU target:
28665 @table @gcctabopt
28666 @item -minrt
28667 @opindex minrt
28668 Link with a minimum runtime environment, with no support for static
28669 initializers and constructors.  Using this option can significantly reduce
28670 the size of the final ELF binary.  Beware that the compiler could still
28671 generate code with static initializers and constructors.  It is up to the
28672 programmer to ensure that the source program will not use those features.
28674 @item -mmcu=@var{mcu}
28675 @opindex mmcu
28676 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
28677 supported MCUs.
28679 @item -mno-relax
28680 @opindex mno-relax
28681 Make GCC pass the @option{--no-relax} command-line option to the linker
28682 instead of the @option{--relax} option.
28684 @item -mloop
28685 @opindex mloop
28686 Allow (or do not allow) GCC to use the LOOP instruction.
28688 @item -mabi=@var{variant}
28689 @opindex mabi
28690 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
28691 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
28692 more naturally with certain GCC assumptions.  These are the differences:
28694 @table @samp
28695 @item Function Pointer Size
28696 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
28697 supports only 32-bit data and code pointers.
28699 @item Optional Return Value Pointer
28700 Function return values larger than 64 bits are passed by using a hidden
28701 pointer as the first argument of the function.  TI ABI, though, mandates that
28702 the pointer can be NULL in case the caller is not using the returned value.
28703 GNU always passes and expects a valid return value pointer.
28705 @end table
28707 The current @option{-mabi=ti} implementation simply raises a compile error
28708 when any of the above code constructs is detected.  As a consequence
28709 the standard C library cannot be built and it is omitted when linking with
28710 @option{-mabi=ti}.
28712 Relaxation is a GNU feature and for safety reasons is disabled when using
28713 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
28714 instructions, so the GNU linker cannot adjust them when shortening adjacent
28715 LDI32 pseudo instructions.
28717 @end table
28719 @node RISC-V Options
28720 @subsection RISC-V Options
28721 @cindex RISC-V Options
28723 These command-line options are defined for RISC-V targets:
28725 @table @gcctabopt
28726 @item -mbranch-cost=@var{n}
28727 @opindex mbranch-cost
28728 Set the cost of branches to roughly @var{n} instructions.
28730 @item -mplt
28731 @itemx -mno-plt
28732 @opindex plt
28733 When generating PIC code, do or don't allow the use of PLTs. Ignored for
28734 non-PIC.  The default is @option{-mplt}.
28736 @item -mabi=@var{ABI-string}
28737 @opindex mabi
28738 Specify integer and floating-point calling convention.  @var{ABI-string}
28739 contains two parts: the size of integer types and the registers used for
28740 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
28741 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
28742 32-bit), and that floating-point values up to 64 bits wide are passed in F
28743 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
28744 allows the compiler to generate code that uses the F and D extensions but only
28745 allows floating-point values up to 32 bits long to be passed in registers; or
28746 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
28747 passed in registers.
28749 The default for this argument is system dependent, users who want a specific
28750 calling convention should specify one explicitly.  The valid calling
28751 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
28752 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
28753 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
28754 invalid because the ABI requires 64-bit values be passed in F registers, but F
28755 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
28756 only be used with the @samp{rv32e} architecture.  This ABI is not well
28757 specified at present, and is subject to change.
28759 @item -mfdiv
28760 @itemx -mno-fdiv
28761 @opindex mfdiv
28762 Do or don't use hardware floating-point divide and square root instructions.
28763 This requires the F or D extensions for floating-point registers.  The default
28764 is to use them if the specified architecture has these instructions.
28766 @item -mdiv
28767 @itemx -mno-div
28768 @opindex mdiv
28769 Do or don't use hardware instructions for integer division.  This requires the
28770 M extension.  The default is to use them if the specified architecture has
28771 these instructions.
28773 @item -misa-spec=@var{ISA-spec-string}
28774 @opindex misa-spec
28775 Specify the version of the RISC-V Unprivileged (formerly User-Level)
28776 ISA specification to produce code conforming to.  The possibilities
28777 for @var{ISA-spec-string} are:
28778 @table @code
28779 @item 2.2
28780 Produce code conforming to version 2.2.
28781 @item 20190608
28782 Produce code conforming to version 20190608.
28783 @item 20191213
28784 Produce code conforming to version 20191213.
28785 @end table
28786 The default is @option{-misa-spec=20191213} unless GCC has been configured
28787 with @option{--with-isa-spec=} specifying a different default version.
28789 @item -march=@var{ISA-string}
28790 @opindex march
28791 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
28792 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
28793 @samp{rv32imaf}.
28795 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
28797 If both @option{-march} and @option{-mcpu=} are not specified, the default for
28798 this argument is system dependent, users who want a specific architecture
28799 extensions should specify one explicitly.
28801 @item -mcpu=@var{processor-string}
28802 @opindex mcpu
28803 Use architecture of and optimize the output for the given processor, specified
28804 by particular CPU name.
28805 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
28806 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
28807 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
28808 @samp{sifive-u54}, and @samp{sifive-u74}.
28810 @item -mtune=@var{processor-string}
28811 @opindex mtune
28812 Optimize the output for the given processor, specified by microarchitecture or
28813 particular CPU name.  Permissible values for this option are: @samp{rocket},
28814 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
28815 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
28817 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
28818 the default is @samp{rocket} if both are not specified.
28820 The @samp{size} choice is not intended for use by end-users.  This is used
28821 when @option{-Os} is specified.  It overrides the instruction cost info
28822 provided by @option{-mtune=}, but does not override the pipeline info.  This
28823 helps reduce code size while still giving good performance.
28825 @item -mpreferred-stack-boundary=@var{num}
28826 @opindex mpreferred-stack-boundary
28827 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28828 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
28829 the default is 4 (16 bytes or 128-bits).
28831 @strong{Warning:} If you use this switch, then you must build all modules with
28832 the same value, including any libraries.  This includes the system libraries
28833 and startup modules.
28835 @item -msmall-data-limit=@var{n}
28836 @opindex msmall-data-limit
28837 Put global and static data smaller than @var{n} bytes into a special section
28838 (on some targets).
28840 @item -msave-restore
28841 @itemx -mno-save-restore
28842 @opindex msave-restore
28843 Do or don't use smaller but slower prologue and epilogue code that uses
28844 library function calls.  The default is to use fast inline prologues and
28845 epilogues.
28847 @item -mshorten-memrefs
28848 @itemx -mno-shorten-memrefs
28849 @opindex mshorten-memrefs
28850 Do or do not attempt to make more use of compressed load/store instructions by
28851 replacing a load/store of 'base register + large offset' with a new load/store
28852 of 'new base + small offset'.  If the new base gets stored in a compressed
28853 register, then the new load/store can be compressed.  Currently targets 32-bit
28854 integer load/stores only.
28856 @item -mstrict-align
28857 @itemx -mno-strict-align
28858 @opindex mstrict-align
28859 Do not or do generate unaligned memory accesses.  The default is set depending
28860 on whether the processor we are optimizing for supports fast unaligned access
28861 or not.
28863 @item -mcmodel=medlow
28864 @opindex mcmodel=medlow
28865 Generate code for the medium-low code model. The program and its statically
28866 defined symbols must lie within a single 2 GiB address range and must lie
28867 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
28868 statically or dynamically linked. This is the default code model.
28870 @item -mcmodel=medany
28871 @opindex mcmodel=medany
28872 Generate code for the medium-any code model. The program and its statically
28873 defined symbols must be within any single 2 GiB address range. Programs can be
28874 statically or dynamically linked.
28876 The code generated by the medium-any code model is position-independent, but is
28877 not guaranteed to function correctly when linked into position-independent
28878 executables or libraries.
28880 @item -mexplicit-relocs
28881 @itemx -mno-exlicit-relocs
28882 Use or do not use assembler relocation operators when dealing with symbolic
28883 addresses.  The alternative is to use assembler macros instead, which may
28884 limit optimization.
28886 @item -mrelax
28887 @itemx -mno-relax
28888 @opindex mrelax
28889 Take advantage of linker relaxations to reduce the number of instructions
28890 required to materialize symbol addresses. The default is to take advantage of
28891 linker relaxations.
28893 @item -mriscv-attribute
28894 @itemx -mno-riscv-attribute
28895 @opindex mriscv-attribute
28896 Emit (do not emit) RISC-V attribute to record extra information into ELF
28897 objects.  This feature requires at least binutils 2.32.
28899 @item -mcsr-check
28900 @itemx -mno-csr-check
28901 @opindex mcsr-check
28902 Enables or disables the CSR checking.
28904 @item -malign-data=@var{type}
28905 @opindex malign-data
28906 Control how GCC aligns variables and constants of array, structure, or union
28907 types.  Supported values for @var{type} are @samp{xlen} which uses x register
28908 width as the alignment value, and @samp{natural} which uses natural alignment.
28909 @samp{xlen} is the default.
28911 @item -mbig-endian
28912 @opindex mbig-endian
28913 Generate big-endian code.  This is the default when GCC is configured for a
28914 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
28916 @item -mlittle-endian
28917 @opindex mlittle-endian
28918 Generate little-endian code.  This is the default when GCC is configured for a
28919 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
28920 @samp{riscv32be-*-*} target.
28922 @item -mstack-protector-guard=@var{guard}
28923 @itemx -mstack-protector-guard-reg=@var{reg}
28924 @itemx -mstack-protector-guard-offset=@var{offset}
28925 @opindex mstack-protector-guard
28926 @opindex mstack-protector-guard-reg
28927 @opindex mstack-protector-guard-offset
28928 Generate stack protection code using canary at @var{guard}.  Supported
28929 locations are @samp{global} for a global canary or @samp{tls} for per-thread
28930 canary in the TLS block.
28932 With the latter choice the options
28933 @option{-mstack-protector-guard-reg=@var{reg}} and
28934 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28935 which register to use as base register for reading the canary,
28936 and from what offset from that base register. There is no default
28937 register or offset as this is entirely for use within the Linux
28938 kernel.
28939 @end table
28941 @node RL78 Options
28942 @subsection RL78 Options
28943 @cindex RL78 Options
28945 @table @gcctabopt
28947 @item -msim
28948 @opindex msim
28949 Links in additional target libraries to support operation within a
28950 simulator.
28952 @item -mmul=none
28953 @itemx -mmul=g10
28954 @itemx -mmul=g13
28955 @itemx -mmul=g14
28956 @itemx -mmul=rl78
28957 @opindex mmul
28958 Specifies the type of hardware multiplication and division support to
28959 be used.  The simplest is @code{none}, which uses software for both
28960 multiplication and division.  This is the default.  The @code{g13}
28961 value is for the hardware multiply/divide peripheral found on the
28962 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
28963 the multiplication and division instructions supported by the RL78/G14
28964 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
28965 the value @code{mg10} is an alias for @code{none}.
28967 In addition a C preprocessor macro is defined, based upon the setting
28968 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
28969 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
28971 @item -mcpu=g10
28972 @itemx -mcpu=g13
28973 @itemx -mcpu=g14
28974 @itemx -mcpu=rl78
28975 @opindex mcpu
28976 Specifies the RL78 core to target.  The default is the G14 core, also
28977 known as an S3 core or just RL78.  The G13 or S2 core does not have
28978 multiply or divide instructions, instead it uses a hardware peripheral
28979 for these operations.  The G10 or S1 core does not have register
28980 banks, so it uses a different calling convention.
28982 If this option is set it also selects the type of hardware multiply
28983 support to use, unless this is overridden by an explicit
28984 @option{-mmul=none} option on the command line.  Thus specifying
28985 @option{-mcpu=g13} enables the use of the G13 hardware multiply
28986 peripheral and specifying @option{-mcpu=g10} disables the use of
28987 hardware multiplications altogether.
28989 Note, although the RL78/G14 core is the default target, specifying
28990 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
28991 change the behavior of the toolchain since it also enables G14
28992 hardware multiply support.  If these options are not specified on the
28993 command line then software multiplication routines will be used even
28994 though the code targets the RL78 core.  This is for backwards
28995 compatibility with older toolchains which did not have hardware
28996 multiply and divide support.
28998 In addition a C preprocessor macro is defined, based upon the setting
28999 of this option.  Possible values are: @code{__RL78_G10__},
29000 @code{__RL78_G13__} or @code{__RL78_G14__}.
29002 @item -mg10
29003 @itemx -mg13
29004 @itemx -mg14
29005 @itemx -mrl78
29006 @opindex mg10
29007 @opindex mg13
29008 @opindex mg14
29009 @opindex mrl78
29010 These are aliases for the corresponding @option{-mcpu=} option.  They
29011 are provided for backwards compatibility.
29013 @item -mallregs
29014 @opindex mallregs
29015 Allow the compiler to use all of the available registers.  By default
29016 registers @code{r24..r31} are reserved for use in interrupt handlers.
29017 With this option enabled these registers can be used in ordinary
29018 functions as well.
29020 @item -m64bit-doubles
29021 @itemx -m32bit-doubles
29022 @opindex m64bit-doubles
29023 @opindex m32bit-doubles
29024 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
29025 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
29026 @option{-m32bit-doubles}.
29028 @item -msave-mduc-in-interrupts
29029 @itemx -mno-save-mduc-in-interrupts
29030 @opindex msave-mduc-in-interrupts
29031 @opindex mno-save-mduc-in-interrupts
29032 Specifies that interrupt handler functions should preserve the
29033 MDUC registers.  This is only necessary if normal code might use
29034 the MDUC registers, for example because it performs multiplication
29035 and division operations.  The default is to ignore the MDUC registers
29036 as this makes the interrupt handlers faster.  The target option -mg13
29037 needs to be passed for this to work as this feature is only available
29038 on the G13 target (S2 core).  The MDUC registers will only be saved
29039 if the interrupt handler performs a multiplication or division
29040 operation or it calls another function.
29042 @end table
29044 @node RS/6000 and PowerPC Options
29045 @subsection IBM RS/6000 and PowerPC Options
29046 @cindex RS/6000 and PowerPC Options
29047 @cindex IBM RS/6000 and PowerPC Options
29049 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
29050 @table @gcctabopt
29051 @item -mpowerpc-gpopt
29052 @itemx -mno-powerpc-gpopt
29053 @itemx -mpowerpc-gfxopt
29054 @itemx -mno-powerpc-gfxopt
29055 @need 800
29056 @itemx -mpowerpc64
29057 @itemx -mno-powerpc64
29058 @itemx -mmfcrf
29059 @itemx -mno-mfcrf
29060 @itemx -mpopcntb
29061 @itemx -mno-popcntb
29062 @itemx -mpopcntd
29063 @itemx -mno-popcntd
29064 @itemx -mfprnd
29065 @itemx -mno-fprnd
29066 @need 800
29067 @itemx -mcmpb
29068 @itemx -mno-cmpb
29069 @itemx -mhard-dfp
29070 @itemx -mno-hard-dfp
29071 @opindex mpowerpc-gpopt
29072 @opindex mno-powerpc-gpopt
29073 @opindex mpowerpc-gfxopt
29074 @opindex mno-powerpc-gfxopt
29075 @opindex mpowerpc64
29076 @opindex mno-powerpc64
29077 @opindex mmfcrf
29078 @opindex mno-mfcrf
29079 @opindex mpopcntb
29080 @opindex mno-popcntb
29081 @opindex mpopcntd
29082 @opindex mno-popcntd
29083 @opindex mfprnd
29084 @opindex mno-fprnd
29085 @opindex mcmpb
29086 @opindex mno-cmpb
29087 @opindex mhard-dfp
29088 @opindex mno-hard-dfp
29089 You use these options to specify which instructions are available on the
29090 processor you are using.  The default value of these options is
29091 determined when configuring GCC@.  Specifying the
29092 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29093 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
29094 rather than the options listed above.
29096 Specifying @option{-mpowerpc-gpopt} allows
29097 GCC to use the optional PowerPC architecture instructions in the
29098 General Purpose group, including floating-point square root.  Specifying
29099 @option{-mpowerpc-gfxopt} allows GCC to
29100 use the optional PowerPC architecture instructions in the Graphics
29101 group, including floating-point select.
29103 The @option{-mmfcrf} option allows GCC to generate the move from
29104 condition register field instruction implemented on the POWER4
29105 processor and other processors that support the PowerPC V2.01
29106 architecture.
29107 The @option{-mpopcntb} option allows GCC to generate the popcount and
29108 double-precision FP reciprocal estimate instruction implemented on the
29109 POWER5 processor and other processors that support the PowerPC V2.02
29110 architecture.
29111 The @option{-mpopcntd} option allows GCC to generate the popcount
29112 instruction implemented on the POWER7 processor and other processors
29113 that support the PowerPC V2.06 architecture.
29114 The @option{-mfprnd} option allows GCC to generate the FP round to
29115 integer instructions implemented on the POWER5+ processor and other
29116 processors that support the PowerPC V2.03 architecture.
29117 The @option{-mcmpb} option allows GCC to generate the compare bytes
29118 instruction implemented on the POWER6 processor and other processors
29119 that support the PowerPC V2.05 architecture.
29120 The @option{-mhard-dfp} option allows GCC to generate the decimal
29121 floating-point instructions implemented on some POWER processors.
29123 The @option{-mpowerpc64} option allows GCC to generate the additional
29124 64-bit instructions that are found in the full PowerPC64 architecture
29125 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
29126 @option{-mno-powerpc64}.
29128 @item -mcpu=@var{cpu_type}
29129 @opindex mcpu
29130 Set architecture type, register usage, and
29131 instruction scheduling parameters for machine type @var{cpu_type}.
29132 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29133 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29134 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29135 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29136 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29137 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29138 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29139 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29140 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29141 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29142 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29143 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29145 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29146 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29147 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
29148 architecture machine types, with an appropriate, generic processor
29149 model assumed for scheduling purposes.
29151 Specifying @samp{native} as cpu type detects and selects the
29152 architecture option that corresponds to the host processor of the
29153 system performing the compilation.
29154 @option{-mcpu=native} has no effect if GCC does not recognize the
29155 processor.
29157 The other options specify a specific processor.  Code generated under
29158 those options runs best on that processor, and may not run at all on
29159 others.
29161 The @option{-mcpu} options automatically enable or disable the
29162 following options:
29164 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
29165 -mpopcntb  -mpopcntd  -mpowerpc64 @gol
29166 -mpowerpc-gpopt  -mpowerpc-gfxopt @gol
29167 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx @gol
29168 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector @gol
29169 -mquad-memory  -mquad-memory-atomic  -mfloat128 @gol
29170 -mfloat128-hardware -mprefixed -mpcrel -mmma @gol
29171 -mrop-protect}
29173 The particular options set for any particular CPU varies between
29174 compiler versions, depending on what setting seems to produce optimal
29175 code for that CPU; it doesn't necessarily reflect the actual hardware's
29176 capabilities.  If you wish to set an individual option to a particular
29177 value, you may specify it after the @option{-mcpu} option, like
29178 @option{-mcpu=970 -mno-altivec}.
29180 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
29181 not enabled or disabled by the @option{-mcpu} option at present because
29182 AIX does not have full support for these options.  You may still
29183 enable or disable them individually if you're sure it'll work in your
29184 environment.
29186 @item -mtune=@var{cpu_type}
29187 @opindex mtune
29188 Set the instruction scheduling parameters for machine type
29189 @var{cpu_type}, but do not set the architecture type or register usage,
29190 as @option{-mcpu=@var{cpu_type}} does.  The same
29191 values for @var{cpu_type} are used for @option{-mtune} as for
29192 @option{-mcpu}.  If both are specified, the code generated uses the
29193 architecture and registers set by @option{-mcpu}, but the
29194 scheduling parameters set by @option{-mtune}.
29196 @item -mcmodel=small
29197 @opindex mcmodel=small
29198 Generate PowerPC64 code for the small model: The TOC is limited to
29199 64k.
29201 @item -mcmodel=medium
29202 @opindex mcmodel=medium
29203 Generate PowerPC64 code for the medium model: The TOC and other static
29204 data may be up to a total of 4G in size.  This is the default for 64-bit
29205 Linux.
29207 @item -mcmodel=large
29208 @opindex mcmodel=large
29209 Generate PowerPC64 code for the large model: The TOC may be up to 4G
29210 in size.  Other data and code is only limited by the 64-bit address
29211 space.
29213 @item -maltivec
29214 @itemx -mno-altivec
29215 @opindex maltivec
29216 @opindex mno-altivec
29217 Generate code that uses (does not use) AltiVec instructions, and also
29218 enable the use of built-in functions that allow more direct access to
29219 the AltiVec instruction set.  You may also need to set
29220 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
29221 enhancements.
29223 When @option{-maltivec} is used, the element order for AltiVec intrinsics
29224 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
29225 match array element order corresponding to the endianness of the
29226 target.  That is, element zero identifies the leftmost element in a
29227 vector register when targeting a big-endian platform, and identifies
29228 the rightmost element in a vector register when targeting a
29229 little-endian platform.
29231 @item -mvrsave
29232 @itemx -mno-vrsave
29233 @opindex mvrsave
29234 @opindex mno-vrsave
29235 Generate VRSAVE instructions when generating AltiVec code.
29237 @item -msecure-plt
29238 @opindex msecure-plt
29239 Generate code that allows @command{ld} and @command{ld.so}
29240 to build executables and shared
29241 libraries with non-executable @code{.plt} and @code{.got} sections.
29242 This is a PowerPC
29243 32-bit SYSV ABI option.
29245 @item -mbss-plt
29246 @opindex mbss-plt
29247 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
29248 fills in, and
29249 requires @code{.plt} and @code{.got}
29250 sections that are both writable and executable.
29251 This is a PowerPC 32-bit SYSV ABI option.
29253 @item -misel
29254 @itemx -mno-isel
29255 @opindex misel
29256 @opindex mno-isel
29257 This switch enables or disables the generation of ISEL instructions.
29259 @item -mvsx
29260 @itemx -mno-vsx
29261 @opindex mvsx
29262 @opindex mno-vsx
29263 Generate code that uses (does not use) vector/scalar (VSX)
29264 instructions, and also enable the use of built-in functions that allow
29265 more direct access to the VSX instruction set.
29267 @item -mcrypto
29268 @itemx -mno-crypto
29269 @opindex mcrypto
29270 @opindex mno-crypto
29271 Enable the use (disable) of the built-in functions that allow direct
29272 access to the cryptographic instructions that were added in version
29273 2.07 of the PowerPC ISA.
29275 @item -mhtm
29276 @itemx -mno-htm
29277 @opindex mhtm
29278 @opindex mno-htm
29279 Enable (disable) the use of the built-in functions that allow direct
29280 access to the Hardware Transactional Memory (HTM) instructions that
29281 were added in version 2.07 of the PowerPC ISA.
29283 @item -mpower8-fusion
29284 @itemx -mno-power8-fusion
29285 @opindex mpower8-fusion
29286 @opindex mno-power8-fusion
29287 Generate code that keeps (does not keeps) some integer operations
29288 adjacent so that the instructions can be fused together on power8 and
29289 later processors.
29291 @item -mpower8-vector
29292 @itemx -mno-power8-vector
29293 @opindex mpower8-vector
29294 @opindex mno-power8-vector
29295 Generate code that uses (does not use) the vector and scalar
29296 instructions that were added in version 2.07 of the PowerPC ISA.  Also
29297 enable the use of built-in functions that allow more direct access to
29298 the vector instructions.
29300 @item -mquad-memory
29301 @itemx -mno-quad-memory
29302 @opindex mquad-memory
29303 @opindex mno-quad-memory
29304 Generate code that uses (does not use) the non-atomic quad word memory
29305 instructions.  The @option{-mquad-memory} option requires use of
29306 64-bit mode.
29308 @item -mquad-memory-atomic
29309 @itemx -mno-quad-memory-atomic
29310 @opindex mquad-memory-atomic
29311 @opindex mno-quad-memory-atomic
29312 Generate code that uses (does not use) the atomic quad word memory
29313 instructions.  The @option{-mquad-memory-atomic} option requires use of
29314 64-bit mode.
29316 @item -mfloat128
29317 @itemx -mno-float128
29318 @opindex mfloat128
29319 @opindex mno-float128
29320 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
29321 and use either software emulation for IEEE 128-bit floating point or
29322 hardware instructions.
29324 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
29325 128-bit floating point support.  The IEEE 128-bit floating point is only
29326 supported on Linux.
29328 The default for @option{-mfloat128} is enabled on PowerPC Linux
29329 systems using the VSX instruction set, and disabled on other systems.
29331 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
29332 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
29333 point support will also enable the generation of ISA 3.0 IEEE 128-bit
29334 floating point instructions.  Otherwise, if you do not specify to
29335 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
29336 system, IEEE 128-bit floating point will be done with software
29337 emulation.
29339 @item -mfloat128-hardware
29340 @itemx -mno-float128-hardware
29341 @opindex mfloat128-hardware
29342 @opindex mno-float128-hardware
29343 Enable/disable using ISA 3.0 hardware instructions to support the
29344 @var{__float128} data type.
29346 The default for @option{-mfloat128-hardware} is enabled on PowerPC
29347 Linux systems using the ISA 3.0 instruction set, and disabled on other
29348 systems.
29350 @item -m32
29351 @itemx -m64
29352 @opindex m32
29353 @opindex m64
29354 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
29355 targets (including GNU/Linux).  The 32-bit environment sets int, long
29356 and pointer to 32 bits and generates code that runs on any PowerPC
29357 variant.  The 64-bit environment sets int to 32 bits and long and
29358 pointer to 64 bits, and generates code for PowerPC64, as for
29359 @option{-mpowerpc64}.
29361 @item -mfull-toc
29362 @itemx -mno-fp-in-toc
29363 @itemx -mno-sum-in-toc
29364 @itemx -mminimal-toc
29365 @opindex mfull-toc
29366 @opindex mno-fp-in-toc
29367 @opindex mno-sum-in-toc
29368 @opindex mminimal-toc
29369 Modify generation of the TOC (Table Of Contents), which is created for
29370 every executable file.  The @option{-mfull-toc} option is selected by
29371 default.  In that case, GCC allocates at least one TOC entry for
29372 each unique non-automatic variable reference in your program.  GCC
29373 also places floating-point constants in the TOC@.  However, only
29374 16,384 entries are available in the TOC@.
29376 If you receive a linker error message that saying you have overflowed
29377 the available TOC space, you can reduce the amount of TOC space used
29378 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
29379 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
29380 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
29381 generate code to calculate the sum of an address and a constant at
29382 run time instead of putting that sum into the TOC@.  You may specify one
29383 or both of these options.  Each causes GCC to produce very slightly
29384 slower and larger code at the expense of conserving TOC space.
29386 If you still run out of space in the TOC even when you specify both of
29387 these options, specify @option{-mminimal-toc} instead.  This option causes
29388 GCC to make only one TOC entry for every file.  When you specify this
29389 option, GCC produces code that is slower and larger but which
29390 uses extremely little TOC space.  You may wish to use this option
29391 only on files that contain less frequently-executed code.
29393 @item -maix64
29394 @itemx -maix32
29395 @opindex maix64
29396 @opindex maix32
29397 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
29398 @code{long} type, and the infrastructure needed to support them.
29399 Specifying @option{-maix64} implies @option{-mpowerpc64},
29400 while @option{-maix32} disables the 64-bit ABI and
29401 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
29403 @item -mxl-compat
29404 @itemx -mno-xl-compat
29405 @opindex mxl-compat
29406 @opindex mno-xl-compat
29407 Produce code that conforms more closely to IBM XL compiler semantics
29408 when using AIX-compatible ABI@.  Pass floating-point arguments to
29409 prototyped functions beyond the register save area (RSA) on the stack
29410 in addition to argument FPRs.  Do not assume that most significant
29411 double in 128-bit long double value is properly rounded when comparing
29412 values and converting to double.  Use XL symbol names for long double
29413 support routines.
29415 The AIX calling convention was extended but not initially documented to
29416 handle an obscure K&R C case of calling a function that takes the
29417 address of its arguments with fewer arguments than declared.  IBM XL
29418 compilers access floating-point arguments that do not fit in the
29419 RSA from the stack when a subroutine is compiled without
29420 optimization.  Because always storing floating-point arguments on the
29421 stack is inefficient and rarely needed, this option is not enabled by
29422 default and only is necessary when calling subroutines compiled by IBM
29423 XL compilers without optimization.
29425 @item -mpe
29426 @opindex mpe
29427 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
29428 application written to use message passing with special startup code to
29429 enable the application to run.  The system must have PE installed in the
29430 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
29431 must be overridden with the @option{-specs=} option to specify the
29432 appropriate directory location.  The Parallel Environment does not
29433 support threads, so the @option{-mpe} option and the @option{-pthread}
29434 option are incompatible.
29436 @item -malign-natural
29437 @itemx -malign-power
29438 @opindex malign-natural
29439 @opindex malign-power
29440 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
29441 @option{-malign-natural} overrides the ABI-defined alignment of larger
29442 types, such as floating-point doubles, on their natural size-based boundary.
29443 The option @option{-malign-power} instructs GCC to follow the ABI-specified
29444 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
29446 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
29447 is not supported.
29449 @item -msoft-float
29450 @itemx -mhard-float
29451 @opindex msoft-float
29452 @opindex mhard-float
29453 Generate code that does not use (uses) the floating-point register set.
29454 Software floating-point emulation is provided if you use the
29455 @option{-msoft-float} option, and pass the option to GCC when linking.
29457 @item -mmultiple
29458 @itemx -mno-multiple
29459 @opindex mmultiple
29460 @opindex mno-multiple
29461 Generate code that uses (does not use) the load multiple word
29462 instructions and the store multiple word instructions.  These
29463 instructions are generated by default on POWER systems, and not
29464 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
29465 PowerPC systems, since those instructions do not work when the
29466 processor is in little-endian mode.  The exceptions are PPC740 and
29467 PPC750 which permit these instructions in little-endian mode.
29469 @item -mupdate
29470 @itemx -mno-update
29471 @opindex mupdate
29472 @opindex mno-update
29473 Generate code that uses (does not use) the load or store instructions
29474 that update the base register to the address of the calculated memory
29475 location.  These instructions are generated by default.  If you use
29476 @option{-mno-update}, there is a small window between the time that the
29477 stack pointer is updated and the address of the previous frame is
29478 stored, which means code that walks the stack frame across interrupts or
29479 signals may get corrupted data.
29481 @item -mavoid-indexed-addresses
29482 @itemx -mno-avoid-indexed-addresses
29483 @opindex mavoid-indexed-addresses
29484 @opindex mno-avoid-indexed-addresses
29485 Generate code that tries to avoid (not avoid) the use of indexed load
29486 or store instructions. These instructions can incur a performance
29487 penalty on Power6 processors in certain situations, such as when
29488 stepping through large arrays that cross a 16M boundary.  This option
29489 is enabled by default when targeting Power6 and disabled otherwise.
29491 @item -mfused-madd
29492 @itemx -mno-fused-madd
29493 @opindex mfused-madd
29494 @opindex mno-fused-madd
29495 Generate code that uses (does not use) the floating-point multiply and
29496 accumulate instructions.  These instructions are generated by default
29497 if hardware floating point is used.  The machine-dependent
29498 @option{-mfused-madd} option is now mapped to the machine-independent
29499 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29500 mapped to @option{-ffp-contract=off}.
29502 @item -mmulhw
29503 @itemx -mno-mulhw
29504 @opindex mmulhw
29505 @opindex mno-mulhw
29506 Generate code that uses (does not use) the half-word multiply and
29507 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
29508 These instructions are generated by default when targeting those
29509 processors.
29511 @item -mdlmzb
29512 @itemx -mno-dlmzb
29513 @opindex mdlmzb
29514 @opindex mno-dlmzb
29515 Generate code that uses (does not use) the string-search @samp{dlmzb}
29516 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
29517 generated by default when targeting those processors.
29519 @item -mno-bit-align
29520 @itemx -mbit-align
29521 @opindex mno-bit-align
29522 @opindex mbit-align
29523 On System V.4 and embedded PowerPC systems do not (do) force structures
29524 and unions that contain bit-fields to be aligned to the base type of the
29525 bit-field.
29527 For example, by default a structure containing nothing but 8
29528 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
29529 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
29530 the structure is aligned to a 1-byte boundary and is 1 byte in
29531 size.
29533 @item -mno-strict-align
29534 @itemx -mstrict-align
29535 @opindex mno-strict-align
29536 @opindex mstrict-align
29537 On System V.4 and embedded PowerPC systems do not (do) assume that
29538 unaligned memory references are handled by the system.
29540 @item -mrelocatable
29541 @itemx -mno-relocatable
29542 @opindex mrelocatable
29543 @opindex mno-relocatable
29544 Generate code that allows (does not allow) a static executable to be
29545 relocated to a different address at run time.  A simple embedded
29546 PowerPC system loader should relocate the entire contents of
29547 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
29548 a table of 32-bit addresses generated by this option.  For this to
29549 work, all objects linked together must be compiled with
29550 @option{-mrelocatable} or @option{-mrelocatable-lib}.
29551 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
29553 @item -mrelocatable-lib
29554 @itemx -mno-relocatable-lib
29555 @opindex mrelocatable-lib
29556 @opindex mno-relocatable-lib
29557 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
29558 @code{.fixup} section to allow static executables to be relocated at
29559 run time, but @option{-mrelocatable-lib} does not use the smaller stack
29560 alignment of @option{-mrelocatable}.  Objects compiled with
29561 @option{-mrelocatable-lib} may be linked with objects compiled with
29562 any combination of the @option{-mrelocatable} options.
29564 @item -mno-toc
29565 @itemx -mtoc
29566 @opindex mno-toc
29567 @opindex mtoc
29568 On System V.4 and embedded PowerPC systems do not (do) assume that
29569 register 2 contains a pointer to a global area pointing to the addresses
29570 used in the program.
29572 @item -mlittle
29573 @itemx -mlittle-endian
29574 @opindex mlittle
29575 @opindex mlittle-endian
29576 On System V.4 and embedded PowerPC systems compile code for the
29577 processor in little-endian mode.  The @option{-mlittle-endian} option is
29578 the same as @option{-mlittle}.
29580 @item -mbig
29581 @itemx -mbig-endian
29582 @opindex mbig
29583 @opindex mbig-endian
29584 On System V.4 and embedded PowerPC systems compile code for the
29585 processor in big-endian mode.  The @option{-mbig-endian} option is
29586 the same as @option{-mbig}.
29588 @item -mdynamic-no-pic
29589 @opindex mdynamic-no-pic
29590 On Darwin and Mac OS X systems, compile code so that it is not
29591 relocatable, but that its external references are relocatable.  The
29592 resulting code is suitable for applications, but not shared
29593 libraries.
29595 @item -msingle-pic-base
29596 @opindex msingle-pic-base
29597 Treat the register used for PIC addressing as read-only, rather than
29598 loading it in the prologue for each function.  The runtime system is
29599 responsible for initializing this register with an appropriate value
29600 before execution begins.
29602 @item -mprioritize-restricted-insns=@var{priority}
29603 @opindex mprioritize-restricted-insns
29604 This option controls the priority that is assigned to
29605 dispatch-slot restricted instructions during the second scheduling
29606 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
29607 or @samp{2} to assign no, highest, or second-highest (respectively) 
29608 priority to dispatch-slot restricted
29609 instructions.
29611 @item -msched-costly-dep=@var{dependence_type}
29612 @opindex msched-costly-dep
29613 This option controls which dependences are considered costly
29614 by the target during instruction scheduling.  The argument
29615 @var{dependence_type} takes one of the following values:
29617 @table @asis
29618 @item @samp{no}
29619 No dependence is costly.
29621 @item @samp{all}
29622 All dependences are costly.
29624 @item @samp{true_store_to_load}
29625 A true dependence from store to load is costly.
29627 @item @samp{store_to_load}
29628 Any dependence from store to load is costly.
29630 @item @var{number}
29631 Any dependence for which the latency is greater than or equal to 
29632 @var{number} is costly.
29633 @end table
29635 @item -minsert-sched-nops=@var{scheme}
29636 @opindex minsert-sched-nops
29637 This option controls which NOP insertion scheme is used during
29638 the second scheduling pass.  The argument @var{scheme} takes one of the
29639 following values:
29641 @table @asis
29642 @item @samp{no}
29643 Don't insert NOPs.
29645 @item @samp{pad}
29646 Pad with NOPs any dispatch group that has vacant issue slots,
29647 according to the scheduler's grouping.
29649 @item @samp{regroup_exact}
29650 Insert NOPs to force costly dependent insns into
29651 separate groups.  Insert exactly as many NOPs as needed to force an insn
29652 to a new group, according to the estimated processor grouping.
29654 @item @var{number}
29655 Insert NOPs to force costly dependent insns into
29656 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
29657 @end table
29659 @item -mcall-sysv
29660 @opindex mcall-sysv
29661 On System V.4 and embedded PowerPC systems compile code using calling
29662 conventions that adhere to the March 1995 draft of the System V
29663 Application Binary Interface, PowerPC processor supplement.  This is the
29664 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
29666 @item -mcall-sysv-eabi
29667 @itemx -mcall-eabi
29668 @opindex mcall-sysv-eabi
29669 @opindex mcall-eabi
29670 Specify both @option{-mcall-sysv} and @option{-meabi} options.
29672 @item -mcall-sysv-noeabi
29673 @opindex mcall-sysv-noeabi
29674 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
29676 @item -mcall-aixdesc
29677 @opindex mcall-aixdesc
29678 On System V.4 and embedded PowerPC systems compile code for the AIX
29679 operating system.
29681 @item -mcall-linux
29682 @opindex mcall-linux
29683 On System V.4 and embedded PowerPC systems compile code for the
29684 Linux-based GNU system.
29686 @item -mcall-freebsd
29687 @opindex mcall-freebsd
29688 On System V.4 and embedded PowerPC systems compile code for the
29689 FreeBSD operating system.
29691 @item -mcall-netbsd
29692 @opindex mcall-netbsd
29693 On System V.4 and embedded PowerPC systems compile code for the
29694 NetBSD operating system.
29696 @item -mcall-openbsd
29697 @opindex mcall-openbsd
29698 On System V.4 and embedded PowerPC systems compile code for the
29699 OpenBSD operating system.
29701 @item -mtraceback=@var{traceback_type}
29702 @opindex mtraceback
29703 Select the type of traceback table. Valid values for @var{traceback_type}
29704 are @samp{full}, @samp{part}, and @samp{no}.
29706 @item -maix-struct-return
29707 @opindex maix-struct-return
29708 Return all structures in memory (as specified by the AIX ABI)@.
29710 @item -msvr4-struct-return
29711 @opindex msvr4-struct-return
29712 Return structures smaller than 8 bytes in registers (as specified by the
29713 SVR4 ABI)@.
29715 @item -mabi=@var{abi-type}
29716 @opindex mabi
29717 Extend the current ABI with a particular extension, or remove such extension.
29718 Valid values are: @samp{altivec}, @samp{no-altivec},
29719 @samp{ibmlongdouble}, @samp{ieeelongdouble},
29720 @samp{elfv1}, @samp{elfv2},
29721 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
29723 @item -mabi=ibmlongdouble
29724 @opindex mabi=ibmlongdouble
29725 Change the current ABI to use IBM extended-precision long double.
29726 This is not likely to work if your system defaults to using IEEE
29727 extended-precision long double.  If you change the long double type
29728 from IEEE extended-precision, the compiler will issue a warning unless
29729 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
29730 to be enabled.
29732 @item -mabi=ieeelongdouble
29733 @opindex mabi=ieeelongdouble
29734 Change the current ABI to use IEEE extended-precision long double.
29735 This is not likely to work if your system defaults to using IBM
29736 extended-precision long double.  If you change the long double type
29737 from IBM extended-precision, the compiler will issue a warning unless
29738 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
29739 to be enabled.
29741 @item -mabi=elfv1
29742 @opindex mabi=elfv1
29743 Change the current ABI to use the ELFv1 ABI.
29744 This is the default ABI for big-endian PowerPC 64-bit Linux.
29745 Overriding the default ABI requires special system support and is
29746 likely to fail in spectacular ways.
29748 @item -mabi=elfv2
29749 @opindex mabi=elfv2
29750 Change the current ABI to use the ELFv2 ABI.
29751 This is the default ABI for little-endian PowerPC 64-bit Linux.
29752 Overriding the default ABI requires special system support and is
29753 likely to fail in spectacular ways.
29755 @item -mgnu-attribute
29756 @itemx -mno-gnu-attribute
29757 @opindex mgnu-attribute
29758 @opindex mno-gnu-attribute
29759 Emit .gnu_attribute assembly directives to set tag/value pairs in a
29760 .gnu.attributes section that specify ABI variations in function
29761 parameters or return values.
29763 @item -mprototype
29764 @itemx -mno-prototype
29765 @opindex mprototype
29766 @opindex mno-prototype
29767 On System V.4 and embedded PowerPC systems assume that all calls to
29768 variable argument functions are properly prototyped.  Otherwise, the
29769 compiler must insert an instruction before every non-prototyped call to
29770 set or clear bit 6 of the condition code register (@code{CR}) to
29771 indicate whether floating-point values are passed in the floating-point
29772 registers in case the function takes variable arguments.  With
29773 @option{-mprototype}, only calls to prototyped variable argument functions
29774 set or clear the bit.
29776 @item -msim
29777 @opindex msim
29778 On embedded PowerPC systems, assume that the startup module is called
29779 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
29780 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
29781 configurations.
29783 @item -mmvme
29784 @opindex mmvme
29785 On embedded PowerPC systems, assume that the startup module is called
29786 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
29787 @file{libc.a}.
29789 @item -mads
29790 @opindex mads
29791 On embedded PowerPC systems, assume that the startup module is called
29792 @file{crt0.o} and the standard C libraries are @file{libads.a} and
29793 @file{libc.a}.
29795 @item -myellowknife
29796 @opindex myellowknife
29797 On embedded PowerPC systems, assume that the startup module is called
29798 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
29799 @file{libc.a}.
29801 @item -mvxworks
29802 @opindex mvxworks
29803 On System V.4 and embedded PowerPC systems, specify that you are
29804 compiling for a VxWorks system.
29806 @item -memb
29807 @opindex memb
29808 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
29809 header to indicate that @samp{eabi} extended relocations are used.
29811 @item -meabi
29812 @itemx -mno-eabi
29813 @opindex meabi
29814 @opindex mno-eabi
29815 On System V.4 and embedded PowerPC systems do (do not) adhere to the
29816 Embedded Applications Binary Interface (EABI), which is a set of
29817 modifications to the System V.4 specifications.  Selecting @option{-meabi}
29818 means that the stack is aligned to an 8-byte boundary, a function
29819 @code{__eabi} is called from @code{main} to set up the EABI
29820 environment, and the @option{-msdata} option can use both @code{r2} and
29821 @code{r13} to point to two separate small data areas.  Selecting
29822 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
29823 no EABI initialization function is called from @code{main}, and the
29824 @option{-msdata} option only uses @code{r13} to point to a single
29825 small data area.  The @option{-meabi} option is on by default if you
29826 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
29828 @item -msdata=eabi
29829 @opindex msdata=eabi
29830 On System V.4 and embedded PowerPC systems, put small initialized
29831 @code{const} global and static data in the @code{.sdata2} section, which
29832 is pointed to by register @code{r2}.  Put small initialized
29833 non-@code{const} global and static data in the @code{.sdata} section,
29834 which is pointed to by register @code{r13}.  Put small uninitialized
29835 global and static data in the @code{.sbss} section, which is adjacent to
29836 the @code{.sdata} section.  The @option{-msdata=eabi} option is
29837 incompatible with the @option{-mrelocatable} option.  The
29838 @option{-msdata=eabi} option also sets the @option{-memb} option.
29840 @item -msdata=sysv
29841 @opindex msdata=sysv
29842 On System V.4 and embedded PowerPC systems, put small global and static
29843 data in the @code{.sdata} section, which is pointed to by register
29844 @code{r13}.  Put small uninitialized global and static data in the
29845 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
29846 The @option{-msdata=sysv} option is incompatible with the
29847 @option{-mrelocatable} option.
29849 @item -msdata=default
29850 @itemx -msdata
29851 @opindex msdata=default
29852 @opindex msdata
29853 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
29854 compile code the same as @option{-msdata=eabi}, otherwise compile code the
29855 same as @option{-msdata=sysv}.
29857 @item -msdata=data
29858 @opindex msdata=data
29859 On System V.4 and embedded PowerPC systems, put small global
29860 data in the @code{.sdata} section.  Put small uninitialized global
29861 data in the @code{.sbss} section.  Do not use register @code{r13}
29862 to address small data however.  This is the default behavior unless
29863 other @option{-msdata} options are used.
29865 @item -msdata=none
29866 @itemx -mno-sdata
29867 @opindex msdata=none
29868 @opindex mno-sdata
29869 On embedded PowerPC systems, put all initialized global and static data
29870 in the @code{.data} section, and all uninitialized data in the
29871 @code{.bss} section.
29873 @item -mreadonly-in-sdata
29874 @opindex mreadonly-in-sdata
29875 @opindex mno-readonly-in-sdata
29876 Put read-only objects in the @code{.sdata} section as well.  This is the
29877 default.
29879 @item -mblock-move-inline-limit=@var{num}
29880 @opindex mblock-move-inline-limit
29881 Inline all block moves (such as calls to @code{memcpy} or structure
29882 copies) less than or equal to @var{num} bytes.  The minimum value for
29883 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
29884 targets.  The default value is target-specific.
29886 @item -mblock-compare-inline-limit=@var{num}
29887 @opindex mblock-compare-inline-limit
29888 Generate non-looping inline code for all block compares (such as calls
29889 to @code{memcmp} or structure compares) less than or equal to @var{num}
29890 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
29891 block compare is disabled. The default value is target-specific.
29893 @item -mblock-compare-inline-loop-limit=@var{num}
29894 @opindex mblock-compare-inline-loop-limit
29895 Generate an inline expansion using loop code for all block compares that
29896 are less than or equal to @var{num} bytes, but greater than the limit
29897 for non-loop inline block compare expansion. If the block length is not
29898 constant, at most @var{num} bytes will be compared before @code{memcmp}
29899 is called to compare the remainder of the block. The default value is
29900 target-specific.
29902 @item -mstring-compare-inline-limit=@var{num}
29903 @opindex mstring-compare-inline-limit
29904 Compare at most @var{num} string bytes with inline code.
29905 If the difference or end of string is not found at the
29906 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
29907 take care of the rest of the comparison. The default is 64 bytes.
29909 @item -G @var{num}
29910 @opindex G
29911 @cindex smaller data references (PowerPC)
29912 @cindex .sdata/.sdata2 references (PowerPC)
29913 On embedded PowerPC systems, put global and static items less than or
29914 equal to @var{num} bytes into the small data or BSS sections instead of
29915 the normal data or BSS section.  By default, @var{num} is 8.  The
29916 @option{-G @var{num}} switch is also passed to the linker.
29917 All modules should be compiled with the same @option{-G @var{num}} value.
29919 @item -mregnames
29920 @itemx -mno-regnames
29921 @opindex mregnames
29922 @opindex mno-regnames
29923 On System V.4 and embedded PowerPC systems do (do not) emit register
29924 names in the assembly language output using symbolic forms.
29926 @item -mlongcall
29927 @itemx -mno-longcall
29928 @opindex mlongcall
29929 @opindex mno-longcall
29930 By default assume that all calls are far away so that a longer and more
29931 expensive calling sequence is required.  This is required for calls
29932 farther than 32 megabytes (33,554,432 bytes) from the current location.
29933 A short call is generated if the compiler knows
29934 the call cannot be that far away.  This setting can be overridden by
29935 the @code{shortcall} function attribute, or by @code{#pragma
29936 longcall(0)}.
29938 Some linkers are capable of detecting out-of-range calls and generating
29939 glue code on the fly.  On these systems, long calls are unnecessary and
29940 generate slower code.  As of this writing, the AIX linker can do this,
29941 as can the GNU linker for PowerPC/64.  It is planned to add this feature
29942 to the GNU linker for 32-bit PowerPC systems as well.
29944 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
29945 GCC can generate long calls using an inline PLT call sequence (see
29946 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
29947 ELFv1 (big-endian) do not support inline PLT calls.
29949 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
29950 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
29951 addresses represent the callee and the branch island.  The
29952 Darwin/PPC linker prefers the first address and generates a @code{bl
29953 callee} if the PPC @code{bl} instruction reaches the callee directly;
29954 otherwise, the linker generates @code{bl L42} to call the branch
29955 island.  The branch island is appended to the body of the
29956 calling function; it computes the full 32-bit address of the callee
29957 and jumps to it.
29959 On Mach-O (Darwin) systems, this option directs the compiler emit to
29960 the glue for every direct call, and the Darwin linker decides whether
29961 to use or discard it.
29963 In the future, GCC may ignore all longcall specifications
29964 when the linker is known to generate glue.
29966 @item -mpltseq
29967 @itemx -mno-pltseq
29968 @opindex mpltseq
29969 @opindex mno-pltseq
29970 Implement (do not implement) -fno-plt and long calls using an inline
29971 PLT call sequence that supports lazy linking and long calls to
29972 functions in dlopen'd shared libraries.  Inline PLT calls are only
29973 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
29974 linkers, and are enabled by default if the support is detected when
29975 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
29976 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
29977 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
29978 linked together.
29980 @item -mtls-markers
29981 @itemx -mno-tls-markers
29982 @opindex mtls-markers
29983 @opindex mno-tls-markers
29984 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
29985 specifying the function argument.  The relocation allows the linker to
29986 reliably associate function call with argument setup instructions for
29987 TLS optimization, which in turn allows GCC to better schedule the
29988 sequence.
29990 @item -mrecip
29991 @itemx -mno-recip
29992 @opindex mrecip
29993 This option enables use of the reciprocal estimate and
29994 reciprocal square root estimate instructions with additional
29995 Newton-Raphson steps to increase precision instead of doing a divide or
29996 square root and divide for floating-point arguments.  You should use
29997 the @option{-ffast-math} option when using @option{-mrecip} (or at
29998 least @option{-funsafe-math-optimizations},
29999 @option{-ffinite-math-only}, @option{-freciprocal-math} and
30000 @option{-fno-trapping-math}).  Note that while the throughput of the
30001 sequence is generally higher than the throughput of the non-reciprocal
30002 instruction, the precision of the sequence can be decreased by up to 2
30003 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
30004 roots.
30006 @item -mrecip=@var{opt}
30007 @opindex mrecip=opt
30008 This option controls which reciprocal estimate instructions
30009 may be used.  @var{opt} is a comma-separated list of options, which may
30010 be preceded by a @code{!} to invert the option:
30012 @table @samp
30014 @item all
30015 Enable all estimate instructions.
30017 @item default 
30018 Enable the default instructions, equivalent to @option{-mrecip}.
30020 @item none 
30021 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30023 @item div 
30024 Enable the reciprocal approximation instructions for both 
30025 single and double precision.
30027 @item divf 
30028 Enable the single-precision reciprocal approximation instructions.
30030 @item divd 
30031 Enable the double-precision reciprocal approximation instructions.
30033 @item rsqrt 
30034 Enable the reciprocal square root approximation instructions for both
30035 single and double precision.
30037 @item rsqrtf 
30038 Enable the single-precision reciprocal square root approximation instructions.
30040 @item rsqrtd 
30041 Enable the double-precision reciprocal square root approximation instructions.
30043 @end table
30045 So, for example, @option{-mrecip=all,!rsqrtd} enables
30046 all of the reciprocal estimate instructions, except for the
30047 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
30048 which handle the double-precision reciprocal square root calculations.
30050 @item -mrecip-precision
30051 @itemx -mno-recip-precision
30052 @opindex mrecip-precision
30053 Assume (do not assume) that the reciprocal estimate instructions
30054 provide higher-precision estimates than is mandated by the PowerPC
30055 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
30056 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
30057 The double-precision square root estimate instructions are not generated by
30058 default on low-precision machines, since they do not provide an
30059 estimate that converges after three steps.
30061 @item -mveclibabi=@var{type}
30062 @opindex mveclibabi
30063 Specifies the ABI type to use for vectorizing intrinsics using an
30064 external library.  The only type supported at present is @samp{mass},
30065 which specifies to use IBM's Mathematical Acceleration Subsystem
30066 (MASS) libraries for vectorizing intrinsics using external libraries.
30067 GCC currently emits calls to @code{acosd2}, @code{acosf4},
30068 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
30069 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
30070 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
30071 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
30072 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
30073 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
30074 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
30075 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
30076 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
30077 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
30078 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
30079 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
30080 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30081 for power7.  Both @option{-ftree-vectorize} and
30082 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
30083 libraries must be specified at link time.
30085 @item -mfriz
30086 @itemx -mno-friz
30087 @opindex mfriz
30088 Generate (do not generate) the @code{friz} instruction when the
30089 @option{-funsafe-math-optimizations} option is used to optimize
30090 rounding of floating-point values to 64-bit integer and back to floating
30091 point.  The @code{friz} instruction does not return the same value if
30092 the floating-point number is too large to fit in an integer.
30094 @item -mpointers-to-nested-functions
30095 @itemx -mno-pointers-to-nested-functions
30096 @opindex mpointers-to-nested-functions
30097 Generate (do not generate) code to load up the static chain register
30098 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30099 systems where a function pointer points to a 3-word descriptor giving
30100 the function address, TOC value to be loaded in register @code{r2}, and
30101 static chain value to be loaded in register @code{r11}.  The
30102 @option{-mpointers-to-nested-functions} is on by default.  You cannot
30103 call through pointers to nested functions or pointers
30104 to functions compiled in other languages that use the static chain if
30105 you use @option{-mno-pointers-to-nested-functions}.
30107 @item -msave-toc-indirect
30108 @itemx -mno-save-toc-indirect
30109 @opindex msave-toc-indirect
30110 Generate (do not generate) code to save the TOC value in the reserved
30111 stack location in the function prologue if the function calls through
30112 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
30113 saved in the prologue, it is saved just before the call through the
30114 pointer.  The @option{-mno-save-toc-indirect} option is the default.
30116 @item -mcompat-align-parm
30117 @itemx -mno-compat-align-parm
30118 @opindex mcompat-align-parm
30119 Generate (do not generate) code to pass structure parameters with a
30120 maximum alignment of 64 bits, for compatibility with older versions
30121 of GCC.
30123 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30124 structure parameter on a 128-bit boundary when that structure contained
30125 a member requiring 128-bit alignment.  This is corrected in more
30126 recent versions of GCC.  This option may be used to generate code
30127 that is compatible with functions compiled with older versions of
30128 GCC.
30130 The @option{-mno-compat-align-parm} option is the default.
30132 @item -mstack-protector-guard=@var{guard}
30133 @itemx -mstack-protector-guard-reg=@var{reg}
30134 @itemx -mstack-protector-guard-offset=@var{offset}
30135 @itemx -mstack-protector-guard-symbol=@var{symbol}
30136 @opindex mstack-protector-guard
30137 @opindex mstack-protector-guard-reg
30138 @opindex mstack-protector-guard-offset
30139 @opindex mstack-protector-guard-symbol
30140 Generate stack protection code using canary at @var{guard}.  Supported
30141 locations are @samp{global} for global canary or @samp{tls} for per-thread
30142 canary in the TLS block (the default with GNU libc version 2.4 or later).
30144 With the latter choice the options
30145 @option{-mstack-protector-guard-reg=@var{reg}} and
30146 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30147 which register to use as base register for reading the canary, and from what
30148 offset from that base register. The default for those is as specified in the
30149 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
30150 the offset with a symbol reference to a canary in the TLS block.
30152 @item -mpcrel
30153 @itemx -mno-pcrel
30154 @opindex mpcrel
30155 @opindex mno-pcrel
30156 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
30157 option requires that the medium code model (@option{-mcmodel=medium})
30158 and prefixed addressing (@option{-mprefixed}) options are enabled.
30160 @item -mprefixed
30161 @itemx -mno-prefixed
30162 @opindex mprefixed
30163 @opindex mno-prefixed
30164 Generate (do not generate) addressing modes using prefixed load and
30165 store instructions.  The @option{-mprefixed} option requires that
30166 the option @option{-mcpu=power10} (or later) is enabled.
30168 @item -mmma
30169 @itemx -mno-mma
30170 @opindex mmma
30171 @opindex mno-mma
30172 Generate (do not generate) the MMA instructions.  The @option{-mma}
30173 option requires that the option @option{-mcpu=power10} (or later)
30174 is enabled.
30176 @item -mrop-protect
30177 @itemx -mno-rop-protect
30178 @opindex mrop-protect
30179 @opindex mno-rop-protect
30180 Generate (do not generate) ROP protection instructions when the target
30181 processor supports them.  Currently this option disables the shrink-wrap
30182 optimization (@option{-fshrink-wrap}).
30184 @item -mprivileged
30185 @itemx -mno-privileged
30186 @opindex mprivileged
30187 @opindex mno-privileged
30188 Generate (do not generate) code that will run in privileged state.
30190 @item -mblock-ops-unaligned-vsx
30191 @itemx -mno-block-ops-unaligned-vsx
30192 @opindex block-ops-unaligned-vsx
30193 @opindex no-block-ops-unaligned-vsx
30194 Generate (do not generate) unaligned vsx loads and stores for
30195 inline expansion of @code{memcpy} and @code{memmove}.
30197 @item --param rs6000-vect-unroll-limit=
30198 The vectorizer will check with target information to determine whether it
30199 would be beneficial to unroll the main vectorized loop and by how much.  This
30200 parameter sets the upper bound of how much the vectorizer will unroll the main
30201 loop.  The default value is four.
30203 @end table
30205 @node RX Options
30206 @subsection RX Options
30207 @cindex RX Options
30209 These command-line options are defined for RX targets:
30211 @table @gcctabopt
30212 @item -m64bit-doubles
30213 @itemx -m32bit-doubles
30214 @opindex m64bit-doubles
30215 @opindex m32bit-doubles
30216 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30217 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
30218 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
30219 works on 32-bit values, which is why the default is
30220 @option{-m32bit-doubles}.
30222 @item -fpu
30223 @itemx -nofpu
30224 @opindex fpu
30225 @opindex nofpu
30226 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
30227 floating-point hardware.  The default is enabled for the RX600
30228 series and disabled for the RX200 series.
30230 Floating-point instructions are only generated for 32-bit floating-point 
30231 values, however, so the FPU hardware is not used for doubles if the
30232 @option{-m64bit-doubles} option is used.
30234 @emph{Note} If the @option{-fpu} option is enabled then
30235 @option{-funsafe-math-optimizations} is also enabled automatically.
30236 This is because the RX FPU instructions are themselves unsafe.
30238 @item -mcpu=@var{name}
30239 @opindex mcpu
30240 Selects the type of RX CPU to be targeted.  Currently three types are
30241 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
30242 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
30244 The only difference between @samp{RX600} and @samp{RX610} is that the
30245 @samp{RX610} does not support the @code{MVTIPL} instruction.
30247 The @samp{RX200} series does not have a hardware floating-point unit
30248 and so @option{-nofpu} is enabled by default when this type is
30249 selected.
30251 @item -mbig-endian-data
30252 @itemx -mlittle-endian-data
30253 @opindex mbig-endian-data
30254 @opindex mlittle-endian-data
30255 Store data (but not code) in the big-endian format.  The default is
30256 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
30257 format.
30259 @item -msmall-data-limit=@var{N}
30260 @opindex msmall-data-limit
30261 Specifies the maximum size in bytes of global and static variables
30262 which can be placed into the small data area.  Using the small data
30263 area can lead to smaller and faster code, but the size of area is
30264 limited and it is up to the programmer to ensure that the area does
30265 not overflow.  Also when the small data area is used one of the RX's
30266 registers (usually @code{r13}) is reserved for use pointing to this
30267 area, so it is no longer available for use by the compiler.  This
30268 could result in slower and/or larger code if variables are pushed onto
30269 the stack instead of being held in this register.
30271 Note, common variables (variables that have not been initialized) and
30272 constants are not placed into the small data area as they are assigned
30273 to other sections in the output executable.
30275 The default value is zero, which disables this feature.  Note, this
30276 feature is not enabled by default with higher optimization levels
30277 (@option{-O2} etc) because of the potentially detrimental effects of
30278 reserving a register.  It is up to the programmer to experiment and
30279 discover whether this feature is of benefit to their program.  See the
30280 description of the @option{-mpid} option for a description of how the
30281 actual register to hold the small data area pointer is chosen.
30283 @item -msim
30284 @itemx -mno-sim
30285 @opindex msim
30286 @opindex mno-sim
30287 Use the simulator runtime.  The default is to use the libgloss
30288 board-specific runtime.
30290 @item -mas100-syntax
30291 @itemx -mno-as100-syntax
30292 @opindex mas100-syntax
30293 @opindex mno-as100-syntax
30294 When generating assembler output use a syntax that is compatible with
30295 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
30296 assembler, but it has some restrictions so it is not generated by default.
30298 @item -mmax-constant-size=@var{N}
30299 @opindex mmax-constant-size
30300 Specifies the maximum size, in bytes, of a constant that can be used as
30301 an operand in a RX instruction.  Although the RX instruction set does
30302 allow constants of up to 4 bytes in length to be used in instructions,
30303 a longer value equates to a longer instruction.  Thus in some
30304 circumstances it can be beneficial to restrict the size of constants
30305 that are used in instructions.  Constants that are too big are instead
30306 placed into a constant pool and referenced via register indirection.
30308 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
30309 or 4 means that constants of any size are allowed.
30311 @item -mrelax
30312 @opindex mrelax
30313 Enable linker relaxation.  Linker relaxation is a process whereby the
30314 linker attempts to reduce the size of a program by finding shorter
30315 versions of various instructions.  Disabled by default.
30317 @item -mint-register=@var{N}
30318 @opindex mint-register
30319 Specify the number of registers to reserve for fast interrupt handler
30320 functions.  The value @var{N} can be between 0 and 4.  A value of 1
30321 means that register @code{r13} is reserved for the exclusive use
30322 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
30323 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
30324 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
30325 A value of 0, the default, does not reserve any registers.
30327 @item -msave-acc-in-interrupts
30328 @opindex msave-acc-in-interrupts
30329 Specifies that interrupt handler functions should preserve the
30330 accumulator register.  This is only necessary if normal code might use
30331 the accumulator register, for example because it performs 64-bit
30332 multiplications.  The default is to ignore the accumulator as this
30333 makes the interrupt handlers faster.
30335 @item -mpid
30336 @itemx -mno-pid
30337 @opindex mpid
30338 @opindex mno-pid
30339 Enables the generation of position independent data.  When enabled any
30340 access to constant data is done via an offset from a base address
30341 held in a register.  This allows the location of constant data to be
30342 determined at run time without requiring the executable to be
30343 relocated, which is a benefit to embedded applications with tight
30344 memory constraints.  Data that can be modified is not affected by this
30345 option.
30347 Note, using this feature reserves a register, usually @code{r13}, for
30348 the constant data base address.  This can result in slower and/or
30349 larger code, especially in complicated functions.
30351 The actual register chosen to hold the constant data base address
30352 depends upon whether the @option{-msmall-data-limit} and/or the
30353 @option{-mint-register} command-line options are enabled.  Starting
30354 with register @code{r13} and proceeding downwards, registers are
30355 allocated first to satisfy the requirements of @option{-mint-register},
30356 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
30357 is possible for the small data area register to be @code{r8} if both
30358 @option{-mint-register=4} and @option{-mpid} are specified on the
30359 command line.
30361 By default this feature is not enabled.  The default can be restored
30362 via the @option{-mno-pid} command-line option.
30364 @item -mno-warn-multiple-fast-interrupts
30365 @itemx -mwarn-multiple-fast-interrupts
30366 @opindex mno-warn-multiple-fast-interrupts
30367 @opindex mwarn-multiple-fast-interrupts
30368 Prevents GCC from issuing a warning message if it finds more than one
30369 fast interrupt handler when it is compiling a file.  The default is to
30370 issue a warning for each extra fast interrupt handler found, as the RX
30371 only supports one such interrupt.
30373 @item -mallow-string-insns
30374 @itemx -mno-allow-string-insns
30375 @opindex mallow-string-insns
30376 @opindex mno-allow-string-insns
30377 Enables or disables the use of the string manipulation instructions
30378 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
30379 @code{SWHILE} and also the @code{RMPA} instruction.  These
30380 instructions may prefetch data, which is not safe to do if accessing
30381 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
30382 for more information).
30384 The default is to allow these instructions, but it is not possible for
30385 GCC to reliably detect all circumstances where a string instruction
30386 might be used to access an I/O register, so their use cannot be
30387 disabled automatically.  Instead it is reliant upon the programmer to
30388 use the @option{-mno-allow-string-insns} option if their program
30389 accesses I/O space.
30391 When the instructions are enabled GCC defines the C preprocessor
30392 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
30393 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
30395 @item -mjsr
30396 @itemx -mno-jsr
30397 @opindex mjsr
30398 @opindex mno-jsr
30399 Use only (or not only) @code{JSR} instructions to access functions.
30400 This option can be used when code size exceeds the range of @code{BSR}
30401 instructions.  Note that @option{-mno-jsr} does not mean to not use
30402 @code{JSR} but instead means that any type of branch may be used.
30403 @end table
30405 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
30406 has special significance to the RX port when used with the
30407 @code{interrupt} function attribute.  This attribute indicates a
30408 function intended to process fast interrupts.  GCC ensures
30409 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
30410 and/or @code{r13} and only provided that the normal use of the
30411 corresponding registers have been restricted via the
30412 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
30413 options.
30415 @node S/390 and zSeries Options
30416 @subsection S/390 and zSeries Options
30417 @cindex S/390 and zSeries Options
30419 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
30421 @table @gcctabopt
30422 @item -mhard-float
30423 @itemx -msoft-float
30424 @opindex mhard-float
30425 @opindex msoft-float
30426 Use (do not use) the hardware floating-point instructions and registers
30427 for floating-point operations.  When @option{-msoft-float} is specified,
30428 functions in @file{libgcc.a} are used to perform floating-point
30429 operations.  When @option{-mhard-float} is specified, the compiler
30430 generates IEEE floating-point instructions.  This is the default.
30432 @item -mhard-dfp
30433 @itemx -mno-hard-dfp
30434 @opindex mhard-dfp
30435 @opindex mno-hard-dfp
30436 Use (do not use) the hardware decimal-floating-point instructions for
30437 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
30438 specified, functions in @file{libgcc.a} are used to perform
30439 decimal-floating-point operations.  When @option{-mhard-dfp} is
30440 specified, the compiler generates decimal-floating-point hardware
30441 instructions.  This is the default for @option{-march=z9-ec} or higher.
30443 @item -mlong-double-64
30444 @itemx -mlong-double-128
30445 @opindex mlong-double-64
30446 @opindex mlong-double-128
30447 These switches control the size of @code{long double} type. A size
30448 of 64 bits makes the @code{long double} type equivalent to the @code{double}
30449 type. This is the default.
30451 @item -mbackchain
30452 @itemx -mno-backchain
30453 @opindex mbackchain
30454 @opindex mno-backchain
30455 Store (do not store) the address of the caller's frame as backchain pointer
30456 into the callee's stack frame.
30457 A backchain may be needed to allow debugging using tools that do not understand
30458 DWARF call frame information.
30459 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
30460 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
30461 the backchain is placed into the topmost word of the 96/160 byte register
30462 save area.
30464 In general, code compiled with @option{-mbackchain} is call-compatible with
30465 code compiled with @option{-mno-backchain}; however, use of the backchain
30466 for debugging purposes usually requires that the whole binary is built with
30467 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
30468 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
30469 to build a linux kernel use @option{-msoft-float}.
30471 The default is to not maintain the backchain.
30473 @item -mpacked-stack
30474 @itemx -mno-packed-stack
30475 @opindex mpacked-stack
30476 @opindex mno-packed-stack
30477 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
30478 specified, the compiler uses the all fields of the 96/160 byte register save
30479 area only for their default purpose; unused fields still take up stack space.
30480 When @option{-mpacked-stack} is specified, register save slots are densely
30481 packed at the top of the register save area; unused space is reused for other
30482 purposes, allowing for more efficient use of the available stack space.
30483 However, when @option{-mbackchain} is also in effect, the topmost word of
30484 the save area is always used to store the backchain, and the return address
30485 register is always saved two words below the backchain.
30487 As long as the stack frame backchain is not used, code generated with
30488 @option{-mpacked-stack} is call-compatible with code generated with
30489 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
30490 S/390 or zSeries generated code that uses the stack frame backchain at run
30491 time, not just for debugging purposes.  Such code is not call-compatible
30492 with code compiled with @option{-mpacked-stack}.  Also, note that the
30493 combination of @option{-mbackchain},
30494 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
30495 to build a linux kernel use @option{-msoft-float}.
30497 The default is to not use the packed stack layout.
30499 @item -msmall-exec
30500 @itemx -mno-small-exec
30501 @opindex msmall-exec
30502 @opindex mno-small-exec
30503 Generate (or do not generate) code using the @code{bras} instruction
30504 to do subroutine calls.
30505 This only works reliably if the total executable size does not
30506 exceed 64k.  The default is to use the @code{basr} instruction instead,
30507 which does not have this limitation.
30509 @item -m64
30510 @itemx -m31
30511 @opindex m64
30512 @opindex m31
30513 When @option{-m31} is specified, generate code compliant to the
30514 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
30515 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
30516 particular to generate 64-bit instructions.  For the @samp{s390}
30517 targets, the default is @option{-m31}, while the @samp{s390x}
30518 targets default to @option{-m64}.
30520 @item -mzarch
30521 @itemx -mesa
30522 @opindex mzarch
30523 @opindex mesa
30524 When @option{-mzarch} is specified, generate code using the
30525 instructions available on z/Architecture.
30526 When @option{-mesa} is specified, generate code using the
30527 instructions available on ESA/390.  Note that @option{-mesa} is
30528 not possible with @option{-m64}.
30529 When generating code compliant to the GNU/Linux for S/390 ABI,
30530 the default is @option{-mesa}.  When generating code compliant
30531 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
30533 @item -mhtm
30534 @itemx -mno-htm
30535 @opindex mhtm
30536 @opindex mno-htm
30537 The @option{-mhtm} option enables a set of builtins making use of
30538 instructions available with the transactional execution facility
30539 introduced with the IBM zEnterprise EC12 machine generation
30540 @ref{S/390 System z Built-in Functions}.
30541 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
30543 @item -mvx
30544 @itemx -mno-vx
30545 @opindex mvx
30546 @opindex mno-vx
30547 When @option{-mvx} is specified, generate code using the instructions
30548 available with the vector extension facility introduced with the IBM
30549 z13 machine generation.
30550 This option changes the ABI for some vector type values with regard to
30551 alignment and calling conventions.  In case vector type values are
30552 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
30553 command will be added to mark the resulting binary with the ABI used.
30554 @option{-mvx} is enabled by default when using @option{-march=z13}.
30556 @item -mzvector
30557 @itemx -mno-zvector
30558 @opindex mzvector
30559 @opindex mno-zvector
30560 The @option{-mzvector} option enables vector language extensions and
30561 builtins using instructions available with the vector extension
30562 facility introduced with the IBM z13 machine generation.
30563 This option adds support for @samp{vector} to be used as a keyword to
30564 define vector type variables and arguments.  @samp{vector} is only
30565 available when GNU extensions are enabled.  It will not be expanded
30566 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
30567 In addition to the GCC low-level builtins @option{-mzvector} enables
30568 a set of builtins added for compatibility with AltiVec-style
30569 implementations like Power and Cell.  In order to make use of these
30570 builtins the header file @file{vecintrin.h} needs to be included.
30571 @option{-mzvector} is disabled by default.
30573 @item -mmvcle
30574 @itemx -mno-mvcle
30575 @opindex mmvcle
30576 @opindex mno-mvcle
30577 Generate (or do not generate) code using the @code{mvcle} instruction
30578 to perform block moves.  When @option{-mno-mvcle} is specified,
30579 use a @code{mvc} loop instead.  This is the default unless optimizing for
30580 size.
30582 @item -mdebug
30583 @itemx -mno-debug
30584 @opindex mdebug
30585 @opindex mno-debug
30586 Print (or do not print) additional debug information when compiling.
30587 The default is to not print debug information.
30589 @item -march=@var{cpu-type}
30590 @opindex march
30591 Generate code that runs on @var{cpu-type}, which is the name of a
30592 system representing a certain processor type.  Possible values for
30593 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
30594 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
30595 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
30596 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
30597 @samp{z16}/@samp{arch14}, and @samp{native}.
30599 The default is @option{-march=z900}.
30601 Specifying @samp{native} as cpu type can be used to select the best
30602 architecture option for the host processor.
30603 @option{-march=native} has no effect if GCC does not recognize the
30604 processor.
30606 @item -mtune=@var{cpu-type}
30607 @opindex mtune
30608 Tune to @var{cpu-type} everything applicable about the generated code,
30609 except for the ABI and the set of available instructions.
30610 The list of @var{cpu-type} values is the same as for @option{-march}.
30611 The default is the value used for @option{-march}.
30613 @item -mtpf-trace
30614 @itemx -mno-tpf-trace
30615 @opindex mtpf-trace
30616 @opindex mno-tpf-trace
30617 Generate code that adds (does not add) in TPF OS specific branches to trace
30618 routines in the operating system.  This option is off by default, even
30619 when compiling for the TPF OS@.
30621 @item -mtpf-trace-skip
30622 @itemx -mno-tpf-trace-skip
30623 @opindex mtpf-trace-skip
30624 @opindex mno-tpf-trace-skip
30625 Generate code that changes (does not change) the default branch
30626 targets enabled by @option{-mtpf-trace} to point to specialized trace
30627 routines providing the ability of selectively skipping function trace
30628 entries for the TPF OS.  This option is off by default, even when
30629 compiling for the TPF OS and specifying @option{-mtpf-trace}.
30631 @item -mfused-madd
30632 @itemx -mno-fused-madd
30633 @opindex mfused-madd
30634 @opindex mno-fused-madd
30635 Generate code that uses (does not use) the floating-point multiply and
30636 accumulate instructions.  These instructions are generated by default if
30637 hardware floating point is used.
30639 @item -mwarn-framesize=@var{framesize}
30640 @opindex mwarn-framesize
30641 Emit a warning if the current function exceeds the given frame size.  Because
30642 this is a compile-time check it doesn't need to be a real problem when the program
30643 runs.  It is intended to identify functions that most probably cause
30644 a stack overflow.  It is useful to be used in an environment with limited stack
30645 size e.g.@: the linux kernel.
30647 @item -mwarn-dynamicstack
30648 @opindex mwarn-dynamicstack
30649 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
30650 arrays.  This is generally a bad idea with a limited stack size.
30652 @item -mstack-guard=@var{stack-guard}
30653 @itemx -mstack-size=@var{stack-size}
30654 @opindex mstack-guard
30655 @opindex mstack-size
30656 If these options are provided the S/390 back end emits additional instructions in
30657 the function prologue that trigger a trap if the stack size is @var{stack-guard}
30658 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
30659 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
30660 the frame size of the compiled function is chosen.
30661 These options are intended to be used to help debugging stack overflow problems.
30662 The additionally emitted code causes only little overhead and hence can also be
30663 used in production-like systems without greater performance degradation.  The given
30664 values have to be exact powers of 2 and @var{stack-size} has to be greater than
30665 @var{stack-guard} without exceeding 64k.
30666 In order to be efficient the extra code makes the assumption that the stack starts
30667 at an address aligned to the value given by @var{stack-size}.
30668 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
30670 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
30671 @opindex mhotpatch
30672 If the hotpatch option is enabled, a ``hot-patching'' function
30673 prologue is generated for all functions in the compilation unit.
30674 The funtion label is prepended with the given number of two-byte
30675 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
30676 the label, 2 * @var{post-halfwords} bytes are appended, using the
30677 largest NOP like instructions the architecture allows (maximum
30678 1000000).
30680 If both arguments are zero, hotpatching is disabled.
30682 This option can be overridden for individual functions with the
30683 @code{hotpatch} attribute.
30684 @end table
30686 @node SH Options
30687 @subsection SH Options
30689 These @samp{-m} options are defined for the SH implementations:
30691 @table @gcctabopt
30692 @item -m1
30693 @opindex m1
30694 Generate code for the SH1.
30696 @item -m2
30697 @opindex m2
30698 Generate code for the SH2.
30700 @item -m2e
30701 Generate code for the SH2e.
30703 @item -m2a-nofpu
30704 @opindex m2a-nofpu
30705 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
30706 that the floating-point unit is not used.
30708 @item -m2a-single-only
30709 @opindex m2a-single-only
30710 Generate code for the SH2a-FPU, in such a way that no double-precision
30711 floating-point operations are used.
30713 @item -m2a-single
30714 @opindex m2a-single
30715 Generate code for the SH2a-FPU assuming the floating-point unit is in
30716 single-precision mode by default.
30718 @item -m2a
30719 @opindex m2a
30720 Generate code for the SH2a-FPU assuming the floating-point unit is in
30721 double-precision mode by default.
30723 @item -m3
30724 @opindex m3
30725 Generate code for the SH3.
30727 @item -m3e
30728 @opindex m3e
30729 Generate code for the SH3e.
30731 @item -m4-nofpu
30732 @opindex m4-nofpu
30733 Generate code for the SH4 without a floating-point unit.
30735 @item -m4-single-only
30736 @opindex m4-single-only
30737 Generate code for the SH4 with a floating-point unit that only
30738 supports single-precision arithmetic.
30740 @item -m4-single
30741 @opindex m4-single
30742 Generate code for the SH4 assuming the floating-point unit is in
30743 single-precision mode by default.
30745 @item -m4
30746 @opindex m4
30747 Generate code for the SH4.
30749 @item -m4-100
30750 @opindex m4-100
30751 Generate code for SH4-100.
30753 @item -m4-100-nofpu
30754 @opindex m4-100-nofpu
30755 Generate code for SH4-100 in such a way that the
30756 floating-point unit is not used.
30758 @item -m4-100-single
30759 @opindex m4-100-single
30760 Generate code for SH4-100 assuming the floating-point unit is in
30761 single-precision mode by default.
30763 @item -m4-100-single-only
30764 @opindex m4-100-single-only
30765 Generate code for SH4-100 in such a way that no double-precision
30766 floating-point operations are used.
30768 @item -m4-200
30769 @opindex m4-200
30770 Generate code for SH4-200.
30772 @item -m4-200-nofpu
30773 @opindex m4-200-nofpu
30774 Generate code for SH4-200 without in such a way that the
30775 floating-point unit is not used.
30777 @item -m4-200-single
30778 @opindex m4-200-single
30779 Generate code for SH4-200 assuming the floating-point unit is in
30780 single-precision mode by default.
30782 @item -m4-200-single-only
30783 @opindex m4-200-single-only
30784 Generate code for SH4-200 in such a way that no double-precision
30785 floating-point operations are used.
30787 @item -m4-300
30788 @opindex m4-300
30789 Generate code for SH4-300.
30791 @item -m4-300-nofpu
30792 @opindex m4-300-nofpu
30793 Generate code for SH4-300 without in such a way that the
30794 floating-point unit is not used.
30796 @item -m4-300-single
30797 @opindex m4-300-single
30798 Generate code for SH4-300 in such a way that no double-precision
30799 floating-point operations are used.
30801 @item -m4-300-single-only
30802 @opindex m4-300-single-only
30803 Generate code for SH4-300 in such a way that no double-precision
30804 floating-point operations are used.
30806 @item -m4-340
30807 @opindex m4-340
30808 Generate code for SH4-340 (no MMU, no FPU).
30810 @item -m4-500
30811 @opindex m4-500
30812 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
30813 assembler.
30815 @item -m4a-nofpu
30816 @opindex m4a-nofpu
30817 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
30818 floating-point unit is not used.
30820 @item -m4a-single-only
30821 @opindex m4a-single-only
30822 Generate code for the SH4a, in such a way that no double-precision
30823 floating-point operations are used.
30825 @item -m4a-single
30826 @opindex m4a-single
30827 Generate code for the SH4a assuming the floating-point unit is in
30828 single-precision mode by default.
30830 @item -m4a
30831 @opindex m4a
30832 Generate code for the SH4a.
30834 @item -m4al
30835 @opindex m4al
30836 Same as @option{-m4a-nofpu}, except that it implicitly passes
30837 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
30838 instructions at the moment.
30840 @item -mb
30841 @opindex mb
30842 Compile code for the processor in big-endian mode.
30844 @item -ml
30845 @opindex ml
30846 Compile code for the processor in little-endian mode.
30848 @item -mdalign
30849 @opindex mdalign
30850 Align doubles at 64-bit boundaries.  Note that this changes the calling
30851 conventions, and thus some functions from the standard C library do
30852 not work unless you recompile it first with @option{-mdalign}.
30854 @item -mrelax
30855 @opindex mrelax
30856 Shorten some address references at link time, when possible; uses the
30857 linker option @option{-relax}.
30859 @item -mbigtable
30860 @opindex mbigtable
30861 Use 32-bit offsets in @code{switch} tables.  The default is to use
30862 16-bit offsets.
30864 @item -mbitops
30865 @opindex mbitops
30866 Enable the use of bit manipulation instructions on SH2A.
30868 @item -mfmovd
30869 @opindex mfmovd
30870 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
30871 alignment constraints.
30873 @item -mrenesas
30874 @opindex mrenesas
30875 Comply with the calling conventions defined by Renesas.
30877 @item -mno-renesas
30878 @opindex mno-renesas
30879 Comply with the calling conventions defined for GCC before the Renesas
30880 conventions were available.  This option is the default for all
30881 targets of the SH toolchain.
30883 @item -mnomacsave
30884 @opindex mnomacsave
30885 Mark the @code{MAC} register as call-clobbered, even if
30886 @option{-mrenesas} is given.
30888 @item -mieee
30889 @itemx -mno-ieee
30890 @opindex mieee
30891 @opindex mno-ieee
30892 Control the IEEE compliance of floating-point comparisons, which affects the
30893 handling of cases where the result of a comparison is unordered.  By default
30894 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
30895 enabled @option{-mno-ieee} is implicitly set, which results in faster
30896 floating-point greater-equal and less-equal comparisons.  The implicit settings
30897 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
30899 @item -minline-ic_invalidate
30900 @opindex minline-ic_invalidate
30901 Inline code to invalidate instruction cache entries after setting up
30902 nested function trampolines.
30903 This option has no effect if @option{-musermode} is in effect and the selected
30904 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
30905 instruction.
30906 If the selected code generation option does not allow the use of the @code{icbi}
30907 instruction, and @option{-musermode} is not in effect, the inlined code
30908 manipulates the instruction cache address array directly with an associative
30909 write.  This not only requires privileged mode at run time, but it also
30910 fails if the cache line had been mapped via the TLB and has become unmapped.
30912 @item -misize
30913 @opindex misize
30914 Dump instruction size and location in the assembly code.
30916 @item -mpadstruct
30917 @opindex mpadstruct
30918 This option is deprecated.  It pads structures to multiple of 4 bytes,
30919 which is incompatible with the SH ABI@.
30921 @item -matomic-model=@var{model}
30922 @opindex matomic-model=@var{model}
30923 Sets the model of atomic operations and additional parameters as a comma
30924 separated list.  For details on the atomic built-in functions see
30925 @ref{__atomic Builtins}.  The following models and parameters are supported:
30927 @table @samp
30929 @item none
30930 Disable compiler generated atomic sequences and emit library calls for atomic
30931 operations.  This is the default if the target is not @code{sh*-*-linux*}.
30933 @item soft-gusa
30934 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
30935 built-in functions.  The generated atomic sequences require additional support
30936 from the interrupt/exception handling code of the system and are only suitable
30937 for SH3* and SH4* single-core systems.  This option is enabled by default when
30938 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
30939 this option also partially utilizes the hardware atomic instructions
30940 @code{movli.l} and @code{movco.l} to create more efficient code, unless
30941 @samp{strict} is specified.  
30943 @item soft-tcb
30944 Generate software atomic sequences that use a variable in the thread control
30945 block.  This is a variation of the gUSA sequences which can also be used on
30946 SH1* and SH2* targets.  The generated atomic sequences require additional
30947 support from the interrupt/exception handling code of the system and are only
30948 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
30949 parameter has to be specified as well.
30951 @item soft-imask
30952 Generate software atomic sequences that temporarily disable interrupts by
30953 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
30954 in privileged mode and is only suitable for single-core systems.  Additional
30955 support from the interrupt/exception handling code of the system is not
30956 required.  This model is enabled by default when the target is
30957 @code{sh*-*-linux*} and SH1* or SH2*.
30959 @item hard-llcs
30960 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
30961 instructions only.  This is only available on SH4A and is suitable for
30962 multi-core systems.  Since the hardware instructions support only 32 bit atomic
30963 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
30964 Code compiled with this option is also compatible with other software
30965 atomic model interrupt/exception handling systems if executed on an SH4A
30966 system.  Additional support from the interrupt/exception handling code of the
30967 system is not required for this model.
30969 @item gbr-offset=
30970 This parameter specifies the offset in bytes of the variable in the thread
30971 control block structure that should be used by the generated atomic sequences
30972 when the @samp{soft-tcb} model has been selected.  For other models this
30973 parameter is ignored.  The specified value must be an integer multiple of four
30974 and in the range 0-1020.
30976 @item strict
30977 This parameter prevents mixed usage of multiple atomic models, even if they
30978 are compatible, and makes the compiler generate atomic sequences of the
30979 specified model only.
30981 @end table
30983 @item -mtas
30984 @opindex mtas
30985 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
30986 Notice that depending on the particular hardware and software configuration
30987 this can degrade overall performance due to the operand cache line flushes
30988 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
30989 processors the @code{tas.b} instruction must be used with caution since it
30990 can result in data corruption for certain cache configurations.
30992 @item -mprefergot
30993 @opindex mprefergot
30994 When generating position-independent code, emit function calls using
30995 the Global Offset Table instead of the Procedure Linkage Table.
30997 @item -musermode
30998 @itemx -mno-usermode
30999 @opindex musermode
31000 @opindex mno-usermode
31001 Don't allow (allow) the compiler generating privileged mode code.  Specifying
31002 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
31003 inlined code would not work in user mode.  @option{-musermode} is the default
31004 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
31005 @option{-musermode} has no effect, since there is no user mode.
31007 @item -multcost=@var{number}
31008 @opindex multcost=@var{number}
31009 Set the cost to assume for a multiply insn.
31011 @item -mdiv=@var{strategy}
31012 @opindex mdiv=@var{strategy}
31013 Set the division strategy to be used for integer division operations.
31014 @var{strategy} can be one of: 
31016 @table @samp
31018 @item call-div1
31019 Calls a library function that uses the single-step division instruction
31020 @code{div1} to perform the operation.  Division by zero calculates an
31021 unspecified result and does not trap.  This is the default except for SH4,
31022 SH2A and SHcompact.
31024 @item call-fp
31025 Calls a library function that performs the operation in double precision
31026 floating point.  Division by zero causes a floating-point exception.  This is
31027 the default for SHcompact with FPU.  Specifying this for targets that do not
31028 have a double precision FPU defaults to @code{call-div1}.
31030 @item call-table
31031 Calls a library function that uses a lookup table for small divisors and
31032 the @code{div1} instruction with case distinction for larger divisors.  Division
31033 by zero calculates an unspecified result and does not trap.  This is the default
31034 for SH4.  Specifying this for targets that do not have dynamic shift
31035 instructions defaults to @code{call-div1}.
31037 @end table
31039 When a division strategy has not been specified the default strategy is
31040 selected based on the current target.  For SH2A the default strategy is to
31041 use the @code{divs} and @code{divu} instructions instead of library function
31042 calls.
31044 @item -maccumulate-outgoing-args
31045 @opindex maccumulate-outgoing-args
31046 Reserve space once for outgoing arguments in the function prologue rather
31047 than around each call.  Generally beneficial for performance and size.  Also
31048 needed for unwinding to avoid changing the stack frame around conditional code.
31050 @item -mdivsi3_libfunc=@var{name}
31051 @opindex mdivsi3_libfunc=@var{name}
31052 Set the name of the library function used for 32-bit signed division to
31053 @var{name}.
31054 This only affects the name used in the @samp{call} division strategies, and
31055 the compiler still expects the same sets of input/output/clobbered registers as
31056 if this option were not present.
31058 @item -mfixed-range=@var{register-range}
31059 @opindex mfixed-range
31060 Generate code treating the given register range as fixed registers.
31061 A fixed register is one that the register allocator cannot use.  This is
31062 useful when compiling kernel code.  A register range is specified as
31063 two registers separated by a dash.  Multiple register ranges can be
31064 specified separated by a comma.
31066 @item -mbranch-cost=@var{num}
31067 @opindex mbranch-cost=@var{num}
31068 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
31069 make the compiler try to generate more branch-free code if possible.  
31070 If not specified the value is selected depending on the processor type that
31071 is being compiled for.
31073 @item -mzdcbranch
31074 @itemx -mno-zdcbranch
31075 @opindex mzdcbranch
31076 @opindex mno-zdcbranch
31077 Assume (do not assume) that zero displacement conditional branch instructions
31078 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
31079 compiler prefers zero displacement branch code sequences.  This is
31080 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
31081 disabled by specifying @option{-mno-zdcbranch}.
31083 @item -mcbranch-force-delay-slot
31084 @opindex mcbranch-force-delay-slot
31085 Force the usage of delay slots for conditional branches, which stuffs the delay
31086 slot with a @code{nop} if a suitable instruction cannot be found.  By default
31087 this option is disabled.  It can be enabled to work around hardware bugs as
31088 found in the original SH7055.
31090 @item -mfused-madd
31091 @itemx -mno-fused-madd
31092 @opindex mfused-madd
31093 @opindex mno-fused-madd
31094 Generate code that uses (does not use) the floating-point multiply and
31095 accumulate instructions.  These instructions are generated by default
31096 if hardware floating point is used.  The machine-dependent
31097 @option{-mfused-madd} option is now mapped to the machine-independent
31098 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31099 mapped to @option{-ffp-contract=off}.
31101 @item -mfsca
31102 @itemx -mno-fsca
31103 @opindex mfsca
31104 @opindex mno-fsca
31105 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31106 and cosine approximations.  The option @option{-mfsca} must be used in
31107 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
31108 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
31109 approximations even if @option{-funsafe-math-optimizations} is in effect.
31111 @item -mfsrra
31112 @itemx -mno-fsrra
31113 @opindex mfsrra
31114 @opindex mno-fsrra
31115 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31116 reciprocal square root approximations.  The option @option{-mfsrra} must be used
31117 in combination with @option{-funsafe-math-optimizations} and
31118 @option{-ffinite-math-only}.  It is enabled by default when generating code for
31119 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
31120 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31121 in effect.
31123 @item -mpretend-cmove
31124 @opindex mpretend-cmove
31125 Prefer zero-displacement conditional branches for conditional move instruction
31126 patterns.  This can result in faster code on the SH4 processor.
31128 @item -mfdpic
31129 @opindex fdpic
31130 Generate code using the FDPIC ABI.
31132 @end table
31134 @node Solaris 2 Options
31135 @subsection Solaris 2 Options
31136 @cindex Solaris 2 options
31138 These @samp{-m} options are supported on Solaris 2:
31140 @table @gcctabopt
31141 @item -mclear-hwcap
31142 @opindex mclear-hwcap
31143 @option{-mclear-hwcap} tells the compiler to remove the hardware
31144 capabilities generated by the Solaris assembler.  This is only necessary
31145 when object files use ISA extensions not supported by the current
31146 machine, but check at runtime whether or not to use them.
31148 @item -mimpure-text
31149 @opindex mimpure-text
31150 @option{-mimpure-text}, used in addition to @option{-shared}, tells
31151 the compiler to not pass @option{-z text} to the linker when linking a
31152 shared object.  Using this option, you can link position-dependent
31153 code into a shared object.
31155 @option{-mimpure-text} suppresses the ``relocations remain against
31156 allocatable but non-writable sections'' linker error message.
31157 However, the necessary relocations trigger copy-on-write, and the
31158 shared object is not actually shared across processes.  Instead of
31159 using @option{-mimpure-text}, you should compile all source code with
31160 @option{-fpic} or @option{-fPIC}.
31162 @end table
31164 These switches are supported in addition to the above on Solaris 2:
31166 @table @gcctabopt
31167 @item -pthreads
31168 @opindex pthreads
31169 This is a synonym for @option{-pthread}.
31170 @end table
31172 @node SPARC Options
31173 @subsection SPARC Options
31174 @cindex SPARC options
31176 These @samp{-m} options are supported on the SPARC:
31178 @table @gcctabopt
31179 @item -mno-app-regs
31180 @itemx -mapp-regs
31181 @opindex mno-app-regs
31182 @opindex mapp-regs
31183 Specify @option{-mapp-regs} to generate output using the global registers
31184 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
31185 global register 1, each global register 2 through 4 is then treated as an
31186 allocable register that is clobbered by function calls.  This is the default.
31188 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31189 specify @option{-mno-app-regs}.  You should compile libraries and system
31190 software with this option.
31192 @item -mflat
31193 @itemx -mno-flat
31194 @opindex mflat
31195 @opindex mno-flat
31196 With @option{-mflat}, the compiler does not generate save/restore instructions
31197 and uses a ``flat'' or single register window model.  This model is compatible
31198 with the regular register window model.  The local registers and the input
31199 registers (0--5) are still treated as ``call-saved'' registers and are
31200 saved on the stack as needed.
31202 With @option{-mno-flat} (the default), the compiler generates save/restore
31203 instructions (except for leaf functions).  This is the normal operating mode.
31205 @item -mfpu
31206 @itemx -mhard-float
31207 @opindex mfpu
31208 @opindex mhard-float
31209 Generate output containing floating-point instructions.  This is the
31210 default.
31212 @item -mno-fpu
31213 @itemx -msoft-float
31214 @opindex mno-fpu
31215 @opindex msoft-float
31216 Generate output containing library calls for floating point.
31217 @strong{Warning:} the requisite libraries are not available for all SPARC
31218 targets.  Normally the facilities of the machine's usual C compiler are
31219 used, but this cannot be done directly in cross-compilation.  You must make
31220 your own arrangements to provide suitable library functions for
31221 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
31222 @samp{sparclite-*-*} do provide software floating-point support.
31224 @option{-msoft-float} changes the calling convention in the output file;
31225 therefore, it is only useful if you compile @emph{all} of a program with
31226 this option.  In particular, you need to compile @file{libgcc.a}, the
31227 library that comes with GCC, with @option{-msoft-float} in order for
31228 this to work.
31230 @item -mhard-quad-float
31231 @opindex mhard-quad-float
31232 Generate output containing quad-word (long double) floating-point
31233 instructions.
31235 @item -msoft-quad-float
31236 @opindex msoft-quad-float
31237 Generate output containing library calls for quad-word (long double)
31238 floating-point instructions.  The functions called are those specified
31239 in the SPARC ABI@.  This is the default.
31241 As of this writing, there are no SPARC implementations that have hardware
31242 support for the quad-word floating-point instructions.  They all invoke
31243 a trap handler for one of these instructions, and then the trap handler
31244 emulates the effect of the instruction.  Because of the trap handler overhead,
31245 this is much slower than calling the ABI library routines.  Thus the
31246 @option{-msoft-quad-float} option is the default.
31248 @item -mno-unaligned-doubles
31249 @itemx -munaligned-doubles
31250 @opindex mno-unaligned-doubles
31251 @opindex munaligned-doubles
31252 Assume that doubles have 8-byte alignment.  This is the default.
31254 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
31255 alignment only if they are contained in another type, or if they have an
31256 absolute address.  Otherwise, it assumes they have 4-byte alignment.
31257 Specifying this option avoids some rare compatibility problems with code
31258 generated by other compilers.  It is not the default because it results
31259 in a performance loss, especially for floating-point code.
31261 @item -muser-mode
31262 @itemx -mno-user-mode
31263 @opindex muser-mode
31264 @opindex mno-user-mode
31265 Do not generate code that can only run in supervisor mode.  This is relevant
31266 only for the @code{casa} instruction emitted for the LEON3 processor.  This
31267 is the default.
31269 @item -mfaster-structs
31270 @itemx -mno-faster-structs
31271 @opindex mfaster-structs
31272 @opindex mno-faster-structs
31273 With @option{-mfaster-structs}, the compiler assumes that structures
31274 should have 8-byte alignment.  This enables the use of pairs of
31275 @code{ldd} and @code{std} instructions for copies in structure
31276 assignment, in place of twice as many @code{ld} and @code{st} pairs.
31277 However, the use of this changed alignment directly violates the SPARC
31278 ABI@.  Thus, it's intended only for use on targets where the developer
31279 acknowledges that their resulting code is not directly in line with
31280 the rules of the ABI@.
31282 @item -mstd-struct-return
31283 @itemx -mno-std-struct-return
31284 @opindex mstd-struct-return
31285 @opindex mno-std-struct-return
31286 With @option{-mstd-struct-return}, the compiler generates checking code
31287 in functions returning structures or unions to detect size mismatches
31288 between the two sides of function calls, as per the 32-bit ABI@.
31290 The default is @option{-mno-std-struct-return}.  This option has no effect
31291 in 64-bit mode.
31293 @item -mlra
31294 @itemx -mno-lra
31295 @opindex mlra
31296 @opindex mno-lra
31297 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
31298 so @option{-mno-lra} needs to be passed to get old Reload.
31300 @item -mcpu=@var{cpu_type}
31301 @opindex mcpu
31302 Set the instruction set, register set, and instruction scheduling parameters
31303 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
31304 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
31305 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
31306 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
31307 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
31308 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
31309 @samp{m8}.
31311 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
31312 which selects the best architecture option for the host processor.
31313 @option{-mcpu=native} has no effect if GCC does not recognize
31314 the processor.
31316 Default instruction scheduling parameters are used for values that select
31317 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
31318 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
31320 Here is a list of each supported architecture and their supported
31321 implementations.
31323 @table @asis
31324 @item v7
31325 cypress, leon3v7
31327 @item v8
31328 supersparc, hypersparc, leon, leon3, leon5
31330 @item sparclite
31331 f930, f934, sparclite86x
31333 @item sparclet
31334 tsc701
31336 @item v9
31337 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
31338 niagara7, m8
31339 @end table
31341 By default (unless configured otherwise), GCC generates code for the V7
31342 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
31343 additionally optimizes it for the Cypress CY7C602 chip, as used in the
31344 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
31345 SPARCStation 1, 2, IPX etc.
31347 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
31348 architecture.  The only difference from V7 code is that the compiler emits
31349 the integer multiply and integer divide instructions which exist in SPARC-V8
31350 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
31351 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
31352 2000 series.
31354 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
31355 the SPARC architecture.  This adds the integer multiply, integer divide step
31356 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
31357 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
31358 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
31359 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
31360 MB86934 chip, which is the more recent SPARClite with FPU@.
31362 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
31363 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
31364 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
31365 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
31366 optimizes it for the TEMIC SPARClet chip.
31368 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
31369 architecture.  This adds 64-bit integer and floating-point move instructions,
31370 3 additional floating-point condition code registers and conditional move
31371 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
31372 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
31373 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
31374 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
31375 @option{-mcpu=niagara}, the compiler additionally optimizes it for
31376 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
31377 additionally optimizes it for Sun UltraSPARC T2 chips. With
31378 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
31379 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
31380 additionally optimizes it for Sun UltraSPARC T4 chips.  With
31381 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
31382 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
31383 additionally optimizes it for Oracle M8 chips.
31385 @item -mtune=@var{cpu_type}
31386 @opindex mtune
31387 Set the instruction scheduling parameters for machine type
31388 @var{cpu_type}, but do not set the instruction set or register set that the
31389 option @option{-mcpu=@var{cpu_type}} does.
31391 The same values for @option{-mcpu=@var{cpu_type}} can be used for
31392 @option{-mtune=@var{cpu_type}}, but the only useful values are those
31393 that select a particular CPU implementation.  Those are
31394 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
31395 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
31396 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
31397 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
31398 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
31399 and GNU/Linux toolchains, @samp{native} can also be used.
31401 @item -mv8plus
31402 @itemx -mno-v8plus
31403 @opindex mv8plus
31404 @opindex mno-v8plus
31405 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
31406 difference from the V8 ABI is that the global and out registers are
31407 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
31408 mode for all SPARC-V9 processors.
31410 @item -mvis
31411 @itemx -mno-vis
31412 @opindex mvis
31413 @opindex mno-vis
31414 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
31415 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
31417 @item -mvis2
31418 @itemx -mno-vis2
31419 @opindex mvis2
31420 @opindex mno-vis2
31421 With @option{-mvis2}, GCC generates code that takes advantage of
31422 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
31423 default is @option{-mvis2} when targeting a cpu that supports such
31424 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
31425 also sets @option{-mvis}.
31427 @item -mvis3
31428 @itemx -mno-vis3
31429 @opindex mvis3
31430 @opindex mno-vis3
31431 With @option{-mvis3}, GCC generates code that takes advantage of
31432 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
31433 default is @option{-mvis3} when targeting a cpu that supports such
31434 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
31435 also sets @option{-mvis2} and @option{-mvis}.
31437 @item -mvis4
31438 @itemx -mno-vis4
31439 @opindex mvis4
31440 @opindex mno-vis4
31441 With @option{-mvis4}, GCC generates code that takes advantage of
31442 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
31443 default is @option{-mvis4} when targeting a cpu that supports such
31444 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
31445 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
31447 @item -mvis4b
31448 @itemx -mno-vis4b
31449 @opindex mvis4b
31450 @opindex mno-vis4b
31451 With @option{-mvis4b}, GCC generates code that takes advantage of
31452 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
31453 the additional VIS instructions introduced in the Oracle SPARC
31454 Architecture 2017.  The default is @option{-mvis4b} when targeting a
31455 cpu that supports such instructions, such as m8 and later.  Setting
31456 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
31457 @option{-mvis2} and @option{-mvis}.
31459 @item -mcbcond
31460 @itemx -mno-cbcond
31461 @opindex mcbcond
31462 @opindex mno-cbcond
31463 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
31464 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
31465 when targeting a CPU that supports such instructions, such as Niagara-4 and
31466 later.
31468 @item -mfmaf
31469 @itemx -mno-fmaf
31470 @opindex mfmaf
31471 @opindex mno-fmaf
31472 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
31473 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
31474 when targeting a CPU that supports such instructions, such as Niagara-3 and
31475 later.
31477 @item -mfsmuld
31478 @itemx -mno-fsmuld
31479 @opindex mfsmuld
31480 @opindex mno-fsmuld
31481 With @option{-mfsmuld}, GCC generates code that takes advantage of the
31482 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
31483 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
31484 or V9 with FPU except @option{-mcpu=leon}.
31486 @item -mpopc
31487 @itemx -mno-popc
31488 @opindex mpopc
31489 @opindex mno-popc
31490 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
31491 Population Count instruction.  The default is @option{-mpopc}
31492 when targeting a CPU that supports such an instruction, such as Niagara-2 and
31493 later.
31495 @item -msubxc
31496 @itemx -mno-subxc
31497 @opindex msubxc
31498 @opindex mno-subxc
31499 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
31500 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
31501 when targeting a CPU that supports such an instruction, such as Niagara-7 and
31502 later.
31504 @item -mfix-at697f
31505 @opindex mfix-at697f
31506 Enable the documented workaround for the single erratum of the Atmel AT697F
31507 processor (which corresponds to erratum #13 of the AT697E processor).
31509 @item -mfix-ut699
31510 @opindex mfix-ut699
31511 Enable the documented workarounds for the floating-point errata and the data
31512 cache nullify errata of the UT699 processor.
31514 @item -mfix-ut700
31515 @opindex mfix-ut700
31516 Enable the documented workaround for the back-to-back store errata of
31517 the UT699E/UT700 processor.
31519 @item -mfix-gr712rc
31520 @opindex mfix-gr712rc
31521 Enable the documented workaround for the back-to-back store errata of
31522 the GR712RC processor.
31523 @end table
31525 These @samp{-m} options are supported in addition to the above
31526 on SPARC-V9 processors in 64-bit environments:
31528 @table @gcctabopt
31529 @item -m32
31530 @itemx -m64
31531 @opindex m32
31532 @opindex m64
31533 Generate code for a 32-bit or 64-bit environment.
31534 The 32-bit environment sets int, long and pointer to 32 bits.
31535 The 64-bit environment sets int to 32 bits and long and pointer
31536 to 64 bits.
31538 @item -mcmodel=@var{which}
31539 @opindex mcmodel
31540 Set the code model to one of
31542 @table @samp
31543 @item medlow
31544 The Medium/Low code model: 64-bit addresses, programs
31545 must be linked in the low 32 bits of memory.  Programs can be statically
31546 or dynamically linked.
31548 @item medmid
31549 The Medium/Middle code model: 64-bit addresses, programs
31550 must be linked in the low 44 bits of memory, the text and data segments must
31551 be less than 2GB in size and the data segment must be located within 2GB of
31552 the text segment.
31554 @item medany
31555 The Medium/Anywhere code model: 64-bit addresses, programs
31556 may be linked anywhere in memory, the text and data segments must be less
31557 than 2GB in size and the data segment must be located within 2GB of the
31558 text segment.
31560 @item embmedany
31561 The Medium/Anywhere code model for embedded systems:
31562 64-bit addresses, the text and data segments must be less than 2GB in
31563 size, both starting anywhere in memory (determined at link time).  The
31564 global register %g4 points to the base of the data segment.  Programs
31565 are statically linked and PIC is not supported.
31566 @end table
31568 @item -mmemory-model=@var{mem-model}
31569 @opindex mmemory-model
31570 Set the memory model in force on the processor to one of
31572 @table @samp
31573 @item default
31574 The default memory model for the processor and operating system.
31576 @item rmo
31577 Relaxed Memory Order
31579 @item pso
31580 Partial Store Order
31582 @item tso
31583 Total Store Order
31585 @item sc
31586 Sequential Consistency
31587 @end table
31589 These memory models are formally defined in Appendix D of the SPARC-V9
31590 architecture manual, as set in the processor's @code{PSTATE.MM} field.
31592 @item -mstack-bias
31593 @itemx -mno-stack-bias
31594 @opindex mstack-bias
31595 @opindex mno-stack-bias
31596 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
31597 frame pointer if present, are offset by @minus{}2047 which must be added back
31598 when making stack frame references.  This is the default in 64-bit mode.
31599 Otherwise, assume no such offset is present.
31600 @end table
31602 @node System V Options
31603 @subsection Options for System V
31605 These additional options are available on System V Release 4 for
31606 compatibility with other compilers on those systems:
31608 @table @gcctabopt
31609 @item -G
31610 @opindex G
31611 Create a shared object.
31612 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
31614 @item -Qy
31615 @opindex Qy
31616 Identify the versions of each tool used by the compiler, in a
31617 @code{.ident} assembler directive in the output.
31619 @item -Qn
31620 @opindex Qn
31621 Refrain from adding @code{.ident} directives to the output file (this is
31622 the default).
31624 @item -YP,@var{dirs}
31625 @opindex YP
31626 Search the directories @var{dirs}, and no others, for libraries
31627 specified with @option{-l}.
31629 @item -Ym,@var{dir}
31630 @opindex Ym
31631 Look in the directory @var{dir} to find the M4 preprocessor.
31632 The assembler uses this option.
31633 @c This is supposed to go with a -Yd for predefined M4 macro files, but
31634 @c the generic assembler that comes with Solaris takes just -Ym.
31635 @end table
31637 @node V850 Options
31638 @subsection V850 Options
31639 @cindex V850 Options
31641 These @samp{-m} options are defined for V850 implementations:
31643 @table @gcctabopt
31644 @item -mlong-calls
31645 @itemx -mno-long-calls
31646 @opindex mlong-calls
31647 @opindex mno-long-calls
31648 Treat all calls as being far away (near).  If calls are assumed to be
31649 far away, the compiler always loads the function's address into a
31650 register, and calls indirect through the pointer.
31652 @item -mno-ep
31653 @itemx -mep
31654 @opindex mno-ep
31655 @opindex mep
31656 Do not optimize (do optimize) basic blocks that use the same index
31657 pointer 4 or more times to copy pointer into the @code{ep} register, and
31658 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
31659 option is on by default if you optimize.
31661 @item -mno-prolog-function
31662 @itemx -mprolog-function
31663 @opindex mno-prolog-function
31664 @opindex mprolog-function
31665 Do not use (do use) external functions to save and restore registers
31666 at the prologue and epilogue of a function.  The external functions
31667 are slower, but use less code space if more than one function saves
31668 the same number of registers.  The @option{-mprolog-function} option
31669 is on by default if you optimize.
31671 @item -mspace
31672 @opindex mspace
31673 Try to make the code as small as possible.  At present, this just turns
31674 on the @option{-mep} and @option{-mprolog-function} options.
31676 @item -mtda=@var{n}
31677 @opindex mtda
31678 Put static or global variables whose size is @var{n} bytes or less into
31679 the tiny data area that register @code{ep} points to.  The tiny data
31680 area can hold up to 256 bytes in total (128 bytes for byte references).
31682 @item -msda=@var{n}
31683 @opindex msda
31684 Put static or global variables whose size is @var{n} bytes or less into
31685 the small data area that register @code{gp} points to.  The small data
31686 area can hold up to 64 kilobytes.
31688 @item -mzda=@var{n}
31689 @opindex mzda
31690 Put static or global variables whose size is @var{n} bytes or less into
31691 the first 32 kilobytes of memory.
31693 @item -mv850
31694 @opindex mv850
31695 Specify that the target processor is the V850.
31697 @item -mv850e3v5
31698 @opindex mv850e3v5
31699 Specify that the target processor is the V850E3V5.  The preprocessor
31700 constant @code{__v850e3v5__} is defined if this option is used.
31702 @item -mv850e2v4
31703 @opindex mv850e2v4
31704 Specify that the target processor is the V850E3V5.  This is an alias for
31705 the @option{-mv850e3v5} option.
31707 @item -mv850e2v3
31708 @opindex mv850e2v3
31709 Specify that the target processor is the V850E2V3.  The preprocessor
31710 constant @code{__v850e2v3__} is defined if this option is used.
31712 @item -mv850e2
31713 @opindex mv850e2
31714 Specify that the target processor is the V850E2.  The preprocessor
31715 constant @code{__v850e2__} is defined if this option is used.
31717 @item -mv850e1
31718 @opindex mv850e1
31719 Specify that the target processor is the V850E1.  The preprocessor
31720 constants @code{__v850e1__} and @code{__v850e__} are defined if
31721 this option is used.
31723 @item -mv850es
31724 @opindex mv850es
31725 Specify that the target processor is the V850ES.  This is an alias for
31726 the @option{-mv850e1} option.
31728 @item -mv850e
31729 @opindex mv850e
31730 Specify that the target processor is the V850E@.  The preprocessor
31731 constant @code{__v850e__} is defined if this option is used.
31733 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
31734 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
31735 are defined then a default target processor is chosen and the
31736 relevant @samp{__v850*__} preprocessor constant is defined.
31738 The preprocessor constants @code{__v850} and @code{__v851__} are always
31739 defined, regardless of which processor variant is the target.
31741 @item -mdisable-callt
31742 @itemx -mno-disable-callt
31743 @opindex mdisable-callt
31744 @opindex mno-disable-callt
31745 This option suppresses generation of the @code{CALLT} instruction for the
31746 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
31747 architecture.
31749 This option is enabled by default when the RH850 ABI is
31750 in use (see @option{-mrh850-abi}), and disabled by default when the
31751 GCC ABI is in use.  If @code{CALLT} instructions are being generated
31752 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
31754 @item -mrelax
31755 @itemx -mno-relax
31756 @opindex mrelax
31757 @opindex mno-relax
31758 Pass on (or do not pass on) the @option{-mrelax} command-line option
31759 to the assembler.
31761 @item -mlong-jumps
31762 @itemx -mno-long-jumps
31763 @opindex mlong-jumps
31764 @opindex mno-long-jumps
31765 Disable (or re-enable) the generation of PC-relative jump instructions.
31767 @item -msoft-float
31768 @itemx -mhard-float
31769 @opindex msoft-float
31770 @opindex mhard-float
31771 Disable (or re-enable) the generation of hardware floating point
31772 instructions.  This option is only significant when the target
31773 architecture is @samp{V850E2V3} or higher.  If hardware floating point
31774 instructions are being generated then the C preprocessor symbol
31775 @code{__FPU_OK__} is defined, otherwise the symbol
31776 @code{__NO_FPU__} is defined.
31778 @item -mloop
31779 @opindex mloop
31780 Enables the use of the e3v5 LOOP instruction.  The use of this
31781 instruction is not enabled by default when the e3v5 architecture is
31782 selected because its use is still experimental.
31784 @item -mrh850-abi
31785 @itemx -mghs
31786 @opindex mrh850-abi
31787 @opindex mghs
31788 Enables support for the RH850 version of the V850 ABI.  This is the
31789 default.  With this version of the ABI the following rules apply:
31791 @itemize
31792 @item
31793 Integer sized structures and unions are returned via a memory pointer
31794 rather than a register.
31796 @item
31797 Large structures and unions (more than 8 bytes in size) are passed by
31798 value.
31800 @item
31801 Functions are aligned to 16-bit boundaries.
31803 @item
31804 The @option{-m8byte-align} command-line option is supported.
31806 @item
31807 The @option{-mdisable-callt} command-line option is enabled by
31808 default.  The @option{-mno-disable-callt} command-line option is not
31809 supported.
31810 @end itemize
31812 When this version of the ABI is enabled the C preprocessor symbol
31813 @code{__V850_RH850_ABI__} is defined.
31815 @item -mgcc-abi
31816 @opindex mgcc-abi
31817 Enables support for the old GCC version of the V850 ABI.  With this
31818 version of the ABI the following rules apply:
31820 @itemize
31821 @item
31822 Integer sized structures and unions are returned in register @code{r10}.
31824 @item
31825 Large structures and unions (more than 8 bytes in size) are passed by
31826 reference.
31828 @item
31829 Functions are aligned to 32-bit boundaries, unless optimizing for
31830 size.
31832 @item
31833 The @option{-m8byte-align} command-line option is not supported.
31835 @item
31836 The @option{-mdisable-callt} command-line option is supported but not
31837 enabled by default.
31838 @end itemize
31840 When this version of the ABI is enabled the C preprocessor symbol
31841 @code{__V850_GCC_ABI__} is defined.
31843 @item -m8byte-align
31844 @itemx -mno-8byte-align
31845 @opindex m8byte-align
31846 @opindex mno-8byte-align
31847 Enables support for @code{double} and @code{long long} types to be
31848 aligned on 8-byte boundaries.  The default is to restrict the
31849 alignment of all objects to at most 4-bytes.  When
31850 @option{-m8byte-align} is in effect the C preprocessor symbol
31851 @code{__V850_8BYTE_ALIGN__} is defined.
31853 @item -mbig-switch
31854 @opindex mbig-switch
31855 Generate code suitable for big switch tables.  Use this option only if
31856 the assembler/linker complain about out of range branches within a switch
31857 table.
31859 @item -mapp-regs
31860 @opindex mapp-regs
31861 This option causes r2 and r5 to be used in the code generated by
31862 the compiler.  This setting is the default.
31864 @item -mno-app-regs
31865 @opindex mno-app-regs
31866 This option causes r2 and r5 to be treated as fixed registers.
31868 @end table
31870 @node VAX Options
31871 @subsection VAX Options
31872 @cindex VAX options
31874 These @samp{-m} options are defined for the VAX:
31876 @table @gcctabopt
31877 @item -munix
31878 @opindex munix
31879 Do not output certain jump instructions (@code{aobleq} and so on)
31880 that the Unix assembler for the VAX cannot handle across long
31881 ranges.
31883 @item -mgnu
31884 @opindex mgnu
31885 Do output those jump instructions, on the assumption that the
31886 GNU assembler is being used.
31888 @item -mg
31889 @opindex mg
31890 Output code for G-format floating-point numbers instead of D-format.
31892 @item -mlra
31893 @itemx -mno-lra
31894 @opindex mlra
31895 @opindex mno-lra
31896 Enable Local Register Allocation.  This is still experimental for the VAX,
31897 so by default the compiler uses standard reload.
31898 @end table
31900 @node Visium Options
31901 @subsection Visium Options
31902 @cindex Visium options
31904 @table @gcctabopt
31906 @item -mdebug
31907 @opindex mdebug
31908 A program which performs file I/O and is destined to run on an MCM target
31909 should be linked with this option.  It causes the libraries libc.a and
31910 libdebug.a to be linked.  The program should be run on the target under
31911 the control of the GDB remote debugging stub.
31913 @item -msim
31914 @opindex msim
31915 A program which performs file I/O and is destined to run on the simulator
31916 should be linked with option.  This causes libraries libc.a and libsim.a to
31917 be linked.
31919 @item -mfpu
31920 @itemx -mhard-float
31921 @opindex mfpu
31922 @opindex mhard-float
31923 Generate code containing floating-point instructions.  This is the
31924 default.
31926 @item -mno-fpu
31927 @itemx -msoft-float
31928 @opindex mno-fpu
31929 @opindex msoft-float
31930 Generate code containing library calls for floating-point.
31932 @option{-msoft-float} changes the calling convention in the output file;
31933 therefore, it is only useful if you compile @emph{all} of a program with
31934 this option.  In particular, you need to compile @file{libgcc.a}, the
31935 library that comes with GCC, with @option{-msoft-float} in order for
31936 this to work.
31938 @item -mcpu=@var{cpu_type}
31939 @opindex mcpu
31940 Set the instruction set, register set, and instruction scheduling parameters
31941 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
31942 @samp{mcm}, @samp{gr5} and @samp{gr6}.
31944 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
31946 By default (unless configured otherwise), GCC generates code for the GR5
31947 variant of the Visium architecture.  
31949 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
31950 architecture.  The only difference from GR5 code is that the compiler will
31951 generate block move instructions.
31953 @item -mtune=@var{cpu_type}
31954 @opindex mtune
31955 Set the instruction scheduling parameters for machine type @var{cpu_type},
31956 but do not set the instruction set or register set that the option
31957 @option{-mcpu=@var{cpu_type}} would.
31959 @item -msv-mode
31960 @opindex msv-mode
31961 Generate code for the supervisor mode, where there are no restrictions on
31962 the access to general registers.  This is the default.
31964 @item -muser-mode
31965 @opindex muser-mode
31966 Generate code for the user mode, where the access to some general registers
31967 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
31968 mode; on the GR6, only registers r29 to r31 are affected.
31969 @end table
31971 @node VMS Options
31972 @subsection VMS Options
31974 These @samp{-m} options are defined for the VMS implementations:
31976 @table @gcctabopt
31977 @item -mvms-return-codes
31978 @opindex mvms-return-codes
31979 Return VMS condition codes from @code{main}. The default is to return POSIX-style
31980 condition (e.g.@: error) codes.
31982 @item -mdebug-main=@var{prefix}
31983 @opindex mdebug-main=@var{prefix}
31984 Flag the first routine whose name starts with @var{prefix} as the main
31985 routine for the debugger.
31987 @item -mmalloc64
31988 @opindex mmalloc64
31989 Default to 64-bit memory allocation routines.
31991 @item -mpointer-size=@var{size}
31992 @opindex mpointer-size=@var{size}
31993 Set the default size of pointers. Possible options for @var{size} are
31994 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
31995 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
31996 The later option disables @code{pragma pointer_size}.
31997 @end table
31999 @node VxWorks Options
32000 @subsection VxWorks Options
32001 @cindex VxWorks Options
32003 The options in this section are defined for all VxWorks targets.
32004 Options specific to the target hardware are listed with the other
32005 options for that target.
32007 @table @gcctabopt
32008 @item -mrtp
32009 @opindex mrtp
32010 GCC can generate code for both VxWorks kernels and real time processes
32011 (RTPs).  This option switches from the former to the latter.  It also
32012 defines the preprocessor macro @code{__RTP__}.
32014 @item -non-static
32015 @opindex non-static
32016 Link an RTP executable against shared libraries rather than static
32017 libraries.  The options @option{-static} and @option{-shared} can
32018 also be used for RTPs (@pxref{Link Options}); @option{-static}
32019 is the default.
32021 @item -Bstatic
32022 @itemx -Bdynamic
32023 @opindex Bstatic
32024 @opindex Bdynamic
32025 These options are passed down to the linker.  They are defined for
32026 compatibility with Diab.
32028 @item -Xbind-lazy
32029 @opindex Xbind-lazy
32030 Enable lazy binding of function calls.  This option is equivalent to
32031 @option{-Wl,-z,now} and is defined for compatibility with Diab.
32033 @item -Xbind-now
32034 @opindex Xbind-now
32035 Disable lazy binding of function calls.  This option is the default and
32036 is defined for compatibility with Diab.
32037 @end table
32039 @node x86 Options
32040 @subsection x86 Options
32041 @cindex x86 Options
32043 These @samp{-m} options are defined for the x86 family of computers.
32045 @table @gcctabopt
32047 @item -march=@var{cpu-type}
32048 @opindex march
32049 Generate instructions for the machine type @var{cpu-type}.  In contrast to
32050 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
32051 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
32052 to generate code that may not run at all on processors other than the one
32053 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
32054 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
32056 The choices for @var{cpu-type} are:
32058 @table @samp
32059 @item native
32060 This selects the CPU to generate code for at compilation time by determining
32061 the processor type of the compiling machine.  Using @option{-march=native}
32062 enables all instruction subsets supported by the local machine (hence
32063 the result might not run on different machines).  Using @option{-mtune=native}
32064 produces code optimized for the local machine under the constraints
32065 of the selected instruction set.  
32067 @item x86-64
32068 A generic CPU with 64-bit extensions.
32070 @item x86-64-v2
32071 @itemx x86-64-v3
32072 @itemx x86-64-v4
32073 These choices for @var{cpu-type} select the corresponding
32074 micro-architecture level from the x86-64 psABI.  On ABIs other than
32075 the x86-64 psABI they select the same CPU features as the x86-64 psABI
32076 documents for the particular micro-architecture level.
32078 Since these @var{cpu-type} values do not have a corresponding
32079 @option{-mtune} setting, using @option{-march} with these values enables
32080 generic tuning.  Specific tuning can be enabled using the
32081 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32082 @var{other-cpu-type} value.
32084 @item i386
32085 Original Intel i386 CPU@.
32087 @item i486
32088 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
32090 @item i586
32091 @itemx pentium
32092 Intel Pentium CPU with no MMX support.
32094 @item lakemont
32095 Intel Lakemont MCU, based on Intel Pentium CPU.
32097 @item pentium-mmx
32098 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32100 @item pentiumpro
32101 Intel Pentium Pro CPU@.
32103 @item i686
32104 When used with @option{-march}, the Pentium Pro
32105 instruction set is used, so the code runs on all i686 family chips.
32106 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32108 @item pentium2
32109 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32110 set support.
32112 @item pentium3
32113 @itemx pentium3m
32114 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32115 instruction set support.
32117 @item pentium-m
32118 Intel Pentium M; low-power version of Intel Pentium III CPU
32119 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
32120 notebooks.
32122 @item pentium4
32123 @itemx pentium4m
32124 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32126 @item prescott
32127 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32128 instruction set support.
32130 @item nocona
32131 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32132 SSE2, SSE3 and FXSR instruction set support.
32134 @item core2
32135 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32136 SAHF and FXSR instruction set support.
32138 @item nehalem
32139 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32140 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
32142 @item westmere
32143 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32144 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
32146 @item sandybridge
32147 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32148 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
32149 support.
32151 @item ivybridge
32152 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32153 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
32154 and F16C instruction set support.
32156 @item haswell
32157 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32158 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32159 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32161 @item broadwell
32162 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32163 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32164 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32165 instruction set support.
32167 @item skylake
32168 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32169 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32170 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32171 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32173 @item bonnell
32174 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32175 instruction set support.
32177 @item silvermont
32178 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32179 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32180 instruction set support.
32182 @item goldmont
32183 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32184 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32185 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32186 set support.
32188 @item goldmont-plus
32189 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32190 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32191 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32192 RDPID and SGX instruction set support.
32194 @item tremont
32195 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32196 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32197 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32198 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32199 support.
32201 @item sierraforest
32202 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32203 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32204 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32205 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32206 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32207 AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support.
32209 @item grandridge
32210 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32211 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32212 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32213 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32214 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32215 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD and RAOINT instruction set
32216 support.
32218 @item knl
32219 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32220 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32221 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32222 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
32224 @item knm
32225 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32226 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32227 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32228 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
32229 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
32231 @item skylake-avx512
32232 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32233 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32234 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32235 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
32236 AVX512DQ and AVX512CD instruction set support.
32238 @item cannonlake
32239 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
32240 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
32241 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
32242 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
32243 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
32244 support.
32246 @item icelake-client
32247 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32248 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32249 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32250 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32251 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32252 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32254 @item icelake-server
32255 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32256 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32257 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32258 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32259 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32260 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
32261 instruction set support.
32263 @item cascadelake
32264 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32265 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32266 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32267 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32268 AVX512CD and AVX512VNNI instruction set support.
32270 @item cooperlake
32271 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32272 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32273 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32274 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32275 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
32277 @item tigerlake
32278 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32279 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32280 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32281 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32282 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32283 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
32284 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
32286 @item sapphirerapids
32287 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32288 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32289 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32290 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32291 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32292 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32293 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32294 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16 and AVX512BF16
32295 instruction set support.
32297 @item alderlake
32298 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32299 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
32300 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
32301 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
32302 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
32303 support.
32305 @item rocketlake
32306 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
32307 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32308 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32309 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32310 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32311 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32313 @item graniterapids
32314 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32315 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32316 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32317 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32318 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32319 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32320 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
32321 SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16,
32322 AVX512BF16, AMX-FP16 and PREFETCHI instruction set support.
32324 @item k6
32325 AMD K6 CPU with MMX instruction set support.
32327 @item k6-2
32328 @itemx k6-3
32329 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
32331 @item athlon
32332 @itemx athlon-tbird
32333 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
32334 support.
32336 @item athlon-4
32337 @itemx athlon-xp
32338 @itemx athlon-mp
32339 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
32340 instruction set support.
32342 @item k8
32343 @itemx opteron
32344 @itemx athlon64
32345 @itemx athlon-fx
32346 Processors based on the AMD K8 core with x86-64 instruction set support,
32347 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
32348 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
32349 instruction set extensions.)
32351 @item k8-sse3
32352 @itemx opteron-sse3
32353 @itemx athlon64-sse3
32354 Improved versions of AMD K8 cores with SSE3 instruction set support.
32356 @item amdfam10
32357 @itemx barcelona
32358 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
32359 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
32360 instruction set extensions.)
32362 @item bdver1
32363 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
32364 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
32365 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
32367 @item bdver2
32368 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32369 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
32370 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
32371 extensions.)
32373 @item bdver3
32374 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32375 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
32376 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
32377 64-bit instruction set extensions.)
32379 @item bdver4
32380 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32381 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
32382 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
32383 SSE4.2, ABM and 64-bit instruction set extensions.)
32385 @item znver1
32386 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
32387 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
32388 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
32389 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
32390 instruction set extensions.)
32392 @item znver2
32393 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32394 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32395 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32396 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32397 WBNOINVD, and 64-bit instruction set extensions.)
32399 @item znver3
32400 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32401 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32402 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32403 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32404 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
32406 @item znver4
32407 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32408 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32409 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32410 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32411 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
32412 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
32413 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
32415 @item btver1
32416 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
32417 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
32418 instruction set extensions.)
32420 @item btver2
32421 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
32422 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
32423 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
32425 @item winchip-c6
32426 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
32427 set support.
32429 @item winchip2
32430 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
32431 instruction set support.
32433 @item c3
32434 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
32435 (No scheduling is implemented for this chip.)
32437 @item c3-2
32438 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
32439 (No scheduling is implemented for this chip.)
32441 @item c7
32442 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32443 (No scheduling is implemented for this chip.)
32445 @item samuel-2
32446 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
32447 (No scheduling is implemented for this chip.)
32449 @item nehemiah
32450 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
32451 (No scheduling is implemented for this chip.)
32453 @item esther
32454 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32455 (No scheduling is implemented for this chip.)
32457 @item eden-x2
32458 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
32459 (No scheduling is implemented for this chip.)
32461 @item eden-x4
32462 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
32463 AVX and AVX2 instruction set support.
32464 (No scheduling is implemented for this chip.)
32466 @item nano
32467 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32468 instruction set support.
32469 (No scheduling is implemented for this chip.)
32471 @item nano-1000
32472 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32473 instruction set support.
32474 (No scheduling is implemented for this chip.)
32476 @item nano-2000
32477 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32478 instruction set support.
32479 (No scheduling is implemented for this chip.)
32481 @item nano-3000
32482 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32483 instruction set support.
32484 (No scheduling is implemented for this chip.)
32486 @item nano-x2
32487 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32488 instruction set support.
32489 (No scheduling is implemented for this chip.)
32491 @item nano-x4
32492 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32493 instruction set support.
32494 (No scheduling is implemented for this chip.)
32496 @item lujiazui
32497 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
32498 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
32499 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
32501 @item geode
32502 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
32503 @end table
32505 @item -mtune=@var{cpu-type}
32506 @opindex mtune
32507 Tune to @var{cpu-type} everything applicable about the generated code, except
32508 for the ABI and the set of available instructions.  
32509 While picking a specific @var{cpu-type} schedules things appropriately
32510 for that particular chip, the compiler does not generate any code that
32511 cannot run on the default machine type unless you use a
32512 @option{-march=@var{cpu-type}} option.
32513 For example, if GCC is configured for i686-pc-linux-gnu
32514 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
32515 but still runs on i686 machines.
32517 The choices for @var{cpu-type} are the same as for @option{-march}.
32518 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
32520 @table @samp
32521 @item generic
32522 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
32523 If you know the CPU on which your code will run, then you should use
32524 the corresponding @option{-mtune} or @option{-march} option instead of
32525 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
32526 of your application will have, then you should use this option.
32528 As new processors are deployed in the marketplace, the behavior of this
32529 option will change.  Therefore, if you upgrade to a newer version of
32530 GCC, code generation controlled by this option will change to reflect
32531 the processors
32532 that are most common at the time that version of GCC is released.
32534 There is no @option{-march=generic} option because @option{-march}
32535 indicates the instruction set the compiler can use, and there is no
32536 generic instruction set applicable to all processors.  In contrast,
32537 @option{-mtune} indicates the processor (or, in this case, collection of
32538 processors) for which the code is optimized.
32540 @item intel
32541 Produce code optimized for the most current Intel processors, which are
32542 Haswell and Silvermont for this version of GCC.  If you know the CPU
32543 on which your code will run, then you should use the corresponding
32544 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
32545 But, if you want your application performs better on both Haswell and
32546 Silvermont, then you should use this option.
32548 As new Intel processors are deployed in the marketplace, the behavior of
32549 this option will change.  Therefore, if you upgrade to a newer version of
32550 GCC, code generation controlled by this option will change to reflect
32551 the most current Intel processors at the time that version of GCC is
32552 released.
32554 There is no @option{-march=intel} option because @option{-march} indicates
32555 the instruction set the compiler can use, and there is no common
32556 instruction set applicable to all processors.  In contrast,
32557 @option{-mtune} indicates the processor (or, in this case, collection of
32558 processors) for which the code is optimized.
32559 @end table
32561 @item -mcpu=@var{cpu-type}
32562 @opindex mcpu
32563 A deprecated synonym for @option{-mtune}.
32565 @item -mfpmath=@var{unit}
32566 @opindex mfpmath
32567 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
32568 for @var{unit} are:
32570 @table @samp
32571 @item 387
32572 Use the standard 387 floating-point coprocessor present on the majority of chips and
32573 emulated otherwise.  Code compiled with this option runs almost everywhere.
32574 The temporary results are computed in 80-bit precision instead of the precision
32575 specified by the type, resulting in slightly different results compared to most
32576 of other chips.  See @option{-ffloat-store} for more detailed description.
32578 This is the default choice for non-Darwin x86-32 targets.
32580 @item sse
32581 Use scalar floating-point instructions present in the SSE instruction set.
32582 This instruction set is supported by Pentium III and newer chips,
32583 and in the AMD line
32584 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
32585 instruction set supports only single-precision arithmetic, thus the double and
32586 extended-precision arithmetic are still done using 387.  A later version, present
32587 only in Pentium 4 and AMD x86-64 chips, supports double-precision
32588 arithmetic too.
32590 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
32591 or @option{-msse2} switches to enable SSE extensions and make this option
32592 effective.  For the x86-64 compiler, these extensions are enabled by default.
32594 The resulting code should be considerably faster in the majority of cases and avoid
32595 the numerical instability problems of 387 code, but may break some existing
32596 code that expects temporaries to be 80 bits.
32598 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
32599 and the default choice for x86-32 targets with the SSE2 instruction set
32600 when @option{-ffast-math} is enabled.
32602 @item sse,387
32603 @itemx sse+387
32604 @itemx both
32605 Attempt to utilize both instruction sets at once.  This effectively doubles the
32606 amount of available registers, and on chips with separate execution units for
32607 387 and SSE the execution resources too.  Use this option with care, as it is
32608 still experimental, because the GCC register allocator does not model separate
32609 functional units well, resulting in unstable performance.
32610 @end table
32612 @item -masm=@var{dialect}
32613 @opindex masm=@var{dialect}
32614 Output assembly instructions using selected @var{dialect}.  Also affects
32615 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
32616 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
32617 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
32618 not support @samp{intel}.
32620 @item -mieee-fp
32621 @itemx -mno-ieee-fp
32622 @opindex mieee-fp
32623 @opindex mno-ieee-fp
32624 Control whether or not the compiler uses IEEE floating-point
32625 comparisons.  These correctly handle the case where the result of a
32626 comparison is unordered.
32628 @item -m80387
32629 @itemx -mhard-float
32630 @opindex m80387
32631 @opindex mhard-float
32632 Generate output containing 80387 instructions for floating point.
32634 @item -mno-80387
32635 @itemx -msoft-float
32636 @opindex no-80387
32637 @opindex msoft-float
32638 Generate output containing library calls for floating point.
32640 @strong{Warning:} the requisite libraries are not part of GCC@.
32641 Normally the facilities of the machine's usual C compiler are used, but
32642 this cannot be done directly in cross-compilation.  You must make your
32643 own arrangements to provide suitable library functions for
32644 cross-compilation.
32646 On machines where a function returns floating-point results in the 80387
32647 register stack, some floating-point opcodes may be emitted even if
32648 @option{-msoft-float} is used.
32650 @item -mno-fp-ret-in-387
32651 @opindex mno-fp-ret-in-387
32652 @opindex mfp-ret-in-387
32653 Do not use the FPU registers for return values of functions.
32655 The usual calling convention has functions return values of types
32656 @code{float} and @code{double} in an FPU register, even if there
32657 is no FPU@.  The idea is that the operating system should emulate
32658 an FPU@.
32660 The option @option{-mno-fp-ret-in-387} causes such values to be returned
32661 in ordinary CPU registers instead.
32663 @item -mno-fancy-math-387
32664 @opindex mno-fancy-math-387
32665 @opindex mfancy-math-387
32666 Some 387 emulators do not support the @code{sin}, @code{cos} and
32667 @code{sqrt} instructions for the 387.  Specify this option to avoid
32668 generating those instructions.
32669 This option is overridden when @option{-march}
32670 indicates that the target CPU always has an FPU and so the
32671 instruction does not need emulation.  These
32672 instructions are not generated unless you also use the
32673 @option{-funsafe-math-optimizations} switch.
32675 @item -malign-double
32676 @itemx -mno-align-double
32677 @opindex malign-double
32678 @opindex mno-align-double
32679 Control whether GCC aligns @code{double}, @code{long double}, and
32680 @code{long long} variables on a two-word boundary or a one-word
32681 boundary.  Aligning @code{double} variables on a two-word boundary
32682 produces code that runs somewhat faster on a Pentium at the
32683 expense of more memory.
32685 On x86-64, @option{-malign-double} is enabled by default.
32687 @strong{Warning:} if you use the @option{-malign-double} switch,
32688 structures containing the above types are aligned differently than
32689 the published application binary interface specifications for the x86-32
32690 and are not binary compatible with structures in code compiled
32691 without that switch.
32693 @item -m96bit-long-double
32694 @itemx -m128bit-long-double
32695 @opindex m96bit-long-double
32696 @opindex m128bit-long-double
32697 These switches control the size of @code{long double} type.  The x86-32
32698 application binary interface specifies the size to be 96 bits,
32699 so @option{-m96bit-long-double} is the default in 32-bit mode.
32701 Modern architectures (Pentium and newer) prefer @code{long double}
32702 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
32703 conforming to the ABI, this is not possible.  So specifying
32704 @option{-m128bit-long-double} aligns @code{long double}
32705 to a 16-byte boundary by padding the @code{long double} with an additional
32706 32-bit zero.
32708 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
32709 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
32711 Notice that neither of these options enable any extra precision over the x87
32712 standard of 80 bits for a @code{long double}.
32714 @strong{Warning:} if you override the default value for your target ABI, this
32715 changes the size of 
32716 structures and arrays containing @code{long double} variables,
32717 as well as modifying the function calling convention for functions taking
32718 @code{long double}.  Hence they are not binary-compatible
32719 with code compiled without that switch.
32721 @item -mlong-double-64
32722 @itemx -mlong-double-80
32723 @itemx -mlong-double-128
32724 @opindex mlong-double-64
32725 @opindex mlong-double-80
32726 @opindex mlong-double-128
32727 These switches control the size of @code{long double} type. A size
32728 of 64 bits makes the @code{long double} type equivalent to the @code{double}
32729 type. This is the default for 32-bit Bionic C library.  A size
32730 of 128 bits makes the @code{long double} type equivalent to the
32731 @code{__float128} type. This is the default for 64-bit Bionic C library.
32733 @strong{Warning:} if you override the default value for your target ABI, this
32734 changes the size of
32735 structures and arrays containing @code{long double} variables,
32736 as well as modifying the function calling convention for functions taking
32737 @code{long double}.  Hence they are not binary-compatible
32738 with code compiled without that switch.
32740 @item -malign-data=@var{type}
32741 @opindex malign-data
32742 Control how GCC aligns variables.  Supported values for @var{type} are
32743 @samp{compat} uses increased alignment value compatible uses GCC 4.8
32744 and earlier, @samp{abi} uses alignment value as specified by the
32745 psABI, and @samp{cacheline} uses increased alignment value to match
32746 the cache line size.  @samp{compat} is the default.
32748 @item -mlarge-data-threshold=@var{threshold}
32749 @opindex mlarge-data-threshold
32750 When @option{-mcmodel=medium} is specified, data objects larger than
32751 @var{threshold} are placed in the large data section.  This value must be the
32752 same across all objects linked into the binary, and defaults to 65535.
32754 @item -mrtd
32755 @opindex mrtd
32756 Use a different function-calling convention, in which functions that
32757 take a fixed number of arguments return with the @code{ret @var{num}}
32758 instruction, which pops their arguments while returning.  This saves one
32759 instruction in the caller since there is no need to pop the arguments
32760 there.
32762 You can specify that an individual function is called with this calling
32763 sequence with the function attribute @code{stdcall}.  You can also
32764 override the @option{-mrtd} option by using the function attribute
32765 @code{cdecl}.  @xref{Function Attributes}.
32767 @strong{Warning:} this calling convention is incompatible with the one
32768 normally used on Unix, so you cannot use it if you need to call
32769 libraries compiled with the Unix compiler.
32771 Also, you must provide function prototypes for all functions that
32772 take variable numbers of arguments (including @code{printf});
32773 otherwise incorrect code is generated for calls to those
32774 functions.
32776 In addition, seriously incorrect code results if you call a
32777 function with too many arguments.  (Normally, extra arguments are
32778 harmlessly ignored.)
32780 @item -mregparm=@var{num}
32781 @opindex mregparm
32782 Control how many registers are used to pass integer arguments.  By
32783 default, no registers are used to pass arguments, and at most 3
32784 registers can be used.  You can control this behavior for a specific
32785 function by using the function attribute @code{regparm}.
32786 @xref{Function Attributes}.
32788 @strong{Warning:} if you use this switch, and
32789 @var{num} is nonzero, then you must build all modules with the same
32790 value, including any libraries.  This includes the system libraries and
32791 startup modules.
32793 @item -msseregparm
32794 @opindex msseregparm
32795 Use SSE register passing conventions for float and double arguments
32796 and return values.  You can control this behavior for a specific
32797 function by using the function attribute @code{sseregparm}.
32798 @xref{Function Attributes}.
32800 @strong{Warning:} if you use this switch then you must build all
32801 modules with the same value, including any libraries.  This includes
32802 the system libraries and startup modules.
32804 @item -mvect8-ret-in-mem
32805 @opindex mvect8-ret-in-mem
32806 Return 8-byte vectors in memory instead of MMX registers.  This is the
32807 default on VxWorks to match the ABI of the Sun Studio compilers until
32808 version 12.  @emph{Only} use this option if you need to remain
32809 compatible with existing code produced by those previous compiler
32810 versions or older versions of GCC@.
32812 @item -mpc32
32813 @itemx -mpc64
32814 @itemx -mpc80
32815 @opindex mpc32
32816 @opindex mpc64
32817 @opindex mpc80
32819 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
32820 is specified, the significands of results of floating-point operations are
32821 rounded to 24 bits (single precision); @option{-mpc64} rounds the
32822 significands of results of floating-point operations to 53 bits (double
32823 precision) and @option{-mpc80} rounds the significands of results of
32824 floating-point operations to 64 bits (extended double precision), which is
32825 the default.  When this option is used, floating-point operations in higher
32826 precisions are not available to the programmer without setting the FPU
32827 control word explicitly.
32829 Setting the rounding of floating-point operations to less than the default
32830 80 bits can speed some programs by 2% or more.  Note that some mathematical
32831 libraries assume that extended-precision (80-bit) floating-point operations
32832 are enabled by default; routines in such libraries could suffer significant
32833 loss of accuracy, typically through so-called ``catastrophic cancellation'',
32834 when this option is used to set the precision to less than extended precision.
32836 @item -mdaz-ftz
32837 @opindex mdaz-ftz
32839 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
32840 are used to control floating-point calculations.SSE and AVX instructions
32841 including scalar and vector instructions could benefit from enabling the FTZ
32842 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
32843 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
32844 will set FTZ/DAZ flags even with @option{-shared}.
32846 @item -mstackrealign
32847 @opindex mstackrealign
32848 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
32849 option generates an alternate prologue and epilogue that realigns the
32850 run-time stack if necessary.  This supports mixing legacy codes that keep
32851 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
32852 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
32853 applicable to individual functions.
32855 @item -mpreferred-stack-boundary=@var{num}
32856 @opindex mpreferred-stack-boundary
32857 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
32858 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
32859 the default is 4 (16 bytes or 128 bits).
32861 @strong{Warning:} When generating code for the x86-64 architecture with
32862 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
32863 used to keep the stack boundary aligned to 8 byte boundary.  Since
32864 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
32865 intended to be used in controlled environment where stack space is
32866 important limitation.  This option leads to wrong code when functions
32867 compiled with 16 byte stack alignment (such as functions from a standard
32868 library) are called with misaligned stack.  In this case, SSE
32869 instructions may lead to misaligned memory access traps.  In addition,
32870 variable arguments are handled incorrectly for 16 byte aligned
32871 objects (including x87 long double and __int128), leading to wrong
32872 results.  You must build all modules with
32873 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
32874 includes the system libraries and startup modules.
32876 @item -mincoming-stack-boundary=@var{num}
32877 @opindex mincoming-stack-boundary
32878 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
32879 boundary.  If @option{-mincoming-stack-boundary} is not specified,
32880 the one specified by @option{-mpreferred-stack-boundary} is used.
32882 On Pentium and Pentium Pro, @code{double} and @code{long double} values
32883 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
32884 suffer significant run time performance penalties.  On Pentium III, the
32885 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
32886 properly if it is not 16-byte aligned.
32888 To ensure proper alignment of this values on the stack, the stack boundary
32889 must be as aligned as that required by any value stored on the stack.
32890 Further, every function must be generated such that it keeps the stack
32891 aligned.  Thus calling a function compiled with a higher preferred
32892 stack boundary from a function compiled with a lower preferred stack
32893 boundary most likely misaligns the stack.  It is recommended that
32894 libraries that use callbacks always use the default setting.
32896 This extra alignment does consume extra stack space, and generally
32897 increases code size.  Code that is sensitive to stack space usage, such
32898 as embedded systems and operating system kernels, may want to reduce the
32899 preferred alignment to @option{-mpreferred-stack-boundary=2}.
32901 @need 200
32902 @item -mmmx
32903 @opindex mmmx
32904 @need 200
32905 @itemx -msse
32906 @opindex msse
32907 @need 200
32908 @itemx -msse2
32909 @opindex msse2
32910 @need 200
32911 @itemx -msse3
32912 @opindex msse3
32913 @need 200
32914 @itemx -mssse3
32915 @opindex mssse3
32916 @need 200
32917 @itemx -msse4
32918 @opindex msse4
32919 @need 200
32920 @itemx -msse4a
32921 @opindex msse4a
32922 @need 200
32923 @itemx -msse4.1
32924 @opindex msse4.1
32925 @need 200
32926 @itemx -msse4.2
32927 @opindex msse4.2
32928 @need 200
32929 @itemx -mavx
32930 @opindex mavx
32931 @need 200
32932 @itemx -mavx2
32933 @opindex mavx2
32934 @need 200
32935 @itemx -mavx512f
32936 @opindex mavx512f
32937 @need 200
32938 @itemx -mavx512pf
32939 @opindex mavx512pf
32940 @need 200
32941 @itemx -mavx512er
32942 @opindex mavx512er
32943 @need 200
32944 @itemx -mavx512cd
32945 @opindex mavx512cd
32946 @need 200
32947 @itemx -mavx512vl
32948 @opindex mavx512vl
32949 @need 200
32950 @itemx -mavx512bw
32951 @opindex mavx512bw
32952 @need 200
32953 @itemx -mavx512dq
32954 @opindex mavx512dq
32955 @need 200
32956 @itemx -mavx512ifma
32957 @opindex mavx512ifma
32958 @need 200
32959 @itemx -mavx512vbmi
32960 @opindex mavx512vbmi
32961 @need 200
32962 @itemx -msha
32963 @opindex msha
32964 @need 200
32965 @itemx -maes
32966 @opindex maes
32967 @need 200
32968 @itemx -mpclmul
32969 @opindex mpclmul
32970 @need 200
32971 @itemx -mclflushopt
32972 @opindex mclflushopt
32973 @need 200
32974 @itemx -mclwb
32975 @opindex mclwb
32976 @need 200
32977 @itemx -mfsgsbase
32978 @opindex mfsgsbase
32979 @need 200
32980 @itemx -mptwrite
32981 @opindex mptwrite
32982 @need 200
32983 @itemx -mrdrnd
32984 @opindex mrdrnd
32985 @need 200
32986 @itemx -mf16c
32987 @opindex mf16c
32988 @need 200
32989 @itemx -mfma
32990 @opindex mfma
32991 @need 200
32992 @itemx -mpconfig
32993 @opindex mpconfig
32994 @need 200
32995 @itemx -mwbnoinvd
32996 @opindex mwbnoinvd
32997 @need 200
32998 @itemx -mfma4
32999 @opindex mfma4
33000 @need 200
33001 @itemx -mprfchw
33002 @opindex mprfchw
33003 @need 200
33004 @itemx -mrdpid
33005 @opindex mrdpid
33006 @need 200
33007 @itemx -mprefetchwt1
33008 @opindex mprefetchwt1
33009 @need 200
33010 @itemx -mrdseed
33011 @opindex mrdseed
33012 @need 200
33013 @itemx -msgx
33014 @opindex msgx
33015 @need 200
33016 @itemx -mxop
33017 @opindex mxop
33018 @need 200
33019 @itemx -mlwp
33020 @opindex mlwp
33021 @need 200
33022 @itemx -m3dnow
33023 @opindex m3dnow
33024 @need 200
33025 @itemx -m3dnowa
33026 @opindex m3dnowa
33027 @need 200
33028 @itemx -mpopcnt
33029 @opindex mpopcnt
33030 @need 200
33031 @itemx -mabm
33032 @opindex mabm
33033 @need 200
33034 @itemx -madx
33035 @opindex madx
33036 @need 200
33037 @itemx -mbmi
33038 @opindex mbmi
33039 @need 200
33040 @itemx -mbmi2
33041 @opindex mbmi2
33042 @need 200
33043 @itemx -mlzcnt
33044 @opindex mlzcnt
33045 @need 200
33046 @itemx -mfxsr
33047 @opindex mfxsr
33048 @need 200
33049 @itemx -mxsave
33050 @opindex mxsave
33051 @need 200
33052 @itemx -mxsaveopt
33053 @opindex mxsaveopt
33054 @need 200
33055 @itemx -mxsavec
33056 @opindex mxsavec
33057 @need 200
33058 @itemx -mxsaves
33059 @opindex mxsaves
33060 @need 200
33061 @itemx -mrtm
33062 @opindex mrtm
33063 @need 200
33064 @itemx -mhle
33065 @opindex mhle
33066 @need 200
33067 @itemx -mtbm
33068 @opindex mtbm
33069 @need 200
33070 @itemx -mmwaitx
33071 @opindex mmwaitx
33072 @need 200
33073 @itemx -mclzero
33074 @opindex mclzero
33075 @need 200
33076 @itemx -mpku
33077 @opindex mpku
33078 @need 200
33079 @itemx -mavx512vbmi2
33080 @opindex mavx512vbmi2
33081 @need 200
33082 @itemx -mavx512bf16
33083 @opindex mavx512bf16
33084 @need 200
33085 @itemx -mavx512fp16
33086 @opindex mavx512fp16
33087 @need 200
33088 @itemx -mgfni
33089 @opindex mgfni
33090 @need 200
33091 @itemx -mvaes
33092 @opindex mvaes
33093 @need 200
33094 @itemx -mwaitpkg
33095 @opindex mwaitpkg
33096 @need 200
33097 @itemx -mvpclmulqdq
33098 @opindex mvpclmulqdq
33099 @need 200
33100 @itemx -mavx512bitalg
33101 @opindex mavx512bitalg
33102 @need 200
33103 @itemx -mmovdiri
33104 @opindex mmovdiri
33105 @need 200
33106 @itemx -mmovdir64b
33107 @opindex mmovdir64b
33108 @need 200
33109 @itemx -menqcmd
33110 @opindex menqcmd
33111 @itemx -muintr
33112 @opindex muintr
33113 @need 200
33114 @itemx -mtsxldtrk
33115 @opindex mtsxldtrk
33116 @need 200
33117 @itemx -mavx512vpopcntdq
33118 @opindex mavx512vpopcntdq
33119 @need 200
33120 @itemx -mavx512vp2intersect
33121 @opindex mavx512vp2intersect
33122 @need 200
33123 @itemx -mavx5124fmaps
33124 @opindex mavx5124fmaps
33125 @need 200
33126 @itemx -mavx512vnni
33127 @opindex mavx512vnni
33128 @need 200
33129 @itemx -mavxvnni
33130 @opindex mavxvnni
33131 @need 200
33132 @itemx -mavx5124vnniw
33133 @opindex mavx5124vnniw
33134 @need 200
33135 @itemx -mcldemote
33136 @opindex mcldemote
33137 @need 200
33138 @itemx -mserialize
33139 @opindex mserialize
33140 @need 200
33141 @itemx -mamx-tile
33142 @opindex mamx-tile
33143 @need 200
33144 @itemx -mamx-int8
33145 @opindex mamx-int8
33146 @need 200
33147 @itemx -mamx-bf16
33148 @opindex mamx-bf16
33149 @need 200
33150 @itemx -mhreset
33151 @opindex mhreset
33152 @itemx -mkl
33153 @opindex mkl
33154 @need 200
33155 @itemx -mwidekl
33156 @opindex mwidekl
33157 @need 200
33158 @itemx -mavxifma
33159 @opindex mavxifma
33160 @need 200
33161 @itemx -mavxvnniint8
33162 @opindex mavxvnniint8
33163 @need 200
33164 @itemx -mavxneconvert
33165 @opindex mavxneconvert
33166 @need 200
33167 @itemx -mcmpccxadd
33168 @opindex mcmpccxadd
33169 @need 200
33170 @itemx -mamx-fp16
33171 @opindex mamx-fp16
33172 @need 200
33173 @itemx -mprefetchi
33174 @opindex mprefetchi
33175 @need 200
33176 @itemx -mraoint
33177 @opindex mraoint
33178 These switches enable the use of instructions in the MMX, SSE,
33179 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
33180 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
33181 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
33182 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
33183 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
33184 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
33185 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
33186 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
33187 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16,
33188 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT or
33189 CLDEMOTE extended instruction sets. Each has a corresponding @option{-mno-}
33190 option to disable use of these instructions.
33192 These extensions are also available as built-in functions: see
33193 @ref{x86 Built-in Functions}, for details of the functions enabled and
33194 disabled by these switches.
33196 To generate SSE/SSE2 instructions automatically from floating-point
33197 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
33199 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
33200 generates new AVX instructions or AVX equivalence for all SSEx instructions
33201 when needed.
33203 These options enable GCC to use these extended instructions in
33204 generated code, even without @option{-mfpmath=sse}.  Applications that
33205 perform run-time CPU detection must compile separate files for each
33206 supported architecture, using the appropriate flags.  In particular,
33207 the file containing the CPU detection code should be compiled without
33208 these options.
33210 @item -mdump-tune-features
33211 @opindex mdump-tune-features
33212 This option instructs GCC to dump the names of the x86 performance 
33213 tuning features and default settings. The names can be used in 
33214 @option{-mtune-ctrl=@var{feature-list}}.
33216 @item -mtune-ctrl=@var{feature-list}
33217 @opindex mtune-ctrl=@var{feature-list}
33218 This option is used to do fine grain control of x86 code generation features.
33219 @var{feature-list} is a comma separated list of @var{feature} names. See also
33220 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
33221 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
33222 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
33223 developers. Using it may lead to code paths not covered by testing and can
33224 potentially result in compiler ICEs or runtime errors.
33226 @item -mno-default
33227 @opindex mno-default
33228 This option instructs GCC to turn off all tunable features. See also 
33229 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
33231 @item -mcld
33232 @opindex mcld
33233 This option instructs GCC to emit a @code{cld} instruction in the prologue
33234 of functions that use string instructions.  String instructions depend on
33235 the DF flag to select between autoincrement or autodecrement mode.  While the
33236 ABI specifies the DF flag to be cleared on function entry, some operating
33237 systems violate this specification by not clearing the DF flag in their
33238 exception dispatchers.  The exception handler can be invoked with the DF flag
33239 set, which leads to wrong direction mode when string instructions are used.
33240 This option can be enabled by default on 32-bit x86 targets by configuring
33241 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
33242 instructions can be suppressed with the @option{-mno-cld} compiler option
33243 in this case.
33245 @item -mvzeroupper
33246 @opindex mvzeroupper
33247 This option instructs GCC to emit a @code{vzeroupper} instruction
33248 before a transfer of control flow out of the function to minimize
33249 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
33250 intrinsics.
33252 @item -mprefer-avx128
33253 @opindex mprefer-avx128
33254 This option instructs GCC to use 128-bit AVX instructions instead of
33255 256-bit AVX instructions in the auto-vectorizer.
33257 @item -mprefer-vector-width=@var{opt}
33258 @opindex mprefer-vector-width
33259 This option instructs GCC to use @var{opt}-bit vector width in instructions
33260 instead of default on the selected platform.
33262 @item -mmove-max=@var{bits}
33263 @opindex mmove-max
33264 This option instructs GCC to set the maximum number of bits can be
33265 moved from memory to memory efficiently to @var{bits}.  The valid
33266 @var{bits} are 128, 256 and 512.
33268 @item -mstore-max=@var{bits}
33269 @opindex mstore-max
33270 This option instructs GCC to set the maximum number of bits can be
33271 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
33272 128, 256 and 512.
33274 @table @samp
33275 @item none
33276 No extra limitations applied to GCC other than defined by the selected platform.
33278 @item 128
33279 Prefer 128-bit vector width for instructions.
33281 @item 256
33282 Prefer 256-bit vector width for instructions.
33284 @item 512
33285 Prefer 512-bit vector width for instructions.
33286 @end table
33288 @item -mcx16
33289 @opindex mcx16
33290 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
33291 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
33292 objects.  This is useful for atomic updates of data structures exceeding one
33293 machine word in size.  The compiler uses this instruction to implement
33294 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
33295 128-bit integers, a library call is always used.
33297 @item -msahf
33298 @opindex msahf
33299 This option enables generation of @code{SAHF} instructions in 64-bit code.
33300 Early Intel Pentium 4 CPUs with Intel 64 support,
33301 prior to the introduction of Pentium 4 G1 step in December 2005,
33302 lacked the @code{LAHF} and @code{SAHF} instructions
33303 which are supported by AMD64.
33304 These are load and store instructions, respectively, for certain status flags.
33305 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
33306 @code{drem}, and @code{remainder} built-in functions;
33307 see @ref{Other Builtins} for details.
33309 @item -mmovbe
33310 @opindex mmovbe
33311 This option enables use of the @code{movbe} instruction to implement
33312 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
33314 @item -mshstk
33315 @opindex mshstk
33316 The @option{-mshstk} option enables shadow stack built-in functions
33317 from x86 Control-flow Enforcement Technology (CET).
33319 @item -mcrc32
33320 @opindex mcrc32
33321 This option enables built-in functions @code{__builtin_ia32_crc32qi},
33322 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
33323 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
33325 @item -mmwait
33326 @opindex mmwait
33327 This option enables built-in functions @code{__builtin_ia32_monitor},
33328 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
33329 @code{mwait} machine instructions.
33331 @item -mrecip
33332 @opindex mrecip
33333 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
33334 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
33335 with an additional Newton-Raphson step
33336 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
33337 (and their vectorized
33338 variants) for single-precision floating-point arguments.  These instructions
33339 are generated only when @option{-funsafe-math-optimizations} is enabled
33340 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
33341 Note that while the throughput of the sequence is higher than the throughput
33342 of the non-reciprocal instruction, the precision of the sequence can be
33343 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
33345 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
33346 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
33347 combination), and doesn't need @option{-mrecip}.
33349 Also note that GCC emits the above sequence with additional Newton-Raphson step
33350 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
33351 already with @option{-ffast-math} (or the above option combination), and
33352 doesn't need @option{-mrecip}.
33354 @item -mrecip=@var{opt}
33355 @opindex mrecip=opt
33356 This option controls which reciprocal estimate instructions
33357 may be used.  @var{opt} is a comma-separated list of options, which may
33358 be preceded by a @samp{!} to invert the option:
33360 @table @samp
33361 @item all
33362 Enable all estimate instructions.
33364 @item default
33365 Enable the default instructions, equivalent to @option{-mrecip}.
33367 @item none
33368 Disable all estimate instructions, equivalent to @option{-mno-recip}.
33370 @item div
33371 Enable the approximation for scalar division.
33373 @item vec-div
33374 Enable the approximation for vectorized division.
33376 @item sqrt
33377 Enable the approximation for scalar square root.
33379 @item vec-sqrt
33380 Enable the approximation for vectorized square root.
33381 @end table
33383 So, for example, @option{-mrecip=all,!sqrt} enables
33384 all of the reciprocal approximations, except for square root.
33386 @item -mveclibabi=@var{type}
33387 @opindex mveclibabi
33388 Specifies the ABI type to use for vectorizing intrinsics using an
33389 external library.  Supported values for @var{type} are @samp{svml} 
33390 for the Intel short
33391 vector math library and @samp{acml} for the AMD math core library.
33392 To use this option, both @option{-ftree-vectorize} and
33393 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
33394 ABI-compatible library must be specified at link time.
33396 GCC currently emits calls to @code{vmldExp2},
33397 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
33398 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
33399 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
33400 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
33401 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
33402 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
33403 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
33404 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
33405 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
33406 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
33407 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
33408 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
33409 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
33410 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
33411 when @option{-mveclibabi=acml} is used.  
33413 @item -mabi=@var{name}
33414 @opindex mabi
33415 Generate code for the specified calling convention.  Permissible values
33416 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
33417 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
33418 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
33419 You can control this behavior for specific functions by
33420 using the function attributes @code{ms_abi} and @code{sysv_abi}.
33421 @xref{Function Attributes}.
33423 @item -mforce-indirect-call
33424 @opindex mforce-indirect-call
33425 Force all calls to functions to be indirect. This is useful
33426 when using Intel Processor Trace where it generates more precise timing
33427 information for function calls.
33429 @item -mmanual-endbr
33430 @opindex mmanual-endbr
33431 Insert ENDBR instruction at function entry only via the @code{cf_check}
33432 function attribute. This is useful when used with the option
33433 @option{-fcf-protection=branch} to control ENDBR insertion at the
33434 function entry.
33436 @item -mcet-switch
33437 @opindex mcet-switch
33438 By default, CET instrumentation is turned off on switch statements that
33439 use a jump table and indirect branch track is disabled.  Since jump
33440 tables are stored in read-only memory, this does not result in a direct
33441 loss of hardening.  But if the jump table index is attacker-controlled,
33442 the indirect jump may not be constrained by CET.  This option turns on
33443 CET instrumentation to enable indirect branch track for switch statements
33444 with jump tables which leads to the jump targets reachable via any indirect
33445 jumps.
33447 @item -mcall-ms2sysv-xlogues
33448 @opindex mcall-ms2sysv-xlogues
33449 @opindex mno-call-ms2sysv-xlogues
33450 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
33451 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
33452 default, the code for saving and restoring these registers is emitted inline,
33453 resulting in fairly lengthy prologues and epilogues.  Using
33454 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
33455 use stubs in the static portion of libgcc to perform these saves and restores,
33456 thus reducing function size at the cost of a few extra instructions.
33458 @item -mtls-dialect=@var{type}
33459 @opindex mtls-dialect
33460 Generate code to access thread-local storage using the @samp{gnu} or
33461 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
33462 @samp{gnu2} is more efficient, but it may add compile- and run-time
33463 requirements that cannot be satisfied on all systems.
33465 @item -mpush-args
33466 @itemx -mno-push-args
33467 @opindex mpush-args
33468 @opindex mno-push-args
33469 Use PUSH operations to store outgoing parameters.  This method is shorter
33470 and usually equally fast as method using SUB/MOV operations and is enabled
33471 by default.  In some cases disabling it may improve performance because of
33472 improved scheduling and reduced dependencies.
33474 @item -maccumulate-outgoing-args
33475 @opindex maccumulate-outgoing-args
33476 If enabled, the maximum amount of space required for outgoing arguments is
33477 computed in the function prologue.  This is faster on most modern CPUs
33478 because of reduced dependencies, improved scheduling and reduced stack usage
33479 when the preferred stack boundary is not equal to 2.  The drawback is a notable
33480 increase in code size.  This switch implies @option{-mno-push-args}.
33482 @item -mthreads
33483 @opindex mthreads
33484 Support thread-safe exception handling on MinGW.  Programs that rely
33485 on thread-safe exception handling must compile and link all code with the
33486 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
33487 @option{-D_MT}; when linking, it links in a special thread helper library
33488 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
33490 @item -mms-bitfields
33491 @itemx -mno-ms-bitfields
33492 @opindex mms-bitfields
33493 @opindex mno-ms-bitfields
33495 Enable/disable bit-field layout compatible with the native Microsoft
33496 Windows compiler.  
33498 If @code{packed} is used on a structure, or if bit-fields are used,
33499 it may be that the Microsoft ABI lays out the structure differently
33500 than the way GCC normally does.  Particularly when moving packed
33501 data between functions compiled with GCC and the native Microsoft compiler
33502 (either via function call or as data in a file), it may be necessary to access
33503 either format.
33505 This option is enabled by default for Microsoft Windows
33506 targets.  This behavior can also be controlled locally by use of variable
33507 or type attributes.  For more information, see @ref{x86 Variable Attributes}
33508 and @ref{x86 Type Attributes}.
33510 The Microsoft structure layout algorithm is fairly simple with the exception
33511 of the bit-field packing.  
33512 The padding and alignment of members of structures and whether a bit-field 
33513 can straddle a storage-unit boundary are determine by these rules:
33515 @enumerate
33516 @item Structure members are stored sequentially in the order in which they are
33517 declared: the first member has the lowest memory address and the last member
33518 the highest.
33520 @item Every data object has an alignment requirement.  The alignment requirement
33521 for all data except structures, unions, and arrays is either the size of the
33522 object or the current packing size (specified with either the
33523 @code{aligned} attribute or the @code{pack} pragma),
33524 whichever is less.  For structures, unions, and arrays,
33525 the alignment requirement is the largest alignment requirement of its members.
33526 Every object is allocated an offset so that:
33528 @smallexample
33529 offset % alignment_requirement == 0
33530 @end smallexample
33532 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
33533 unit if the integral types are the same size and if the next bit-field fits
33534 into the current allocation unit without crossing the boundary imposed by the
33535 common alignment requirements of the bit-fields.
33536 @end enumerate
33538 MSVC interprets zero-length bit-fields in the following ways:
33540 @enumerate
33541 @item If a zero-length bit-field is inserted between two bit-fields that
33542 are normally coalesced, the bit-fields are not coalesced.
33544 For example:
33546 @smallexample
33547 struct
33548  @{
33549    unsigned long bf_1 : 12;
33550    unsigned long : 0;
33551    unsigned long bf_2 : 12;
33552  @} t1;
33553 @end smallexample
33555 @noindent
33556 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
33557 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
33559 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
33560 alignment of the zero-length bit-field is greater than the member that follows it,
33561 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
33563 For example:
33565 @smallexample
33566 struct
33567  @{
33568    char foo : 4;
33569    short : 0;
33570    char bar;
33571  @} t2;
33573 struct
33574  @{
33575    char foo : 4;
33576    short : 0;
33577    double bar;
33578  @} t3;
33579 @end smallexample
33581 @noindent
33582 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
33583 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
33584 bit-field does not affect the alignment of @code{bar} or, as a result, the size
33585 of the structure.
33587 Taking this into account, it is important to note the following:
33589 @enumerate
33590 @item If a zero-length bit-field follows a normal bit-field, the type of the
33591 zero-length bit-field may affect the alignment of the structure as whole. For
33592 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
33593 normal bit-field, and is of type short.
33595 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
33596 still affect the alignment of the structure:
33598 @smallexample
33599 struct
33600  @{
33601    char foo : 6;
33602    long : 0;
33603  @} t4;
33604 @end smallexample
33606 @noindent
33607 Here, @code{t4} takes up 4 bytes.
33608 @end enumerate
33610 @item Zero-length bit-fields following non-bit-field members are ignored:
33612 @smallexample
33613 struct
33614  @{
33615    char foo;
33616    long : 0;
33617    char bar;
33618  @} t5;
33619 @end smallexample
33621 @noindent
33622 Here, @code{t5} takes up 2 bytes.
33623 @end enumerate
33626 @item -mno-align-stringops
33627 @opindex mno-align-stringops
33628 @opindex malign-stringops
33629 Do not align the destination of inlined string operations.  This switch reduces
33630 code size and improves performance in case the destination is already aligned,
33631 but GCC doesn't know about it.
33633 @item -minline-all-stringops
33634 @opindex minline-all-stringops
33635 By default GCC inlines string operations only when the destination is 
33636 known to be aligned to least a 4-byte boundary.  
33637 This enables more inlining and increases code
33638 size, but may improve performance of code that depends on fast
33639 @code{memcpy} and @code{memset} for short lengths.
33640 The option enables inline expansion of @code{strlen} for all
33641 pointer alignments.
33643 @item -minline-stringops-dynamically
33644 @opindex minline-stringops-dynamically
33645 For string operations of unknown size, use run-time checks with
33646 inline code for small blocks and a library call for large blocks.
33648 @item -mstringop-strategy=@var{alg}
33649 @opindex mstringop-strategy=@var{alg}
33650 Override the internal decision heuristic for the particular algorithm to use
33651 for inlining string operations.  The allowed values for @var{alg} are:
33653 @table @samp
33654 @item rep_byte
33655 @itemx rep_4byte
33656 @itemx rep_8byte
33657 Expand using i386 @code{rep} prefix of the specified size.
33659 @item byte_loop
33660 @itemx loop
33661 @itemx unrolled_loop
33662 Expand into an inline loop.
33664 @item libcall
33665 Always use a library call.
33666 @end table
33668 @item -mmemcpy-strategy=@var{strategy}
33669 @opindex mmemcpy-strategy=@var{strategy}
33670 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
33671 should be inlined and what inline algorithm to use when the expected size
33672 of the copy operation is known. @var{strategy} 
33673 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
33674 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
33675 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
33676 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
33677 in the list must be specified in increasing order.  The minimal byte size for 
33678 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
33679 preceding range.
33681 @item -mmemset-strategy=@var{strategy}
33682 @opindex mmemset-strategy=@var{strategy}
33683 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
33684 @code{__builtin_memset} expansion.
33686 @item -momit-leaf-frame-pointer
33687 @opindex momit-leaf-frame-pointer
33688 Don't keep the frame pointer in a register for leaf functions.  This
33689 avoids the instructions to save, set up, and restore frame pointers and
33690 makes an extra register available in leaf functions.  The option
33691 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
33692 which might make debugging harder.
33694 @item -mtls-direct-seg-refs
33695 @itemx -mno-tls-direct-seg-refs
33696 @opindex mtls-direct-seg-refs
33697 Controls whether TLS variables may be accessed with offsets from the
33698 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
33699 or whether the thread base pointer must be added.  Whether or not this
33700 is valid depends on the operating system, and whether it maps the
33701 segment to cover the entire TLS area.
33703 For systems that use the GNU C Library, the default is on.
33705 @item -msse2avx
33706 @itemx -mno-sse2avx
33707 @opindex msse2avx
33708 Specify that the assembler should encode SSE instructions with VEX
33709 prefix.  The option @option{-mavx} turns this on by default.
33711 @item -mfentry
33712 @itemx -mno-fentry
33713 @opindex mfentry
33714 If profiling is active (@option{-pg}), put the profiling
33715 counter call before the prologue.
33716 Note: On x86 architectures the attribute @code{ms_hook_prologue}
33717 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
33719 @item -mrecord-mcount
33720 @itemx -mno-record-mcount
33721 @opindex mrecord-mcount
33722 If profiling is active (@option{-pg}), generate a __mcount_loc section
33723 that contains pointers to each profiling call. This is useful for
33724 automatically patching and out calls.
33726 @item -mnop-mcount
33727 @itemx -mno-nop-mcount
33728 @opindex mnop-mcount
33729 If profiling is active (@option{-pg}), generate the calls to
33730 the profiling functions as NOPs. This is useful when they
33731 should be patched in later dynamically. This is likely only
33732 useful together with @option{-mrecord-mcount}.
33734 @item -minstrument-return=@var{type}
33735 @opindex minstrument-return
33736 Instrument function exit in -pg -mfentry instrumented functions with
33737 call to specified function. This only instruments true returns ending
33738 with ret, but not sibling calls ending with jump. Valid types
33739 are @var{none} to not instrument, @var{call} to generate a call to __return__,
33740 or @var{nop5} to generate a 5 byte nop.
33742 @item -mrecord-return
33743 @itemx -mno-record-return
33744 @opindex mrecord-return
33745 Generate a __return_loc section pointing to all return instrumentation code.
33747 @item -mfentry-name=@var{name}
33748 @opindex mfentry-name
33749 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
33751 @item -mfentry-section=@var{name}
33752 @opindex mfentry-section
33753 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
33755 @item -mskip-rax-setup
33756 @itemx -mno-skip-rax-setup
33757 @opindex mskip-rax-setup
33758 When generating code for the x86-64 architecture with SSE extensions
33759 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
33760 register when there are no variable arguments passed in vector registers.
33762 @strong{Warning:} Since RAX register is used to avoid unnecessarily
33763 saving vector registers on stack when passing variable arguments, the
33764 impacts of this option are callees may waste some stack space,
33765 misbehave or jump to a random location.  GCC 4.4 or newer don't have
33766 those issues, regardless the RAX register value.
33768 @item -m8bit-idiv
33769 @itemx -mno-8bit-idiv
33770 @opindex m8bit-idiv
33771 On some processors, like Intel Atom, 8-bit unsigned integer divide is
33772 much faster than 32-bit/64-bit integer divide.  This option generates a
33773 run-time check.  If both dividend and divisor are within range of 0
33774 to 255, 8-bit unsigned integer divide is used instead of
33775 32-bit/64-bit integer divide.
33777 @item -mavx256-split-unaligned-load
33778 @itemx -mavx256-split-unaligned-store
33779 @opindex mavx256-split-unaligned-load
33780 @opindex mavx256-split-unaligned-store
33781 Split 32-byte AVX unaligned load and store.
33783 @item -mstack-protector-guard=@var{guard}
33784 @itemx -mstack-protector-guard-reg=@var{reg}
33785 @itemx -mstack-protector-guard-offset=@var{offset}
33786 @opindex mstack-protector-guard
33787 @opindex mstack-protector-guard-reg
33788 @opindex mstack-protector-guard-offset
33789 Generate stack protection code using canary at @var{guard}.  Supported
33790 locations are @samp{global} for global canary or @samp{tls} for per-thread
33791 canary in the TLS block (the default).  This option has effect only when
33792 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
33794 With the latter choice the options
33795 @option{-mstack-protector-guard-reg=@var{reg}} and
33796 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
33797 which segment register (@code{%fs} or @code{%gs}) to use as base register
33798 for reading the canary, and from what offset from that base register.
33799 The default for those is as specified in the relevant ABI.
33801 @item -mgeneral-regs-only
33802 @opindex mgeneral-regs-only
33803 Generate code that uses only the general-purpose registers.  This
33804 prevents the compiler from using floating-point, vector, mask and bound
33805 registers.
33807 @item -mrelax-cmpxchg-loop
33808 @opindex mrelax-cmpxchg-loop
33809 When emitting a compare-and-swap loop for @ref{__sync Builtins}
33810 and @ref{__atomic Builtins} lacking a native instruction, optimize
33811 for the highly contended case by issuing an atomic load before the
33812 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
33813 to save CPU power when restarting the loop.
33815 @item -mindirect-branch=@var{choice}
33816 @opindex mindirect-branch
33817 Convert indirect call and jump with @var{choice}.  The default is
33818 @samp{keep}, which keeps indirect call and jump unmodified.
33819 @samp{thunk} converts indirect call and jump to call and return thunk.
33820 @samp{thunk-inline} converts indirect call and jump to inlined call
33821 and return thunk.  @samp{thunk-extern} converts indirect call and jump
33822 to external call and return thunk provided in a separate object file.
33823 You can control this behavior for a specific function by using the
33824 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
33826 Note that @option{-mcmodel=large} is incompatible with
33827 @option{-mindirect-branch=thunk} and
33828 @option{-mindirect-branch=thunk-extern} since the thunk function may
33829 not be reachable in the large code model.
33831 Note that @option{-mindirect-branch=thunk-extern} is compatible with
33832 @option{-fcf-protection=branch} since the external thunk can be made
33833 to enable control-flow check.
33835 @item -mfunction-return=@var{choice}
33836 @opindex mfunction-return
33837 Convert function return with @var{choice}.  The default is @samp{keep},
33838 which keeps function return unmodified.  @samp{thunk} converts function
33839 return to call and return thunk.  @samp{thunk-inline} converts function
33840 return to inlined call and return thunk.  @samp{thunk-extern} converts
33841 function return to external call and return thunk provided in a separate
33842 object file.  You can control this behavior for a specific function by
33843 using the function attribute @code{function_return}.
33844 @xref{Function Attributes}.
33846 Note that @option{-mindirect-return=thunk-extern} is compatible with
33847 @option{-fcf-protection=branch} since the external thunk can be made
33848 to enable control-flow check.
33850 Note that @option{-mcmodel=large} is incompatible with
33851 @option{-mfunction-return=thunk} and
33852 @option{-mfunction-return=thunk-extern} since the thunk function may
33853 not be reachable in the large code model.
33856 @item -mindirect-branch-register
33857 @opindex mindirect-branch-register
33858 Force indirect call and jump via register.
33860 @item -mharden-sls=@var{choice}
33861 @opindex mharden-sls
33862 Generate code to mitigate against straight line speculation (SLS) with
33863 @var{choice}.  The default is @samp{none} which disables all SLS
33864 hardening.  @samp{return} enables SLS hardening for function returns.
33865 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
33866 @samp{all} enables all SLS hardening.
33868 @item -mindirect-branch-cs-prefix
33869 @opindex mindirect-branch-cs-prefix
33870 Add CS prefix to call and jmp to indirect thunk with branch target in
33871 r8-r15 registers so that the call and jmp instruction length is 6 bytes
33872 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
33873 @samp{lfence; jmp *%r8-r15} at run-time.
33875 @end table
33877 These @samp{-m} switches are supported in addition to the above
33878 on x86-64 processors in 64-bit environments.
33880 @table @gcctabopt
33881 @item -m32
33882 @itemx -m64
33883 @itemx -mx32
33884 @itemx -m16
33885 @itemx -miamcu
33886 @opindex m32
33887 @opindex m64
33888 @opindex mx32
33889 @opindex m16
33890 @opindex miamcu
33891 Generate code for a 16-bit, 32-bit or 64-bit environment.
33892 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
33893 to 32 bits, and
33894 generates code that runs on any i386 system.
33896 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
33897 types to 64 bits, and generates code for the x86-64 architecture.
33898 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
33899 and @option{-mdynamic-no-pic} options.
33901 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
33902 to 32 bits, and
33903 generates code for the x86-64 architecture.
33905 The @option{-m16} option is the same as @option{-m32}, except for that
33906 it outputs the @code{.code16gcc} assembly directive at the beginning of
33907 the assembly output so that the binary can run in 16-bit mode.
33909 The @option{-miamcu} option generates code which conforms to Intel MCU
33910 psABI.  It requires the @option{-m32} option to be turned on.
33912 @item -mno-red-zone
33913 @opindex mno-red-zone
33914 @opindex mred-zone
33915 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
33916 by the x86-64 ABI; it is a 128-byte area beyond the location of the
33917 stack pointer that is not modified by signal or interrupt handlers
33918 and therefore can be used for temporary data without adjusting the stack
33919 pointer.  The flag @option{-mno-red-zone} disables this red zone.
33921 @item -mcmodel=small
33922 @opindex mcmodel=small
33923 Generate code for the small code model: the program and its symbols must
33924 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
33925 Programs can be statically or dynamically linked.  This is the default
33926 code model.
33928 @item -mcmodel=kernel
33929 @opindex mcmodel=kernel
33930 Generate code for the kernel code model.  The kernel runs in the
33931 negative 2 GB of the address space.
33932 This model has to be used for Linux kernel code.
33934 @item -mcmodel=medium
33935 @opindex mcmodel=medium
33936 Generate code for the medium model: the program is linked in the lower 2
33937 GB of the address space.  Small symbols are also placed there.  Symbols
33938 with sizes larger than @option{-mlarge-data-threshold} are put into
33939 large data or BSS sections and can be located above 2GB.  Programs can
33940 be statically or dynamically linked.
33942 @item -mcmodel=large
33943 @opindex mcmodel=large
33944 Generate code for the large model.  This model makes no assumptions
33945 about addresses and sizes of sections.
33947 @item -maddress-mode=long
33948 @opindex maddress-mode=long
33949 Generate code for long address mode.  This is only supported for 64-bit
33950 and x32 environments.  It is the default address mode for 64-bit
33951 environments.
33953 @item -maddress-mode=short
33954 @opindex maddress-mode=short
33955 Generate code for short address mode.  This is only supported for 32-bit
33956 and x32 environments.  It is the default address mode for 32-bit and
33957 x32 environments.
33959 @item -mneeded
33960 @itemx -mno-needed
33961 @opindex mneeded
33962 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
33963 indicate the micro-architecture ISA level required to execute the binary.
33965 @item -mno-direct-extern-access
33966 @opindex mno-direct-extern-access
33967 @opindex mdirect-extern-access
33968 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
33969 to access external symbols.  With @option{-fpic} or @option{-fPIC},
33970 treat access to protected symbols as local symbols.  The default is
33971 @option{-mdirect-extern-access}.
33973 @strong{Warning:} shared libraries compiled with
33974 @option{-mno-direct-extern-access} and executable compiled with
33975 @option{-mdirect-extern-access} may not be binary compatible if
33976 protected symbols are used in shared libraries and executable.
33978 @item -munroll-only-small-loops
33979 @opindex munroll-only-small-loops
33980 @opindex mno-unroll-only-small-loops
33981 Controls conservative small loop unrolling. It is default enabled by
33982 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
33983 -f[no-]unroll-[all-]loops would disable this flag to avoid any
33984 unintended unrolling behavior that user does not want.
33986 @item -mlam=@var{choice}
33987 @opindex mlam
33988 LAM(linear-address masking) allows special bits in the pointer to be used
33989 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
33990 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
33991 positions 62:57 can be used for metadata.
33992 @end table
33994 @node x86 Windows Options
33995 @subsection x86 Windows Options
33996 @cindex x86 Windows Options
33997 @cindex Windows Options for x86
33999 These additional options are available for Microsoft Windows targets:
34001 @table @gcctabopt
34002 @item -mconsole
34003 @opindex mconsole
34004 This option
34005 specifies that a console application is to be generated, by
34006 instructing the linker to set the PE header subsystem type
34007 required for console applications.
34008 This option is available for Cygwin and MinGW targets and is
34009 enabled by default on those targets.
34011 @item -mdll
34012 @opindex mdll
34013 This option is available for Cygwin and MinGW targets.  It
34014 specifies that a DLL---a dynamic link library---is to be
34015 generated, enabling the selection of the required runtime
34016 startup object and entry point.
34018 @item -mnop-fun-dllimport
34019 @opindex mnop-fun-dllimport
34020 This option is available for Cygwin and MinGW targets.  It
34021 specifies that the @code{dllimport} attribute should be ignored.
34023 @item -mthreads
34024 @opindex mthreads
34025 This option is available for MinGW targets. It specifies
34026 that MinGW-specific thread support is to be used.
34028 @item -municode
34029 @opindex municode
34030 This option is available for MinGW-w64 targets.  It causes
34031 the @code{UNICODE} preprocessor macro to be predefined, and
34032 chooses Unicode-capable runtime startup code.
34034 @item -mwin32
34035 @opindex mwin32
34036 This option is available for Cygwin and MinGW targets.  It
34037 specifies that the typical Microsoft Windows predefined macros are to
34038 be set in the pre-processor, but does not influence the choice
34039 of runtime library/startup code.
34041 @item -mwindows
34042 @opindex mwindows
34043 This option is available for Cygwin and MinGW targets.  It
34044 specifies that a GUI application is to be generated by
34045 instructing the linker to set the PE header subsystem type
34046 appropriately.
34048 @item -fno-set-stack-executable
34049 @opindex fno-set-stack-executable
34050 @opindex fset-stack-executable
34051 This option is available for MinGW targets. It specifies that
34052 the executable flag for the stack used by nested functions isn't
34053 set. This is necessary for binaries running in kernel mode of
34054 Microsoft Windows, as there the User32 API, which is used to set executable
34055 privileges, isn't available.
34057 @item -fwritable-relocated-rdata
34058 @opindex fno-writable-relocated-rdata
34059 @opindex fwritable-relocated-rdata
34060 This option is available for MinGW and Cygwin targets.  It specifies
34061 that relocated-data in read-only section is put into the @code{.data}
34062 section.  This is a necessary for older runtimes not supporting
34063 modification of @code{.rdata} sections for pseudo-relocation.
34065 @item -mpe-aligned-commons
34066 @opindex mpe-aligned-commons
34067 This option is available for Cygwin and MinGW targets.  It
34068 specifies that the GNU extension to the PE file format that
34069 permits the correct alignment of COMMON variables should be
34070 used when generating code.  It is enabled by default if
34071 GCC detects that the target assembler found during configuration
34072 supports the feature.
34073 @end table
34075 See also under @ref{x86 Options} for standard options.
34077 @node Xstormy16 Options
34078 @subsection Xstormy16 Options
34079 @cindex Xstormy16 Options
34081 These options are defined for Xstormy16:
34083 @table @gcctabopt
34084 @item -msim
34085 @opindex msim
34086 Choose startup files and linker script suitable for the simulator.
34087 @end table
34089 @node Xtensa Options
34090 @subsection Xtensa Options
34091 @cindex Xtensa Options
34093 These options are supported for Xtensa targets:
34095 @table @gcctabopt
34096 @item -mconst16
34097 @itemx -mno-const16
34098 @opindex mconst16
34099 @opindex mno-const16
34100 Enable or disable use of @code{CONST16} instructions for loading
34101 constant values.  The @code{CONST16} instruction is currently not a
34102 standard option from Tensilica.  When enabled, @code{CONST16}
34103 instructions are always used in place of the standard @code{L32R}
34104 instructions.  The use of @code{CONST16} is enabled by default only if
34105 the @code{L32R} instruction is not available.
34107 @item -mfused-madd
34108 @itemx -mno-fused-madd
34109 @opindex mfused-madd
34110 @opindex mno-fused-madd
34111 Enable or disable use of fused multiply/add and multiply/subtract
34112 instructions in the floating-point option.  This has no effect if the
34113 floating-point option is not also enabled.  Disabling fused multiply/add
34114 and multiply/subtract instructions forces the compiler to use separate
34115 instructions for the multiply and add/subtract operations.  This may be
34116 desirable in some cases where strict IEEE 754-compliant results are
34117 required: the fused multiply add/subtract instructions do not round the
34118 intermediate result, thereby producing results with @emph{more} bits of
34119 precision than specified by the IEEE standard.  Disabling fused multiply
34120 add/subtract instructions also ensures that the program output is not
34121 sensitive to the compiler's ability to combine multiply and add/subtract
34122 operations.
34124 @item -mserialize-volatile
34125 @itemx -mno-serialize-volatile
34126 @opindex mserialize-volatile
34127 @opindex mno-serialize-volatile
34128 When this option is enabled, GCC inserts @code{MEMW} instructions before
34129 @code{volatile} memory references to guarantee sequential consistency.
34130 The default is @option{-mserialize-volatile}.  Use
34131 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
34133 @item -mforce-no-pic
34134 @opindex mforce-no-pic
34135 For targets, like GNU/Linux, where all user-mode Xtensa code must be
34136 position-independent code (PIC), this option disables PIC for compiling
34137 kernel code.
34139 @item -mtext-section-literals
34140 @itemx -mno-text-section-literals
34141 @opindex mtext-section-literals
34142 @opindex mno-text-section-literals
34143 These options control the treatment of literal pools.  The default is
34144 @option{-mno-text-section-literals}, which places literals in a separate
34145 section in the output file.  This allows the literal pool to be placed
34146 in a data RAM/ROM, and it also allows the linker to combine literal
34147 pools from separate object files to remove redundant literals and
34148 improve code size.  With @option{-mtext-section-literals}, the literals
34149 are interspersed in the text section in order to keep them as close as
34150 possible to their references.  This may be necessary for large assembly
34151 files.  Literals for each function are placed right before that function.
34153 @item -mauto-litpools
34154 @itemx -mno-auto-litpools
34155 @opindex mauto-litpools
34156 @opindex mno-auto-litpools
34157 These options control the treatment of literal pools.  The default is
34158 @option{-mno-auto-litpools}, which places literals in a separate
34159 section in the output file unless @option{-mtext-section-literals} is
34160 used.  With @option{-mauto-litpools} the literals are interspersed in
34161 the text section by the assembler.  Compiler does not produce explicit
34162 @code{.literal} directives and loads literals into registers with
34163 @code{MOVI} instructions instead of @code{L32R} to let the assembler
34164 do relaxation and place literals as necessary.  This option allows
34165 assembler to create several literal pools per function and assemble
34166 very big functions, which may not be possible with
34167 @option{-mtext-section-literals}.
34169 @item -mtarget-align
34170 @itemx -mno-target-align
34171 @opindex mtarget-align
34172 @opindex mno-target-align
34173 When this option is enabled, GCC instructs the assembler to
34174 automatically align instructions to reduce branch penalties at the
34175 expense of some code density.  The assembler attempts to widen density
34176 instructions to align branch targets and the instructions following call
34177 instructions.  If there are not enough preceding safe density
34178 instructions to align a target, no widening is performed.  The
34179 default is @option{-mtarget-align}.  These options do not affect the
34180 treatment of auto-aligned instructions like @code{LOOP}, which the
34181 assembler always aligns, either by widening density instructions or
34182 by inserting NOP instructions.
34184 @item -mlongcalls
34185 @itemx -mno-longcalls
34186 @opindex mlongcalls
34187 @opindex mno-longcalls
34188 When this option is enabled, GCC instructs the assembler to translate
34189 direct calls to indirect calls unless it can determine that the target
34190 of a direct call is in the range allowed by the call instruction.  This
34191 translation typically occurs for calls to functions in other source
34192 files.  Specifically, the assembler translates a direct @code{CALL}
34193 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
34194 The default is @option{-mno-longcalls}.  This option should be used in
34195 programs where the call target can potentially be out of range.  This
34196 option is implemented in the assembler, not the compiler, so the
34197 assembly code generated by GCC still shows direct call
34198 instructions---look at the disassembled object code to see the actual
34199 instructions.  Note that the assembler uses an indirect call for
34200 every cross-file call, not just those that really are out of range.
34202 @item -mabi=@var{name}
34203 @opindex mabi
34204 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
34205 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
34207 @item -mabi=call0
34208 @opindex mabi=call0
34209 When this option is enabled function parameters are passed in registers
34210 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
34211 caller-saved, and register @code{a15} may be used as a frame pointer.
34212 When this version of the ABI is enabled the C preprocessor symbol
34213 @code{__XTENSA_CALL0_ABI__} is defined.
34215 @item -mabi=windowed
34216 @opindex mabi=windowed
34217 When this option is enabled function parameters are passed in registers
34218 @code{a10} through @code{a15}, and called function rotates register window
34219 by 8 registers on entry so that its arguments are found in registers
34220 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
34221 pointer.  Register window is rotated 8 registers back upon return.
34222 When this version of the ABI is enabled the C preprocessor symbol
34223 @code{__XTENSA_WINDOWED_ABI__} is defined.
34225 @item -mextra-l32r-costs=@var{n}
34226 @opindex mextra-l32r-costs
34227 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
34228 instructions, in clock cycles.  This affects, when optimizing for speed,
34229 whether loading a constant from literal pool using @code{L32R} or
34230 synthesizing the constant from a small one with a couple of arithmetic
34231 instructions.  The default value is 0.
34232 @end table
34234 @node zSeries Options
34235 @subsection zSeries Options
34236 @cindex zSeries options
34238 These are listed under @xref{S/390 and zSeries Options}.
34241 @c man end
34243 @node Spec Files
34244 @section Specifying Subprocesses and the Switches to Pass to Them
34245 @cindex Spec Files
34247 @command{gcc} is a driver program.  It performs its job by invoking a
34248 sequence of other programs to do the work of compiling, assembling and
34249 linking.  GCC interprets its command-line parameters and uses these to
34250 deduce which programs it should invoke, and which command-line options
34251 it ought to place on their command lines.  This behavior is controlled
34252 by @dfn{spec strings}.  In most cases there is one spec string for each
34253 program that GCC can invoke, but a few programs have multiple spec
34254 strings to control their behavior.  The spec strings built into GCC can
34255 be overridden by using the @option{-specs=} command-line switch to specify
34256 a spec file.
34258 @dfn{Spec files} are plain-text files that are used to construct spec
34259 strings.  They consist of a sequence of directives separated by blank
34260 lines.  The type of directive is determined by the first non-whitespace
34261 character on the line, which can be one of the following:
34263 @table @code
34264 @item %@var{command}
34265 Issues a @var{command} to the spec file processor.  The commands that can
34266 appear here are:
34268 @table @code
34269 @item %include <@var{file}>
34270 @cindex @code{%include}
34271 Search for @var{file} and insert its text at the current point in the
34272 specs file.
34274 @item %include_noerr <@var{file}>
34275 @cindex @code{%include_noerr}
34276 Just like @samp{%include}, but do not generate an error message if the include
34277 file cannot be found.
34279 @item %rename @var{old_name} @var{new_name}
34280 @cindex @code{%rename}
34281 Rename the spec string @var{old_name} to @var{new_name}.
34283 @end table
34285 @item *[@var{spec_name}]:
34286 This tells the compiler to create, override or delete the named spec
34287 string.  All lines after this directive up to the next directive or
34288 blank line are considered to be the text for the spec string.  If this
34289 results in an empty string then the spec is deleted.  (Or, if the
34290 spec did not exist, then nothing happens.)  Otherwise, if the spec
34291 does not currently exist a new spec is created.  If the spec does
34292 exist then its contents are overridden by the text of this
34293 directive, unless the first character of that text is the @samp{+}
34294 character, in which case the text is appended to the spec.
34296 @item [@var{suffix}]:
34297 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
34298 and up to the next directive or blank line are considered to make up the
34299 spec string for the indicated suffix.  When the compiler encounters an
34300 input file with the named suffix, it processes the spec string in
34301 order to work out how to compile that file.  For example:
34303 @smallexample
34304 .ZZ:
34305 z-compile -input %i
34306 @end smallexample
34308 This says that any input file whose name ends in @samp{.ZZ} should be
34309 passed to the program @samp{z-compile}, which should be invoked with the
34310 command-line switch @option{-input} and with the result of performing the
34311 @samp{%i} substitution.  (See below.)
34313 As an alternative to providing a spec string, the text following a
34314 suffix directive can be one of the following:
34316 @table @code
34317 @item @@@var{language}
34318 This says that the suffix is an alias for a known @var{language}.  This is
34319 similar to using the @option{-x} command-line switch to GCC to specify a
34320 language explicitly.  For example:
34322 @smallexample
34323 .ZZ:
34324 @@c++
34325 @end smallexample
34327 Says that .ZZ files are, in fact, C++ source files.
34329 @item #@var{name}
34330 This causes an error messages saying:
34332 @smallexample
34333 @var{name} compiler not installed on this system.
34334 @end smallexample
34335 @end table
34337 GCC already has an extensive list of suffixes built into it.
34338 This directive adds an entry to the end of the list of suffixes, but
34339 since the list is searched from the end backwards, it is effectively
34340 possible to override earlier entries using this technique.
34342 @end table
34344 GCC has the following spec strings built into it.  Spec files can
34345 override these strings or create their own.  Note that individual
34346 targets can also add their own spec strings to this list.
34348 @smallexample
34349 asm          Options to pass to the assembler
34350 asm_final    Options to pass to the assembler post-processor
34351 cpp          Options to pass to the C preprocessor
34352 cc1          Options to pass to the C compiler
34353 cc1plus      Options to pass to the C++ compiler
34354 endfile      Object files to include at the end of the link
34355 link         Options to pass to the linker
34356 lib          Libraries to include on the command line to the linker
34357 libgcc       Decides which GCC support library to pass to the linker
34358 linker       Sets the name of the linker
34359 predefines   Defines to be passed to the C preprocessor
34360 signed_char  Defines to pass to CPP to say whether @code{char} is signed
34361              by default
34362 startfile    Object files to include at the start of the link
34363 @end smallexample
34365 Here is a small example of a spec file:
34367 @smallexample
34368 %rename lib                 old_lib
34370 *lib:
34371 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
34372 @end smallexample
34374 This example renames the spec called @samp{lib} to @samp{old_lib} and
34375 then overrides the previous definition of @samp{lib} with a new one.
34376 The new definition adds in some extra command-line options before
34377 including the text of the old definition.
34379 @dfn{Spec strings} are a list of command-line options to be passed to their
34380 corresponding program.  In addition, the spec strings can contain
34381 @samp{%}-prefixed sequences to substitute variable text or to
34382 conditionally insert text into the command line.  Using these constructs
34383 it is possible to generate quite complex command lines.
34385 Here is a table of all defined @samp{%}-sequences for spec
34386 strings.  Note that spaces are not generated automatically around the
34387 results of expanding these sequences.  Therefore you can concatenate them
34388 together or combine them with constant text in a single argument.
34390 @table @code
34391 @item %%
34392 Substitute one @samp{%} into the program name or argument.
34394 @item %"
34395 Substitute an empty argument.
34397 @item %i
34398 Substitute the name of the input file being processed.
34400 @item %b
34401 Substitute the basename for outputs related with the input file being
34402 processed.  This is often the substring up to (and not including) the
34403 last period and not including the directory but, unless %w is active, it
34404 expands to the basename for auxiliary outputs, which may be influenced
34405 by an explicit output name, and by various other options that control
34406 how auxiliary outputs are named.
34408 @item %B
34409 This is the same as @samp{%b}, but include the file suffix (text after
34410 the last period).  Without %w, it expands to the basename for dump
34411 outputs.
34413 @item %d
34414 Marks the argument containing or following the @samp{%d} as a
34415 temporary file name, so that that file is deleted if GCC exits
34416 successfully.  Unlike @samp{%g}, this contributes no text to the
34417 argument.
34419 @item %g@var{suffix}
34420 Substitute a file name that has suffix @var{suffix} and is chosen
34421 once per compilation, and mark the argument in the same way as
34422 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
34423 name is now chosen in a way that is hard to predict even when previously
34424 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
34425 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
34426 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
34427 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
34428 was simply substituted with a file name chosen once per compilation,
34429 without regard to any appended suffix (which was therefore treated
34430 just like ordinary text), making such attacks more likely to succeed.
34432 @item %u@var{suffix}
34433 Like @samp{%g}, but generates a new temporary file name
34434 each time it appears instead of once per compilation.
34436 @item %U@var{suffix}
34437 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
34438 new one if there is no such last file name.  In the absence of any
34439 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
34440 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
34441 involves the generation of two distinct file names, one
34442 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
34443 simply substituted with a file name chosen for the previous @samp{%u},
34444 without regard to any appended suffix.
34446 @item %j@var{suffix}
34447 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
34448 writable, and if @option{-save-temps} is not used; 
34449 otherwise, substitute the name
34450 of a temporary file, just like @samp{%u}.  This temporary file is not
34451 meant for communication between processes, but rather as a junk
34452 disposal mechanism.
34454 @item %|@var{suffix}
34455 @itemx %m@var{suffix}
34456 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
34457 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
34458 all.  These are the two most common ways to instruct a program that it
34459 should read from standard input or write to standard output.  If you
34460 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
34461 construct: see for example @file{gcc/fortran/lang-specs.h}.
34463 @item %.@var{SUFFIX}
34464 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
34465 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
34466 terminated by the next space or %.
34468 @item %w
34469 Marks the argument containing or following the @samp{%w} as the
34470 designated output file of this compilation.  This puts the argument
34471 into the sequence of arguments that @samp{%o} substitutes.
34473 @item %V
34474 Indicates that this compilation produces no output file.
34476 @item %o
34477 Substitutes the names of all the output files, with spaces
34478 automatically placed around them.  You should write spaces
34479 around the @samp{%o} as well or the results are undefined.
34480 @samp{%o} is for use in the specs for running the linker.
34481 Input files whose names have no recognized suffix are not compiled
34482 at all, but they are included among the output files, so they are
34483 linked.
34485 @item %O
34486 Substitutes the suffix for object files.  Note that this is
34487 handled specially when it immediately follows @samp{%g, %u, or %U},
34488 because of the need for those to form complete file names.  The
34489 handling is such that @samp{%O} is treated exactly as if it had already
34490 been substituted, except that @samp{%g, %u, and %U} do not currently
34491 support additional @var{suffix} characters following @samp{%O} as they do
34492 following, for example, @samp{.o}.
34494 @item %I
34495 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
34496 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
34497 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
34498 and @option{-imultilib} as necessary.
34500 @item %s
34501 Current argument is the name of a library or startup file of some sort.
34502 Search for that file in a standard list of directories and substitute
34503 the full name found.  The current working directory is included in the
34504 list of directories scanned.
34506 @item %T
34507 Current argument is the name of a linker script.  Search for that file
34508 in the current list of directories to scan for libraries. If the file
34509 is located insert a @option{--script} option into the command line
34510 followed by the full path name found.  If the file is not found then
34511 generate an error message.  Note: the current working directory is not
34512 searched.
34514 @item %e@var{str}
34515 Print @var{str} as an error message.  @var{str} is terminated by a newline.
34516 Use this when inconsistent options are detected.
34518 @item %n@var{str}
34519 Print @var{str} as a notice.  @var{str} is terminated by a newline.
34521 @item %(@var{name})
34522 Substitute the contents of spec string @var{name} at this point.
34524 @item %x@{@var{option}@}
34525 Accumulate an option for @samp{%X}.
34527 @item %X
34528 Output the accumulated linker options specified by a @samp{%x} spec string.
34530 @item %Y
34531 Output the accumulated assembler options specified by @option{-Wa}.
34533 @item %Z
34534 Output the accumulated preprocessor options specified by @option{-Wp}.
34536 @item %M
34537 Output @code{multilib_os_dir}.
34539 @item %R
34540 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
34542 @item %a
34543 Process the @code{asm} spec.  This is used to compute the
34544 switches to be passed to the assembler.
34546 @item %A
34547 Process the @code{asm_final} spec.  This is a spec string for
34548 passing switches to an assembler post-processor, if such a program is
34549 needed.
34551 @item %l
34552 Process the @code{link} spec.  This is the spec for computing the
34553 command line passed to the linker.  Typically it makes use of the
34554 @samp{%L %G %S %D and %E} sequences.
34556 @item %D
34557 Dump out a @option{-L} option for each directory that GCC believes might
34558 contain startup files.  If the target supports multilibs then the
34559 current multilib directory is prepended to each of these paths.
34561 @item %L
34562 Process the @code{lib} spec.  This is a spec string for deciding which
34563 libraries are included on the command line to the linker.
34565 @item %G
34566 Process the @code{libgcc} spec.  This is a spec string for deciding
34567 which GCC support library is included on the command line to the linker.
34569 @item %S
34570 Process the @code{startfile} spec.  This is a spec for deciding which
34571 object files are the first ones passed to the linker.  Typically
34572 this might be a file named @file{crt0.o}.
34574 @item %E
34575 Process the @code{endfile} spec.  This is a spec string that specifies
34576 the last object files that are passed to the linker.
34578 @item %C
34579 Process the @code{cpp} spec.  This is used to construct the arguments
34580 to be passed to the C preprocessor.
34582 @item %1
34583 Process the @code{cc1} spec.  This is used to construct the options to be
34584 passed to the actual C compiler (@command{cc1}).
34586 @item %2
34587 Process the @code{cc1plus} spec.  This is used to construct the options to be
34588 passed to the actual C++ compiler (@command{cc1plus}).
34590 @item %*
34591 Substitute the variable part of a matched option.  See below.
34592 Note that each comma in the substituted string is replaced by
34593 a single space.
34595 @item %<S
34596 Remove all occurrences of @code{-S} from the command line.  Note---this
34597 command is position dependent.  @samp{%} commands in the spec string
34598 before this one see @code{-S}, @samp{%} commands in the spec string
34599 after this one do not.
34601 @item %<S*
34602 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
34604 @item %>S
34605 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
34607 @item %:@var{function}(@var{args})
34608 Call the named function @var{function}, passing it @var{args}.
34609 @var{args} is first processed as a nested spec string, then split
34610 into an argument vector in the usual fashion.  The function returns
34611 a string which is processed as if it had appeared literally as part
34612 of the current spec.
34614 The following built-in spec functions are provided:
34616 @table @code
34617 @item @code{getenv}
34618 The @code{getenv} spec function takes two arguments: an environment
34619 variable name and a string.  If the environment variable is not
34620 defined, a fatal error is issued.  Otherwise, the return value is the
34621 value of the environment variable concatenated with the string.  For
34622 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
34624 @smallexample
34625 %:getenv(TOPDIR /include)
34626 @end smallexample
34628 expands to @file{/path/to/top/include}.
34630 @item @code{if-exists}
34631 The @code{if-exists} spec function takes one argument, an absolute
34632 pathname to a file.  If the file exists, @code{if-exists} returns the
34633 pathname.  Here is a small example of its usage:
34635 @smallexample
34636 *startfile:
34637 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
34638 @end smallexample
34640 @item @code{if-exists-else}
34641 The @code{if-exists-else} spec function is similar to the @code{if-exists}
34642 spec function, except that it takes two arguments.  The first argument is
34643 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
34644 returns the pathname.  If it does not exist, it returns the second argument.
34645 This way, @code{if-exists-else} can be used to select one file or another,
34646 based on the existence of the first.  Here is a small example of its usage:
34648 @smallexample
34649 *startfile:
34650 crt0%O%s %:if-exists(crti%O%s) \
34651 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
34652 @end smallexample
34654 @item @code{if-exists-then-else}
34655 The @code{if-exists-then-else} spec function takes at least two arguments
34656 and an optional third one. The first argument is an absolute pathname to a
34657 file.  If the file exists, the function returns the second argument.
34658 If the file does not exist, the function returns the third argument if there
34659 is one, or NULL otherwise. This can be used to expand one text, or optionally
34660 another, based on the existence of a file.  Here is a small example of its
34661 usage:
34663 @smallexample
34664 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
34665 @end smallexample
34667 @item @code{sanitize}
34668 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
34669 any address, thread or undefined behavior sanitizers are active.
34671 @smallexample
34672 %@{%:sanitize(address):-funwind-tables@}
34673 @end smallexample
34675 @item @code{replace-outfile}
34676 The @code{replace-outfile} spec function takes two arguments.  It looks for the
34677 first argument in the outfiles array and replaces it with the second argument.  Here
34678 is a small example of its usage:
34680 @smallexample
34681 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
34682 @end smallexample
34684 @item @code{remove-outfile}
34685 The @code{remove-outfile} spec function takes one argument.  It looks for the
34686 first argument in the outfiles array and removes it.  Here is a small example
34687 its usage:
34689 @smallexample
34690 %:remove-outfile(-lm)
34691 @end smallexample
34693 @item @code{version-compare}
34694 The @code{version-compare} spec function takes four or five arguments of the following
34695 form:
34697 @smallexample
34698 <comparison-op> <arg1> [<arg2>] <switch> <result>
34699 @end smallexample
34701 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
34702 The supported @code{comparison-op} values are:
34704 @table @code
34705 @item >=
34706 True if @code{switch} is a later (or same) version than @code{arg1}
34708 @item !>
34709 Opposite of @code{>=}
34711 @item <
34712 True if @code{switch} is an earlier version than @code{arg1}
34714 @item !<
34715 Opposite of @code{<}
34717 @item ><
34718 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
34720 @item <>
34721 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
34722 @end table
34724 If the @code{switch} is not present at all, the condition is false unless the first character
34725 of the @code{comparison-op} is @code{!}.
34727 @smallexample
34728 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
34729 @end smallexample
34731 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
34732 passed.
34734 @item @code{include}
34735 The @code{include} spec function behaves much like @code{%include}, with the advantage
34736 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
34737 the filename, and looks for it in the startfile path.  It always returns NULL.
34739 @smallexample
34740 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
34741 @end smallexample
34743 @item @code{pass-through-libs}
34744 The @code{pass-through-libs} spec function takes any number of arguments.  It
34745 finds any @option{-l} options and any non-options ending in @file{.a} (which it
34746 assumes are the names of linker input library archive files) and returns a
34747 result containing all the found arguments each prepended by
34748 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
34749 intended to be passed to the LTO linker plugin.
34751 @smallexample
34752 %:pass-through-libs(%G %L %G)
34753 @end smallexample
34755 @item @code{print-asm-header}
34756 The @code{print-asm-header} function takes no arguments and simply
34757 prints a banner like:
34759 @smallexample
34760 Assembler options
34761 =================
34763 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
34764 @end smallexample
34766 It is used to separate compiler options from assembler options
34767 in the @option{--target-help} output.
34769 @item @code{gt}
34770 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
34771 empty string) if the second-to-last argument is greater than the last argument, and NULL
34772 otherwise.  The following example inserts the @code{link_gomp} spec if the last
34773 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
34775 @smallexample
34776 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
34777 @end smallexample
34779 @item @code{debug-level-gt}
34780 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
34781 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
34782 otherwise.
34784 @smallexample
34785 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
34786 @end smallexample
34787 @end table
34789 @item %@{S@}
34790 Substitutes the @code{-S} switch, if that switch is given to GCC@.
34791 If that switch is not specified, this substitutes nothing.  Note that
34792 the leading dash is omitted when specifying this option, and it is
34793 automatically inserted if the substitution is performed.  Thus the spec
34794 string @samp{%@{foo@}} matches the command-line option @option{-foo}
34795 and outputs the command-line option @option{-foo}.
34797 @item %W@{S@}
34798 Like %@{@code{S}@} but mark last argument supplied within as a file to be
34799 deleted on failure.
34801 @item %@@@{S@}
34802 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
34803 @code{@@FILE} if an @code{@@file} argument has been supplied.
34805 @item %@{S*@}
34806 Substitutes all the switches specified to GCC whose names start
34807 with @code{-S}, but which also take an argument.  This is used for
34808 switches like @option{-o}, @option{-D}, @option{-I}, etc.
34809 GCC considers @option{-o foo} as being
34810 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
34811 text, including the space.  Thus two arguments are generated.
34813 @item %@{S*&T*@}
34814 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
34815 (the order of @code{S} and @code{T} in the spec is not significant).
34816 There can be any number of ampersand-separated variables; for each the
34817 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
34819 @item %@{S:X@}
34820 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
34822 @item %@{!S:X@}
34823 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
34825 @item %@{S*:X@}
34826 Substitutes @code{X} if one or more switches whose names start with
34827 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
34828 once, no matter how many such switches appeared.  However, if @code{%*}
34829 appears somewhere in @code{X}, then @code{X} is substituted once
34830 for each matching switch, with the @code{%*} replaced by the part of
34831 that switch matching the @code{*}.
34833 If @code{%*} appears as the last part of a spec sequence then a space
34834 is added after the end of the last substitution.  If there is more
34835 text in the sequence, however, then a space is not generated.  This
34836 allows the @code{%*} substitution to be used as part of a larger
34837 string.  For example, a spec string like this:
34839 @smallexample
34840 %@{mcu=*:--script=%*/memory.ld@}
34841 @end smallexample
34843 @noindent
34844 when matching an option like @option{-mcu=newchip} produces:
34846 @smallexample
34847 --script=newchip/memory.ld
34848 @end smallexample
34850 @item %@{.S:X@}
34851 Substitutes @code{X}, if processing a file with suffix @code{S}.
34853 @item %@{!.S:X@}
34854 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
34856 @item %@{,S:X@}
34857 Substitutes @code{X}, if processing a file for language @code{S}.
34859 @item %@{!,S:X@}
34860 Substitutes @code{X}, if not processing a file for language @code{S}.
34862 @item %@{S|P:X@}
34863 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
34864 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
34865 @code{*} sequences as well, although they have a stronger binding than
34866 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
34867 alternatives must be starred, and only the first matching alternative
34868 is substituted.
34870 For example, a spec string like this:
34872 @smallexample
34873 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
34874 @end smallexample
34876 @noindent
34877 outputs the following command-line options from the following input
34878 command-line options:
34880 @smallexample
34881 fred.c        -foo -baz
34882 jim.d         -bar -boggle
34883 -d fred.c     -foo -baz -boggle
34884 -d jim.d      -bar -baz -boggle
34885 @end smallexample
34887 @item %@{%:@var{function}(@var{args}):X@}
34889 Call function named @var{function} with args @var{args}.  If the
34890 function returns non-NULL, then @code{X} is substituted, if it returns
34891 NULL, it isn't substituted.
34893 @item %@{S:X; T:Y; :D@}
34895 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
34896 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
34897 be as many clauses as you need.  This may be combined with @code{.},
34898 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
34901 @end table
34903 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
34904 or similar construct can use a backslash to ignore the special meaning
34905 of the character following it, thus allowing literal matching of a
34906 character that is otherwise specially treated.  For example,
34907 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
34908 @option{-std=iso9899:1999} option is given.
34910 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
34911 construct may contain other nested @samp{%} constructs or spaces, or
34912 even newlines.  They are processed as usual, as described above.
34913 Trailing white space in @code{X} is ignored.  White space may also
34914 appear anywhere on the left side of the colon in these constructs,
34915 except between @code{.} or @code{*} and the corresponding word.
34917 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
34918 handled specifically in these constructs.  If another value of
34919 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
34920 @option{-W} switch is found later in the command line, the earlier
34921 switch value is ignored, except with @{@code{S}*@} where @code{S} is
34922 just one letter, which passes all matching options.
34924 The character @samp{|} at the beginning of the predicate text is used to
34925 indicate that a command should be piped to the following command, but
34926 only if @option{-pipe} is specified.
34928 It is built into GCC which switches take arguments and which do not.
34929 (You might think it would be useful to generalize this to allow each
34930 compiler's spec to say which switches take arguments.  But this cannot
34931 be done in a consistent fashion.  GCC cannot even decide which input
34932 files have been specified without knowing which switches take arguments,
34933 and it must know which input files to compile in order to tell which
34934 compilers to run).
34936 GCC also knows implicitly that arguments starting in @option{-l} are to be
34937 treated as compiler output files, and passed to the linker in their
34938 proper position among the other output files.
34940 @node Environment Variables
34941 @section Environment Variables Affecting GCC
34942 @cindex environment variables
34944 @c man begin ENVIRONMENT
34945 This section describes several environment variables that affect how GCC
34946 operates.  Some of them work by specifying directories or prefixes to use
34947 when searching for various kinds of files.  Some are used to specify other
34948 aspects of the compilation environment.
34950 Note that you can also specify places to search using options such as
34951 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
34952 take precedence over places specified using environment variables, which
34953 in turn take precedence over those specified by the configuration of GCC@.
34954 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
34955 GNU Compiler Collection (GCC) Internals}.
34957 @table @env
34958 @item LANG
34959 @itemx LC_CTYPE
34960 @c @itemx LC_COLLATE
34961 @itemx LC_MESSAGES
34962 @c @itemx LC_MONETARY
34963 @c @itemx LC_NUMERIC
34964 @c @itemx LC_TIME
34965 @itemx LC_ALL
34966 @findex LANG
34967 @findex LC_CTYPE
34968 @c @findex LC_COLLATE
34969 @findex LC_MESSAGES
34970 @c @findex LC_MONETARY
34971 @c @findex LC_NUMERIC
34972 @c @findex LC_TIME
34973 @findex LC_ALL
34974 @cindex locale
34975 These environment variables control the way that GCC uses
34976 localization information which allows GCC to work with different
34977 national conventions.  GCC inspects the locale categories
34978 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
34979 so.  These locale categories can be set to any value supported by your
34980 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
34981 Kingdom encoded in UTF-8.
34983 The @env{LC_CTYPE} environment variable specifies character
34984 classification.  GCC uses it to determine the character boundaries in
34985 a string; this is needed for some multibyte encodings that contain quote
34986 and escape characters that are otherwise interpreted as a string
34987 end or escape.
34989 The @env{LC_MESSAGES} environment variable specifies the language to
34990 use in diagnostic messages.
34992 If the @env{LC_ALL} environment variable is set, it overrides the value
34993 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
34994 and @env{LC_MESSAGES} default to the value of the @env{LANG}
34995 environment variable.  If none of these variables are set, GCC
34996 defaults to traditional C English behavior.
34998 @item TMPDIR
34999 @findex TMPDIR
35000 If @env{TMPDIR} is set, it specifies the directory to use for temporary
35001 files.  GCC uses temporary files to hold the output of one stage of
35002 compilation which is to be used as input to the next stage: for example,
35003 the output of the preprocessor, which is the input to the compiler
35004 proper.
35006 @item GCC_COMPARE_DEBUG
35007 @findex GCC_COMPARE_DEBUG
35008 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
35009 @option{-fcompare-debug} to the compiler driver.  See the documentation
35010 of this option for more details.
35012 @item GCC_EXEC_PREFIX
35013 @findex GCC_EXEC_PREFIX
35014 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
35015 names of the subprograms executed by the compiler.  No slash is added
35016 when this prefix is combined with the name of a subprogram, but you can
35017 specify a prefix that ends with a slash if you wish.
35019 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
35020 an appropriate prefix to use based on the pathname it is invoked with.
35022 If GCC cannot find the subprogram using the specified prefix, it
35023 tries looking in the usual places for the subprogram.
35025 The default value of @env{GCC_EXEC_PREFIX} is
35026 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
35027 the installed compiler. In many cases @var{prefix} is the value
35028 of @code{prefix} when you ran the @file{configure} script.
35030 Other prefixes specified with @option{-B} take precedence over this prefix.
35032 This prefix is also used for finding files such as @file{crt0.o} that are
35033 used for linking.
35035 In addition, the prefix is used in an unusual way in finding the
35036 directories to search for header files.  For each of the standard
35037 directories whose name normally begins with @samp{/usr/local/lib/gcc}
35038 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
35039 replacing that beginning with the specified prefix to produce an
35040 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
35041 @file{foo/bar} just before it searches the standard directory 
35042 @file{/usr/local/lib/bar}.
35043 If a standard directory begins with the configured
35044 @var{prefix} then the value of @var{prefix} is replaced by
35045 @env{GCC_EXEC_PREFIX} when looking for header files.
35047 @item COMPILER_PATH
35048 @findex COMPILER_PATH
35049 The value of @env{COMPILER_PATH} is a colon-separated list of
35050 directories, much like @env{PATH}.  GCC tries the directories thus
35051 specified when searching for subprograms, if it cannot find the
35052 subprograms using @env{GCC_EXEC_PREFIX}.
35054 @item LIBRARY_PATH
35055 @findex LIBRARY_PATH
35056 The value of @env{LIBRARY_PATH} is a colon-separated list of
35057 directories, much like @env{PATH}.  When configured as a native compiler,
35058 GCC tries the directories thus specified when searching for special
35059 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
35060 using GCC also uses these directories when searching for ordinary
35061 libraries for the @option{-l} option (but directories specified with
35062 @option{-L} come first).
35064 @item LANG
35065 @findex LANG
35066 @cindex locale definition
35067 This variable is used to pass locale information to the compiler.  One way in
35068 which this information is used is to determine the character set to be used
35069 when character literals, string literals and comments are parsed in C and C++.
35070 When the compiler is configured to allow multibyte characters,
35071 the following values for @env{LANG} are recognized:
35073 @table @samp
35074 @item C-JIS
35075 Recognize JIS characters.
35076 @item C-SJIS
35077 Recognize SJIS characters.
35078 @item C-EUCJP
35079 Recognize EUCJP characters.
35080 @end table
35082 If @env{LANG} is not defined, or if it has some other value, then the
35083 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
35084 recognize and translate multibyte characters.
35086 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
35087 @findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
35088 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
35089 then additional text will be emitted to stderr when fix-it hints are
35090 emitted.  @option{-fdiagnostics-parseable-fixits} and
35091 @option{-fno-diagnostics-parseable-fixits} take precedence over this
35092 environment variable.
35094 @table @samp
35095 @item fixits-v1
35096 Emit parseable fix-it hints, equivalent to
35097 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
35098 expressed as a count of bytes, starting at byte 1 for the initial column.
35100 @item fixits-v2
35101 As @code{fixits-v1}, but columns are expressed as display columns,
35102 as per @option{-fdiagnostics-column-unit=display}.
35103 @end table
35105 @end table
35107 @noindent
35108 Some additional environment variables affect the behavior of the
35109 preprocessor.
35111 @include cppenv.texi
35113 @c man end
35115 @node Precompiled Headers
35116 @section Using Precompiled Headers
35117 @cindex precompiled headers
35118 @cindex speed of compilation
35120 Often large projects have many header files that are included in every
35121 source file.  The time the compiler takes to process these header files
35122 over and over again can account for nearly all of the time required to
35123 build the project.  To make builds faster, GCC allows you to
35124 @dfn{precompile} a header file.
35126 To create a precompiled header file, simply compile it as you would any
35127 other file, if necessary using the @option{-x} option to make the driver
35128 treat it as a C or C++ header file.  You may want to use a
35129 tool like @command{make} to keep the precompiled header up-to-date when
35130 the headers it contains change.
35132 A precompiled header file is searched for when @code{#include} is
35133 seen in the compilation.  As it searches for the included file
35134 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
35135 compiler looks for a precompiled header in each directory just before it
35136 looks for the include file in that directory.  The name searched for is
35137 the name specified in the @code{#include} with @samp{.gch} appended.  If
35138 the precompiled header file cannot be used, it is ignored.
35140 For instance, if you have @code{#include "all.h"}, and you have
35141 @file{all.h.gch} in the same directory as @file{all.h}, then the
35142 precompiled header file is used if possible, and the original
35143 header is used otherwise.
35145 Alternatively, you might decide to put the precompiled header file in a
35146 directory and use @option{-I} to ensure that directory is searched
35147 before (or instead of) the directory containing the original header.
35148 Then, if you want to check that the precompiled header file is always
35149 used, you can put a file of the same name as the original header in this
35150 directory containing an @code{#error} command.
35152 This also works with @option{-include}.  So yet another way to use
35153 precompiled headers, good for projects not designed with precompiled
35154 header files in mind, is to simply take most of the header files used by
35155 a project, include them from another header file, precompile that header
35156 file, and @option{-include} the precompiled header.  If the header files
35157 have guards against multiple inclusion, they are skipped because
35158 they've already been included (in the precompiled header).
35160 If you need to precompile the same header file for different
35161 languages, targets, or compiler options, you can instead make a
35162 @emph{directory} named like @file{all.h.gch}, and put each precompiled
35163 header in the directory, perhaps using @option{-o}.  It doesn't matter
35164 what you call the files in the directory; every precompiled header in
35165 the directory is considered.  The first precompiled header
35166 encountered in the directory that is valid for this compilation is
35167 used; they're searched in no particular order.
35169 There are many other possibilities, limited only by your imagination,
35170 good sense, and the constraints of your build system.
35172 A precompiled header file can be used only when these conditions apply:
35174 @itemize
35175 @item
35176 Only one precompiled header can be used in a particular compilation.
35178 @item
35179 A precompiled header cannot be used once the first C token is seen.  You
35180 can have preprocessor directives before a precompiled header; you cannot
35181 include a precompiled header from inside another header.
35183 @item
35184 The precompiled header file must be produced for the same language as
35185 the current compilation.  You cannot use a C precompiled header for a C++
35186 compilation.
35188 @item
35189 The precompiled header file must have been produced by the same compiler
35190 binary as the current compilation is using.
35192 @item
35193 Any macros defined before the precompiled header is included must
35194 either be defined in the same way as when the precompiled header was
35195 generated, or must not affect the precompiled header, which usually
35196 means that they don't appear in the precompiled header at all.
35198 The @option{-D} option is one way to define a macro before a
35199 precompiled header is included; using a @code{#define} can also do it.
35200 There are also some options that define macros implicitly, like
35201 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
35202 defined this way.
35204 @item If debugging information is output when using the precompiled
35205 header, using @option{-g} or similar, the same kind of debugging information
35206 must have been output when building the precompiled header.  However,
35207 a precompiled header built using @option{-g} can be used in a compilation
35208 when no debugging information is being output.
35210 @item The same @option{-m} options must generally be used when building
35211 and using the precompiled header.  @xref{Submodel Options},
35212 for any cases where this rule is relaxed.
35214 @item Each of the following options must be the same when building and using
35215 the precompiled header:
35217 @gccoptlist{-fexceptions}
35219 @item
35220 Some other command-line options starting with @option{-f},
35221 @option{-p}, or @option{-O} must be defined in the same way as when
35222 the precompiled header was generated.  At present, it's not clear
35223 which options are safe to change and which are not; the safest choice
35224 is to use exactly the same options when generating and using the
35225 precompiled header.  The following are known to be safe:
35227 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
35228 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
35229 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
35230 -pedantic-errors}
35232 @item Address space layout randomization (ASLR) can lead to not binary identical
35233 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
35234 PCH files.
35236 @end itemize
35238 For all of these except the last, the compiler automatically
35239 ignores the precompiled header if the conditions aren't met.  If you
35240 find an option combination that doesn't work and doesn't cause the
35241 precompiled header to be ignored, please consider filing a bug report,
35242 see @ref{Bugs}.
35244 If you do use differing options when generating and using the
35245 precompiled header, the actual behavior is a mixture of the
35246 behavior for the options.  For instance, if you use @option{-g} to
35247 generate the precompiled header but not when using it, you may or may
35248 not get debugging information for routines in the precompiled header.
35250 @node C++ Modules
35251 @section C++ Modules
35252 @cindex speed of compilation
35254 Modules are a C++20 language feature.  As the name suggests, they
35255 provides a modular compilation system, intending to provide both
35256 faster builds and better library isolation.  The ``Merging Modules''
35257 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
35258 of changes to the standard, although it does not capture later
35259 changes.
35261 @emph{G++'s modules support is not complete.}  Other than bugs, the
35262 known missing pieces are:
35264 @table @emph
35266 @item Private Module Fragment
35267 The Private Module Fragment is recognized, but an error is emitted.
35269 @item Partition definition visibility rules
35270 Entities may be defined in implementation partitions, and those
35271 definitions are not available outside of the module.  This is not
35272 implemented, and the definitions are available to extra-module use.
35274 @item Textual merging of reachable GM entities
35275 Entities may be multiply defined across different header-units.
35276 These must be de-duplicated, and this is implemented across imports,
35277 or when an import redefines a textually-defined entity.  However the
35278 reverse is not implemented---textually redefining an entity that has
35279 been defined in an imported header-unit.  A redefinition error is
35280 emitted.
35282 @item Translation-Unit local referencing rules
35283 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
35284 (@uref{https://wg21.link/p2003}) add limitations on which entities an
35285 exported region may reference (for instance, the entities an exported
35286 template definition may reference).  These are not fully implemented.
35288 @item Standard Library Header Units
35289 The Standard Library is not provided as importable header units.  If
35290 you want to import such units, you must explicitly build them first.
35291 If you do not do this with care, you may have multiple declarations,
35292 which the module machinery must merge---compiler resource usage can be
35293 affected by how you partition header files into header units.
35295 @end table
35297 Modular compilation is @emph{not} enabled with just the
35298 @option{-std=c++20} option.  You must explicitly enable it with the
35299 @option{-fmodules-ts} option.  It is independent of the language
35300 version selected, although in pre-C++20 versions, it is of course an
35301 extension.
35303 No new source file suffixes are required or supported.  If you wish to
35304 use a non-standard suffix (@pxref{Overall Options}), you also need
35305 to provide a @option{-x c++} option too.@footnote{Some users like to
35306 distinguish module interface files with a new suffix, such as naming
35307 the source @code{module.cppm}, which involves
35308 teaching all tools about the new suffix.  A different scheme, such as
35309 naming @code{module-m.cpp} would be less invasive.}
35311 Compiling a module interface unit produces an additional output (to
35312 the assembly or object file), called a Compiled Module Interface
35313 (CMI).  This encodes the exported declarations of the module.
35314 Importing a module reads in the CMI.  The import graph is a Directed
35315 Acyclic Graph (DAG).  You must build imports before the importer.
35317 Header files may themselves be compiled to header units, which are a
35318 transitional ability aiming at faster compilation.  The
35319 @option{-fmodule-header} option is used to enable this, and implies
35320 the @option{-fmodules-ts} option.  These CMIs are named by the fully
35321 resolved underlying header file, and thus may be a complete pathname
35322 containing subdirectories.  If the header file is found at an absolute
35323 pathname, the CMI location is still relative to a CMI root directory.
35325 As header files often have no suffix, you commonly have to specify a
35326 @option{-x} option to tell the compiler the source is a header file.
35327 You may use @option{-x c++-header}, @option{-x c++-user-header} or
35328 @option{-x c++-system-header}.  When used in conjunction with
35329 @option{-fmodules-ts}, these all imply an appropriate
35330 @option{-fmodule-header} option.  The latter two variants use the
35331 user or system include path to search for the file specified.  This
35332 allows you to, for instance, compile standard library header files as
35333 header units, without needing to know exactly where they are
35334 installed.  Specifying the language as one of these variants also
35335 inhibits output of the object file, as header files have no associated
35336 object file.
35338 The @option{-fmodule-only} option disables generation of the
35339 associated object file for compiling a module interface.  Only the CMI
35340 is generated.  This option is implied when using the
35341 @option{-fmodule-header} option.
35343 The @option{-flang-info-include-translate} and
35344 @option{-flang-info-include-translate-not} options notes whether
35345 include translation occurs or not.  With no argument, the first will
35346 note all include translation.  The second will note all
35347 non-translations of include files not known to intentionally be
35348 textual.  With an argument, queries about include translation of a
35349 header files with that particular trailing pathname are noted.  You
35350 may repeat this form to cover several different header files.  This
35351 option may be helpful in determining whether include translation is
35352 happening---if it is working correctly, it behaves as if it isn't
35353 there at all.
35355 The @option{-flang-info-module-cmi} option can be used to determine
35356 where the compiler is reading a CMI from.  Without the option, the
35357 compiler is silent when such a read is successful.  This option has an
35358 optional argument, which will restrict the notification to just the
35359 set of named modules or header units specified.
35361 The @option{-Winvalid-imported-macros} option causes all imported macros
35362 to be resolved at the end of compilation.  Without this, imported
35363 macros are only resolved when expanded or (re)defined.  This option
35364 detects conflicting import definitions for all macros.
35366 For details of the @option{-fmodule-mapper} family of options,
35367 @pxref{C++ Module Mapper}.
35369 @menu
35370 * C++ Module Mapper::       Module Mapper
35371 * C++ Module Preprocessing::  Module Preprocessing
35372 * C++ Compiled Module Interface:: Compiled Module Interface
35373 @end menu
35375 @node C++ Module Mapper
35376 @subsection Module Mapper
35377 @cindex C++ Module Mapper
35379 A module mapper provides a server or file that the compiler queries to
35380 determine the mapping between module names and CMI files.  It is also
35381 used to build CMIs on demand.  @emph{Mapper functionality is in its
35382 infancy and is intended for experimentation with build system
35383 interactions.}
35385 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
35386 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
35387 have one of the following forms:
35389 @table @gcctabopt
35391 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
35392 An optional hostname and a numeric port number to connect to.  If the
35393 hostname is omitted, the loopback address is used.  If the hostname
35394 corresponds to multiple IPV6 addresses, these are tried in turn, until
35395 one is successful.  If your host lacks IPv6, this form is
35396 non-functional.  If you must use IPv4 use
35397 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
35399 @item =@var{socket}@r{[}?@var{ident}@r{]}
35400 A local domain socket.  If your host lacks local domain sockets, this
35401 form is non-functional.
35403 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
35404 A program to spawn, and communicate with on its stdin/stdout streams.
35405 Your @var{PATH} environment variable is searched for the program.
35406 Arguments are separated by space characters, (it is not possible for
35407 one of the arguments delivered to the program to contain a space).  An
35408 exception is if @var{program} begins with @@.  In that case
35409 @var{program} (sans @@) is looked for in the compiler's internal
35410 binary directory.  Thus the sample mapper-server can be specified
35411 with @code{@@g++-mapper-server}.
35413 @item <>@r{[}?@var{ident}@r{]}
35414 @item <>@var{inout}@r{[}?@var{ident}@r{]}
35415 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
35416 Named pipes or file descriptors to communicate over.  The first form,
35417 @option{<>}, communicates over stdin and stdout.  The other forms
35418 allow you to specify a file descriptor or name a pipe.  A numeric value
35419 is interpreted as a file descriptor, otherwise named pipe is opened.
35420 The second form specifies a bidirectional pipe and the last form
35421 allows specifying two independent pipes.  Using file descriptors
35422 directly in this manner is fragile in general, as it can require the
35423 cooperation of intermediate processes.  In particular using stdin &
35424 stdout is fraught with danger as other compiler options might also
35425 cause the compiler to read stdin or write stdout, and it can have
35426 unfortunate interactions with signal delivery from the terminal.
35428 @item @var{file}@r{[}?@var{ident}@r{]}
35429 A mapping file consisting of space-separated module-name, filename
35430 pairs, one per line.  Only the mappings for the direct imports and any
35431 module export name need be provided.  If other mappings are provided,
35432 they override those stored in any imported CMI files.  A repository
35433 root may be specified in the mapping file by using @samp{$root} as the
35434 module name in the first active line.  Use of this option will disable
35435 any default module->CMI name mapping.
35437 @end table
35439 As shown, an optional @var{ident} may suffix the first word of the
35440 option, indicated by a @samp{?} prefix.  The value is used in the
35441 initial handshake with the module server, or to specify a prefix on
35442 mapping file lines.  In the server case, the main source file name is
35443 used if no @var{ident} is specified.  In the file case, all non-blank
35444 lines are significant, unless a value is specified, in which case only
35445 lines beginning with @var{ident} are significant.  The @var{ident}
35446 must be separated by whitespace from the module name.  Be aware that
35447 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
35448 significant to the shell, and therefore may need quoting.
35450 The mapper is connected to or loaded lazily, when the first module
35451 mapping is required.  The networking protocols are only supported on
35452 hosts that provide networking.  If no mapper is specified a default is
35453 provided.
35455 A project-specific mapper is expected to be provided by the build
35456 system that invokes the compiler.  It is not expected that a
35457 general-purpose server is provided for all compilations.  As such, the
35458 server will know the build configuration, the compiler it invoked, and
35459 the environment (such as working directory) in which that is
35460 operating.  As it may parallelize builds, several compilations may
35461 connect to the same socket.
35463 The default mapper generates CMI files in a @samp{gcm.cache}
35464 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
35465 is used directly to provide the basename.  Header units construct a
35466 relative path using the underlying header file name.  If the path is
35467 already relative, a @samp{,} directory is prepended.  Internal
35468 @samp{..} components are translated to @samp{,,}.  No attempt is made
35469 to canonicalize these filenames beyond that done by the preprocessor's
35470 include search algorithm, as in general it is ambiguous when symbolic
35471 links are present.
35473 The mapper protocol was published as ``A Module Mapper''
35474 @uref{https://wg21.link/p1184}.  The implementation is provided by
35475 @command{libcody}, @uref{https://github.com/urnathan/libcody},
35476 which specifies the canonical protocol definition.  A proof of concept
35477 server implementation embedded in @command{make} was described in
35478 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
35480 @node C++ Module Preprocessing
35481 @subsection Module Preprocessing
35482 @cindex C++ Module Preprocessing
35484 Modules affect preprocessing because of header units and include
35485 translation.  Some uses of the preprocessor as a separate step either
35486 do not produce a correct output, or require CMIs to be available.
35488 Header units import macros.  These macros can affect later conditional
35489 inclusion, which therefore can cascade to differing import sets.  When
35490 preprocessing, it is necessary to load the CMI.  If a header unit is
35491 unavailable, the preprocessor issues a warning and continue (when
35492 not just preprocessing, an error is emitted).  Detecting such imports
35493 requires preprocessor tokenization of the input stream to phase 4
35494 (macro expansion).
35496 Include translation converts @code{#include}, @code{#include_next} and
35497 @code{#import} directives to internal @code{import} declarations.
35498 Whether a particular directive is translated is controlled by the
35499 module mapper.  Header unit names are canonicalized during
35500 preprocessing.
35502 Dependency information can be emitted for macro import, extending the
35503 functionality of @option{-MD} and @option{-MMD} options.  Detection of
35504 import declarations also requires phase 4 preprocessing, and thus
35505 requires full preprocessing (or compilation).
35507 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
35508 preprocessing before phase 4.
35510 The @option{-save-temps} option uses @option{-fdirectives-only} for
35511 preprocessing, and preserve the macro definitions in the preprocessed
35512 output.  Usually you also want to use this option when explicitly
35513 preprocessing a header-unit, or consuming such preprocessed output:
35515 @smallexample
35516 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
35517 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
35518 @end smallexample
35520 @node C++ Compiled Module Interface
35521 @subsection Compiled Module Interface
35522 @cindex C++ Compiled Module Interface
35524 CMIs are an additional artifact when compiling named module
35525 interfaces, partitions or header units.  These are read when
35526 importing.  CMI contents are implementation-specific, and in GCC's
35527 case tied to the compiler version.  Consider them a rebuildable cache
35528 artifact, not a distributable object.
35530 When creating an output CMI, any missing directory components are
35531 created in a manner that is safe for concurrent builds creating
35532 multiple, different, CMIs within a common subdirectory tree.
35534 CMI contents are written to a temporary file, which is then atomically
35535 renamed.  Observers either see old contents (if there is an
35536 existing file), or complete new contents.  They do not observe the
35537 CMI during its creation.  This is unlike object file writing, which
35538 may be observed by an external process.
35540 CMIs are read in lazily, if the host OS provides @code{mmap}
35541 functionality.  Generally blocks are read when name lookup or template
35542 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
35543 option may be used.
35545 The @option{--param lazy-modules=@var{n}} parameter controls the limit
35546 on the number of concurrently open module files during lazy loading.
35547 Should more modules be imported, an LRU algorithm is used to determine
35548 which files to close---until that file is needed again.  This limit
35549 may be exceeded with deep module dependency hierarchies.  With large
35550 code bases there may be more imports than the process limit of file
35551 descriptors.  By default, the limit is a few less than the per-process
35552 file descriptor hard limit, if that is determinable.@footnote{Where
35553 applicable the soft limit is incremented as needed towards the hard limit.}
35555 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
35556 You may use @command{readelf} to inspect them, although section
35557 contents are largely undecipherable.  There is a section named
35558 @code{.gnu.c++.README}, which contains human-readable text.  Other
35559 than the first line, each line consists of @code{@var{tag}: @code{value}}
35560 tuples.
35562 @smallexample
35563 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
35565 String dump of section '.gnu.c++.README':
35566   [     0]  GNU C++ primary module interface
35567   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
35568   [    6f]  version: 2020/11/16-04:54
35569   [    89]  module: foo
35570   [    95]  source: c_b.ii
35571   [    a4]  dialect: C++20/coroutines
35572   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
35573   [    ee]  repository: gcm.cache
35574   [   104]  buildtime: 2020/11/16 15:03:21 UTC
35575   [   127]  localtime: 2020/11/16 07:03:21 PST
35576   [   14a]  export: foo:part1 foo-part1.gcm
35577 @end smallexample
35579 Amongst other things, this lists the source that was built, C++
35580 dialect used and imports of the module.@footnote{The precise contents
35581 of this output may change.} The timestamp is the same value as that
35582 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
35583 explicitly specified with the environment variable
35584 @code{SOURCE_DATE_EPOCH}.  For further details
35585 @pxref{Environment Variables}.
35587 A set of related CMIs may be copied, provided the relative pathnames
35588 are preserved.
35590 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
35591 it may be removed or altered.  The section numbering of the sections
35592 whose names do not begin with @code{.gnu.c++.}, or are not the string
35593 section is significant and must not be altered.