]> gcc.gnu.org Git - gcc.git/blob - gcc/doc/invoke.texi
x86: Add a new option -mdaz-ftz to enable FTZ and DAZ flags in MXCSR.
[gcc.git] / gcc / doc / invoke.texi
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.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2022 Free Software Foundation, Inc.
12
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.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
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{}
42
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
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
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}.
76
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.
81
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.
88
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.
101
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}}.
108
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.
116
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.
123
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.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
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
177
178 @c man begin OPTIONS
179
180 @node Option Summary
181 @section Option Summary
182
183 Here is a summary of all the options, grouped by type. Explanations are
184 in the following sections.
185
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}}
197
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}}
212
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}
275
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}
298
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{]}}
320
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}
421
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
493 }
494
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}
501
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}
524
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}
618
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}
645
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}}
665
666 @item Assembler Options
667 @xref{Assembler Options,,Passing Options to the Assembler}.
668 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
669
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}}
681
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}}
692
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}
711
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{]}}
755
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.
761
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 }
782
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}}
790
791 @emph{AMD GCN Options}
792 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
793
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}
813
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}
854
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}
865
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}
876
877 @emph{C6X Options}
878 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
879 -msim -msdata=@var{sdata-type}}
880
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}
889
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}
900
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}
927
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}}
939
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}}
944
945 @emph{FR30 Options}
946 @gccoptlist{-msmall-model -mno-lsim}
947
948 @emph{FT32 Options}
949 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
950
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}}
968
969 @emph{GNU/Linux Options}
970 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
971 -tno-android-cc -tno-android-ld}
972
973 @emph{H8/300 Options}
974 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
975
976 @emph{HPPA Options}
977 @gccoptlist{-march=@var{architecture-type} @gol
978 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
979 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
980 -mfixed-range=@var{register-range} @gol
981 -mjump-in-delay -mlinker-opt -mlong-calls @gol
982 -mlong-load-store -mno-disable-fpregs @gol
983 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
984 -mno-jump-in-delay -mno-long-load-store @gol
985 -mno-portable-runtime -mno-soft-float @gol
986 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
987 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
988 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
989 -munix=@var{unix-std} -nolibdld -static -threads}
990
991 @emph{IA-64 Options}
992 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
993 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
994 -mconstant-gp -mauto-pic -mfused-madd @gol
995 -minline-float-divide-min-latency @gol
996 -minline-float-divide-max-throughput @gol
997 -mno-inline-float-divide @gol
998 -minline-int-divide-min-latency @gol
999 -minline-int-divide-max-throughput @gol
1000 -mno-inline-int-divide @gol
1001 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
1002 -mno-inline-sqrt @gol
1003 -mdwarf2-asm -mearly-stop-bits @gol
1004 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
1005 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
1006 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
1007 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
1008 -msched-spec-ldc -msched-spec-control-ldc @gol
1009 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
1010 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
1011 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
1012 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
1013
1014 @emph{LM32 Options}
1015 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
1016 -msign-extend-enabled -muser-enabled}
1017
1018 @emph{LoongArch Options}
1019 @gccoptlist{-march=@var{cpu-type} -mtune=@var{cpu-type} -mabi=@var{base-abi-type} @gol
1020 -mfpu=@var{fpu-type} -msoft-float -msingle-float -mdouble-float @gol
1021 -mbranch-cost=@var{n} -mcheck-zero-division -mno-check-zero-division @gol
1022 -mcond-move-int -mno-cond-move-int @gol
1023 -mcond-move-float -mno-cond-move-float @gol
1024 -memcpy -mno-memcpy -mstrict-align -mno-strict-align @gol
1025 -mmax-inline-memcpy-size=@var{n} @gol
1026 -mexplicit-relocs -mno-explicit-relocs @gol
1027 -mdirect-extern-access -mno-direct-extern-access @gol
1028 -mcmodel=@var{code-model}}
1029
1030 @emph{M32R/D Options}
1031 @gccoptlist{-m32r2 -m32rx -m32r @gol
1032 -mdebug @gol
1033 -malign-loops -mno-align-loops @gol
1034 -missue-rate=@var{number} @gol
1035 -mbranch-cost=@var{number} @gol
1036 -mmodel=@var{code-size-model-type} @gol
1037 -msdata=@var{sdata-type} @gol
1038 -mno-flush-func -mflush-func=@var{name} @gol
1039 -mno-flush-trap -mflush-trap=@var{number} @gol
1040 -G @var{num}}
1041
1042 @emph{M32C Options}
1043 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
1044
1045 @emph{M680x0 Options}
1046 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
1047 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
1048 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
1049 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
1050 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
1051 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
1052 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
1053 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
1054 -mxgot -mno-xgot -mlong-jump-table-offsets}
1055
1056 @emph{MCore Options}
1057 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
1058 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
1059 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
1060 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
1061 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
1062
1063 @emph{MicroBlaze Options}
1064 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
1065 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
1066 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
1067 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
1068 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
1069 -mpic-data-is-text-relative}
1070
1071 @emph{MIPS Options}
1072 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
1073 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
1074 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
1075 -mips16 -mno-mips16 -mflip-mips16 @gol
1076 -minterlink-compressed -mno-interlink-compressed @gol
1077 -minterlink-mips16 -mno-interlink-mips16 @gol
1078 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
1079 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
1080 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
1081 -mno-float -msingle-float -mdouble-float @gol
1082 -modd-spreg -mno-odd-spreg @gol
1083 -mabs=@var{mode} -mnan=@var{encoding} @gol
1084 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1085 -mmcu -mmno-mcu @gol
1086 -meva -mno-eva @gol
1087 -mvirt -mno-virt @gol
1088 -mxpa -mno-xpa @gol
1089 -mcrc -mno-crc @gol
1090 -mginv -mno-ginv @gol
1091 -mmicromips -mno-micromips @gol
1092 -mmsa -mno-msa @gol
1093 -mloongson-mmi -mno-loongson-mmi @gol
1094 -mloongson-ext -mno-loongson-ext @gol
1095 -mloongson-ext2 -mno-loongson-ext2 @gol
1096 -mfpu=@var{fpu-type} @gol
1097 -msmartmips -mno-smartmips @gol
1098 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1099 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1100 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1101 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1102 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1103 -membedded-data -mno-embedded-data @gol
1104 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1105 -mcode-readable=@var{setting} @gol
1106 -msplit-addresses -mno-split-addresses @gol
1107 -mexplicit-relocs -mno-explicit-relocs @gol
1108 -mcheck-zero-division -mno-check-zero-division @gol
1109 -mdivide-traps -mdivide-breaks @gol
1110 -mload-store-pairs -mno-load-store-pairs @gol
1111 -munaligned-access -mno-unaligned-access @gol
1112 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1113 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1114 -mfix-24k -mno-fix-24k @gol
1115 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1116 -mfix-r5900 -mno-fix-r5900 @gol
1117 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1118 -mfix-vr4120 -mno-fix-vr4120 @gol
1119 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1120 -mflush-func=@var{func} -mno-flush-func @gol
1121 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1122 -mcompact-branches=@var{policy} @gol
1123 -mfp-exceptions -mno-fp-exceptions @gol
1124 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1125 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1126 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1127 -mframe-header-opt -mno-frame-header-opt}
1128
1129 @emph{MMIX Options}
1130 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1131 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1132 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1133 -mno-base-addresses -msingle-exit -mno-single-exit}
1134
1135 @emph{MN10300 Options}
1136 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1137 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1138 -mtune=@var{cpu-type} @gol
1139 -mreturn-pointer-on-d0 @gol
1140 -mno-crt0 -mrelax -mliw -msetlb}
1141
1142 @emph{Moxie Options}
1143 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1144
1145 @emph{MSP430 Options}
1146 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1147 -mwarn-mcu @gol
1148 -mcode-region= -mdata-region= @gol
1149 -msilicon-errata= -msilicon-errata-warn= @gol
1150 -mhwmult= -minrt -mtiny-printf -mmax-inline-shift=}
1151
1152 @emph{NDS32 Options}
1153 @gccoptlist{-mbig-endian -mlittle-endian @gol
1154 -mreduced-regs -mfull-regs @gol
1155 -mcmov -mno-cmov @gol
1156 -mext-perf -mno-ext-perf @gol
1157 -mext-perf2 -mno-ext-perf2 @gol
1158 -mext-string -mno-ext-string @gol
1159 -mv3push -mno-v3push @gol
1160 -m16bit -mno-16bit @gol
1161 -misr-vector-size=@var{num} @gol
1162 -mcache-block-size=@var{num} @gol
1163 -march=@var{arch} @gol
1164 -mcmodel=@var{code-model} @gol
1165 -mctor-dtor -mrelax}
1166
1167 @emph{Nios II Options}
1168 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1169 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1170 -mel -meb @gol
1171 -mno-bypass-cache -mbypass-cache @gol
1172 -mno-cache-volatile -mcache-volatile @gol
1173 -mno-fast-sw-div -mfast-sw-div @gol
1174 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1175 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1176 -mcustom-fpu-cfg=@var{name} @gol
1177 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1178 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1179
1180 @emph{Nvidia PTX Options}
1181 @gccoptlist{-m64 -mmainkernel -moptimize}
1182
1183 @emph{OpenRISC Options}
1184 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1185 -msoft-mul -msoft-div @gol
1186 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1187 -mcmov -mror -mrori -msext -msfimm -mshftimm @gol
1188 -mcmodel=@var{code-model}}
1189
1190 @emph{PDP-11 Options}
1191 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1192 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1193 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1194
1195 @emph{PowerPC Options}
1196 See RS/6000 and PowerPC Options.
1197
1198 @emph{PRU Options}
1199 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1200 -mabi=@var{variant}}
1201
1202 @emph{RISC-V Options}
1203 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1204 -mplt -mno-plt @gol
1205 -mabi=@var{ABI-string} @gol
1206 -mfdiv -mno-fdiv @gol
1207 -mdiv -mno-div @gol
1208 -misa-spec=@var{ISA-spec-string} @gol
1209 -march=@var{ISA-string} @gol
1210 -mtune=@var{processor-string} @gol
1211 -mpreferred-stack-boundary=@var{num} @gol
1212 -msmall-data-limit=@var{N-bytes} @gol
1213 -msave-restore -mno-save-restore @gol
1214 -mshorten-memrefs -mno-shorten-memrefs @gol
1215 -mstrict-align -mno-strict-align @gol
1216 -mcmodel=medlow -mcmodel=medany @gol
1217 -mexplicit-relocs -mno-explicit-relocs @gol
1218 -mrelax -mno-relax @gol
1219 -mriscv-attribute -mno-riscv-attribute @gol
1220 -malign-data=@var{type} @gol
1221 -mbig-endian -mlittle-endian @gol
1222 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1223 -mstack-protector-guard-offset=@var{offset} @gol
1224 -mcsr-check -mno-csr-check}
1225
1226 @emph{RL78 Options}
1227 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1228 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1229 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1230
1231 @emph{RS/6000 and PowerPC Options}
1232 @gccoptlist{-mcpu=@var{cpu-type} @gol
1233 -mtune=@var{cpu-type} @gol
1234 -mcmodel=@var{code-model} @gol
1235 -mpowerpc64 @gol
1236 -maltivec -mno-altivec @gol
1237 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1238 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1239 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1240 -mfprnd -mno-fprnd @gol
1241 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1242 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1243 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1244 -malign-power -malign-natural @gol
1245 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1246 -mupdate -mno-update @gol
1247 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1248 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1249 -mstrict-align -mno-strict-align -mrelocatable @gol
1250 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1251 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1252 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1253 -mprioritize-restricted-insns=@var{priority} @gol
1254 -msched-costly-dep=@var{dependence_type} @gol
1255 -minsert-sched-nops=@var{scheme} @gol
1256 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1257 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1258 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1259 -mtraceback=@var{traceback_type} @gol
1260 -maix-struct-return -msvr4-struct-return @gol
1261 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1262 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1263 -mblock-move-inline-limit=@var{num} @gol
1264 -mblock-compare-inline-limit=@var{num} @gol
1265 -mblock-compare-inline-loop-limit=@var{num} @gol
1266 -mno-block-ops-unaligned-vsx @gol
1267 -mstring-compare-inline-limit=@var{num} @gol
1268 -misel -mno-isel @gol
1269 -mvrsave -mno-vrsave @gol
1270 -mmulhw -mno-mulhw @gol
1271 -mdlmzb -mno-dlmzb @gol
1272 -mprototype -mno-prototype @gol
1273 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1274 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1275 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1276 -mno-recip-precision @gol
1277 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1278 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1279 -msave-toc-indirect -mno-save-toc-indirect @gol
1280 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1281 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1282 -mquad-memory -mno-quad-memory @gol
1283 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1284 -mcompat-align-parm -mno-compat-align-parm @gol
1285 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1286 -mgnu-attribute -mno-gnu-attribute @gol
1287 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1288 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1289 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol
1290 -mprivileged -mno-privileged}
1291
1292 @emph{RX Options}
1293 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1294 -mcpu=@gol
1295 -mbig-endian-data -mlittle-endian-data @gol
1296 -msmall-data @gol
1297 -msim -mno-sim@gol
1298 -mas100-syntax -mno-as100-syntax@gol
1299 -mrelax@gol
1300 -mmax-constant-size=@gol
1301 -mint-register=@gol
1302 -mpid@gol
1303 -mallow-string-insns -mno-allow-string-insns@gol
1304 -mjsr@gol
1305 -mno-warn-multiple-fast-interrupts@gol
1306 -msave-acc-in-interrupts}
1307
1308 @emph{S/390 and zSeries Options}
1309 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1310 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1311 -mlong-double-64 -mlong-double-128 @gol
1312 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1313 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1314 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1315 -mhtm -mvx -mzvector @gol
1316 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1317 -mfused-madd -mno-fused-madd @gol
1318 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1319 -mhotpatch=@var{halfwords},@var{halfwords}}
1320
1321 @emph{SH Options}
1322 @gccoptlist{-m1 -m2 -m2e @gol
1323 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1324 -m3 -m3e @gol
1325 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1326 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1327 -mb -ml -mdalign -mrelax @gol
1328 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1329 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1330 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1331 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1332 -maccumulate-outgoing-args @gol
1333 -matomic-model=@var{atomic-model} @gol
1334 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1335 -mcbranch-force-delay-slot @gol
1336 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1337 -mpretend-cmove -mtas}
1338
1339 @emph{Solaris 2 Options}
1340 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1341 -pthreads}
1342
1343 @emph{SPARC Options}
1344 @gccoptlist{-mcpu=@var{cpu-type} @gol
1345 -mtune=@var{cpu-type} @gol
1346 -mcmodel=@var{code-model} @gol
1347 -mmemory-model=@var{mem-model} @gol
1348 -m32 -m64 -mapp-regs -mno-app-regs @gol
1349 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1350 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1351 -mhard-quad-float -msoft-quad-float @gol
1352 -mstack-bias -mno-stack-bias @gol
1353 -mstd-struct-return -mno-std-struct-return @gol
1354 -munaligned-doubles -mno-unaligned-doubles @gol
1355 -muser-mode -mno-user-mode @gol
1356 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1357 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1358 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1359 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1360 -mpopc -mno-popc -msubxc -mno-subxc @gol
1361 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1362 -mlra -mno-lra}
1363
1364 @emph{System V Options}
1365 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1366
1367 @emph{V850 Options}
1368 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1369 -mprolog-function -mno-prolog-function -mspace @gol
1370 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1371 -mapp-regs -mno-app-regs @gol
1372 -mdisable-callt -mno-disable-callt @gol
1373 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1374 -mv850e -mv850 -mv850e3v5 @gol
1375 -mloop @gol
1376 -mrelax @gol
1377 -mlong-jumps @gol
1378 -msoft-float @gol
1379 -mhard-float @gol
1380 -mgcc-abi @gol
1381 -mrh850-abi @gol
1382 -mbig-switch}
1383
1384 @emph{VAX Options}
1385 @gccoptlist{-mg -mgnu -munix -mlra}
1386
1387 @emph{Visium Options}
1388 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1389 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1390
1391 @emph{VMS Options}
1392 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1393 -mpointer-size=@var{size}}
1394
1395 @emph{VxWorks Options}
1396 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1397 -Xbind-lazy -Xbind-now}
1398
1399 @emph{x86 Options}
1400 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1401 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1402 -mfpmath=@var{unit} @gol
1403 -masm=@var{dialect} -mno-fancy-math-387 @gol
1404 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1405 -mno-wide-multiply -mrtd -malign-double @gol
1406 -mpreferred-stack-boundary=@var{num} @gol
1407 -mincoming-stack-boundary=@var{num} @gol
1408 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mmwait @gol
1409 -mrecip -mrecip=@var{opt} @gol
1410 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1411 -mmove-max=@var{bits} -mstore-max=@var{bits} @gol
1412 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1413 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1414 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1415 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1416 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1417 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1418 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1419 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1420 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call @gol
1421 -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1422 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1423 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1424 -mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1425 -mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni@gol
1426 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16 @gol
1427 -mprefetchi -mraoint @gol
1428 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1429 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1430 -mkl -mwidekl @gol
1431 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1432 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1433 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1434 -mregparm=@var{num} -msseregparm @gol
1435 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1436 -mpc32 -mpc64 -mpc80 -mdaz-ftz -mstackrealign @gol
1437 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1438 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1439 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1440 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1441 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1442 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1443 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1444 -mstack-protector-guard-reg=@var{reg} @gol
1445 -mstack-protector-guard-offset=@var{offset} @gol
1446 -mstack-protector-guard-symbol=@var{symbol} @gol
1447 -mgeneral-regs-only -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop @gol
1448 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1449 -mindirect-branch-register -mharden-sls=@var{choice} @gol
1450 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access @gol
1451 -munroll-only-small-loops -mlam=@var{choice}}
1452
1453 @emph{x86 Windows Options}
1454 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1455 -mnop-fun-dllimport -mthread @gol
1456 -municode -mwin32 -mwindows -fno-set-stack-executable}
1457
1458 @emph{Xstormy16 Options}
1459 @gccoptlist{-msim}
1460
1461 @emph{Xtensa Options}
1462 @gccoptlist{-mconst16 -mno-const16 @gol
1463 -mfused-madd -mno-fused-madd @gol
1464 -mforce-no-pic @gol
1465 -mserialize-volatile -mno-serialize-volatile @gol
1466 -mtext-section-literals -mno-text-section-literals @gol
1467 -mauto-litpools -mno-auto-litpools @gol
1468 -mtarget-align -mno-target-align @gol
1469 -mlongcalls -mno-longcalls @gol
1470 -mabi=@var{abi-type} @gol
1471 -mextra-l32r-costs=@var{cycles}}
1472
1473 @emph{zSeries Options}
1474 See S/390 and zSeries Options.
1475 @end table
1476
1477
1478 @node Overall Options
1479 @section Options Controlling the Kind of Output
1480
1481 Compilation can involve up to four stages: preprocessing, compilation
1482 proper, assembly and linking, always in that order. GCC is capable of
1483 preprocessing and compiling several files either into several
1484 assembler input files, or into one assembler input file; then each
1485 assembler input file produces an object file, and linking combines all
1486 the object files (those newly compiled, and those specified as input)
1487 into an executable file.
1488
1489 @cindex file name suffix
1490 For any given input file, the file name suffix determines what kind of
1491 compilation is done:
1492
1493 @table @gcctabopt
1494 @item @var{file}.c
1495 C source code that must be preprocessed.
1496
1497 @item @var{file}.i
1498 C source code that should not be preprocessed.
1499
1500 @item @var{file}.ii
1501 C++ source code that should not be preprocessed.
1502
1503 @item @var{file}.m
1504 Objective-C source code. Note that you must link with the @file{libobjc}
1505 library to make an Objective-C program work.
1506
1507 @item @var{file}.mi
1508 Objective-C source code that should not be preprocessed.
1509
1510 @item @var{file}.mm
1511 @itemx @var{file}.M
1512 Objective-C++ source code. Note that you must link with the @file{libobjc}
1513 library to make an Objective-C++ program work. Note that @samp{.M} refers
1514 to a literal capital M@.
1515
1516 @item @var{file}.mii
1517 Objective-C++ source code that should not be preprocessed.
1518
1519 @item @var{file}.h
1520 C, C++, Objective-C or Objective-C++ header file to be turned into a
1521 precompiled header (default), or C, C++ header file to be turned into an
1522 Ada spec (via the @option{-fdump-ada-spec} switch).
1523
1524 @item @var{file}.cc
1525 @itemx @var{file}.cp
1526 @itemx @var{file}.cxx
1527 @itemx @var{file}.cpp
1528 @itemx @var{file}.CPP
1529 @itemx @var{file}.c++
1530 @itemx @var{file}.C
1531 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1532 the last two letters must both be literally @samp{x}. Likewise,
1533 @samp{.C} refers to a literal capital C@.
1534
1535 @item @var{file}.mm
1536 @itemx @var{file}.M
1537 Objective-C++ source code that must be preprocessed.
1538
1539 @item @var{file}.mii
1540 Objective-C++ source code that should not be preprocessed.
1541
1542 @item @var{file}.hh
1543 @itemx @var{file}.H
1544 @itemx @var{file}.hp
1545 @itemx @var{file}.hxx
1546 @itemx @var{file}.hpp
1547 @itemx @var{file}.HPP
1548 @itemx @var{file}.h++
1549 @itemx @var{file}.tcc
1550 C++ header file to be turned into a precompiled header or Ada spec.
1551
1552 @item @var{file}.f
1553 @itemx @var{file}.for
1554 @itemx @var{file}.ftn
1555 Fixed form Fortran source code that should not be preprocessed.
1556
1557 @item @var{file}.F
1558 @itemx @var{file}.FOR
1559 @itemx @var{file}.fpp
1560 @itemx @var{file}.FPP
1561 @itemx @var{file}.FTN
1562 Fixed form Fortran source code that must be preprocessed (with the traditional
1563 preprocessor).
1564
1565 @item @var{file}.f90
1566 @itemx @var{file}.f95
1567 @itemx @var{file}.f03
1568 @itemx @var{file}.f08
1569 Free form Fortran source code that should not be preprocessed.
1570
1571 @item @var{file}.F90
1572 @itemx @var{file}.F95
1573 @itemx @var{file}.F03
1574 @itemx @var{file}.F08
1575 Free form Fortran source code that must be preprocessed (with the
1576 traditional preprocessor).
1577
1578 @item @var{file}.go
1579 Go source code.
1580
1581 @item @var{file}.d
1582 D source code.
1583
1584 @item @var{file}.di
1585 D interface file.
1586
1587 @item @var{file}.dd
1588 D documentation code (Ddoc).
1589
1590 @item @var{file}.ads
1591 Ada source code file that contains a library unit declaration (a
1592 declaration of a package, subprogram, or generic, or a generic
1593 instantiation), or a library unit renaming declaration (a package,
1594 generic, or subprogram renaming declaration). Such files are also
1595 called @dfn{specs}.
1596
1597 @item @var{file}.adb
1598 Ada source code file containing a library unit body (a subprogram or
1599 package body). Such files are also called @dfn{bodies}.
1600
1601 @c GCC also knows about some suffixes for languages not yet included:
1602 @c Ratfor:
1603 @c @var{file}.r
1604
1605 @item @var{file}.s
1606 Assembler code.
1607
1608 @item @var{file}.S
1609 @itemx @var{file}.sx
1610 Assembler code that must be preprocessed.
1611
1612 @item @var{other}
1613 An object file to be fed straight into linking.
1614 Any file name with no recognized suffix is treated this way.
1615 @end table
1616
1617 @opindex x
1618 You can specify the input language explicitly with the @option{-x} option:
1619
1620 @table @gcctabopt
1621 @item -x @var{language}
1622 Specify explicitly the @var{language} for the following input files
1623 (rather than letting the compiler choose a default based on the file
1624 name suffix). This option applies to all following input files until
1625 the next @option{-x} option. Possible values for @var{language} are:
1626 @smallexample
1627 c c-header cpp-output
1628 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1629 objective-c objective-c-header objective-c-cpp-output
1630 objective-c++ objective-c++-header objective-c++-cpp-output
1631 assembler assembler-with-cpp
1632 ada
1633 d
1634 f77 f77-cpp-input f95 f95-cpp-input
1635 go
1636 @end smallexample
1637
1638 @item -x none
1639 Turn off any specification of a language, so that subsequent files are
1640 handled according to their file name suffixes (as they are if @option{-x}
1641 has not been used at all).
1642 @end table
1643
1644 If you only want some of the stages of compilation, you can use
1645 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1646 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1647 @command{gcc} is to stop. Note that some combinations (for example,
1648 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1649
1650 @table @gcctabopt
1651 @item -c
1652 @opindex c
1653 Compile or assemble the source files, but do not link. The linking
1654 stage simply is not done. The ultimate output is in the form of an
1655 object file for each source file.
1656
1657 By default, the object file name for a source file is made by replacing
1658 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1659
1660 Unrecognized input files, not requiring compilation or assembly, are
1661 ignored.
1662
1663 @item -S
1664 @opindex S
1665 Stop after the stage of compilation proper; do not assemble. The output
1666 is in the form of an assembler code file for each non-assembler input
1667 file specified.
1668
1669 By default, the assembler file name for a source file is made by
1670 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1671
1672 Input files that don't require compilation are ignored.
1673
1674 @item -E
1675 @opindex E
1676 Stop after the preprocessing stage; do not run the compiler proper. The
1677 output is in the form of preprocessed source code, which is sent to the
1678 standard output.
1679
1680 Input files that don't require preprocessing are ignored.
1681
1682 @cindex output file option
1683 @item -o @var{file}
1684 @opindex o
1685 Place the primary output in file @var{file}. This applies to whatever
1686 sort of output is being produced, whether it be an executable file, an
1687 object file, an assembler file or preprocessed C code.
1688
1689 If @option{-o} is not specified, the default is to put an executable
1690 file in @file{a.out}, the object file for
1691 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1692 assembler file in @file{@var{source}.s}, a precompiled header file in
1693 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1694 standard output.
1695
1696 Though @option{-o} names only the primary output, it also affects the
1697 naming of auxiliary and dump outputs. See the examples below. Unless
1698 overridden, both auxiliary outputs and dump outputs are placed in the
1699 same directory as the primary output. In auxiliary outputs, the suffix
1700 of the input file is replaced with that of the auxiliary output file
1701 type; in dump outputs, the suffix of the dump file is appended to the
1702 input file suffix. In compilation commands, the base name of both
1703 auxiliary and dump outputs is that of the primary output; in compile and
1704 link commands, the primary output name, minus the executable suffix, is
1705 combined with the input file name. If both share the same base name,
1706 disregarding the suffix, the result of the combination is that base
1707 name, otherwise, they are concatenated, separated by a dash.
1708
1709 @smallexample
1710 gcc -c foo.c ...
1711 @end smallexample
1712
1713 will use @file{foo.o} as the primary output, and place aux outputs and
1714 dumps next to it, e.g., aux file @file{foo.dwo} for
1715 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1716 @option{-fdump-rtl-final}.
1717
1718 If a non-linker output file is explicitly specified, aux and dump files
1719 by default take the same base name:
1720
1721 @smallexample
1722 gcc -c foo.c -o dir/foobar.o ...
1723 @end smallexample
1724
1725 will name aux outputs @file{dir/foobar.*} and dump outputs
1726 @file{dir/foobar.c.*}.
1727
1728 A linker output will instead prefix aux and dump outputs:
1729
1730 @smallexample
1731 gcc foo.c bar.c -o dir/foobar ...
1732 @end smallexample
1733
1734 will generally name aux outputs @file{dir/foobar-foo.*} and
1735 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1736 @file{dir/foobar-bar.c.*}.
1737
1738 The one exception to the above is when the executable shares the base
1739 name with the single input:
1740
1741 @smallexample
1742 gcc foo.c -o dir/foo ...
1743 @end smallexample
1744
1745 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1746 named @file{dir/foo.c.*}.
1747
1748 The location and the names of auxiliary and dump outputs can be adjusted
1749 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1750 @option{-dumpdir}, @option{-save-temps=cwd}, and
1751 @option{-save-temps=obj}.
1752
1753
1754 @item -dumpbase @var{dumpbase}
1755 @opindex dumpbase
1756 This option sets the base name for auxiliary and dump output files. It
1757 does not affect the name of the primary output file. Intermediate
1758 outputs, when preserved, are not regarded as primary outputs, but as
1759 auxiliary outputs:
1760
1761 @smallexample
1762 gcc -save-temps -S foo.c
1763 @end smallexample
1764
1765 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1766 then compiles to the (implied) output file @file{foo.s}, whereas:
1767
1768 @smallexample
1769 gcc -save-temps -dumpbase save-foo -c foo.c
1770 @end smallexample
1771
1772 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1773 an intermediate, thus auxiliary output), and then assembles to the
1774 (implied) output file @file{foo.o}.
1775
1776 Absent this option, dump and aux files take their names from the input
1777 file, or from the (non-linker) output file, if one is explicitly
1778 specified: dump output files (e.g. those requested by @option{-fdump-*}
1779 options) with the input name suffix, and aux output files (those
1780 requested by other non-dump options, e.g. @code{-save-temps},
1781 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1782
1783 Similar suffix differentiation of dump and aux outputs can be attained
1784 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1785 @option{-dumpbase-ext .suf}.
1786
1787 If @var{dumpbase} is explicitly specified with any directory component,
1788 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1789 @option{-save-temps=*}) is ignored, and instead of appending to it,
1790 @var{dumpbase} fully overrides it:
1791
1792 @smallexample
1793 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1794 -dumpdir pfx- -save-temps=cwd ...
1795 @end smallexample
1796
1797 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1798 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1799 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1800
1801 When @option{-dumpbase} is specified in a command that compiles multiple
1802 inputs, or that compiles and then links, it may be combined with
1803 @var{dumppfx}, as specified under @option{-dumpdir}. Then, each input
1804 file is compiled using the combined @var{dumppfx}, and default values
1805 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1806 file:
1807
1808 @smallexample
1809 gcc foo.c bar.c -c -dumpbase main ...
1810 @end smallexample
1811
1812 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1813 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1814 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1815 and @file{main-bar.*}.
1816
1817 An empty string specified as @var{dumpbase} avoids the influence of the
1818 output basename in the naming of auxiliary and dump outputs during
1819 compilation, computing default values :
1820
1821 @smallexample
1822 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1823 @end smallexample
1824
1825 will name aux outputs @file{dir/foo.*} and dump outputs
1826 @file{dir/foo.c.*}. Note how their basenames are taken from the input
1827 name, but the directory still defaults to that of the output.
1828
1829 The empty-string dumpbase does not prevent the use of the output
1830 basename for outputs during linking:
1831
1832 @smallexample
1833 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1834 @end smallexample
1835
1836 The compilation of the source files will name auxiliary outputs
1837 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1838 @file{dir/foo.c.*} and @file{dir/bar.c.*}. LTO recompilation during
1839 linking will use @file{dir/foobar.} as the prefix for dumps and
1840 auxiliary files.
1841
1842
1843 @item -dumpbase-ext @var{auxdropsuf}
1844 @opindex dumpbase-ext
1845 When forming the name of an auxiliary (but not a dump) output file, drop
1846 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1847 suffixes. If not specified, this option defaults to the suffix of a
1848 default @var{dumpbase}, i.e., the suffix of the input file when
1849 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1850 is combined with @var{dumppfx}.
1851
1852 @smallexample
1853 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1854 @end smallexample
1855
1856 creates @file{dir/foo.o} as the main output, and generates auxiliary
1857 outputs in @file{dir/x-foo.*}, taking the location of the primary
1858 output, and dropping the @file{.c} suffix from the @var{dumpbase}. Dump
1859 outputs retain the suffix: @file{dir/x-foo.c.*}.
1860
1861 This option is disregarded if it does not match the suffix of a
1862 specified @var{dumpbase}, except as an alternative to the executable
1863 suffix when appending the linker output base name to @var{dumppfx}, as
1864 specified below:
1865
1866 @smallexample
1867 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1868 @end smallexample
1869
1870 creates @file{main.out} as the primary output, and avoids overwriting
1871 the auxiliary and dump outputs by using the executable name minus
1872 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1873 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1874 @file{main-foo.c.*} and @file{main-bar.c.*}.
1875
1876
1877 @item -dumpdir @var{dumppfx}
1878 @opindex dumpdir
1879 When forming the name of an auxiliary or dump output file, use
1880 @var{dumppfx} as a prefix:
1881
1882 @smallexample
1883 gcc -dumpdir pfx- -c foo.c ...
1884 @end smallexample
1885
1886 creates @file{foo.o} as the primary output, and auxiliary outputs named
1887 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1888 @var{dumpbase} derived from the default primary output, derived in turn
1889 from the input name. Dump outputs also take the input name suffix:
1890 @file{pfx-foo.c.*}.
1891
1892 If @var{dumppfx} is to be used as a directory name, it must end with a
1893 directory separator:
1894
1895 @smallexample
1896 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1897 @end smallexample
1898
1899 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1900 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1901 default @var{dumpbase} derived from the primary output name. Dump
1902 outputs also take the input name suffix: @file{dir/bar.c.*}.
1903
1904 It defaults to the location of the output file, unless the output
1905 file is a special file like @code{/dev/null}. Options
1906 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1907 default, just like an explicit @option{-dumpdir} option. In case
1908 multiple such options are given, the last one prevails:
1909
1910 @smallexample
1911 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1912 @end smallexample
1913
1914 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1915 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1916 @option{-dumpdir} option. It does not matter that @option{=obj} is the
1917 default for @option{-save-temps}, nor that the output directory is
1918 implicitly the current directory. Dump outputs are named
1919 @file{foo.c.*}.
1920
1921 When compiling from multiple input files, if @option{-dumpbase} is
1922 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1923 are appended to (or override, if containing any directory components) an
1924 explicit or defaulted @var{dumppfx}, so that each of the multiple
1925 compilations gets differently-named aux and dump outputs.
1926
1927 @smallexample
1928 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1929 @end smallexample
1930
1931 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1932 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1933 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1934 and @file{dir/pfx-main-bar.c.*}, respectively. Contrast with the
1935 single-input compilation:
1936
1937 @smallexample
1938 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1939 @end smallexample
1940
1941 that, applying @option{-dumpbase} to a single source, does not compute
1942 and append a separate @var{dumpbase} per input file. Its auxiliary and
1943 dump outputs go in @file{dir/pfx-main.*}.
1944
1945 When compiling and then linking from multiple input files, a defaulted
1946 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1947 transformation above (e.g. the compilation of @file{foo.c} and
1948 @file{bar.c} above, but without @option{-c}). If neither
1949 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1950 base name, minus @var{auxdropsuf}, if specified, or the executable
1951 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1952 instead. Note, however, that unlike earlier cases of linking:
1953
1954 @smallexample
1955 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1956 @end smallexample
1957
1958 does not append the output name @file{main} to @var{dumppfx}, because
1959 @option{-dumpdir} is explicitly specified. The goal is that the
1960 explicitly-specified @var{dumppfx} may contain the specified output name
1961 as part of the prefix, if desired; only an explicitly-specified
1962 @option{-dumpbase} would be combined with it, in order to avoid simply
1963 discarding a meaningful option.
1964
1965 When compiling and then linking from a single input file, the linker
1966 output base name will only be appended to the default @var{dumppfx} as
1967 above if it does not share the base name with the single input file
1968 name. This has been covered in single-input linking cases above, but
1969 not with an explicit @option{-dumpdir} that inhibits the combination,
1970 even if overridden by @option{-save-temps=*}:
1971
1972 @smallexample
1973 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1974 @end smallexample
1975
1976 Auxiliary outputs are named @file{foo.*}, and dump outputs
1977 @file{foo.c.*}, in the current working directory as ultimately requested
1978 by @option{-save-temps=cwd}.
1979
1980 Summing it all up for an intuitive though slightly imprecise data flow:
1981 the primary output name is broken into a directory part and a basename
1982 part; @var{dumppfx} is set to the former, unless overridden by
1983 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1984 to the latter, unless overriden by @option{-dumpbase}. If there are
1985 multiple inputs or linking, this @var{dumpbase} may be combined with
1986 @var{dumppfx} and taken from each input file. Auxiliary output names
1987 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1988 minus suffix, and the auxiliary output suffix; dump output names are
1989 only different in that the suffix from @var{dumpbase} is retained.
1990
1991 When it comes to auxiliary and dump outputs created during LTO
1992 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1993 given or as derived from the linker output name but not from inputs,
1994 even in cases in which this combination would not otherwise be used as
1995 such, is passed down with a trailing period replacing the compiler-added
1996 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1997 being involved in linking, this program does not normally get any
1998 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
1999
2000 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2001 names to the received @var{dumppfx}, ensures it contains a directory
2002 component so that it overrides any @option{-dumpdir}, and passes that as
2003 @option{-dumpbase} to sub-compilers.
2004
2005 @item -v
2006 @opindex v
2007 Print (on standard error output) the commands executed to run the stages
2008 of compilation. Also print the version number of the compiler driver
2009 program and of the preprocessor and the compiler proper.
2010
2011 @item -###
2012 @opindex ###
2013 Like @option{-v} except the commands are not executed and arguments
2014 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2015 This is useful for shell scripts to capture the driver-generated command lines.
2016
2017 @item --help
2018 @opindex help
2019 Print (on the standard output) a description of the command-line options
2020 understood by @command{gcc}. If the @option{-v} option is also specified
2021 then @option{--help} is also passed on to the various processes
2022 invoked by @command{gcc}, so that they can display the command-line options
2023 they accept. If the @option{-Wextra} option has also been specified
2024 (prior to the @option{--help} option), then command-line options that
2025 have no documentation associated with them are also displayed.
2026
2027 @item --target-help
2028 @opindex target-help
2029 Print (on the standard output) a description of target-specific command-line
2030 options for each tool. For some targets extra target-specific
2031 information may also be printed.
2032
2033 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2034 Print (on the standard output) a description of the command-line
2035 options understood by the compiler that fit into all specified classes
2036 and qualifiers. These are the supported classes:
2037
2038 @table @asis
2039 @item @samp{optimizers}
2040 Display all of the optimization options supported by the
2041 compiler.
2042
2043 @item @samp{warnings}
2044 Display all of the options controlling warning messages
2045 produced by the compiler.
2046
2047 @item @samp{target}
2048 Display target-specific options. Unlike the
2049 @option{--target-help} option however, target-specific options of the
2050 linker and assembler are not displayed. This is because those
2051 tools do not currently support the extended @option{--help=} syntax.
2052
2053 @item @samp{params}
2054 Display the values recognized by the @option{--param}
2055 option.
2056
2057 @item @var{language}
2058 Display the options supported for @var{language}, where
2059 @var{language} is the name of one of the languages supported in this
2060 version of GCC@. If an option is supported by all languages, one needs
2061 to select @samp{common} class.
2062
2063 @item @samp{common}
2064 Display the options that are common to all languages.
2065 @end table
2066
2067 These are the supported qualifiers:
2068
2069 @table @asis
2070 @item @samp{undocumented}
2071 Display only those options that are undocumented.
2072
2073 @item @samp{joined}
2074 Display options taking an argument that appears after an equal
2075 sign in the same continuous piece of text, such as:
2076 @samp{--help=target}.
2077
2078 @item @samp{separate}
2079 Display options taking an argument that appears as a separate word
2080 following the original option, such as: @samp{-o output-file}.
2081 @end table
2082
2083 Thus for example to display all the undocumented target-specific
2084 switches supported by the compiler, use:
2085
2086 @smallexample
2087 --help=target,undocumented
2088 @end smallexample
2089
2090 The sense of a qualifier can be inverted by prefixing it with the
2091 @samp{^} character, so for example to display all binary warning
2092 options (i.e., ones that are either on or off and that do not take an
2093 argument) that have a description, use:
2094
2095 @smallexample
2096 --help=warnings,^joined,^undocumented
2097 @end smallexample
2098
2099 The argument to @option{--help=} should not consist solely of inverted
2100 qualifiers.
2101
2102 Combining several classes is possible, although this usually
2103 restricts the output so much that there is nothing to display. One
2104 case where it does work, however, is when one of the classes is
2105 @var{target}. For example, to display all the target-specific
2106 optimization options, use:
2107
2108 @smallexample
2109 --help=target,optimizers
2110 @end smallexample
2111
2112 The @option{--help=} option can be repeated on the command line. Each
2113 successive use displays its requested class of options, skipping
2114 those that have already been displayed. If @option{--help} is also
2115 specified anywhere on the command line then this takes precedence
2116 over any @option{--help=} option.
2117
2118 If the @option{-Q} option appears on the command line before the
2119 @option{--help=} option, then the descriptive text displayed by
2120 @option{--help=} is changed. Instead of describing the displayed
2121 options, an indication is given as to whether the option is enabled,
2122 disabled or set to a specific value (assuming that the compiler
2123 knows this at the point where the @option{--help=} option is used).
2124
2125 Here is a truncated example from the ARM port of @command{gcc}:
2126
2127 @smallexample
2128 % gcc -Q -mabi=2 --help=target -c
2129 The following options are target specific:
2130 -mabi= 2
2131 -mabort-on-noreturn [disabled]
2132 -mapcs [disabled]
2133 @end smallexample
2134
2135 The output is sensitive to the effects of previous command-line
2136 options, so for example it is possible to find out which optimizations
2137 are enabled at @option{-O2} by using:
2138
2139 @smallexample
2140 -Q -O2 --help=optimizers
2141 @end smallexample
2142
2143 Alternatively you can discover which binary optimizations are enabled
2144 by @option{-O3} by using:
2145
2146 @smallexample
2147 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2148 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2149 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2150 @end smallexample
2151
2152 @item --version
2153 @opindex version
2154 Display the version number and copyrights of the invoked GCC@.
2155
2156 @item -pass-exit-codes
2157 @opindex pass-exit-codes
2158 Normally the @command{gcc} program exits with the code of 1 if any
2159 phase of the compiler returns a non-success return code. If you specify
2160 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2161 the numerically highest error produced by any phase returning an error
2162 indication. The C, C++, and Fortran front ends return 4 if an internal
2163 compiler error is encountered.
2164
2165 @item -pipe
2166 @opindex pipe
2167 Use pipes rather than temporary files for communication between the
2168 various stages of compilation. This fails to work on some systems where
2169 the assembler is unable to read from a pipe; but the GNU assembler has
2170 no trouble.
2171
2172 @item -specs=@var{file}
2173 @opindex specs
2174 Process @var{file} after the compiler reads in the standard @file{specs}
2175 file, in order to override the defaults which the @command{gcc} driver
2176 program uses when determining what switches to pass to @command{cc1},
2177 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
2178 @option{-specs=@var{file}} can be specified on the command line, and they
2179 are processed in order, from left to right. @xref{Spec Files}, for
2180 information about the format of the @var{file}.
2181
2182 @item -wrapper
2183 @opindex wrapper
2184 Invoke all subcommands under a wrapper program. The name of the
2185 wrapper program and its parameters are passed as a comma separated
2186 list.
2187
2188 @smallexample
2189 gcc -c t.c -wrapper gdb,--args
2190 @end smallexample
2191
2192 @noindent
2193 This invokes all subprograms of @command{gcc} under
2194 @samp{gdb --args}, thus the invocation of @command{cc1} is
2195 @samp{gdb --args cc1 @dots{}}.
2196
2197 @item -ffile-prefix-map=@var{old}=@var{new}
2198 @opindex ffile-prefix-map
2199 When compiling files residing in directory @file{@var{old}}, record
2200 any references to them in the result of the compilation as if the
2201 files resided in directory @file{@var{new}} instead. Specifying this
2202 option is equivalent to specifying all the individual
2203 @option{-f*-prefix-map} options. This can be used to make reproducible
2204 builds that are location independent. Directories referenced by
2205 directives are not affected by these options. See also
2206 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map} and
2207 @option{-fprofile-prefix-map}.
2208
2209 @item -fplugin=@var{name}.so
2210 @opindex fplugin
2211 Load the plugin code in file @var{name}.so, assumed to be a
2212 shared object to be dlopen'd by the compiler. The base name of
2213 the shared object file is used to identify the plugin for the
2214 purposes of argument parsing (See
2215 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2216 Each plugin should define the callback functions specified in the
2217 Plugins API.
2218
2219 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2220 @opindex fplugin-arg
2221 Define an argument called @var{key} with a value of @var{value}
2222 for the plugin called @var{name}.
2223
2224 @item -fdump-ada-spec@r{[}-slim@r{]}
2225 @opindex fdump-ada-spec
2226 For C and C++ source and include files, generate corresponding Ada specs.
2227 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2228 GNAT User's Guide}, which provides detailed documentation on this feature.
2229
2230 @item -fada-spec-parent=@var{unit}
2231 @opindex fada-spec-parent
2232 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2233 Ada specs as child units of parent @var{unit}.
2234
2235 @item -fdump-go-spec=@var{file}
2236 @opindex fdump-go-spec
2237 For input files in any language, generate corresponding Go
2238 declarations in @var{file}. This generates Go @code{const},
2239 @code{type}, @code{var}, and @code{func} declarations which may be a
2240 useful way to start writing a Go interface to code written in some
2241 other language.
2242
2243 @include @value{srcdir}/../libiberty/at-file.texi
2244 @end table
2245
2246 @node Invoking G++
2247 @section Compiling C++ Programs
2248
2249 @cindex suffixes for C++ source
2250 @cindex C++ source file suffixes
2251 C++ source files conventionally use one of the suffixes @samp{.C},
2252 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2253 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2254 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2255 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
2256 files with these names and compiles them as C++ programs even if you
2257 call the compiler the same way as for compiling C programs (usually
2258 with the name @command{gcc}).
2259
2260 @findex g++
2261 @findex c++
2262 However, the use of @command{gcc} does not add the C++ library.
2263 @command{g++} is a program that calls GCC and automatically specifies linking
2264 against the C++ library. It treats @samp{.c},
2265 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2266 files unless @option{-x} is used. This program is also useful when
2267 precompiling a C header file with a @samp{.h} extension for use in C++
2268 compilations. On many systems, @command{g++} is also installed with
2269 the name @command{c++}.
2270
2271 @cindex invoking @command{g++}
2272 When you compile C++ programs, you may specify many of the same
2273 command-line options that you use for compiling programs in any
2274 language; or command-line options meaningful for C and related
2275 languages; or options that are meaningful only for C++ programs.
2276 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2277 explanations of options for languages related to C@.
2278 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2279 explanations of options that are meaningful only for C++ programs.
2280
2281 @node C Dialect Options
2282 @section Options Controlling C Dialect
2283 @cindex dialect options
2284 @cindex language dialect options
2285 @cindex options, dialect
2286
2287 The following options control the dialect of C (or languages derived
2288 from C, such as C++, Objective-C and Objective-C++) that the compiler
2289 accepts:
2290
2291 @table @gcctabopt
2292 @cindex ANSI support
2293 @cindex ISO support
2294 @item -ansi
2295 @opindex ansi
2296 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2297 equivalent to @option{-std=c++98}.
2298
2299 This turns off certain features of GCC that are incompatible with ISO
2300 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2301 such as the @code{asm} and @code{typeof} keywords, and
2302 predefined macros such as @code{unix} and @code{vax} that identify the
2303 type of system you are using. It also enables the undesirable and
2304 rarely used ISO trigraph feature. For the C compiler,
2305 it disables recognition of C++ style @samp{//} comments as well as
2306 the @code{inline} keyword.
2307
2308 The alternate keywords @code{__asm__}, @code{__extension__},
2309 @code{__inline__} and @code{__typeof__} continue to work despite
2310 @option{-ansi}. You would not want to use them in an ISO C program, of
2311 course, but it is useful to put them in header files that might be included
2312 in compilations done with @option{-ansi}. Alternate predefined macros
2313 such as @code{__unix__} and @code{__vax__} are also available, with or
2314 without @option{-ansi}.
2315
2316 The @option{-ansi} option does not cause non-ISO programs to be
2317 rejected gratuitously. For that, @option{-Wpedantic} is required in
2318 addition to @option{-ansi}. @xref{Warning Options}.
2319
2320 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2321 option is used. Some header files may notice this macro and refrain
2322 from declaring certain functions or defining certain macros that the
2323 ISO standard doesn't call for; this is to avoid interfering with any
2324 programs that might use these names for other things.
2325
2326 Functions that are normally built in but do not have semantics
2327 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2328 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
2329 built-in functions provided by GCC}, for details of the functions
2330 affected.
2331
2332 @item -std=
2333 @opindex std
2334 Determine the language standard. @xref{Standards,,Language Standards
2335 Supported by GCC}, for details of these standard versions. This option
2336 is currently only supported when compiling C or C++.
2337
2338 The compiler can accept several base standards, such as @samp{c90} or
2339 @samp{c++98}, and GNU dialects of those standards, such as
2340 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
2341 compiler accepts all programs following that standard plus those
2342 using GNU extensions that do not contradict it. For example,
2343 @option{-std=c90} turns off certain features of GCC that are
2344 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2345 keywords, but not other GNU extensions that do not have a meaning in
2346 ISO C90, such as omitting the middle term of a @code{?:}
2347 expression. On the other hand, when a GNU dialect of a standard is
2348 specified, all features supported by the compiler are enabled, even when
2349 those features change the meaning of the base standard. As a result, some
2350 strict-conforming programs may be rejected. The particular standard
2351 is used by @option{-Wpedantic} to identify which features are GNU
2352 extensions given that version of the standard. For example
2353 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2354 comments, while @option{-std=gnu99 -Wpedantic} does not.
2355
2356 A value for this option must be provided; possible values are
2357
2358 @table @samp
2359 @item c90
2360 @itemx c89
2361 @itemx iso9899:1990
2362 Support all ISO C90 programs (certain GNU extensions that conflict
2363 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2364
2365 @item iso9899:199409
2366 ISO C90 as modified in amendment 1.
2367
2368 @item c99
2369 @itemx c9x
2370 @itemx iso9899:1999
2371 @itemx iso9899:199x
2372 ISO C99. This standard is substantially completely supported, modulo
2373 bugs and floating-point issues
2374 (mainly but not entirely relating to optional C99 features from
2375 Annexes F and G). See
2376 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information. The
2377 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2378
2379 @item c11
2380 @itemx c1x
2381 @itemx iso9899:2011
2382 ISO C11, the 2011 revision of the ISO C standard. This standard is
2383 substantially completely supported, modulo bugs, floating-point issues
2384 (mainly but not entirely relating to optional C11 features from
2385 Annexes F and G) and the optional Annexes K (Bounds-checking
2386 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
2387
2388 @item c17
2389 @itemx c18
2390 @itemx iso9899:2017
2391 @itemx iso9899:2018
2392 ISO C17, the 2017 revision of the ISO C standard
2393 (published in 2018). This standard is
2394 same as C11 except for corrections of defects (all of which are also
2395 applied with @option{-std=c11}) and a new value of
2396 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2397
2398 @item c2x
2399 The next version of the ISO C standard, still under development. The
2400 support for this version is experimental and incomplete.
2401
2402 @item gnu90
2403 @itemx gnu89
2404 GNU dialect of ISO C90 (including some C99 features).
2405
2406 @item gnu99
2407 @itemx gnu9x
2408 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2409
2410 @item gnu11
2411 @itemx gnu1x
2412 GNU dialect of ISO C11.
2413 The name @samp{gnu1x} is deprecated.
2414
2415 @item gnu17
2416 @itemx gnu18
2417 GNU dialect of ISO C17. This is the default for C code.
2418
2419 @item gnu2x
2420 The next version of the ISO C standard, still under development, plus
2421 GNU extensions. The support for this version is experimental and
2422 incomplete.
2423
2424 @item c++98
2425 @itemx c++03
2426 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2427 additional defect reports. Same as @option{-ansi} for C++ code.
2428
2429 @item gnu++98
2430 @itemx gnu++03
2431 GNU dialect of @option{-std=c++98}.
2432
2433 @item c++11
2434 @itemx c++0x
2435 The 2011 ISO C++ standard plus amendments.
2436 The name @samp{c++0x} is deprecated.
2437
2438 @item gnu++11
2439 @itemx gnu++0x
2440 GNU dialect of @option{-std=c++11}.
2441 The name @samp{gnu++0x} is deprecated.
2442
2443 @item c++14
2444 @itemx c++1y
2445 The 2014 ISO C++ standard plus amendments.
2446 The name @samp{c++1y} is deprecated.
2447
2448 @item gnu++14
2449 @itemx gnu++1y
2450 GNU dialect of @option{-std=c++14}.
2451 The name @samp{gnu++1y} is deprecated.
2452
2453 @item c++17
2454 @itemx c++1z
2455 The 2017 ISO C++ standard plus amendments.
2456 The name @samp{c++1z} is deprecated.
2457
2458 @item gnu++17
2459 @itemx gnu++1z
2460 GNU dialect of @option{-std=c++17}.
2461 This is the default for C++ code.
2462 The name @samp{gnu++1z} is deprecated.
2463
2464 @item c++20
2465 @itemx c++2a
2466 The 2020 ISO C++ standard plus amendments.
2467 Support is experimental, and could change in incompatible ways in
2468 future releases.
2469 The name @samp{c++2a} is deprecated.
2470
2471 @item gnu++20
2472 @itemx gnu++2a
2473 GNU dialect of @option{-std=c++20}.
2474 Support is experimental, and could change in incompatible ways in
2475 future releases.
2476 The name @samp{gnu++2a} is deprecated.
2477
2478 @item c++2b
2479 @itemx c++23
2480 The next revision of the ISO C++ standard, planned for
2481 2023. Support is highly experimental, and will almost certainly
2482 change in incompatible ways in future releases.
2483
2484 @item gnu++2b
2485 @itemx gnu++23
2486 GNU dialect of @option{-std=c++2b}. Support is highly experimental,
2487 and will almost certainly change in incompatible ways in future
2488 releases.
2489 @end table
2490
2491 @item -aux-info @var{filename}
2492 @opindex aux-info
2493 Output to the given filename prototyped declarations for all functions
2494 declared and/or defined in a translation unit, including those in header
2495 files. This option is silently ignored in any language other than C@.
2496
2497 Besides declarations, the file indicates, in comments, the origin of
2498 each declaration (source file and line), whether the declaration was
2499 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2500 @samp{O} for old, respectively, in the first character after the line
2501 number and the colon), and whether it came from a declaration or a
2502 definition (@samp{C} or @samp{F}, respectively, in the following
2503 character). In the case of function definitions, a K&R-style list of
2504 arguments followed by their declarations is also provided, inside
2505 comments, after the declaration.
2506
2507 @item -fno-asm
2508 @opindex fno-asm
2509 @opindex fasm
2510 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2511 keyword, so that code can use these words as identifiers. You can use
2512 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2513 instead. In C, @option{-ansi} implies @option{-fno-asm}.
2514
2515 In C++, @code{inline} is a standard keyword and is not affected by
2516 this switch. You may want to use the @option{-fno-gnu-keywords} flag
2517 instead, which disables @code{typeof} but not @code{asm} and
2518 @code{inline}. In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2519 this switch only affects the @code{asm} and @code{typeof} keywords,
2520 since @code{inline} is a standard keyword in ISO C99. In C2X mode
2521 (@option{-std=c2x} or @option{-std=gnu2x}), this switch only affects
2522 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2523 ISO C2X.
2524
2525 @item -fno-builtin
2526 @itemx -fno-builtin-@var{function}
2527 @opindex fno-builtin
2528 @opindex fbuiltin
2529 @cindex built-in functions
2530 Don't recognize built-in functions that do not begin with
2531 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2532 functions provided by GCC}, for details of the functions affected,
2533 including those which are not built-in functions when @option{-ansi} or
2534 @option{-std} options for strict ISO C conformance are used because they
2535 do not have an ISO standard meaning.
2536
2537 GCC normally generates special code to handle certain built-in functions
2538 more efficiently; for instance, calls to @code{alloca} may become single
2539 instructions which adjust the stack directly, and calls to @code{memcpy}
2540 may become inline copy loops. The resulting code is often both smaller
2541 and faster, but since the function calls no longer appear as such, you
2542 cannot set a breakpoint on those calls, nor can you change the behavior
2543 of the functions by linking with a different library. In addition,
2544 when a function is recognized as a built-in function, GCC may use
2545 information about that function to warn about problems with calls to
2546 that function, or to generate more efficient code, even if the
2547 resulting code still contains calls to that function. For example,
2548 warnings are given with @option{-Wformat} for bad calls to
2549 @code{printf} when @code{printf} is built in and @code{strlen} is
2550 known not to modify global memory.
2551
2552 With the @option{-fno-builtin-@var{function}} option
2553 only the built-in function @var{function} is
2554 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2555 function is named that is not built-in in this version of GCC, this
2556 option is ignored. There is no corresponding
2557 @option{-fbuiltin-@var{function}} option; if you wish to enable
2558 built-in functions selectively when using @option{-fno-builtin} or
2559 @option{-ffreestanding}, you may define macros such as:
2560
2561 @smallexample
2562 #define abs(n) __builtin_abs ((n))
2563 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2564 @end smallexample
2565
2566 @item -fcond-mismatch
2567 @opindex fcond-mismatch
2568 Allow conditional expressions with mismatched types in the second and
2569 third arguments. The value of such an expression is void. This option
2570 is not supported for C++.
2571
2572 @item -ffreestanding
2573 @opindex ffreestanding
2574 @cindex hosted environment
2575
2576 Assert that compilation targets a freestanding environment. This
2577 implies @option{-fno-builtin}. A freestanding environment
2578 is one in which the standard library may not exist, and program startup may
2579 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2580 This is equivalent to @option{-fno-hosted}.
2581
2582 @xref{Standards,,Language Standards Supported by GCC}, for details of
2583 freestanding and hosted environments.
2584
2585 @item -fgimple
2586 @opindex fgimple
2587
2588 Enable parsing of function definitions marked with @code{__GIMPLE}.
2589 This is an experimental feature that allows unit testing of GIMPLE
2590 passes.
2591
2592 @item -fgnu-tm
2593 @opindex fgnu-tm
2594 When the option @option{-fgnu-tm} is specified, the compiler
2595 generates code for the Linux variant of Intel's current Transactional
2596 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2597 an experimental feature whose interface may change in future versions
2598 of GCC, as the official specification changes. Please note that not
2599 all architectures are supported for this feature.
2600
2601 For more information on GCC's support for transactional memory,
2602 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2603 Transactional Memory Library}.
2604
2605 Note that the transactional memory feature is not supported with
2606 non-call exceptions (@option{-fnon-call-exceptions}).
2607
2608 @item -fgnu89-inline
2609 @opindex fgnu89-inline
2610 The option @option{-fgnu89-inline} tells GCC to use the traditional
2611 GNU semantics for @code{inline} functions when in C99 mode.
2612 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2613 Using this option is roughly equivalent to adding the
2614 @code{gnu_inline} function attribute to all inline functions
2615 (@pxref{Function Attributes}).
2616
2617 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2618 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2619 specifies the default behavior).
2620 This option is not supported in @option{-std=c90} or
2621 @option{-std=gnu90} mode.
2622
2623 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2624 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2625 in effect for @code{inline} functions. @xref{Common Predefined
2626 Macros,,,cpp,The C Preprocessor}.
2627
2628 @item -fhosted
2629 @opindex fhosted
2630 @cindex hosted environment
2631
2632 Assert that compilation targets a hosted environment. This implies
2633 @option{-fbuiltin}. A hosted environment is one in which the
2634 entire standard library is available, and in which @code{main} has a return
2635 type of @code{int}. Examples are nearly everything except a kernel.
2636 This is equivalent to @option{-fno-freestanding}.
2637
2638 @item -flax-vector-conversions
2639 @opindex flax-vector-conversions
2640 Allow implicit conversions between vectors with differing numbers of
2641 elements and/or incompatible element types. This option should not be
2642 used for new code.
2643
2644 @item -fms-extensions
2645 @opindex fms-extensions
2646 Accept some non-standard constructs used in Microsoft header files.
2647
2648 In C++ code, this allows member names in structures to be similar
2649 to previous types declarations.
2650
2651 @smallexample
2652 typedef int UOW;
2653 struct ABC @{
2654 UOW UOW;
2655 @};
2656 @end smallexample
2657
2658 Some cases of unnamed fields in structures and unions are only
2659 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2660 fields within structs/unions}, for details.
2661
2662 Note that this option is off for all targets except for x86
2663 targets using ms-abi.
2664
2665 @item -foffload=disable
2666 @itemx -foffload=default
2667 @itemx -foffload=@var{target-list}
2668 @opindex foffload
2669 @cindex Offloading targets
2670 @cindex OpenACC offloading targets
2671 @cindex OpenMP offloading targets
2672 Specify for which OpenMP and OpenACC offload targets code should be generated.
2673 The default behavior, equivalent to @option{-foffload=default}, is to generate
2674 code for all supported offload targets. The @option{-foffload=disable} form
2675 generates code only for the host fallback, while
2676 @option{-foffload=@var{target-list}} generates code only for the specified
2677 comma-separated list of offload targets.
2678
2679 Offload targets are specified in GCC's internal target-triplet format. You can
2680 run the compiler with @option{-v} to show the list of configured offload targets
2681 under @code{OFFLOAD_TARGET_NAMES}.
2682
2683 @item -foffload-options=@var{options}
2684 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2685 @opindex foffload-options
2686 @cindex Offloading options
2687 @cindex OpenACC offloading options
2688 @cindex OpenMP offloading options
2689
2690 With @option{-foffload-options=@var{options}}, GCC passes the specified
2691 @var{options} to the compilers for all enabled offloading targets. You can
2692 specify options that apply only to a specific target or targets by using
2693 the @option{-foffload-options=@var{target-list}=@var{options}} form. The
2694 @var{target-list} is a comma-separated list in the same format as for the
2695 @option{-foffload=} option.
2696
2697 Typical command lines are
2698
2699 @smallexample
2700 -foffload-options=-lgfortran -foffload-options=-lm
2701 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2702 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2703 @end smallexample
2704
2705 @item -fopenacc
2706 @opindex fopenacc
2707 @cindex OpenACC accelerator programming
2708 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2709 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2710 compiler generates accelerated code according to the OpenACC Application
2711 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2712 implies @option{-pthread}, and thus is only supported on targets that
2713 have support for @option{-pthread}.
2714
2715 @item -fopenacc-dim=@var{geom}
2716 @opindex fopenacc-dim
2717 @cindex OpenACC accelerator programming
2718 Specify default compute dimensions for parallel offload regions that do
2719 not explicitly specify. The @var{geom} value is a triple of
2720 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2721 can be omitted, to use a target-specific default value.
2722
2723 @item -fopenmp
2724 @opindex fopenmp
2725 @cindex OpenMP parallel
2726 Enable handling of OpenMP directives @code{#pragma omp} in C/C++,
2727 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++ and
2728 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2729 compiler generates parallel code according to the OpenMP Application
2730 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2731 implies @option{-pthread}, and thus is only supported on targets that
2732 have support for @option{-pthread}. @option{-fopenmp} implies
2733 @option{-fopenmp-simd}.
2734
2735 @item -fopenmp-simd
2736 @opindex fopenmp-simd
2737 @cindex OpenMP SIMD
2738 @cindex SIMD
2739 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2740 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan},
2741 @code{loop} directives and combined or composite directives with
2742 @code{simd} as constituent with @code{#pragma omp} in C/C++,
2743 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++
2744 and @code{!$omp} in Fortran. Other OpenMP directives are ignored.
2745
2746 @item -fopenmp-target-simd-clone
2747 @item -fopenmp-target-simd-clone=@var{device-type}
2748 @opindex fopenmp-target-simd-clone
2749 @cindex OpenMP target SIMD clone
2750 In addition to generating SIMD clones for functions marked with the
2751 @code{declare simd} directive, GCC also generates clones
2752 for functions marked with the OpenMP @code{declare target} directive
2753 that are suitable for vectorization when this option is in effect. The
2754 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2755 and @code{any}, which correspond to keywords for the @code{device_type}
2756 clause of the @code{declare target} directive; clones are generated for
2757 the intersection of devices specified.
2758 @option{-fopenmp-target-simd-clone} is equivalent to
2759 @option{-fopenmp-target-simd-clone=any} and
2760 @option{-fno-openmp-target-simd-clone} is equivalent to
2761 @option{-fopenmp-target-simd-clone=none}.
2762
2763 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2764 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2765 it is disabled by default.
2766
2767 @item -fpermitted-flt-eval-methods=@var{style}
2768 @opindex fpermitted-flt-eval-methods
2769 @opindex fpermitted-flt-eval-methods=c11
2770 @opindex fpermitted-flt-eval-methods=ts-18661-3
2771 ISO/IEC TS 18661-3 defines new permissible values for
2772 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2773 a semantic type that is an interchange or extended format should be
2774 evaluated to the precision and range of that type. These new values are
2775 a superset of those permitted under C99/C11, which does not specify the
2776 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2777 conforming to C11 may not have been written expecting the possibility of
2778 the new values.
2779
2780 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2781 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2782 or the extended set of values specified in ISO/IEC TS 18661-3.
2783
2784 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2785
2786 The default when in a standards compliant mode (@option{-std=c11} or similar)
2787 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2788 dialect (@option{-std=gnu11} or similar) is
2789 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2790
2791 @item -fplan9-extensions
2792 @opindex fplan9-extensions
2793 Accept some non-standard constructs used in Plan 9 code.
2794
2795 This enables @option{-fms-extensions}, permits passing pointers to
2796 structures with anonymous fields to functions that expect pointers to
2797 elements of the type of the field, and permits referring to anonymous
2798 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2799 struct/union fields within structs/unions}, for details. This is only
2800 supported for C, not C++.
2801
2802 @item -fsigned-bitfields
2803 @itemx -funsigned-bitfields
2804 @itemx -fno-signed-bitfields
2805 @itemx -fno-unsigned-bitfields
2806 @opindex fsigned-bitfields
2807 @opindex funsigned-bitfields
2808 @opindex fno-signed-bitfields
2809 @opindex fno-unsigned-bitfields
2810 These options control whether a bit-field is signed or unsigned, when the
2811 declaration does not use either @code{signed} or @code{unsigned}. By
2812 default, such a bit-field is signed, because this is consistent: the
2813 basic integer types such as @code{int} are signed types.
2814
2815 @item -fsigned-char
2816 @opindex fsigned-char
2817 Let the type @code{char} be signed, like @code{signed char}.
2818
2819 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2820 the negative form of @option{-funsigned-char}. Likewise, the option
2821 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2822
2823 @item -funsigned-char
2824 @opindex funsigned-char
2825 Let the type @code{char} be unsigned, like @code{unsigned char}.
2826
2827 Each kind of machine has a default for what @code{char} should
2828 be. It is either like @code{unsigned char} by default or like
2829 @code{signed char} by default.
2830
2831 Ideally, a portable program should always use @code{signed char} or
2832 @code{unsigned char} when it depends on the signedness of an object.
2833 But many programs have been written to use plain @code{char} and
2834 expect it to be signed, or expect it to be unsigned, depending on the
2835 machines they were written for. This option, and its inverse, let you
2836 make such a program work with the opposite default.
2837
2838 The type @code{char} is always a distinct type from each of
2839 @code{signed char} or @code{unsigned char}, even though its behavior
2840 is always just like one of those two.
2841
2842 @item -fstrict-flex-arrays
2843 @opindex fstrict-flex-arrays
2844 @opindex fno-strict-flex-arrays
2845 Control when to treat the trailing array of a structure as a flexible array
2846 member for the purpose of accessing the elements of such an array.
2847 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2848 strictest. A trailing array is treated as a flexible array member only when it
2849 is declared as a flexible array member per C99 standard onwards.
2850 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2851 least strict. All trailing arrays of structures are treated as flexible array
2852 members.
2853
2854 @item -fstrict-flex-arrays=@var{level}
2855 @opindex fstrict-flex-arrays=@var{level}
2856 Control when to treat the trailing array of a structure as a flexible array
2857 member for the purpose of accessing the elements of such an array. The value
2858 of @var{level} controls the level of strictness.
2859
2860 The possible values of @var{level} are the same as for the
2861 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2862
2863 You can control this behavior for a specific trailing array field of a
2864 structure by using the variable attribute @code{strict_flex_array} attribute
2865 (@pxref{Variable Attributes}).
2866
2867 @item -fsso-struct=@var{endianness}
2868 @opindex fsso-struct
2869 Set the default scalar storage order of structures and unions to the
2870 specified endianness. The accepted values are @samp{big-endian},
2871 @samp{little-endian} and @samp{native} for the native endianness of
2872 the target (the default). This option is not supported for C++.
2873
2874 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2875 code that is not binary compatible with code generated without it if the
2876 specified endianness is not the native endianness of the target.
2877 @end table
2878
2879 @node C++ Dialect Options
2880 @section Options Controlling C++ Dialect
2881
2882 @cindex compiler options, C++
2883 @cindex C++ options, command-line
2884 @cindex options, C++
2885 This section describes the command-line options that are only meaningful
2886 for C++ programs. You can also use most of the GNU compiler options
2887 regardless of what language your program is in. For example, you
2888 might compile a file @file{firstClass.C} like this:
2889
2890 @smallexample
2891 g++ -g -fstrict-enums -O -c firstClass.C
2892 @end smallexample
2893
2894 @noindent
2895 In this example, only @option{-fstrict-enums} is an option meant
2896 only for C++ programs; you can use the other options with any
2897 language supported by GCC@.
2898
2899 Some options for compiling C programs, such as @option{-std}, are also
2900 relevant for C++ programs.
2901 @xref{C Dialect Options,,Options Controlling C Dialect}.
2902
2903 Here is a list of options that are @emph{only} for compiling C++ programs:
2904
2905 @table @gcctabopt
2906
2907 @item -fabi-version=@var{n}
2908 @opindex fabi-version
2909 Use version @var{n} of the C++ ABI@. The default is version 0.
2910
2911 Version 0 refers to the version conforming most closely to
2912 the C++ ABI specification. Therefore, the ABI obtained using version 0
2913 will change in different versions of G++ as ABI bugs are fixed.
2914
2915 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2916
2917 Version 2 is the version of the C++ ABI that first appeared in G++
2918 3.4, and was the default through G++ 4.9.
2919
2920 Version 3 corrects an error in mangling a constant address as a
2921 template argument.
2922
2923 Version 4, which first appeared in G++ 4.5, implements a standard
2924 mangling for vector types.
2925
2926 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2927 attribute const/volatile on function pointer types, decltype of a
2928 plain decl, and use of a function parameter in the declaration of
2929 another parameter.
2930
2931 Version 6, which first appeared in G++ 4.7, corrects the promotion
2932 behavior of C++11 scoped enums and the mangling of template argument
2933 packs, const/static_cast, prefix ++ and --, and a class scope function
2934 used as a template argument.
2935
2936 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2937 builtin type and corrects the mangling of lambdas in default argument
2938 scope.
2939
2940 Version 8, which first appeared in G++ 4.9, corrects the substitution
2941 behavior of function types with function-cv-qualifiers.
2942
2943 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2944 @code{nullptr_t}.
2945
2946 Version 10, which first appeared in G++ 6.1, adds mangling of
2947 attributes that affect type identity, such as ia32 calling convention
2948 attributes (e.g.@: @samp{stdcall}).
2949
2950 Version 11, which first appeared in G++ 7, corrects the mangling of
2951 sizeof... expressions and operator names. For multiple entities with
2952 the same name within a function, that are declared in different scopes,
2953 the mangling now changes starting with the twelfth occurrence. It also
2954 implies @option{-fnew-inheriting-ctors}.
2955
2956 Version 12, which first appeared in G++ 8, corrects the calling
2957 conventions for empty classes on the x86_64 target and for classes
2958 with only deleted copy/move constructors. It accidentally changes the
2959 calling convention for classes with a deleted copy constructor and a
2960 trivial move constructor.
2961
2962 Version 13, which first appeared in G++ 8.2, fixes the accidental
2963 change in version 12.
2964
2965 Version 14, which first appeared in G++ 10, corrects the mangling of
2966 the nullptr expression.
2967
2968 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
2969 tag regression.
2970
2971 Version 16, which first appeared in G++ 11, changes the mangling of
2972 @code{__alignof__} to be distinct from that of @code{alignof}, and
2973 dependent operator names.
2974
2975 Version 17, which first appeared in G++ 12, fixes layout of classes
2976 that inherit from aggregate classes with default member initializers
2977 in C++14 and up.
2978
2979 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
2980 that have additional context.
2981
2982 See also @option{-Wabi}.
2983
2984 @item -fabi-compat-version=@var{n}
2985 @opindex fabi-compat-version
2986 On targets that support strong aliases, G++
2987 works around mangling changes by creating an alias with the correct
2988 mangled name when defining a symbol with an incorrect mangled name.
2989 This switch specifies which ABI version to use for the alias.
2990
2991 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
2992 compatibility). If another ABI version is explicitly selected, this
2993 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2994 use @option{-fabi-compat-version=2}.
2995
2996 If this option is not provided but @option{-Wabi=@var{n}} is, that
2997 version is used for compatibility aliases. If this option is provided
2998 along with @option{-Wabi} (without the version), the version from this
2999 option is used for the warning.
3000
3001 @item -fno-access-control
3002 @opindex fno-access-control
3003 @opindex faccess-control
3004 Turn off all access checking. This switch is mainly useful for working
3005 around bugs in the access control code.
3006
3007 @item -faligned-new
3008 @opindex faligned-new
3009 Enable support for C++17 @code{new} of types that require more
3010 alignment than @code{void* ::operator new(std::size_t)} provides. A
3011 numeric argument such as @code{-faligned-new=32} can be used to
3012 specify how much alignment (in bytes) is provided by that function,
3013 but few users will need to override the default of
3014 @code{alignof(std::max_align_t)}.
3015
3016 This flag is enabled by default for @option{-std=c++17}.
3017
3018 @item -fchar8_t
3019 @itemx -fno-char8_t
3020 @opindex fchar8_t
3021 @opindex fno-char8_t
3022 Enable support for @code{char8_t} as adopted for C++20. This includes
3023 the addition of a new @code{char8_t} fundamental type, changes to the
3024 types of UTF-8 string and character literals, new signatures for
3025 user-defined literals, associated standard library updates, and new
3026 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3027
3028 This option enables functions to be overloaded for ordinary and UTF-8
3029 strings:
3030
3031 @smallexample
3032 int f(const char *); // #1
3033 int f(const char8_t *); // #2
3034 int v1 = f("text"); // Calls #1
3035 int v2 = f(u8"text"); // Calls #2
3036 @end smallexample
3037
3038 @noindent
3039 and introduces new signatures for user-defined literals:
3040
3041 @smallexample
3042 int operator""_udl1(char8_t);
3043 int v3 = u8'x'_udl1;
3044 int operator""_udl2(const char8_t*, std::size_t);
3045 int v4 = u8"text"_udl2;
3046 template<typename T, T...> int operator""_udl3();
3047 int v5 = u8"text"_udl3;
3048 @end smallexample
3049
3050 @noindent
3051 The change to the types of UTF-8 string and character literals introduces
3052 incompatibilities with ISO C++11 and later standards. For example, the
3053 following code is well-formed under ISO C++11, but is ill-formed when
3054 @option{-fchar8_t} is specified.
3055
3056 @smallexample
3057 char ca[] = u8"xx"; // error: char-array initialized from wide
3058 // string
3059 const char *cp = u8"xx";// error: invalid conversion from
3060 // `const char8_t*' to `const char*'
3061 int f(const char*);
3062 auto v = f(u8"xx"); // error: invalid conversion from
3063 // `const char8_t*' to `const char*'
3064 std::string s@{u8"xx"@}; // error: no matching function for call to
3065 // `std::basic_string<char>::basic_string()'
3066 using namespace std::literals;
3067 s = u8"xx"s; // error: conversion from
3068 // `basic_string<char8_t>' to non-scalar
3069 // type `basic_string<char>' requested
3070 @end smallexample
3071
3072 @item -fcheck-new
3073 @opindex fcheck-new
3074 Check that the pointer returned by @code{operator new} is non-null
3075 before attempting to modify the storage allocated. This check is
3076 normally unnecessary because the C++ standard specifies that
3077 @code{operator new} only returns @code{0} if it is declared
3078 @code{throw()}, in which case the compiler always checks the
3079 return value even without this option. In all other cases, when
3080 @code{operator new} has a non-empty exception specification, memory
3081 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
3082 @samp{new (nothrow)}.
3083
3084 @item -fconcepts
3085 @itemx -fconcepts-ts
3086 @opindex fconcepts
3087 @opindex fconcepts-ts
3088 Enable support for the C++ Concepts feature for constraining template
3089 arguments. With @option{-std=c++20} and above, Concepts are part of
3090 the language standard, so @option{-fconcepts} defaults to on.
3091
3092 Some constructs that were allowed by the earlier C++ Extensions for
3093 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3094 into the standard, can additionally be enabled by
3095 @option{-fconcepts-ts}.
3096
3097 @item -fconstexpr-depth=@var{n}
3098 @opindex fconstexpr-depth
3099 Set the maximum nested evaluation depth for C++11 constexpr functions
3100 to @var{n}. A limit is needed to detect endless recursion during
3101 constant expression evaluation. The minimum specified by the standard
3102 is 512.
3103
3104 @item -fconstexpr-cache-depth=@var{n}
3105 @opindex fconstexpr-cache-depth
3106 Set the maximum level of nested evaluation depth for C++11 constexpr
3107 functions that will be cached to @var{n}. This is a heuristic that
3108 trades off compilation speed (when the cache avoids repeated
3109 calculations) against memory consumption (when the cache grows very
3110 large from highly recursive evaluations). The default is 8. Very few
3111 users are likely to want to adjust it, but if your code does heavy
3112 constexpr calculations you might want to experiment to find which
3113 value works best for you.
3114
3115 @item -fconstexpr-fp-except
3116 @opindex fconstexpr-fp-except
3117 Annex F of the C standard specifies that IEC559 floating point
3118 exceptions encountered at compile time should not stop compilation.
3119 C++ compilers have historically not followed this guidance, instead
3120 treating floating point division by zero as non-constant even though
3121 it has a well defined value. This flag tells the compiler to give
3122 Annex F priority over other rules saying that a particular operation
3123 is undefined.
3124
3125 @smallexample
3126 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3127 @end smallexample
3128
3129 @item -fconstexpr-loop-limit=@var{n}
3130 @opindex fconstexpr-loop-limit
3131 Set the maximum number of iterations for a loop in C++14 constexpr functions
3132 to @var{n}. A limit is needed to detect infinite loops during
3133 constant expression evaluation. The default is 262144 (1<<18).
3134
3135 @item -fconstexpr-ops-limit=@var{n}
3136 @opindex fconstexpr-ops-limit
3137 Set the maximum number of operations during a single constexpr evaluation.
3138 Even when number of iterations of a single loop is limited with the above limit,
3139 if there are several nested loops and each of them has many iterations but still
3140 smaller than the above limit, or if in a body of some loop or even outside
3141 of a loop too many expressions need to be evaluated, the resulting constexpr
3142 evaluation might take too long.
3143 The default is 33554432 (1<<25).
3144
3145 @item -fcontracts
3146 @opindex fcontracts
3147 Enable experimental support for the C++ Contracts feature, as briefly
3148 added to and then removed from the C++20 working paper (N4820). The
3149 implementation also includes proposed enhancements from papers P1290,
3150 P1332, and P1429. This functionality is intended mostly for those
3151 interested in experimentation towards refining the feature to get it
3152 into shape for a future C++ standard.
3153
3154 On violation of a checked contract, the violation handler is called.
3155 Users can replace the violation handler by defining
3156 @smallexample
3157 void handle_contract_violation (const std::experimental::contract_violation&);
3158 @end smallexample
3159
3160 There are different sets of additional flags that can be used together
3161 to specify which contracts will be checked and how, for N4820
3162 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3163 used together.
3164
3165 @table @gcctabopt
3166 @item -fcontract-mode=[on|off]
3167 @opindex fcontract-mode
3168 Control whether any contracts have any semantics at all. Defaults to on.
3169
3170 @item -fcontract-assumption-mode=[on|off]
3171 @opindex fcontract-assumption-mode
3172 [N4820] Control whether contracts with level @samp{axiom}
3173 should have the assume semantic. Defaults to on.
3174
3175 @item -fcontract-build-level=[off|default|audit]
3176 @opindex fcontract-build-level
3177 [N4820] Specify which level of contracts to generate checks
3178 for. Defaults to @samp{default}.
3179
3180 @item -fcontract-continuation-mode=[on|off]
3181 @opindex fcontract-continuation-mode
3182 [N4820] Control whether to allow the program to continue executing
3183 after a contract violation. That is, do checked contracts have the
3184 @samp{maybe} semantic described below rather than the @samp{never}
3185 semantic. Defaults to off.
3186
3187 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3188 @opindex fcontract-role
3189 [P1332] Specify the concrete semantics for each contract level
3190 of a particular contract role.
3191
3192 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3193 [P1429] Specify the concrete semantic for a particular
3194 contract level.
3195
3196 @item -fcontract-strict-declarations=[on|off]
3197 @opindex fcontract-strict-declarations
3198 Control whether to reject adding contracts to a function after its
3199 first declaration. Defaults to off.
3200 @end table
3201
3202 The possible concrete semantics for that can be specified with
3203 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3204
3205 @table @code
3206 @item ignore
3207 This contract has no effect.
3208
3209 @item assume
3210 This contract is treated like C++23 @code{[[assume]]}.
3211
3212 @item check_never_continue
3213 @itemx never
3214 @itemx abort
3215 This contract is checked. If it fails, the violation handler is
3216 called. If the handler returns, @code{std::terminate} is called.
3217
3218 @item check_maybe_continue
3219 @itemx maybe
3220 This contract is checked. If it fails, the violation handler is
3221 called. If the handler returns, execution continues normally.
3222 @end table
3223
3224 @item -fcoroutines
3225 @opindex fcoroutines
3226 Enable support for the C++ coroutines extension (experimental).
3227
3228 @item -fno-elide-constructors
3229 @opindex fno-elide-constructors
3230 @opindex felide-constructors
3231 The C++ standard allows an implementation to omit creating a temporary
3232 that is only used to initialize another object of the same type.
3233 Specifying this option disables that optimization, and forces G++ to
3234 call the copy constructor in all cases. This option also causes G++
3235 to call trivial member functions which otherwise would be expanded inline.
3236
3237 In C++17, the compiler is required to omit these temporaries, but this
3238 option still affects trivial member functions.
3239
3240 @item -fno-enforce-eh-specs
3241 @opindex fno-enforce-eh-specs
3242 @opindex fenforce-eh-specs
3243 Don't generate code to check for violation of exception specifications
3244 at run time. This option violates the C++ standard, but may be useful
3245 for reducing code size in production builds, much like defining
3246 @code{NDEBUG}. This does not give user code permission to throw
3247 exceptions in violation of the exception specifications; the compiler
3248 still optimizes based on the specifications, so throwing an
3249 unexpected exception results in undefined behavior at run time.
3250
3251 @item -fextern-tls-init
3252 @itemx -fno-extern-tls-init
3253 @opindex fextern-tls-init
3254 @opindex fno-extern-tls-init
3255 The C++11 and OpenMP standards allow @code{thread_local} and
3256 @code{threadprivate} variables to have dynamic (runtime)
3257 initialization. To support this, any use of such a variable goes
3258 through a wrapper function that performs any necessary initialization.
3259 When the use and definition of the variable are in the same
3260 translation unit, this overhead can be optimized away, but when the
3261 use is in a different translation unit there is significant overhead
3262 even if the variable doesn't actually need dynamic initialization. If
3263 the programmer can be sure that no use of the variable in a
3264 non-defining TU needs to trigger dynamic initialization (either
3265 because the variable is statically initialized, or a use of the
3266 variable in the defining TU will be executed before any uses in
3267 another TU), they can avoid this overhead with the
3268 @option{-fno-extern-tls-init} option.
3269
3270 On targets that support symbol aliases, the default is
3271 @option{-fextern-tls-init}. On targets that do not support symbol
3272 aliases, the default is @option{-fno-extern-tls-init}.
3273
3274 @item -ffold-simple-inlines
3275 @itemx -fno-fold-simple-inlines
3276 @opindex ffold-simple-inlines
3277 @opindex fno-fold-simple-inlines
3278 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3279 @code{std::addressof} and @code{std::as_const}. In contrast to inlining, this
3280 means no debug information will be generated for such calls. Since these
3281 functions are rarely interesting to debug, this flag is enabled by default
3282 unless @option{-fno-inline} is active.
3283
3284 @item -fno-gnu-keywords
3285 @opindex fno-gnu-keywords
3286 @opindex fgnu-keywords
3287 Do not recognize @code{typeof} as a keyword, so that code can use this
3288 word as an identifier. You can use the keyword @code{__typeof__} instead.
3289 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3290 @option{-std=c++98}, @option{-std=c++11}, etc.
3291
3292 @item -fimplicit-constexpr
3293 @opindex fimplicit-constexpr
3294 Make inline functions implicitly constexpr, if they satisfy the
3295 requirements for a constexpr function. This option can be used in
3296 C++14 mode or later. This can result in initialization changing from
3297 dynamic to static and other optimizations.
3298
3299 @item -fno-implicit-templates
3300 @opindex fno-implicit-templates
3301 @opindex fimplicit-templates
3302 Never emit code for non-inline templates that are instantiated
3303 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3304 If you use this option, you must take care to structure your code to
3305 include all the necessary explicit instantiations to avoid getting
3306 undefined symbols at link time.
3307 @xref{Template Instantiation}, for more information.
3308
3309 @item -fno-implicit-inline-templates
3310 @opindex fno-implicit-inline-templates
3311 @opindex fimplicit-inline-templates
3312 Don't emit code for implicit instantiations of inline templates, either.
3313 The default is to handle inlines differently so that compiles with and
3314 without optimization need the same set of explicit instantiations.
3315
3316 @item -fno-implement-inlines
3317 @opindex fno-implement-inlines
3318 @opindex fimplement-inlines
3319 To save space, do not emit out-of-line copies of inline functions
3320 controlled by @code{#pragma implementation}. This causes linker
3321 errors if these functions are not inlined everywhere they are called.
3322
3323 @item -fmodules-ts
3324 @itemx -fno-modules-ts
3325 @opindex fmodules-ts
3326 @opindex fno-modules-ts
3327 Enable support for C++20 modules (@pxref{C++ Modules}). The
3328 @option{-fno-modules-ts} is usually not needed, as that is the
3329 default. Even though this is a C++20 feature, it is not currently
3330 implicitly enabled by selecting that standard version.
3331
3332 @item -fmodule-header
3333 @itemx -fmodule-header=user
3334 @itemx -fmodule-header=system
3335 @opindex fmodule-header
3336 Compile a header file to create an importable header unit.
3337
3338 @item -fmodule-implicit-inline
3339 @opindex fmodule-implicit-inline
3340 Member functions defined in their class definitions are not implicitly
3341 inline for modular code. This is different to traditional C++
3342 behavior, for good reasons. However, it may result in a difficulty
3343 during code porting. This option makes such function definitions
3344 implicitly inline. It does however generate an ABI incompatibility,
3345 so you must use it everywhere or nowhere. (Such definitions outside
3346 of a named module remain implicitly inline, regardless.)
3347
3348 @item -fno-module-lazy
3349 @opindex fno-module-lazy
3350 @opindex fmodule-lazy
3351 Disable lazy module importing and module mapper creation.
3352
3353 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3354 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3355 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3356 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3357 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3358 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3359 @vindex CXX_MODULE_MAPPER @r{environment variable}
3360 @opindex fmodule-mapper
3361 An oracle to query for module name to filename mappings. If
3362 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3363 and if that is unset, an in-process default is provided.
3364
3365 @item -fmodule-only
3366 @opindex fmodule-only
3367 Only emit the Compiled Module Interface, inhibiting any object file.
3368
3369 @item -fms-extensions
3370 @opindex fms-extensions
3371 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3372 int and getting a pointer to member function via non-standard syntax.
3373
3374 @item -fnew-inheriting-ctors
3375 @opindex fnew-inheriting-ctors
3376 Enable the P0136 adjustment to the semantics of C++11 constructor
3377 inheritance. This is part of C++17 but also considered to be a Defect
3378 Report against C++11 and C++14. This flag is enabled by default
3379 unless @option{-fabi-version=10} or lower is specified.
3380
3381 @item -fnew-ttp-matching
3382 @opindex fnew-ttp-matching
3383 Enable the P0522 resolution to Core issue 150, template template
3384 parameters and default arguments: this allows a template with default
3385 template arguments as an argument for a template template parameter
3386 with fewer template parameters. This flag is enabled by default for
3387 @option{-std=c++17}.
3388
3389 @item -fno-nonansi-builtins
3390 @opindex fno-nonansi-builtins
3391 @opindex fnonansi-builtins
3392 Disable built-in declarations of functions that are not mandated by
3393 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
3394 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3395
3396 @item -fnothrow-opt
3397 @opindex fnothrow-opt
3398 Treat a @code{throw()} exception specification as if it were a
3399 @code{noexcept} specification to reduce or eliminate the text size
3400 overhead relative to a function with no exception specification. If
3401 the function has local variables of types with non-trivial
3402 destructors, the exception specification actually makes the
3403 function smaller because the EH cleanups for those variables can be
3404 optimized away. The semantic effect is that an exception thrown out of
3405 a function with such an exception specification results in a call
3406 to @code{terminate} rather than @code{unexpected}.
3407
3408 @item -fno-operator-names
3409 @opindex fno-operator-names
3410 @opindex foperator-names
3411 Do not treat the operator name keywords @code{and}, @code{bitand},
3412 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3413 synonyms as keywords.
3414
3415 @item -fno-optional-diags
3416 @opindex fno-optional-diags
3417 @opindex foptional-diags
3418 Disable diagnostics that the standard says a compiler does not need to
3419 issue. Currently, the only such diagnostic issued by G++ is the one for
3420 a name having multiple meanings within a class.
3421
3422 @item -fpermissive
3423 @opindex fpermissive
3424 Downgrade some diagnostics about nonconformant code from errors to
3425 warnings. Thus, using @option{-fpermissive} allows some
3426 nonconforming code to compile.
3427
3428 @item -fno-pretty-templates
3429 @opindex fno-pretty-templates
3430 @opindex fpretty-templates
3431 When an error message refers to a specialization of a function
3432 template, the compiler normally prints the signature of the
3433 template followed by the template arguments and any typedefs or
3434 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3435 rather than @code{void f(int)}) so that it's clear which template is
3436 involved. When an error message refers to a specialization of a class
3437 template, the compiler omits any template arguments that match
3438 the default template arguments for that template. If either of these
3439 behaviors make it harder to understand the error message rather than
3440 easier, you can use @option{-fno-pretty-templates} to disable them.
3441
3442 @item -fno-rtti
3443 @opindex fno-rtti
3444 @opindex frtti
3445 Disable generation of information about every class with virtual
3446 functions for use by the C++ run-time type identification features
3447 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
3448 of the language, you can save some space by using this flag. Note that
3449 exception handling uses the same information, but G++ generates it as
3450 needed. The @code{dynamic_cast} operator can still be used for casts that
3451 do not require run-time type information, i.e.@: casts to @code{void *} or to
3452 unambiguous base classes.
3453
3454 Mixing code compiled with @option{-frtti} with that compiled with
3455 @option{-fno-rtti} may not work. For example, programs may
3456 fail to link if a class compiled with @option{-fno-rtti} is used as a base
3457 for a class compiled with @option{-frtti}.
3458
3459 @item -fsized-deallocation
3460 @opindex fsized-deallocation
3461 Enable the built-in global declarations
3462 @smallexample
3463 void operator delete (void *, std::size_t) noexcept;
3464 void operator delete[] (void *, std::size_t) noexcept;
3465 @end smallexample
3466 as introduced in C++14. This is useful for user-defined replacement
3467 deallocation functions that, for example, use the size of the object
3468 to make deallocation faster. Enabled by default under
3469 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
3470 warns about places that might want to add a definition.
3471
3472 @item -fstrict-enums
3473 @opindex fstrict-enums
3474 Allow the compiler to optimize using the assumption that a value of
3475 enumerated type can only be one of the values of the enumeration (as
3476 defined in the C++ standard; basically, a value that can be
3477 represented in the minimum number of bits needed to represent all the
3478 enumerators). This assumption may not be valid if the program uses a
3479 cast to convert an arbitrary integer value to the enumerated type.
3480
3481 @item -fstrong-eval-order
3482 @opindex fstrong-eval-order
3483 Evaluate member access, array subscripting, and shift expressions in
3484 left-to-right order, and evaluate assignment in right-to-left order,
3485 as adopted for C++17. Enabled by default with @option{-std=c++17}.
3486 @option{-fstrong-eval-order=some} enables just the ordering of member
3487 access and shift expressions, and is the default without
3488 @option{-std=c++17}.
3489
3490 @item -ftemplate-backtrace-limit=@var{n}
3491 @opindex ftemplate-backtrace-limit
3492 Set the maximum number of template instantiation notes for a single
3493 warning or error to @var{n}. The default value is 10.
3494
3495 @item -ftemplate-depth=@var{n}
3496 @opindex ftemplate-depth
3497 Set the maximum instantiation depth for template classes to @var{n}.
3498 A limit on the template instantiation depth is needed to detect
3499 endless recursions during template class instantiation. ANSI/ISO C++
3500 conforming programs must not rely on a maximum depth greater than 17
3501 (changed to 1024 in C++11). The default value is 900, as the compiler
3502 can run out of stack space before hitting 1024 in some situations.
3503
3504 @item -fno-threadsafe-statics
3505 @opindex fno-threadsafe-statics
3506 @opindex fthreadsafe-statics
3507 Do not emit the extra code to use the routines specified in the C++
3508 ABI for thread-safe initialization of local statics. You can use this
3509 option to reduce code size slightly in code that doesn't need to be
3510 thread-safe.
3511
3512 @item -fuse-cxa-atexit
3513 @opindex fuse-cxa-atexit
3514 Register destructors for objects with static storage duration with the
3515 @code{__cxa_atexit} function rather than the @code{atexit} function.
3516 This option is required for fully standards-compliant handling of static
3517 destructors, but only works if your C library supports
3518 @code{__cxa_atexit}.
3519
3520 @item -fno-use-cxa-get-exception-ptr
3521 @opindex fno-use-cxa-get-exception-ptr
3522 @opindex fuse-cxa-get-exception-ptr
3523 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
3524 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3525 if the runtime routine is not available.
3526
3527 @item -fvisibility-inlines-hidden
3528 @opindex fvisibility-inlines-hidden
3529 This switch declares that the user does not attempt to compare
3530 pointers to inline functions or methods where the addresses of the two functions
3531 are taken in different shared objects.
3532
3533 The effect of this is that GCC may, effectively, mark inline methods with
3534 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3535 appear in the export table of a DSO and do not require a PLT indirection
3536 when used within the DSO@. Enabling this option can have a dramatic effect
3537 on load and link times of a DSO as it massively reduces the size of the
3538 dynamic export table when the library makes heavy use of templates.
3539
3540 The behavior of this switch is not quite the same as marking the
3541 methods as hidden directly, because it does not affect static variables
3542 local to the function or cause the compiler to deduce that
3543 the function is defined in only one shared object.
3544
3545 You may mark a method as having a visibility explicitly to negate the
3546 effect of the switch for that method. For example, if you do want to
3547 compare pointers to a particular inline method, you might mark it as
3548 having default visibility. Marking the enclosing class with explicit
3549 visibility has no effect.
3550
3551 Explicitly instantiated inline methods are unaffected by this option
3552 as their linkage might otherwise cross a shared library boundary.
3553 @xref{Template Instantiation}.
3554
3555 @item -fvisibility-ms-compat
3556 @opindex fvisibility-ms-compat
3557 This flag attempts to use visibility settings to make GCC's C++
3558 linkage model compatible with that of Microsoft Visual Studio.
3559
3560 The flag makes these changes to GCC's linkage model:
3561
3562 @enumerate
3563 @item
3564 It sets the default visibility to @code{hidden}, like
3565 @option{-fvisibility=hidden}.
3566
3567 @item
3568 Types, but not their members, are not hidden by default.
3569
3570 @item
3571 The One Definition Rule is relaxed for types without explicit
3572 visibility specifications that are defined in more than one
3573 shared object: those declarations are permitted if they are
3574 permitted when this option is not used.
3575 @end enumerate
3576
3577 In new code it is better to use @option{-fvisibility=hidden} and
3578 export those classes that are intended to be externally visible.
3579 Unfortunately it is possible for code to rely, perhaps accidentally,
3580 on the Visual Studio behavior.
3581
3582 Among the consequences of these changes are that static data members
3583 of the same type with the same name but defined in different shared
3584 objects are different, so changing one does not change the other;
3585 and that pointers to function members defined in different shared
3586 objects may not compare equal. When this flag is given, it is a
3587 violation of the ODR to define types with the same name differently.
3588
3589 @item -fno-weak
3590 @opindex fno-weak
3591 @opindex fweak
3592 Do not use weak symbol support, even if it is provided by the linker.
3593 By default, G++ uses weak symbols if they are available. This
3594 option exists only for testing, and should not be used by end-users;
3595 it results in inferior code and has no benefits. This option may
3596 be removed in a future release of G++.
3597
3598 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3599 @opindex fext-numeric-literals
3600 @opindex fno-ext-numeric-literals
3601 Accept imaginary, fixed-point, or machine-defined
3602 literal number suffixes as GNU extensions.
3603 When this option is turned off these suffixes are treated
3604 as C++11 user-defined literal numeric suffixes.
3605 This is on by default for all pre-C++11 dialects and all GNU dialects:
3606 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3607 @option{-std=gnu++14}.
3608 This option is off by default
3609 for ISO C++11 onwards (@option{-std=c++11}, ...).
3610
3611 @item -nostdinc++
3612 @opindex nostdinc++
3613 Do not search for header files in the standard directories specific to
3614 C++, but do still search the other standard directories. (This option
3615 is used when building the C++ library.)
3616
3617 @item -flang-info-include-translate
3618 @itemx -flang-info-include-translate-not
3619 @itemx -flang-info-include-translate=@var{header}
3620 @opindex flang-info-include-translate
3621 @opindex flang-info-include-translate-not
3622 Inform of include translation events. The first will note accepted
3623 include translations, the second will note declined include
3624 translations. The @var{header} form will inform of include
3625 translations relating to that specific header. If @var{header} is of
3626 the form @code{"user"} or @code{<system>} it will be resolved to a
3627 specific user or system header using the include path.
3628
3629 @item -flang-info-module-cmi
3630 @itemx -flang-info-module-cmi=@var{module}
3631 @opindex flang-info-module-cmi
3632 Inform of Compiled Module Interface pathnames. The first will note
3633 all read CMI pathnames. The @var{module} form will not reading a
3634 specific module's CMI. @var{module} may be a named module or a
3635 header-unit (the latter indicated by either being a pathname containing
3636 directory separators or enclosed in @code{<>} or @code{""}).
3637
3638 @item -stdlib=@var{libstdc++,libc++}
3639 @opindex stdlib
3640 When G++ is configured to support this option, it allows specification of
3641 alternate C++ runtime libraries. Two options are available: @var{libstdc++}
3642 (the default, native C++ runtime for G++) and @var{libc++} which is the
3643 C++ runtime installed on some operating systems (e.g. Darwin versions from
3644 Darwin11 onwards). The option switches G++ to use the headers from the
3645 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3646 when a C++ runtime is required for linking.
3647 @end table
3648
3649 In addition, these warning options have meanings only for C++ programs:
3650
3651 @table @gcctabopt
3652 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3653 @opindex Wabi-tag
3654 Warn when a type with an ABI tag is used in a context that does not
3655 have that ABI tag. See @ref{C++ Attributes} for more information
3656 about ABI tags.
3657
3658 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3659 @opindex Wcomma-subscript
3660 @opindex Wno-comma-subscript
3661 Warn about uses of a comma expression within a subscripting expression.
3662 This usage was deprecated in C++20 and is going to be removed in C++23.
3663 However, a comma expression wrapped in @code{( )} is not deprecated. Example:
3664
3665 @smallexample
3666 @group
3667 void f(int *a, int b, int c) @{
3668 a[b,c]; // deprecated in C++20, invalid in C++23
3669 a[(b,c)]; // OK
3670 @}
3671 @end group
3672 @end smallexample
3673
3674 In C++23 it is valid to have comma separated expressions in a subscript
3675 when an overloaded subscript operator is found and supports the right
3676 number and types of arguments. G++ will accept the formerly valid syntax
3677 for code that is not valid in C++23 but used to be valid but deprecated
3678 in C++20 with a pedantic warning that can be disabled with
3679 @option{-Wno-comma-subscript}.
3680
3681 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3682 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3683
3684 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3685 @opindex Wctad-maybe-unsupported
3686 @opindex Wno-ctad-maybe-unsupported
3687 Warn when performing class template argument deduction (CTAD) on a type with
3688 no explicitly written deduction guides. This warning will point out cases
3689 where CTAD succeeded only because the compiler synthesized the implicit
3690 deduction guides, which might not be what the programmer intended. Certain
3691 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3692 types that are designed to support CTAD. This warning can be suppressed with
3693 the following pattern:
3694
3695 @smallexample
3696 struct allow_ctad_t; // any name works
3697 template <typename T> struct S @{
3698 S(T) @{ @}
3699 @};
3700 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
3701 @end smallexample
3702
3703 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3704 @opindex Wctor-dtor-privacy
3705 @opindex Wno-ctor-dtor-privacy
3706 Warn when a class seems unusable because all the constructors or
3707 destructors in that class are private, and it has neither friends nor
3708 public static member functions. Also warn if there are no non-private
3709 methods, and there's at least one private member function that isn't
3710 a constructor or destructor.
3711
3712 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3713 @opindex Wdangling-reference
3714 @opindex Wno-dangling-reference
3715 Warn when a reference is bound to a temporary whose lifetime has ended.
3716 For example:
3717
3718 @smallexample
3719 int n = 1;
3720 const int& r = std::max(n - 1, n + 1); // r is dangling
3721 @end smallexample
3722
3723 In the example above, two temporaries are created, one for each
3724 argument, and a reference to one of the temporaries is returned.
3725 However, both temporaries are destroyed at the end of the full
3726 expression, so the reference @code{r} is dangling. This warning
3727 also detects dangling references in member initializer lists:
3728
3729 @smallexample
3730 const int& f(const int& i) @{ return i; @}
3731 struct S @{
3732 const int &r; // r is dangling
3733 S() : r(f(10)) @{ @}
3734 @};
3735 @end smallexample
3736
3737 Member functions are checked as well, but only their object argument:
3738
3739 @smallexample
3740 struct S @{
3741 const S& self () @{ return *this; @}
3742 @};
3743 const S& s = S().self(); // s is dangling
3744 @end smallexample
3745
3746 Certain functions are safe in this respect, for example @code{std::use_facet}:
3747 they take and return a reference, but they don't return one of its arguments,
3748 which can fool the warning. Such functions can be excluded from the warning
3749 by wrapping them in a @code{#pragma}:
3750
3751 @smallexample
3752 #pragma GCC diagnostic push
3753 #pragma GCC diagnostic ignored "-Wdangling-reference"
3754 const T& foo (const T&) @{ @dots{} @}
3755 #pragma GCC diagnostic pop
3756 @end smallexample
3757
3758 @option{-Wdangling-reference} also warns about code like
3759
3760 @smallexample
3761 auto p = std::minmax(1, 2);
3762 @end smallexample
3763
3764 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3765 both references dangle after the end of the full expression that contains
3766 the call to @code{std::minmax}.
3767
3768 This warning is enabled by @option{-Wall}.
3769
3770 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3771 @opindex Wdelete-non-virtual-dtor
3772 @opindex Wno-delete-non-virtual-dtor
3773 Warn when @code{delete} is used to destroy an instance of a class that
3774 has virtual functions and non-virtual destructor. It is unsafe to delete
3775 an instance of a derived class through a pointer to a base class if the
3776 base class does not have a virtual destructor. This warning is enabled
3777 by @option{-Wall}.
3778
3779 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3780 @opindex Wdeprecated-copy
3781 @opindex Wno-deprecated-copy
3782 Warn that the implicit declaration of a copy constructor or copy
3783 assignment operator is deprecated if the class has a user-provided
3784 copy constructor or copy assignment operator, in C++11 and up. This
3785 warning is enabled by @option{-Wextra}. With
3786 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3787 user-provided destructor.
3788
3789 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3790 @opindex Wdeprecated-enum-enum-conversion
3791 @opindex Wno-deprecated-enum-enum-conversion
3792 Disable the warning about the case when the usual arithmetic conversions
3793 are applied on operands where one is of enumeration type and the other is
3794 of a different enumeration type. This conversion was deprecated in C++20.
3795 For example:
3796
3797 @smallexample
3798 enum E1 @{ e @};
3799 enum E2 @{ f @};
3800 int k = f - e;
3801 @end smallexample
3802
3803 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3804 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3805 by @option{-Wenum-conversion}.
3806
3807 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3808 @opindex Wdeprecated-enum-float-conversion
3809 @opindex Wno-deprecated-enum-float-conversion
3810 Disable the warning about the case when the usual arithmetic conversions
3811 are applied on operands where one is of enumeration type and the other is
3812 of a floating-point type. This conversion was deprecated in C++20. For
3813 example:
3814
3815 @smallexample
3816 enum E1 @{ e @};
3817 enum E2 @{ f @};
3818 bool b = e <= 3.7;
3819 @end smallexample
3820
3821 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3822 @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
3823 by @option{-Wenum-conversion}.
3824
3825 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3826 @opindex Winit-list-lifetime
3827 @opindex Wno-init-list-lifetime
3828 Do not warn about uses of @code{std::initializer_list} that are likely
3829 to result in dangling pointers. Since the underlying array for an
3830 @code{initializer_list} is handled like a normal C++ temporary object,
3831 it is easy to inadvertently keep a pointer to the array past the end
3832 of the array's lifetime. For example:
3833
3834 @itemize @bullet
3835 @item
3836 If a function returns a temporary @code{initializer_list}, or a local
3837 @code{initializer_list} variable, the array's lifetime ends at the end
3838 of the return statement, so the value returned has a dangling pointer.
3839
3840 @item
3841 If a new-expression creates an @code{initializer_list}, the array only
3842 lives until the end of the enclosing full-expression, so the
3843 @code{initializer_list} in the heap has a dangling pointer.
3844
3845 @item
3846 When an @code{initializer_list} variable is assigned from a
3847 brace-enclosed initializer list, the temporary array created for the
3848 right side of the assignment only lives until the end of the
3849 full-expression, so at the next statement the @code{initializer_list}
3850 variable has a dangling pointer.
3851
3852 @smallexample
3853 // li's initial underlying array lives as long as li
3854 std::initializer_list<int> li = @{ 1,2,3 @};
3855 // assignment changes li to point to a temporary array
3856 li = @{ 4, 5 @};
3857 // now the temporary is gone and li has a dangling pointer
3858 int i = li.begin()[0] // undefined behavior
3859 @end smallexample
3860
3861 @item
3862 When a list constructor stores the @code{begin} pointer from the
3863 @code{initializer_list} argument, this doesn't extend the lifetime of
3864 the array, so if a class variable is constructed from a temporary
3865 @code{initializer_list}, the pointer is left dangling by the end of
3866 the variable declaration statement.
3867
3868 @end itemize
3869
3870 @item -Winvalid-constexpr
3871 @opindex Winvalid-constexpr
3872 @opindex Wno-invalid-constexpr
3873
3874 Warn when a function never produces a constant expression. In C++20
3875 and earlier, for every @code{constexpr} function and function template,
3876 there must be at least one set of function arguments in at least one
3877 instantiation such that an invocation of the function or constructor
3878 could be an evaluated subexpression of a core constant expression.
3879 C++23 removed this restriction, so it's possible to have a function
3880 or a function template marked @code{constexpr} for which no invocation
3881 satisfies the requirements of a core constant expression.
3882
3883 This warning is enabled as a pedantic warning by default in C++20 and
3884 earlier. In C++23, @option{-Winvalid-constexpr} can be turned on, in
3885 which case it will be an ordinary warning. For example:
3886
3887 @smallexample
3888 void f (int& i);
3889 constexpr void
3890 g (int& i)
3891 @{
3892 f(i); // warns by default in C++20, in C++23 only with -Winvalid-constexpr
3893 @}
3894 @end smallexample
3895
3896 @item -Winvalid-imported-macros
3897 @opindex Winvalid-imported-macros
3898 @opindex Wno-invalid-imported-macros
3899 Verify all imported macro definitions are valid at the end of
3900 compilation. This is not enabled by default, as it requires
3901 additional processing to determine. It may be useful when preparing
3902 sets of header-units to ensure consistent macros.
3903
3904 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3905 @opindex Wliteral-suffix
3906 @opindex Wno-literal-suffix
3907 Do not warn when a string or character literal is followed by a
3908 ud-suffix which does not begin with an underscore. As a conforming
3909 extension, GCC treats such suffixes as separate preprocessing tokens
3910 in order to maintain backwards compatibility with code that uses
3911 formatting macros from @code{<inttypes.h>}. For example:
3912
3913 @smallexample
3914 #define __STDC_FORMAT_MACROS
3915 #include <inttypes.h>
3916 #include <stdio.h>
3917
3918 int main() @{
3919 int64_t i64 = 123;
3920 printf("My int64: %" PRId64"\n", i64);
3921 @}
3922 @end smallexample
3923
3924 In this case, @code{PRId64} is treated as a separate preprocessing token.
3925
3926 This option also controls warnings when a user-defined literal
3927 operator is declared with a literal suffix identifier that doesn't
3928 begin with an underscore. Literal suffix identifiers that don't begin
3929 with an underscore are reserved for future standardization.
3930
3931 These warnings are enabled by default.
3932
3933 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3934 @opindex Wnarrowing
3935 @opindex Wno-narrowing
3936 For C++11 and later standards, narrowing conversions are diagnosed by default,
3937 as required by the standard. A narrowing conversion from a constant produces
3938 an error, and a narrowing conversion from a non-constant produces a warning,
3939 but @option{-Wno-narrowing} suppresses the diagnostic.
3940 Note that this does not affect the meaning of well-formed code;
3941 narrowing conversions are still considered ill-formed in SFINAE contexts.
3942
3943 With @option{-Wnarrowing} in C++98, warn when a narrowing
3944 conversion prohibited by C++11 occurs within
3945 @samp{@{ @}}, e.g.
3946
3947 @smallexample
3948 int i = @{ 2.2 @}; // error: narrowing from double to int
3949 @end smallexample
3950
3951 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3952
3953 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3954 @opindex Wnoexcept
3955 @opindex Wno-noexcept
3956 Warn when a noexcept-expression evaluates to false because of a call
3957 to a function that does not have a non-throwing exception
3958 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3959 the compiler to never throw an exception.
3960
3961 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3962 @opindex Wnoexcept-type
3963 @opindex Wno-noexcept-type
3964 Warn if the C++17 feature making @code{noexcept} part of a function
3965 type changes the mangled name of a symbol relative to C++14. Enabled
3966 by @option{-Wabi} and @option{-Wc++17-compat}.
3967
3968 As an example:
3969
3970 @smallexample
3971 template <class T> void f(T t) @{ t(); @};
3972 void g() noexcept;
3973 void h() @{ f(g); @}
3974 @end smallexample
3975
3976 @noindent
3977 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3978 C++17 it calls @code{f<void(*)()noexcept>}.
3979
3980 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3981 @opindex Wclass-memaccess
3982 @opindex Wno-class-memaccess
3983 Warn when the destination of a call to a raw memory function such as
3984 @code{memset} or @code{memcpy} is an object of class type, and when writing
3985 into such an object might bypass the class non-trivial or deleted constructor
3986 or copy assignment, violate const-correctness or encapsulation, or corrupt
3987 virtual table pointers. Modifying the representation of such objects may
3988 violate invariants maintained by member functions of the class. For example,
3989 the call to @code{memset} below is undefined because it modifies a non-trivial
3990 class object and is, therefore, diagnosed. The safe way to either initialize
3991 or clear the storage of objects of such types is by using the appropriate
3992 constructor or assignment operator, if one is available.
3993 @smallexample
3994 std::string str = "abc";
3995 memset (&str, 0, sizeof str);
3996 @end smallexample
3997 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3998 Explicitly casting the pointer to the class object to @code{void *} or
3999 to a type that can be safely accessed by the raw memory function suppresses
4000 the warning.
4001
4002 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4003 @opindex Wnon-virtual-dtor
4004 @opindex Wno-non-virtual-dtor
4005 Warn when a class has virtual functions and an accessible non-virtual
4006 destructor itself or in an accessible polymorphic base class, in which
4007 case it is possible but unsafe to delete an instance of a derived
4008 class through a pointer to the class itself or base class. This
4009 warning is automatically enabled if @option{-Weffc++} is specified.
4010 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4011 should be preferred because it warns about the unsafe cases without false
4012 positives.
4013
4014 @item -Wregister @r{(C++ and Objective-C++ only)}
4015 @opindex Wregister
4016 @opindex Wno-register
4017 Warn on uses of the @code{register} storage class specifier, except
4018 when it is part of the GNU @ref{Explicit Register Variables} extension.
4019 The use of the @code{register} keyword as storage class specifier has
4020 been deprecated in C++11 and removed in C++17.
4021 Enabled by default with @option{-std=c++17}.
4022
4023 @item -Wreorder @r{(C++ and Objective-C++ only)}
4024 @opindex Wreorder
4025 @opindex Wno-reorder
4026 @cindex reordering, warning
4027 @cindex warning for reordering of member initializers
4028 Warn when the order of member initializers given in the code does not
4029 match the order in which they must be executed. For instance:
4030
4031 @smallexample
4032 struct A @{
4033 int i;
4034 int j;
4035 A(): j (0), i (1) @{ @}
4036 @};
4037 @end smallexample
4038
4039 @noindent
4040 The compiler rearranges the member initializers for @code{i}
4041 and @code{j} to match the declaration order of the members, emitting
4042 a warning to that effect. This warning is enabled by @option{-Wall}.
4043
4044 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4045 @opindex Wpessimizing-move
4046 @opindex Wno-pessimizing-move
4047 This warning warns when a call to @code{std::move} prevents copy
4048 elision. A typical scenario when copy elision can occur is when returning in
4049 a function with a class return type, when the expression being returned is the
4050 name of a non-volatile automatic object, and is not a function parameter, and
4051 has the same type as the function return type.
4052
4053 @smallexample
4054 struct T @{
4055 @dots{}
4056 @};
4057 T fn()
4058 @{
4059 T t;
4060 @dots{}
4061 return std::move (t);
4062 @}
4063 @end smallexample
4064
4065 But in this example, the @code{std::move} call prevents copy elision.
4066
4067 This warning is enabled by @option{-Wall}.
4068
4069 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4070 @opindex Wredundant-move
4071 @opindex Wno-redundant-move
4072 This warning warns about redundant calls to @code{std::move}; that is, when
4073 a move operation would have been performed even without the @code{std::move}
4074 call. This happens because the compiler is forced to treat the object as if
4075 it were an rvalue in certain situations such as returning a local variable,
4076 where copy elision isn't applicable. Consider:
4077
4078 @smallexample
4079 struct T @{
4080 @dots{}
4081 @};
4082 T fn(T t)
4083 @{
4084 @dots{}
4085 return std::move (t);
4086 @}
4087 @end smallexample
4088
4089 Here, the @code{std::move} call is redundant. Because G++ implements Core
4090 Issue 1579, another example is:
4091
4092 @smallexample
4093 struct T @{ // convertible to U
4094 @dots{}
4095 @};
4096 struct U @{
4097 @dots{}
4098 @};
4099 U fn()
4100 @{
4101 T t;
4102 @dots{}
4103 return std::move (t);
4104 @}
4105 @end smallexample
4106 In this example, copy elision isn't applicable because the type of the
4107 expression being returned and the function return type differ, yet G++
4108 treats the return value as if it were designated by an rvalue.
4109
4110 This warning is enabled by @option{-Wextra}.
4111
4112 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4113 @opindex Wrange-loop-construct
4114 @opindex Wno-range-loop-construct
4115 This warning warns when a C++ range-based for-loop is creating an unnecessary
4116 copy. This can happen when the range declaration is not a reference, but
4117 probably should be. For example:
4118
4119 @smallexample
4120 struct S @{ char arr[128]; @};
4121 void fn () @{
4122 S arr[5];
4123 for (const auto x : arr) @{ @dots{} @}
4124 @}
4125 @end smallexample
4126
4127 It does not warn when the type being copied is a trivially-copyable type whose
4128 size is less than 64 bytes.
4129
4130 This warning also warns when a loop variable in a range-based for-loop is
4131 initialized with a value of a different type resulting in a copy. For example:
4132
4133 @smallexample
4134 void fn() @{
4135 int arr[10];
4136 for (const double &x : arr) @{ @dots{} @}
4137 @}
4138 @end smallexample
4139
4140 In the example above, in every iteration of the loop a temporary value of
4141 type @code{double} is created and destroyed, to which the reference
4142 @code{const double &} is bound.
4143
4144 This warning is enabled by @option{-Wall}.
4145
4146 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4147 @opindex Wredundant-tags
4148 @opindex Wno-redundant-tags
4149 Warn about redundant class-key and enum-key in references to class types
4150 and enumerated types in contexts where the key can be eliminated without
4151 causing an ambiguity. For example:
4152
4153 @smallexample
4154 struct foo;
4155 struct foo *p; // warn that keyword struct can be eliminated
4156 @end smallexample
4157
4158 @noindent
4159 On the other hand, in this example there is no warning:
4160
4161 @smallexample
4162 struct foo;
4163 void foo (); // "hides" struct foo
4164 void bar (struct foo&); // no warning, keyword struct is necessary
4165 @end smallexample
4166
4167 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4168 @opindex Wsubobject-linkage
4169 @opindex Wno-subobject-linkage
4170 Do not warn
4171 if a class type has a base or a field whose type uses the anonymous
4172 namespace or depends on a type with no linkage. If a type A depends on
4173 a type B with no or internal linkage, defining it in multiple
4174 translation units would be an ODR violation because the meaning of B
4175 is different in each translation unit. If A only appears in a single
4176 translation unit, the best way to silence the warning is to give it
4177 internal linkage by putting it in an anonymous namespace as well. The
4178 compiler doesn't give this warning for types defined in the main .C
4179 file, as those are unlikely to have multiple definitions.
4180 @option{-Wsubobject-linkage} is enabled by default.
4181
4182 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4183 @opindex Weffc++
4184 @opindex Wno-effc++
4185 Warn about violations of the following style guidelines from Scott Meyers'
4186 @cite{Effective C++} series of books:
4187
4188 @itemize @bullet
4189 @item
4190 Define a copy constructor and an assignment operator for classes
4191 with dynamically-allocated memory.
4192
4193 @item
4194 Prefer initialization to assignment in constructors.
4195
4196 @item
4197 Have @code{operator=} return a reference to @code{*this}.
4198
4199 @item
4200 Don't try to return a reference when you must return an object.
4201
4202 @item
4203 Distinguish between prefix and postfix forms of increment and
4204 decrement operators.
4205
4206 @item
4207 Never overload @code{&&}, @code{||}, or @code{,}.
4208
4209 @end itemize
4210
4211 This option also enables @option{-Wnon-virtual-dtor}, which is also
4212 one of the effective C++ recommendations. However, the check is
4213 extended to warn about the lack of virtual destructor in accessible
4214 non-polymorphic bases classes too.
4215
4216 When selecting this option, be aware that the standard library
4217 headers do not obey all of these guidelines; use @samp{grep -v}
4218 to filter out those warnings.
4219
4220 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4221 @opindex Wexceptions
4222 @opindex Wno-exceptions
4223 Disable the warning about the case when an exception handler is shadowed by
4224 another handler, which can point out a wrong ordering of exception handlers.
4225
4226 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4227 @opindex Wstrict-null-sentinel
4228 @opindex Wno-strict-null-sentinel
4229 Warn about the use of an uncasted @code{NULL} as sentinel. When
4230 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4231 to @code{__null}. Although it is a null pointer constant rather than a
4232 null pointer, it is guaranteed to be of the same size as a pointer.
4233 But this use is not portable across different compilers.
4234
4235 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4236 @opindex Wno-non-template-friend
4237 @opindex Wnon-template-friend
4238 Disable warnings when non-template friend functions are declared
4239 within a template. In very old versions of GCC that predate implementation
4240 of the ISO standard, declarations such as
4241 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4242 could be interpreted as a particular specialization of a template
4243 function; the warning exists to diagnose compatibility problems,
4244 and is enabled by default.
4245
4246 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4247 @opindex Wold-style-cast
4248 @opindex Wno-old-style-cast
4249 Warn if an old-style (C-style) cast to a non-void type is used within
4250 a C++ program. The new-style casts (@code{dynamic_cast},
4251 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4252 less vulnerable to unintended effects and much easier to search for.
4253
4254 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4255 @itemx -Woverloaded-virtual=@var{n}
4256 @opindex Woverloaded-virtual
4257 @opindex Wno-overloaded-virtual
4258 @cindex overloaded virtual function, warning
4259 @cindex warning for overloaded virtual function
4260 Warn when a function declaration hides virtual functions from a
4261 base class. For example, in:
4262
4263 @smallexample
4264 struct A @{
4265 virtual void f();
4266 @};
4267
4268 struct B: public A @{
4269 void f(int); // does not override
4270 @};
4271 @end smallexample
4272
4273 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4274 like:
4275
4276 @smallexample
4277 B* b;
4278 b->f();
4279 @end smallexample
4280
4281 @noindent
4282 fails to compile.
4283
4284 The optional level suffix controls the behavior when all the
4285 declarations in the derived class override virtual functions in the
4286 base class, even if not all of the base functions are overridden:
4287
4288 @smallexample
4289 struct C @{
4290 virtual void f();
4291 virtual void f(int);
4292 @};
4293
4294 struct D: public C @{
4295 void f(int); // does override
4296 @}
4297 @end smallexample
4298
4299 This pattern is less likely to be a mistake; if D is only used
4300 virtually, the user might have decided that the base class semantics
4301 for some of the overloads are fine.
4302
4303 At level 1, this case does not warn; at level 2, it does.
4304 @option{-Woverloaded-virtual} by itself selects level 2. Level 1 is
4305 included in @option{-Wall}.
4306
4307 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4308 @opindex Wno-pmf-conversions
4309 @opindex Wpmf-conversions
4310 Disable the diagnostic for converting a bound pointer to member function
4311 to a plain pointer.
4312
4313 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4314 @opindex Wsign-promo
4315 @opindex Wno-sign-promo
4316 Warn when overload resolution chooses a promotion from unsigned or
4317 enumerated type to a signed type, over a conversion to an unsigned type of
4318 the same size. Previous versions of G++ tried to preserve
4319 unsignedness, but the standard mandates the current behavior.
4320
4321 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4322 @opindex Wtemplates
4323 @opindex Wno-templates
4324 Warn when a primary template declaration is encountered. Some coding
4325 rules disallow templates, and this may be used to enforce that rule.
4326 The warning is inactive inside a system header file, such as the STL, so
4327 one can still use the STL. One may also instantiate or specialize
4328 templates.
4329
4330 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4331 @opindex Wmismatched-new-delete
4332 @opindex Wno-mismatched-new-delete
4333 Warn for mismatches between calls to @code{operator new} or @code{operator
4334 delete} and the corresponding call to the allocation or deallocation function.
4335 This includes invocations of C++ @code{operator delete} with pointers
4336 returned from either mismatched forms of @code{operator new}, or from other
4337 functions that allocate objects for which the @code{operator delete} isn't
4338 a suitable deallocator, as well as calls to other deallocation functions
4339 with pointers returned from @code{operator new} for which the deallocation
4340 function isn't suitable.
4341
4342 For example, the @code{delete} expression in the function below is diagnosed
4343 because it doesn't match the array form of the @code{new} expression
4344 the pointer argument was returned from. Similarly, the call to @code{free}
4345 is also diagnosed.
4346
4347 @smallexample
4348 void f ()
4349 @{
4350 int *a = new int[n];
4351 delete a; // warning: mismatch in array forms of expressions
4352
4353 char *p = new char[n];
4354 free (p); // warning: mismatch between new and free
4355 @}
4356 @end smallexample
4357
4358 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4359 involving allocation and deallocation functions other than @code{operator
4360 new} and @code{operator delete}.
4361
4362 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4363
4364 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4365 @opindex Wmismatched-tags
4366 @opindex Wno-mismatched-tags
4367 Warn for declarations of structs, classes, and class templates and their
4368 specializations with a class-key that does not match either the definition
4369 or the first declaration if no definition is provided.
4370
4371 For example, the declaration of @code{struct Object} in the argument list
4372 of @code{draw} triggers the warning. To avoid it, either remove the redundant
4373 class-key @code{struct} or replace it with @code{class} to match its definition.
4374 @smallexample
4375 class Object @{
4376 public:
4377 virtual ~Object () = 0;
4378 @};
4379 void draw (struct Object*);
4380 @end smallexample
4381
4382 It is not wrong to declare a class with the class-key @code{struct} as
4383 the example above shows. The @option{-Wmismatched-tags} option is intended
4384 to help achieve a consistent style of class declarations. In code that is
4385 intended to be portable to Windows-based compilers the warning helps prevent
4386 unresolved references due to the difference in the mangling of symbols
4387 declared with different class-keys. The option can be used either on its
4388 own or in conjunction with @option{-Wredundant-tags}.
4389
4390 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4391 @opindex Wmultiple-inheritance
4392 @opindex Wno-multiple-inheritance
4393 Warn when a class is defined with multiple direct base classes. Some
4394 coding rules disallow multiple inheritance, and this may be used to
4395 enforce that rule. The warning is inactive inside a system header file,
4396 such as the STL, so one can still use the STL. One may also define
4397 classes that indirectly use multiple inheritance.
4398
4399 @item -Wvirtual-inheritance
4400 @opindex Wvirtual-inheritance
4401 @opindex Wno-virtual-inheritance
4402 Warn when a class is defined with a virtual direct base class. Some
4403 coding rules disallow multiple inheritance, and this may be used to
4404 enforce that rule. The warning is inactive inside a system header file,
4405 such as the STL, so one can still use the STL. One may also define
4406 classes that indirectly use virtual inheritance.
4407
4408 @item -Wno-virtual-move-assign
4409 @opindex Wvirtual-move-assign
4410 @opindex Wno-virtual-move-assign
4411 Suppress warnings about inheriting from a virtual base with a
4412 non-trivial C++11 move assignment operator. This is dangerous because
4413 if the virtual base is reachable along more than one path, it is
4414 moved multiple times, which can mean both objects end up in the
4415 moved-from state. If the move assignment operator is written to avoid
4416 moving from a moved-from object, this warning can be disabled.
4417
4418 @item -Wnamespaces
4419 @opindex Wnamespaces
4420 @opindex Wno-namespaces
4421 Warn when a namespace definition is opened. Some coding rules disallow
4422 namespaces, and this may be used to enforce that rule. The warning is
4423 inactive inside a system header file, such as the STL, so one can still
4424 use the STL. One may also use using directives and qualified names.
4425
4426 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4427 @opindex Wterminate
4428 @opindex Wno-terminate
4429 Disable the warning about a throw-expression that will immediately
4430 result in a call to @code{terminate}.
4431
4432 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4433 @opindex Wvexing-parse
4434 @opindex Wno-vexing-parse
4435 Warn about the most vexing parse syntactic ambiguity. This warns about
4436 the cases when a declaration looks like a variable definition, but the
4437 C++ language requires it to be interpreted as a function declaration.
4438 For instance:
4439
4440 @smallexample
4441 void f(double a) @{
4442 int i(); // extern int i (void);
4443 int n(int(a)); // extern int n (int);
4444 @}
4445 @end smallexample
4446
4447 Another example:
4448
4449 @smallexample
4450 struct S @{ S(int); @};
4451 void f(double a) @{
4452 S x(int(a)); // extern struct S x (int);
4453 S y(int()); // extern struct S y (int (*) (void));
4454 S z(); // extern struct S z (void);
4455 @}
4456 @end smallexample
4457
4458 The warning will suggest options how to deal with such an ambiguity; e.g.,
4459 it can suggest removing the parentheses or using braces instead.
4460
4461 This warning is enabled by default.
4462
4463 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4464 @opindex Wno-class-conversion
4465 @opindex Wclass-conversion
4466 Do not warn when a conversion function converts an
4467 object to the same type, to a base class of that type, or to void; such
4468 a conversion function will never be called.
4469
4470 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4471 @opindex Wvolatile
4472 @opindex Wno-volatile
4473 Warn about deprecated uses of the @code{volatile} qualifier. This includes
4474 postfix and prefix @code{++} and @code{--} expressions of
4475 @code{volatile}-qualified types, using simple assignments where the left
4476 operand is a @code{volatile}-qualified non-class type for their value,
4477 compound assignments where the left operand is a @code{volatile}-qualified
4478 non-class type, @code{volatile}-qualified function return type,
4479 @code{volatile}-qualified parameter type, and structured bindings of a
4480 @code{volatile}-qualified type. This usage was deprecated in C++20.
4481
4482 Enabled by default with @option{-std=c++20}.
4483
4484 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4485 @opindex Wzero-as-null-pointer-constant
4486 @opindex Wno-zero-as-null-pointer-constant
4487 Warn when a literal @samp{0} is used as null pointer constant. This can
4488 be useful to facilitate the conversion to @code{nullptr} in C++11.
4489
4490 @item -Waligned-new
4491 @opindex Waligned-new
4492 @opindex Wno-aligned-new
4493 Warn about a new-expression of a type that requires greater alignment
4494 than the @code{alignof(std::max_align_t)} but uses an allocation
4495 function without an explicit alignment parameter. This option is
4496 enabled by @option{-Wall}.
4497
4498 Normally this only warns about global allocation functions, but
4499 @option{-Waligned-new=all} also warns about class member allocation
4500 functions.
4501
4502 @item -Wno-placement-new
4503 @itemx -Wplacement-new=@var{n}
4504 @opindex Wplacement-new
4505 @opindex Wno-placement-new
4506 Warn about placement new expressions with undefined behavior, such as
4507 constructing an object in a buffer that is smaller than the type of
4508 the object. For example, the placement new expression below is diagnosed
4509 because it attempts to construct an array of 64 integers in a buffer only
4510 64 bytes large.
4511 @smallexample
4512 char buf [64];
4513 new (buf) int[64];
4514 @end smallexample
4515 This warning is enabled by default.
4516
4517 @table @gcctabopt
4518 @item -Wplacement-new=1
4519 This is the default warning level of @option{-Wplacement-new}. At this
4520 level the warning is not issued for some strictly undefined constructs that
4521 GCC allows as extensions for compatibility with legacy code. For example,
4522 the following @code{new} expression is not diagnosed at this level even
4523 though it has undefined behavior according to the C++ standard because
4524 it writes past the end of the one-element array.
4525 @smallexample
4526 struct S @{ int n, a[1]; @};
4527 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4528 new (s->a)int [32]();
4529 @end smallexample
4530
4531 @item -Wplacement-new=2
4532 At this level, in addition to diagnosing all the same constructs as at level
4533 1, a diagnostic is also issued for placement new expressions that construct
4534 an object in the last member of structure whose type is an array of a single
4535 element and whose size is less than the size of the object being constructed.
4536 While the previous example would be diagnosed, the following construct makes
4537 use of the flexible member array extension to avoid the warning at level 2.
4538 @smallexample
4539 struct S @{ int n, a[]; @};
4540 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4541 new (s->a)int [32]();
4542 @end smallexample
4543
4544 @end table
4545
4546 @item -Wcatch-value
4547 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4548 @opindex Wcatch-value
4549 @opindex Wno-catch-value
4550 Warn about catch handlers that do not catch via reference.
4551 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4552 warn about polymorphic class types that are caught by value.
4553 With @option{-Wcatch-value=2} warn about all class types that are caught
4554 by value. With @option{-Wcatch-value=3} warn about all types that are
4555 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4556
4557 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4558 @opindex Wconditionally-supported
4559 @opindex Wno-conditionally-supported
4560 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4561
4562 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4563 @opindex Wdelete-incomplete
4564 @opindex Wno-delete-incomplete
4565 Do not warn when deleting a pointer to incomplete type, which may cause
4566 undefined behavior at runtime. This warning is enabled by default.
4567
4568 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4569 @opindex Wextra-semi
4570 @opindex Wno-extra-semi
4571 Warn about redundant semicolons after in-class function definitions.
4572
4573 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4574 @opindex Winaccessible-base
4575 @opindex Wno-inaccessible-base
4576 This option controls warnings
4577 when a base class is inaccessible in a class derived from it due to
4578 ambiguity. The warning is enabled by default.
4579 Note that the warning for ambiguous virtual
4580 bases is enabled by the @option{-Wextra} option.
4581 @smallexample
4582 @group
4583 struct A @{ int a; @};
4584
4585 struct B : A @{ @};
4586
4587 struct C : B, A @{ @};
4588 @end group
4589 @end smallexample
4590
4591 @item -Wno-inherited-variadic-ctor
4592 @opindex Winherited-variadic-ctor
4593 @opindex Wno-inherited-variadic-ctor
4594 Suppress warnings about use of C++11 inheriting constructors when the
4595 base class inherited from has a C variadic constructor; the warning is
4596 on by default because the ellipsis is not inherited.
4597
4598 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4599 @opindex Wno-invalid-offsetof
4600 @opindex Winvalid-offsetof
4601 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4602 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
4603 to a non-standard-layout type is undefined. In existing C++ implementations,
4604 however, @code{offsetof} typically gives meaningful results.
4605 This flag is for users who are aware that they are
4606 writing nonportable code and who have deliberately chosen to ignore the
4607 warning about it.
4608
4609 The restrictions on @code{offsetof} may be relaxed in a future version
4610 of the C++ standard.
4611
4612 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4613 @opindex Wsized-deallocation
4614 @opindex Wno-sized-deallocation
4615 Warn about a definition of an unsized deallocation function
4616 @smallexample
4617 void operator delete (void *) noexcept;
4618 void operator delete[] (void *) noexcept;
4619 @end smallexample
4620 without a definition of the corresponding sized deallocation function
4621 @smallexample
4622 void operator delete (void *, std::size_t) noexcept;
4623 void operator delete[] (void *, std::size_t) noexcept;
4624 @end smallexample
4625 or vice versa. Enabled by @option{-Wextra} along with
4626 @option{-fsized-deallocation}.
4627
4628 @item -Wsuggest-final-types
4629 @opindex Wno-suggest-final-types
4630 @opindex Wsuggest-final-types
4631 Warn about types with virtual methods where code quality would be improved
4632 if the type were declared with the C++11 @code{final} specifier,
4633 or, if possible,
4634 declared in an anonymous namespace. This allows GCC to more aggressively
4635 devirtualize the polymorphic calls. This warning is more effective with
4636 link-time optimization,
4637 where the information about the class hierarchy graph is
4638 more complete.
4639
4640 @item -Wsuggest-final-methods
4641 @opindex Wno-suggest-final-methods
4642 @opindex Wsuggest-final-methods
4643 Warn about virtual methods where code quality would be improved if the method
4644 were declared with the C++11 @code{final} specifier,
4645 or, if possible, its type were
4646 declared in an anonymous namespace or with the @code{final} specifier.
4647 This warning is
4648 more effective with link-time optimization, where the information about the
4649 class hierarchy graph is more complete. It is recommended to first consider
4650 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4651 annotations.
4652
4653 @item -Wsuggest-override
4654 @opindex Wsuggest-override
4655 @opindex Wno-suggest-override
4656 Warn about overriding virtual functions that are not marked with the
4657 @code{override} keyword.
4658
4659 @item -Wuse-after-free
4660 @itemx -Wuse-after-free=@var{n}
4661 @opindex Wuse-after-free
4662 @opindex Wno-use-after-free
4663 Warn about uses of pointers to dynamically allocated objects that have
4664 been rendered indeterminate by a call to a deallocation function.
4665 The warning is enabled at all optimization levels but may yield different
4666 results with optimization than without.
4667
4668 @table @gcctabopt
4669 @item -Wuse-after-free=1
4670 At level 1 the warning attempts to diagnose only unconditional uses
4671 of pointers made indeterminate by a deallocation call or a successful
4672 call to @code{realloc}, regardless of whether or not the call resulted
4673 in an actual reallocatio of memory. This includes double-@code{free}
4674 calls as well as uses in arithmetic and relational expressions. Although
4675 undefined, uses of indeterminate pointers in equality (or inequality)
4676 expressions are not diagnosed at this level.
4677 @item -Wuse-after-free=2
4678 At level 2, in addition to unconditional uses, the warning also diagnoses
4679 conditional uses of pointers made indeterminate by a deallocation call.
4680 As at level 2, uses in equality (or inequality) expressions are not
4681 diagnosed. For example, the second call to @code{free} in the following
4682 function is diagnosed at this level:
4683 @smallexample
4684 struct A @{ int refcount; void *data; @};
4685
4686 void release (struct A *p)
4687 @{
4688 int refcount = --p->refcount;
4689 free (p);
4690 if (refcount == 0)
4691 free (p->data); // warning: p may be used after free
4692 @}
4693 @end smallexample
4694 @item -Wuse-after-free=3
4695 At level 3, the warning also diagnoses uses of indeterminate pointers in
4696 equality expressions. All uses of indeterminate pointers are undefined
4697 but equality tests sometimes appear after calls to @code{realloc} as
4698 an attempt to determine whether the call resulted in relocating the object
4699 to a different address. They are diagnosed at a separate level to aid
4700 legacy code gradually transition to safe alternatives. For example,
4701 the equality test in the function below is diagnosed at this level:
4702 @smallexample
4703 void adjust_pointers (int**, int);
4704
4705 void grow (int **p, int n)
4706 @{
4707 int **q = (int**)realloc (p, n *= 2);
4708 if (q == p)
4709 return;
4710 adjust_pointers ((int**)q, n);
4711 @}
4712 @end smallexample
4713 To avoid the warning at this level, store offsets into allocated memory
4714 instead of pointers. This approach obviates needing to adjust the stored
4715 pointers after reallocation.
4716 @end table
4717
4718 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4719
4720 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4721 @opindex Wuseless-cast
4722 @opindex Wno-useless-cast
4723 Warn when an expression is cast to its own type. This warning does not
4724 occur when a class object is converted to a non-reference type as that
4725 is a way to create a temporary:
4726
4727 @smallexample
4728 struct S @{ @};
4729 void g (S&&);
4730 void f (S&& arg)
4731 @{
4732 g (S(arg)); // make arg prvalue so that it can bind to S&&
4733 @}
4734 @end smallexample
4735
4736 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4737 @opindex Wconversion-null
4738 @opindex Wno-conversion-null
4739 Do not warn for conversions between @code{NULL} and non-pointer
4740 types. @option{-Wconversion-null} is enabled by default.
4741
4742 @end table
4743
4744 @node Objective-C and Objective-C++ Dialect Options
4745 @section Options Controlling Objective-C and Objective-C++ Dialects
4746
4747 @cindex compiler options, Objective-C and Objective-C++
4748 @cindex Objective-C and Objective-C++ options, command-line
4749 @cindex options, Objective-C and Objective-C++
4750 (NOTE: This manual does not describe the Objective-C and Objective-C++
4751 languages themselves. @xref{Standards,,Language Standards
4752 Supported by GCC}, for references.)
4753
4754 This section describes the command-line options that are only meaningful
4755 for Objective-C and Objective-C++ programs. You can also use most of
4756 the language-independent GNU compiler options.
4757 For example, you might compile a file @file{some_class.m} like this:
4758
4759 @smallexample
4760 gcc -g -fgnu-runtime -O -c some_class.m
4761 @end smallexample
4762
4763 @noindent
4764 In this example, @option{-fgnu-runtime} is an option meant only for
4765 Objective-C and Objective-C++ programs; you can use the other options with
4766 any language supported by GCC@.
4767
4768 Note that since Objective-C is an extension of the C language, Objective-C
4769 compilations may also use options specific to the C front-end (e.g.,
4770 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
4771 C++-specific options (e.g., @option{-Wabi}).
4772
4773 Here is a list of options that are @emph{only} for compiling Objective-C
4774 and Objective-C++ programs:
4775
4776 @table @gcctabopt
4777 @item -fconstant-string-class=@var{class-name}
4778 @opindex fconstant-string-class
4779 Use @var{class-name} as the name of the class to instantiate for each
4780 literal string specified with the syntax @code{@@"@dots{}"}. The default
4781 class name is @code{NXConstantString} if the GNU runtime is being used, and
4782 @code{NSConstantString} if the NeXT runtime is being used (see below). The
4783 @option{-fconstant-cfstrings} option, if also present, overrides the
4784 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4785 to be laid out as constant CoreFoundation strings.
4786
4787 @item -fgnu-runtime
4788 @opindex fgnu-runtime
4789 Generate object code compatible with the standard GNU Objective-C
4790 runtime. This is the default for most types of systems.
4791
4792 @item -fnext-runtime
4793 @opindex fnext-runtime
4794 Generate output compatible with the NeXT runtime. This is the default
4795 for NeXT-based systems, including Darwin and Mac OS X@. The macro
4796 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4797 used.
4798
4799 @item -fno-nil-receivers
4800 @opindex fno-nil-receivers
4801 @opindex fnil-receivers
4802 Assume that all Objective-C message dispatches (@code{[receiver
4803 message:arg]}) in this translation unit ensure that the receiver is
4804 not @code{nil}. This allows for more efficient entry points in the
4805 runtime to be used. This option is only available in conjunction with
4806 the NeXT runtime and ABI version 0 or 1.
4807
4808 @item -fobjc-abi-version=@var{n}
4809 @opindex fobjc-abi-version
4810 Use version @var{n} of the Objective-C ABI for the selected runtime.
4811 This option is currently supported only for the NeXT runtime. In that
4812 case, Version 0 is the traditional (32-bit) ABI without support for
4813 properties and other Objective-C 2.0 additions. Version 1 is the
4814 traditional (32-bit) ABI with support for properties and other
4815 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
4816 nothing is specified, the default is Version 0 on 32-bit target
4817 machines, and Version 2 on 64-bit target machines.
4818
4819 @item -fobjc-call-cxx-cdtors
4820 @opindex fobjc-call-cxx-cdtors
4821 For each Objective-C class, check if any of its instance variables is a
4822 C++ object with a non-trivial default constructor. If so, synthesize a
4823 special @code{- (id) .cxx_construct} instance method which runs
4824 non-trivial default constructors on any such instance variables, in order,
4825 and then return @code{self}. Similarly, check if any instance variable
4826 is a C++ object with a non-trivial destructor, and if so, synthesize a
4827 special @code{- (void) .cxx_destruct} method which runs
4828 all such default destructors, in reverse order.
4829
4830 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4831 methods thusly generated only operate on instance variables
4832 declared in the current Objective-C class, and not those inherited
4833 from superclasses. It is the responsibility of the Objective-C
4834 runtime to invoke all such methods in an object's inheritance
4835 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
4836 by the runtime immediately after a new object instance is allocated;
4837 the @code{- (void) .cxx_destruct} methods are invoked immediately
4838 before the runtime deallocates an object instance.
4839
4840 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4841 support for invoking the @code{- (id) .cxx_construct} and
4842 @code{- (void) .cxx_destruct} methods.
4843
4844 @item -fobjc-direct-dispatch
4845 @opindex fobjc-direct-dispatch
4846 Allow fast jumps to the message dispatcher. On Darwin this is
4847 accomplished via the comm page.
4848
4849 @item -fobjc-exceptions
4850 @opindex fobjc-exceptions
4851 Enable syntactic support for structured exception handling in
4852 Objective-C, similar to what is offered by C++. This option
4853 is required to use the Objective-C keywords @code{@@try},
4854 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4855 @code{@@synchronized}. This option is available with both the GNU
4856 runtime and the NeXT runtime (but not available in conjunction with
4857 the NeXT runtime on Mac OS X 10.2 and earlier).
4858
4859 @item -fobjc-gc
4860 @opindex fobjc-gc
4861 Enable garbage collection (GC) in Objective-C and Objective-C++
4862 programs. This option is only available with the NeXT runtime; the
4863 GNU runtime has a different garbage collection implementation that
4864 does not require special compiler flags.
4865
4866 @item -fobjc-nilcheck
4867 @opindex fobjc-nilcheck
4868 For the NeXT runtime with version 2 of the ABI, check for a nil
4869 receiver in method invocations before doing the actual method call.
4870 This is the default and can be disabled using
4871 @option{-fno-objc-nilcheck}. Class methods and super calls are never
4872 checked for nil in this way no matter what this flag is set to.
4873 Currently this flag does nothing when the GNU runtime, or an older
4874 version of the NeXT runtime ABI, is used.
4875
4876 @item -fobjc-std=objc1
4877 @opindex fobjc-std
4878 Conform to the language syntax of Objective-C 1.0, the language
4879 recognized by GCC 4.0. This only affects the Objective-C additions to
4880 the C/C++ language; it does not affect conformance to C/C++ standards,
4881 which is controlled by the separate C/C++ dialect option flags. When
4882 this option is used with the Objective-C or Objective-C++ compiler,
4883 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4884 This is useful if you need to make sure that your Objective-C code can
4885 be compiled with older versions of GCC@.
4886
4887 @item -freplace-objc-classes
4888 @opindex freplace-objc-classes
4889 Emit a special marker instructing @command{ld(1)} not to statically link in
4890 the resulting object file, and allow @command{dyld(1)} to load it in at
4891 run time instead. This is used in conjunction with the Fix-and-Continue
4892 debugging mode, where the object file in question may be recompiled and
4893 dynamically reloaded in the course of program execution, without the need
4894 to restart the program itself. Currently, Fix-and-Continue functionality
4895 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4896 and later.
4897
4898 @item -fzero-link
4899 @opindex fzero-link
4900 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4901 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4902 compile time) with static class references that get initialized at load time,
4903 which improves run-time performance. Specifying the @option{-fzero-link} flag
4904 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4905 to be retained. This is useful in Zero-Link debugging mode, since it allows
4906 for individual class implementations to be modified during program execution.
4907 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4908 regardless of command-line options.
4909
4910 @item -fno-local-ivars
4911 @opindex fno-local-ivars
4912 @opindex flocal-ivars
4913 By default instance variables in Objective-C can be accessed as if
4914 they were local variables from within the methods of the class they're
4915 declared in. This can lead to shadowing between instance variables
4916 and other variables declared either locally inside a class method or
4917 globally with the same name. Specifying the @option{-fno-local-ivars}
4918 flag disables this behavior thus avoiding variable shadowing issues.
4919
4920 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4921 @opindex fivar-visibility
4922 Set the default instance variable visibility to the specified option
4923 so that instance variables declared outside the scope of any access
4924 modifier directives default to the specified visibility.
4925
4926 @item -gen-decls
4927 @opindex gen-decls
4928 Dump interface declarations for all classes seen in the source file to a
4929 file named @file{@var{sourcename}.decl}.
4930
4931 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4932 @opindex Wassign-intercept
4933 @opindex Wno-assign-intercept
4934 Warn whenever an Objective-C assignment is being intercepted by the
4935 garbage collector.
4936
4937 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4938 @opindex Wproperty-assign-default
4939 @opindex Wno-property-assign-default
4940 Do not warn if a property for an Objective-C object has no assign
4941 semantics specified.
4942
4943 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4944 @opindex Wno-protocol
4945 @opindex Wprotocol
4946 If a class is declared to implement a protocol, a warning is issued for
4947 every method in the protocol that is not implemented by the class. The
4948 default behavior is to issue a warning for every method not explicitly
4949 implemented in the class, even if a method implementation is inherited
4950 from the superclass. If you use the @option{-Wno-protocol} option, then
4951 methods inherited from the superclass are considered to be implemented,
4952 and no warning is issued for them.
4953
4954 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4955 @opindex Wobjc-root-class
4956 Warn if a class interface lacks a superclass. Most classes will inherit
4957 from @code{NSObject} (or @code{Object}) for example. When declaring
4958 classes intended to be root classes, the warning can be suppressed by
4959 marking their interfaces with @code{__attribute__((objc_root_class))}.
4960
4961 @item -Wselector @r{(Objective-C and Objective-C++ only)}
4962 @opindex Wselector
4963 @opindex Wno-selector
4964 Warn if multiple methods of different types for the same selector are
4965 found during compilation. The check is performed on the list of methods
4966 in the final stage of compilation. Additionally, a check is performed
4967 for each selector appearing in a @code{@@selector(@dots{})}
4968 expression, and a corresponding method for that selector has been found
4969 during compilation. Because these checks scan the method table only at
4970 the end of compilation, these warnings are not produced if the final
4971 stage of compilation is not reached, for example because an error is
4972 found during compilation, or because the @option{-fsyntax-only} option is
4973 being used.
4974
4975 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4976 @opindex Wstrict-selector-match
4977 @opindex Wno-strict-selector-match
4978 Warn if multiple methods with differing argument and/or return types are
4979 found for a given selector when attempting to send a message using this
4980 selector to a receiver of type @code{id} or @code{Class}. When this flag
4981 is off (which is the default behavior), the compiler omits such warnings
4982 if any differences found are confined to types that share the same size
4983 and alignment.
4984
4985 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4986 @opindex Wundeclared-selector
4987 @opindex Wno-undeclared-selector
4988 Warn if a @code{@@selector(@dots{})} expression referring to an
4989 undeclared selector is found. A selector is considered undeclared if no
4990 method with that name has been declared before the
4991 @code{@@selector(@dots{})} expression, either explicitly in an
4992 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
4993 an @code{@@implementation} section. This option always performs its
4994 checks as soon as a @code{@@selector(@dots{})} expression is found,
4995 while @option{-Wselector} only performs its checks in the final stage of
4996 compilation. This also enforces the coding style convention
4997 that methods and selectors must be declared before being used.
4998
4999 @item -print-objc-runtime-info
5000 @opindex print-objc-runtime-info
5001 Generate C header describing the largest structure that is passed by
5002 value, if any.
5003
5004 @end table
5005
5006 @node Diagnostic Message Formatting Options
5007 @section Options to Control Diagnostic Messages Formatting
5008 @cindex options to control diagnostics formatting
5009 @cindex diagnostic messages
5010 @cindex message formatting
5011
5012 Traditionally, diagnostic messages have been formatted irrespective of
5013 the output device's aspect (e.g.@: its width, @dots{}). You can use the
5014 options described below
5015 to control the formatting algorithm for diagnostic messages,
5016 e.g.@: how many characters per line, how often source location
5017 information should be reported. Note that some language front ends may not
5018 honor these options.
5019
5020 @table @gcctabopt
5021 @item -fmessage-length=@var{n}
5022 @opindex fmessage-length
5023 Try to format error messages so that they fit on lines of about
5024 @var{n} characters. If @var{n} is zero, then no line-wrapping is
5025 done; each error message appears on a single line. This is the
5026 default for all front ends.
5027
5028 Note - this option also affects the display of the @samp{#error} and
5029 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5030 function/type/variable attribute. It does not however affect the
5031 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5032
5033 @item -fdiagnostics-plain-output
5034 This option requests that diagnostic output look as plain as possible, which
5035 may be useful when running @command{dejagnu} or other utilities that need to
5036 parse diagnostics output and prefer that it remain more stable over time.
5037 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5038 options:
5039 @gccoptlist{-fno-diagnostics-show-caret @gol
5040 -fno-diagnostics-show-line-numbers @gol
5041 -fdiagnostics-color=never @gol
5042 -fdiagnostics-urls=never @gol
5043 -fdiagnostics-path-format=separate-events}
5044 In the future, if GCC changes the default appearance of its diagnostics, the
5045 corresponding option to disable the new behavior will be added to this list.
5046
5047 @item -fdiagnostics-show-location=once
5048 @opindex fdiagnostics-show-location
5049 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
5050 reporter to emit source location information @emph{once}; that is, in
5051 case the message is too long to fit on a single physical line and has to
5052 be wrapped, the source location won't be emitted (as prefix) again,
5053 over and over, in subsequent continuation lines. This is the default
5054 behavior.
5055
5056 @item -fdiagnostics-show-location=every-line
5057 Only meaningful in line-wrapping mode. Instructs the diagnostic
5058 messages reporter to emit the same source location information (as
5059 prefix) for physical lines that result from the process of breaking
5060 a message which is too long to fit on a single line.
5061
5062 @item -fdiagnostics-color[=@var{WHEN}]
5063 @itemx -fno-diagnostics-color
5064 @opindex fdiagnostics-color
5065 @cindex highlight, color
5066 @vindex GCC_COLORS @r{environment variable}
5067 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
5068 or @samp{auto}. The default depends on how the compiler has been configured,
5069 it can be any of the above @var{WHEN} options or also @samp{never}
5070 if @env{GCC_COLORS} environment variable isn't present in the environment,
5071 and @samp{auto} otherwise.
5072 @samp{auto} makes GCC use color only when the standard error is a terminal,
5073 and when not executing in an emacs shell.
5074 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5075 aliases for @option{-fdiagnostics-color=always} and
5076 @option{-fdiagnostics-color=never}, respectively.
5077
5078 The colors are defined by the environment variable @env{GCC_COLORS}.
5079 Its value is a colon-separated list of capabilities and Select Graphic
5080 Rendition (SGR) substrings. SGR commands are interpreted by the
5081 terminal or terminal emulator. (See the section in the documentation
5082 of your text terminal for permitted values and their meanings as
5083 character attributes.) These substring values are integers in decimal
5084 representation and can be concatenated with semicolons.
5085 Common values to concatenate include
5086 @samp{1} for bold,
5087 @samp{4} for underline,
5088 @samp{5} for blink,
5089 @samp{7} for inverse,
5090 @samp{39} for default foreground color,
5091 @samp{30} to @samp{37} for foreground colors,
5092 @samp{90} to @samp{97} for 16-color mode foreground colors,
5093 @samp{38;5;0} to @samp{38;5;255}
5094 for 88-color and 256-color modes foreground colors,
5095 @samp{49} for default background color,
5096 @samp{40} to @samp{47} for background colors,
5097 @samp{100} to @samp{107} for 16-color mode background colors,
5098 and @samp{48;5;0} to @samp{48;5;255}
5099 for 88-color and 256-color modes background colors.
5100
5101 The default @env{GCC_COLORS} is
5102 @smallexample
5103 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5104 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5105 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5106 type-diff=01;32:fnname=01;32:targs=35
5107 @end smallexample
5108 @noindent
5109 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5110 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5111 @samp{01} is bold, and @samp{31} is red.
5112 Setting @env{GCC_COLORS} to the empty string disables colors.
5113 Supported capabilities are as follows.
5114
5115 @table @code
5116 @item error=
5117 @vindex error GCC_COLORS @r{capability}
5118 SGR substring for error: markers.
5119
5120 @item warning=
5121 @vindex warning GCC_COLORS @r{capability}
5122 SGR substring for warning: markers.
5123
5124 @item note=
5125 @vindex note GCC_COLORS @r{capability}
5126 SGR substring for note: markers.
5127
5128 @item path=
5129 @vindex path GCC_COLORS @r{capability}
5130 SGR substring for colorizing paths of control-flow events as printed
5131 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5132 individual events and lines indicating interprocedural calls and returns.
5133
5134 @item range1=
5135 @vindex range1 GCC_COLORS @r{capability}
5136 SGR substring for first additional range.
5137
5138 @item range2=
5139 @vindex range2 GCC_COLORS @r{capability}
5140 SGR substring for second additional range.
5141
5142 @item locus=
5143 @vindex locus GCC_COLORS @r{capability}
5144 SGR substring for location information, @samp{file:line} or
5145 @samp{file:line:column} etc.
5146
5147 @item quote=
5148 @vindex quote GCC_COLORS @r{capability}
5149 SGR substring for information printed within quotes.
5150
5151 @item fnname=
5152 @vindex fnname GCC_COLORS @r{capability}
5153 SGR substring for names of C++ functions.
5154
5155 @item targs=
5156 @vindex targs GCC_COLORS @r{capability}
5157 SGR substring for C++ function template parameter bindings.
5158
5159 @item fixit-insert=
5160 @vindex fixit-insert GCC_COLORS @r{capability}
5161 SGR substring for fix-it hints suggesting text to
5162 be inserted or replaced.
5163
5164 @item fixit-delete=
5165 @vindex fixit-delete GCC_COLORS @r{capability}
5166 SGR substring for fix-it hints suggesting text to
5167 be deleted.
5168
5169 @item diff-filename=
5170 @vindex diff-filename GCC_COLORS @r{capability}
5171 SGR substring for filename headers within generated patches.
5172
5173 @item diff-hunk=
5174 @vindex diff-hunk GCC_COLORS @r{capability}
5175 SGR substring for the starts of hunks within generated patches.
5176
5177 @item diff-delete=
5178 @vindex diff-delete GCC_COLORS @r{capability}
5179 SGR substring for deleted lines within generated patches.
5180
5181 @item diff-insert=
5182 @vindex diff-insert GCC_COLORS @r{capability}
5183 SGR substring for inserted lines within generated patches.
5184
5185 @item type-diff=
5186 @vindex type-diff GCC_COLORS @r{capability}
5187 SGR substring for highlighting mismatching types within template
5188 arguments in the C++ frontend.
5189 @end table
5190
5191 @item -fdiagnostics-urls[=@var{WHEN}]
5192 @opindex fdiagnostics-urls
5193 @cindex urls
5194 @vindex GCC_URLS @r{environment variable}
5195 @vindex TERM_URLS @r{environment variable}
5196 Use escape sequences to embed URLs in diagnostics. For example, when
5197 @option{-fdiagnostics-show-option} emits text showing the command-line
5198 option controlling a diagnostic, embed a URL for documentation of that
5199 option.
5200
5201 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5202 @samp{auto} makes GCC use URL escape sequences only when the standard error
5203 is a terminal, and when not executing in an emacs shell or any graphical
5204 terminal which is known to be incompatible with this feature, see below.
5205
5206 The default depends on how the compiler has been configured.
5207 It can be any of the above @var{WHEN} options.
5208
5209 GCC can also be configured (via the
5210 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5211 so that the default is affected by environment variables.
5212 Under such a configuration, GCC defaults to using @samp{auto}
5213 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5214 present and non-empty in the environment of the compiler, or @samp{never}
5215 if neither are.
5216
5217 However, even with @option{-fdiagnostics-urls=always} the behavior is
5218 dependent on those environment variables:
5219 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5220 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
5221 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5222 Any other non-empty value enables the feature.
5223 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5224 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5225 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5226
5227 At this time GCC tries to detect also a few terminals that are known to
5228 not implement the URL feature, and have bugs or at least had bugs in
5229 some versions that are still in use, where the URL escapes are likely
5230 to misbehave, i.e. print garbage on the screen.
5231 That list is currently xfce4-terminal, certain known to be buggy
5232 gnome-terminal versions, the linux console, and mingw.
5233 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5234
5235 @item -fno-diagnostics-show-option
5236 @opindex fno-diagnostics-show-option
5237 @opindex fdiagnostics-show-option
5238 By default, each diagnostic emitted includes text indicating the
5239 command-line option that directly controls the diagnostic (if such an
5240 option is known to the diagnostic machinery). Specifying the
5241 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5242
5243 @item -fno-diagnostics-show-caret
5244 @opindex fno-diagnostics-show-caret
5245 @opindex fdiagnostics-show-caret
5246 By default, each diagnostic emitted includes the original source line
5247 and a caret @samp{^} indicating the column. This option suppresses this
5248 information. The source line is truncated to @var{n} characters, if
5249 the @option{-fmessage-length=n} option is given. When the output is done
5250 to the terminal, the width is limited to the width given by the
5251 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5252
5253 @item -fno-diagnostics-show-labels
5254 @opindex fno-diagnostics-show-labels
5255 @opindex fdiagnostics-show-labels
5256 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5257 diagnostics can label ranges of source code with pertinent information, such
5258 as the types of expressions:
5259
5260 @smallexample
5261 printf ("foo %s bar", long_i + long_j);
5262 ~^ ~~~~~~~~~~~~~~~
5263 | |
5264 char * long int
5265 @end smallexample
5266
5267 This option suppresses the printing of these labels (in the example above,
5268 the vertical bars and the ``char *'' and ``long int'' text).
5269
5270 @item -fno-diagnostics-show-cwe
5271 @opindex fno-diagnostics-show-cwe
5272 @opindex fdiagnostics-show-cwe
5273 Diagnostic messages can optionally have an associated
5274 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5275 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5276 diagnostics. GCC plugins may also provide diagnostics with such metadata.
5277 By default, if this information is present, it will be printed with
5278 the diagnostic. This option suppresses the printing of this metadata.
5279
5280 @item -fno-diagnostics-show-rules
5281 @opindex fno-diagnostics-show-rules
5282 @opindex fdiagnostics-show-rules
5283 Diagnostic messages can optionally have rules associated with them, such
5284 as from a coding standard, or a specification.
5285 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5286 By default, if this information is present, it will be printed with
5287 the diagnostic. This option suppresses the printing of this metadata.
5288
5289 @item -fno-diagnostics-show-line-numbers
5290 @opindex fno-diagnostics-show-line-numbers
5291 @opindex fdiagnostics-show-line-numbers
5292 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5293 a left margin is printed, showing line numbers. This option suppresses this
5294 left margin.
5295
5296 @item -fdiagnostics-minimum-margin-width=@var{width}
5297 @opindex fdiagnostics-minimum-margin-width
5298 This option controls the minimum width of the left margin printed by
5299 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
5300
5301 @item -fdiagnostics-parseable-fixits
5302 @opindex fdiagnostics-parseable-fixits
5303 Emit fix-it hints in a machine-parseable format, suitable for consumption
5304 by IDEs. For each fix-it, a line will be printed after the relevant
5305 diagnostic, starting with the string ``fix-it:''. For example:
5306
5307 @smallexample
5308 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5309 @end smallexample
5310
5311 The location is expressed as a half-open range, expressed as a count of
5312 bytes, starting at byte 1 for the initial column. In the above example,
5313 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5314 given string:
5315
5316 @smallexample
5317 00000000011111111112222222222
5318 12345678901234567890123456789
5319 gtk_widget_showall (dlg);
5320 ^^^^^^^^^^^^^^^^^^
5321 gtk_widget_show_all
5322 @end smallexample
5323
5324 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5325 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5326 (e.g. vertical tab as ``\013'').
5327
5328 An empty replacement string indicates that the given range is to be removed.
5329 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5330 be inserted at the given position.
5331
5332 @item -fdiagnostics-generate-patch
5333 @opindex fdiagnostics-generate-patch
5334 Print fix-it hints to stderr in unified diff format, after any diagnostics
5335 are printed. For example:
5336
5337 @smallexample
5338 --- test.c
5339 +++ test.c
5340 @@ -42,5 +42,5 @@
5341
5342 void show_cb(GtkDialog *dlg)
5343 @{
5344 - gtk_widget_showall(dlg);
5345 + gtk_widget_show_all(dlg);
5346 @}
5347
5348 @end smallexample
5349
5350 The diff may or may not be colorized, following the same rules
5351 as for diagnostics (see @option{-fdiagnostics-color}).
5352
5353 @item -fdiagnostics-show-template-tree
5354 @opindex fdiagnostics-show-template-tree
5355
5356 In the C++ frontend, when printing diagnostics showing mismatching
5357 template types, such as:
5358
5359 @smallexample
5360 could not convert 'std::map<int, std::vector<double> >()'
5361 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5362 @end smallexample
5363
5364 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5365 tree-like structure showing the common and differing parts of the types,
5366 such as:
5367
5368 @smallexample
5369 map<
5370 [...],
5371 vector<
5372 [double != float]>>
5373 @end smallexample
5374
5375 The parts that differ are highlighted with color (``double'' and
5376 ``float'' in this case).
5377
5378 @item -fno-elide-type
5379 @opindex fno-elide-type
5380 @opindex felide-type
5381 By default when the C++ frontend prints diagnostics showing mismatching
5382 template types, common parts of the types are printed as ``[...]'' to
5383 simplify the error message. For example:
5384
5385 @smallexample
5386 could not convert 'std::map<int, std::vector<double> >()'
5387 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5388 @end smallexample
5389
5390 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5391 This flag also affects the output of the
5392 @option{-fdiagnostics-show-template-tree} flag.
5393
5394 @item -fdiagnostics-path-format=@var{KIND}
5395 @opindex fdiagnostics-path-format
5396 Specify how to print paths of control-flow events for diagnostics that
5397 have such a path associated with them.
5398
5399 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5400 the default.
5401
5402 @samp{none} means to not print diagnostic paths.
5403
5404 @samp{separate-events} means to print a separate ``note'' diagnostic for
5405 each event within the diagnostic. For example:
5406
5407 @smallexample
5408 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5409 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5410 test.c:27:3: note: (2) when 'i < count'
5411 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5412 @end smallexample
5413
5414 @samp{inline-events} means to print the events ``inline'' within the source
5415 code. This view attempts to consolidate the events into runs of
5416 sufficiently-close events, printing them as labelled ranges within the source.
5417
5418 For example, the same events as above might be printed as:
5419
5420 @smallexample
5421 'test': events 1-3
5422 |
5423 | 25 | list = PyList_New(0);
5424 | | ^~~~~~~~~~~~~
5425 | | |
5426 | | (1) when 'PyList_New' fails, returning NULL
5427 | 26 |
5428 | 27 | for (i = 0; i < count; i++) @{
5429 | | ~~~
5430 | | |
5431 | | (2) when 'i < count'
5432 | 28 | item = PyLong_FromLong(random());
5433 | 29 | PyList_Append(list, item);
5434 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
5435 | | |
5436 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5437 |
5438 @end smallexample
5439
5440 Interprocedural control flow is shown by grouping the events by stack frame,
5441 and using indentation to show how stack frames are nested, pushed, and popped.
5442
5443 For example:
5444
5445 @smallexample
5446 'test': events 1-2
5447 |
5448 | 133 | @{
5449 | | ^
5450 | | |
5451 | | (1) entering 'test'
5452 | 134 | boxed_int *obj = make_boxed_int (i);
5453 | | ~~~~~~~~~~~~~~~~~~
5454 | | |
5455 | | (2) calling 'make_boxed_int'
5456 |
5457 +--> 'make_boxed_int': events 3-4
5458 |
5459 | 120 | @{
5460 | | ^
5461 | | |
5462 | | (3) entering 'make_boxed_int'
5463 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5464 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5465 | | |
5466 | | (4) calling 'wrapped_malloc'
5467 |
5468 +--> 'wrapped_malloc': events 5-6
5469 |
5470 | 7 | @{
5471 | | ^
5472 | | |
5473 | | (5) entering 'wrapped_malloc'
5474 | 8 | return malloc (size);
5475 | | ~~~~~~~~~~~~~
5476 | | |
5477 | | (6) calling 'malloc'
5478 |
5479 <-------------+
5480 |
5481 'test': event 7
5482 |
5483 | 138 | free_boxed_int (obj);
5484 | | ^~~~~~~~~~~~~~~~~~~~
5485 | | |
5486 | | (7) calling 'free_boxed_int'
5487 |
5488 (etc)
5489 @end smallexample
5490
5491 @item -fdiagnostics-show-path-depths
5492 @opindex fdiagnostics-show-path-depths
5493 This option provides additional information when printing control-flow paths
5494 associated with a diagnostic.
5495
5496 If this is option is provided then the stack depth will be printed for
5497 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5498 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5499 the stack depth and function declaration will be appended when printing
5500 each event.
5501
5502 This is intended for use by GCC developers and plugin developers when
5503 debugging diagnostics that report interprocedural control flow.
5504
5505 @item -fno-show-column
5506 @opindex fno-show-column
5507 @opindex fshow-column
5508 Do not print column numbers in diagnostics. This may be necessary if
5509 diagnostics are being scanned by a program that does not understand the
5510 column numbers, such as @command{dejagnu}.
5511
5512 @item -fdiagnostics-column-unit=@var{UNIT}
5513 @opindex fdiagnostics-column-unit
5514 Select the units for the column number. This affects traditional diagnostics
5515 (in the absence of @option{-fno-show-column}), as well as JSON format
5516 diagnostics if requested.
5517
5518 The default @var{UNIT}, @samp{display}, considers the number of display
5519 columns occupied by each character. This may be larger than the number
5520 of bytes required to encode the character, in the case of tab
5521 characters, or it may be smaller, in the case of multibyte characters.
5522 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5523 display column, and its UTF-8 encoding requires two bytes; the character
5524 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5525 its UTF-8 encoding requires four bytes.
5526
5527 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5528 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5529
5530 @item -fdiagnostics-column-origin=@var{ORIGIN}
5531 @opindex fdiagnostics-column-origin
5532 Select the origin for column numbers, i.e. the column number assigned to the
5533 first column. The default value of 1 corresponds to traditional GCC
5534 behavior and to the GNU style guide. Some utilities may perform better with an
5535 origin of 0; any non-negative value may be specified.
5536
5537 @item -fdiagnostics-escape-format=@var{FORMAT}
5538 @opindex fdiagnostics-escape-format
5539 When GCC prints pertinent source lines for a diagnostic it normally attempts
5540 to print the source bytes directly. However, some diagnostics relate to encoding
5541 issues in the source file, such as malformed UTF-8, or issues with Unicode
5542 normalization. These diagnostics are flagged so that GCC will escape bytes
5543 that are not printable ASCII when printing their pertinent source lines.
5544
5545 This option controls how such bytes should be escaped.
5546
5547 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5548 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5549 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5550 displayed as hexadecimal in the form @samp{<XX>}.
5551
5552 For example, a source line containing the string @samp{before} followed by the
5553 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5554 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5555 the string @samp{after} will be printed for such a diagnostic as:
5556
5557 @smallexample
5558 before<U+03C0><BF>after
5559 @end smallexample
5560
5561 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5562 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5563 Unicode characters. For the example above, the following will be printed:
5564
5565 @smallexample
5566 before<CF><80><BF>after
5567 @end smallexample
5568
5569 @item -fdiagnostics-format=@var{FORMAT}
5570 @opindex fdiagnostics-format
5571 Select a different format for printing diagnostics.
5572 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5573 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5574
5575 The default is @samp{text}.
5576
5577 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5578 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5579 named @file{@var{source}.sarif}, respectively.
5580
5581 The @samp{json} format is a synonym for @samp{json-stderr}.
5582 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5583 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5584 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5585
5586 The emitted JSON consists of a top-level JSON array containing JSON objects
5587 representing the diagnostics. The JSON is emitted as one line, without
5588 formatting; the examples below have been formatted for clarity.
5589
5590 Diagnostics can have child diagnostics. For example, this error and note:
5591
5592 @smallexample
5593 misleading-indentation.c:15:3: warning: this 'if' clause does not
5594 guard... [-Wmisleading-indentation]
5595 15 | if (flag)
5596 | ^~
5597 misleading-indentation.c:17:5: note: ...this statement, but the latter
5598 is misleadingly indented as if it were guarded by the 'if'
5599 17 | y = 2;
5600 | ^
5601 @end smallexample
5602
5603 @noindent
5604 might be printed in JSON form (after formatting) like this:
5605
5606 @smallexample
5607 [
5608 @{
5609 "kind": "warning",
5610 "locations": [
5611 @{
5612 "caret": @{
5613 "display-column": 3,
5614 "byte-column": 3,
5615 "column": 3,
5616 "file": "misleading-indentation.c",
5617 "line": 15
5618 @},
5619 "finish": @{
5620 "display-column": 4,
5621 "byte-column": 4,
5622 "column": 4,
5623 "file": "misleading-indentation.c",
5624 "line": 15
5625 @}
5626 @}
5627 ],
5628 "message": "this \u2018if\u2019 clause does not guard...",
5629 "option": "-Wmisleading-indentation",
5630 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5631 "children": [
5632 @{
5633 "kind": "note",
5634 "locations": [
5635 @{
5636 "caret": @{
5637 "display-column": 5,
5638 "byte-column": 5,
5639 "column": 5,
5640 "file": "misleading-indentation.c",
5641 "line": 17
5642 @}
5643 @}
5644 ],
5645 "escape-source": false,
5646 "message": "...this statement, but the latter is @dots{}"
5647 @}
5648 ]
5649 "escape-source": false,
5650 "column-origin": 1,
5651 @}
5652 ]
5653 @end smallexample
5654
5655 @noindent
5656 where the @code{note} is a child of the @code{warning}.
5657
5658 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
5659 an @code{option} key describing the command-line option controlling the
5660 warning.
5661
5662 A diagnostic can contain zero or more locations. Each location has an
5663 optional @code{label} string and up to three positions within it: a
5664 @code{caret} position and optional @code{start} and @code{finish} positions.
5665 A position is described by a @code{file} name, a @code{line} number, and
5666 three numbers indicating a column position:
5667 @itemize @bullet
5668
5669 @item
5670 @code{display-column} counts display columns, accounting for tabs and
5671 multibyte characters.
5672
5673 @item
5674 @code{byte-column} counts raw bytes.
5675
5676 @item
5677 @code{column} is equal to one of
5678 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5679 option.
5680
5681 @end itemize
5682 All three columns are relative to the origin specified by
5683 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5684 be set, for instance, to 0 for compatibility with other utilities that
5685 number columns from 0. The column origin is recorded in the JSON output in
5686 the @code{column-origin} tag. In the remaining examples below, the extra
5687 column number outputs have been omitted for brevity.
5688
5689 For example, this error:
5690
5691 @smallexample
5692 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5693 'struct s'@} and 'T' @{aka 'struct t'@})
5694 64 | return callee_4a () + callee_4b ();
5695 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5696 | | |
5697 | | T @{aka struct t@}
5698 | S @{aka struct s@}
5699 @end smallexample
5700
5701 @noindent
5702 has three locations. Its primary location is at the ``+'' token at column
5703 23. It has two secondary locations, describing the left and right-hand sides
5704 of the expression, which have labels. It might be printed in JSON form as:
5705
5706 @smallexample
5707 @{
5708 "children": [],
5709 "kind": "error",
5710 "locations": [
5711 @{
5712 "caret": @{
5713 "column": 23, "file": "bad-binary-ops.c", "line": 64
5714 @}
5715 @},
5716 @{
5717 "caret": @{
5718 "column": 10, "file": "bad-binary-ops.c", "line": 64
5719 @},
5720 "finish": @{
5721 "column": 21, "file": "bad-binary-ops.c", "line": 64
5722 @},
5723 "label": "S @{aka struct s@}"
5724 @},
5725 @{
5726 "caret": @{
5727 "column": 25, "file": "bad-binary-ops.c", "line": 64
5728 @},
5729 "finish": @{
5730 "column": 36, "file": "bad-binary-ops.c", "line": 64
5731 @},
5732 "label": "T @{aka struct t@}"
5733 @}
5734 ],
5735 "escape-source": false,
5736 "message": "invalid operands to binary + @dots{}"
5737 @}
5738 @end smallexample
5739
5740 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5741 consisting of half-open intervals, similar to the output of
5742 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
5743 with a replacement fix-it hint:
5744
5745 @smallexample
5746 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5747 mean 'color'?
5748 8 | return ptr->colour;
5749 | ^~~~~~
5750 | color
5751 @end smallexample
5752
5753 @noindent
5754 might be printed in JSON form as:
5755
5756 @smallexample
5757 @{
5758 "children": [],
5759 "fixits": [
5760 @{
5761 "next": @{
5762 "column": 21,
5763 "file": "demo.c",
5764 "line": 8
5765 @},
5766 "start": @{
5767 "column": 15,
5768 "file": "demo.c",
5769 "line": 8
5770 @},
5771 "string": "color"
5772 @}
5773 ],
5774 "kind": "error",
5775 "locations": [
5776 @{
5777 "caret": @{
5778 "column": 15,
5779 "file": "demo.c",
5780 "line": 8
5781 @},
5782 "finish": @{
5783 "column": 20,
5784 "file": "demo.c",
5785 "line": 8
5786 @}
5787 @}
5788 ],
5789 "escape-source": false,
5790 "message": "\u2018struct s\u2019 has no member named @dots{}"
5791 @}
5792 @end smallexample
5793
5794 @noindent
5795 where the fix-it hint suggests replacing the text from @code{start} up
5796 to but not including @code{next} with @code{string}'s value. Deletions
5797 are expressed via an empty value for @code{string}, insertions by
5798 having @code{start} equal @code{next}.
5799
5800 If the diagnostic has a path of control-flow events associated with it,
5801 it has a @code{path} array of objects representing the events. Each
5802 event object has a @code{description} string, a @code{location} object,
5803 along with a @code{function} string and a @code{depth} number for
5804 representing interprocedural paths. The @code{function} represents the
5805 current function at that event, and the @code{depth} represents the
5806 stack depth relative to some baseline: the higher, the more frames are
5807 within the stack.
5808
5809 For example, the intraprocedural example shown for
5810 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5811
5812 @smallexample
5813 "path": [
5814 @{
5815 "depth": 0,
5816 "description": "when 'PyList_New' fails, returning NULL",
5817 "function": "test",
5818 "location": @{
5819 "column": 10,
5820 "file": "test.c",
5821 "line": 25
5822 @}
5823 @},
5824 @{
5825 "depth": 0,
5826 "description": "when 'i < count'",
5827 "function": "test",
5828 "location": @{
5829 "column": 3,
5830 "file": "test.c",
5831 "line": 27
5832 @}
5833 @},
5834 @{
5835 "depth": 0,
5836 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5837 "function": "test",
5838 "location": @{
5839 "column": 5,
5840 "file": "test.c",
5841 "line": 29
5842 @}
5843 @}
5844 ]
5845 @end smallexample
5846
5847 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5848 non-ASCII bytes should be escaped when printing the pertinent lines of
5849 source code (@code{true} for diagnostics involving source encoding issues).
5850
5851 @end table
5852
5853 @node Warning Options
5854 @section Options to Request or Suppress Warnings
5855 @cindex options to control warnings
5856 @cindex warning messages
5857 @cindex messages, warning
5858 @cindex suppressing warnings
5859
5860 Warnings are diagnostic messages that report constructions that
5861 are not inherently erroneous but that are risky or suggest there
5862 may have been an error.
5863
5864 The following language-independent options do not enable specific
5865 warnings but control the kinds of diagnostics produced by GCC@.
5866
5867 @table @gcctabopt
5868 @cindex syntax checking
5869 @item -fsyntax-only
5870 @opindex fsyntax-only
5871 Check the code for syntax errors, but don't do anything beyond that.
5872
5873 @item -fmax-errors=@var{n}
5874 @opindex fmax-errors
5875 Limits the maximum number of error messages to @var{n}, at which point
5876 GCC bails out rather than attempting to continue processing the source
5877 code. If @var{n} is 0 (the default), there is no limit on the number
5878 of error messages produced. If @option{-Wfatal-errors} is also
5879 specified, then @option{-Wfatal-errors} takes precedence over this
5880 option.
5881
5882 @item -w
5883 @opindex w
5884 Inhibit all warning messages.
5885
5886 @item -Werror
5887 @opindex Werror
5888 @opindex Wno-error
5889 Make all warnings into errors.
5890
5891 @item -Werror=
5892 @opindex Werror=
5893 @opindex Wno-error=
5894 Make the specified warning into an error. The specifier for a warning
5895 is appended; for example @option{-Werror=switch} turns the warnings
5896 controlled by @option{-Wswitch} into errors. This switch takes a
5897 negative form, to be used to negate @option{-Werror} for specific
5898 warnings; for example @option{-Wno-error=switch} makes
5899 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5900 is in effect.
5901
5902 The warning message for each controllable warning includes the
5903 option that controls the warning. That option can then be used with
5904 @option{-Werror=} and @option{-Wno-error=} as described above.
5905 (Printing of the option in the warning message can be disabled using the
5906 @option{-fno-diagnostics-show-option} flag.)
5907
5908 Note that specifying @option{-Werror=}@var{foo} automatically implies
5909 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
5910 imply anything.
5911
5912 @item -Wfatal-errors
5913 @opindex Wfatal-errors
5914 @opindex Wno-fatal-errors
5915 This option causes the compiler to abort compilation on the first error
5916 occurred rather than trying to keep going and printing further error
5917 messages.
5918
5919 @end table
5920
5921 You can request many specific warnings with options beginning with
5922 @samp{-W}, for example @option{-Wimplicit} to request warnings on
5923 implicit declarations. Each of these specific warning options also
5924 has a negative form beginning @samp{-Wno-} to turn off warnings; for
5925 example, @option{-Wno-implicit}. This manual lists only one of the
5926 two forms, whichever is not the default. For further
5927 language-specific options also refer to @ref{C++ Dialect Options} and
5928 @ref{Objective-C and Objective-C++ Dialect Options}.
5929 Additional warnings can be produced by enabling the static analyzer;
5930 @xref{Static Analyzer Options}.
5931
5932 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5933 options, such as @option{-Wunused}, which may turn on further options,
5934 such as @option{-Wunused-value}. The combined effect of positive and
5935 negative forms is that more specific options have priority over less
5936 specific ones, independently of their position in the command-line. For
5937 options of the same specificity, the last one takes effect. Options
5938 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5939 as if they appeared at the end of the command-line.
5940
5941 When an unrecognized warning option is requested (e.g.,
5942 @option{-Wunknown-warning}), GCC emits a diagnostic stating
5943 that the option is not recognized. However, if the @option{-Wno-} form
5944 is used, the behavior is slightly different: no diagnostic is
5945 produced for @option{-Wno-unknown-warning} unless other diagnostics
5946 are being produced. This allows the use of new @option{-Wno-} options
5947 with old compilers, but if something goes wrong, the compiler
5948 warns that an unrecognized option is present.
5949
5950 The effectiveness of some warnings depends on optimizations also being
5951 enabled. For example @option{-Wsuggest-final-types} is more effective
5952 with link-time optimization and some instances of other warnings may
5953 not be issued at all unless optimization is enabled. While optimization
5954 in general improves the efficacy of control and data flow sensitive
5955 warnings, in some cases it may also cause false positives.
5956
5957 @table @gcctabopt
5958 @item -Wpedantic
5959 @itemx -pedantic
5960 @opindex pedantic
5961 @opindex Wpedantic
5962 @opindex Wno-pedantic
5963 Issue all the warnings demanded by strict ISO C and ISO C++;
5964 reject all programs that use forbidden extensions, and some other
5965 programs that do not follow ISO C and ISO C++. For ISO C, follows the
5966 version of the ISO C standard specified by any @option{-std} option used.
5967
5968 Valid ISO C and ISO C++ programs should compile properly with or without
5969 this option (though a rare few require @option{-ansi} or a
5970 @option{-std} option specifying the required version of ISO C)@. However,
5971 without this option, certain GNU extensions and traditional C and C++
5972 features are supported as well. With this option, they are rejected.
5973
5974 @option{-Wpedantic} does not cause warning messages for use of the
5975 alternate keywords whose names begin and end with @samp{__}. This alternate
5976 format can also be used to disable warnings for non-ISO @samp{__intN} types,
5977 i.e. @samp{__intN__}.
5978 Pedantic warnings are also disabled in the expression that follows
5979 @code{__extension__}. However, only system header files should use
5980 these escape routes; application programs should avoid them.
5981 @xref{Alternate Keywords}.
5982
5983 Some users try to use @option{-Wpedantic} to check programs for strict ISO
5984 C conformance. They soon find that it does not do quite what they want:
5985 it finds some non-ISO practices, but not all---only those for which
5986 ISO C @emph{requires} a diagnostic, and some others for which
5987 diagnostics have been added.
5988
5989 A feature to report any failure to conform to ISO C might be useful in
5990 some instances, but would require considerable additional work and would
5991 be quite different from @option{-Wpedantic}. We don't have plans to
5992 support such a feature in the near future.
5993
5994 Where the standard specified with @option{-std} represents a GNU
5995 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5996 corresponding @dfn{base standard}, the version of ISO C on which the GNU
5997 extended dialect is based. Warnings from @option{-Wpedantic} are given
5998 where they are required by the base standard. (It does not make sense
5999 for such warnings to be given only for features not in the specified GNU
6000 C dialect, since by definition the GNU dialects of C include all
6001 features the compiler supports with the given option, and there would be
6002 nothing to warn about.)
6003
6004 @item -pedantic-errors
6005 @opindex pedantic-errors
6006 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6007 requires a diagnostic, in some cases where there is undefined behavior
6008 at compile-time and in some other cases that do not prevent compilation
6009 of programs that are valid according to the standard. This is not
6010 equivalent to @option{-Werror=pedantic}, since there are errors enabled
6011 by this option and not enabled by the latter and vice versa.
6012
6013 @item -Wall
6014 @opindex Wall
6015 @opindex Wno-all
6016 This enables all the warnings about constructions that some users
6017 consider questionable, and that are easy to avoid (or modify to
6018 prevent the warning), even in conjunction with macros. This also
6019 enables some language-specific warnings described in @ref{C++ Dialect
6020 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6021
6022 @option{-Wall} turns on the following warning flags:
6023
6024 @gccoptlist{-Waddress @gol
6025 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
6026 -Warray-compare @gol
6027 -Warray-parameter=2 @r{(C and Objective-C only)} @gol
6028 -Wbool-compare @gol
6029 -Wbool-operation @gol
6030 -Wc++11-compat -Wc++14-compat @gol
6031 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
6032 -Wchar-subscripts @gol
6033 -Wcomment @gol
6034 -Wdangling-pointer=2 @gol
6035 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
6036 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
6037 -Wenum-int-mismatch @r{(C and Objective-C only)} @gol
6038 -Wformat @gol
6039 -Wformat-overflow @gol
6040 -Wformat-truncation @gol
6041 -Wint-in-bool-context @gol
6042 -Wimplicit @r{(C and Objective-C only)} @gol
6043 -Wimplicit-int @r{(C and Objective-C only)} @gol
6044 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
6045 -Winit-self @r{(only for C++)} @gol
6046 -Wlogical-not-parentheses @gol
6047 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
6048 -Wmaybe-uninitialized @gol
6049 -Wmemset-elt-size @gol
6050 -Wmemset-transposed-args @gol
6051 -Wmisleading-indentation @r{(only for C/C++)} @gol
6052 -Wmismatched-dealloc @gol
6053 -Wmismatched-new-delete @r{(only for C/C++)} @gol
6054 -Wmissing-attributes @gol
6055 -Wmissing-braces @r{(only for C/ObjC)} @gol
6056 -Wmultistatement-macros @gol
6057 -Wnarrowing @r{(only for C++)} @gol
6058 -Wnonnull @gol
6059 -Wnonnull-compare @gol
6060 -Wopenmp-simd @gol
6061 -Wparentheses @gol
6062 -Wpessimizing-move @r{(only for C++)} @gol
6063 -Wpointer-sign @gol
6064 -Wrange-loop-construct @r{(only for C++)} @gol
6065 -Wreorder @gol
6066 -Wrestrict @gol
6067 -Wreturn-type @gol
6068 -Wself-move @r{(only for C++)} @gol
6069 -Wsequence-point @gol
6070 -Wsign-compare @r{(only in C++)} @gol
6071 -Wsizeof-array-div @gol
6072 -Wsizeof-pointer-div @gol
6073 -Wsizeof-pointer-memaccess @gol
6074 -Wstrict-aliasing @gol
6075 -Wstrict-overflow=1 @gol
6076 -Wswitch @gol
6077 -Wtautological-compare @gol
6078 -Wtrigraphs @gol
6079 -Wuninitialized @gol
6080 -Wunknown-pragmas @gol
6081 -Wunused-function @gol
6082 -Wunused-label @gol
6083 -Wunused-value @gol
6084 -Wunused-variable @gol
6085 -Wuse-after-free=3 @gol
6086 -Wvla-parameter @r{(C and Objective-C only)} @gol
6087 -Wvolatile-register-var @gol
6088 -Wzero-length-bounds}
6089
6090 Note that some warning flags are not implied by @option{-Wall}. Some of
6091 them warn about constructions that users generally do not consider
6092 questionable, but which occasionally you might wish to check for;
6093 others warn about constructions that are necessary or hard to avoid in
6094 some cases, and there is no simple way to modify the code to suppress
6095 the warning. Some of them are enabled by @option{-Wextra} but many of
6096 them must be enabled individually.
6097
6098 @item -Wextra
6099 @opindex W
6100 @opindex Wextra
6101 @opindex Wno-extra
6102 This enables some extra warning flags that are not enabled by
6103 @option{-Wall}. (This option used to be called @option{-W}. The older
6104 name is still supported, but the newer name is more descriptive.)
6105
6106 @gccoptlist{-Wclobbered @gol
6107 -Wcast-function-type @gol
6108 -Wdeprecated-copy @r{(C++ only)} @gol
6109 -Wempty-body @gol
6110 -Wenum-conversion @r{(C only)} @gol
6111 -Wignored-qualifiers @gol
6112 -Wimplicit-fallthrough=3 @gol
6113 -Wmissing-field-initializers @gol
6114 -Wmissing-parameter-type @r{(C only)} @gol
6115 -Wold-style-declaration @r{(C only)} @gol
6116 -Woverride-init @gol
6117 -Wsign-compare @r{(C only)} @gol
6118 -Wstring-compare @gol
6119 -Wredundant-move @r{(only for C++)} @gol
6120 -Wtype-limits @gol
6121 -Wuninitialized @gol
6122 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)} @gol
6123 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
6124 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6125
6126
6127 The option @option{-Wextra} also prints warning messages for the
6128 following cases:
6129
6130 @itemize @bullet
6131
6132 @item
6133 A pointer is compared against integer zero with @code{<}, @code{<=},
6134 @code{>}, or @code{>=}.
6135
6136 @item
6137 (C++ only) An enumerator and a non-enumerator both appear in a
6138 conditional expression.
6139
6140 @item
6141 (C++ only) Ambiguous virtual bases.
6142
6143 @item
6144 (C++ only) Subscripting an array that has been declared @code{register}.
6145
6146 @item
6147 (C++ only) Taking the address of a variable that has been declared
6148 @code{register}.
6149
6150 @item
6151 (C++ only) A base class is not initialized in the copy constructor
6152 of a derived class.
6153
6154 @end itemize
6155
6156 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6157 @opindex Wabi
6158 @opindex Wno-abi
6159
6160 Warn about code affected by ABI changes. This includes code that may
6161 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6162 for the particular target.
6163
6164 Since G++ now defaults to updating the ABI with each major release,
6165 normally @option{-Wabi} warns only about C++ ABI compatibility
6166 problems if there is a check added later in a release series for an
6167 ABI issue discovered since the initial release. @option{-Wabi} warns
6168 about more things if an older ABI version is selected (with
6169 @option{-fabi-version=@var{n}}).
6170
6171 @option{-Wabi} can also be used with an explicit version number to
6172 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6173 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6174 @option{-fabi-version=2}.
6175
6176 If an explicit version number is provided and
6177 @option{-fabi-compat-version} is not specified, the version number
6178 from this option is used for compatibility aliases. If no explicit
6179 version number is provided with this option, but
6180 @option{-fabi-compat-version} is specified, that version number is
6181 used for C++ ABI warnings.
6182
6183 Although an effort has been made to warn about
6184 all such cases, there are probably some cases that are not warned about,
6185 even though G++ is generating incompatible code. There may also be
6186 cases where warnings are emitted even though the code that is generated
6187 is compatible.
6188
6189 You should rewrite your code to avoid these warnings if you are
6190 concerned about the fact that code generated by G++ may not be binary
6191 compatible with code generated by other compilers.
6192
6193 Known incompatibilities in @option{-fabi-version=2} (which was the
6194 default from GCC 3.4 to 4.9) include:
6195
6196 @itemize @bullet
6197
6198 @item
6199 A template with a non-type template parameter of reference type was
6200 mangled incorrectly:
6201 @smallexample
6202 extern int N;
6203 template <int &> struct S @{@};
6204 void n (S<N>) @{2@}
6205 @end smallexample
6206
6207 This was fixed in @option{-fabi-version=3}.
6208
6209 @item
6210 SIMD vector types declared using @code{__attribute ((vector_size))} were
6211 mangled in a non-standard way that does not allow for overloading of
6212 functions taking vectors of different sizes.
6213
6214 The mangling was changed in @option{-fabi-version=4}.
6215
6216 @item
6217 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6218 qualifiers, and @code{decltype} of a plain declaration was folded away.
6219
6220 These mangling issues were fixed in @option{-fabi-version=5}.
6221
6222 @item
6223 Scoped enumerators passed as arguments to a variadic function are
6224 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6225 On most targets this does not actually affect the parameter passing
6226 ABI, as there is no way to pass an argument smaller than @code{int}.
6227
6228 Also, the ABI changed the mangling of template argument packs,
6229 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6230 a class scope function used as a template argument.
6231
6232 These issues were corrected in @option{-fabi-version=6}.
6233
6234 @item
6235 Lambdas in default argument scope were mangled incorrectly, and the
6236 ABI changed the mangling of @code{nullptr_t}.
6237
6238 These issues were corrected in @option{-fabi-version=7}.
6239
6240 @item
6241 When mangling a function type with function-cv-qualifiers, the
6242 un-qualified function type was incorrectly treated as a substitution
6243 candidate.
6244
6245 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6246
6247 @item
6248 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6249 unaligned accesses. Note that this did not affect the ABI of a
6250 function with a @code{nullptr_t} parameter, as parameters have a
6251 minimum alignment.
6252
6253 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6254
6255 @item
6256 Target-specific attributes that affect the identity of a type, such as
6257 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6258 did not affect the mangled name, leading to name collisions when
6259 function pointers were used as template arguments.
6260
6261 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6262
6263 @end itemize
6264
6265 This option also enables warnings about psABI-related changes.
6266 The known psABI changes at this point include:
6267
6268 @itemize @bullet
6269
6270 @item
6271 For SysV/x86-64, unions with @code{long double} members are
6272 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
6273 the case. For example:
6274
6275 @smallexample
6276 union U @{
6277 long double ld;
6278 int i;
6279 @};
6280 @end smallexample
6281
6282 @noindent
6283 @code{union U} is now always passed in memory.
6284
6285 @end itemize
6286
6287 @item -Wchar-subscripts
6288 @opindex Wchar-subscripts
6289 @opindex Wno-char-subscripts
6290 Warn if an array subscript has type @code{char}. This is a common cause
6291 of error, as programmers often forget that this type is signed on some
6292 machines.
6293 This warning is enabled by @option{-Wall}.
6294
6295 @item -Wno-coverage-mismatch
6296 @opindex Wno-coverage-mismatch
6297 @opindex Wcoverage-mismatch
6298 Warn if feedback profiles do not match when using the
6299 @option{-fprofile-use} option.
6300 If a source file is changed between compiling with @option{-fprofile-generate}
6301 and with @option{-fprofile-use}, the files with the profile feedback can fail
6302 to match the source file and GCC cannot use the profile feedback
6303 information. By default, this warning is enabled and is treated as an
6304 error. @option{-Wno-coverage-mismatch} can be used to disable the
6305 warning or @option{-Wno-error=coverage-mismatch} can be used to
6306 disable the error. Disabling the error for this warning can result in
6307 poorly optimized code and is useful only in the
6308 case of very minor changes such as bug fixes to an existing code-base.
6309 Completely disabling the warning is not recommended.
6310
6311 @item -Wno-coverage-invalid-line-number
6312 @opindex Wno-coverage-invalid-line-number
6313 @opindex Wcoverage-invalid-line-number
6314 Warn in case a function ends earlier than it begins due
6315 to an invalid linenum macros. The warning is emitted only
6316 with @option{--coverage} enabled.
6317
6318 By default, this warning is enabled and is treated as an
6319 error. @option{-Wno-coverage-invalid-line-number} can be used to disable the
6320 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6321 disable the error.
6322
6323 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6324 @opindex Wno-cpp
6325 @opindex Wcpp
6326 Suppress warning messages emitted by @code{#warning} directives.
6327
6328 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6329 @opindex Wdouble-promotion
6330 @opindex Wno-double-promotion
6331 Give a warning when a value of type @code{float} is implicitly
6332 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
6333 floating-point unit implement @code{float} in hardware, but emulate
6334 @code{double} in software. On such a machine, doing computations
6335 using @code{double} values is much more expensive because of the
6336 overhead required for software emulation.
6337
6338 It is easy to accidentally do computations with @code{double} because
6339 floating-point literals are implicitly of type @code{double}. For
6340 example, in:
6341 @smallexample
6342 @group
6343 float area(float radius)
6344 @{
6345 return 3.14159 * radius * radius;
6346 @}
6347 @end group
6348 @end smallexample
6349 the compiler performs the entire computation with @code{double}
6350 because the floating-point literal is a @code{double}.
6351
6352 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6353 @opindex Wduplicate-decl-specifier
6354 @opindex Wno-duplicate-decl-specifier
6355 Warn if a declaration has duplicate @code{const}, @code{volatile},
6356 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
6357 @option{-Wall}.
6358
6359 @item -Wformat
6360 @itemx -Wformat=@var{n}
6361 @opindex Wformat
6362 @opindex Wno-format
6363 @opindex ffreestanding
6364 @opindex fno-builtin
6365 @opindex Wformat=
6366 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6367 the arguments supplied have types appropriate to the format string
6368 specified, and that the conversions specified in the format string make
6369 sense. This includes standard functions, and others specified by format
6370 attributes (@pxref{Function Attributes}), in the @code{printf},
6371 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6372 not in the C standard) families (or other target-specific families).
6373 Which functions are checked without format attributes having been
6374 specified depends on the standard version selected, and such checks of
6375 functions without the attribute specified are disabled by
6376 @option{-ffreestanding} or @option{-fno-builtin}.
6377
6378 The formats are checked against the format features supported by GNU
6379 libc version 2.2. These include all ISO C90 and C99 features, as well
6380 as features from the Single Unix Specification and some BSD and GNU
6381 extensions. Other library implementations may not support all these
6382 features; GCC does not support warning about features that go beyond a
6383 particular library's limitations. However, if @option{-Wpedantic} is used
6384 with @option{-Wformat}, warnings are given about format features not
6385 in the selected standard version (but not for @code{strfmon} formats,
6386 since those are not in any version of the C standard). @xref{C Dialect
6387 Options,,Options Controlling C Dialect}.
6388
6389 @table @gcctabopt
6390 @item -Wformat=1
6391 @itemx -Wformat
6392 @opindex Wformat
6393 @opindex Wformat=1
6394 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6395 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
6396 @option{-Wformat} also checks for null format arguments for several
6397 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
6398 aspects of this level of format checking can be disabled by the
6399 options: @option{-Wno-format-contains-nul},
6400 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6401 @option{-Wformat} is enabled by @option{-Wall}.
6402
6403 @item -Wformat=2
6404 @opindex Wformat=2
6405 Enable @option{-Wformat} plus additional format checks. Currently
6406 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6407 -Wformat-y2k}.
6408 @end table
6409
6410 @item -Wno-format-contains-nul
6411 @opindex Wno-format-contains-nul
6412 @opindex Wformat-contains-nul
6413 If @option{-Wformat} is specified, do not warn about format strings that
6414 contain NUL bytes.
6415
6416 @item -Wno-format-extra-args
6417 @opindex Wno-format-extra-args
6418 @opindex Wformat-extra-args
6419 If @option{-Wformat} is specified, do not warn about excess arguments to a
6420 @code{printf} or @code{scanf} format function. The C standard specifies
6421 that such arguments are ignored.
6422
6423 Where the unused arguments lie between used arguments that are
6424 specified with @samp{$} operand number specifications, normally
6425 warnings are still given, since the implementation could not know what
6426 type to pass to @code{va_arg} to skip the unused arguments. However,
6427 in the case of @code{scanf} formats, this option suppresses the
6428 warning if the unused arguments are all pointers, since the Single
6429 Unix Specification says that such unused arguments are allowed.
6430
6431 @item -Wformat-overflow
6432 @itemx -Wformat-overflow=@var{level}
6433 @opindex Wformat-overflow
6434 @opindex Wno-format-overflow
6435 Warn about calls to formatted input/output functions such as @code{sprintf}
6436 and @code{vsprintf} that might overflow the destination buffer. When the
6437 exact number of bytes written by a format directive cannot be determined
6438 at compile-time it is estimated based on heuristics that depend on the
6439 @var{level} argument and on optimization. While enabling optimization
6440 will in most cases improve the accuracy of the warning, it may also
6441 result in false positives.
6442
6443 @table @gcctabopt
6444 @item -Wformat-overflow
6445 @itemx -Wformat-overflow=1
6446 @opindex Wformat-overflow
6447 @opindex Wno-format-overflow
6448 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6449 employs a conservative approach that warns only about calls that most
6450 likely overflow the buffer. At this level, numeric arguments to format
6451 directives with unknown values are assumed to have the value of one, and
6452 strings of unknown length to be empty. Numeric arguments that are known
6453 to be bounded to a subrange of their type, or string arguments whose output
6454 is bounded either by their directive's precision or by a finite set of
6455 string literals, are assumed to take on the value within the range that
6456 results in the most bytes on output. For example, the call to @code{sprintf}
6457 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6458 the terminating NUL character (@code{'\0'}) appended by the function
6459 to the destination buffer will be written past its end. Increasing
6460 the size of the buffer by a single byte is sufficient to avoid the
6461 warning, though it may not be sufficient to avoid the overflow.
6462
6463 @smallexample
6464 void f (int a, int b)
6465 @{
6466 char buf [13];
6467 sprintf (buf, "a = %i, b = %i\n", a, b);
6468 @}
6469 @end smallexample
6470
6471 @item -Wformat-overflow=2
6472 Level @var{2} warns also about calls that might overflow the destination
6473 buffer given an argument of sufficient length or magnitude. At level
6474 @var{2}, unknown numeric arguments are assumed to have the minimum
6475 representable value for signed types with a precision greater than 1, and
6476 the maximum representable value otherwise. Unknown string arguments whose
6477 length cannot be assumed to be bounded either by the directive's precision,
6478 or by a finite set of string literals they may evaluate to, or the character
6479 array they may point to, are assumed to be 1 character long.
6480
6481 At level @var{2}, the call in the example above is again diagnosed, but
6482 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6483 @code{%i} directive will write some of its digits beyond the end of
6484 the destination buffer. To make the call safe regardless of the values
6485 of the two variables, the size of the destination buffer must be increased
6486 to at least 34 bytes. GCC includes the minimum size of the buffer in
6487 an informational note following the warning.
6488
6489 An alternative to increasing the size of the destination buffer is to
6490 constrain the range of formatted values. The maximum length of string
6491 arguments can be bounded by specifying the precision in the format
6492 directive. When numeric arguments of format directives can be assumed
6493 to be bounded by less than the precision of their type, choosing
6494 an appropriate length modifier to the format specifier will reduce
6495 the required buffer size. For example, if @var{a} and @var{b} in the
6496 example above can be assumed to be within the precision of
6497 the @code{short int} type then using either the @code{%hi} format
6498 directive or casting the argument to @code{short} reduces the maximum
6499 required size of the buffer to 24 bytes.
6500
6501 @smallexample
6502 void f (int a, int b)
6503 @{
6504 char buf [23];
6505 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6506 @}
6507 @end smallexample
6508 @end table
6509
6510 @item -Wno-format-zero-length
6511 @opindex Wno-format-zero-length
6512 @opindex Wformat-zero-length
6513 If @option{-Wformat} is specified, do not warn about zero-length formats.
6514 The C standard specifies that zero-length formats are allowed.
6515
6516 @item -Wformat-nonliteral
6517 @opindex Wformat-nonliteral
6518 @opindex Wno-format-nonliteral
6519 If @option{-Wformat} is specified, also warn if the format string is not a
6520 string literal and so cannot be checked, unless the format function
6521 takes its format arguments as a @code{va_list}.
6522
6523 @item -Wformat-security
6524 @opindex Wformat-security
6525 @opindex Wno-format-security
6526 If @option{-Wformat} is specified, also warn about uses of format
6527 functions that represent possible security problems. At present, this
6528 warns about calls to @code{printf} and @code{scanf} functions where the
6529 format string is not a string literal and there are no format arguments,
6530 as in @code{printf (foo);}. This may be a security hole if the format
6531 string came from untrusted input and contains @samp{%n}. (This is
6532 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6533 in future warnings may be added to @option{-Wformat-security} that are not
6534 included in @option{-Wformat-nonliteral}.)
6535
6536 @item -Wformat-signedness
6537 @opindex Wformat-signedness
6538 @opindex Wno-format-signedness
6539 If @option{-Wformat} is specified, also warn if the format string
6540 requires an unsigned argument and the argument is signed and vice versa.
6541
6542 @item -Wformat-truncation
6543 @itemx -Wformat-truncation=@var{level}
6544 @opindex Wformat-truncation
6545 @opindex Wno-format-truncation
6546 Warn about calls to formatted input/output functions such as @code{snprintf}
6547 and @code{vsnprintf} that might result in output truncation. When the exact
6548 number of bytes written by a format directive cannot be determined at
6549 compile-time it is estimated based on heuristics that depend on
6550 the @var{level} argument and on optimization. While enabling optimization
6551 will in most cases improve the accuracy of the warning, it may also result
6552 in false positives. Except as noted otherwise, the option uses the same
6553 logic @option{-Wformat-overflow}.
6554
6555 @table @gcctabopt
6556 @item -Wformat-truncation
6557 @itemx -Wformat-truncation=1
6558 @opindex Wformat-truncation
6559 @opindex Wno-format-truncation
6560 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6561 employs a conservative approach that warns only about calls to bounded
6562 functions whose return value is unused and that will most likely result
6563 in output truncation.
6564
6565 @item -Wformat-truncation=2
6566 Level @var{2} warns also about calls to bounded functions whose return
6567 value is used and that might result in truncation given an argument of
6568 sufficient length or magnitude.
6569 @end table
6570
6571 @item -Wformat-y2k
6572 @opindex Wformat-y2k
6573 @opindex Wno-format-y2k
6574 If @option{-Wformat} is specified, also warn about @code{strftime}
6575 formats that may yield only a two-digit year.
6576
6577 @item -Wnonnull
6578 @opindex Wnonnull
6579 @opindex Wno-nonnull
6580 Warn about passing a null pointer for arguments marked as
6581 requiring a non-null value by the @code{nonnull} function attribute.
6582
6583 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
6584 can be disabled with the @option{-Wno-nonnull} option.
6585
6586 @item -Wnonnull-compare
6587 @opindex Wnonnull-compare
6588 @opindex Wno-nonnull-compare
6589 Warn when comparing an argument marked with the @code{nonnull}
6590 function attribute against null inside the function.
6591
6592 @option{-Wnonnull-compare} is included in @option{-Wall}. It
6593 can be disabled with the @option{-Wno-nonnull-compare} option.
6594
6595 @item -Wnull-dereference
6596 @opindex Wnull-dereference
6597 @opindex Wno-null-dereference
6598 Warn if the compiler detects paths that trigger erroneous or
6599 undefined behavior due to dereferencing a null pointer. This option
6600 is only active when @option{-fdelete-null-pointer-checks} is active,
6601 which is enabled by optimizations in most targets. The precision of
6602 the warnings depends on the optimization options used.
6603
6604 @item -Winfinite-recursion
6605 @opindex Winfinite-recursion
6606 @opindex Wno-infinite-recursion
6607 Warn about infinitely recursive calls. The warning is effective at all
6608 optimization levels but requires optimization in order to detect infinite
6609 recursion in calls between two or more functions.
6610 @option{-Winfinite-recursion} is included in @option{-Wall}.
6611
6612 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6613 similar diagnostic, but is implemented in a different way (as part of
6614 @option{-fanalyzer}).
6615
6616 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6617 @opindex Winit-self
6618 @opindex Wno-init-self
6619 Warn about uninitialized variables that are initialized with themselves.
6620 Note this option can only be used with the @option{-Wuninitialized} option.
6621
6622 For example, GCC warns about @code{i} being uninitialized in the
6623 following snippet only when @option{-Winit-self} has been specified:
6624 @smallexample
6625 @group
6626 int f()
6627 @{
6628 int i = i;
6629 return i;
6630 @}
6631 @end group
6632 @end smallexample
6633
6634 This warning is enabled by @option{-Wall} in C++.
6635
6636 @item -Wno-implicit-int @r{(C and Objective-C only)}
6637 @opindex Wimplicit-int
6638 @opindex Wno-implicit-int
6639 This option controls warnings when a declaration does not specify a type.
6640 This warning is enabled by default in C99 and later dialects of C,
6641 and also by @option{-Wall}.
6642
6643 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6644 @opindex Wimplicit-function-declaration
6645 @opindex Wno-implicit-function-declaration
6646 This option controls warnings when a function is used before being declared.
6647 This warning is enabled by default in C99 and later dialects of C,
6648 and also by @option{-Wall}.
6649 The warning is made into an error by @option{-pedantic-errors}.
6650
6651 @item -Wimplicit @r{(C and Objective-C only)}
6652 @opindex Wimplicit
6653 @opindex Wno-implicit
6654 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6655 This warning is enabled by @option{-Wall}.
6656
6657 @item -Wimplicit-fallthrough
6658 @opindex Wimplicit-fallthrough
6659 @opindex Wno-implicit-fallthrough
6660 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6661 and @option{-Wno-implicit-fallthrough} is the same as
6662 @option{-Wimplicit-fallthrough=0}.
6663
6664 @item -Wimplicit-fallthrough=@var{n}
6665 @opindex Wimplicit-fallthrough=
6666 Warn when a switch case falls through. For example:
6667
6668 @smallexample
6669 @group
6670 switch (cond)
6671 @{
6672 case 1:
6673 a = 1;
6674 break;
6675 case 2:
6676 a = 2;
6677 case 3:
6678 a = 3;
6679 break;
6680 @}
6681 @end group
6682 @end smallexample
6683
6684 This warning does not warn when the last statement of a case cannot
6685 fall through, e.g. when there is a return statement or a call to function
6686 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
6687 also takes into account control flow statements, such as ifs, and only
6688 warns when appropriate. E.g.@:
6689
6690 @smallexample
6691 @group
6692 switch (cond)
6693 @{
6694 case 1:
6695 if (i > 3) @{
6696 bar (5);
6697 break;
6698 @} else if (i < 1) @{
6699 bar (0);
6700 @} else
6701 return;
6702 default:
6703 @dots{}
6704 @}
6705 @end group
6706 @end smallexample
6707
6708 Since there are occasions where a switch case fall through is desirable,
6709 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6710 to be used along with a null statement to suppress this warning that
6711 would normally occur:
6712
6713 @smallexample
6714 @group
6715 switch (cond)
6716 @{
6717 case 1:
6718 bar (0);
6719 __attribute__ ((fallthrough));
6720 default:
6721 @dots{}
6722 @}
6723 @end group
6724 @end smallexample
6725
6726 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6727 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
6728 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6729 Instead of these attributes, it is also possible to add a fallthrough comment
6730 to silence the warning. The whole body of the C or C++ style comment should
6731 match the given regular expressions listed below. The option argument @var{n}
6732 specifies what kind of comments are accepted:
6733
6734 @itemize @bullet
6735
6736 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6737
6738 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6739 expression, any comment is used as fallthrough comment.
6740
6741 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6742 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6743
6744 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6745 following regular expressions:
6746
6747 @itemize @bullet
6748
6749 @item @code{-fallthrough}
6750
6751 @item @code{@@fallthrough@@}
6752
6753 @item @code{lint -fallthrough[ \t]*}
6754
6755 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6756
6757 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6758
6759 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6760
6761 @end itemize
6762
6763 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6764 following regular expressions:
6765
6766 @itemize @bullet
6767
6768 @item @code{-fallthrough}
6769
6770 @item @code{@@fallthrough@@}
6771
6772 @item @code{lint -fallthrough[ \t]*}
6773
6774 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6775
6776 @end itemize
6777
6778 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6779 fallthrough comments, only attributes disable the warning.
6780
6781 @end itemize
6782
6783 The comment needs to be followed after optional whitespace and other comments
6784 by @code{case} or @code{default} keywords or by a user label that precedes some
6785 @code{case} or @code{default} label.
6786
6787 @smallexample
6788 @group
6789 switch (cond)
6790 @{
6791 case 1:
6792 bar (0);
6793 /* FALLTHRU */
6794 default:
6795 @dots{}
6796 @}
6797 @end group
6798 @end smallexample
6799
6800 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6801
6802 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6803 @opindex Wif-not-aligned
6804 @opindex Wno-if-not-aligned
6805 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6806 should be issued. These warnings are enabled by default.
6807
6808 @item -Wignored-qualifiers @r{(C and C++ only)}
6809 @opindex Wignored-qualifiers
6810 @opindex Wno-ignored-qualifiers
6811 Warn if the return type of a function has a type qualifier
6812 such as @code{const}. For ISO C such a type qualifier has no effect,
6813 since the value returned by a function is not an lvalue.
6814 For C++, the warning is only emitted for scalar types or @code{void}.
6815 ISO C prohibits qualified @code{void} return types on function
6816 definitions, so such return types always receive a warning
6817 even without this option.
6818
6819 This warning is also enabled by @option{-Wextra}.
6820
6821 @item -Wno-ignored-attributes @r{(C and C++ only)}
6822 @opindex Wignored-attributes
6823 @opindex Wno-ignored-attributes
6824 This option controls warnings when an attribute is ignored.
6825 This is different from the
6826 @option{-Wattributes} option in that it warns whenever the compiler decides
6827 to drop an attribute, not that the attribute is either unknown, used in a
6828 wrong place, etc. This warning is enabled by default.
6829
6830 @item -Wmain
6831 @opindex Wmain
6832 @opindex Wno-main
6833 Warn if the type of @code{main} is suspicious. @code{main} should be
6834 a function with external linkage, returning int, taking either zero
6835 arguments, two, or three arguments of appropriate types. This warning
6836 is enabled by default in C++ and is enabled by either @option{-Wall}
6837 or @option{-Wpedantic}.
6838
6839 @item -Wmisleading-indentation @r{(C and C++ only)}
6840 @opindex Wmisleading-indentation
6841 @opindex Wno-misleading-indentation
6842 Warn when the indentation of the code does not reflect the block structure.
6843 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6844 @code{for} clauses with a guarded statement that does not use braces,
6845 followed by an unguarded statement with the same indentation.
6846
6847 In the following example, the call to ``bar'' is misleadingly indented as
6848 if it were guarded by the ``if'' conditional.
6849
6850 @smallexample
6851 if (some_condition ())
6852 foo ();
6853 bar (); /* Gotcha: this is not guarded by the "if". */
6854 @end smallexample
6855
6856 In the case of mixed tabs and spaces, the warning uses the
6857 @option{-ftabstop=} option to determine if the statements line up
6858 (defaulting to 8).
6859
6860 The warning is not issued for code involving multiline preprocessor logic
6861 such as the following example.
6862
6863 @smallexample
6864 if (flagA)
6865 foo (0);
6866 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
6867 if (flagB)
6868 #endif
6869 foo (1);
6870 @end smallexample
6871
6872 The warning is not issued after a @code{#line} directive, since this
6873 typically indicates autogenerated code, and no assumptions can be made
6874 about the layout of the file that the directive references.
6875
6876 This warning is enabled by @option{-Wall} in C and C++.
6877
6878 @item -Wmissing-attributes
6879 @opindex Wmissing-attributes
6880 @opindex Wno-missing-attributes
6881 Warn when a declaration of a function is missing one or more attributes
6882 that a related function is declared with and whose absence may adversely
6883 affect the correctness or efficiency of generated code. For example,
6884 the warning is issued for declarations of aliases that use attributes
6885 to specify less restrictive requirements than those of their targets.
6886 This typically represents a potential optimization opportunity.
6887 By contrast, the @option{-Wattribute-alias=2} option controls warnings
6888 issued when the alias is more restrictive than the target, which could
6889 lead to incorrect code generation.
6890 Attributes considered include @code{alloc_align}, @code{alloc_size},
6891 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6892 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6893 @code{returns_nonnull}, and @code{returns_twice}.
6894
6895 In C++, the warning is issued when an explicit specialization of a primary
6896 template declared with attribute @code{alloc_align}, @code{alloc_size},
6897 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6898 or @code{nonnull} is declared without it. Attributes @code{deprecated},
6899 @code{error}, and @code{warning} suppress the warning.
6900 (@pxref{Function Attributes}).
6901
6902 You can use the @code{copy} attribute to apply the same
6903 set of attributes to a declaration as that on another declaration without
6904 explicitly enumerating the attributes. This attribute can be applied
6905 to declarations of functions (@pxref{Common Function Attributes}),
6906 variables (@pxref{Common Variable Attributes}), or types
6907 (@pxref{Common Type Attributes}).
6908
6909 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
6910
6911 For example, since the declaration of the primary function template
6912 below makes use of both attribute @code{malloc} and @code{alloc_size}
6913 the declaration of the explicit specialization of the template is
6914 diagnosed because it is missing one of the attributes.
6915
6916 @smallexample
6917 template <class T>
6918 T* __attribute__ ((malloc, alloc_size (1)))
6919 allocate (size_t);
6920
6921 template <>
6922 void* __attribute__ ((malloc)) // missing alloc_size
6923 allocate<void> (size_t);
6924 @end smallexample
6925
6926 @item -Wmissing-braces
6927 @opindex Wmissing-braces
6928 @opindex Wno-missing-braces
6929 Warn if an aggregate or union initializer is not fully bracketed. In
6930 the following example, the initializer for @code{a} is not fully
6931 bracketed, but that for @code{b} is fully bracketed.
6932
6933 @smallexample
6934 int a[2][2] = @{ 0, 1, 2, 3 @};
6935 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6936 @end smallexample
6937
6938 This warning is enabled by @option{-Wall}.
6939
6940 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
6941 @opindex Wmissing-include-dirs
6942 @opindex Wno-missing-include-dirs
6943 Warn if a user-supplied include directory does not exist. This opions is disabled
6944 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
6945 enabled by default by warning for -I and -J, only.
6946
6947 @item -Wno-missing-profile
6948 @opindex Wmissing-profile
6949 @opindex Wno-missing-profile
6950 This option controls warnings if feedback profiles are missing when using the
6951 @option{-fprofile-use} option.
6952 This option diagnoses those cases where a new function or a new file is added
6953 between compiling with @option{-fprofile-generate} and with
6954 @option{-fprofile-use}, without regenerating the profiles.
6955 In these cases, the profile feedback data files do not contain any
6956 profile feedback information for
6957 the newly added function or file respectively. Also, in the case when profile
6958 count data (.gcda) files are removed, GCC cannot use any profile feedback
6959 information. In all these cases, warnings are issued to inform you that a
6960 profile generation step is due.
6961 Ignoring the warning can result in poorly optimized code.
6962 @option{-Wno-missing-profile} can be used to
6963 disable the warning, but this is not recommended and should be done only
6964 when non-existent profile data is justified.
6965
6966 @item -Wmismatched-dealloc
6967 @opindex Wmismatched-dealloc
6968 @opindex Wno-mismatched-dealloc
6969
6970 Warn for calls to deallocation functions with pointer arguments returned
6971 from from allocations functions for which the former isn't a suitable
6972 deallocator. A pair of functions can be associated as matching allocators
6973 and deallocators by use of attribute @code{malloc}. Unless disabled by
6974 the @option{-fno-builtin} option the standard functions @code{calloc},
6975 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
6976 forms of C++ @code{operator new} and @code{operator delete} are implicitly
6977 associated as matching allocators and deallocators. In the following
6978 example @code{mydealloc} is the deallocator for pointers returned from
6979 @code{myalloc}.
6980
6981 @smallexample
6982 void mydealloc (void*);
6983
6984 __attribute__ ((malloc (mydealloc, 1))) void*
6985 myalloc (size_t);
6986
6987 void f (void)
6988 @{
6989 void *p = myalloc (32);
6990 // @dots{}use p@dots{}
6991 free (p); // warning: not a matching deallocator for myalloc
6992 mydealloc (p); // ok
6993 @}
6994 @end smallexample
6995
6996 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
6997 mismatches involving either @code{operator new} or @code{operator delete}.
6998
6999 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7000
7001 @item -Wmultistatement-macros
7002 @opindex Wmultistatement-macros
7003 @opindex Wno-multistatement-macros
7004 Warn about unsafe multiple statement macros that appear to be guarded
7005 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7006 @code{while}, in which only the first statement is actually guarded after
7007 the macro is expanded.
7008
7009 For example:
7010
7011 @smallexample
7012 #define DOIT x++; y++
7013 if (c)
7014 DOIT;
7015 @end smallexample
7016
7017 will increment @code{y} unconditionally, not just when @code{c} holds.
7018 The can usually be fixed by wrapping the macro in a do-while loop:
7019 @smallexample
7020 #define DOIT do @{ x++; y++; @} while (0)
7021 if (c)
7022 DOIT;
7023 @end smallexample
7024
7025 This warning is enabled by @option{-Wall} in C and C++.
7026
7027 @item -Wparentheses
7028 @opindex Wparentheses
7029 @opindex Wno-parentheses
7030 Warn if parentheses are omitted in certain contexts, such
7031 as when there is an assignment in a context where a truth value
7032 is expected, or when operators are nested whose precedence people
7033 often get confused about.
7034
7035 Also warn if a comparison like @code{x<=y<=z} appears; this is
7036 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7037 interpretation from that of ordinary mathematical notation.
7038
7039 Also warn for dangerous uses of the GNU extension to
7040 @code{?:} with omitted middle operand. When the condition
7041 in the @code{?}: operator is a boolean expression, the omitted value is
7042 always 1. Often programmers expect it to be a value computed
7043 inside the conditional expression instead.
7044
7045 For C++ this also warns for some cases of unnecessary parentheses in
7046 declarations, which can indicate an attempt at a function call instead
7047 of a declaration:
7048 @smallexample
7049 @{
7050 // Declares a local variable called mymutex.
7051 std::unique_lock<std::mutex> (mymutex);
7052 // User meant std::unique_lock<std::mutex> lock (mymutex);
7053 @}
7054 @end smallexample
7055
7056 This warning is enabled by @option{-Wall}.
7057
7058 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7059 @opindex Wself-move
7060 @opindex Wno-self-move
7061 This warning warns when a value is moved to itself with @code{std::move}.
7062 Such a @code{std::move} typically has no effect.
7063
7064 @smallexample
7065 struct T @{
7066 @dots{}
7067 @};
7068 void fn()
7069 @{
7070 T t;
7071 @dots{}
7072 t = std::move (t);
7073 @}
7074 @end smallexample
7075
7076 This warning is enabled by @option{-Wall}.
7077
7078 @item -Wsequence-point
7079 @opindex Wsequence-point
7080 @opindex Wno-sequence-point
7081 Warn about code that may have undefined semantics because of violations
7082 of sequence point rules in the C and C++ standards.
7083
7084 The C and C++ standards define the order in which expressions in a C/C++
7085 program are evaluated in terms of @dfn{sequence points}, which represent
7086 a partial ordering between the execution of parts of the program: those
7087 executed before the sequence point, and those executed after it. These
7088 occur after the evaluation of a full expression (one which is not part
7089 of a larger expression), after the evaluation of the first operand of a
7090 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7091 function is called (but after the evaluation of its arguments and the
7092 expression denoting the called function), and in certain other places.
7093 Other than as expressed by the sequence point rules, the order of
7094 evaluation of subexpressions of an expression is not specified. All
7095 these rules describe only a partial order rather than a total order,
7096 since, for example, if two functions are called within one expression
7097 with no sequence point between them, the order in which the functions
7098 are called is not specified. However, the standards committee have
7099 ruled that function calls do not overlap.
7100
7101 It is not specified when between sequence points modifications to the
7102 values of objects take effect. Programs whose behavior depends on this
7103 have undefined behavior; the C and C++ standards specify that ``Between
7104 the previous and next sequence point an object shall have its stored
7105 value modified at most once by the evaluation of an expression.
7106 Furthermore, the prior value shall be read only to determine the value
7107 to be stored.''. If a program breaks these rules, the results on any
7108 particular implementation are entirely unpredictable.
7109
7110 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7111 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
7112 diagnosed by this option, and it may give an occasional false positive
7113 result, but in general it has been found fairly effective at detecting
7114 this sort of problem in programs.
7115
7116 The C++17 standard will define the order of evaluation of operands in
7117 more cases: in particular it requires that the right-hand side of an
7118 assignment be evaluated before the left-hand side, so the above
7119 examples are no longer undefined. But this option will still warn
7120 about them, to help people avoid writing code that is undefined in C
7121 and earlier revisions of C++.
7122
7123 The standard is worded confusingly, therefore there is some debate
7124 over the precise meaning of the sequence point rules in subtle cases.
7125 Links to discussions of the problem, including proposed formal
7126 definitions, may be found on the GCC readings page, at
7127 @uref{https://gcc.gnu.org/@/readings.html}.
7128
7129 This warning is enabled by @option{-Wall} for C and C++.
7130
7131 @item -Wno-return-local-addr
7132 @opindex Wno-return-local-addr
7133 @opindex Wreturn-local-addr
7134 Do not warn about returning a pointer (or in C++, a reference) to a
7135 variable that goes out of scope after the function returns.
7136
7137 @item -Wreturn-type
7138 @opindex Wreturn-type
7139 @opindex Wno-return-type
7140 Warn whenever a function is defined with a return type that defaults
7141 to @code{int}. Also warn about any @code{return} statement with no
7142 return value in a function whose return type is not @code{void}
7143 (falling off the end of the function body is considered returning
7144 without a value).
7145
7146 For C only, warn about a @code{return} statement with an expression in a
7147 function whose return type is @code{void}, unless the expression type is
7148 also @code{void}. As a GNU extension, the latter case is accepted
7149 without a warning unless @option{-Wpedantic} is used. Attempting
7150 to use the return value of a non-@code{void} function other than @code{main}
7151 that flows off the end by reaching the closing curly brace that terminates
7152 the function is undefined.
7153
7154 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7155 than @code{main} results in undefined behavior even when the value of
7156 the function is not used.
7157
7158 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7159
7160 @item -Wno-shift-count-negative
7161 @opindex Wshift-count-negative
7162 @opindex Wno-shift-count-negative
7163 Controls warnings if a shift count is negative.
7164 This warning is enabled by default.
7165
7166 @item -Wno-shift-count-overflow
7167 @opindex Wshift-count-overflow
7168 @opindex Wno-shift-count-overflow
7169 Controls warnings if a shift count is greater than or equal to the bit width
7170 of the type. This warning is enabled by default.
7171
7172 @item -Wshift-negative-value
7173 @opindex Wshift-negative-value
7174 @opindex Wno-shift-negative-value
7175 Warn if left shifting a negative value. This warning is enabled by
7176 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7177
7178 @item -Wno-shift-overflow
7179 @itemx -Wshift-overflow=@var{n}
7180 @opindex Wshift-overflow
7181 @opindex Wno-shift-overflow
7182 These options control warnings about left shift overflows.
7183
7184 @table @gcctabopt
7185 @item -Wshift-overflow=1
7186 This is the warning level of @option{-Wshift-overflow} and is enabled
7187 by default in C99 and C++11 modes (and newer). This warning level does
7188 not warn about left-shifting 1 into the sign bit. (However, in C, such
7189 an overflow is still rejected in contexts where an integer constant expression
7190 is required.) No warning is emitted in C++20 mode (and newer), as signed left
7191 shifts always wrap.
7192
7193 @item -Wshift-overflow=2
7194 This warning level also warns about left-shifting 1 into the sign bit,
7195 unless C++14 mode (or newer) is active.
7196 @end table
7197
7198 @item -Wswitch
7199 @opindex Wswitch
7200 @opindex Wno-switch
7201 Warn whenever a @code{switch} statement has an index of enumerated type
7202 and lacks a @code{case} for one or more of the named codes of that
7203 enumeration. (The presence of a @code{default} label prevents this
7204 warning.) @code{case} labels outside the enumeration range also
7205 provoke warnings when this option is used (even if there is a
7206 @code{default} label).
7207 This warning is enabled by @option{-Wall}.
7208
7209 @item -Wswitch-default
7210 @opindex Wswitch-default
7211 @opindex Wno-switch-default
7212 Warn whenever a @code{switch} statement does not have a @code{default}
7213 case.
7214
7215 @item -Wswitch-enum
7216 @opindex Wswitch-enum
7217 @opindex Wno-switch-enum
7218 Warn whenever a @code{switch} statement has an index of enumerated type
7219 and lacks a @code{case} for one or more of the named codes of that
7220 enumeration. @code{case} labels outside the enumeration range also
7221 provoke warnings when this option is used. The only difference
7222 between @option{-Wswitch} and this option is that this option gives a
7223 warning about an omitted enumeration code even if there is a
7224 @code{default} label.
7225
7226 @item -Wno-switch-bool
7227 @opindex Wswitch-bool
7228 @opindex Wno-switch-bool
7229 Do not warn when a @code{switch} statement has an index of boolean type
7230 and the case values are outside the range of a boolean type.
7231 It is possible to suppress this warning by casting the controlling
7232 expression to a type other than @code{bool}. For example:
7233 @smallexample
7234 @group
7235 switch ((int) (a == 4))
7236 @{
7237 @dots{}
7238 @}
7239 @end group
7240 @end smallexample
7241 This warning is enabled by default for C and C++ programs.
7242
7243 @item -Wno-switch-outside-range
7244 @opindex Wswitch-outside-range
7245 @opindex Wno-switch-outside-range
7246 This option controls warnings when a @code{switch} case has a value
7247 that is outside of its
7248 respective type range. This warning is enabled by default for
7249 C and C++ programs.
7250
7251 @item -Wno-switch-unreachable
7252 @opindex Wswitch-unreachable
7253 @opindex Wno-switch-unreachable
7254 Do not warn when a @code{switch} statement contains statements between the
7255 controlling expression and the first case label, which will never be
7256 executed. For example:
7257 @smallexample
7258 @group
7259 switch (cond)
7260 @{
7261 i = 15;
7262 @dots{}
7263 case 5:
7264 @dots{}
7265 @}
7266 @end group
7267 @end smallexample
7268 @option{-Wswitch-unreachable} does not warn if the statement between the
7269 controlling expression and the first case label is just a declaration:
7270 @smallexample
7271 @group
7272 switch (cond)
7273 @{
7274 int i;
7275 @dots{}
7276 case 5:
7277 i = 5;
7278 @dots{}
7279 @}
7280 @end group
7281 @end smallexample
7282 This warning is enabled by default for C and C++ programs.
7283
7284 @item -Wsync-nand @r{(C and C++ only)}
7285 @opindex Wsync-nand
7286 @opindex Wno-sync-nand
7287 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7288 built-in functions are used. These functions changed semantics in GCC 4.4.
7289
7290 @item -Wtrivial-auto-var-init
7291 @opindex Wtrivial-auto-var-init
7292 @opindex Wno-trivial-auto-var-init
7293 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7294 variable. A common situation is an automatic variable that is declared
7295 between the controlling expression and the first case label of a @code{switch}
7296 statement.
7297
7298 @item -Wunused-but-set-parameter
7299 @opindex Wunused-but-set-parameter
7300 @opindex Wno-unused-but-set-parameter
7301 Warn whenever a function parameter is assigned to, but otherwise unused
7302 (aside from its declaration).
7303
7304 To suppress this warning use the @code{unused} attribute
7305 (@pxref{Variable Attributes}).
7306
7307 This warning is also enabled by @option{-Wunused} together with
7308 @option{-Wextra}.
7309
7310 @item -Wunused-but-set-variable
7311 @opindex Wunused-but-set-variable
7312 @opindex Wno-unused-but-set-variable
7313 Warn whenever a local variable is assigned to, but otherwise unused
7314 (aside from its declaration).
7315 This warning is enabled by @option{-Wall}.
7316
7317 To suppress this warning use the @code{unused} attribute
7318 (@pxref{Variable Attributes}).
7319
7320 This warning is also enabled by @option{-Wunused}, which is enabled
7321 by @option{-Wall}.
7322
7323 @item -Wunused-function
7324 @opindex Wunused-function
7325 @opindex Wno-unused-function
7326 Warn whenever a static function is declared but not defined or a
7327 non-inline static function is unused.
7328 This warning is enabled by @option{-Wall}.
7329
7330 @item -Wunused-label
7331 @opindex Wunused-label
7332 @opindex Wno-unused-label
7333 Warn whenever a label is declared but not used.
7334 This warning is enabled by @option{-Wall}.
7335
7336 To suppress this warning use the @code{unused} attribute
7337 (@pxref{Variable Attributes}).
7338
7339 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7340 @opindex Wunused-local-typedefs
7341 @opindex Wno-unused-local-typedefs
7342 Warn when a typedef locally defined in a function is not used.
7343 This warning is enabled by @option{-Wall}.
7344
7345 @item -Wunused-parameter
7346 @opindex Wunused-parameter
7347 @opindex Wno-unused-parameter
7348 Warn whenever a function parameter is unused aside from its declaration.
7349
7350 To suppress this warning use the @code{unused} attribute
7351 (@pxref{Variable Attributes}).
7352
7353 @item -Wno-unused-result
7354 @opindex Wunused-result
7355 @opindex Wno-unused-result
7356 Do not warn if a caller of a function marked with attribute
7357 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7358 its return value. The default is @option{-Wunused-result}.
7359
7360 @item -Wunused-variable
7361 @opindex Wunused-variable
7362 @opindex Wno-unused-variable
7363 Warn whenever a local or static variable is unused aside from its
7364 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7365 but not for C++. This warning is enabled by @option{-Wall}.
7366
7367 To suppress this warning use the @code{unused} attribute
7368 (@pxref{Variable Attributes}).
7369
7370 @item -Wunused-const-variable
7371 @itemx -Wunused-const-variable=@var{n}
7372 @opindex Wunused-const-variable
7373 @opindex Wno-unused-const-variable
7374 Warn whenever a constant static variable is unused aside from its declaration.
7375 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7376 for C, but not for C++. In C this declares variable storage, but in C++ this
7377 is not an error since const variables take the place of @code{#define}s.
7378
7379 To suppress this warning use the @code{unused} attribute
7380 (@pxref{Variable Attributes}).
7381
7382 @table @gcctabopt
7383 @item -Wunused-const-variable=1
7384 This is the warning level that is enabled by @option{-Wunused-variable} for
7385 C. It warns only about unused static const variables defined in the main
7386 compilation unit, but not about static const variables declared in any
7387 header included.
7388
7389 @item -Wunused-const-variable=2
7390 This warning level also warns for unused constant static variables in
7391 headers (excluding system headers). This is the warning level of
7392 @option{-Wunused-const-variable} and must be explicitly requested since
7393 in C++ this isn't an error and in C it might be harder to clean up all
7394 headers included.
7395 @end table
7396
7397 @item -Wunused-value
7398 @opindex Wunused-value
7399 @opindex Wno-unused-value
7400 Warn whenever a statement computes a result that is explicitly not
7401 used. To suppress this warning cast the unused expression to
7402 @code{void}. This includes an expression-statement or the left-hand
7403 side of a comma expression that contains no side effects. For example,
7404 an expression such as @code{x[i,j]} causes a warning, while
7405 @code{x[(void)i,j]} does not.
7406
7407 This warning is enabled by @option{-Wall}.
7408
7409 @item -Wunused
7410 @opindex Wunused
7411 @opindex Wno-unused
7412 All the above @option{-Wunused} options combined.
7413
7414 In order to get a warning about an unused function parameter, you must
7415 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7416 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7417
7418 @item -Wuninitialized
7419 @opindex Wuninitialized
7420 @opindex Wno-uninitialized
7421 Warn if an object with automatic or allocated storage duration is used
7422 without having been initialized. In C++, also warn if a non-static
7423 reference or non-static @code{const} member appears in a class without
7424 constructors.
7425
7426 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7427 object to a @code{const}-qualified argument of a built-in function known to
7428 read the object is also diagnosed by this warning.
7429 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7430
7431 If you want to warn about code that uses the uninitialized value of the
7432 variable in its own initializer, use the @option{-Winit-self} option.
7433
7434 These warnings occur for individual uninitialized elements of
7435 structure, union or array variables as well as for variables that are
7436 uninitialized as a whole. They do not occur for variables or elements
7437 declared @code{volatile}. Because these warnings depend on
7438 optimization, the exact variables or elements for which there are
7439 warnings depend on the precise optimization options and version of GCC
7440 used.
7441
7442 Note that there may be no warning about a variable that is used only
7443 to compute a value that itself is never used, because such
7444 computations may be deleted by data flow analysis before the warnings
7445 are printed.
7446
7447 In C++, this warning also warns about using uninitialized objects in
7448 member-initializer-lists. For example, GCC warns about @code{b} being
7449 uninitialized in the following snippet:
7450
7451 @smallexample
7452 struct A @{
7453 int a;
7454 int b;
7455 A() : a(b) @{ @}
7456 @};
7457 @end smallexample
7458
7459 @item -Wno-invalid-memory-model
7460 @opindex Winvalid-memory-model
7461 @opindex Wno-invalid-memory-model
7462 This option controls warnings
7463 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7464 and the C11 atomic generic functions with a memory consistency argument
7465 that is either invalid for the operation or outside the range of values
7466 of the @code{memory_order} enumeration. For example, since the
7467 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7468 defined for the relaxed, release, and sequentially consistent memory
7469 orders the following code is diagnosed:
7470
7471 @smallexample
7472 void store (int *i)
7473 @{
7474 __atomic_store_n (i, 0, memory_order_consume);
7475 @}
7476 @end smallexample
7477
7478 @option{-Winvalid-memory-model} is enabled by default.
7479
7480 @item -Wmaybe-uninitialized
7481 @opindex Wmaybe-uninitialized
7482 @opindex Wno-maybe-uninitialized
7483 For an object with automatic or allocated storage duration, if there exists
7484 a path from the function entry to a use of the object that is initialized,
7485 but there exist some other paths for which the object is not initialized,
7486 the compiler emits a warning if it cannot prove the uninitialized paths
7487 are not executed at run time.
7488
7489 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7490 object to a @code{const}-qualified function argument is also diagnosed by
7491 this warning. (@option{-Wuninitialized} is issued for built-in functions
7492 known to read the object.) Annotating the function with attribute
7493 @code{access (none)} indicates that the argument isn't used to access
7494 the object and avoids the warning (@pxref{Common Function Attributes}).
7495
7496 These warnings are only possible in optimizing compilation, because otherwise
7497 GCC does not keep track of the state of variables.
7498
7499 These warnings are made optional because GCC may not be able to determine when
7500 the code is correct in spite of appearing to have an error. Here is one
7501 example of how this can happen:
7502
7503 @smallexample
7504 @group
7505 @{
7506 int x;
7507 switch (y)
7508 @{
7509 case 1: x = 1;
7510 break;
7511 case 2: x = 4;
7512 break;
7513 case 3: x = 5;
7514 @}
7515 foo (x);
7516 @}
7517 @end group
7518 @end smallexample
7519
7520 @noindent
7521 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7522 always initialized, but GCC doesn't know this. To suppress the
7523 warning, you need to provide a default case with assert(0) or
7524 similar code.
7525
7526 @cindex @code{longjmp} warnings
7527 This option also warns when a non-volatile automatic variable might be
7528 changed by a call to @code{longjmp}.
7529 The compiler sees only the calls to @code{setjmp}. It cannot know
7530 where @code{longjmp} will be called; in fact, a signal handler could
7531 call it at any point in the code. As a result, you may get a warning
7532 even when there is in fact no problem because @code{longjmp} cannot
7533 in fact be called at the place that would cause a problem.
7534
7535 Some spurious warnings can be avoided if you declare all the functions
7536 you use that never return as @code{noreturn}. @xref{Function
7537 Attributes}.
7538
7539 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7540
7541 @item -Wunknown-pragmas
7542 @opindex Wunknown-pragmas
7543 @opindex Wno-unknown-pragmas
7544 @cindex warning for unknown pragmas
7545 @cindex unknown pragmas, warning
7546 @cindex pragmas, warning of unknown
7547 Warn when a @code{#pragma} directive is encountered that is not understood by
7548 GCC@. If this command-line option is used, warnings are even issued
7549 for unknown pragmas in system header files. This is not the case if
7550 the warnings are only enabled by the @option{-Wall} command-line option.
7551
7552 @item -Wno-pragmas
7553 @opindex Wno-pragmas
7554 @opindex Wpragmas
7555 Do not warn about misuses of pragmas, such as incorrect parameters,
7556 invalid syntax, or conflicts between pragmas. See also
7557 @option{-Wunknown-pragmas}.
7558
7559 @item -Wno-prio-ctor-dtor
7560 @opindex Wno-prio-ctor-dtor
7561 @opindex Wprio-ctor-dtor
7562 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7563 The use of constructor and destructor attributes allow you to assign a
7564 priority to the constructor/destructor to control its order of execution
7565 before @code{main} is called or after it returns. The priority values must be
7566 greater than 100 as the compiler reserves priority values between 0--100 for
7567 the implementation.
7568
7569 @item -Wstrict-aliasing
7570 @opindex Wstrict-aliasing
7571 @opindex Wno-strict-aliasing
7572 This option is only active when @option{-fstrict-aliasing} is active.
7573 It warns about code that might break the strict aliasing rules that the
7574 compiler is using for optimization. The warning does not catch all
7575 cases, but does attempt to catch the more common pitfalls. It is
7576 included in @option{-Wall}.
7577 It is equivalent to @option{-Wstrict-aliasing=3}
7578
7579 @item -Wstrict-aliasing=n
7580 @opindex Wstrict-aliasing=n
7581 This option is only active when @option{-fstrict-aliasing} is active.
7582 It warns about code that might break the strict aliasing rules that the
7583 compiler is using for optimization.
7584 Higher levels correspond to higher accuracy (fewer false positives).
7585 Higher levels also correspond to more effort, similar to the way @option{-O}
7586 works.
7587 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7588
7589 Level 1: Most aggressive, quick, least accurate.
7590 Possibly useful when higher levels
7591 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7592 false negatives. However, it has many false positives.
7593 Warns for all pointer conversions between possibly incompatible types,
7594 even if never dereferenced. Runs in the front end only.
7595
7596 Level 2: Aggressive, quick, not too precise.
7597 May still have many false positives (not as many as level 1 though),
7598 and few false negatives (but possibly more than level 1).
7599 Unlike level 1, it only warns when an address is taken. Warns about
7600 incomplete types. Runs in the front end only.
7601
7602 Level 3 (default for @option{-Wstrict-aliasing}):
7603 Should have very few false positives and few false
7604 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
7605 Takes care of the common pun+dereference pattern in the front end:
7606 @code{*(int*)&some_float}.
7607 If optimization is enabled, it also runs in the back end, where it deals
7608 with multiple statement cases using flow-sensitive points-to information.
7609 Only warns when the converted pointer is dereferenced.
7610 Does not warn about incomplete types.
7611
7612 @item -Wstrict-overflow
7613 @itemx -Wstrict-overflow=@var{n}
7614 @opindex Wstrict-overflow
7615 @opindex Wno-strict-overflow
7616 This option is only active when signed overflow is undefined.
7617 It warns about cases where the compiler optimizes based on the
7618 assumption that signed overflow does not occur. Note that it does not
7619 warn about all cases where the code might overflow: it only warns
7620 about cases where the compiler implements some optimization. Thus
7621 this warning depends on the optimization level.
7622
7623 An optimization that assumes that signed overflow does not occur is
7624 perfectly safe if the values of the variables involved are such that
7625 overflow never does, in fact, occur. Therefore this warning can
7626 easily give a false positive: a warning about code that is not
7627 actually a problem. To help focus on important issues, several
7628 warning levels are defined. No warnings are issued for the use of
7629 undefined signed overflow when estimating how many iterations a loop
7630 requires, in particular when determining whether a loop will be
7631 executed at all.
7632
7633 @table @gcctabopt
7634 @item -Wstrict-overflow=1
7635 Warn about cases that are both questionable and easy to avoid. For
7636 example the compiler simplifies
7637 @code{x + 1 > x} to @code{1}. This level of
7638 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7639 are not, and must be explicitly requested.
7640
7641 @item -Wstrict-overflow=2
7642 Also warn about other cases where a comparison is simplified to a
7643 constant. For example: @code{abs (x) >= 0}. This can only be
7644 simplified when signed integer overflow is undefined, because
7645 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7646 zero. @option{-Wstrict-overflow} (with no level) is the same as
7647 @option{-Wstrict-overflow=2}.
7648
7649 @item -Wstrict-overflow=3
7650 Also warn about other cases where a comparison is simplified. For
7651 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7652
7653 @item -Wstrict-overflow=4
7654 Also warn about other simplifications not covered by the above cases.
7655 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7656
7657 @item -Wstrict-overflow=5
7658 Also warn about cases where the compiler reduces the magnitude of a
7659 constant involved in a comparison. For example: @code{x + 2 > y} is
7660 simplified to @code{x + 1 >= y}. This is reported only at the
7661 highest warning level because this simplification applies to many
7662 comparisons, so this warning level gives a very large number of
7663 false positives.
7664 @end table
7665
7666 @item -Wstring-compare
7667 @opindex Wstring-compare
7668 @opindex Wno-string-compare
7669 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7670 determined to be either zero or non-zero in tests for such equality
7671 owing to the length of one argument being greater than the size of
7672 the array the other argument is stored in (or the bound in the case
7673 of @code{strncmp}). Such calls could be mistakes. For example,
7674 the call to @code{strcmp} below is diagnosed because its result is
7675 necessarily non-zero irrespective of the contents of the array @code{a}.
7676
7677 @smallexample
7678 extern char a[4];
7679 void f (char *d)
7680 @{
7681 strcpy (d, "string");
7682 @dots{}
7683 if (0 == strcmp (a, d)) // cannot be true
7684 puts ("a and d are the same");
7685 @}
7686 @end smallexample
7687
7688 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7689
7690 @item -Wno-stringop-overflow
7691 @item -Wstringop-overflow
7692 @itemx -Wstringop-overflow=@var{type}
7693 @opindex Wstringop-overflow
7694 @opindex Wno-stringop-overflow
7695 Warn for calls to string manipulation functions such as @code{memcpy} and
7696 @code{strcpy} that are determined to overflow the destination buffer. The
7697 optional argument is one greater than the type of Object Size Checking to
7698 perform to determine the size of the destination. @xref{Object Size Checking}.
7699 The argument is meaningful only for functions that operate on character arrays
7700 but not for raw memory functions like @code{memcpy} which always make use
7701 of Object Size type-0. The option also warns for calls that specify a size
7702 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7703 The option produces the best results with optimization enabled but can detect
7704 a small subset of simple buffer overflows even without optimization in
7705 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7706 correspond to the standard functions. In any case, the option warns about
7707 just a subset of buffer overflows detected by the corresponding overflow
7708 checking built-ins. For example, the option issues a warning for
7709 the @code{strcpy} call below because it copies at least 5 characters
7710 (the string @code{"blue"} including the terminating NUL) into the buffer
7711 of size 4.
7712
7713 @smallexample
7714 enum Color @{ blue, purple, yellow @};
7715 const char* f (enum Color clr)
7716 @{
7717 static char buf [4];
7718 const char *str;
7719 switch (clr)
7720 @{
7721 case blue: str = "blue"; break;
7722 case purple: str = "purple"; break;
7723 case yellow: str = "yellow"; break;
7724 @}
7725
7726 return strcpy (buf, str); // warning here
7727 @}
7728 @end smallexample
7729
7730 Option @option{-Wstringop-overflow=2} is enabled by default.
7731
7732 @table @gcctabopt
7733 @item -Wstringop-overflow
7734 @itemx -Wstringop-overflow=1
7735 @opindex Wstringop-overflow
7736 @opindex Wno-stringop-overflow
7737 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7738 to determine the sizes of destination objects. At this setting the option
7739 does not warn for writes past the end of subobjects of larger objects accessed
7740 by pointers unless the size of the largest surrounding object is known. When
7741 the destination may be one of several objects it is assumed to be the largest
7742 one of them. On Linux systems, when optimization is enabled at this setting
7743 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7744 is defined to a non-zero value.
7745
7746 @item -Wstringop-overflow=2
7747 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7748 to determine the sizes of destination objects. At this setting the option
7749 warns about overflows when writing to members of the largest complete
7750 objects whose exact size is known. However, it does not warn for excessive
7751 writes to the same members of unknown objects referenced by pointers since
7752 they may point to arrays containing unknown numbers of elements. This is
7753 the default setting of the option.
7754
7755 @item -Wstringop-overflow=3
7756 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7757 to determine the sizes of destination objects. At this setting the option
7758 warns about overflowing the smallest object or data member. This is the
7759 most restrictive setting of the option that may result in warnings for safe
7760 code.
7761
7762 @item -Wstringop-overflow=4
7763 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7764 to determine the sizes of destination objects. At this setting the option
7765 warns about overflowing any data members, and when the destination is
7766 one of several objects it uses the size of the largest of them to decide
7767 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
7768 setting of the option may result in warnings for benign code.
7769 @end table
7770
7771 @item -Wno-stringop-overread
7772 @opindex Wstringop-overread
7773 @opindex Wno-stringop-overread
7774 Warn for calls to string manipulation functions such as @code{memchr}, or
7775 @code{strcpy} that are determined to read past the end of the source
7776 sequence.
7777
7778 Option @option{-Wstringop-overread} is enabled by default.
7779
7780 @item -Wno-stringop-truncation
7781 @opindex Wstringop-truncation
7782 @opindex Wno-stringop-truncation
7783 Do not warn for calls to bounded string manipulation functions
7784 such as @code{strncat},
7785 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7786 or leave the destination unchanged.
7787
7788 In the following example, the call to @code{strncat} specifies a bound that
7789 is less than the length of the source string. As a result, the copy of
7790 the source will be truncated and so the call is diagnosed. To avoid the
7791 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7792
7793 @smallexample
7794 void append (char *buf, size_t bufsize)
7795 @{
7796 strncat (buf, ".txt", 3);
7797 @}
7798 @end smallexample
7799
7800 As another example, the following call to @code{strncpy} results in copying
7801 to @code{d} just the characters preceding the terminating NUL, without
7802 appending the NUL to the end. Assuming the result of @code{strncpy} is
7803 necessarily a NUL-terminated string is a common mistake, and so the call
7804 is diagnosed. To avoid the warning when the result is not expected to be
7805 NUL-terminated, call @code{memcpy} instead.
7806
7807 @smallexample
7808 void copy (char *d, const char *s)
7809 @{
7810 strncpy (d, s, strlen (s));
7811 @}
7812 @end smallexample
7813
7814 In the following example, the call to @code{strncpy} specifies the size
7815 of the destination buffer as the bound. If the length of the source
7816 string is equal to or greater than this size the result of the copy will
7817 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
7818 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7819 element of the buffer to @code{NUL}.
7820
7821 @smallexample
7822 void copy (const char *s)
7823 @{
7824 char buf[80];
7825 strncpy (buf, s, sizeof buf);
7826 @dots{}
7827 @}
7828 @end smallexample
7829
7830 In situations where a character array is intended to store a sequence
7831 of bytes with no terminating @code{NUL} such an array may be annotated
7832 with attribute @code{nonstring} to avoid this warning. Such arrays,
7833 however, are not suitable arguments to functions that expect
7834 @code{NUL}-terminated strings. To help detect accidental misuses of
7835 such arrays GCC issues warnings unless it can prove that the use is
7836 safe. @xref{Common Variable Attributes}.
7837
7838 @item -Wstrict-flex-arrays
7839 @opindex Wstrict-flex-arrays
7840 @opindex Wno-strict-flex-arrays
7841 Warn about inproper usages of flexible array members
7842 according to the @var{level} of the @code{strict_flex_array (@var{level})}
7843 attribute attached to the trailing array field of a structure if it's
7844 available, otherwise according to the @var{level} of the option
7845 @option{-fstrict-flex-arrays=@var{level}}.
7846
7847 This option is effective only when @var{level} is bigger than 0. Otherwise,
7848 it will be ignored with a warning.
7849
7850 when @var{level}=1, warnings will be issued for a trailing array reference
7851 of a structure that have 2 or more elements if the trailing array is referenced
7852 as a flexible array member.
7853
7854 when @var{level}=2, in addition to @var{level}=1, additional warnings will be
7855 issued for a trailing one-element array reference of a structure
7856 if the array is referenced as a flexible array member.
7857
7858 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
7859 issued for a trailing zero-length array reference of a structure
7860 if the array is referenced as a flexible array member.
7861
7862
7863 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7864 @opindex Wsuggest-attribute=
7865 @opindex Wno-suggest-attribute=
7866 Warn for cases where adding an attribute may be beneficial. The
7867 attributes currently supported are listed below.
7868
7869 @table @gcctabopt
7870 @item -Wsuggest-attribute=pure
7871 @itemx -Wsuggest-attribute=const
7872 @itemx -Wsuggest-attribute=noreturn
7873 @itemx -Wmissing-noreturn
7874 @itemx -Wsuggest-attribute=malloc
7875 @opindex Wsuggest-attribute=pure
7876 @opindex Wno-suggest-attribute=pure
7877 @opindex Wsuggest-attribute=const
7878 @opindex Wno-suggest-attribute=const
7879 @opindex Wsuggest-attribute=noreturn
7880 @opindex Wno-suggest-attribute=noreturn
7881 @opindex Wmissing-noreturn
7882 @opindex Wno-missing-noreturn
7883 @opindex Wsuggest-attribute=malloc
7884 @opindex Wno-suggest-attribute=malloc
7885
7886 Warn about functions that might be candidates for attributes
7887 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7888 only warns for functions visible in other compilation units or (in the case of
7889 @code{pure} and @code{const}) if it cannot prove that the function returns
7890 normally. A function returns normally if it doesn't contain an infinite loop or
7891 return abnormally by throwing, calling @code{abort} or trapping. This analysis
7892 requires option @option{-fipa-pure-const}, which is enabled by default at
7893 @option{-O} and higher. Higher optimization levels improve the accuracy
7894 of the analysis.
7895
7896 @item -Wsuggest-attribute=format
7897 @itemx -Wmissing-format-attribute
7898 @opindex Wsuggest-attribute=format
7899 @opindex Wmissing-format-attribute
7900 @opindex Wno-suggest-attribute=format
7901 @opindex Wno-missing-format-attribute
7902 @opindex Wformat
7903 @opindex Wno-format
7904
7905 Warn about function pointers that might be candidates for @code{format}
7906 attributes. Note these are only possible candidates, not absolute ones.
7907 GCC guesses that function pointers with @code{format} attributes that
7908 are used in assignment, initialization, parameter passing or return
7909 statements should have a corresponding @code{format} attribute in the
7910 resulting type. I.e.@: the left-hand side of the assignment or
7911 initialization, the type of the parameter variable, or the return type
7912 of the containing function respectively should also have a @code{format}
7913 attribute to avoid the warning.
7914
7915 GCC also warns about function definitions that might be
7916 candidates for @code{format} attributes. Again, these are only
7917 possible candidates. GCC guesses that @code{format} attributes
7918 might be appropriate for any function that calls a function like
7919 @code{vprintf} or @code{vscanf}, but this might not always be the
7920 case, and some functions for which @code{format} attributes are
7921 appropriate may not be detected.
7922
7923 @item -Wsuggest-attribute=cold
7924 @opindex Wsuggest-attribute=cold
7925 @opindex Wno-suggest-attribute=cold
7926
7927 Warn about functions that might be candidates for @code{cold} attribute. This
7928 is based on static detection and generally only warns about functions which
7929 always leads to a call to another @code{cold} function such as wrappers of
7930 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7931 @end table
7932
7933 @item -Walloc-zero
7934 @opindex Wno-alloc-zero
7935 @opindex Walloc-zero
7936 Warn about calls to allocation functions decorated with attribute
7937 @code{alloc_size} that specify zero bytes, including those to the built-in
7938 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7939 @code{malloc}, and @code{realloc}. Because the behavior of these functions
7940 when called with a zero size differs among implementations (and in the case
7941 of @code{realloc} has been deprecated) relying on it may result in subtle
7942 portability bugs and should be avoided.
7943
7944 @item -Walloc-size-larger-than=@var{byte-size}
7945 @opindex Walloc-size-larger-than=
7946 @opindex Wno-alloc-size-larger-than
7947 Warn about calls to functions decorated with attribute @code{alloc_size}
7948 that attempt to allocate objects larger than the specified number of bytes,
7949 or where the result of the size computation in an integer type with infinite
7950 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7951 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7952 Warnings controlled by the option can be disabled either by specifying
7953 @var{byte-size} of @samp{SIZE_MAX} or more or by
7954 @option{-Wno-alloc-size-larger-than}.
7955 @xref{Function Attributes}.
7956
7957 @item -Wno-alloc-size-larger-than
7958 @opindex Wno-alloc-size-larger-than
7959 Disable @option{-Walloc-size-larger-than=} warnings. The option is
7960 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7961 larger.
7962
7963 @item -Walloca
7964 @opindex Wno-alloca
7965 @opindex Walloca
7966 This option warns on all uses of @code{alloca} in the source.
7967
7968 @item -Walloca-larger-than=@var{byte-size}
7969 @opindex Walloca-larger-than=
7970 @opindex Wno-alloca-larger-than
7971 This option warns on calls to @code{alloca} with an integer argument whose
7972 value is either zero, or that is not bounded by a controlling predicate
7973 that limits its value to at most @var{byte-size}. It also warns for calls
7974 to @code{alloca} where the bound value is unknown. Arguments of non-integer
7975 types are considered unbounded even if they appear to be constrained to
7976 the expected range.
7977
7978 For example, a bounded case of @code{alloca} could be:
7979
7980 @smallexample
7981 void func (size_t n)
7982 @{
7983 void *p;
7984 if (n <= 1000)
7985 p = alloca (n);
7986 else
7987 p = malloc (n);
7988 f (p);
7989 @}
7990 @end smallexample
7991
7992 In the above example, passing @code{-Walloca-larger-than=1000} would not
7993 issue a warning because the call to @code{alloca} is known to be at most
7994 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
7995 the compiler would emit a warning.
7996
7997 Unbounded uses, on the other hand, are uses of @code{alloca} with no
7998 controlling predicate constraining its integer argument. For example:
7999
8000 @smallexample
8001 void func ()
8002 @{
8003 void *p = alloca (n);
8004 f (p);
8005 @}
8006 @end smallexample
8007
8008 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8009 a warning, but this time because of the lack of bounds checking.
8010
8011 Note, that even seemingly correct code involving signed integers could
8012 cause a warning:
8013
8014 @smallexample
8015 void func (signed int n)
8016 @{
8017 if (n < 500)
8018 @{
8019 p = alloca (n);
8020 f (p);
8021 @}
8022 @}
8023 @end smallexample
8024
8025 In the above example, @var{n} could be negative, causing a larger than
8026 expected argument to be implicitly cast into the @code{alloca} call.
8027
8028 This option also warns when @code{alloca} is used in a loop.
8029
8030 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8031 but is usually only effective when @option{-ftree-vrp} is active (default
8032 for @option{-O2} and above).
8033
8034 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8035
8036 @item -Wno-alloca-larger-than
8037 @opindex Wno-alloca-larger-than
8038 Disable @option{-Walloca-larger-than=} warnings. The option is
8039 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8040
8041 @item -Warith-conversion
8042 @opindex Warith-conversion
8043 @opindex Wno-arith-conversion
8044 Do warn about implicit conversions from arithmetic operations even
8045 when conversion of the operands to the same type cannot change their
8046 values. This affects warnings from @option{-Wconversion},
8047 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8048
8049 @smallexample
8050 @group
8051 void f (char c, int i)
8052 @{
8053 c = c + i; // warns with @option{-Wconversion}
8054 c = c + 1; // only warns with @option{-Warith-conversion}
8055 @}
8056 @end group
8057 @end smallexample
8058
8059 @item -Warray-bounds
8060 @itemx -Warray-bounds=@var{n}
8061 @opindex Wno-array-bounds
8062 @opindex Warray-bounds
8063 Warn about out of bounds subscripts or offsets into arrays. This warning
8064 is enabled by @option{-Wall}. It is more effective when @option{-ftree-vrp}
8065 is active (the default for @option{-O2} and above) but a subset of instances
8066 are issued even without optimization.
8067
8068 By default, the trailing array of a structure will be treated as a flexible
8069 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8070 if it is declared as either a flexible array member per C99 standard onwards
8071 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8072 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8073 zero-length arrays or one-element arrays are not warned by default.
8074
8075 You can add the option @option{-fstrict-flex-arrays} or
8076 @option{-fstrict-flex-arrays=@var{level}} to control how this
8077 option treat trailing array of a structure as a flexible array member:
8078
8079 when @var{level}<=1, no change to the default behavior.
8080
8081 when @var{level}=2, additional warnings will be issued for out of bounds
8082 subscripts or offsets into one-element arrays;
8083
8084 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8085 issued for out of bounds subscripts or offsets into zero-length arrays.
8086
8087 @table @gcctabopt
8088 @item -Warray-bounds=1
8089 This is the default warning level of @option{-Warray-bounds} and is enabled
8090 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8091
8092 @item -Warray-bounds=2
8093 This warning level also warns about the intermediate results of pointer
8094 arithmetic that may yield out of bounds values. This warning level may
8095 give a larger number of false positives and is deactivated by default.
8096 @end table
8097
8098 @item -Warray-compare
8099 @opindex Warray-compare
8100 @opindex Wno-array-compare
8101 Warn about equality and relational comparisons between two operands of array
8102 type. This comparison was deprecated in C++20. For example:
8103
8104 @smallexample
8105 int arr1[5];
8106 int arr2[5];
8107 bool same = arr1 == arr2;
8108 @end smallexample
8109
8110 @option{-Warray-compare} is enabled by @option{-Wall}.
8111
8112 @item -Warray-parameter
8113 @itemx -Warray-parameter=@var{n}
8114 @opindex Wno-array-parameter
8115 Warn about redeclarations of functions involving arguments of array or
8116 pointer types of inconsistent kinds or forms, and enable the detection
8117 of out-of-bounds accesses to such parameters by warnings such as
8118 @option{-Warray-bounds}.
8119
8120 If the first function declaration uses the array form the bound specified
8121 in the array is assumed to be the minimum number of elements expected to
8122 be provided in calls to the function and the maximum number of elements
8123 accessed by it. Failing to provide arguments of sufficient size or accessing
8124 more than the maximum number of elements may be diagnosed by warnings such
8125 as @option{-Warray-bounds}. At level 1 the warning diagnoses inconsistencies
8126 involving array parameters declared using the @code{T[static N]} form.
8127
8128 For example, the warning triggers for the following redeclarations because
8129 the first one allows an array of any size to be passed to @code{f} while
8130 the second one with the keyword @code{static} specifies that the array
8131 argument must have at least four elements.
8132
8133 @smallexample
8134 void f (int[static 4]);
8135 void f (int[]); // warning (inconsistent array form)
8136
8137 void g (void)
8138 @{
8139 int *p = (int *)malloc (4);
8140 f (p); // warning (array too small)
8141 @dots{}
8142 @}
8143 @end smallexample
8144
8145 At level 2 the warning also triggers for redeclarations involving any other
8146 inconsistency in array or pointer argument forms denoting array sizes.
8147 Pointers and arrays of unspecified bound are considered equivalent and do
8148 not trigger a warning.
8149
8150 @smallexample
8151 void g (int*);
8152 void g (int[]); // no warning
8153 void g (int[8]); // warning (inconsistent array bound)
8154 @end smallexample
8155
8156 @option{-Warray-parameter=2} is included in @option{-Wall}. The
8157 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8158 involving Variable Length Array arguments.
8159
8160 @item -Wattribute-alias=@var{n}
8161 @itemx -Wno-attribute-alias
8162 @opindex Wattribute-alias
8163 @opindex Wno-attribute-alias
8164 Warn about declarations using the @code{alias} and similar attributes whose
8165 target is incompatible with the type of the alias.
8166 @xref{Function Attributes,,Declaring Attributes of Functions}.
8167
8168 @table @gcctabopt
8169 @item -Wattribute-alias=1
8170 The default warning level of the @option{-Wattribute-alias} option diagnoses
8171 incompatibilities between the type of the alias declaration and that of its
8172 target. Such incompatibilities are typically indicative of bugs.
8173
8174 @item -Wattribute-alias=2
8175
8176 At this level @option{-Wattribute-alias} also diagnoses cases where
8177 the attributes of the alias declaration are more restrictive than the
8178 attributes applied to its target. These mismatches can potentially
8179 result in incorrect code generation. In other cases they may be
8180 benign and could be resolved simply by adding the missing attribute to
8181 the target. For comparison, see the @option{-Wmissing-attributes}
8182 option, which controls diagnostics when the alias declaration is less
8183 restrictive than the target, rather than more restrictive.
8184
8185 Attributes considered include @code{alloc_align}, @code{alloc_size},
8186 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8187 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8188 @code{returns_nonnull}, and @code{returns_twice}.
8189 @end table
8190
8191 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8192 This is the default. You can disable these warnings with either
8193 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8194
8195 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8196 @opindex Wbidi-chars=
8197 @opindex Wbidi-chars
8198 @opindex Wno-bidi-chars
8199 Warn about possibly misleading UTF-8 bidirectional control characters in
8200 comments, string literals, character constants, and identifiers. Such
8201 characters can change left-to-right writing direction into right-to-left
8202 (and vice versa), which can cause confusion between the logical order and
8203 visual order. This may be dangerous; for instance, it may seem that a piece
8204 of code is not commented out, whereas it in fact is.
8205
8206 There are three levels of warning supported by GCC@. The default is
8207 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8208 bidi contexts. @option{-Wbidi-chars=none} turns the warning off.
8209 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8210 characters.
8211
8212 By default, this warning does not warn about UCNs. It is, however, possible
8213 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8214 @option{-Wbidi-chars=any,ucn}. Using @option{-Wbidi-chars=ucn} is valid,
8215 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8216 @option{-Wbidi-chars=any} was specified.
8217
8218 @item -Wbool-compare
8219 @opindex Wno-bool-compare
8220 @opindex Wbool-compare
8221 Warn about boolean expression compared with an integer value different from
8222 @code{true}/@code{false}. For instance, the following comparison is
8223 always false:
8224 @smallexample
8225 int n = 5;
8226 @dots{}
8227 if ((n > 1) == 2) @{ @dots{} @}
8228 @end smallexample
8229 This warning is enabled by @option{-Wall}.
8230
8231 @item -Wbool-operation
8232 @opindex Wno-bool-operation
8233 @opindex Wbool-operation
8234 Warn about suspicious operations on expressions of a boolean type. For
8235 instance, bitwise negation of a boolean is very likely a bug in the program.
8236 For C, this warning also warns about incrementing or decrementing a boolean,
8237 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
8238 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8239
8240 This warning is enabled by @option{-Wall}.
8241
8242 @item -Wduplicated-branches
8243 @opindex Wno-duplicated-branches
8244 @opindex Wduplicated-branches
8245 Warn when an if-else has identical branches. This warning detects cases like
8246 @smallexample
8247 if (p != NULL)
8248 return 0;
8249 else
8250 return 0;
8251 @end smallexample
8252 It doesn't warn when both branches contain just a null statement. This warning
8253 also warn for conditional operators:
8254 @smallexample
8255 int i = x ? *p : *p;
8256 @end smallexample
8257
8258 @item -Wduplicated-cond
8259 @opindex Wno-duplicated-cond
8260 @opindex Wduplicated-cond
8261 Warn about duplicated conditions in an if-else-if chain. For instance,
8262 warn for the following code:
8263 @smallexample
8264 if (p->q != NULL) @{ @dots{} @}
8265 else if (p->q != NULL) @{ @dots{} @}
8266 @end smallexample
8267
8268 @item -Wframe-address
8269 @opindex Wno-frame-address
8270 @opindex Wframe-address
8271 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8272 is called with an argument greater than 0. Such calls may return indeterminate
8273 values or crash the program. The warning is included in @option{-Wall}.
8274
8275 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8276 @opindex Wno-discarded-qualifiers
8277 @opindex Wdiscarded-qualifiers
8278 Do not warn if type qualifiers on pointers are being discarded.
8279 Typically, the compiler warns if a @code{const char *} variable is
8280 passed to a function that takes a @code{char *} parameter. This option
8281 can be used to suppress such a warning.
8282
8283 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8284 @opindex Wno-discarded-array-qualifiers
8285 @opindex Wdiscarded-array-qualifiers
8286 Do not warn if type qualifiers on arrays which are pointer targets
8287 are being discarded. Typically, the compiler warns if a
8288 @code{const int (*)[]} variable is passed to a function that
8289 takes a @code{int (*)[]} parameter. This option can be used to
8290 suppress such a warning.
8291
8292 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8293 @opindex Wno-incompatible-pointer-types
8294 @opindex Wincompatible-pointer-types
8295 Do not warn when there is a conversion between pointers that have incompatible
8296 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
8297 which warns for pointer argument passing or assignment with different
8298 signedness.
8299
8300 @item -Wno-int-conversion @r{(C and Objective-C only)}
8301 @opindex Wno-int-conversion
8302 @opindex Wint-conversion
8303 Do not warn about incompatible integer to pointer and pointer to integer
8304 conversions. This warning is about implicit conversions; for explicit
8305 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8306 @option{-Wno-pointer-to-int-cast} may be used.
8307
8308 @item -Wzero-length-bounds
8309 @opindex Wzero-length-bounds
8310 @opindex Wzero-length-bounds
8311 Warn about accesses to elements of zero-length array members that might
8312 overlap other members of the same object. Declaring interior zero-length
8313 arrays is discouraged because accesses to them are undefined. See
8314 @xref{Zero Length}.
8315
8316 For example, the first two stores in function @code{bad} are diagnosed
8317 because the array elements overlap the subsequent members @code{b} and
8318 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
8319 because it is beyond the bounds of the enclosing object.
8320
8321 @smallexample
8322 struct X @{ int a[0]; int b, c; @};
8323 struct X x;
8324
8325 void bad (void)
8326 @{
8327 x.a[0] = 0; // -Wzero-length-bounds
8328 x.a[1] = 1; // -Wzero-length-bounds
8329 x.a[2] = 2; // -Warray-bounds
8330 @}
8331 @end smallexample
8332
8333 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8334
8335 @item -Wno-div-by-zero
8336 @opindex Wno-div-by-zero
8337 @opindex Wdiv-by-zero
8338 Do not warn about compile-time integer division by zero. Floating-point
8339 division by zero is not warned about, as it can be a legitimate way of
8340 obtaining infinities and NaNs.
8341
8342 @item -Wsystem-headers
8343 @opindex Wsystem-headers
8344 @opindex Wno-system-headers
8345 @cindex warnings from system headers
8346 @cindex system headers, warnings from
8347 Print warning messages for constructs found in system header files.
8348 Warnings from system headers are normally suppressed, on the assumption
8349 that they usually do not indicate real problems and would only make the
8350 compiler output harder to read. Using this command-line option tells
8351 GCC to emit warnings from system headers as if they occurred in user
8352 code. However, note that using @option{-Wall} in conjunction with this
8353 option does @emph{not} warn about unknown pragmas in system
8354 headers---for that, @option{-Wunknown-pragmas} must also be used.
8355
8356 @item -Wtautological-compare
8357 @opindex Wtautological-compare
8358 @opindex Wno-tautological-compare
8359 Warn if a self-comparison always evaluates to true or false. This
8360 warning detects various mistakes such as:
8361 @smallexample
8362 int i = 1;
8363 @dots{}
8364 if (i > i) @{ @dots{} @}
8365 @end smallexample
8366
8367 This warning also warns about bitwise comparisons that always evaluate
8368 to true or false, for instance:
8369 @smallexample
8370 if ((a & 16) == 10) @{ @dots{} @}
8371 @end smallexample
8372 will always be false.
8373
8374 This warning is enabled by @option{-Wall}.
8375
8376 @item -Wtrampolines
8377 @opindex Wtrampolines
8378 @opindex Wno-trampolines
8379 Warn about trampolines generated for pointers to nested functions.
8380 A trampoline is a small piece of data or code that is created at run
8381 time on the stack when the address of a nested function is taken, and is
8382 used to call the nested function indirectly. For some targets, it is
8383 made up of data only and thus requires no special treatment. But, for
8384 most targets, it is made up of code and thus requires the stack to be
8385 made executable in order for the program to work properly.
8386
8387 @item -Wfloat-equal
8388 @opindex Wfloat-equal
8389 @opindex Wno-float-equal
8390 Warn if floating-point values are used in equality comparisons.
8391
8392 The idea behind this is that sometimes it is convenient (for the
8393 programmer) to consider floating-point values as approximations to
8394 infinitely precise real numbers. If you are doing this, then you need
8395 to compute (by analyzing the code, or in some other way) the maximum or
8396 likely maximum error that the computation introduces, and allow for it
8397 when performing comparisons (and when producing output, but that's a
8398 different problem). In particular, instead of testing for equality, you
8399 should check to see whether the two values have ranges that overlap; and
8400 this is done with the relational operators, so equality comparisons are
8401 probably mistaken.
8402
8403 @item -Wtraditional @r{(C and Objective-C only)}
8404 @opindex Wtraditional
8405 @opindex Wno-traditional
8406 Warn about certain constructs that behave differently in traditional and
8407 ISO C@. Also warn about ISO C constructs that have no traditional C
8408 equivalent, and/or problematic constructs that should be avoided.
8409
8410 @itemize @bullet
8411 @item
8412 Macro parameters that appear within string literals in the macro body.
8413 In traditional C macro replacement takes place within string literals,
8414 but in ISO C it does not.
8415
8416 @item
8417 In traditional C, some preprocessor directives did not exist.
8418 Traditional preprocessors only considered a line to be a directive
8419 if the @samp{#} appeared in column 1 on the line. Therefore
8420 @option{-Wtraditional} warns about directives that traditional C
8421 understands but ignores because the @samp{#} does not appear as the
8422 first character on the line. It also suggests you hide directives like
8423 @code{#pragma} not understood by traditional C by indenting them. Some
8424 traditional implementations do not recognize @code{#elif}, so this option
8425 suggests avoiding it altogether.
8426
8427 @item
8428 A function-like macro that appears without arguments.
8429
8430 @item
8431 The unary plus operator.
8432
8433 @item
8434 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8435 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
8436 constants.) Note, these suffixes appear in macros defined in the system
8437 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8438 Use of these macros in user code might normally lead to spurious
8439 warnings, however GCC's integrated preprocessor has enough context to
8440 avoid warning in these cases.
8441
8442 @item
8443 A function declared external in one block and then used after the end of
8444 the block.
8445
8446 @item
8447 A @code{switch} statement has an operand of type @code{long}.
8448
8449 @item
8450 A non-@code{static} function declaration follows a @code{static} one.
8451 This construct is not accepted by some traditional C compilers.
8452
8453 @item
8454 The ISO type of an integer constant has a different width or
8455 signedness from its traditional type. This warning is only issued if
8456 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
8457 typically represent bit patterns, are not warned about.
8458
8459 @item
8460 Usage of ISO string concatenation is detected.
8461
8462 @item
8463 Initialization of automatic aggregates.
8464
8465 @item
8466 Identifier conflicts with labels. Traditional C lacks a separate
8467 namespace for labels.
8468
8469 @item
8470 Initialization of unions. If the initializer is zero, the warning is
8471 omitted. This is done under the assumption that the zero initializer in
8472 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8473 initializer warnings and relies on default initialization to zero in the
8474 traditional C case.
8475
8476 @item
8477 Conversions by prototypes between fixed/floating-point values and vice
8478 versa. The absence of these prototypes when compiling with traditional
8479 C causes serious problems. This is a subset of the possible
8480 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8481
8482 @item
8483 Use of ISO C style function definitions. This warning intentionally is
8484 @emph{not} issued for prototype declarations or variadic functions
8485 because these ISO C features appear in your code when using
8486 libiberty's traditional C compatibility macros, @code{PARAMS} and
8487 @code{VPARAMS}. This warning is also bypassed for nested functions
8488 because that feature is already a GCC extension and thus not relevant to
8489 traditional C compatibility.
8490 @end itemize
8491
8492 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8493 @opindex Wtraditional-conversion
8494 @opindex Wno-traditional-conversion
8495 Warn if a prototype causes a type conversion that is different from what
8496 would happen to the same argument in the absence of a prototype. This
8497 includes conversions of fixed point to floating and vice versa, and
8498 conversions changing the width or signedness of a fixed-point argument
8499 except when the same as the default promotion.
8500
8501 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8502 @opindex Wdeclaration-after-statement
8503 @opindex Wno-declaration-after-statement
8504 Warn when a declaration is found after a statement in a block. This
8505 construct, known from C++, was introduced with ISO C99 and is by default
8506 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}.
8507
8508 @item -Wshadow
8509 @opindex Wshadow
8510 @opindex Wno-shadow
8511 Warn whenever a local variable or type declaration shadows another
8512 variable, parameter, type, class member (in C++), or instance variable
8513 (in Objective-C) or whenever a built-in function is shadowed. Note
8514 that in C++, the compiler warns if a local variable shadows an
8515 explicit typedef, but not if it shadows a struct/class/enum.
8516 If this warning is enabled, it includes also all instances of
8517 local shadowing. This means that @option{-Wno-shadow=local}
8518 and @option{-Wno-shadow=compatible-local} are ignored when
8519 @option{-Wshadow} is used.
8520 Same as @option{-Wshadow=global}.
8521
8522 @item -Wno-shadow-ivar @r{(Objective-C only)}
8523 @opindex Wno-shadow-ivar
8524 @opindex Wshadow-ivar
8525 Do not warn whenever a local variable shadows an instance variable in an
8526 Objective-C method.
8527
8528 @item -Wshadow=global
8529 @opindex Wshadow=global
8530 Warn for any shadowing.
8531 Same as @option{-Wshadow}.
8532
8533 @item -Wshadow=local
8534 @opindex Wshadow=local
8535 Warn when a local variable shadows another local variable or parameter.
8536
8537 @item -Wshadow=compatible-local
8538 @opindex Wshadow=compatible-local
8539 Warn when a local variable shadows another local variable or parameter
8540 whose type is compatible with that of the shadowing variable. In C++,
8541 type compatibility here means the type of the shadowing variable can be
8542 converted to that of the shadowed variable. The creation of this flag
8543 (in addition to @option{-Wshadow=local}) is based on the idea that when
8544 a local variable shadows another one of incompatible type, it is most
8545 likely intentional, not a bug or typo, as shown in the following example:
8546
8547 @smallexample
8548 @group
8549 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8550 @{
8551 for (int i = 0; i < N; ++i)
8552 @{
8553 ...
8554 @}
8555 ...
8556 @}
8557 @end group
8558 @end smallexample
8559
8560 Since the two variable @code{i} in the example above have incompatible types,
8561 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8562 Because their types are incompatible, if a programmer accidentally uses one
8563 in place of the other, type checking is expected to catch that and emit an
8564 error or warning. Use of this flag instead of @option{-Wshadow=local} can
8565 possibly reduce the number of warnings triggered by intentional shadowing.
8566 Note that this also means that shadowing @code{const char *i} by
8567 @code{char *i} does not emit a warning.
8568
8569 This warning is also enabled by @option{-Wshadow=local}.
8570
8571 @item -Wlarger-than=@var{byte-size}
8572 @opindex Wlarger-than=
8573 @opindex Wlarger-than-@var{byte-size}
8574 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8575 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8576 Warnings controlled by the option can be disabled either by specifying
8577 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8578
8579 Also warn for calls to bounded functions such as @code{memchr} or
8580 @code{strnlen} that specify a bound greater than the largest possible
8581 object, which is @samp{PTRDIFF_MAX} bytes by default. These warnings
8582 can only be disabled by @option{-Wno-larger-than}.
8583
8584 @item -Wno-larger-than
8585 @opindex Wno-larger-than
8586 Disable @option{-Wlarger-than=} warnings. The option is equivalent
8587 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8588
8589 @item -Wframe-larger-than=@var{byte-size}
8590 @opindex Wframe-larger-than=
8591 @opindex Wno-frame-larger-than
8592 Warn if the size of a function frame exceeds @var{byte-size}.
8593 The computation done to determine the stack frame size is approximate
8594 and not conservative.
8595 The actual requirements may be somewhat greater than @var{byte-size}
8596 even if you do not get a warning. In addition, any space allocated
8597 via @code{alloca}, variable-length arrays, or related constructs
8598 is not included by the compiler when determining
8599 whether or not to issue a warning.
8600 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8601 Warnings controlled by the option can be disabled either by specifying
8602 @var{byte-size} of @samp{SIZE_MAX} or more or by
8603 @option{-Wno-frame-larger-than}.
8604
8605 @item -Wno-frame-larger-than
8606 @opindex Wno-frame-larger-than
8607 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
8608 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8609
8610 @item -Wfree-nonheap-object
8611 @opindex Wfree-nonheap-object
8612 @opindex Wno-free-nonheap-object
8613 Warn when attempting to deallocate an object that was either not allocated
8614 on the heap, or by using a pointer that was not returned from a prior call
8615 to the corresponding allocation function. For example, because the call
8616 to @code{stpcpy} returns a pointer to the terminating nul character and
8617 not to the beginning of the object, the call to @code{free} below is
8618 diagnosed.
8619
8620 @smallexample
8621 void f (char *p)
8622 @{
8623 p = stpcpy (p, "abc");
8624 // ...
8625 free (p); // warning
8626 @}
8627 @end smallexample
8628
8629 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8630
8631 @item -Wstack-usage=@var{byte-size}
8632 @opindex Wstack-usage
8633 @opindex Wno-stack-usage
8634 Warn if the stack usage of a function might exceed @var{byte-size}.
8635 The computation done to determine the stack usage is conservative.
8636 Any space allocated via @code{alloca}, variable-length arrays, or related
8637 constructs is included by the compiler when determining whether or not to
8638 issue a warning.
8639
8640 The message is in keeping with the output of @option{-fstack-usage}.
8641
8642 @itemize
8643 @item
8644 If the stack usage is fully static but exceeds the specified amount, it's:
8645
8646 @smallexample
8647 warning: stack usage is 1120 bytes
8648 @end smallexample
8649 @item
8650 If the stack usage is (partly) dynamic but bounded, it's:
8651
8652 @smallexample
8653 warning: stack usage might be 1648 bytes
8654 @end smallexample
8655 @item
8656 If the stack usage is (partly) dynamic and not bounded, it's:
8657
8658 @smallexample
8659 warning: stack usage might be unbounded
8660 @end smallexample
8661 @end itemize
8662
8663 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8664 Warnings controlled by the option can be disabled either by specifying
8665 @var{byte-size} of @samp{SIZE_MAX} or more or by
8666 @option{-Wno-stack-usage}.
8667
8668 @item -Wno-stack-usage
8669 @opindex Wno-stack-usage
8670 Disable @option{-Wstack-usage=} warnings. The option is equivalent
8671 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8672
8673 @item -Wunsafe-loop-optimizations
8674 @opindex Wunsafe-loop-optimizations
8675 @opindex Wno-unsafe-loop-optimizations
8676 Warn if the loop cannot be optimized because the compiler cannot
8677 assume anything on the bounds of the loop indices. With
8678 @option{-funsafe-loop-optimizations} warn if the compiler makes
8679 such assumptions.
8680
8681 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8682 @opindex Wno-pedantic-ms-format
8683 @opindex Wpedantic-ms-format
8684 When used in combination with @option{-Wformat}
8685 and @option{-pedantic} without GNU extensions, this option
8686 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8687 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8688 which depend on the MS runtime.
8689
8690 @item -Wpointer-arith
8691 @opindex Wpointer-arith
8692 @opindex Wno-pointer-arith
8693 Warn about anything that depends on the ``size of'' a function type or
8694 of @code{void}. GNU C assigns these types a size of 1, for
8695 convenience in calculations with @code{void *} pointers and pointers
8696 to functions. In C++, warn also when an arithmetic operation involves
8697 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
8698
8699 @item -Wno-pointer-compare
8700 @opindex Wpointer-compare
8701 @opindex Wno-pointer-compare
8702 Do not warn if a pointer is compared with a zero character constant.
8703 This usually
8704 means that the pointer was meant to be dereferenced. For example:
8705
8706 @smallexample
8707 const char *p = foo ();
8708 if (p == '\0')
8709 return 42;
8710 @end smallexample
8711
8712 Note that the code above is invalid in C++11.
8713
8714 This warning is enabled by default.
8715
8716 @item -Wtsan
8717 @opindex Wtsan
8718 @opindex Wno-tsan
8719 Warn about unsupported features in ThreadSanitizer.
8720
8721 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8722 can report false positives.
8723
8724 This warning is enabled by default.
8725
8726 @item -Wtype-limits
8727 @opindex Wtype-limits
8728 @opindex Wno-type-limits
8729 Warn if a comparison is always true or always false due to the limited
8730 range of the data type, but do not warn for constant expressions. For
8731 example, warn if an unsigned variable is compared against zero with
8732 @code{<} or @code{>=}. This warning is also enabled by
8733 @option{-Wextra}.
8734
8735 @item -Wabsolute-value @r{(C and Objective-C only)}
8736 @opindex Wabsolute-value
8737 @opindex Wno-absolute-value
8738 Warn for calls to standard functions that compute the absolute value
8739 of an argument when a more appropriate standard function is available.
8740 For example, calling @code{abs(3.14)} triggers the warning because the
8741 appropriate function to call to compute the absolute value of a double
8742 argument is @code{fabs}. The option also triggers warnings when the
8743 argument in a call to such a function has an unsigned type. This
8744 warning can be suppressed with an explicit type cast and it is also
8745 enabled by @option{-Wextra}.
8746
8747 @include cppwarnopts.texi
8748
8749 @item -Wbad-function-cast @r{(C and Objective-C only)}
8750 @opindex Wbad-function-cast
8751 @opindex Wno-bad-function-cast
8752 Warn when a function call is cast to a non-matching type.
8753 For example, warn if a call to a function returning an integer type
8754 is cast to a pointer type.
8755
8756 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8757 @opindex Wc90-c99-compat
8758 @opindex Wno-c90-c99-compat
8759 Warn about features not present in ISO C90, but present in ISO C99.
8760 For instance, warn about use of variable length arrays, @code{long long}
8761 type, @code{bool} type, compound literals, designated initializers, and so
8762 on. This option is independent of the standards mode. Warnings are disabled
8763 in the expression that follows @code{__extension__}.
8764
8765 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8766 @opindex Wc99-c11-compat
8767 @opindex Wno-c99-c11-compat
8768 Warn about features not present in ISO C99, but present in ISO C11.
8769 For instance, warn about use of anonymous structures and unions,
8770 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8771 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8772 and so on. This option is independent of the standards mode. Warnings are
8773 disabled in the expression that follows @code{__extension__}.
8774
8775 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8776 @opindex Wc11-c2x-compat
8777 @opindex Wno-c11-c2x-compat
8778 Warn about features not present in ISO C11, but present in ISO C2X.
8779 For instance, warn about omitting the string in @code{_Static_assert},
8780 use of @samp{[[]]} syntax for attributes, use of decimal
8781 floating-point types, and so on. This option is independent of the
8782 standards mode. Warnings are disabled in the expression that follows
8783 @code{__extension__}.
8784
8785 @item -Wc++-compat @r{(C and Objective-C only)}
8786 @opindex Wc++-compat
8787 @opindex Wno-c++-compat
8788 Warn about ISO C constructs that are outside of the common subset of
8789 ISO C and ISO C++, e.g.@: request for implicit conversion from
8790 @code{void *} to a pointer to non-@code{void} type.
8791
8792 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8793 @opindex Wc++11-compat
8794 @opindex Wno-c++11-compat
8795 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8796 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8797 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
8798 enabled by @option{-Wall}.
8799
8800 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8801 @opindex Wc++14-compat
8802 @opindex Wno-c++14-compat
8803 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8804 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
8805
8806 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8807 @opindex Wc++17-compat
8808 @opindex Wno-c++17-compat
8809 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8810 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
8811
8812 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8813 @opindex Wc++20-compat
8814 @opindex Wno-c++20-compat
8815 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8816 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
8817
8818 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8819 @opindex Wc++11-extensions
8820 @opindex Wno-c++11-extensions
8821 Do not warn about C++11 constructs in code being compiled using
8822 an older C++ standard. Even without this option, some C++11 constructs
8823 will only be diagnosed if @option{-Wpedantic} is used.
8824
8825 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8826 @opindex Wc++14-extensions
8827 @opindex Wno-c++14-extensions
8828 Do not warn about C++14 constructs in code being compiled using
8829 an older C++ standard. Even without this option, some C++14 constructs
8830 will only be diagnosed if @option{-Wpedantic} is used.
8831
8832 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
8833 @opindex Wc++17-extensions
8834 @opindex Wno-c++17-extensions
8835 Do not warn about C++17 constructs in code being compiled using
8836 an older C++ standard. Even without this option, some C++17 constructs
8837 will only be diagnosed if @option{-Wpedantic} is used.
8838
8839 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
8840 @opindex Wc++20-extensions
8841 @opindex Wno-c++20-extensions
8842 Do not warn about C++20 constructs in code being compiled using
8843 an older C++ standard. Even without this option, some C++20 constructs
8844 will only be diagnosed if @option{-Wpedantic} is used.
8845
8846 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
8847 @opindex Wc++23-extensions
8848 @opindex Wno-c++23-extensions
8849 Do not warn about C++23 constructs in code being compiled using
8850 an older C++ standard. Even without this option, some C++23 constructs
8851 will only be diagnosed if @option{-Wpedantic} is used.
8852
8853 @item -Wcast-qual
8854 @opindex Wcast-qual
8855 @opindex Wno-cast-qual
8856 Warn whenever a pointer is cast so as to remove a type qualifier from
8857 the target type. For example, warn if a @code{const char *} is cast
8858 to an ordinary @code{char *}.
8859
8860 Also warn when making a cast that introduces a type qualifier in an
8861 unsafe way. For example, casting @code{char **} to @code{const char **}
8862 is unsafe, as in this example:
8863
8864 @smallexample
8865 /* p is char ** value. */
8866 const char **q = (const char **) p;
8867 /* Assignment of readonly string to const char * is OK. */
8868 *q = "string";
8869 /* Now char** pointer points to read-only memory. */
8870 **p = 'b';
8871 @end smallexample
8872
8873 @item -Wcast-align
8874 @opindex Wcast-align
8875 @opindex Wno-cast-align
8876 Warn whenever a pointer is cast such that the required alignment of the
8877 target is increased. For example, warn if a @code{char *} is cast to
8878 an @code{int *} on machines where integers can only be accessed at
8879 two- or four-byte boundaries.
8880
8881 @item -Wcast-align=strict
8882 @opindex Wcast-align=strict
8883 Warn whenever a pointer is cast such that the required alignment of the
8884 target is increased. For example, warn if a @code{char *} is cast to
8885 an @code{int *} regardless of the target machine.
8886
8887 @item -Wcast-function-type
8888 @opindex Wcast-function-type
8889 @opindex Wno-cast-function-type
8890 Warn when a function pointer is cast to an incompatible function pointer.
8891 In a cast involving function types with a variable argument list only
8892 the types of initial arguments that are provided are considered.
8893 Any parameter of pointer-type matches any other pointer-type. Any benign
8894 differences in integral types are ignored, like @code{int} vs.@: @code{long}
8895 on ILP32 targets. Likewise type qualifiers are ignored. The function
8896 type @code{void (*) (void)} is special and matches everything, which can
8897 be used to suppress this warning.
8898 In a cast involving pointer to member types this warning warns whenever
8899 the type cast is changing the pointer to member type.
8900 This warning is enabled by @option{-Wextra}.
8901
8902 @item -Wwrite-strings
8903 @opindex Wwrite-strings
8904 @opindex Wno-write-strings
8905 When compiling C, give string constants the type @code{const
8906 char[@var{length}]} so that copying the address of one into a
8907 non-@code{const} @code{char *} pointer produces a warning. These
8908 warnings help you find at compile time code that can try to write
8909 into a string constant, but only if you have been very careful about
8910 using @code{const} in declarations and prototypes. Otherwise, it is
8911 just a nuisance. This is why we did not make @option{-Wall} request
8912 these warnings.
8913
8914 When compiling C++, warn about the deprecated conversion from string
8915 literals to @code{char *}. This warning is enabled by default for C++
8916 programs.
8917
8918 @item -Wclobbered
8919 @opindex Wclobbered
8920 @opindex Wno-clobbered
8921 Warn for variables that might be changed by @code{longjmp} or
8922 @code{vfork}. This warning is also enabled by @option{-Wextra}.
8923
8924 @item -Wconversion
8925 @opindex Wconversion
8926 @opindex Wno-conversion
8927 Warn for implicit conversions that may alter a value. This includes
8928 conversions between real and integer, like @code{abs (x)} when
8929 @code{x} is @code{double}; conversions between signed and unsigned,
8930 like @code{unsigned ui = -1}; and conversions to smaller types, like
8931 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8932 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8933 changed by the conversion like in @code{abs (2.0)}. Warnings about
8934 conversions between signed and unsigned integers can be disabled by
8935 using @option{-Wno-sign-conversion}.
8936
8937 For C++, also warn for confusing overload resolution for user-defined
8938 conversions; and conversions that never use a type conversion
8939 operator: conversions to @code{void}, the same type, a base class or a
8940 reference to them. Warnings about conversions between signed and
8941 unsigned integers are disabled by default in C++ unless
8942 @option{-Wsign-conversion} is explicitly enabled.
8943
8944 Warnings about conversion from arithmetic on a small type back to that
8945 type are only given with @option{-Warith-conversion}.
8946
8947 @item -Wdangling-else
8948 @opindex Wdangling-else
8949 @opindex Wno-dangling-else
8950 Warn about constructions where there may be confusion to which
8951 @code{if} statement an @code{else} branch belongs. Here is an example of
8952 such a case:
8953
8954 @smallexample
8955 @group
8956 @{
8957 if (a)
8958 if (b)
8959 foo ();
8960 else
8961 bar ();
8962 @}
8963 @end group
8964 @end smallexample
8965
8966 In C/C++, every @code{else} branch belongs to the innermost possible
8967 @code{if} statement, which in this example is @code{if (b)}. This is
8968 often not what the programmer expected, as illustrated in the above
8969 example by indentation the programmer chose. When there is the
8970 potential for this confusion, GCC issues a warning when this flag
8971 is specified. To eliminate the warning, add explicit braces around
8972 the innermost @code{if} statement so there is no way the @code{else}
8973 can belong to the enclosing @code{if}. The resulting code
8974 looks like this:
8975
8976 @smallexample
8977 @group
8978 @{
8979 if (a)
8980 @{
8981 if (b)
8982 foo ();
8983 else
8984 bar ();
8985 @}
8986 @}
8987 @end group
8988 @end smallexample
8989
8990 This warning is enabled by @option{-Wparentheses}.
8991
8992 @item -Wdangling-pointer
8993 @itemx -Wdangling-pointer=@var{n}
8994 @opindex Wdangling-pointer
8995 @opindex Wno-dangling-pointer
8996 Warn about uses of pointers (or C++ references) to objects with automatic
8997 storage duration after their lifetime has ended. This includes local
8998 variables declared in nested blocks, compound literals and other unnamed
8999 temporary objects. In addition, warn about storing the address of such
9000 objects in escaped pointers. The warning is enabled at all optimization
9001 levels but may yield different results with optimization than without.
9002
9003 @table @gcctabopt
9004 @item -Wdangling-pointer=1
9005 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
9006 For example
9007 @smallexample
9008 int f (int c1, int c2, x)
9009 @{
9010 char *p = strchr ((char[])@{ c1, c2 @}, c3);
9011 return p ? *p : 'x'; // warning: dangling pointer to a compound literal
9012 @}
9013 @end smallexample
9014 In the following function the store of the address of the local variable
9015 @code{x} in the escaped pointer @code{*p} also triggers the warning.
9016 @smallexample
9017 void g (int **p)
9018 @{
9019 int x = 7;
9020 *p = &x; // warning: storing the address of a local variable in *p
9021 @}
9022 @end smallexample
9023
9024 @item -Wdangling-pointer=2
9025 At level 2, in addition to unconditional uses the warning also diagnoses
9026 conditional uses of dangling pointers.
9027
9028 For example, because the array @var{a} in the following function is out of
9029 scope when the pointer @var{s} that was set to point is used, the warning
9030 triggers at this level.
9031
9032 @smallexample
9033 void f (char *s)
9034 @{
9035 if (!s)
9036 @{
9037 char a[12] = "tmpname";
9038 s = a;
9039 @}
9040 strcat (s, ".tmp"); // warning: dangling pointer to a may be used
9041 ...
9042 @}
9043 @end smallexample
9044 @end table
9045
9046 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9047
9048 @item -Wdate-time
9049 @opindex Wdate-time
9050 @opindex Wno-date-time
9051 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9052 are encountered as they might prevent bit-wise-identical reproducible
9053 compilations.
9054
9055 @item -Wempty-body
9056 @opindex Wempty-body
9057 @opindex Wno-empty-body
9058 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9059 while} statement. This warning is also enabled by @option{-Wextra}.
9060
9061 @item -Wno-endif-labels
9062 @opindex Wendif-labels
9063 @opindex Wno-endif-labels
9064 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9065
9066 @item -Wenum-compare
9067 @opindex Wenum-compare
9068 @opindex Wno-enum-compare
9069 Warn about a comparison between values of different enumerated types.
9070 In C++ enumerated type mismatches in conditional expressions are also
9071 diagnosed and the warning is enabled by default. In C this warning is
9072 enabled by @option{-Wall}.
9073
9074 @item -Wenum-conversion
9075 @opindex Wenum-conversion
9076 @opindex Wno-enum-conversion
9077 Warn when a value of enumerated type is implicitly converted to a
9078 different enumerated type. This warning is enabled by @option{-Wextra}
9079 in C@.
9080
9081 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9082 @opindex Wenum-int-mismatch
9083 @opindex Wno-enum-int-mismatch
9084 Warn about mismatches between an enumerated type and an integer type in
9085 declarations. For example:
9086
9087 @smallexample
9088 enum E @{ l = -1, z = 0, g = 1 @};
9089 int foo(void);
9090 enum E foo(void);
9091 @end smallexample
9092
9093 In C, an enumerated type is compatible with @code{char}, a signed
9094 integer type, or an unsigned integer type. However, since the choice
9095 of the underlying type of an enumerated type is implementation-defined,
9096 such mismatches may cause portability issues. In C++, such mismatches
9097 are an error. In C, this warning is enabled by @option{-Wall} and
9098 @option{-Wc++-compat}.
9099
9100 @item -Wjump-misses-init @r{(C, Objective-C only)}
9101 @opindex Wjump-misses-init
9102 @opindex Wno-jump-misses-init
9103 Warn if a @code{goto} statement or a @code{switch} statement jumps
9104 forward across the initialization of a variable, or jumps backward to a
9105 label after the variable has been initialized. This only warns about
9106 variables that are initialized when they are declared. This warning is
9107 only supported for C and Objective-C; in C++ this sort of branch is an
9108 error in any case.
9109
9110 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
9111 can be disabled with the @option{-Wno-jump-misses-init} option.
9112
9113 @item -Wsign-compare
9114 @opindex Wsign-compare
9115 @opindex Wno-sign-compare
9116 @cindex warning for comparison of signed and unsigned values
9117 @cindex comparison of signed and unsigned values, warning
9118 @cindex signed and unsigned values, comparison warning
9119 Warn when a comparison between signed and unsigned values could produce
9120 an incorrect result when the signed value is converted to unsigned.
9121 In C++, this warning is also enabled by @option{-Wall}. In C, it is
9122 also enabled by @option{-Wextra}.
9123
9124 @item -Wsign-conversion
9125 @opindex Wsign-conversion
9126 @opindex Wno-sign-conversion
9127 Warn for implicit conversions that may change the sign of an integer
9128 value, like assigning a signed integer expression to an unsigned
9129 integer variable. An explicit cast silences the warning. In C, this
9130 option is enabled also by @option{-Wconversion}.
9131
9132 @item -Wfloat-conversion
9133 @opindex Wfloat-conversion
9134 @opindex Wno-float-conversion
9135 Warn for implicit conversions that reduce the precision of a real value.
9136 This includes conversions from real to integer, and from higher precision
9137 real to lower precision real values. This option is also enabled by
9138 @option{-Wconversion}.
9139
9140 @item -Wno-scalar-storage-order
9141 @opindex Wno-scalar-storage-order
9142 @opindex Wscalar-storage-order
9143 Do not warn on suspicious constructs involving reverse scalar storage order.
9144
9145 @item -Wsizeof-array-div
9146 @opindex Wsizeof-array-div
9147 @opindex Wno-sizeof-array-div
9148 Warn about divisions of two sizeof operators when the first one is applied
9149 to an array and the divisor does not equal the size of the array element.
9150 In such a case, the computation will not yield the number of elements in the
9151 array, which is likely what the user intended. This warning warns e.g. about
9152 @smallexample
9153 int fn ()
9154 @{
9155 int arr[10];
9156 return sizeof (arr) / sizeof (short);
9157 @}
9158 @end smallexample
9159
9160 This warning is enabled by @option{-Wall}.
9161
9162 @item -Wsizeof-pointer-div
9163 @opindex Wsizeof-pointer-div
9164 @opindex Wno-sizeof-pointer-div
9165 Warn for suspicious divisions of two sizeof expressions that divide
9166 the pointer size by the element size, which is the usual way to compute
9167 the array size but won't work out correctly with pointers. This warning
9168 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9169 not an array, but a pointer. This warning is enabled by @option{-Wall}.
9170
9171 @item -Wsizeof-pointer-memaccess
9172 @opindex Wsizeof-pointer-memaccess
9173 @opindex Wno-sizeof-pointer-memaccess
9174 Warn for suspicious length parameters to certain string and memory built-in
9175 functions if the argument uses @code{sizeof}. This warning triggers for
9176 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9177 an array, but a pointer, and suggests a possible fix, or about
9178 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
9179 also warns about calls to bounded string copy functions like @code{strncat}
9180 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9181 the source array. For example, in the following function the call to
9182 @code{strncat} specifies the size of the source string as the bound. That
9183 is almost certainly a mistake and so the call is diagnosed.
9184 @smallexample
9185 void make_file (const char *name)
9186 @{
9187 char path[PATH_MAX];
9188 strncpy (path, name, sizeof path - 1);
9189 strncat (path, ".text", sizeof ".text");
9190 @dots{}
9191 @}
9192 @end smallexample
9193
9194 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9195
9196 @item -Wno-sizeof-array-argument
9197 @opindex Wsizeof-array-argument
9198 @opindex Wno-sizeof-array-argument
9199 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9200 declared as an array in a function definition. This warning is enabled by
9201 default for C and C++ programs.
9202
9203 @item -Wmemset-elt-size
9204 @opindex Wmemset-elt-size
9205 @opindex Wno-memset-elt-size
9206 Warn for suspicious calls to the @code{memset} built-in function, if the
9207 first argument references an array, and the third argument is a number
9208 equal to the number of elements, but not equal to the size of the array
9209 in memory. This indicates that the user has omitted a multiplication by
9210 the element size. This warning is enabled by @option{-Wall}.
9211
9212 @item -Wmemset-transposed-args
9213 @opindex Wmemset-transposed-args
9214 @opindex Wno-memset-transposed-args
9215 Warn for suspicious calls to the @code{memset} built-in function where
9216 the second argument is not zero and the third argument is zero. For
9217 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9218 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
9219 is only emitted if the third argument is a literal zero. Otherwise, if
9220 it is an expression that is folded to zero, or a cast of zero to some
9221 type, it is far less likely that the arguments have been mistakenly
9222 transposed and no warning is emitted. This warning is enabled
9223 by @option{-Wall}.
9224
9225 @item -Waddress
9226 @opindex Waddress
9227 @opindex Wno-address
9228 Warn about suspicious uses of address expressions. These include comparing
9229 the address of a function or a declared object to the null pointer constant
9230 such as in
9231 @smallexample
9232 void f (void);
9233 void g (void)
9234 @{
9235 if (!f) // warning: expression evaluates to false
9236 abort ();
9237 @}
9238 @end smallexample
9239 comparisons of a pointer to a string literal, such as in
9240 @smallexample
9241 void f (const char *x)
9242 @{
9243 if (x == "abc") // warning: expression evaluates to false
9244 puts ("equal");
9245 @}
9246 @end smallexample
9247 and tests of the results of pointer addition or subtraction for equality
9248 to null, such as in
9249 @smallexample
9250 void f (const int *p, int i)
9251 @{
9252 return p + i == NULL;
9253 @}
9254 @end smallexample
9255 Such uses typically indicate a programmer error: the address of most
9256 functions and objects necessarily evaluates to true (the exception are
9257 weak symbols), so their use in a conditional might indicate missing
9258 parentheses in a function call or a missing dereference in an array
9259 expression. The subset of the warning for object pointers can be
9260 suppressed by casting the pointer operand to an integer type such
9261 as @code{intptr_t} or @code{uintptr_t}.
9262 Comparisons against string literals result in unspecified behavior
9263 and are not portable, and suggest the intent was to call @code{strcmp}.
9264 The warning is suppressed if the suspicious expression is the result
9265 of macro expansion.
9266 @option{-Waddress} warning is enabled by @option{-Wall}.
9267
9268 @item -Wno-address-of-packed-member
9269 @opindex Waddress-of-packed-member
9270 @opindex Wno-address-of-packed-member
9271 Do not warn when the address of packed member of struct or union is taken,
9272 which usually results in an unaligned pointer value. This is
9273 enabled by default.
9274
9275 @item -Wlogical-op
9276 @opindex Wlogical-op
9277 @opindex Wno-logical-op
9278 Warn about suspicious uses of logical operators in expressions.
9279 This includes using logical operators in contexts where a
9280 bit-wise operator is likely to be expected. Also warns when
9281 the operands of a logical operator are the same:
9282 @smallexample
9283 extern int a;
9284 if (a < 0 && a < 0) @{ @dots{} @}
9285 @end smallexample
9286
9287 @item -Wlogical-not-parentheses
9288 @opindex Wlogical-not-parentheses
9289 @opindex Wno-logical-not-parentheses
9290 Warn about logical not used on the left hand side operand of a comparison.
9291 This option does not warn if the right operand is considered to be a boolean
9292 expression. Its purpose is to detect suspicious code like the following:
9293 @smallexample
9294 int a;
9295 @dots{}
9296 if (!a > 1) @{ @dots{} @}
9297 @end smallexample
9298
9299 It is possible to suppress the warning by wrapping the LHS into
9300 parentheses:
9301 @smallexample
9302 if ((!a) > 1) @{ @dots{} @}
9303 @end smallexample
9304
9305 This warning is enabled by @option{-Wall}.
9306
9307 @item -Waggregate-return
9308 @opindex Waggregate-return
9309 @opindex Wno-aggregate-return
9310 Warn if any functions that return structures or unions are defined or
9311 called. (In languages where you can return an array, this also elicits
9312 a warning.)
9313
9314 @item -Wno-aggressive-loop-optimizations
9315 @opindex Wno-aggressive-loop-optimizations
9316 @opindex Waggressive-loop-optimizations
9317 Warn if in a loop with constant number of iterations the compiler detects
9318 undefined behavior in some statement during one or more of the iterations.
9319
9320 @item -Wno-attributes
9321 @opindex Wno-attributes
9322 @opindex Wattributes
9323 Do not warn if an unexpected @code{__attribute__} is used, such as
9324 unrecognized attributes, function attributes applied to variables,
9325 etc. This does not stop errors for incorrect use of supported
9326 attributes.
9327
9328 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9329 warnings about unknown scoped attributes (in C++11 and C2X). For example,
9330 @option{-Wno-attributes=vendor::attr} disables warning about the following
9331 declaration:
9332
9333 @smallexample
9334 [[vendor::attr]] void f();
9335 @end smallexample
9336
9337 It is also possible to disable warning about all attributes in a namespace
9338 using @option{-Wno-attributes=vendor::} which prevents warning about both
9339 of these declarations:
9340
9341 @smallexample
9342 [[vendor::safe]] void f();
9343 [[vendor::unsafe]] void f2();
9344 @end smallexample
9345
9346 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9347
9348 @item -Wno-builtin-declaration-mismatch
9349 @opindex Wno-builtin-declaration-mismatch
9350 @opindex Wbuiltin-declaration-mismatch
9351 Warn if a built-in function is declared with an incompatible signature
9352 or as a non-function, or when a built-in function declared with a type
9353 that does not include a prototype is called with arguments whose promoted
9354 types do not match those expected by the function. When @option{-Wextra}
9355 is specified, also warn when a built-in function that takes arguments is
9356 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
9357 warning is enabled by default. To avoid the warning include the appropriate
9358 header to bring the prototypes of built-in functions into scope.
9359
9360 For example, the call to @code{memset} below is diagnosed by the warning
9361 because the function expects a value of type @code{size_t} as its argument
9362 but the type of @code{32} is @code{int}. With @option{-Wextra},
9363 the declaration of the function is diagnosed as well.
9364 @smallexample
9365 extern void* memset ();
9366 void f (void *d)
9367 @{
9368 memset (d, '\0', 32);
9369 @}
9370 @end smallexample
9371
9372 @item -Wno-builtin-macro-redefined
9373 @opindex Wno-builtin-macro-redefined
9374 @opindex Wbuiltin-macro-redefined
9375 Do not warn if certain built-in macros are redefined. This suppresses
9376 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9377 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9378
9379 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9380 @opindex Wstrict-prototypes
9381 @opindex Wno-strict-prototypes
9382 Warn if a function is declared or defined without specifying the
9383 argument types. (An old-style function definition is permitted without
9384 a warning if preceded by a declaration that specifies the argument
9385 types.)
9386
9387 @item -Wold-style-declaration @r{(C and Objective-C only)}
9388 @opindex Wold-style-declaration
9389 @opindex Wno-old-style-declaration
9390 Warn for obsolescent usages, according to the C Standard, in a
9391 declaration. For example, warn if storage-class specifiers like
9392 @code{static} are not the first things in a declaration. This warning
9393 is also enabled by @option{-Wextra}.
9394
9395 @item -Wold-style-definition @r{(C and Objective-C only)}
9396 @opindex Wold-style-definition
9397 @opindex Wno-old-style-definition
9398 Warn if an old-style function definition is used. A warning is given
9399 even if there is a previous prototype. A definition using @samp{()}
9400 is not considered an old-style definition in C2X mode, because it is
9401 equivalent to @samp{(void)} in that case, but is considered an
9402 old-style definition for older standards.
9403
9404 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9405 @opindex Wmissing-parameter-type
9406 @opindex Wno-missing-parameter-type
9407 A function parameter is declared without a type specifier in K&R-style
9408 functions:
9409
9410 @smallexample
9411 void foo(bar) @{ @}
9412 @end smallexample
9413
9414 This warning is also enabled by @option{-Wextra}.
9415
9416 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9417 @opindex Wmissing-prototypes
9418 @opindex Wno-missing-prototypes
9419 Warn if a global function is defined without a previous prototype
9420 declaration. This warning is issued even if the definition itself
9421 provides a prototype. Use this option to detect global functions
9422 that do not have a matching prototype declaration in a header file.
9423 This option is not valid for C++ because all function declarations
9424 provide prototypes and a non-matching declaration declares an
9425 overload rather than conflict with an earlier declaration.
9426 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9427
9428 @item -Wmissing-declarations
9429 @opindex Wmissing-declarations
9430 @opindex Wno-missing-declarations
9431 Warn if a global function is defined without a previous declaration.
9432 Do so even if the definition itself provides a prototype.
9433 Use this option to detect global functions that are not declared in
9434 header files. In C, no warnings are issued for functions with previous
9435 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9436 missing prototypes. In C++, no warnings are issued for function templates,
9437 or for inline functions, or for functions in anonymous namespaces.
9438
9439 @item -Wmissing-field-initializers
9440 @opindex Wmissing-field-initializers
9441 @opindex Wno-missing-field-initializers
9442 @opindex W
9443 @opindex Wextra
9444 @opindex Wno-extra
9445 Warn if a structure's initializer has some fields missing. For
9446 example, the following code causes such a warning, because
9447 @code{x.h} is implicitly zero:
9448
9449 @smallexample
9450 struct s @{ int f, g, h; @};
9451 struct s x = @{ 3, 4 @};
9452 @end smallexample
9453
9454 This option does not warn about designated initializers, so the following
9455 modification does not trigger a warning:
9456
9457 @smallexample
9458 struct s @{ int f, g, h; @};
9459 struct s x = @{ .f = 3, .g = 4 @};
9460 @end smallexample
9461
9462 In C this option does not warn about the universal zero initializer
9463 @samp{@{ 0 @}}:
9464
9465 @smallexample
9466 struct s @{ int f, g, h; @};
9467 struct s x = @{ 0 @};
9468 @end smallexample
9469
9470 Likewise, in C++ this option does not warn about the empty @{ @}
9471 initializer, for example:
9472
9473 @smallexample
9474 struct s @{ int f, g, h; @};
9475 s x = @{ @};
9476 @end smallexample
9477
9478 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
9479 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9480
9481 @item -Wno-missing-requires
9482 @opindex Wmissing-requires
9483 @opindex Wno-missing-requires
9484
9485 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9486
9487 @smallexample
9488 bool satisfied = requires @{ C<T> @};
9489 @end smallexample
9490
9491 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9492 expression, which it is for all T. Presumably the user meant to write
9493
9494 @smallexample
9495 bool satisfied = requires @{ requires C<T> @};
9496 @end smallexample
9497
9498 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9499 type @samp{T}.
9500
9501 This warning can be disabled with @option{-Wno-missing-requires}.
9502
9503 @item -Wno-missing-template-keyword
9504 @opindex Wmissing-template-keyword
9505 @opindex Wno-missing-template-keyword
9506
9507 The member access tokens ., -> and :: must be followed by the @code{template}
9508 keyword if the parent object is dependent and the member being named is a
9509 template.
9510
9511 @smallexample
9512 template <class X>
9513 void DoStuff (X x)
9514 @{
9515 x.template DoSomeOtherStuff<X>(); // Good.
9516 x.DoMoreStuff<X>(); // Warning, x is dependent.
9517 @}
9518 @end smallexample
9519
9520 In rare cases it is possible to get false positives. To silence this, wrap
9521 the expression in parentheses. For example, the following is treated as a
9522 template, even where m and N are integers:
9523
9524 @smallexample
9525 void NotATemplate (my_class t)
9526 @{
9527 int N = 5;
9528
9529 bool test = t.m < N > (0); // Treated as a template.
9530 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9531 @}
9532 @end smallexample
9533
9534 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9535
9536 @item -Wno-multichar
9537 @opindex Wno-multichar
9538 @opindex Wmultichar
9539 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9540 Usually they indicate a typo in the user's code, as they have
9541 implementation-defined values, and should not be used in portable code.
9542
9543 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9544 @opindex Wnormalized=
9545 @opindex Wnormalized
9546 @opindex Wno-normalized
9547 @cindex NFC
9548 @cindex NFKC
9549 @cindex character set, input normalization
9550 In ISO C and ISO C++, two identifiers are different if they are
9551 different sequences of characters. However, sometimes when characters
9552 outside the basic ASCII character set are used, you can have two
9553 different character sequences that look the same. To avoid confusion,
9554 the ISO 10646 standard sets out some @dfn{normalization rules} which
9555 when applied ensure that two sequences that look the same are turned into
9556 the same sequence. GCC can warn you if you are using identifiers that
9557 have not been normalized; this option controls that warning.
9558
9559 There are four levels of warning supported by GCC@. The default is
9560 @option{-Wnormalized=nfc}, which warns about any identifier that is
9561 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
9562 recommended form for most uses. It is equivalent to
9563 @option{-Wnormalized}.
9564
9565 Unfortunately, there are some characters allowed in identifiers by
9566 ISO C and ISO C++ that, when turned into NFC, are not allowed in
9567 identifiers. That is, there's no way to use these symbols in portable
9568 ISO C or C++ and have all your identifiers in NFC@.
9569 @option{-Wnormalized=id} suppresses the warning for these characters.
9570 It is hoped that future versions of the standards involved will correct
9571 this, which is why this option is not the default.
9572
9573 You can switch the warning off for all characters by writing
9574 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
9575 only do this if you are using some other normalization scheme (like
9576 ``D''), because otherwise you can easily create bugs that are
9577 literally impossible to see.
9578
9579 Some characters in ISO 10646 have distinct meanings but look identical
9580 in some fonts or display methodologies, especially once formatting has
9581 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9582 LETTER N'', displays just like a regular @code{n} that has been
9583 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
9584 normalization scheme to convert all these into a standard form as
9585 well, and GCC warns if your code is not in NFKC if you use
9586 @option{-Wnormalized=nfkc}. This warning is comparable to warning
9587 about every identifier that contains the letter O because it might be
9588 confused with the digit 0, and so is not the default, but may be
9589 useful as a local coding convention if the programming environment
9590 cannot be fixed to display these characters distinctly.
9591
9592 @item -Wno-attribute-warning
9593 @opindex Wno-attribute-warning
9594 @opindex Wattribute-warning
9595 Do not warn about usage of functions (@pxref{Function Attributes})
9596 declared with @code{warning} attribute. By default, this warning is
9597 enabled. @option{-Wno-attribute-warning} can be used to disable the
9598 warning or @option{-Wno-error=attribute-warning} can be used to
9599 disable the error when compiled with @option{-Werror} flag.
9600
9601 @item -Wno-deprecated
9602 @opindex Wno-deprecated
9603 @opindex Wdeprecated
9604 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
9605
9606 @item -Wno-deprecated-declarations
9607 @opindex Wno-deprecated-declarations
9608 @opindex Wdeprecated-declarations
9609 Do not warn about uses of functions (@pxref{Function Attributes}),
9610 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9611 Attributes}) marked as deprecated by using the @code{deprecated}
9612 attribute.
9613
9614 @item -Wno-overflow
9615 @opindex Wno-overflow
9616 @opindex Woverflow
9617 Do not warn about compile-time overflow in constant expressions.
9618
9619 @item -Wno-odr
9620 @opindex Wno-odr
9621 @opindex Wodr
9622 Warn about One Definition Rule violations during link-time optimization.
9623 Enabled by default.
9624
9625 @item -Wopenacc-parallelism
9626 @opindex Wopenacc-parallelism
9627 @opindex Wno-openacc-parallelism
9628 @cindex OpenACC accelerator programming
9629 Warn about potentially suboptimal choices related to OpenACC parallelism.
9630
9631 @item -Wopenmp-simd
9632 @opindex Wopenmp-simd
9633 @opindex Wno-openmp-simd
9634 Warn if the vectorizer cost model overrides the OpenMP
9635 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
9636 option can be used to relax the cost model.
9637
9638 @item -Woverride-init @r{(C and Objective-C only)}
9639 @opindex Woverride-init
9640 @opindex Wno-override-init
9641 @opindex W
9642 @opindex Wextra
9643 @opindex Wno-extra
9644 Warn if an initialized field without side effects is overridden when
9645 using designated initializers (@pxref{Designated Inits, , Designated
9646 Initializers}).
9647
9648 This warning is included in @option{-Wextra}. To get other
9649 @option{-Wextra} warnings without this one, use @option{-Wextra
9650 -Wno-override-init}.
9651
9652 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9653 @opindex Woverride-init-side-effects
9654 @opindex Wno-override-init-side-effects
9655 Do not warn if an initialized field with side effects is overridden when
9656 using designated initializers (@pxref{Designated Inits, , Designated
9657 Initializers}). This warning is enabled by default.
9658
9659 @item -Wpacked
9660 @opindex Wpacked
9661 @opindex Wno-packed
9662 Warn if a structure is given the packed attribute, but the packed
9663 attribute has no effect on the layout or size of the structure.
9664 Such structures may be mis-aligned for little benefit. For
9665 instance, in this code, the variable @code{f.x} in @code{struct bar}
9666 is misaligned even though @code{struct bar} does not itself
9667 have the packed attribute:
9668
9669 @smallexample
9670 @group
9671 struct foo @{
9672 int x;
9673 char a, b, c, d;
9674 @} __attribute__((packed));
9675 struct bar @{
9676 char z;
9677 struct foo f;
9678 @};
9679 @end group
9680 @end smallexample
9681
9682 @item -Wnopacked-bitfield-compat
9683 @opindex Wpacked-bitfield-compat
9684 @opindex Wno-packed-bitfield-compat
9685 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9686 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
9687 the change can lead to differences in the structure layout. GCC
9688 informs you when the offset of such a field has changed in GCC 4.4.
9689 For example there is no longer a 4-bit padding between field @code{a}
9690 and @code{b} in this structure:
9691
9692 @smallexample
9693 struct foo
9694 @{
9695 char a:4;
9696 char b:8;
9697 @} __attribute__ ((packed));
9698 @end smallexample
9699
9700 This warning is enabled by default. Use
9701 @option{-Wno-packed-bitfield-compat} to disable this warning.
9702
9703 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9704 @opindex Wpacked-not-aligned
9705 @opindex Wno-packed-not-aligned
9706 Warn if a structure field with explicitly specified alignment in a
9707 packed struct or union is misaligned. For example, a warning will
9708 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9709 'struct S' is less than 8}, in this code:
9710
9711 @smallexample
9712 @group
9713 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9714 struct __attribute__ ((packed)) S @{
9715 struct S8 s8;
9716 @};
9717 @end group
9718 @end smallexample
9719
9720 This warning is enabled by @option{-Wall}.
9721
9722 @item -Wpadded
9723 @opindex Wpadded
9724 @opindex Wno-padded
9725 Warn if padding is included in a structure, either to align an element
9726 of the structure or to align the whole structure. Sometimes when this
9727 happens it is possible to rearrange the fields of the structure to
9728 reduce the padding and so make the structure smaller.
9729
9730 @item -Wredundant-decls
9731 @opindex Wredundant-decls
9732 @opindex Wno-redundant-decls
9733 Warn if anything is declared more than once in the same scope, even in
9734 cases where multiple declaration is valid and changes nothing.
9735
9736 @item -Wrestrict
9737 @opindex Wrestrict
9738 @opindex Wno-restrict
9739 Warn when an object referenced by a @code{restrict}-qualified parameter
9740 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9741 argument, or when copies between such objects overlap. For example,
9742 the call to the @code{strcpy} function below attempts to truncate the string
9743 by replacing its initial characters with the last four. However, because
9744 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9745 the call is diagnosed.
9746
9747 @smallexample
9748 void foo (void)
9749 @{
9750 char a[] = "abcd1234";
9751 strcpy (a, a + 4);
9752 @dots{}
9753 @}
9754 @end smallexample
9755 The @option{-Wrestrict} option detects some instances of simple overlap
9756 even without optimization but works best at @option{-O2} and above. It
9757 is included in @option{-Wall}.
9758
9759 @item -Wnested-externs @r{(C and Objective-C only)}
9760 @opindex Wnested-externs
9761 @opindex Wno-nested-externs
9762 Warn if an @code{extern} declaration is encountered within a function.
9763
9764 @item -Winline
9765 @opindex Winline
9766 @opindex Wno-inline
9767 Warn if a function that is declared as inline cannot be inlined.
9768 Even with this option, the compiler does not warn about failures to
9769 inline functions declared in system headers.
9770
9771 The compiler uses a variety of heuristics to determine whether or not
9772 to inline a function. For example, the compiler takes into account
9773 the size of the function being inlined and the amount of inlining
9774 that has already been done in the current function. Therefore,
9775 seemingly insignificant changes in the source program can cause the
9776 warnings produced by @option{-Winline} to appear or disappear.
9777
9778 @item -Winterference-size
9779 @opindex Winterference-size
9780 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
9781 without specifying its value with @option{--param destructive-interference-size}.
9782 Also warn about questionable values for that option.
9783
9784 This variable is intended to be used for controlling class layout, to
9785 avoid false sharing in concurrent code:
9786
9787 @smallexample
9788 struct independent_fields @{
9789 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
9790 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
9791 @};
9792 @end smallexample
9793
9794 Here @samp{one} and @samp{two} are intended to be far enough apart
9795 that stores to one won't require accesses to the other to reload the
9796 cache line.
9797
9798 By default, @option{--param destructive-interference-size} and
9799 @option{--param constructive-interference-size} are set based on the
9800 current @option{-mtune} option, typically to the L1 cache line size
9801 for the particular target CPU, sometimes to a range if tuning for a
9802 generic target. So all translation units that depend on ABI
9803 compatibility for the use of these variables must be compiled with
9804 the same @option{-mtune} (or @option{-mcpu}).
9805
9806 If ABI stability is important, such as if the use is in a header for a
9807 library, you should probably not use the hardware interference size
9808 variables at all. Alternatively, you can force a particular value
9809 with @option{--param}.
9810
9811 If you are confident that your use of the variable does not affect ABI
9812 outside a single build of your project, you can turn off the warning
9813 with @option{-Wno-interference-size}.
9814
9815 @item -Wint-in-bool-context
9816 @opindex Wint-in-bool-context
9817 @opindex Wno-int-in-bool-context
9818 Warn for suspicious use of integer values where boolean values are expected,
9819 such as conditional expressions (?:) using non-boolean integer constants in
9820 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
9821 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
9822 for all kinds of multiplications regardless of the data type.
9823 This warning is enabled by @option{-Wall}.
9824
9825 @item -Wno-int-to-pointer-cast
9826 @opindex Wno-int-to-pointer-cast
9827 @opindex Wint-to-pointer-cast
9828 Suppress warnings from casts to pointer type of an integer of a
9829 different size. In C++, casting to a pointer type of smaller size is
9830 an error. @option{Wint-to-pointer-cast} is enabled by default.
9831
9832
9833 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
9834 @opindex Wno-pointer-to-int-cast
9835 @opindex Wpointer-to-int-cast
9836 Suppress warnings from casts from a pointer to an integer type of a
9837 different size.
9838
9839 @item -Winvalid-pch
9840 @opindex Winvalid-pch
9841 @opindex Wno-invalid-pch
9842 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
9843 the search path but cannot be used.
9844
9845 @item -Winvalid-utf8
9846 @opindex Winvalid-utf8
9847 @opindex Wno-invalid-utf8
9848 Warn if an invalid UTF-8 character is found.
9849 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
9850 is used and turned into error with @option{-pedantic-errors}.
9851
9852 @item -Wno-unicode
9853 @opindex Wunicode
9854 @opindex Wno-unicode
9855 Don't diagnose invalid forms of delimited or named escape sequences which are
9856 treated as separate tokens. @option{Wunicode} is enabled by default.
9857
9858 @item -Wlong-long
9859 @opindex Wlong-long
9860 @opindex Wno-long-long
9861 Warn if @code{long long} type is used. This is enabled by either
9862 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
9863 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
9864
9865 @item -Wvariadic-macros
9866 @opindex Wvariadic-macros
9867 @opindex Wno-variadic-macros
9868 Warn if variadic macros are used in ISO C90 mode, or if the GNU
9869 alternate syntax is used in ISO C99 mode. This is enabled by either
9870 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
9871 messages, use @option{-Wno-variadic-macros}.
9872
9873 @item -Wno-varargs
9874 @opindex Wvarargs
9875 @opindex Wno-varargs
9876 Do not warn upon questionable usage of the macros used to handle variable
9877 arguments like @code{va_start}. These warnings are enabled by default.
9878
9879 @item -Wvector-operation-performance
9880 @opindex Wvector-operation-performance
9881 @opindex Wno-vector-operation-performance
9882 Warn if vector operation is not implemented via SIMD capabilities of the
9883 architecture. Mainly useful for the performance tuning.
9884 Vector operation can be implemented @code{piecewise}, which means that the
9885 scalar operation is performed on every vector element;
9886 @code{in parallel}, which means that the vector operation is implemented
9887 using scalars of wider type, which normally is more performance efficient;
9888 and @code{as a single scalar}, which means that vector fits into a
9889 scalar type.
9890
9891 @item -Wvla
9892 @opindex Wvla
9893 @opindex Wno-vla
9894 Warn if a variable-length array is used in the code.
9895 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
9896 the variable-length array.
9897
9898 @item -Wvla-larger-than=@var{byte-size}
9899 @opindex Wvla-larger-than=
9900 @opindex Wno-vla-larger-than
9901 If this option is used, the compiler warns for declarations of
9902 variable-length arrays whose size is either unbounded, or bounded
9903 by an argument that allows the array size to exceed @var{byte-size}
9904 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
9905 works, but with variable-length arrays.
9906
9907 Note that GCC may optimize small variable-length arrays of a known
9908 value into plain arrays, so this warning may not get triggered for
9909 such arrays.
9910
9911 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
9912 is typically only effective when @option{-ftree-vrp} is active (default
9913 for @option{-O2} and above).
9914
9915 See also @option{-Walloca-larger-than=@var{byte-size}}.
9916
9917 @item -Wno-vla-larger-than
9918 @opindex Wno-vla-larger-than
9919 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
9920 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
9921
9922 @item -Wvla-parameter
9923 @opindex Wno-vla-parameter
9924 Warn about redeclarations of functions involving arguments of Variable
9925 Length Array types of inconsistent kinds or forms, and enable the detection
9926 of out-of-bounds accesses to such parameters by warnings such as
9927 @option{-Warray-bounds}.
9928
9929 If the first function declaration uses the VLA form the bound specified
9930 in the array is assumed to be the minimum number of elements expected to
9931 be provided in calls to the function and the maximum number of elements
9932 accessed by it. Failing to provide arguments of sufficient size or
9933 accessing more than the maximum number of elements may be diagnosed.
9934
9935 For example, the warning triggers for the following redeclarations because
9936 the first one allows an array of any size to be passed to @code{f} while
9937 the second one specifies that the array argument must have at least @code{n}
9938 elements. In addition, calling @code{f} with the associated VLA bound
9939 parameter in excess of the actual VLA bound triggers a warning as well.
9940
9941 @smallexample
9942 void f (int n, int[n]);
9943 void f (int, int[]); // warning: argument 2 previously declared as a VLA
9944
9945 void g (int n)
9946 @{
9947 if (n > 4)
9948 return;
9949 int a[n];
9950 f (sizeof a, a); // warning: access to a by f may be out of bounds
9951 @dots{}
9952 @}
9953
9954 @end smallexample
9955
9956 @option{-Wvla-parameter} is included in @option{-Wall}. The
9957 @option{-Warray-parameter} option triggers warnings for similar problems
9958 involving ordinary array arguments.
9959
9960 @item -Wvolatile-register-var
9961 @opindex Wvolatile-register-var
9962 @opindex Wno-volatile-register-var
9963 Warn if a register variable is declared volatile. The volatile
9964 modifier does not inhibit all optimizations that may eliminate reads
9965 and/or writes to register variables. This warning is enabled by
9966 @option{-Wall}.
9967
9968 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
9969 @opindex Wxor-used-as-pow
9970 @opindex Wno-xor-used-as-pow
9971 Warn about uses of @code{^}, the exclusive or operator, where it appears
9972 the user meant exponentiation. Specifically, the warning occurs when the
9973 left-hand side is the decimal constant 2 or 10 and the right-hand side
9974 is also a decimal constant.
9975
9976 In C and C++, @code{^} means exclusive or, whereas in some other languages
9977 (e.g. TeX and some versions of BASIC) it means exponentiation.
9978
9979 This warning is enabled by default. It can be silenced by converting one
9980 of the operands to hexadecimal.
9981
9982 @item -Wdisabled-optimization
9983 @opindex Wdisabled-optimization
9984 @opindex Wno-disabled-optimization
9985 Warn if a requested optimization pass is disabled. This warning does
9986 not generally indicate that there is anything wrong with your code; it
9987 merely indicates that GCC's optimizers are unable to handle the code
9988 effectively. Often, the problem is that your code is too big or too
9989 complex; GCC refuses to optimize programs when the optimization
9990 itself is likely to take inordinate amounts of time.
9991
9992 @item -Wpointer-sign @r{(C and Objective-C only)}
9993 @opindex Wpointer-sign
9994 @opindex Wno-pointer-sign
9995 Warn for pointer argument passing or assignment with different signedness.
9996 This option is only supported for C and Objective-C@. It is implied by
9997 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9998 @option{-Wno-pointer-sign}.
9999
10000 @item -Wstack-protector
10001 @opindex Wstack-protector
10002 @opindex Wno-stack-protector
10003 This option is only active when @option{-fstack-protector} is active. It
10004 warns about functions that are not protected against stack smashing.
10005
10006 @item -Woverlength-strings
10007 @opindex Woverlength-strings
10008 @opindex Wno-overlength-strings
10009 Warn about string constants that are longer than the ``minimum
10010 maximum'' length specified in the C standard. Modern compilers
10011 generally allow string constants that are much longer than the
10012 standard's minimum limit, but very portable programs should avoid
10013 using longer strings.
10014
10015 The limit applies @emph{after} string constant concatenation, and does
10016 not count the trailing NUL@. In C90, the limit was 509 characters; in
10017 C99, it was raised to 4095. C++98 does not specify a normative
10018 minimum maximum, so we do not diagnose overlength strings in C++@.
10019
10020 This option is implied by @option{-Wpedantic}, and can be disabled with
10021 @option{-Wno-overlength-strings}.
10022
10023 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10024 @opindex Wunsuffixed-float-constants
10025 @opindex Wno-unsuffixed-float-constants
10026
10027 Issue a warning for any floating constant that does not have
10028 a suffix. When used together with @option{-Wsystem-headers} it
10029 warns about such constants in system header files. This can be useful
10030 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10031 from the decimal floating-point extension to C99.
10032
10033 @item -Wno-lto-type-mismatch
10034 @opindex Wlto-type-mismatch
10035 @opindex Wno-lto-type-mismatch
10036
10037 During the link-time optimization, do not warn about type mismatches in
10038 global declarations from different compilation units.
10039 Requires @option{-flto} to be enabled. Enabled by default.
10040
10041 @item -Wno-designated-init @r{(C and Objective-C only)}
10042 @opindex Wdesignated-init
10043 @opindex Wno-designated-init
10044 Suppress warnings when a positional initializer is used to initialize
10045 a structure that has been marked with the @code{designated_init}
10046 attribute.
10047
10048 @end table
10049
10050 @node Static Analyzer Options
10051 @section Options That Control Static Analysis
10052
10053 @table @gcctabopt
10054 @item -fanalyzer
10055 @opindex analyzer
10056 @opindex fanalyzer
10057 @opindex fno-analyzer
10058 This option enables an static analysis of program flow which looks
10059 for ``interesting'' interprocedural paths through the
10060 code, and issues warnings for problems found on them.
10061
10062 This analysis is much more expensive than other GCC warnings.
10063
10064 Enabling this option effectively enables the following warnings:
10065
10066 @gccoptlist{ @gol
10067 -Wanalyzer-allocation-size @gol
10068 -Wanalyzer-deref-before-check @gol
10069 -Wanalyzer-double-fclose @gol
10070 -Wanalyzer-double-free @gol
10071 -Wanalyzer-exposure-through-output-file @gol
10072 -Wanalyzer-exposure-through-uninit-copy @gol
10073 -Wanalyzer-fd-access-mode-mismatch @gol
10074 -Wanalyzer-fd-double-close @gol
10075 -Wanalyzer-fd-leak @gol
10076 -Wanalyzer-fd-phase-mismatch @gol
10077 -Wanalyzer-fd-type-mismatch @gol
10078 -Wanalyzer-fd-use-after-close @gol
10079 -Wanalyzer-fd-use-without-check @gol
10080 -Wanalyzer-file-leak @gol
10081 -Wanalyzer-free-of-non-heap @gol
10082 -Wanalyzer-imprecise-fp-arithmetic @gol
10083 -Wanalyzer-infinite-recursion @gol
10084 -Wanalyzer-jump-through-null @gol
10085 -Wanalyzer-malloc-leak @gol
10086 -Wanalyzer-mismatching-deallocation @gol
10087 -Wanalyzer-null-argument @gol
10088 -Wanalyzer-null-dereference @gol
10089 -Wanalyzer-out-of-bounds @gol
10090 -Wanalyzer-possible-null-argument @gol
10091 -Wanalyzer-possible-null-dereference @gol
10092 -Wanalyzer-putenv-of-auto-var @gol
10093 -Wanalyzer-shift-count-negative @gol
10094 -Wanalyzer-shift-count-overflow @gol
10095 -Wanalyzer-stale-setjmp-buffer @gol
10096 -Wanalyzer-unsafe-call-within-signal-handler @gol
10097 -Wanalyzer-use-after-free @gol
10098 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
10099 -Wanalyzer-use-of-uninitialized-value @gol
10100 -Wanalyzer-va-arg-type-mismatch @gol
10101 -Wanalyzer-va-list-exhausted @gol
10102 -Wanalyzer-va-list-leak @gol
10103 -Wanalyzer-va-list-use-after-va-end @gol
10104 -Wanalyzer-write-to-const @gol
10105 -Wanalyzer-write-to-string-literal @gol
10106 }
10107 @ignore
10108 -Wanalyzer-tainted-allocation-size @gol
10109 -Wanalyzer-tainted-array-index @gol
10110 -Wanalyzer-tainted-divisor @gol
10111 -Wanalyzer-tainted-offset @gol
10112 -Wanalyzer-tainted-size @gol
10113 @end ignore
10114
10115 This option is only available if GCC was configured with analyzer
10116 support enabled.
10117
10118 @item -Wanalyzer-too-complex
10119 @opindex Wanalyzer-too-complex
10120 @opindex Wno-analyzer-too-complex
10121 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10122 to attempt to explore the control flow and data flow in the program,
10123 but these can be defeated by sufficiently complicated code.
10124
10125 By default, the analysis silently stops if the code is too
10126 complicated for the analyzer to fully explore and it reaches an internal
10127 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
10128
10129 @item -Wno-analyzer-allocation-size
10130 @opindex Wanalyzer-allocation-size
10131 @opindex Wno-analyzer-allocation-size
10132 This warning requires @option{-fanalyzer}, which enables it; use
10133 @option{-Wno-analyzer-allocation-size}
10134 to disable it.
10135
10136 This diagnostic warns for paths through the code in which a pointer to
10137 a buffer is assigned to point at a buffer with a size that is not a
10138 multiple of @code{sizeof (*pointer)}.
10139
10140 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10141
10142 @item -Wno-analyzer-deref-before-check
10143 @opindex Wanalyzer-deref-before-check
10144 @opindex Wno-analyzer-deref-before-check
10145 This warning requires @option{-fanalyzer}, which enables it; use
10146 @option{-Wno-analyzer-deref-before-check}
10147 to disable it.
10148
10149 This diagnostic warns for paths through the code in which a pointer
10150 is checked for @code{NULL} *after* it has already been
10151 dereferenced, suggesting that the pointer could have been NULL.
10152 Such cases suggest that the check for NULL is either redundant,
10153 or that it needs to be moved to before the pointer is dereferenced.
10154
10155 This diagnostic also considers values passed to a function argument
10156 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10157 value, and thus will complain if such values are checked for @code{NULL}
10158 after returning from such a function call.
10159
10160 This diagnostic is unlikely to be reported when any level of optimization
10161 is enabled, as GCC's optimization logic will typically consider such
10162 checks for NULL as being redundant, and optimize them away before the
10163 analyzer "sees" them. Hence optimization should be disabled when
10164 attempting to trigger this diagnostic.
10165
10166 @item -Wno-analyzer-double-fclose
10167 @opindex Wanalyzer-double-fclose
10168 @opindex Wno-analyzer-double-fclose
10169 This warning requires @option{-fanalyzer}, which enables it; use
10170 @option{-Wno-analyzer-double-fclose} to disable it.
10171
10172 This diagnostic warns for paths through the code in which a @code{FILE *}
10173 can have @code{fclose} called on it more than once.
10174
10175 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10176
10177 @item -Wno-analyzer-double-free
10178 @opindex Wanalyzer-double-free
10179 @opindex Wno-analyzer-double-free
10180 This warning requires @option{-fanalyzer}, which enables it; use
10181 @option{-Wno-analyzer-double-free} to disable it.
10182
10183 This diagnostic warns for paths through the code in which a pointer
10184 can have a deallocator called on it more than once, either @code{free},
10185 or a deallocator referenced by attribute @code{malloc}.
10186
10187 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10188
10189 @item -Wno-analyzer-exposure-through-output-file
10190 @opindex Wanalyzer-exposure-through-output-file
10191 @opindex Wno-analyzer-exposure-through-output-file
10192 This warning requires @option{-fanalyzer}, which enables it; use
10193 @option{-Wno-analyzer-exposure-through-output-file}
10194 to disable it.
10195
10196 This diagnostic warns for paths through the code in which a
10197 security-sensitive value is written to an output file
10198 (such as writing a password to a log file).
10199
10200 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10201
10202 @item -Wanalyzer-exposure-through-uninit-copy
10203 @opindex Wanalyzer-exposure-through-uninit-copy
10204 @opindex Wno-analyzer-exposure-through-uninit-copy
10205 This warning requires both @option{-fanalyzer} and the use of a plugin
10206 to specify a function that copies across a ``trust boundary''. Use
10207 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10208
10209 This diagnostic warns for ``infoleaks'' - paths through the code in which
10210 uninitialized values are copied across a security boundary
10211 (such as code within an OS kernel that copies a partially-initialized
10212 struct on the stack to user space).
10213
10214 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10215
10216 @item -Wno-analyzer-fd-access-mode-mismatch
10217 @opindex Wanalyzer-fd-access-mode-mismatch
10218 @opindex Wno-analyzer-fd-access-mode-mismatch
10219 This warning requires @option{-fanalyzer}, which enables it; use
10220 @option{-Wno-analyzer-fd-access-mode-mismatch}
10221 to disable it.
10222
10223 This diagnostic warns for paths through code in which a
10224 @code{read} on a write-only file descriptor is attempted, or vice versa.
10225
10226 This diagnostic also warns for code paths in a which a function with attribute
10227 @code{fd_arg_read (N)} is called with a file descriptor opened with
10228 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10229 @code{fd_arg_write (N)} is called with a file descriptor opened with
10230 @code{O_RDONLY} at referenced argument @var{N}.
10231
10232 @item -Wno-analyzer-fd-double-close
10233 @opindex Wanalyzer-fd-double-close
10234 @opindex Wno-analyzer-fd-double-close
10235 This warning requires @option{-fanalyzer}, which enables it; use
10236 @option{-Wno-analyzer-fd-double-close}
10237 to disable it.
10238
10239 This diagnostic warns for paths through code in which a
10240 file descriptor can be closed more than once.
10241
10242 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10243
10244 @item -Wno-analyzer-fd-leak
10245 @opindex Wanalyzer-fd-leak
10246 @opindex Wno-analyzer-fd-leak
10247 This warning requires @option{-fanalyzer}, which enables it; use
10248 @option{-Wno-analyzer-fd-leak}
10249 to disable it.
10250
10251 This diagnostic warns for paths through code in which an
10252 open file descriptor is leaked.
10253
10254 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10255
10256 @item -Wno-analyzer-fd-phase-mismatch
10257 @opindex Wanalyzer-fd-phase-mismatch
10258 @opindex Wno-analyzer-fd-phase-mismatch
10259 This warning requires @option{-fanalyzer}, which enables it; use
10260 @option{-Wno-analyzer-fd-phase-mismatch}
10261 to disable it.
10262
10263 This diagnostic warns for paths through code in which an operation is
10264 attempted in the wrong phase of a file descriptor's lifetime.
10265 For example, it will warn on attempts to call @code{accept} on a stream
10266 socket that has not yet had @code{listen} successfully called on it.
10267
10268 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10269
10270 @item -Wno-analyzer-fd-type-mismatch
10271 @opindex Wanalyzer-fd-type-mismatch
10272 @opindex Wno-analyzer-fd-type-mismatch
10273 This warning requires @option{-fanalyzer}, which enables it; use
10274 @option{-Wno-analyzer-fd-type-mismatch}
10275 to disable it.
10276
10277 This diagnostic warns for paths through code in which an
10278 operation is attempted on the wrong type of file descriptor.
10279 For example, it will warn on attempts to use socket operations
10280 on a file descriptor obtained via @code{open}, or when attempting
10281 to use a stream socket operation on a datagram socket.
10282
10283 @item -Wno-analyzer-fd-use-after-close
10284 @opindex Wanalyzer-fd-use-after-close
10285 @opindex Wno-analyzer-fd-use-after-close
10286 This warning requires @option{-fanalyzer}, which enables it; use
10287 @option{-Wno-analyzer-fd-use-after-close}
10288 to disable it.
10289
10290 This diagnostic warns for paths through code in which a
10291 read or write is called on a closed file descriptor.
10292
10293 This diagnostic also warns for paths through code in which
10294 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10295 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10296 referenced argument @code{N}.
10297
10298 @item -Wno-analyzer-fd-use-without-check
10299 @opindex Wanalyzer-fd-use-without-check
10300 @opindex Wno-analyzer-fd-use-without-check
10301 This warning requires @option{-fanalyzer}, which enables it; use
10302 @option{-Wno-analyzer-fd-use-without-check}
10303 to disable it.
10304
10305 This diagnostic warns for paths through code in which a
10306 file descriptor is used without being checked for validity.
10307
10308 This diagnostic also warns for paths through code in which
10309 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10310 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10311 argument @code{N}, without being checked for validity.
10312
10313 @item -Wno-analyzer-file-leak
10314 @opindex Wanalyzer-file-leak
10315 @opindex Wno-analyzer-file-leak
10316 This warning requires @option{-fanalyzer}, which enables it; use
10317 @option{-Wno-analyzer-file-leak}
10318 to disable it.
10319
10320 This diagnostic warns for paths through the code in which a
10321 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10322
10323 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10324
10325 @item -Wno-analyzer-free-of-non-heap
10326 @opindex Wanalyzer-free-of-non-heap
10327 @opindex Wno-analyzer-free-of-non-heap
10328 This warning requires @option{-fanalyzer}, which enables it; use
10329 @option{-Wno-analyzer-free-of-non-heap}
10330 to disable it.
10331
10332 This diagnostic warns for paths through the code in which @code{free}
10333 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10334
10335 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10336
10337 @item -Wno-analyzer-imprecise-fp-arithmetic
10338 @opindex Wanalyzer-imprecise-fp-arithmetic
10339 @opindex Wno-analyzer-imprecise-fp-arithmetic
10340 This warning requires @option{-fanalyzer}, which enables it; use
10341 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10342 to disable it.
10343
10344 This diagnostic warns for paths through the code in which floating-point
10345 arithmetic is used in locations where precise computation is needed. This
10346 diagnostic only warns on use of floating-point operands inside the
10347 calculation of an allocation size at the moment.
10348
10349 @item -Wno-analyzer-infinite-recursion
10350 @opindex Wanalyzer-infinite-recursion
10351 @opindex Wno-analyzer-infinite-recursion
10352 This warning requires @option{-fanalyzer}, which enables it; use
10353 @option{-Wno-analyzer-infinite-recursion} to disable it.
10354
10355 This diagnostics warns for paths through the code which appear to
10356 lead to infinite recursion.
10357
10358 Specifically, when the analyzer "sees" a recursive call, it will compare
10359 the state of memory at the entry to the new frame with that at the entry
10360 to the previous frame of that function on the stack. The warning is
10361 issued if nothing in memory appears to be changing; any changes observed
10362 to parameters or globals are assumed to lead to termination of the
10363 recursion and thus suppress the warning.
10364
10365 This diagnostic is likely to miss cases of infinite recursion that
10366 are convered to iteration by the optimizer before the analyzer "sees"
10367 them. Hence optimization should be disabled when attempting to trigger
10368 this diagnostic.
10369
10370 Compare with @option{-Winfinite-recursion}, which provides a similar
10371 diagnostic, but is implemented in a different way.
10372
10373 @item -Wno-analyzer-jump-through-null
10374 @opindex Wanalyzer-jump-through-null
10375 @opindex Wno-analyzer-jump-through-null
10376 This warning requires @option{-fanalyzer}, which enables it; use
10377 @option{-Wno-analyzer-jump-through-null}
10378 to disable it.
10379
10380 This diagnostic warns for paths through the code in which a @code{NULL}
10381 function pointer is called.
10382
10383 @item -Wno-analyzer-malloc-leak
10384 @opindex Wanalyzer-malloc-leak
10385 @opindex Wno-analyzer-malloc-leak
10386 This warning requires @option{-fanalyzer}, which enables it; use
10387 @option{-Wno-analyzer-malloc-leak}
10388 to disable it.
10389
10390 This diagnostic warns for paths through the code in which a
10391 pointer allocated via an allocator is leaked: either @code{malloc},
10392 or a function marked with attribute @code{malloc}.
10393
10394 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10395
10396 @item -Wno-analyzer-mismatching-deallocation
10397 @opindex Wanalyzer-mismatching-deallocation
10398 @opindex Wno-analyzer-mismatching-deallocation
10399 This warning requires @option{-fanalyzer}, which enables it; use
10400 @option{-Wno-analyzer-mismatching-deallocation}
10401 to disable it.
10402
10403 This diagnostic warns for paths through the code in which the
10404 wrong deallocation function is called on a pointer value, based on
10405 which function was used to allocate the pointer value. The diagnostic
10406 will warn about mismatches between @code{free}, scalar @code{delete}
10407 and vector @code{delete[]}, and those marked as allocator/deallocator
10408 pairs using attribute @code{malloc}.
10409
10410 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10411
10412 @item -Wno-analyzer-out-of-bounds
10413 @opindex Wanalyzer-out-of-bounds
10414 @opindex Wno-analyzer-out-of-bounds
10415 This warning requires @option{-fanalyzer} to enable it; use
10416 @option{-Wno-analyzer-out-of-bounds} to disable it.
10417
10418 This diagnostic warns for path through the code in which a buffer is
10419 definitely read or written out-of-bounds. The diagnostic applies for
10420 cases where the analyzer is able to determine a constant offset and for
10421 accesses past the end of a buffer, also a constant capacity. Further,
10422 the diagnostic does limited checking for accesses past the end when the
10423 offset as well as the capacity is symbolic.
10424
10425 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10426
10427 @item -Wno-analyzer-possible-null-argument
10428 @opindex Wanalyzer-possible-null-argument
10429 @opindex Wno-analyzer-possible-null-argument
10430 This warning requires @option{-fanalyzer}, which enables it; use
10431 @option{-Wno-analyzer-possible-null-argument} to disable it.
10432
10433 This diagnostic warns for paths through the code in which a
10434 possibly-NULL value is passed to a function argument marked
10435 with @code{__attribute__((nonnull))} as requiring a non-NULL
10436 value.
10437
10438 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10439
10440 @item -Wno-analyzer-possible-null-dereference
10441 @opindex Wanalyzer-possible-null-dereference
10442 @opindex Wno-analyzer-possible-null-dereference
10443 This warning requires @option{-fanalyzer}, which enables it; use
10444 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10445
10446 This diagnostic warns for paths through the code in which a
10447 possibly-NULL value is dereferenced.
10448
10449 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10450
10451 @item -Wno-analyzer-null-argument
10452 @opindex Wanalyzer-null-argument
10453 @opindex Wno-analyzer-null-argument
10454 This warning requires @option{-fanalyzer}, which enables it; use
10455 @option{-Wno-analyzer-null-argument} to disable it.
10456
10457 This diagnostic warns for paths through the code in which a
10458 value known to be NULL is passed to a function argument marked
10459 with @code{__attribute__((nonnull))} as requiring a non-NULL
10460 value.
10461
10462 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10463
10464 @item -Wno-analyzer-null-dereference
10465 @opindex Wanalyzer-null-dereference
10466 @opindex Wno-analyzer-null-dereference
10467 This warning requires @option{-fanalyzer}, which enables it; use
10468 @option{-Wno-analyzer-null-dereference} to disable it.
10469
10470 This diagnostic warns for paths through the code in which a
10471 value known to be NULL is dereferenced.
10472
10473 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10474
10475 @item -Wno-analyzer-putenv-of-auto-var
10476 @opindex Wanalyzer-putenv-of-auto-var
10477 @opindex Wno-analyzer-putenv-of-auto-var
10478 This warning requires @option{-fanalyzer}, which enables it; use
10479 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10480
10481 This diagnostic warns for paths through the code in which a
10482 call to @code{putenv} is passed a pointer to an automatic variable
10483 or an on-stack buffer.
10484
10485 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}.
10486
10487 @item -Wno-analyzer-shift-count-negative
10488 @opindex Wanalyzer-shift-count-negative
10489 @opindex Wno-analyzer-shift-count-negative
10490 This warning requires @option{-fanalyzer}, which enables it; use
10491 @option{-Wno-analyzer-shift-count-negative} to disable it.
10492
10493 This diagnostic warns for paths through the code in which a
10494 shift is attempted with a negative count. It is analogous to
10495 the @option{-Wshift-count-negative} diagnostic implemented in
10496 the C/C++ front ends, but is implemented based on analyzing
10497 interprocedural paths, rather than merely parsing the syntax tree.
10498 However, the analyzer does not prioritize detection of such paths, so
10499 false negatives are more likely relative to other warnings.
10500
10501 @item -Wno-analyzer-shift-count-overflow
10502 @opindex Wanalyzer-shift-count-overflow
10503 @opindex Wno-analyzer-shift-count-overflow
10504 This warning requires @option{-fanalyzer}, which enables it; use
10505 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10506
10507 This diagnostic warns for paths through the code in which a
10508 shift is attempted with a count greater than or equal to the
10509 precision of the operand's type. It is analogous to
10510 the @option{-Wshift-count-overflow} diagnostic implemented in
10511 the C/C++ front ends, but is implemented based on analyzing
10512 interprocedural paths, rather than merely parsing the syntax tree.
10513 However, the analyzer does not prioritize detection of such paths, so
10514 false negatives are more likely relative to other warnings.
10515
10516 @item -Wno-analyzer-stale-setjmp-buffer
10517 @opindex Wanalyzer-stale-setjmp-buffer
10518 @opindex Wno-analyzer-stale-setjmp-buffer
10519 This warning requires @option{-fanalyzer}, which enables it; use
10520 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10521
10522 This diagnostic warns for paths through the code in which
10523 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10524 to a @code{setjmp} call in a function that has returned.
10525
10526 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10527 location, it records the stack frame. The stack frame becomes invalid
10528 when the function containing the @code{setjmp} call returns. Attempting
10529 to rewind to it via @code{longjmp} would reference a stack frame that
10530 no longer exists, and likely lead to a crash (or worse).
10531
10532 @item -Wno-analyzer-tainted-allocation-size
10533 @opindex Wanalyzer-tainted-allocation-size
10534 @opindex Wno-analyzer-tainted-allocation-size
10535 This warning requires both @option{-fanalyzer} and
10536 @option{-fanalyzer-checker=taint} to enable it;
10537 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10538
10539 This diagnostic warns for paths through the code in which a value
10540 that could be under an attacker's control is used as the size
10541 of an allocation without being sanitized, so that an attacker could
10542 inject an excessively large allocation and potentially cause a denial
10543 of service attack.
10544
10545 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10546
10547 @item -Wno-analyzer-tainted-assertion
10548 @opindex Wanalyzer-tainted-assertion
10549 @opindex Wno-analyzer-tainted-assertion
10550
10551 This warning requires both @option{-fanalyzer} and
10552 @option{-fanalyzer-checker=taint} to enable it;
10553 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10554
10555 This diagnostic warns for paths through the code in which a value
10556 that could be under an attacker's control is used as part of a
10557 condition without being first sanitized, and that condition guards a
10558 call to a function marked with attribute @code{noreturn}
10559 (such as the function @code{__builtin_unreachable}). Such functions
10560 typically indicate abnormal termination of the program, such as for
10561 assertion failure handlers. For example:
10562
10563 @smallexample
10564 assert (some_tainted_value < SOME_LIMIT);
10565 @end smallexample
10566
10567 In such cases:
10568
10569 @itemize
10570 @item
10571 when assertion-checking is enabled: an attacker could trigger
10572 a denial of service by injecting an assertion failure
10573
10574 @item
10575 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10576 an attacker could inject data that subverts the process, since it
10577 presumably violates a precondition that is being assumed by the code.
10578
10579 @end itemize
10580
10581 Note that when assertion-checking is disabled, the assertions are
10582 typically removed by the preprocessor before the analyzer has a chance
10583 to "see" them, so this diagnostic can only generate warnings on builds
10584 in which assertion-checking is enabled.
10585
10586 For the purpose of this warning, any function marked with attribute
10587 @code{noreturn} is considered as a possible assertion failure
10588 handler, including @code{__builtin_unreachable}. Note that these functions
10589 are sometimes removed by the optimizer before the analyzer "sees" them.
10590 Hence optimization should be disabled when attempting to trigger this
10591 diagnostic.
10592
10593 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10594
10595 The warning can also report problematic constructions such as
10596
10597 @smallexample
10598 switch (some_tainted_value) @{
10599 case 0:
10600 /* [...etc; various valid cases omitted...] */
10601 break;
10602
10603 default:
10604 __builtin_unreachable (); /* BUG: attacker can trigger this */
10605 @}
10606 @end smallexample
10607
10608 despite the above not being an assertion failure, strictly speaking.
10609
10610 @item -Wno-analyzer-tainted-array-index
10611 @opindex Wanalyzer-tainted-array-index
10612 @opindex Wno-analyzer-tainted-array-index
10613 This warning requires both @option{-fanalyzer} and
10614 @option{-fanalyzer-checker=taint} to enable it;
10615 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10616
10617 This diagnostic warns for paths through the code in which a value
10618 that could be under an attacker's control is used as the index
10619 of an array access without being sanitized, so that an attacker
10620 could inject an out-of-bounds access.
10621
10622 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10623
10624 @item -Wno-analyzer-tainted-divisor
10625 @opindex Wanalyzer-tainted-divisor
10626 @opindex Wno-analyzer-tainted-divisor
10627 This warning requires both @option{-fanalyzer} and
10628 @option{-fanalyzer-checker=taint} to enable it;
10629 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10630
10631 This diagnostic warns for paths through the code in which a value
10632 that could be under an attacker's control is used as the divisor
10633 in a division or modulus operation without being sanitized, so that
10634 an attacker could inject a division-by-zero.
10635
10636 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10637
10638 @item -Wno-analyzer-tainted-offset
10639 @opindex Wanalyzer-tainted-offset
10640 @opindex Wno-analyzer-tainted-offset
10641 This warning requires both @option{-fanalyzer} and
10642 @option{-fanalyzer-checker=taint} to enable it;
10643 use @option{-Wno-analyzer-tainted-offset} to disable it.
10644
10645 This diagnostic warns for paths through the code in which a value
10646 that could be under an attacker's control is used as a pointer offset
10647 without being sanitized, so that an attacker could inject an out-of-bounds
10648 access.
10649
10650 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10651
10652 @item -Wno-analyzer-tainted-size
10653 @opindex Wanalyzer-tainted-size
10654 @opindex Wno-analyzer-tainted-size
10655 This warning requires both @option{-fanalyzer} and
10656 @option{-fanalyzer-checker=taint} to enable it;
10657 use @option{-Wno-analyzer-tainted-size} to disable it.
10658
10659 This diagnostic warns for paths through the code in which a value
10660 that could be under an attacker's control is used as the size of
10661 an operation such as @code{memset} without being sanitized, so that an
10662 attacker could inject an out-of-bounds access.
10663
10664 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10665
10666 @item -Wno-analyzer-unsafe-call-within-signal-handler
10667 @opindex Wanalyzer-unsafe-call-within-signal-handler
10668 @opindex Wno-analyzer-unsafe-call-within-signal-handler
10669 This warning requires @option{-fanalyzer}, which enables it; use
10670 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
10671
10672 This diagnostic warns for paths through the code in which a
10673 function known to be async-signal-unsafe (such as @code{fprintf}) is
10674 called from a signal handler.
10675
10676 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
10677
10678 @item -Wno-analyzer-use-after-free
10679 @opindex Wanalyzer-use-after-free
10680 @opindex Wno-analyzer-use-after-free
10681 This warning requires @option{-fanalyzer}, which enables it; use
10682 @option{-Wno-analyzer-use-after-free} to disable it.
10683
10684 This diagnostic warns for paths through the code in which a
10685 pointer is used after a deallocator is called on it: either @code{free},
10686 or a deallocator referenced by attribute @code{malloc}.
10687
10688 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
10689
10690 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
10691 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
10692 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
10693 This warning requires @option{-fanalyzer}, which enables it; use
10694 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
10695 to disable it.
10696
10697 This diagnostic warns for paths through the code in which a pointer
10698 is dereferenced that points to a variable in a stale stack frame.
10699
10700 @item -Wno-analyzer-va-arg-type-mismatch
10701 @opindex Wanalyzer-va-arg-type-mismatch
10702 @opindex Wno-analyzer-va-arg-type-mismatch
10703 This warning requires @option{-fanalyzer}, which enables it; use
10704 @option{-Wno-analyzer-va-arg-type-mismatch}
10705 to disable it.
10706
10707 This diagnostic warns for interprocedural paths through the code for which
10708 the analyzer detects an attempt to use @code{va_arg} to extract a value
10709 passed to a variadic call, but uses a type that does not match that of
10710 the expression passed to the call.
10711
10712 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
10713
10714 @item -Wno-analyzer-va-list-exhausted
10715 @opindex Wanalyzer-va-list-exhausted
10716 @opindex Wno-analyzer-va-list-exhausted
10717 This warning requires @option{-fanalyzer}, which enables it; use
10718 @option{-Wno-analyzer-va-list-exhausted}
10719 to disable it.
10720
10721 This diagnostic warns for interprocedural paths through the code for which
10722 the analyzer detects an attempt to use @code{va_arg} to access the next
10723 value passed to a variadic call, but all of the values in the
10724 @code{va_list} have already been consumed.
10725
10726 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
10727
10728 @item -Wno-analyzer-va-list-leak
10729 @opindex Wanalyzer-va-list-leak
10730 @opindex Wno-analyzer-va-list-leak
10731 This warning requires @option{-fanalyzer}, which enables it; use
10732 @option{-Wno-analyzer-va-list-leak}
10733 to disable it.
10734
10735 This diagnostic warns for interprocedural paths through the code for which
10736 the analyzer detects that @code{va_start} or @code{va_copy} has been called
10737 on a @code{va_list} without a corresponding call to @code{va_end}.
10738
10739 @item -Wno-analyzer-va-list-use-after-va-end
10740 @opindex Wanalyzer-va-list-use-after-va-end
10741 @opindex Wno-analyzer-va-list-use-after-va-end
10742 This warning requires @option{-fanalyzer}, which enables it; use
10743 @option{-Wno-analyzer-va-list-use-after-va-end}
10744 to disable it.
10745
10746 This diagnostic warns for interprocedural paths through the code for which
10747 the analyzer detects an attempt to use a @code{va_list} after
10748 @code{va_end} has been called on it.
10749 @code{va_list}.
10750
10751 @item -Wno-analyzer-write-to-const
10752 @opindex Wanalyzer-write-to-const
10753 @opindex Wno-analyzer-write-to-const
10754 This warning requires @option{-fanalyzer}, which enables it; use
10755 @option{-Wno-analyzer-write-to-const}
10756 to disable it.
10757
10758 This diagnostic warns for paths through the code in which the analyzer
10759 detects an attempt to write through a pointer to a @code{const} object.
10760 However, the analyzer does not prioritize detection of such paths, so
10761 false negatives are more likely relative to other warnings.
10762
10763 @item -Wno-analyzer-write-to-string-literal
10764 @opindex Wanalyzer-write-to-string-literal
10765 @opindex Wno-analyzer-write-to-string-literal
10766 This warning requires @option{-fanalyzer}, which enables it; use
10767 @option{-Wno-analyzer-write-to-string-literal}
10768 to disable it.
10769
10770 This diagnostic warns for paths through the code in which the analyzer
10771 detects an attempt to write through a pointer to a string literal.
10772 However, the analyzer does not prioritize detection of such paths, so
10773 false negatives are more likely relative to other warnings.
10774
10775 @item -Wno-analyzer-use-of-uninitialized-value
10776 @opindex Wanalyzer-use-of-uninitialized-value
10777 @opindex Wno-analyzer-use-of-uninitialized-value
10778 This warning requires @option{-fanalyzer}, which enables it; use
10779 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
10780
10781 This diagnostic warns for paths through the code in which an uninitialized
10782 value is used.
10783
10784 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
10785
10786 @end table
10787
10788 The analyzer has hardcoded knowledge about the behavior of the following
10789 memory-management functions:
10790
10791 @itemize @bullet
10792 @item @code{alloca}
10793 @item The built-in functions @code{__builtin_alloc},
10794 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
10795 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
10796 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
10797 @code{__builtin_memset_chk}, @code{__builtin_realloc},
10798 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
10799 @item @code{calloc}
10800 @item @code{free}
10801 @item @code{malloc}
10802 @item @code{memset}
10803 @item @code{operator delete}
10804 @item @code{operator delete []}
10805 @item @code{operator new}
10806 @item @code{operator new []}
10807 @item @code{realloc}
10808 @item @code{strdup}
10809 @item @code{strndup}
10810 @end itemize
10811
10812 of the following functions for working with file descriptors:
10813
10814 @itemize @bullet
10815 @item @code{open}
10816 @item @code{close}
10817 @item @code{creat}
10818 @item @code{dup}, @code{dup2} and @code{dup3}
10819 @item @code{isatty}
10820 @item @code{pipe}, and @code{pipe2}
10821 @item @code{read}
10822 @item @code{write}
10823 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
10824 @end itemize
10825
10826 of the following functions for working with @code{<stdio.h>} streams:
10827 @itemize @bullet
10828 @item The built-in functions @code{__builtin_fprintf},
10829 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
10830 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
10831 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
10832 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
10833 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
10834 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
10835 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
10836 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
10837 @code{__builtin_vprintf}
10838 @item @code{fopen}
10839 @item @code{fclose}
10840 @item @code{ferror}
10841 @item @code{fgets}
10842 @item @code{fgets_unlocked}
10843 @item @code{fileno}
10844 @item @code{fread}
10845 @item @code{getc}
10846 @item @code{getchar}
10847 @item @code{fprintf}
10848 @item @code{printf}
10849 @item @code{fwrite}
10850 @end itemize
10851
10852 and of the following functions:
10853
10854 @itemize @bullet
10855 @item The built-in functions @code{__builtin_expect},
10856 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
10857 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
10858 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
10859 @code{__builtin_va_start}
10860 @item The GNU extensions @code{error} and @code{error_at_line}
10861 @item @code{getpass}
10862 @item @code{longjmp}
10863 @item @code{putenv}
10864 @item @code{setjmp}
10865 @item @code{siglongjmp}
10866 @item @code{signal}
10867 @item @code{sigsetjmp}
10868 @item @code{strchr}
10869 @item @code{strlen}
10870 @end itemize
10871
10872 In addition, various functions with an @code{__analyzer_} prefix have
10873 special meaning to the analyzer, described in the GCC Internals manual.
10874
10875 Pertinent parameters for controlling the exploration are:
10876 @option{--param analyzer-bb-explosion-factor=@var{value}},
10877 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
10878 @option{--param analyzer-max-recursion-depth=@var{value}}, and
10879 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
10880
10881 The following options control the analyzer.
10882
10883 @table @gcctabopt
10884
10885 @item -fanalyzer-call-summaries
10886 @opindex fanalyzer-call-summaries
10887 @opindex fno-analyzer-call-summaries
10888 Simplify interprocedural analysis by computing the effect of certain calls,
10889 rather than exploring all paths through the function from callsite to each
10890 possible return.
10891
10892 If enabled, call summaries are only used for functions with more than one
10893 call site, and that are sufficiently complicated (as per
10894 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
10895
10896 @item -fanalyzer-checker=@var{name}
10897 @opindex fanalyzer-checker
10898 Restrict the analyzer to run just the named checker, and enable it.
10899
10900 Some checkers are disabled by default (even with @option{-fanalyzer}),
10901 such as the @code{taint} checker that implements
10902 @option{-Wanalyzer-tainted-array-index}, and this option is required
10903 to enable them.
10904
10905 @emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
10906 following warnings from @option{-fanalyzer}:
10907
10908 @gccoptlist{ @gol
10909 -Wanalyzer-deref-before-check @gol
10910 -Wanalyzer-double-fclose @gol
10911 -Wanalyzer-double-free @gol
10912 -Wanalyzer-exposure-through-output-file @gol
10913 -Wanalyzer-fd-access-mode-mismatch @gol
10914 -Wanalyzer-fd-double-close @gol
10915 -Wanalyzer-fd-leak @gol
10916 -Wanalyzer-fd-use-after-close @gol
10917 -Wanalyzer-fd-use-without-check @gol
10918 -Wanalyzer-file-leak @gol
10919 -Wanalyzer-free-of-non-heap @gol
10920 -Wanalyzer-malloc-leak @gol
10921 -Wanalyzer-mismatching-deallocation @gol
10922 -Wanalyzer-null-argument @gol
10923 -Wanalyzer-null-dereference @gol
10924 -Wanalyzer-possible-null-argument @gol
10925 -Wanalyzer-possible-null-dereference @gol
10926 -Wanalyzer-unsafe-call-within-signal-handler @gol
10927 -Wanalyzer-use-after-free @gol
10928 -Wanalyzer-va-list-leak @gol
10929 -Wanalyzer-va-list-use-after-va-end @gol
10930 }
10931
10932 @item -fno-analyzer-feasibility
10933 @opindex fanalyzer-feasibility
10934 @opindex fno-analyzer-feasibility
10935 This option is intended for analyzer developers.
10936
10937 By default the analyzer verifies that there is a feasible control flow path
10938 for each diagnostic it emits: that the conditions that hold are not mutually
10939 exclusive. Diagnostics for which no feasible path can be found are rejected.
10940 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
10941 debugging issues in this code.
10942
10943 @item -fanalyzer-fine-grained
10944 @opindex fanalyzer-fine-grained
10945 @opindex fno-analyzer-fine-grained
10946 This option is intended for analyzer developers.
10947
10948 Internally the analyzer builds an ``exploded graph'' that combines
10949 control flow graphs with data flow information.
10950
10951 By default, an edge in this graph can contain the effects of a run
10952 of multiple statements within a basic block. With
10953 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
10954
10955 @item -fanalyzer-show-duplicate-count
10956 @opindex fanalyzer-show-duplicate-count
10957 @opindex fno-analyzer-show-duplicate-count
10958 This option is intended for analyzer developers: if multiple diagnostics
10959 have been detected as being duplicates of each other, it emits a note when
10960 reporting the best diagnostic, giving the number of additional diagnostics
10961 that were suppressed by the deduplication logic.
10962
10963 @item -fno-analyzer-state-merge
10964 @opindex fanalyzer-state-merge
10965 @opindex fno-analyzer-state-merge
10966 This option is intended for analyzer developers.
10967
10968 By default the analyzer attempts to simplify analysis by merging
10969 sufficiently similar states at each program point as it builds its
10970 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
10971 merging can be suppressed, for debugging state-handling issues.
10972
10973 @item -fno-analyzer-state-purge
10974 @opindex fanalyzer-state-purge
10975 @opindex fno-analyzer-state-purge
10976 This option is intended for analyzer developers.
10977
10978 By default the analyzer attempts to simplify analysis by purging
10979 aspects of state at a program point that appear to no longer be relevant
10980 e.g. the values of locals that aren't accessed later in the function
10981 and which aren't relevant to leak analysis.
10982
10983 With @option{-fno-analyzer-state-purge} this purging of state can
10984 be suppressed, for debugging state-handling issues.
10985
10986 @item -fanalyzer-transitivity
10987 @opindex fanalyzer-transitivity
10988 @opindex fno-analyzer-transitivity
10989 This option enables transitivity of constraints within the analyzer.
10990
10991 @item -fno-analyzer-undo-inlining
10992 @opindex fanalyzer-undo-inlining
10993 @opindex fno-analyzer-undo-inlining
10994 This option is intended for analyzer developers.
10995
10996 @option{-fanalyzer} runs relatively late compared to other code analysis
10997 tools, and some optimizations have already been applied to the code. In
10998 particular function inlining may have occurred, leading to the
10999 interprocedural execution paths emitted by the analyzer containing
11000 function frames that don't correspond to those in the original source
11001 code.
11002
11003 By default the analyzer attempts to reconstruct the original function
11004 frames, and to emit events showing the inlined calls.
11005
11006 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11007 the original frame information can be be disabled, which may be of help
11008 when debugging issues in the analyzer.
11009
11010 @item -fanalyzer-verbose-edges
11011 This option is intended for analyzer developers. It enables more
11012 verbose, lower-level detail in the descriptions of control flow
11013 within diagnostic paths.
11014
11015 @item -fanalyzer-verbose-state-changes
11016 This option is intended for analyzer developers. It enables more
11017 verbose, lower-level detail in the descriptions of events relating
11018 to state machines within diagnostic paths.
11019
11020 @item -fanalyzer-verbosity=@var{level}
11021 This option controls the complexity of the control flow paths that are
11022 emitted for analyzer diagnostics.
11023
11024 The @var{level} can be one of:
11025
11026 @table @samp
11027 @item 0
11028 At this level, interprocedural call and return events are displayed,
11029 along with the most pertinent state-change events relating to
11030 a diagnostic. For example, for a double-@code{free} diagnostic,
11031 both calls to @code{free} will be shown.
11032
11033 @item 1
11034 As per the previous level, but also show events for the entry
11035 to each function.
11036
11037 @item 2
11038 As per the previous level, but also show events relating to
11039 control flow that are significant to triggering the issue
11040 (e.g. ``true path taken'' at a conditional).
11041
11042 This level is the default.
11043
11044 @item 3
11045 As per the previous level, but show all control flow events, not
11046 just significant ones.
11047
11048 @item 4
11049 This level is intended for analyzer developers; it adds various
11050 other events intended for debugging the analyzer.
11051
11052 @end table
11053
11054 @item -fdump-analyzer
11055 @opindex fdump-analyzer
11056 Dump internal details about what the analyzer is doing to
11057 @file{@var{file}.analyzer.txt}.
11058 This option is overridden by @option{-fdump-analyzer-stderr}.
11059
11060 @item -fdump-analyzer-stderr
11061 @opindex fdump-analyzer-stderr
11062 Dump internal details about what the analyzer is doing to stderr.
11063 This option overrides @option{-fdump-analyzer}.
11064
11065 @item -fdump-analyzer-callgraph
11066 @opindex fdump-analyzer-callgraph
11067 Dump a representation of the call graph suitable for viewing with
11068 GraphViz to @file{@var{file}.callgraph.dot}.
11069
11070 @item -fdump-analyzer-exploded-graph
11071 @opindex fdump-analyzer-exploded-graph
11072 Dump a representation of the ``exploded graph'' suitable for viewing with
11073 GraphViz to @file{@var{file}.eg.dot}.
11074 Nodes are color-coded based on state-machine states to emphasize
11075 state changes.
11076
11077 @item -fdump-analyzer-exploded-nodes
11078 @opindex dump-analyzer-exploded-nodes
11079 Emit diagnostics showing where nodes in the ``exploded graph'' are
11080 in relation to the program source.
11081
11082 @item -fdump-analyzer-exploded-nodes-2
11083 @opindex dump-analyzer-exploded-nodes-2
11084 Dump a textual representation of the ``exploded graph'' to
11085 @file{@var{file}.eg.txt}.
11086
11087 @item -fdump-analyzer-exploded-nodes-3
11088 @opindex dump-analyzer-exploded-nodes-3
11089 Dump a textual representation of the ``exploded graph'' to
11090 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11091 This is typically a large number of dump files.
11092
11093 @item -fdump-analyzer-exploded-paths
11094 @opindex fdump-analyzer-exploded-paths
11095 Dump a textual representation of the ``exploded path'' for each
11096 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11097
11098 @item -fdump-analyzer-feasibility
11099 @opindex dump-analyzer-feasibility
11100 Dump internal details about the analyzer's search for feasible paths.
11101 The details are written in a form suitable for viewing with GraphViz
11102 to filenames of the form @file{@var{file}.*.fg.dot},
11103 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11104
11105 @item -fdump-analyzer-json
11106 @opindex fdump-analyzer-json
11107 Dump a compressed JSON representation of analyzer internals to
11108 @file{@var{file}.analyzer.json.gz}. The precise format is subject
11109 to change.
11110
11111 @item -fdump-analyzer-state-purge
11112 @opindex fdump-analyzer-state-purge
11113 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11114 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11115 graph with information on what state will be purged at each node.
11116 The graph is written to @file{@var{file}.state-purge.dot}.
11117
11118 @item -fdump-analyzer-supergraph
11119 @opindex fdump-analyzer-supergraph
11120 Dump representations of the ``supergraph'' suitable for viewing with
11121 GraphViz to @file{@var{file}.supergraph.dot} and to
11122 @file{@var{file}.supergraph-eg.dot}. These show all of the
11123 control flow graphs in the program, with interprocedural edges for
11124 calls and returns. The second dump contains annotations showing nodes
11125 in the ``exploded graph'' and diagnostics associated with them.
11126
11127 @item -fdump-analyzer-untracked
11128 @opindex fdump-analyzer-untracked
11129 Emit custom warnings with internal details intended for analyzer developers.
11130
11131 @end table
11132
11133 @node Debugging Options
11134 @section Options for Debugging Your Program
11135 @cindex options, debugging
11136 @cindex debugging information options
11137
11138 To tell GCC to emit extra information for use by a debugger, in almost
11139 all cases you need only to add @option{-g} to your other options. Some debug
11140 formats can co-exist (like DWARF with CTF) when each of them is enabled
11141 explicitly by adding the respective command line option to your other options.
11142
11143 GCC allows you to use @option{-g} with
11144 @option{-O}. The shortcuts taken by optimized code may occasionally
11145 be surprising: some variables you declared may not exist
11146 at all; flow of control may briefly move where you did not expect it;
11147 some statements may not be executed because they compute constant
11148 results or their values are already at hand; some statements may
11149 execute in different places because they have been moved out of loops.
11150 Nevertheless it is possible to debug optimized output. This makes
11151 it reasonable to use the optimizer for programs that might have bugs.
11152
11153 If you are not using some other optimization option, consider
11154 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
11155 With no @option{-O} option at all, some compiler passes that collect
11156 information useful for debugging do not run at all, so that
11157 @option{-Og} may result in a better debugging experience.
11158
11159 @table @gcctabopt
11160 @item -g
11161 @opindex g
11162 Produce debugging information in the operating system's native format
11163 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
11164 information.
11165
11166 On most systems that use stabs format, @option{-g} enables use of extra
11167 debugging information that only GDB can use; this extra information
11168 makes debugging work better in GDB but probably makes other debuggers
11169 crash or refuse to read the program. If you want to control for certain whether
11170 to generate the extra information, use @option{-gvms} (see below).
11171
11172 @item -ggdb
11173 @opindex ggdb
11174 Produce debugging information for use by GDB@. This means to use the
11175 most expressive format available (DWARF, stabs, or the native format
11176 if neither of those are supported), including GDB extensions if at all
11177 possible.
11178
11179 @item -gdwarf
11180 @itemx -gdwarf-@var{version}
11181 @opindex gdwarf
11182 Produce debugging information in DWARF format (if that is supported).
11183 The value of @var{version} may be either 2, 3, 4 or 5; the default
11184 version for most targets is 5 (with the exception of VxWorks, TPF and
11185 Darwin/Mac OS X, which default to version 2, and AIX, which defaults
11186 to version 4).
11187
11188 Note that with DWARF Version 2, some ports require and always
11189 use some non-conflicting DWARF 3 extensions in the unwind tables.
11190
11191 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11192 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11193
11194 GCC no longer supports DWARF Version 1, which is substantially
11195 different than Version 2 and later. For historical reasons, some
11196 other DWARF-related options such as
11197 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11198 in their names, but apply to all currently-supported versions of DWARF.
11199
11200 @item -gbtf
11201 @opindex gbtf
11202 Request BTF debug information. BTF is the default debugging format for the
11203 eBPF target. On other targets, like x86, BTF debug information can be
11204 generated along with DWARF debug information when both of the debug formats are
11205 enabled explicitly via their respective command line options.
11206
11207 @item -gctf
11208 @itemx -gctf@var{level}
11209 @opindex gctf
11210 Request CTF debug information and use level to specify how much CTF debug
11211 information should be produced. If @option{-gctf} is specified
11212 without a value for level, the default level of CTF debug information is 2.
11213
11214 CTF debug information can be generated along with DWARF debug information when
11215 both of the debug formats are enabled explicitly via their respective command
11216 line options.
11217
11218 Level 0 produces no CTF debug information at all. Thus, @option{-gctf0}
11219 negates @option{-gctf}.
11220
11221 Level 1 produces CTF information for tracebacks only. This includes callsite
11222 information, but does not include type information.
11223
11224 Level 2 produces type information for entities (functions, data objects etc.)
11225 at file-scope or global-scope only.
11226
11227 @item -gvms
11228 @opindex gvms
11229 Produce debugging information in Alpha/VMS debug format (if that is
11230 supported). This is the format used by DEBUG on Alpha/VMS systems.
11231
11232 @item -g@var{level}
11233 @itemx -ggdb@var{level}
11234 @itemx -gvms@var{level}
11235 Request debugging information and also use @var{level} to specify how
11236 much information. The default level is 2.
11237
11238 Level 0 produces no debug information at all. Thus, @option{-g0} negates
11239 @option{-g}.
11240
11241 Level 1 produces minimal information, enough for making backtraces in
11242 parts of the program that you don't plan to debug. This includes
11243 descriptions of functions and external variables, and line number
11244 tables, but no information about local variables.
11245
11246 Level 3 includes extra information, such as all the macro definitions
11247 present in the program. Some debuggers support macro expansion when
11248 you use @option{-g3}.
11249
11250 If you use multiple @option{-g} options, with or without level numbers,
11251 the last such option is the one that is effective.
11252
11253 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11254 confusion with @option{-gdwarf-@var{level}}.
11255 Instead use an additional @option{-g@var{level}} option to change the
11256 debug level for DWARF.
11257
11258 @item -fno-eliminate-unused-debug-symbols
11259 @opindex feliminate-unused-debug-symbols
11260 @opindex fno-eliminate-unused-debug-symbols
11261 By default, no debug information is produced for symbols that are not actually
11262 used. Use this option if you want debug information for all symbols.
11263
11264 @item -femit-class-debug-always
11265 @opindex femit-class-debug-always
11266 Instead of emitting debugging information for a C++ class in only one
11267 object file, emit it in all object files using the class. This option
11268 should be used only with debuggers that are unable to handle the way GCC
11269 normally emits debugging information for classes because using this
11270 option increases the size of debugging information by as much as a
11271 factor of two.
11272
11273 @item -fno-merge-debug-strings
11274 @opindex fmerge-debug-strings
11275 @opindex fno-merge-debug-strings
11276 Direct the linker to not merge together strings in the debugging
11277 information that are identical in different object files. Merging is
11278 not supported by all assemblers or linkers. Merging decreases the size
11279 of the debug information in the output file at the cost of increasing
11280 link processing time. Merging is enabled by default.
11281
11282 @item -fdebug-prefix-map=@var{old}=@var{new}
11283 @opindex fdebug-prefix-map
11284 When compiling files residing in directory @file{@var{old}}, record
11285 debugging information describing them as if the files resided in
11286 directory @file{@var{new}} instead. This can be used to replace a
11287 build-time path with an install-time path in the debug info. It can
11288 also be used to change an absolute path to a relative path by using
11289 @file{.} for @var{new}. This can give more reproducible builds, which
11290 are location independent, but may require an extra command to tell GDB
11291 where to find the source files. See also @option{-ffile-prefix-map}.
11292
11293 @item -fvar-tracking
11294 @opindex fvar-tracking
11295 Run variable tracking pass. It computes where variables are stored at each
11296 position in code. Better debugging information is then generated
11297 (if the debugging information format supports this information).
11298
11299 It is enabled by default when compiling with optimization (@option{-Os},
11300 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11301 the debug info format supports it.
11302
11303 @item -fvar-tracking-assignments
11304 @opindex fvar-tracking-assignments
11305 @opindex fno-var-tracking-assignments
11306 Annotate assignments to user variables early in the compilation and
11307 attempt to carry the annotations over throughout the compilation all the
11308 way to the end, in an attempt to improve debug information while
11309 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
11310
11311 It can be enabled even if var-tracking is disabled, in which case
11312 annotations are created and maintained, but discarded at the end.
11313 By default, this flag is enabled together with @option{-fvar-tracking},
11314 except when selective scheduling is enabled.
11315
11316 @item -gsplit-dwarf
11317 @opindex gsplit-dwarf
11318 If DWARF debugging information is enabled, separate as much debugging
11319 information as possible into a separate output file with the extension
11320 @file{.dwo}. This option allows the build system to avoid linking files with
11321 debug information. To be useful, this option requires a debugger capable of
11322 reading @file{.dwo} files.
11323
11324 @item -gdwarf32
11325 @itemx -gdwarf64
11326 @opindex gdwarf32
11327 @opindex gdwarf64
11328 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11329 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11330 DWARF format. The default is target specific, on most targets it is
11331 @option{-gdwarf32} though. The 32-bit DWARF format is smaller, but
11332 can't support more than 2GiB of debug information in any of the DWARF
11333 debug information sections. The 64-bit DWARF format allows larger debug
11334 information and might not be well supported by all consumers yet.
11335
11336 @item -gdescribe-dies
11337 @opindex gdescribe-dies
11338 Add description attributes to some DWARF DIEs that have no name attribute,
11339 such as artificial variables, external references and call site
11340 parameter DIEs.
11341
11342 @item -gpubnames
11343 @opindex gpubnames
11344 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11345
11346 @item -ggnu-pubnames
11347 @opindex ggnu-pubnames
11348 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11349 suitable for conversion into a GDB@ index. This option is only useful
11350 with a linker that can produce GDB@ index version 7.
11351
11352 @item -fdebug-types-section
11353 @opindex fdebug-types-section
11354 @opindex fno-debug-types-section
11355 When using DWARF Version 4 or higher, type DIEs can be put into
11356 their own @code{.debug_types} section instead of making them part of the
11357 @code{.debug_info} section. It is more efficient to put them in a separate
11358 comdat section since the linker can then remove duplicates.
11359 But not all DWARF consumers support @code{.debug_types} sections yet
11360 and on some objects @code{.debug_types} produces larger instead of smaller
11361 debugging information.
11362
11363 @item -grecord-gcc-switches
11364 @itemx -gno-record-gcc-switches
11365 @opindex grecord-gcc-switches
11366 @opindex gno-record-gcc-switches
11367 This switch causes the command-line options used to invoke the
11368 compiler that may affect code generation to be appended to the
11369 DW_AT_producer attribute in DWARF debugging information. The options
11370 are concatenated with spaces separating them from each other and from
11371 the compiler version.
11372 It is enabled by default.
11373 See also @option{-frecord-gcc-switches} for another
11374 way of storing compiler options into the object file.
11375
11376 @item -gstrict-dwarf
11377 @opindex gstrict-dwarf
11378 Disallow using extensions of later DWARF standard version than selected
11379 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
11380 DWARF extensions from later standard versions is allowed.
11381
11382 @item -gno-strict-dwarf
11383 @opindex gno-strict-dwarf
11384 Allow using extensions of later DWARF standard version than selected with
11385 @option{-gdwarf-@var{version}}.
11386
11387 @item -gas-loc-support
11388 @opindex gas-loc-support
11389 Inform the compiler that the assembler supports @code{.loc} directives.
11390 It may then use them for the assembler to generate DWARF2+ line number
11391 tables.
11392
11393 This is generally desirable, because assembler-generated line-number
11394 tables are a lot more compact than those the compiler can generate
11395 itself.
11396
11397 This option will be enabled by default if, at GCC configure time, the
11398 assembler was found to support such directives.
11399
11400 @item -gno-as-loc-support
11401 @opindex gno-as-loc-support
11402 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11403 line number tables are to be generated.
11404
11405 @item -gas-locview-support
11406 @opindex gas-locview-support
11407 Inform the compiler that the assembler supports @code{view} assignment
11408 and reset assertion checking in @code{.loc} directives.
11409
11410 This option will be enabled by default if, at GCC configure time, the
11411 assembler was found to support them.
11412
11413 @item -gno-as-locview-support
11414 Force GCC to assign view numbers internally, if
11415 @option{-gvariable-location-views} are explicitly requested.
11416
11417 @item -gcolumn-info
11418 @itemx -gno-column-info
11419 @opindex gcolumn-info
11420 @opindex gno-column-info
11421 Emit location column information into DWARF debugging information, rather
11422 than just file and line.
11423 This option is enabled by default.
11424
11425 @item -gstatement-frontiers
11426 @itemx -gno-statement-frontiers
11427 @opindex gstatement-frontiers
11428 @opindex gno-statement-frontiers
11429 This option causes GCC to create markers in the internal representation
11430 at the beginning of statements, and to keep them roughly in place
11431 throughout compilation, using them to guide the output of @code{is_stmt}
11432 markers in the line number table. This is enabled by default when
11433 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11434 @dots{}), and outputting DWARF 2 debug information at the normal level.
11435
11436 @item -gvariable-location-views
11437 @itemx -gvariable-location-views=incompat5
11438 @itemx -gno-variable-location-views
11439 @opindex gvariable-location-views
11440 @opindex gvariable-location-views=incompat5
11441 @opindex gno-variable-location-views
11442 Augment variable location lists with progressive view numbers implied
11443 from the line number table. This enables debug information consumers to
11444 inspect state at certain points of the program, even if no instructions
11445 associated with the corresponding source locations are present at that
11446 point. If the assembler lacks support for view numbers in line number
11447 tables, this will cause the compiler to emit the line number table,
11448 which generally makes them somewhat less compact. The augmented line
11449 number tables and location lists are fully backward-compatible, so they
11450 can be consumed by debug information consumers that are not aware of
11451 these augmentations, but they won't derive any benefit from them either.
11452
11453 This is enabled by default when outputting DWARF 2 debug information at
11454 the normal level, as long as there is assembler support,
11455 @option{-fvar-tracking-assignments} is enabled and
11456 @option{-gstrict-dwarf} is not. When assembler support is not
11457 available, this may still be enabled, but it will force GCC to output
11458 internal line number tables, and if
11459 @option{-ginternal-reset-location-views} is not enabled, that will most
11460 certainly lead to silently mismatching location views.
11461
11462 There is a proposed representation for view numbers that is not backward
11463 compatible with the location list format introduced in DWARF 5, that can
11464 be enabled with @option{-gvariable-location-views=incompat5}. This
11465 option may be removed in the future, is only provided as a reference
11466 implementation of the proposed representation. Debug information
11467 consumers are not expected to support this extended format, and they
11468 would be rendered unable to decode location lists using it.
11469
11470 @item -ginternal-reset-location-views
11471 @itemx -gno-internal-reset-location-views
11472 @opindex ginternal-reset-location-views
11473 @opindex gno-internal-reset-location-views
11474 Attempt to determine location views that can be omitted from location
11475 view lists. This requires the compiler to have very accurate insn
11476 length estimates, which isn't always the case, and it may cause
11477 incorrect view lists to be generated silently when using an assembler
11478 that does not support location view lists. The GNU assembler will flag
11479 any such error as a @code{view number mismatch}. This is only enabled
11480 on ports that define a reliable estimation function.
11481
11482 @item -ginline-points
11483 @itemx -gno-inline-points
11484 @opindex ginline-points
11485 @opindex gno-inline-points
11486 Generate extended debug information for inlined functions. Location
11487 view tracking markers are inserted at inlined entry points, so that
11488 address and view numbers can be computed and output in debug
11489 information. This can be enabled independently of location views, in
11490 which case the view numbers won't be output, but it can only be enabled
11491 along with statement frontiers, and it is only enabled by default if
11492 location views are enabled.
11493
11494 @item -gz@r{[}=@var{type}@r{]}
11495 @opindex gz
11496 Produce compressed debug sections in DWARF format, if that is supported.
11497 If @var{type} is not given, the default type depends on the capabilities
11498 of the assembler and linker used. @var{type} may be one of
11499 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11500 compression in ELF gABI format). If the linker doesn't support writing
11501 compressed debug sections, the option is rejected. Otherwise, if the
11502 assembler does not support them, @option{-gz} is silently ignored when
11503 producing object files.
11504
11505 @item -femit-struct-debug-baseonly
11506 @opindex femit-struct-debug-baseonly
11507 Emit debug information for struct-like types
11508 only when the base name of the compilation source file
11509 matches the base name of file in which the struct is defined.
11510
11511 This option substantially reduces the size of debugging information,
11512 but at significant potential loss in type information to the debugger.
11513 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11514 See @option{-femit-struct-debug-detailed} for more detailed control.
11515
11516 This option works only with DWARF debug output.
11517
11518 @item -femit-struct-debug-reduced
11519 @opindex femit-struct-debug-reduced
11520 Emit debug information for struct-like types
11521 only when the base name of the compilation source file
11522 matches the base name of file in which the type is defined,
11523 unless the struct is a template or defined in a system header.
11524
11525 This option significantly reduces the size of debugging information,
11526 with some potential loss in type information to the debugger.
11527 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11528 See @option{-femit-struct-debug-detailed} for more detailed control.
11529
11530 This option works only with DWARF debug output.
11531
11532 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11533 @opindex femit-struct-debug-detailed
11534 Specify the struct-like types
11535 for which the compiler generates debug information.
11536 The intent is to reduce duplicate struct debug information
11537 between different object files within the same program.
11538
11539 This option is a detailed version of
11540 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11541 which serves for most needs.
11542
11543 A specification has the syntax@*
11544 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11545
11546 The optional first word limits the specification to
11547 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11548 A struct type is used directly when it is the type of a variable, member.
11549 Indirect uses arise through pointers to structs.
11550 That is, when use of an incomplete struct is valid, the use is indirect.
11551 An example is
11552 @samp{struct one direct; struct two * indirect;}.
11553
11554 The optional second word limits the specification to
11555 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11556 Generic structs are a bit complicated to explain.
11557 For C++, these are non-explicit specializations of template classes,
11558 or non-template classes within the above.
11559 Other programming languages have generics,
11560 but @option{-femit-struct-debug-detailed} does not yet implement them.
11561
11562 The third word specifies the source files for those
11563 structs for which the compiler should emit debug information.
11564 The values @samp{none} and @samp{any} have the normal meaning.
11565 The value @samp{base} means that
11566 the base of name of the file in which the type declaration appears
11567 must match the base of the name of the main compilation file.
11568 In practice, this means that when compiling @file{foo.c}, debug information
11569 is generated for types declared in that file and @file{foo.h},
11570 but not other header files.
11571 The value @samp{sys} means those types satisfying @samp{base}
11572 or declared in system or compiler headers.
11573
11574 You may need to experiment to determine the best settings for your application.
11575
11576 The default is @option{-femit-struct-debug-detailed=all}.
11577
11578 This option works only with DWARF debug output.
11579
11580 @item -fno-dwarf2-cfi-asm
11581 @opindex fdwarf2-cfi-asm
11582 @opindex fno-dwarf2-cfi-asm
11583 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11584 instead of using GAS @code{.cfi_*} directives.
11585
11586 @item -fno-eliminate-unused-debug-types
11587 @opindex feliminate-unused-debug-types
11588 @opindex fno-eliminate-unused-debug-types
11589 Normally, when producing DWARF output, GCC avoids producing debug symbol
11590 output for types that are nowhere used in the source file being compiled.
11591 Sometimes it is useful to have GCC emit debugging
11592 information for all types declared in a compilation
11593 unit, regardless of whether or not they are actually used
11594 in that compilation unit, for example
11595 if, in the debugger, you want to cast a value to a type that is
11596 not actually used in your program (but is declared). More often,
11597 however, this results in a significant amount of wasted space.
11598 @end table
11599
11600 @node Optimize Options
11601 @section Options That Control Optimization
11602 @cindex optimize options
11603 @cindex options, optimization
11604
11605 These options control various sorts of optimizations.
11606
11607 Without any optimization option, the compiler's goal is to reduce the
11608 cost of compilation and to make debugging produce the expected
11609 results. Statements are independent: if you stop the program with a
11610 breakpoint between statements, you can then assign a new value to any
11611 variable or change the program counter to any other statement in the
11612 function and get exactly the results you expect from the source
11613 code.
11614
11615 Turning on optimization flags makes the compiler attempt to improve
11616 the performance and/or code size at the expense of compilation time
11617 and possibly the ability to debug the program.
11618
11619 The compiler performs optimization based on the knowledge it has of the
11620 program. Compiling multiple files at once to a single output file mode allows
11621 the compiler to use information gained from all of the files when compiling
11622 each of them.
11623
11624 Not all optimizations are controlled directly by a flag. Only
11625 optimizations that have a flag are listed in this section.
11626
11627 Most optimizations are completely disabled at @option{-O0} or if an
11628 @option{-O} level is not set on the command line, even if individual
11629 optimization flags are specified. Similarly, @option{-Og} suppresses
11630 many optimization passes.
11631
11632 Depending on the target and how GCC was configured, a slightly different
11633 set of optimizations may be enabled at each @option{-O} level than
11634 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
11635 to find out the exact set of optimizations that are enabled at each level.
11636 @xref{Overall Options}, for examples.
11637
11638 @table @gcctabopt
11639 @item -O
11640 @itemx -O1
11641 @opindex O
11642 @opindex O1
11643 Optimize. Optimizing compilation takes somewhat more time, and a lot
11644 more memory for a large function.
11645
11646 With @option{-O}, the compiler tries to reduce code size and execution
11647 time, without performing any optimizations that take a great deal of
11648 compilation time.
11649
11650 @c Note that in addition to the default_options_table list in opts.cc,
11651 @c several optimization flags default to true but control optimization
11652 @c passes that are explicitly disabled at -O0.
11653
11654 @option{-O} turns on the following optimization flags:
11655
11656 @c Please keep the following list alphabetized.
11657 @gccoptlist{-fauto-inc-dec @gol
11658 -fbranch-count-reg @gol
11659 -fcombine-stack-adjustments @gol
11660 -fcompare-elim @gol
11661 -fcprop-registers @gol
11662 -fdce @gol
11663 -fdefer-pop @gol
11664 -fdelayed-branch @gol
11665 -fdse @gol
11666 -fforward-propagate @gol
11667 -fguess-branch-probability @gol
11668 -fif-conversion @gol
11669 -fif-conversion2 @gol
11670 -finline-functions-called-once @gol
11671 -fipa-modref @gol
11672 -fipa-profile @gol
11673 -fipa-pure-const @gol
11674 -fipa-reference @gol
11675 -fipa-reference-addressable @gol
11676 -fmerge-constants @gol
11677 -fmove-loop-invariants @gol
11678 -fmove-loop-stores@gol
11679 -fomit-frame-pointer @gol
11680 -freorder-blocks @gol
11681 -fshrink-wrap @gol
11682 -fshrink-wrap-separate @gol
11683 -fsplit-wide-types @gol
11684 -fssa-backprop @gol
11685 -fssa-phiopt @gol
11686 -ftree-bit-ccp @gol
11687 -ftree-ccp @gol
11688 -ftree-ch @gol
11689 -ftree-coalesce-vars @gol
11690 -ftree-copy-prop @gol
11691 -ftree-dce @gol
11692 -ftree-dominator-opts @gol
11693 -ftree-dse @gol
11694 -ftree-forwprop @gol
11695 -ftree-fre @gol
11696 -ftree-phiprop @gol
11697 -ftree-pta @gol
11698 -ftree-scev-cprop @gol
11699 -ftree-sink @gol
11700 -ftree-slsr @gol
11701 -ftree-sra @gol
11702 -ftree-ter @gol
11703 -funit-at-a-time}
11704
11705 @item -O2
11706 @opindex O2
11707 Optimize even more. GCC performs nearly all supported optimizations
11708 that do not involve a space-speed tradeoff.
11709 As compared to @option{-O}, this option increases both compilation time
11710 and the performance of the generated code.
11711
11712 @option{-O2} turns on all optimization flags specified by @option{-O1}. It
11713 also turns on the following optimization flags:
11714
11715 @c Please keep the following list alphabetized!
11716 @gccoptlist{-falign-functions -falign-jumps @gol
11717 -falign-labels -falign-loops @gol
11718 -fcaller-saves @gol
11719 -fcode-hoisting @gol
11720 -fcrossjumping @gol
11721 -fcse-follow-jumps -fcse-skip-blocks @gol
11722 -fdelete-null-pointer-checks @gol
11723 -fdevirtualize -fdevirtualize-speculatively @gol
11724 -fexpensive-optimizations @gol
11725 -ffinite-loops @gol
11726 -fgcse -fgcse-lm @gol
11727 -fhoist-adjacent-loads @gol
11728 -finline-functions @gol
11729 -finline-small-functions @gol
11730 -findirect-inlining @gol
11731 -fipa-bit-cp -fipa-cp -fipa-icf @gol
11732 -fipa-ra -fipa-sra -fipa-vrp @gol
11733 -fisolate-erroneous-paths-dereference @gol
11734 -flra-remat @gol
11735 -foptimize-sibling-calls @gol
11736 -foptimize-strlen @gol
11737 -fpartial-inlining @gol
11738 -fpeephole2 @gol
11739 -freorder-blocks-algorithm=stc @gol
11740 -freorder-blocks-and-partition -freorder-functions @gol
11741 -frerun-cse-after-loop @gol
11742 -fschedule-insns -fschedule-insns2 @gol
11743 -fsched-interblock -fsched-spec @gol
11744 -fstore-merging @gol
11745 -fstrict-aliasing @gol
11746 -fthread-jumps @gol
11747 -ftree-builtin-call-dce @gol
11748 -ftree-loop-vectorize @gol
11749 -ftree-pre @gol
11750 -ftree-slp-vectorize @gol
11751 -ftree-switch-conversion -ftree-tail-merge @gol
11752 -ftree-vrp @gol
11753 -fvect-cost-model=very-cheap}
11754
11755 Please note the warning under @option{-fgcse} about
11756 invoking @option{-O2} on programs that use computed gotos.
11757
11758 @item -O3
11759 @opindex O3
11760 Optimize yet more. @option{-O3} turns on all optimizations specified
11761 by @option{-O2} and also turns on the following optimization flags:
11762
11763 @c Please keep the following list alphabetized!
11764 @gccoptlist{-fgcse-after-reload @gol
11765 -fipa-cp-clone
11766 -floop-interchange @gol
11767 -floop-unroll-and-jam @gol
11768 -fpeel-loops @gol
11769 -fpredictive-commoning @gol
11770 -fsplit-loops @gol
11771 -fsplit-paths @gol
11772 -ftree-loop-distribution @gol
11773 -ftree-partial-pre @gol
11774 -funswitch-loops @gol
11775 -fvect-cost-model=dynamic @gol
11776 -fversion-loops-for-strides}
11777
11778 @item -O0
11779 @opindex O0
11780 Reduce compilation time and make debugging produce the expected
11781 results. This is the default.
11782
11783 @item -Os
11784 @opindex Os
11785 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
11786 except those that often increase code size:
11787
11788 @gccoptlist{-falign-functions -falign-jumps @gol
11789 -falign-labels -falign-loops @gol
11790 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
11791
11792 It also enables @option{-finline-functions}, causes the compiler to tune for
11793 code size rather than execution speed, and performs further optimizations
11794 designed to reduce code size.
11795
11796 @item -Ofast
11797 @opindex Ofast
11798 Disregard strict standards compliance. @option{-Ofast} enables all
11799 @option{-O3} optimizations. It also enables optimizations that are not
11800 valid for all standard-compliant programs.
11801 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
11802 and the Fortran-specific @option{-fstack-arrays}, unless
11803 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
11804 It turns off @option{-fsemantic-interposition}.
11805
11806 @item -Og
11807 @opindex Og
11808 Optimize debugging experience. @option{-Og} should be the optimization
11809 level of choice for the standard edit-compile-debug cycle, offering
11810 a reasonable level of optimization while maintaining fast compilation
11811 and a good debugging experience. It is a better choice than @option{-O0}
11812 for producing debuggable code because some compiler passes
11813 that collect debug information are disabled at @option{-O0}.
11814
11815 Like @option{-O0}, @option{-Og} completely disables a number of
11816 optimization passes so that individual options controlling them have
11817 no effect. Otherwise @option{-Og} enables all @option{-O1}
11818 optimization flags except for those that may interfere with debugging:
11819
11820 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
11821 -fdse -fif-conversion -fif-conversion2 @gol
11822 -finline-functions-called-once @gol
11823 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt @gol
11824 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
11825
11826 @item -Oz
11827 @opindex Oz
11828 Optimize aggressively for size rather than speed. This may increase
11829 the number of instructions executed if those instructions require
11830 fewer bytes to encode. @option{-Oz} behaves similarly to @option{-Os}
11831 including enabling most @option{-O2} optimizations.
11832
11833 @end table
11834
11835 If you use multiple @option{-O} options, with or without level numbers,
11836 the last such option is the one that is effective.
11837
11838 Options of the form @option{-f@var{flag}} specify machine-independent
11839 flags. Most flags have both positive and negative forms; the negative
11840 form of @option{-ffoo} is @option{-fno-foo}. In the table
11841 below, only one of the forms is listed---the one you typically
11842 use. You can figure out the other form by either removing @samp{no-}
11843 or adding it.
11844
11845 The following options control specific optimizations. They are either
11846 activated by @option{-O} options or are related to ones that are. You
11847 can use the following flags in the rare cases when ``fine-tuning'' of
11848 optimizations to be performed is desired.
11849
11850 @table @gcctabopt
11851 @item -fno-defer-pop
11852 @opindex fno-defer-pop
11853 @opindex fdefer-pop
11854 For machines that must pop arguments after a function call, always pop
11855 the arguments as soon as each function returns.
11856 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
11857 this allows the compiler to let arguments accumulate on the stack for several
11858 function calls and pop them all at once.
11859
11860 @item -fforward-propagate
11861 @opindex fforward-propagate
11862 Perform a forward propagation pass on RTL@. The pass tries to combine two
11863 instructions and checks if the result can be simplified. If loop unrolling
11864 is active, two passes are performed and the second is scheduled after
11865 loop unrolling.
11866
11867 This option is enabled by default at optimization levels @option{-O1},
11868 @option{-O2}, @option{-O3}, @option{-Os}.
11869
11870 @item -ffp-contract=@var{style}
11871 @opindex ffp-contract
11872 @option{-ffp-contract=off} disables floating-point expression contraction.
11873 @option{-ffp-contract=fast} enables floating-point expression contraction
11874 such as forming of fused multiply-add operations if the target has
11875 native support for them.
11876 @option{-ffp-contract=on} enables floating-point expression contraction
11877 if allowed by the language standard. This is currently not implemented
11878 and treated equal to @option{-ffp-contract=off}.
11879
11880 The default is @option{-ffp-contract=fast}.
11881
11882 @item -fomit-frame-pointer
11883 @opindex fomit-frame-pointer
11884 Omit the frame pointer in functions that don't need one. This avoids the
11885 instructions to save, set up and restore the frame pointer; on many targets
11886 it also makes an extra register available.
11887
11888 On some targets this flag has no effect because the standard calling sequence
11889 always uses a frame pointer, so it cannot be omitted.
11890
11891 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
11892 is used in all functions. Several targets always omit the frame pointer in
11893 leaf functions.
11894
11895 Enabled by default at @option{-O1} and higher.
11896
11897 @item -foptimize-sibling-calls
11898 @opindex foptimize-sibling-calls
11899 Optimize sibling and tail recursive calls.
11900
11901 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11902
11903 @item -foptimize-strlen
11904 @opindex foptimize-strlen
11905 Optimize various standard C string functions (e.g.@: @code{strlen},
11906 @code{strchr} or @code{strcpy}) and
11907 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
11908
11909 Enabled at levels @option{-O2}, @option{-O3}.
11910
11911 @item -fno-inline
11912 @opindex fno-inline
11913 @opindex finline
11914 Do not expand any functions inline apart from those marked with
11915 the @code{always_inline} attribute. This is the default when not
11916 optimizing.
11917
11918 Single functions can be exempted from inlining by marking them
11919 with the @code{noinline} attribute.
11920
11921 @item -finline-small-functions
11922 @opindex finline-small-functions
11923 Integrate functions into their callers when their body is smaller than expected
11924 function call code (so overall size of program gets smaller). The compiler
11925 heuristically decides which functions are simple enough to be worth integrating
11926 in this way. This inlining applies to all functions, even those not declared
11927 inline.
11928
11929 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11930
11931 @item -findirect-inlining
11932 @opindex findirect-inlining
11933 Inline also indirect calls that are discovered to be known at compile
11934 time thanks to previous inlining. This option has any effect only
11935 when inlining itself is turned on by the @option{-finline-functions}
11936 or @option{-finline-small-functions} options.
11937
11938 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11939
11940 @item -finline-functions
11941 @opindex finline-functions
11942 Consider all functions for inlining, even if they are not declared inline.
11943 The compiler heuristically decides which functions are worth integrating
11944 in this way.
11945
11946 If all calls to a given function are integrated, and the function is
11947 declared @code{static}, then the function is normally not output as
11948 assembler code in its own right.
11949
11950 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
11951 by @option{-fprofile-use} and @option{-fauto-profile}.
11952
11953 @item -finline-functions-called-once
11954 @opindex finline-functions-called-once
11955 Consider all @code{static} functions called once for inlining into their
11956 caller even if they are not marked @code{inline}. If a call to a given
11957 function is integrated, then the function is not output as assembler code
11958 in its own right.
11959
11960 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
11961 but not @option{-Og}.
11962
11963 @item -fearly-inlining
11964 @opindex fearly-inlining
11965 Inline functions marked by @code{always_inline} and functions whose body seems
11966 smaller than the function call overhead early before doing
11967 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
11968 makes profiling significantly cheaper and usually inlining faster on programs
11969 having large chains of nested wrapper functions.
11970
11971 Enabled by default.
11972
11973 @item -fipa-sra
11974 @opindex fipa-sra
11975 Perform interprocedural scalar replacement of aggregates, removal of
11976 unused parameters and replacement of parameters passed by reference
11977 by parameters passed by value.
11978
11979 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
11980
11981 @item -finline-limit=@var{n}
11982 @opindex finline-limit
11983 By default, GCC limits the size of functions that can be inlined. This flag
11984 allows coarse control of this limit. @var{n} is the size of functions that
11985 can be inlined in number of pseudo instructions.
11986
11987 Inlining is actually controlled by a number of parameters, which may be
11988 specified individually by using @option{--param @var{name}=@var{value}}.
11989 The @option{-finline-limit=@var{n}} option sets some of these parameters
11990 as follows:
11991
11992 @table @gcctabopt
11993 @item max-inline-insns-single
11994 is set to @var{n}/2.
11995 @item max-inline-insns-auto
11996 is set to @var{n}/2.
11997 @end table
11998
11999 See below for a documentation of the individual
12000 parameters controlling inlining and for the defaults of these parameters.
12001
12002 @emph{Note:} there may be no value to @option{-finline-limit} that results
12003 in default behavior.
12004
12005 @emph{Note:} pseudo instruction represents, in this particular context, an
12006 abstract measurement of function's size. In no way does it represent a count
12007 of assembly instructions and as such its exact meaning might change from one
12008 release to an another.
12009
12010 @item -fno-keep-inline-dllexport
12011 @opindex fno-keep-inline-dllexport
12012 @opindex fkeep-inline-dllexport
12013 This is a more fine-grained version of @option{-fkeep-inline-functions},
12014 which applies only to functions that are declared using the @code{dllexport}
12015 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
12016 Functions}.
12017
12018 @item -fkeep-inline-functions
12019 @opindex fkeep-inline-functions
12020 In C, emit @code{static} functions that are declared @code{inline}
12021 into the object file, even if the function has been inlined into all
12022 of its callers. This switch does not affect functions using the
12023 @code{extern inline} extension in GNU C90@. In C++, emit any and all
12024 inline functions into the object file.
12025
12026 @item -fkeep-static-functions
12027 @opindex fkeep-static-functions
12028 Emit @code{static} functions into the object file, even if the function
12029 is never used.
12030
12031 @item -fkeep-static-consts
12032 @opindex fkeep-static-consts
12033 Emit variables declared @code{static const} when optimization isn't turned
12034 on, even if the variables aren't referenced.
12035
12036 GCC enables this option by default. If you want to force the compiler to
12037 check if a variable is referenced, regardless of whether or not
12038 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12039
12040 @item -fmerge-constants
12041 @opindex fmerge-constants
12042 Attempt to merge identical constants (string constants and floating-point
12043 constants) across compilation units.
12044
12045 This option is the default for optimized compilation if the assembler and
12046 linker support it. Use @option{-fno-merge-constants} to inhibit this
12047 behavior.
12048
12049 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12050
12051 @item -fmerge-all-constants
12052 @opindex fmerge-all-constants
12053 Attempt to merge identical constants and identical variables.
12054
12055 This option implies @option{-fmerge-constants}. In addition to
12056 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12057 arrays or initialized constant variables with integral or floating-point
12058 types. Languages like C or C++ require each variable, including multiple
12059 instances of the same variable in recursive calls, to have distinct locations,
12060 so using this option results in non-conforming
12061 behavior.
12062
12063 @item -fmodulo-sched
12064 @opindex fmodulo-sched
12065 Perform swing modulo scheduling immediately before the first scheduling
12066 pass. This pass looks at innermost loops and reorders their
12067 instructions by overlapping different iterations.
12068
12069 @item -fmodulo-sched-allow-regmoves
12070 @opindex fmodulo-sched-allow-regmoves
12071 Perform more aggressive SMS-based modulo scheduling with register moves
12072 allowed. By setting this flag certain anti-dependences edges are
12073 deleted, which triggers the generation of reg-moves based on the
12074 life-range analysis. This option is effective only with
12075 @option{-fmodulo-sched} enabled.
12076
12077 @item -fno-branch-count-reg
12078 @opindex fno-branch-count-reg
12079 @opindex fbranch-count-reg
12080 Disable the optimization pass that scans for opportunities to use
12081 ``decrement and branch'' instructions on a count register instead of
12082 instruction sequences that decrement a register, compare it against zero, and
12083 then branch based upon the result. This option is only meaningful on
12084 architectures that support such instructions, which include x86, PowerPC,
12085 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
12086 doesn't remove the decrement and branch instructions from the generated
12087 instruction stream introduced by other optimization passes.
12088
12089 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12090 except for @option{-Og}.
12091
12092 @item -fno-function-cse
12093 @opindex fno-function-cse
12094 @opindex ffunction-cse
12095 Do not put function addresses in registers; make each instruction that
12096 calls a constant function contain the function's address explicitly.
12097
12098 This option results in less efficient code, but some strange hacks
12099 that alter the assembler output may be confused by the optimizations
12100 performed when this option is not used.
12101
12102 The default is @option{-ffunction-cse}
12103
12104 @item -fno-zero-initialized-in-bss
12105 @opindex fno-zero-initialized-in-bss
12106 @opindex fzero-initialized-in-bss
12107 If the target supports a BSS section, GCC by default puts variables that
12108 are initialized to zero into BSS@. This can save space in the resulting
12109 code.
12110
12111 This option turns off this behavior because some programs explicitly
12112 rely on variables going to the data section---e.g., so that the
12113 resulting executable can find the beginning of that section and/or make
12114 assumptions based on that.
12115
12116 The default is @option{-fzero-initialized-in-bss}.
12117
12118 @item -fthread-jumps
12119 @opindex fthread-jumps
12120 Perform optimizations that check to see if a jump branches to a
12121 location where another comparison subsumed by the first is found. If
12122 so, the first branch is redirected to either the destination of the
12123 second branch or a point immediately following it, depending on whether
12124 the condition is known to be true or false.
12125
12126 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12127
12128 @item -fsplit-wide-types
12129 @opindex fsplit-wide-types
12130 When using a type that occupies multiple registers, such as @code{long
12131 long} on a 32-bit system, split the registers apart and allocate them
12132 independently. This normally generates better code for those types,
12133 but may make debugging more difficult.
12134
12135 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12136 @option{-Os}.
12137
12138 @item -fsplit-wide-types-early
12139 @opindex fsplit-wide-types-early
12140 Fully split wide types early, instead of very late.
12141 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12142
12143 This is the default on some targets.
12144
12145 @item -fcse-follow-jumps
12146 @opindex fcse-follow-jumps
12147 In common subexpression elimination (CSE), scan through jump instructions
12148 when the target of the jump is not reached by any other path. For
12149 example, when CSE encounters an @code{if} statement with an
12150 @code{else} clause, CSE follows the jump when the condition
12151 tested is false.
12152
12153 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12154
12155 @item -fcse-skip-blocks
12156 @opindex fcse-skip-blocks
12157 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12158 follow jumps that conditionally skip over blocks. When CSE
12159 encounters a simple @code{if} statement with no else clause,
12160 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12161 body of the @code{if}.
12162
12163 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12164
12165 @item -frerun-cse-after-loop
12166 @opindex frerun-cse-after-loop
12167 Re-run common subexpression elimination after loop optimizations are
12168 performed.
12169
12170 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12171
12172 @item -fgcse
12173 @opindex fgcse
12174 Perform a global common subexpression elimination pass.
12175 This pass also performs global constant and copy propagation.
12176
12177 @emph{Note:} When compiling a program using computed gotos, a GCC
12178 extension, you may get better run-time performance if you disable
12179 the global common subexpression elimination pass by adding
12180 @option{-fno-gcse} to the command line.
12181
12182 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12183
12184 @item -fgcse-lm
12185 @opindex fgcse-lm
12186 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12187 attempts to move loads that are only killed by stores into themselves. This
12188 allows a loop containing a load/store sequence to be changed to a load outside
12189 the loop, and a copy/store within the loop.
12190
12191 Enabled by default when @option{-fgcse} is enabled.
12192
12193 @item -fgcse-sm
12194 @opindex fgcse-sm
12195 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12196 global common subexpression elimination. This pass attempts to move
12197 stores out of loops. When used in conjunction with @option{-fgcse-lm},
12198 loops containing a load/store sequence can be changed to a load before
12199 the loop and a store after the loop.
12200
12201 Not enabled at any optimization level.
12202
12203 @item -fgcse-las
12204 @opindex fgcse-las
12205 When @option{-fgcse-las} is enabled, the global common subexpression
12206 elimination pass eliminates redundant loads that come after stores to the
12207 same memory location (both partial and full redundancies).
12208
12209 Not enabled at any optimization level.
12210
12211 @item -fgcse-after-reload
12212 @opindex fgcse-after-reload
12213 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12214 pass is performed after reload. The purpose of this pass is to clean up
12215 redundant spilling.
12216
12217 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12218
12219 @item -faggressive-loop-optimizations
12220 @opindex faggressive-loop-optimizations
12221 This option tells the loop optimizer to use language constraints to
12222 derive bounds for the number of iterations of a loop. This assumes that
12223 loop code does not invoke undefined behavior by for example causing signed
12224 integer overflows or out-of-bound array accesses. The bounds for the
12225 number of iterations of a loop are used to guide loop unrolling and peeling
12226 and loop exit test optimizations.
12227 This option is enabled by default.
12228
12229 @item -funconstrained-commons
12230 @opindex funconstrained-commons
12231 This option tells the compiler that variables declared in common blocks
12232 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12233 prevents certain optimizations that depend on knowing the array bounds.
12234
12235 @item -fcrossjumping
12236 @opindex fcrossjumping
12237 Perform cross-jumping transformation.
12238 This transformation unifies equivalent code and saves code size. The
12239 resulting code may or may not perform better than without cross-jumping.
12240
12241 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12242
12243 @item -fauto-inc-dec
12244 @opindex fauto-inc-dec
12245 Combine increments or decrements of addresses with memory accesses.
12246 This pass is always skipped on architectures that do not have
12247 instructions to support this. Enabled by default at @option{-O1} and
12248 higher on architectures that support this.
12249
12250 @item -fdce
12251 @opindex fdce
12252 Perform dead code elimination (DCE) on RTL@.
12253 Enabled by default at @option{-O1} and higher.
12254
12255 @item -fdse
12256 @opindex fdse
12257 Perform dead store elimination (DSE) on RTL@.
12258 Enabled by default at @option{-O1} and higher.
12259
12260 @item -fif-conversion
12261 @opindex fif-conversion
12262 Attempt to transform conditional jumps into branch-less equivalents. This
12263 includes use of conditional moves, min, max, set flags and abs instructions, and
12264 some tricks doable by standard arithmetics. The use of conditional execution
12265 on chips where it is available is controlled by @option{-fif-conversion2}.
12266
12267 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12268 not with @option{-Og}.
12269
12270 @item -fif-conversion2
12271 @opindex fif-conversion2
12272 Use conditional execution (where available) to transform conditional jumps into
12273 branch-less equivalents.
12274
12275 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12276 not with @option{-Og}.
12277
12278 @item -fdeclone-ctor-dtor
12279 @opindex fdeclone-ctor-dtor
12280 The C++ ABI requires multiple entry points for constructors and
12281 destructors: one for a base subobject, one for a complete object, and
12282 one for a virtual destructor that calls operator delete afterwards.
12283 For a hierarchy with virtual bases, the base and complete variants are
12284 clones, which means two copies of the function. With this option, the
12285 base and complete variants are changed to be thunks that call a common
12286 implementation.
12287
12288 Enabled by @option{-Os}.
12289
12290 @item -fdelete-null-pointer-checks
12291 @opindex fdelete-null-pointer-checks
12292 Assume that programs cannot safely dereference null pointers, and that
12293 no code or data element resides at address zero.
12294 This option enables simple constant
12295 folding optimizations at all optimization levels. In addition, other
12296 optimization passes in GCC use this flag to control global dataflow
12297 analyses that eliminate useless checks for null pointers; these assume
12298 that a memory access to address zero always results in a trap, so
12299 that if a pointer is checked after it has already been dereferenced,
12300 it cannot be null.
12301
12302 Note however that in some environments this assumption is not true.
12303 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12304 for programs that depend on that behavior.
12305
12306 This option is enabled by default on most targets. On Nios II ELF, it
12307 defaults to off. On AVR and MSP430, this option is completely disabled.
12308
12309 Passes that use the dataflow information
12310 are enabled independently at different optimization levels.
12311
12312 @item -fdevirtualize
12313 @opindex fdevirtualize
12314 Attempt to convert calls to virtual functions to direct calls. This
12315 is done both within a procedure and interprocedurally as part of
12316 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12317 propagation (@option{-fipa-cp}).
12318 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12319
12320 @item -fdevirtualize-speculatively
12321 @opindex fdevirtualize-speculatively
12322 Attempt to convert calls to virtual functions to speculative direct calls.
12323 Based on the analysis of the type inheritance graph, determine for a given call
12324 the set of likely targets. If the set is small, preferably of size 1, change
12325 the call into a conditional deciding between direct and indirect calls. The
12326 speculative calls enable more optimizations, such as inlining. When they seem
12327 useless after further optimization, they are converted back into original form.
12328
12329 @item -fdevirtualize-at-ltrans
12330 @opindex fdevirtualize-at-ltrans
12331 Stream extra information needed for aggressive devirtualization when running
12332 the link-time optimizer in local transformation mode.
12333 This option enables more devirtualization but
12334 significantly increases the size of streamed data. For this reason it is
12335 disabled by default.
12336
12337 @item -fexpensive-optimizations
12338 @opindex fexpensive-optimizations
12339 Perform a number of minor optimizations that are relatively expensive.
12340
12341 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12342
12343 @item -free
12344 @opindex free
12345 Attempt to remove redundant extension instructions. This is especially
12346 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12347 registers after writing to their lower 32-bit half.
12348
12349 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
12350 @option{-O3}, @option{-Os}.
12351
12352 @item -fno-lifetime-dse
12353 @opindex fno-lifetime-dse
12354 @opindex flifetime-dse
12355 In C++ the value of an object is only affected by changes within its
12356 lifetime: when the constructor begins, the object has an indeterminate
12357 value, and any changes during the lifetime of the object are dead when
12358 the object is destroyed. Normally dead store elimination will take
12359 advantage of this; if your code relies on the value of the object
12360 storage persisting beyond the lifetime of the object, you can use this
12361 flag to disable this optimization. To preserve stores before the
12362 constructor starts (e.g.@: because your operator new clears the object
12363 storage) but still treat the object as dead after the destructor, you
12364 can use @option{-flifetime-dse=1}. The default behavior can be
12365 explicitly selected with @option{-flifetime-dse=2}.
12366 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12367
12368 @item -flive-range-shrinkage
12369 @opindex flive-range-shrinkage
12370 Attempt to decrease register pressure through register live range
12371 shrinkage. This is helpful for fast processors with small or moderate
12372 size register sets.
12373
12374 @item -fira-algorithm=@var{algorithm}
12375 @opindex fira-algorithm
12376 Use the specified coloring algorithm for the integrated register
12377 allocator. The @var{algorithm} argument can be @samp{priority}, which
12378 specifies Chow's priority coloring, or @samp{CB}, which specifies
12379 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
12380 for all architectures, but for those targets that do support it, it is
12381 the default because it generates better code.
12382
12383 @item -fira-region=@var{region}
12384 @opindex fira-region
12385 Use specified regions for the integrated register allocator. The
12386 @var{region} argument should be one of the following:
12387
12388 @table @samp
12389
12390 @item all
12391 Use all loops as register allocation regions.
12392 This can give the best results for machines with a small and/or
12393 irregular register set.
12394
12395 @item mixed
12396 Use all loops except for loops with small register pressure
12397 as the regions. This value usually gives
12398 the best results in most cases and for most architectures,
12399 and is enabled by default when compiling with optimization for speed
12400 (@option{-O}, @option{-O2}, @dots{}).
12401
12402 @item one
12403 Use all functions as a single region.
12404 This typically results in the smallest code size, and is enabled by default for
12405 @option{-Os} or @option{-O0}.
12406
12407 @end table
12408
12409 @item -fira-hoist-pressure
12410 @opindex fira-hoist-pressure
12411 Use IRA to evaluate register pressure in the code hoisting pass for
12412 decisions to hoist expressions. This option usually results in smaller
12413 code, but it can slow the compiler down.
12414
12415 This option is enabled at level @option{-Os} for all targets.
12416
12417 @item -fira-loop-pressure
12418 @opindex fira-loop-pressure
12419 Use IRA to evaluate register pressure in loops for decisions to move
12420 loop invariants. This option usually results in generation
12421 of faster and smaller code on machines with large register files (>= 32
12422 registers), but it can slow the compiler down.
12423
12424 This option is enabled at level @option{-O3} for some targets.
12425
12426 @item -fno-ira-share-save-slots
12427 @opindex fno-ira-share-save-slots
12428 @opindex fira-share-save-slots
12429 Disable sharing of stack slots used for saving call-used hard
12430 registers living through a call. Each hard register gets a
12431 separate stack slot, and as a result function stack frames are
12432 larger.
12433
12434 @item -fno-ira-share-spill-slots
12435 @opindex fno-ira-share-spill-slots
12436 @opindex fira-share-spill-slots
12437 Disable sharing of stack slots allocated for pseudo-registers. Each
12438 pseudo-register that does not get a hard register gets a separate
12439 stack slot, and as a result function stack frames are larger.
12440
12441 @item -flra-remat
12442 @opindex flra-remat
12443 Enable CFG-sensitive rematerialization in LRA. Instead of loading
12444 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12445 values if it is profitable.
12446
12447 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12448
12449 @item -fdelayed-branch
12450 @opindex fdelayed-branch
12451 If supported for the target machine, attempt to reorder instructions
12452 to exploit instruction slots available after delayed branch
12453 instructions.
12454
12455 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12456 but not at @option{-Og}.
12457
12458 @item -fschedule-insns
12459 @opindex fschedule-insns
12460 If supported for the target machine, attempt to reorder instructions to
12461 eliminate execution stalls due to required data being unavailable. This
12462 helps machines that have slow floating point or memory load instructions
12463 by allowing other instructions to be issued until the result of the load
12464 or floating-point instruction is required.
12465
12466 Enabled at levels @option{-O2}, @option{-O3}.
12467
12468 @item -fschedule-insns2
12469 @opindex fschedule-insns2
12470 Similar to @option{-fschedule-insns}, but requests an additional pass of
12471 instruction scheduling after register allocation has been done. This is
12472 especially useful on machines with a relatively small number of
12473 registers and where memory load instructions take more than one cycle.
12474
12475 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12476
12477 @item -fno-sched-interblock
12478 @opindex fno-sched-interblock
12479 @opindex fsched-interblock
12480 Disable instruction scheduling across basic blocks, which
12481 is normally enabled when scheduling before register allocation, i.e.@:
12482 with @option{-fschedule-insns} or at @option{-O2} or higher.
12483
12484 @item -fno-sched-spec
12485 @opindex fno-sched-spec
12486 @opindex fsched-spec
12487 Disable speculative motion of non-load instructions, which
12488 is normally enabled when scheduling before register allocation, i.e.@:
12489 with @option{-fschedule-insns} or at @option{-O2} or higher.
12490
12491 @item -fsched-pressure
12492 @opindex fsched-pressure
12493 Enable register pressure sensitive insn scheduling before register
12494 allocation. This only makes sense when scheduling before register
12495 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12496 @option{-O2} or higher. Usage of this option can improve the
12497 generated code and decrease its size by preventing register pressure
12498 increase above the number of available hard registers and subsequent
12499 spills in register allocation.
12500
12501 @item -fsched-spec-load
12502 @opindex fsched-spec-load
12503 Allow speculative motion of some load instructions. This only makes
12504 sense when scheduling before register allocation, i.e.@: with
12505 @option{-fschedule-insns} or at @option{-O2} or higher.
12506
12507 @item -fsched-spec-load-dangerous
12508 @opindex fsched-spec-load-dangerous
12509 Allow speculative motion of more load instructions. This only makes
12510 sense when scheduling before register allocation, i.e.@: with
12511 @option{-fschedule-insns} or at @option{-O2} or higher.
12512
12513 @item -fsched-stalled-insns
12514 @itemx -fsched-stalled-insns=@var{n}
12515 @opindex fsched-stalled-insns
12516 Define how many insns (if any) can be moved prematurely from the queue
12517 of stalled insns into the ready list during the second scheduling pass.
12518 @option{-fno-sched-stalled-insns} means that no insns are moved
12519 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12520 on how many queued insns can be moved prematurely.
12521 @option{-fsched-stalled-insns} without a value is equivalent to
12522 @option{-fsched-stalled-insns=1}.
12523
12524 @item -fsched-stalled-insns-dep
12525 @itemx -fsched-stalled-insns-dep=@var{n}
12526 @opindex fsched-stalled-insns-dep
12527 Define how many insn groups (cycles) are examined for a dependency
12528 on a stalled insn that is a candidate for premature removal from the queue
12529 of stalled insns. This has an effect only during the second scheduling pass,
12530 and only if @option{-fsched-stalled-insns} is used.
12531 @option{-fno-sched-stalled-insns-dep} is equivalent to
12532 @option{-fsched-stalled-insns-dep=0}.
12533 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12534 @option{-fsched-stalled-insns-dep=1}.
12535
12536 @item -fsched2-use-superblocks
12537 @opindex fsched2-use-superblocks
12538 When scheduling after register allocation, use superblock scheduling.
12539 This allows motion across basic block boundaries,
12540 resulting in faster schedules. This option is experimental, as not all machine
12541 descriptions used by GCC model the CPU closely enough to avoid unreliable
12542 results from the algorithm.
12543
12544 This only makes sense when scheduling after register allocation, i.e.@: with
12545 @option{-fschedule-insns2} or at @option{-O2} or higher.
12546
12547 @item -fsched-group-heuristic
12548 @opindex fsched-group-heuristic
12549 Enable the group heuristic in the scheduler. This heuristic favors
12550 the instruction that belongs to a schedule group. This is enabled
12551 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12552 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12553
12554 @item -fsched-critical-path-heuristic
12555 @opindex fsched-critical-path-heuristic
12556 Enable the critical-path heuristic in the scheduler. This heuristic favors
12557 instructions on the critical path. This is enabled by default when
12558 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12559 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12560
12561 @item -fsched-spec-insn-heuristic
12562 @opindex fsched-spec-insn-heuristic
12563 Enable the speculative instruction heuristic in the scheduler. This
12564 heuristic favors speculative instructions with greater dependency weakness.
12565 This is enabled by default when scheduling is enabled, i.e.@:
12566 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12567 or at @option{-O2} or higher.
12568
12569 @item -fsched-rank-heuristic
12570 @opindex fsched-rank-heuristic
12571 Enable the rank heuristic in the scheduler. This heuristic favors
12572 the instruction belonging to a basic block with greater size or frequency.
12573 This is enabled by default when scheduling is enabled, i.e.@:
12574 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12575 at @option{-O2} or higher.
12576
12577 @item -fsched-last-insn-heuristic
12578 @opindex fsched-last-insn-heuristic
12579 Enable the last-instruction heuristic in the scheduler. This heuristic
12580 favors the instruction that is less dependent on the last instruction
12581 scheduled. This is enabled by default when scheduling is enabled,
12582 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12583 at @option{-O2} or higher.
12584
12585 @item -fsched-dep-count-heuristic
12586 @opindex fsched-dep-count-heuristic
12587 Enable the dependent-count heuristic in the scheduler. This heuristic
12588 favors the instruction that has more instructions depending on it.
12589 This is enabled by default when scheduling is enabled, i.e.@:
12590 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12591 at @option{-O2} or higher.
12592
12593 @item -freschedule-modulo-scheduled-loops
12594 @opindex freschedule-modulo-scheduled-loops
12595 Modulo scheduling is performed before traditional scheduling. If a loop
12596 is modulo scheduled, later scheduling passes may change its schedule.
12597 Use this option to control that behavior.
12598
12599 @item -fselective-scheduling
12600 @opindex fselective-scheduling
12601 Schedule instructions using selective scheduling algorithm. Selective
12602 scheduling runs instead of the first scheduler pass.
12603
12604 @item -fselective-scheduling2
12605 @opindex fselective-scheduling2
12606 Schedule instructions using selective scheduling algorithm. Selective
12607 scheduling runs instead of the second scheduler pass.
12608
12609 @item -fsel-sched-pipelining
12610 @opindex fsel-sched-pipelining
12611 Enable software pipelining of innermost loops during selective scheduling.
12612 This option has no effect unless one of @option{-fselective-scheduling} or
12613 @option{-fselective-scheduling2} is turned on.
12614
12615 @item -fsel-sched-pipelining-outer-loops
12616 @opindex fsel-sched-pipelining-outer-loops
12617 When pipelining loops during selective scheduling, also pipeline outer loops.
12618 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
12619
12620 @item -fsemantic-interposition
12621 @opindex fsemantic-interposition
12622 Some object formats, like ELF, allow interposing of symbols by the
12623 dynamic linker.
12624 This means that for symbols exported from the DSO, the compiler cannot perform
12625 interprocedural propagation, inlining and other optimizations in anticipation
12626 that the function or variable in question may change. While this feature is
12627 useful, for example, to rewrite memory allocation functions by a debugging
12628 implementation, it is expensive in the terms of code quality.
12629 With @option{-fno-semantic-interposition} the compiler assumes that
12630 if interposition happens for functions the overwriting function will have
12631 precisely the same semantics (and side effects).
12632 Similarly if interposition happens
12633 for variables, the constructor of the variable will be the same. The flag
12634 has no effect for functions explicitly declared inline
12635 (where it is never allowed for interposition to change semantics)
12636 and for symbols explicitly declared weak.
12637
12638 @item -fshrink-wrap
12639 @opindex fshrink-wrap
12640 Emit function prologues only before parts of the function that need it,
12641 rather than at the top of the function. This flag is enabled by default at
12642 @option{-O} and higher.
12643
12644 @item -fshrink-wrap-separate
12645 @opindex fshrink-wrap-separate
12646 Shrink-wrap separate parts of the prologue and epilogue separately, so that
12647 those parts are only executed when needed.
12648 This option is on by default, but has no effect unless @option{-fshrink-wrap}
12649 is also turned on and the target supports this.
12650
12651 @item -fcaller-saves
12652 @opindex fcaller-saves
12653 Enable allocation of values to registers that are clobbered by
12654 function calls, by emitting extra instructions to save and restore the
12655 registers around such calls. Such allocation is done only when it
12656 seems to result in better code.
12657
12658 This option is always enabled by default on certain machines, usually
12659 those which have no call-preserved registers to use instead.
12660
12661 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12662
12663 @item -fcombine-stack-adjustments
12664 @opindex fcombine-stack-adjustments
12665 Tracks stack adjustments (pushes and pops) and stack memory references
12666 and then tries to find ways to combine them.
12667
12668 Enabled by default at @option{-O1} and higher.
12669
12670 @item -fipa-ra
12671 @opindex fipa-ra
12672 Use caller save registers for allocation if those registers are not used by
12673 any called function. In that case it is not necessary to save and restore
12674 them around calls. This is only possible if called functions are part of
12675 same compilation unit as current function and they are compiled before it.
12676
12677 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
12678 is disabled if generated code will be instrumented for profiling
12679 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
12680 exactly (this happens on targets that do not expose prologues
12681 and epilogues in RTL).
12682
12683 @item -fconserve-stack
12684 @opindex fconserve-stack
12685 Attempt to minimize stack usage. The compiler attempts to use less
12686 stack space, even if that makes the program slower. This option
12687 implies setting the @option{large-stack-frame} parameter to 100
12688 and the @option{large-stack-frame-growth} parameter to 400.
12689
12690 @item -ftree-reassoc
12691 @opindex ftree-reassoc
12692 Perform reassociation on trees. This flag is enabled by default
12693 at @option{-O1} and higher.
12694
12695 @item -fcode-hoisting
12696 @opindex fcode-hoisting
12697 Perform code hoisting. Code hoisting tries to move the
12698 evaluation of expressions executed on all paths to the function exit
12699 as early as possible. This is especially useful as a code size
12700 optimization, but it often helps for code speed as well.
12701 This flag is enabled by default at @option{-O2} and higher.
12702
12703 @item -ftree-pre
12704 @opindex ftree-pre
12705 Perform partial redundancy elimination (PRE) on trees. This flag is
12706 enabled by default at @option{-O2} and @option{-O3}.
12707
12708 @item -ftree-partial-pre
12709 @opindex ftree-partial-pre
12710 Make partial redundancy elimination (PRE) more aggressive. This flag is
12711 enabled by default at @option{-O3}.
12712
12713 @item -ftree-forwprop
12714 @opindex ftree-forwprop
12715 Perform forward propagation on trees. This flag is enabled by default
12716 at @option{-O1} and higher.
12717
12718 @item -ftree-fre
12719 @opindex ftree-fre
12720 Perform full redundancy elimination (FRE) on trees. The difference
12721 between FRE and PRE is that FRE only considers expressions
12722 that are computed on all paths leading to the redundant computation.
12723 This analysis is faster than PRE, though it exposes fewer redundancies.
12724 This flag is enabled by default at @option{-O1} and higher.
12725
12726 @item -ftree-phiprop
12727 @opindex ftree-phiprop
12728 Perform hoisting of loads from conditional pointers on trees. This
12729 pass is enabled by default at @option{-O1} and higher.
12730
12731 @item -fhoist-adjacent-loads
12732 @opindex fhoist-adjacent-loads
12733 Speculatively hoist loads from both branches of an if-then-else if the
12734 loads are from adjacent locations in the same structure and the target
12735 architecture has a conditional move instruction. This flag is enabled
12736 by default at @option{-O2} and higher.
12737
12738 @item -ftree-copy-prop
12739 @opindex ftree-copy-prop
12740 Perform copy propagation on trees. This pass eliminates unnecessary
12741 copy operations. This flag is enabled by default at @option{-O1} and
12742 higher.
12743
12744 @item -fipa-pure-const
12745 @opindex fipa-pure-const
12746 Discover which functions are pure or constant.
12747 Enabled by default at @option{-O1} and higher.
12748
12749 @item -fipa-reference
12750 @opindex fipa-reference
12751 Discover which static variables do not escape the
12752 compilation unit.
12753 Enabled by default at @option{-O1} and higher.
12754
12755 @item -fipa-reference-addressable
12756 @opindex fipa-reference-addressable
12757 Discover read-only, write-only and non-addressable static variables.
12758 Enabled by default at @option{-O1} and higher.
12759
12760 @item -fipa-stack-alignment
12761 @opindex fipa-stack-alignment
12762 Reduce stack alignment on call sites if possible.
12763 Enabled by default.
12764
12765 @item -fipa-pta
12766 @opindex fipa-pta
12767 Perform interprocedural pointer analysis and interprocedural modification
12768 and reference analysis. This option can cause excessive memory and
12769 compile-time usage on large compilation units. It is not enabled by
12770 default at any optimization level.
12771
12772 @item -fipa-profile
12773 @opindex fipa-profile
12774 Perform interprocedural profile propagation. The functions called only from
12775 cold functions are marked as cold. Also functions executed once (such as
12776 @code{cold}, @code{noreturn}, static constructors or destructors) are
12777 identified. Cold functions and loop less parts of functions executed once are
12778 then optimized for size.
12779 Enabled by default at @option{-O1} and higher.
12780
12781 @item -fipa-modref
12782 @opindex fipa-modref
12783 Perform interprocedural mod/ref analysis. This optimization analyzes the side
12784 effects of functions (memory locations that are modified or referenced) and
12785 enables better optimization across the function call boundary. This flag is
12786 enabled by default at @option{-O1} and higher.
12787
12788 @item -fipa-cp
12789 @opindex fipa-cp
12790 Perform interprocedural constant propagation.
12791 This optimization analyzes the program to determine when values passed
12792 to functions are constants and then optimizes accordingly.
12793 This optimization can substantially increase performance
12794 if the application has constants passed to functions.
12795 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
12796 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12797
12798 @item -fipa-cp-clone
12799 @opindex fipa-cp-clone
12800 Perform function cloning to make interprocedural constant propagation stronger.
12801 When enabled, interprocedural constant propagation performs function cloning
12802 when externally visible function can be called with constant arguments.
12803 Because this optimization can create multiple copies of functions,
12804 it may significantly increase code size
12805 (see @option{--param ipa-cp-unit-growth=@var{value}}).
12806 This flag is enabled by default at @option{-O3}.
12807 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12808
12809 @item -fipa-bit-cp
12810 @opindex fipa-bit-cp
12811 When enabled, perform interprocedural bitwise constant
12812 propagation. This flag is enabled by default at @option{-O2} and
12813 by @option{-fprofile-use} and @option{-fauto-profile}.
12814 It requires that @option{-fipa-cp} is enabled.
12815
12816 @item -fipa-vrp
12817 @opindex fipa-vrp
12818 When enabled, perform interprocedural propagation of value
12819 ranges. This flag is enabled by default at @option{-O2}. It requires
12820 that @option{-fipa-cp} is enabled.
12821
12822 @item -fipa-icf
12823 @opindex fipa-icf
12824 Perform Identical Code Folding for functions and read-only variables.
12825 The optimization reduces code size and may disturb unwind stacks by replacing
12826 a function by equivalent one with a different name. The optimization works
12827 more effectively with link-time optimization enabled.
12828
12829 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
12830 works on different levels and thus the optimizations are not same - there are
12831 equivalences that are found only by GCC and equivalences found only by Gold.
12832
12833 This flag is enabled by default at @option{-O2} and @option{-Os}.
12834
12835 @item -flive-patching=@var{level}
12836 @opindex flive-patching
12837 Control GCC's optimizations to produce output suitable for live-patching.
12838
12839 If the compiler's optimization uses a function's body or information extracted
12840 from its body to optimize/change another function, the latter is called an
12841 impacted function of the former. If a function is patched, its impacted
12842 functions should be patched too.
12843
12844 The impacted functions are determined by the compiler's interprocedural
12845 optimizations. For example, a caller is impacted when inlining a function
12846 into its caller,
12847 cloning a function and changing its caller to call this new clone,
12848 or extracting a function's pureness/constness information to optimize
12849 its direct or indirect callers, etc.
12850
12851 Usually, the more IPA optimizations enabled, the larger the number of
12852 impacted functions for each function. In order to control the number of
12853 impacted functions and more easily compute the list of impacted function,
12854 IPA optimizations can be partially enabled at two different levels.
12855
12856 The @var{level} argument should be one of the following:
12857
12858 @table @samp
12859
12860 @item inline-clone
12861
12862 Only enable inlining and cloning optimizations, which includes inlining,
12863 cloning, interprocedural scalar replacement of aggregates and partial inlining.
12864 As a result, when patching a function, all its callers and its clones'
12865 callers are impacted, therefore need to be patched as well.
12866
12867 @option{-flive-patching=inline-clone} disables the following optimization flags:
12868 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
12869 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
12870 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
12871 -fipa-stack-alignment -fipa-modref}
12872
12873 @item inline-only-static
12874
12875 Only enable inlining of static functions.
12876 As a result, when patching a static function, all its callers are impacted
12877 and so need to be patched as well.
12878
12879 In addition to all the flags that @option{-flive-patching=inline-clone}
12880 disables,
12881 @option{-flive-patching=inline-only-static} disables the following additional
12882 optimization flags:
12883 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
12884
12885 @end table
12886
12887 When @option{-flive-patching} is specified without any value, the default value
12888 is @var{inline-clone}.
12889
12890 This flag is disabled by default.
12891
12892 Note that @option{-flive-patching} is not supported with link-time optimization
12893 (@option{-flto}).
12894
12895 @item -fisolate-erroneous-paths-dereference
12896 @opindex fisolate-erroneous-paths-dereference
12897 Detect paths that trigger erroneous or undefined behavior due to
12898 dereferencing a null pointer. Isolate those paths from the main control
12899 flow and turn the statement with erroneous or undefined behavior into a trap.
12900 This flag is enabled by default at @option{-O2} and higher and depends on
12901 @option{-fdelete-null-pointer-checks} also being enabled.
12902
12903 @item -fisolate-erroneous-paths-attribute
12904 @opindex fisolate-erroneous-paths-attribute
12905 Detect paths that trigger erroneous or undefined behavior due to a null value
12906 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
12907 attribute. Isolate those paths from the main control flow and turn the
12908 statement with erroneous or undefined behavior into a trap. This is not
12909 currently enabled, but may be enabled by @option{-O2} in the future.
12910
12911 @item -ftree-sink
12912 @opindex ftree-sink
12913 Perform forward store motion on trees. This flag is
12914 enabled by default at @option{-O1} and higher.
12915
12916 @item -ftree-bit-ccp
12917 @opindex ftree-bit-ccp
12918 Perform sparse conditional bit constant propagation on trees and propagate
12919 pointer alignment information.
12920 This pass only operates on local scalar variables and is enabled by default
12921 at @option{-O1} and higher, except for @option{-Og}.
12922 It requires that @option{-ftree-ccp} is enabled.
12923
12924 @item -ftree-ccp
12925 @opindex ftree-ccp
12926 Perform sparse conditional constant propagation (CCP) on trees. This
12927 pass only operates on local scalar variables and is enabled by default
12928 at @option{-O1} and higher.
12929
12930 @item -fssa-backprop
12931 @opindex fssa-backprop
12932 Propagate information about uses of a value up the definition chain
12933 in order to simplify the definitions. For example, this pass strips
12934 sign operations if the sign of a value never matters. The flag is
12935 enabled by default at @option{-O1} and higher.
12936
12937 @item -fssa-phiopt
12938 @opindex fssa-phiopt
12939 Perform pattern matching on SSA PHI nodes to optimize conditional
12940 code. This pass is enabled by default at @option{-O1} and higher,
12941 except for @option{-Og}.
12942
12943 @item -ftree-switch-conversion
12944 @opindex ftree-switch-conversion
12945 Perform conversion of simple initializations in a switch to
12946 initializations from a scalar array. This flag is enabled by default
12947 at @option{-O2} and higher.
12948
12949 @item -ftree-tail-merge
12950 @opindex ftree-tail-merge
12951 Look for identical code sequences. When found, replace one with a jump to the
12952 other. This optimization is known as tail merging or cross jumping. This flag
12953 is enabled by default at @option{-O2} and higher. The compilation time
12954 in this pass can
12955 be limited using @option{max-tail-merge-comparisons} parameter and
12956 @option{max-tail-merge-iterations} parameter.
12957
12958 @item -ftree-dce
12959 @opindex ftree-dce
12960 Perform dead code elimination (DCE) on trees. This flag is enabled by
12961 default at @option{-O1} and higher.
12962
12963 @item -ftree-builtin-call-dce
12964 @opindex ftree-builtin-call-dce
12965 Perform conditional dead code elimination (DCE) for calls to built-in functions
12966 that may set @code{errno} but are otherwise free of side effects. This flag is
12967 enabled by default at @option{-O2} and higher if @option{-Os} is not also
12968 specified.
12969
12970 @item -ffinite-loops
12971 @opindex ffinite-loops
12972 @opindex fno-finite-loops
12973 Assume that a loop with an exit will eventually take the exit and not loop
12974 indefinitely. This allows the compiler to remove loops that otherwise have
12975 no side-effects, not considering eventual endless looping as such.
12976
12977 This option is enabled by default at @option{-O2} for C++ with -std=c++11
12978 or higher.
12979
12980 @item -ftree-dominator-opts
12981 @opindex ftree-dominator-opts
12982 Perform a variety of simple scalar cleanups (constant/copy
12983 propagation, redundancy elimination, range propagation and expression
12984 simplification) based on a dominator tree traversal. This also
12985 performs jump threading (to reduce jumps to jumps). This flag is
12986 enabled by default at @option{-O1} and higher.
12987
12988 @item -ftree-dse
12989 @opindex ftree-dse
12990 Perform dead store elimination (DSE) on trees. A dead store is a store into
12991 a memory location that is later overwritten by another store without
12992 any intervening loads. In this case the earlier store can be deleted. This
12993 flag is enabled by default at @option{-O1} and higher.
12994
12995 @item -ftree-ch
12996 @opindex ftree-ch
12997 Perform loop header copying on trees. This is beneficial since it increases
12998 effectiveness of code motion optimizations. It also saves one jump. This flag
12999 is enabled by default at @option{-O1} and higher. It is not enabled
13000 for @option{-Os}, since it usually increases code size.
13001
13002 @item -ftree-loop-optimize
13003 @opindex ftree-loop-optimize
13004 Perform loop optimizations on trees. This flag is enabled by default
13005 at @option{-O1} and higher.
13006
13007 @item -ftree-loop-linear
13008 @itemx -floop-strip-mine
13009 @itemx -floop-block
13010 @opindex ftree-loop-linear
13011 @opindex floop-strip-mine
13012 @opindex floop-block
13013 Perform loop nest optimizations. Same as
13014 @option{-floop-nest-optimize}. To use this code transformation, GCC has
13015 to be configured with @option{--with-isl} to enable the Graphite loop
13016 transformation infrastructure.
13017
13018 @item -fgraphite-identity
13019 @opindex fgraphite-identity
13020 Enable the identity transformation for graphite. For every SCoP we generate
13021 the polyhedral representation and transform it back to gimple. Using
13022 @option{-fgraphite-identity} we can check the costs or benefits of the
13023 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
13024 are also performed by the code generator isl, like index splitting and
13025 dead code elimination in loops.
13026
13027 @item -floop-nest-optimize
13028 @opindex floop-nest-optimize
13029 Enable the isl based loop nest optimizer. This is a generic loop nest
13030 optimizer based on the Pluto optimization algorithms. It calculates a loop
13031 structure optimized for data-locality and parallelism. This option
13032 is experimental.
13033
13034 @item -floop-parallelize-all
13035 @opindex floop-parallelize-all
13036 Use the Graphite data dependence analysis to identify loops that can
13037 be parallelized. Parallelize all the loops that can be analyzed to
13038 not contain loop carried dependences without checking that it is
13039 profitable to parallelize the loops.
13040
13041 @item -ftree-coalesce-vars
13042 @opindex ftree-coalesce-vars
13043 While transforming the program out of the SSA representation, attempt to
13044 reduce copying by coalescing versions of different user-defined
13045 variables, instead of just compiler temporaries. This may severely
13046 limit the ability to debug an optimized program compiled with
13047 @option{-fno-var-tracking-assignments}. In the negated form, this flag
13048 prevents SSA coalescing of user variables. This option is enabled by
13049 default if optimization is enabled, and it does very little otherwise.
13050
13051 @item -ftree-loop-if-convert
13052 @opindex ftree-loop-if-convert
13053 Attempt to transform conditional jumps in the innermost loops to
13054 branch-less equivalents. The intent is to remove control-flow from
13055 the innermost loops in order to improve the ability of the
13056 vectorization pass to handle these loops. This is enabled by default
13057 if vectorization is enabled.
13058
13059 @item -ftree-loop-distribution
13060 @opindex ftree-loop-distribution
13061 Perform loop distribution. This flag can improve cache performance on
13062 big loop bodies and allow further loop optimizations, like
13063 parallelization or vectorization, to take place. For example, the loop
13064 @smallexample
13065 DO I = 1, N
13066 A(I) = B(I) + C
13067 D(I) = E(I) * F
13068 ENDDO
13069 @end smallexample
13070 is transformed to
13071 @smallexample
13072 DO I = 1, N
13073 A(I) = B(I) + C
13074 ENDDO
13075 DO I = 1, N
13076 D(I) = E(I) * F
13077 ENDDO
13078 @end smallexample
13079 This flag is enabled by default at @option{-O3}.
13080 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13081
13082 @item -ftree-loop-distribute-patterns
13083 @opindex ftree-loop-distribute-patterns
13084 Perform loop distribution of patterns that can be code generated with
13085 calls to a library. This flag is enabled by default at @option{-O2} and
13086 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13087
13088 This pass distributes the initialization loops and generates a call to
13089 memset zero. For example, the loop
13090 @smallexample
13091 DO I = 1, N
13092 A(I) = 0
13093 B(I) = A(I) + I
13094 ENDDO
13095 @end smallexample
13096 is transformed to
13097 @smallexample
13098 DO I = 1, N
13099 A(I) = 0
13100 ENDDO
13101 DO I = 1, N
13102 B(I) = A(I) + I
13103 ENDDO
13104 @end smallexample
13105 and the initialization loop is transformed into a call to memset zero.
13106 This flag is enabled by default at @option{-O3}.
13107 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13108
13109 @item -floop-interchange
13110 @opindex floop-interchange
13111 Perform loop interchange outside of graphite. This flag can improve cache
13112 performance on loop nest and allow further loop optimizations, like
13113 vectorization, to take place. For example, the loop
13114 @smallexample
13115 for (int i = 0; i < N; i++)
13116 for (int j = 0; j < N; j++)
13117 for (int k = 0; k < N; k++)
13118 c[i][j] = c[i][j] + a[i][k]*b[k][j];
13119 @end smallexample
13120 is transformed to
13121 @smallexample
13122 for (int i = 0; i < N; i++)
13123 for (int k = 0; k < N; k++)
13124 for (int j = 0; j < N; j++)
13125 c[i][j] = c[i][j] + a[i][k]*b[k][j];
13126 @end smallexample
13127 This flag is enabled by default at @option{-O3}.
13128 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13129
13130 @item -floop-unroll-and-jam
13131 @opindex floop-unroll-and-jam
13132 Apply unroll and jam transformations on feasible loops. In a loop
13133 nest this unrolls the outer loop by some factor and fuses the resulting
13134 multiple inner loops. This flag is enabled by default at @option{-O3}.
13135 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13136
13137 @item -ftree-loop-im
13138 @opindex ftree-loop-im
13139 Perform loop invariant motion on trees. This pass moves only invariants that
13140 are hard to handle at RTL level (function calls, operations that expand to
13141 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
13142 operands of conditions that are invariant out of the loop, so that we can use
13143 just trivial invariantness analysis in loop unswitching. The pass also includes
13144 store motion.
13145
13146 @item -ftree-loop-ivcanon
13147 @opindex ftree-loop-ivcanon
13148 Create a canonical counter for number of iterations in loops for which
13149 determining number of iterations requires complicated analysis. Later
13150 optimizations then may determine the number easily. Useful especially
13151 in connection with unrolling.
13152
13153 @item -ftree-scev-cprop
13154 @opindex ftree-scev-cprop
13155 Perform final value replacement. If a variable is modified in a loop
13156 in such a way that its value when exiting the loop can be determined using
13157 only its initial value and the number of loop iterations, replace uses of
13158 the final value by such a computation, provided it is sufficiently cheap.
13159 This reduces data dependencies and may allow further simplifications.
13160 Enabled by default at @option{-O1} and higher.
13161
13162 @item -fivopts
13163 @opindex fivopts
13164 Perform induction variable optimizations (strength reduction, induction
13165 variable merging and induction variable elimination) on trees.
13166
13167 @item -ftree-parallelize-loops=n
13168 @opindex ftree-parallelize-loops
13169 Parallelize loops, i.e., split their iteration space to run in n threads.
13170 This is only possible for loops whose iterations are independent
13171 and can be arbitrarily reordered. The optimization is only
13172 profitable on multiprocessor machines, for loops that are CPU-intensive,
13173 rather than constrained e.g.@: by memory bandwidth. This option
13174 implies @option{-pthread}, and thus is only supported on targets
13175 that have support for @option{-pthread}.
13176
13177 @item -ftree-pta
13178 @opindex ftree-pta
13179 Perform function-local points-to analysis on trees. This flag is
13180 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13181
13182 @item -ftree-sra
13183 @opindex ftree-sra
13184 Perform scalar replacement of aggregates. This pass replaces structure
13185 references with scalars to prevent committing structures to memory too
13186 early. This flag is enabled by default at @option{-O1} and higher,
13187 except for @option{-Og}.
13188
13189 @item -fstore-merging
13190 @opindex fstore-merging
13191 Perform merging of narrow stores to consecutive memory addresses. This pass
13192 merges contiguous stores of immediate values narrower than a word into fewer
13193 wider stores to reduce the number of instructions. This is enabled by default
13194 at @option{-O2} and higher as well as @option{-Os}.
13195
13196 @item -ftree-ter
13197 @opindex ftree-ter
13198 Perform temporary expression replacement during the SSA->normal phase. Single
13199 use/single def temporaries are replaced at their use location with their
13200 defining expression. This results in non-GIMPLE code, but gives the expanders
13201 much more complex trees to work on resulting in better RTL generation. This is
13202 enabled by default at @option{-O1} and higher.
13203
13204 @item -ftree-slsr
13205 @opindex ftree-slsr
13206 Perform straight-line strength reduction on trees. This recognizes related
13207 expressions involving multiplications and replaces them by less expensive
13208 calculations when possible. This is enabled by default at @option{-O1} and
13209 higher.
13210
13211 @item -ftree-vectorize
13212 @opindex ftree-vectorize
13213 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13214 and @option{-ftree-slp-vectorize} if not explicitly specified.
13215
13216 @item -ftree-loop-vectorize
13217 @opindex ftree-loop-vectorize
13218 Perform loop vectorization on trees. This flag is enabled by default at
13219 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13220 and @option{-fauto-profile}.
13221
13222 @item -ftree-slp-vectorize
13223 @opindex ftree-slp-vectorize
13224 Perform basic block vectorization on trees. This flag is enabled by default at
13225 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13226 and @option{-fauto-profile}.
13227
13228 @item -ftrivial-auto-var-init=@var{choice}
13229 @opindex ftrivial-auto-var-init
13230 Initialize automatic variables with either a pattern or with zeroes to increase
13231 the security and predictability of a program by preventing uninitialized memory
13232 disclosure and use.
13233 GCC still considers an automatic variable that doesn't have an explicit
13234 initializer as uninitialized, @option{-Wuninitialized} and
13235 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13236 warning messages on such automatic variables and the compiler will
13237 perform optimization as if the variable were uninitialized.
13238 With this option, GCC will also initialize any padding of automatic variables
13239 that have structure or union types to zeroes.
13240 However, the current implementation cannot initialize automatic variables that
13241 are declared between the controlling expression and the first case of a
13242 @code{switch} statement. Using @option{-Wtrivial-auto-var-init} to report all
13243 such cases.
13244
13245 The three values of @var{choice} are:
13246
13247 @itemize @bullet
13248 @item
13249 @samp{uninitialized} doesn't initialize any automatic variables.
13250 This is C and C++'s default.
13251
13252 @item
13253 @samp{pattern} Initialize automatic variables with values which will likely
13254 transform logic bugs into crashes down the line, are easily recognized in a
13255 crash dump and without being values that programmers can rely on for useful
13256 program semantics.
13257 The current value is byte-repeatable pattern with byte "0xFE".
13258 The values used for pattern initialization might be changed in the future.
13259
13260 @item
13261 @samp{zero} Initialize automatic variables with zeroes.
13262 @end itemize
13263
13264 The default is @samp{uninitialized}.
13265
13266 You can control this behavior for a specific variable by using the variable
13267 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13268
13269 @item -fvect-cost-model=@var{model}
13270 @opindex fvect-cost-model
13271 Alter the cost model used for vectorization. The @var{model} argument
13272 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13273 @samp{very-cheap}.
13274 With the @samp{unlimited} model the vectorized code-path is assumed
13275 to be profitable while with the @samp{dynamic} model a runtime check
13276 guards the vectorized code-path to enable it only for iteration
13277 counts that will likely execute faster than when executing the original
13278 scalar loop. The @samp{cheap} model disables vectorization of
13279 loops where doing so would be cost prohibitive for example due to
13280 required runtime checks for data dependence or alignment but otherwise
13281 is equal to the @samp{dynamic} model. The @samp{very-cheap} model only
13282 allows vectorization if the vector code would entirely replace the
13283 scalar code that is being vectorized. For example, if each iteration
13284 of a vectorized loop would only be able to handle exactly four iterations
13285 of the scalar loop, the @samp{very-cheap} model would only allow
13286 vectorization if the scalar iteration count is known to be a multiple
13287 of four.
13288
13289 The default cost model depends on other optimization flags and is
13290 either @samp{dynamic} or @samp{cheap}.
13291
13292 @item -fsimd-cost-model=@var{model}
13293 @opindex fsimd-cost-model
13294 Alter the cost model used for vectorization of loops marked with the OpenMP
13295 simd directive. The @var{model} argument should be one of
13296 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
13297 have the same meaning as described in @option{-fvect-cost-model} and by
13298 default a cost model defined with @option{-fvect-cost-model} is used.
13299
13300 @item -ftree-vrp
13301 @opindex ftree-vrp
13302 Perform Value Range Propagation on trees. This is similar to the
13303 constant propagation pass, but instead of values, ranges of values are
13304 propagated. This allows the optimizers to remove unnecessary range
13305 checks like array bound checks and null pointer checks. This is
13306 enabled by default at @option{-O2} and higher. Null pointer check
13307 elimination is only done if @option{-fdelete-null-pointer-checks} is
13308 enabled.
13309
13310 @item -fsplit-paths
13311 @opindex fsplit-paths
13312 Split paths leading to loop backedges. This can improve dead code
13313 elimination and common subexpression elimination. This is enabled by
13314 default at @option{-O3} and above.
13315
13316 @item -fsplit-ivs-in-unroller
13317 @opindex fsplit-ivs-in-unroller
13318 Enables expression of values of induction variables in later iterations
13319 of the unrolled loop using the value in the first iteration. This breaks
13320 long dependency chains, thus improving efficiency of the scheduling passes.
13321
13322 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13323 same effect. However, that is not reliable in cases where the loop body
13324 is more complicated than a single basic block. It also does not work at all
13325 on some architectures due to restrictions in the CSE pass.
13326
13327 This optimization is enabled by default.
13328
13329 @item -fvariable-expansion-in-unroller
13330 @opindex fvariable-expansion-in-unroller
13331 With this option, the compiler creates multiple copies of some
13332 local variables when unrolling a loop, which can result in superior code.
13333
13334 This optimization is enabled by default for PowerPC targets, but disabled
13335 by default otherwise.
13336
13337 @item -fpartial-inlining
13338 @opindex fpartial-inlining
13339 Inline parts of functions. This option has any effect only
13340 when inlining itself is turned on by the @option{-finline-functions}
13341 or @option{-finline-small-functions} options.
13342
13343 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13344
13345 @item -fpredictive-commoning
13346 @opindex fpredictive-commoning
13347 Perform predictive commoning optimization, i.e., reusing computations
13348 (especially memory loads and stores) performed in previous
13349 iterations of loops.
13350
13351 This option is enabled at level @option{-O3}.
13352 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13353
13354 @item -fprefetch-loop-arrays
13355 @opindex fprefetch-loop-arrays
13356 If supported by the target machine, generate instructions to prefetch
13357 memory to improve the performance of loops that access large arrays.
13358
13359 This option may generate better or worse code; results are highly
13360 dependent on the structure of loops within the source code.
13361
13362 Disabled at level @option{-Os}.
13363
13364 @item -fno-printf-return-value
13365 @opindex fno-printf-return-value
13366 @opindex fprintf-return-value
13367 Do not substitute constants for known return value of formatted output
13368 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13369 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
13370 transformation allows GCC to optimize or even eliminate branches based
13371 on the known return value of these functions called with arguments that
13372 are either constant, or whose values are known to be in a range that
13373 makes determining the exact return value possible. For example, when
13374 @option{-fprintf-return-value} is in effect, both the branch and the
13375 body of the @code{if} statement (but not the call to @code{snprint})
13376 can be optimized away when @code{i} is a 32-bit or smaller integer
13377 because the return value is guaranteed to be at most 8.
13378
13379 @smallexample
13380 char buf[9];
13381 if (snprintf (buf, "%08x", i) >= sizeof buf)
13382 @dots{}
13383 @end smallexample
13384
13385 The @option{-fprintf-return-value} option relies on other optimizations
13386 and yields best results with @option{-O2} and above. It works in tandem
13387 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13388 options. The @option{-fprintf-return-value} option is enabled by default.
13389
13390 @item -fno-peephole
13391 @itemx -fno-peephole2
13392 @opindex fno-peephole
13393 @opindex fpeephole
13394 @opindex fno-peephole2
13395 @opindex fpeephole2
13396 Disable any machine-specific peephole optimizations. The difference
13397 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13398 are implemented in the compiler; some targets use one, some use the
13399 other, a few use both.
13400
13401 @option{-fpeephole} is enabled by default.
13402 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13403
13404 @item -fno-guess-branch-probability
13405 @opindex fno-guess-branch-probability
13406 @opindex fguess-branch-probability
13407 Do not guess branch probabilities using heuristics.
13408
13409 GCC uses heuristics to guess branch probabilities if they are
13410 not provided by profiling feedback (@option{-fprofile-arcs}). These
13411 heuristics are based on the control flow graph. If some branch probabilities
13412 are specified by @code{__builtin_expect}, then the heuristics are
13413 used to guess branch probabilities for the rest of the control flow graph,
13414 taking the @code{__builtin_expect} info into account. The interactions
13415 between the heuristics and @code{__builtin_expect} can be complex, and in
13416 some cases, it may be useful to disable the heuristics so that the effects
13417 of @code{__builtin_expect} are easier to understand.
13418
13419 It is also possible to specify expected probability of the expression
13420 with @code{__builtin_expect_with_probability} built-in function.
13421
13422 The default is @option{-fguess-branch-probability} at levels
13423 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13424
13425 @item -freorder-blocks
13426 @opindex freorder-blocks
13427 Reorder basic blocks in the compiled function in order to reduce number of
13428 taken branches and improve code locality.
13429
13430 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13431
13432 @item -freorder-blocks-algorithm=@var{algorithm}
13433 @opindex freorder-blocks-algorithm
13434 Use the specified algorithm for basic block reordering. The
13435 @var{algorithm} argument can be @samp{simple}, which does not increase
13436 code size (except sometimes due to secondary effects like alignment),
13437 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13438 put all often executed code together, minimizing the number of branches
13439 executed by making extra copies of code.
13440
13441 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13442 @samp{stc} at levels @option{-O2}, @option{-O3}.
13443
13444 @item -freorder-blocks-and-partition
13445 @opindex freorder-blocks-and-partition
13446 In addition to reordering basic blocks in the compiled function, in order
13447 to reduce number of taken branches, partitions hot and cold basic blocks
13448 into separate sections of the assembly and @file{.o} files, to improve
13449 paging and cache locality performance.
13450
13451 This optimization is automatically turned off in the presence of
13452 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13453 section attribute and on any architecture that does not support named
13454 sections. When @option{-fsplit-stack} is used this option is not
13455 enabled by default (to avoid linker errors), but may be enabled
13456 explicitly (if using a working linker).
13457
13458 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13459
13460 @item -freorder-functions
13461 @opindex freorder-functions
13462 Reorder functions in the object file in order to
13463 improve code locality. This is implemented by using special
13464 subsections @code{.text.hot} for most frequently executed functions and
13465 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
13466 the linker so object file format must support named sections and linker must
13467 place them in a reasonable way.
13468
13469 This option isn't effective unless you either provide profile feedback
13470 (see @option{-fprofile-arcs} for details) or manually annotate functions with
13471 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13472
13473 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13474
13475 @item -fstrict-aliasing
13476 @opindex fstrict-aliasing
13477 Allow the compiler to assume the strictest aliasing rules applicable to
13478 the language being compiled. For C (and C++), this activates
13479 optimizations based on the type of expressions. In particular, an
13480 object of one type is assumed never to reside at the same address as an
13481 object of a different type, unless the types are almost the same. For
13482 example, an @code{unsigned int} can alias an @code{int}, but not a
13483 @code{void*} or a @code{double}. A character type may alias any other
13484 type.
13485
13486 @anchor{Type-punning}Pay special attention to code like this:
13487 @smallexample
13488 union a_union @{
13489 int i;
13490 double d;
13491 @};
13492
13493 int f() @{
13494 union a_union t;
13495 t.d = 3.0;
13496 return t.i;
13497 @}
13498 @end smallexample
13499 The practice of reading from a different union member than the one most
13500 recently written to (called ``type-punning'') is common. Even with
13501 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13502 is accessed through the union type. So, the code above works as
13503 expected. @xref{Structures unions enumerations and bit-fields
13504 implementation}. However, this code might not:
13505 @smallexample
13506 int f() @{
13507 union a_union t;
13508 int* ip;
13509 t.d = 3.0;
13510 ip = &t.i;
13511 return *ip;
13512 @}
13513 @end smallexample
13514
13515 Similarly, access by taking the address, casting the resulting pointer
13516 and dereferencing the result has undefined behavior, even if the cast
13517 uses a union type, e.g.:
13518 @smallexample
13519 int f() @{
13520 double d = 3.0;
13521 return ((union a_union *) &d)->i;
13522 @}
13523 @end smallexample
13524
13525 The @option{-fstrict-aliasing} option is enabled at levels
13526 @option{-O2}, @option{-O3}, @option{-Os}.
13527
13528 @item -fipa-strict-aliasing
13529 @opindex fipa-strict-aliasing
13530 Controls whether rules of @option{-fstrict-aliasing} are applied across
13531 function boundaries. Note that if multiple functions gets inlined into a
13532 single function the memory accesses are no longer considered to be crossing a
13533 function boundary.
13534
13535 The @option{-fipa-strict-aliasing} option is enabled by default and is
13536 effective only in combination with @option{-fstrict-aliasing}.
13537
13538 @item -falign-functions
13539 @itemx -falign-functions=@var{n}
13540 @itemx -falign-functions=@var{n}:@var{m}
13541 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13542 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13543 @opindex falign-functions
13544 Align the start of functions to the next power-of-two greater than or
13545 equal to @var{n}, skipping up to @var{m}-1 bytes. This ensures that at
13546 least the first @var{m} bytes of the function can be fetched by the CPU
13547 without crossing an @var{n}-byte alignment boundary.
13548
13549 If @var{m} is not specified, it defaults to @var{n}.
13550
13551 Examples: @option{-falign-functions=32} aligns functions to the next
13552 32-byte boundary, @option{-falign-functions=24} aligns to the next
13553 32-byte boundary only if this can be done by skipping 23 bytes or less,
13554 @option{-falign-functions=32:7} aligns to the next
13555 32-byte boundary only if this can be done by skipping 6 bytes or less.
13556
13557 The second pair of @var{n2}:@var{m2} values allows you to specify
13558 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13559 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13560 otherwise aligns to the next 32-byte boundary if this can be done
13561 by skipping 2 bytes or less.
13562 If @var{m2} is not specified, it defaults to @var{n2}.
13563
13564 Some assemblers only support this flag when @var{n} is a power of two;
13565 in that case, it is rounded up.
13566
13567 @option{-fno-align-functions} and @option{-falign-functions=1} are
13568 equivalent and mean that functions are not aligned.
13569
13570 If @var{n} is not specified or is zero, use a machine-dependent default.
13571 The maximum allowed @var{n} option value is 65536.
13572
13573 Enabled at levels @option{-O2}, @option{-O3}.
13574
13575 @item -flimit-function-alignment
13576 If this option is enabled, the compiler tries to avoid unnecessarily
13577 overaligning functions. It attempts to instruct the assembler to align
13578 by the amount specified by @option{-falign-functions}, but not to
13579 skip more bytes than the size of the function.
13580
13581 @item -falign-labels
13582 @itemx -falign-labels=@var{n}
13583 @itemx -falign-labels=@var{n}:@var{m}
13584 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13585 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13586 @opindex falign-labels
13587 Align all branch targets to a power-of-two boundary.
13588
13589 Parameters of this option are analogous to the @option{-falign-functions} option.
13590 @option{-fno-align-labels} and @option{-falign-labels=1} are
13591 equivalent and mean that labels are not aligned.
13592
13593 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13594 are greater than this value, then their values are used instead.
13595
13596 If @var{n} is not specified or is zero, use a machine-dependent default
13597 which is very likely to be @samp{1}, meaning no alignment.
13598 The maximum allowed @var{n} option value is 65536.
13599
13600 Enabled at levels @option{-O2}, @option{-O3}.
13601
13602 @item -falign-loops
13603 @itemx -falign-loops=@var{n}
13604 @itemx -falign-loops=@var{n}:@var{m}
13605 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
13606 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
13607 @opindex falign-loops
13608 Align loops to a power-of-two boundary. If the loops are executed
13609 many times, this makes up for any execution of the dummy padding
13610 instructions.
13611
13612 If @option{-falign-labels} is greater than this value, then its value
13613 is used instead.
13614
13615 Parameters of this option are analogous to the @option{-falign-functions} option.
13616 @option{-fno-align-loops} and @option{-falign-loops=1} are
13617 equivalent and mean that loops are not aligned.
13618 The maximum allowed @var{n} option value is 65536.
13619
13620 If @var{n} is not specified or is zero, use a machine-dependent default.
13621
13622 Enabled at levels @option{-O2}, @option{-O3}.
13623
13624 @item -falign-jumps
13625 @itemx -falign-jumps=@var{n}
13626 @itemx -falign-jumps=@var{n}:@var{m}
13627 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
13628 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
13629 @opindex falign-jumps
13630 Align branch targets to a power-of-two boundary, for branch targets
13631 where the targets can only be reached by jumping. In this case,
13632 no dummy operations need be executed.
13633
13634 If @option{-falign-labels} is greater than this value, then its value
13635 is used instead.
13636
13637 Parameters of this option are analogous to the @option{-falign-functions} option.
13638 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
13639 equivalent and mean that loops are not aligned.
13640
13641 If @var{n} is not specified or is zero, use a machine-dependent default.
13642 The maximum allowed @var{n} option value is 65536.
13643
13644 Enabled at levels @option{-O2}, @option{-O3}.
13645
13646 @item -fno-allocation-dce
13647 @opindex fno-allocation-dce
13648 Do not remove unused C++ allocations in dead code elimination.
13649
13650 @item -fallow-store-data-races
13651 @opindex fallow-store-data-races
13652 Allow the compiler to perform optimizations that may introduce new data races
13653 on stores, without proving that the variable cannot be concurrently accessed
13654 by other threads. Does not affect optimization of local data. It is safe to
13655 use this option if it is known that global data will not be accessed by
13656 multiple threads.
13657
13658 Examples of optimizations enabled by @option{-fallow-store-data-races} include
13659 hoisting or if-conversions that may cause a value that was already in memory
13660 to be re-written with that same value. Such re-writing is safe in a single
13661 threaded context but may be unsafe in a multi-threaded context. Note that on
13662 some processors, if-conversions may be required in order to enable
13663 vectorization.
13664
13665 Enabled at level @option{-Ofast}.
13666
13667 @item -funit-at-a-time
13668 @opindex funit-at-a-time
13669 This option is left for compatibility reasons. @option{-funit-at-a-time}
13670 has no effect, while @option{-fno-unit-at-a-time} implies
13671 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
13672
13673 Enabled by default.
13674
13675 @item -fno-toplevel-reorder
13676 @opindex fno-toplevel-reorder
13677 @opindex ftoplevel-reorder
13678 Do not reorder top-level functions, variables, and @code{asm}
13679 statements. Output them in the same order that they appear in the
13680 input file. When this option is used, unreferenced static variables
13681 are not removed. This option is intended to support existing code
13682 that relies on a particular ordering. For new code, it is better to
13683 use attributes when possible.
13684
13685 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
13686 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
13687 Additionally @option{-fno-toplevel-reorder} implies
13688 @option{-fno-section-anchors}.
13689
13690 @item -funreachable-traps
13691 @opindex funreachable-traps
13692 With this option, the compiler turns calls to
13693 @code{__builtin_unreachable} into traps, instead of using them for
13694 optimization. This also affects any such calls implicitly generated
13695 by the compiler.
13696
13697 This option has the same effect as @option{-fsanitize=unreachable
13698 -fsanitize-trap=unreachable}, but does not affect the values of those
13699 options. If @option{-fsanitize=unreachable} is enabled, that option
13700 takes priority over this one.
13701
13702 This option is enabled by default at @option{-O0} and @option{-Og}.
13703
13704 @item -fweb
13705 @opindex fweb
13706 Constructs webs as commonly used for register allocation purposes and assign
13707 each web individual pseudo register. This allows the register allocation pass
13708 to operate on pseudos directly, but also strengthens several other optimization
13709 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
13710 however, make debugging impossible, since variables no longer stay in a
13711 ``home register''.
13712
13713 Enabled by default with @option{-funroll-loops}.
13714
13715 @item -fwhole-program
13716 @opindex fwhole-program
13717 Assume that the current compilation unit represents the whole program being
13718 compiled. All public functions and variables with the exception of @code{main}
13719 and those merged by attribute @code{externally_visible} become static functions
13720 and in effect are optimized more aggressively by interprocedural optimizers.
13721
13722 With @option{-flto} this option has a limited use. In most cases the
13723 precise list of symbols used or exported from the binary is known the
13724 resolution info passed to the link-time optimizer by the linker plugin. It is
13725 still useful if no linker plugin is used or during incremental link step when
13726 final code is produced (with @option{-flto}
13727 @option{-flinker-output=nolto-rel}).
13728
13729 @item -flto[=@var{n}]
13730 @opindex flto
13731 This option runs the standard link-time optimizer. When invoked
13732 with source code, it generates GIMPLE (one of GCC's internal
13733 representations) and writes it to special ELF sections in the object
13734 file. When the object files are linked together, all the function
13735 bodies are read from these ELF sections and instantiated as if they
13736 had been part of the same translation unit.
13737
13738 To use the link-time optimizer, @option{-flto} and optimization
13739 options should be specified at compile time and during the final link.
13740 It is recommended that you compile all the files participating in the
13741 same link with the same options and also specify those options at
13742 link time.
13743 For example:
13744
13745 @smallexample
13746 gcc -c -O2 -flto foo.c
13747 gcc -c -O2 -flto bar.c
13748 gcc -o myprog -flto -O2 foo.o bar.o
13749 @end smallexample
13750
13751 The first two invocations to GCC save a bytecode representation
13752 of GIMPLE into special ELF sections inside @file{foo.o} and
13753 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
13754 @file{foo.o} and @file{bar.o}, merges the two files into a single
13755 internal image, and compiles the result as usual. Since both
13756 @file{foo.o} and @file{bar.o} are merged into a single image, this
13757 causes all the interprocedural analyses and optimizations in GCC to
13758 work across the two files as if they were a single one. This means,
13759 for example, that the inliner is able to inline functions in
13760 @file{bar.o} into functions in @file{foo.o} and vice-versa.
13761
13762 Another (simpler) way to enable link-time optimization is:
13763
13764 @smallexample
13765 gcc -o myprog -flto -O2 foo.c bar.c
13766 @end smallexample
13767
13768 The above generates bytecode for @file{foo.c} and @file{bar.c},
13769 merges them together into a single GIMPLE representation and optimizes
13770 them as usual to produce @file{myprog}.
13771
13772 The important thing to keep in mind is that to enable link-time
13773 optimizations you need to use the GCC driver to perform the link step.
13774 GCC automatically performs link-time optimization if any of the
13775 objects involved were compiled with the @option{-flto} command-line option.
13776 You can always override
13777 the automatic decision to do link-time optimization
13778 by passing @option{-fno-lto} to the link command.
13779
13780 To make whole program optimization effective, it is necessary to make
13781 certain whole program assumptions. The compiler needs to know
13782 what functions and variables can be accessed by libraries and runtime
13783 outside of the link-time optimized unit. When supported by the linker,
13784 the linker plugin (see @option{-fuse-linker-plugin}) passes information
13785 to the compiler about used and externally visible symbols. When
13786 the linker plugin is not available, @option{-fwhole-program} should be
13787 used to allow the compiler to make these assumptions, which leads
13788 to more aggressive optimization decisions.
13789
13790 When a file is compiled with @option{-flto} without
13791 @option{-fuse-linker-plugin}, the generated object file is larger than
13792 a regular object file because it contains GIMPLE bytecodes and the usual
13793 final code (see @option{-ffat-lto-objects}). This means that
13794 object files with LTO information can be linked as normal object
13795 files; if @option{-fno-lto} is passed to the linker, no
13796 interprocedural optimizations are applied. Note that when
13797 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
13798 but you cannot perform a regular, non-LTO link on them.
13799
13800 When producing the final binary, GCC only
13801 applies link-time optimizations to those files that contain bytecode.
13802 Therefore, you can mix and match object files and libraries with
13803 GIMPLE bytecodes and final object code. GCC automatically selects
13804 which files to optimize in LTO mode and which files to link without
13805 further processing.
13806
13807 Generally, options specified at link time override those
13808 specified at compile time, although in some cases GCC attempts to infer
13809 link-time options from the settings used to compile the input files.
13810
13811 If you do not specify an optimization level option @option{-O} at
13812 link time, then GCC uses the highest optimization level
13813 used when compiling the object files. Note that it is generally
13814 ineffective to specify an optimization level option only at link time and
13815 not at compile time, for two reasons. First, compiling without
13816 optimization suppresses compiler passes that gather information
13817 needed for effective optimization at link time. Second, some early
13818 optimization passes can be performed only at compile time and
13819 not at link time.
13820
13821 There are some code generation flags preserved by GCC when
13822 generating bytecodes, as they need to be used during the final link.
13823 Currently, the following options and their settings are taken from
13824 the first object file that explicitly specifies them:
13825 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
13826 @option{-fgnu-tm} and all the @option{-m} target flags.
13827
13828 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
13829 @option{-fPIE} are combined based on the following scheme:
13830
13831 @smallexample
13832 @option{-fPIC} + @option{-fpic} = @option{-fpic}
13833 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
13834 @option{-fpic/-fPIC} + (no option) = (no option)
13835 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
13836 @option{-fpic} + @option{-fPIE} = @option{-fpie}
13837 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
13838 @end smallexample
13839
13840 Certain ABI-changing flags are required to match in all compilation units,
13841 and trying to override this at link time with a conflicting value
13842 is ignored. This includes options such as @option{-freg-struct-return}
13843 and @option{-fpcc-struct-return}.
13844
13845 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
13846 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
13847 are passed through to the link stage and merged conservatively for
13848 conflicting translation units. Specifically
13849 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
13850 precedence; and for example @option{-ffp-contract=off} takes precedence
13851 over @option{-ffp-contract=fast}. You can override them at link time.
13852
13853 Diagnostic options such as @option{-Wstringop-overflow} are passed
13854 through to the link stage and their setting matches that of the
13855 compile-step at function granularity. Note that this matters only
13856 for diagnostics emitted during optimization. Note that code
13857 transforms such as inlining can lead to warnings being enabled
13858 or disabled for regions if code not consistent with the setting
13859 at compile time.
13860
13861 When you need to pass options to the assembler via @option{-Wa} or
13862 @option{-Xassembler} make sure to either compile such translation
13863 units with @option{-fno-lto} or consistently use the same assembler
13864 options on all translation units. You can alternatively also
13865 specify assembler options at LTO link time.
13866
13867 To enable debug info generation you need to supply @option{-g} at
13868 compile time. If any of the input files at link time were built
13869 with debug info generation enabled the link will enable debug info
13870 generation as well. Any elaborate debug info settings
13871 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
13872 at the linker command line and mixing different settings in different
13873 translation units is discouraged.
13874
13875 If LTO encounters objects with C linkage declared with incompatible
13876 types in separate translation units to be linked together (undefined
13877 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
13878 issued. The behavior is still undefined at run time. Similar
13879 diagnostics may be raised for other languages.
13880
13881 Another feature of LTO is that it is possible to apply interprocedural
13882 optimizations on files written in different languages:
13883
13884 @smallexample
13885 gcc -c -flto foo.c
13886 g++ -c -flto bar.cc
13887 gfortran -c -flto baz.f90
13888 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
13889 @end smallexample
13890
13891 Notice that the final link is done with @command{g++} to get the C++
13892 runtime libraries and @option{-lgfortran} is added to get the Fortran
13893 runtime libraries. In general, when mixing languages in LTO mode, you
13894 should use the same link command options as when mixing languages in a
13895 regular (non-LTO) compilation.
13896
13897 If object files containing GIMPLE bytecode are stored in a library archive, say
13898 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
13899 are using a linker with plugin support. To create static libraries suitable
13900 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
13901 and @command{ranlib};
13902 to show the symbols of object files with GIMPLE bytecode, use
13903 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
13904 and @command{nm} have been compiled with plugin support. At link time, use the
13905 flag @option{-fuse-linker-plugin} to ensure that the library participates in
13906 the LTO optimization process:
13907
13908 @smallexample
13909 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
13910 @end smallexample
13911
13912 With the linker plugin enabled, the linker extracts the needed
13913 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
13914 to make them part of the aggregated GIMPLE image to be optimized.
13915
13916 If you are not using a linker with plugin support and/or do not
13917 enable the linker plugin, then the objects inside @file{libfoo.a}
13918 are extracted and linked as usual, but they do not participate
13919 in the LTO optimization process. In order to make a static library suitable
13920 for both LTO optimization and usual linkage, compile its object files with
13921 @option{-flto} @option{-ffat-lto-objects}.
13922
13923 Link-time optimizations do not require the presence of the whole program to
13924 operate. If the program does not require any symbols to be exported, it is
13925 possible to combine @option{-flto} and @option{-fwhole-program} to allow
13926 the interprocedural optimizers to use more aggressive assumptions which may
13927 lead to improved optimization opportunities.
13928 Use of @option{-fwhole-program} is not needed when linker plugin is
13929 active (see @option{-fuse-linker-plugin}).
13930
13931 The current implementation of LTO makes no
13932 attempt to generate bytecode that is portable between different
13933 types of hosts. The bytecode files are versioned and there is a
13934 strict version check, so bytecode files generated in one version of
13935 GCC do not work with an older or newer version of GCC.
13936
13937 Link-time optimization does not work well with generation of debugging
13938 information on systems other than those using a combination of ELF and
13939 DWARF.
13940
13941 If you specify the optional @var{n}, the optimization and code
13942 generation done at link time is executed in parallel using @var{n}
13943 parallel jobs by utilizing an installed @command{make} program. The
13944 environment variable @env{MAKE} may be used to override the program
13945 used.
13946
13947 You can also specify @option{-flto=jobserver} to use GNU make's
13948 job server mode to determine the number of parallel jobs. This
13949 is useful when the Makefile calling GCC is already executing in parallel.
13950 You must prepend a @samp{+} to the command recipe in the parent Makefile
13951 for this to work. This option likely only works if @env{MAKE} is
13952 GNU make. Even without the option value, GCC tries to automatically
13953 detect a running GNU make's job server.
13954
13955 Use @option{-flto=auto} to use GNU make's job server, if available,
13956 or otherwise fall back to autodetection of the number of CPU threads
13957 present in your system.
13958
13959 @item -flto-partition=@var{alg}
13960 @opindex flto-partition
13961 Specify the partitioning algorithm used by the link-time optimizer.
13962 The value is either @samp{1to1} to specify a partitioning mirroring
13963 the original source files or @samp{balanced} to specify partitioning
13964 into equally sized chunks (whenever possible) or @samp{max} to create
13965 new partition for every symbol where possible. Specifying @samp{none}
13966 as an algorithm disables partitioning and streaming completely.
13967 The default value is @samp{balanced}. While @samp{1to1} can be used
13968 as an workaround for various code ordering issues, the @samp{max}
13969 partitioning is intended for internal testing only.
13970 The value @samp{one} specifies that exactly one partition should be
13971 used while the value @samp{none} bypasses partitioning and executes
13972 the link-time optimization step directly from the WPA phase.
13973
13974 @item -flto-compression-level=@var{n}
13975 @opindex flto-compression-level
13976 This option specifies the level of compression used for intermediate
13977 language written to LTO object files, and is only meaningful in
13978 conjunction with LTO mode (@option{-flto}). GCC currently supports two
13979 LTO compression algorithms. For zstd, valid values are 0 (no compression)
13980 to 19 (maximum compression), while zlib supports values from 0 to 9.
13981 Values outside this range are clamped to either minimum or maximum
13982 of the supported values. If the option is not given,
13983 a default balanced compression setting is used.
13984
13985 @item -fuse-linker-plugin
13986 @opindex fuse-linker-plugin
13987 Enables the use of a linker plugin during link-time optimization. This
13988 option relies on plugin support in the linker, which is available in gold
13989 or in GNU ld 2.21 or newer.
13990
13991 This option enables the extraction of object files with GIMPLE bytecode out
13992 of library archives. This improves the quality of optimization by exposing
13993 more code to the link-time optimizer. This information specifies what
13994 symbols can be accessed externally (by non-LTO object or during dynamic
13995 linking). Resulting code quality improvements on binaries (and shared
13996 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
13997 See @option{-flto} for a description of the effect of this flag and how to
13998 use it.
13999
14000 This option is enabled by default when LTO support in GCC is enabled
14001 and GCC was configured for use with
14002 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14003
14004 @item -ffat-lto-objects
14005 @opindex ffat-lto-objects
14006 Fat LTO objects are object files that contain both the intermediate language
14007 and the object code. This makes them usable for both LTO linking and normal
14008 linking. This option is effective only when compiling with @option{-flto}
14009 and is ignored at link time.
14010
14011 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14012 requires the complete toolchain to be aware of LTO. It requires a linker with
14013 linker plugin support for basic functionality. Additionally,
14014 @command{nm}, @command{ar} and @command{ranlib}
14015 need to support linker plugins to allow a full-featured build environment
14016 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
14017 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14018 to these tools. With non fat LTO makefiles need to be modified to use them.
14019
14020 Note that modern binutils provide plugin auto-load mechanism.
14021 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14022 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14023 @command{gcc-ranlib}).
14024
14025 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14026 support.
14027
14028 @item -fcompare-elim
14029 @opindex fcompare-elim
14030 After register allocation and post-register allocation instruction splitting,
14031 identify arithmetic instructions that compute processor flags similar to a
14032 comparison operation based on that arithmetic. If possible, eliminate the
14033 explicit comparison operation.
14034
14035 This pass only applies to certain targets that cannot explicitly represent
14036 the comparison operation before register allocation is complete.
14037
14038 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14039
14040 @item -fcprop-registers
14041 @opindex fcprop-registers
14042 After register allocation and post-register allocation instruction splitting,
14043 perform a copy-propagation pass to try to reduce scheduling dependencies
14044 and occasionally eliminate the copy.
14045
14046 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14047
14048 @item -fprofile-correction
14049 @opindex fprofile-correction
14050 Profiles collected using an instrumented binary for multi-threaded programs may
14051 be inconsistent due to missed counter updates. When this option is specified,
14052 GCC uses heuristics to correct or smooth out such inconsistencies. By
14053 default, GCC emits an error message when an inconsistent profile is detected.
14054
14055 This option is enabled by @option{-fauto-profile}.
14056
14057 @item -fprofile-partial-training
14058 @opindex fprofile-partial-training
14059 With @code{-fprofile-use} all portions of programs not executed during train
14060 run are optimized agressively for size rather than speed. In some cases it is
14061 not practical to train all possible hot paths in the program. (For
14062 example, program may contain functions specific for a given hardware and
14063 trianing may not cover all hardware configurations program is run on.) With
14064 @code{-fprofile-partial-training} profile feedback will be ignored for all
14065 functions not executed during the train run leading them to be optimized as if
14066 they were compiled without profile feedback. This leads to better performance
14067 when train run is not representative but also leads to significantly bigger
14068 code.
14069
14070 @item -fprofile-use
14071 @itemx -fprofile-use=@var{path}
14072 @opindex fprofile-use
14073 Enable profile feedback-directed optimizations,
14074 and the following optimizations, many of which
14075 are generally profitable only with profile feedback available:
14076
14077 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
14078 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
14079 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
14080 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
14081 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
14082 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
14083 -fprofile-reorder-functions}
14084
14085 Before you can use this option, you must first generate profiling information.
14086 @xref{Instrumentation Options}, for information about the
14087 @option{-fprofile-generate} option.
14088
14089 By default, GCC emits an error message if the feedback profiles do not
14090 match the source code. This error can be turned into a warning by using
14091 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
14092 optimized code. Additionally, by default, GCC also emits a warning message if
14093 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14094
14095 If @var{path} is specified, GCC looks at the @var{path} to find
14096 the profile feedback data files. See @option{-fprofile-dir}.
14097
14098 @item -fauto-profile
14099 @itemx -fauto-profile=@var{path}
14100 @opindex fauto-profile
14101 Enable sampling-based feedback-directed optimizations,
14102 and the following optimizations,
14103 many of which are generally profitable only with profile feedback available:
14104
14105 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
14106 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
14107 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
14108 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
14109 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
14110 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
14111 -fprofile-correction}
14112
14113 @var{path} is the name of a file containing AutoFDO profile information.
14114 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14115
14116 Producing an AutoFDO profile data file requires running your program
14117 with the @command{perf} utility on a supported GNU/Linux target system.
14118 For more information, see @uref{https://perf.wiki.kernel.org/}.
14119
14120 E.g.
14121 @smallexample
14122 perf record -e br_inst_retired:near_taken -b -o perf.data \
14123 -- your_program
14124 @end smallexample
14125
14126 Then use the @command{create_gcov} tool to convert the raw profile data
14127 to a format that can be used by GCC.@ You must also supply the
14128 unstripped binary for your program to this tool.
14129 See @uref{https://github.com/google/autofdo}.
14130
14131 E.g.
14132 @smallexample
14133 create_gcov --binary=your_program.unstripped --profile=perf.data \
14134 --gcov=profile.afdo
14135 @end smallexample
14136 @end table
14137
14138 The following options control compiler behavior regarding floating-point
14139 arithmetic. These options trade off between speed and
14140 correctness. All must be specifically enabled.
14141
14142 @table @gcctabopt
14143 @item -ffloat-store
14144 @opindex ffloat-store
14145 Do not store floating-point variables in registers, and inhibit other
14146 options that might change whether a floating-point value is taken from a
14147 register or memory.
14148
14149 @cindex floating-point precision
14150 This option prevents undesirable excess precision on machines such as
14151 the 68000 where the floating registers (of the 68881) keep more
14152 precision than a @code{double} is supposed to have. Similarly for the
14153 x86 architecture. For most programs, the excess precision does only
14154 good, but a few programs rely on the precise definition of IEEE floating
14155 point. Use @option{-ffloat-store} for such programs, after modifying
14156 them to store all pertinent intermediate computations into variables.
14157
14158 @item -fexcess-precision=@var{style}
14159 @opindex fexcess-precision
14160 This option allows further control over excess precision on machines
14161 where floating-point operations occur in a format with more precision or
14162 range than the IEEE standard and interchange floating-point types. By
14163 default, @option{-fexcess-precision=fast} is in effect; this means that
14164 operations may be carried out in a wider precision than the types specified
14165 in the source if that would result in faster code, and it is unpredictable
14166 when rounding to the types specified in the source code takes place.
14167 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14168 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14169 both casts and assignments cause values to be rounded to their
14170 semantic types (whereas @option{-ffloat-store} only affects
14171 assignments). This option is enabled by default for C or C++ if a strict
14172 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14173 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14174 regardless of whether a strict conformance option is used.
14175
14176 @opindex mfpmath
14177 @option{-fexcess-precision=standard} is not implemented for languages
14178 other than C or C++. On the x86, it has no effect if @option{-mfpmath=sse}
14179 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14180 semantics apply without excess precision, and in the latter, rounding
14181 is unpredictable.
14182
14183 @item -ffast-math
14184 @opindex ffast-math
14185 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14186 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14187 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14188 @option{-fexcess-precision=fast}.
14189
14190 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14191
14192 This option is not turned on by any @option{-O} option besides
14193 @option{-Ofast} since it can result in incorrect output for programs
14194 that depend on an exact implementation of IEEE or ISO rules/specifications
14195 for math functions. It may, however, yield faster code for programs
14196 that do not require the guarantees of these specifications.
14197
14198 @item -fno-math-errno
14199 @opindex fno-math-errno
14200 @opindex fmath-errno
14201 Do not set @code{errno} after calling math functions that are executed
14202 with a single instruction, e.g., @code{sqrt}. A program that relies on
14203 IEEE exceptions for math error handling may want to use this flag
14204 for speed while maintaining IEEE arithmetic compatibility.
14205
14206 This option is not turned on by any @option{-O} option since
14207 it can result in incorrect output for programs that depend on
14208 an exact implementation of IEEE or ISO rules/specifications for
14209 math functions. It may, however, yield faster code for programs
14210 that do not require the guarantees of these specifications.
14211
14212 The default is @option{-fmath-errno}.
14213
14214 On Darwin systems, the math library never sets @code{errno}. There is
14215 therefore no reason for the compiler to consider the possibility that
14216 it might, and @option{-fno-math-errno} is the default.
14217
14218 @item -funsafe-math-optimizations
14219 @opindex funsafe-math-optimizations
14220
14221 Allow optimizations for floating-point arithmetic that (a) assume
14222 that arguments and results are valid and (b) may violate IEEE or
14223 ANSI standards. When used at link time, it may include libraries
14224 or startup files that change the default FPU control word or other
14225 similar optimizations.
14226
14227 This option is not turned on by any @option{-O} option since
14228 it can result in incorrect output for programs that depend on
14229 an exact implementation of IEEE or ISO rules/specifications for
14230 math functions. It may, however, yield faster code for programs
14231 that do not require the guarantees of these specifications.
14232 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14233 @option{-fassociative-math} and @option{-freciprocal-math}.
14234
14235 The default is @option{-fno-unsafe-math-optimizations}.
14236
14237 @item -fassociative-math
14238 @opindex fassociative-math
14239
14240 Allow re-association of operands in series of floating-point operations.
14241 This violates the ISO C and C++ language standard by possibly changing
14242 computation result. NOTE: re-ordering may change the sign of zero as
14243 well as ignore NaNs and inhibit or create underflow or overflow (and
14244 thus cannot be used on code that relies on rounding behavior like
14245 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
14246 and thus may not be used when ordered comparisons are required.
14247 This option requires that both @option{-fno-signed-zeros} and
14248 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
14249 much sense with @option{-frounding-math}. For Fortran the option
14250 is automatically enabled when both @option{-fno-signed-zeros} and
14251 @option{-fno-trapping-math} are in effect.
14252
14253 The default is @option{-fno-associative-math}.
14254
14255 @item -freciprocal-math
14256 @opindex freciprocal-math
14257
14258 Allow the reciprocal of a value to be used instead of dividing by
14259 the value if this enables optimizations. For example @code{x / y}
14260 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14261 is subject to common subexpression elimination. Note that this loses
14262 precision and increases the number of flops operating on the value.
14263
14264 The default is @option{-fno-reciprocal-math}.
14265
14266 @item -ffinite-math-only
14267 @opindex ffinite-math-only
14268 Allow optimizations for floating-point arithmetic that assume
14269 that arguments and results are not NaNs or +-Infs.
14270
14271 This option is not turned on by any @option{-O} option since
14272 it can result in incorrect output for programs that depend on
14273 an exact implementation of IEEE or ISO rules/specifications for
14274 math functions. It may, however, yield faster code for programs
14275 that do not require the guarantees of these specifications.
14276
14277 The default is @option{-fno-finite-math-only}.
14278
14279 @item -fno-signed-zeros
14280 @opindex fno-signed-zeros
14281 @opindex fsigned-zeros
14282 Allow optimizations for floating-point arithmetic that ignore the
14283 signedness of zero. IEEE arithmetic specifies the behavior of
14284 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14285 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14286 This option implies that the sign of a zero result isn't significant.
14287
14288 The default is @option{-fsigned-zeros}.
14289
14290 @item -fno-trapping-math
14291 @opindex fno-trapping-math
14292 @opindex ftrapping-math
14293 Compile code assuming that floating-point operations cannot generate
14294 user-visible traps. These traps include division by zero, overflow,
14295 underflow, inexact result and invalid operation. This option requires
14296 that @option{-fno-signaling-nans} be in effect. Setting this option may
14297 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14298
14299 This option should never be turned on by any @option{-O} option since
14300 it can result in incorrect output for programs that depend on
14301 an exact implementation of IEEE or ISO rules/specifications for
14302 math functions.
14303
14304 The default is @option{-ftrapping-math}.
14305
14306 Future versions of GCC may provide finer control of this setting
14307 using C99's @code{FENV_ACCESS} pragma. This command-line option
14308 will be used along with @option{-frounding-math} to specify the
14309 default state for @code{FENV_ACCESS}.
14310
14311 @item -frounding-math
14312 @opindex frounding-math
14313 Disable transformations and optimizations that assume default floating-point
14314 rounding behavior. This is round-to-zero for all floating point
14315 to integer conversions, and round-to-nearest for all other arithmetic
14316 truncations. This option should be specified for programs that change
14317 the FP rounding mode dynamically, or that may be executed with a
14318 non-default rounding mode. This option disables constant folding of
14319 floating-point expressions at compile time (which may be affected by
14320 rounding mode) and arithmetic transformations that are unsafe in the
14321 presence of sign-dependent rounding modes.
14322
14323 The default is @option{-fno-rounding-math}.
14324
14325 This option is experimental and does not currently guarantee to
14326 disable all GCC optimizations that are affected by rounding mode.
14327 Future versions of GCC may provide finer control of this setting
14328 using C99's @code{FENV_ACCESS} pragma. This command-line option
14329 will be used along with @option{-ftrapping-math} to specify the
14330 default state for @code{FENV_ACCESS}.
14331
14332 @item -fsignaling-nans
14333 @opindex fsignaling-nans
14334 Compile code assuming that IEEE signaling NaNs may generate user-visible
14335 traps during floating-point operations. Setting this option disables
14336 optimizations that may change the number of exceptions visible with
14337 signaling NaNs. This option implies @option{-ftrapping-math}.
14338
14339 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14340 be defined.
14341
14342 The default is @option{-fno-signaling-nans}.
14343
14344 This option is experimental and does not currently guarantee to
14345 disable all GCC optimizations that affect signaling NaN behavior.
14346
14347 @item -fno-fp-int-builtin-inexact
14348 @opindex fno-fp-int-builtin-inexact
14349 @opindex ffp-int-builtin-inexact
14350 Do not allow the built-in functions @code{ceil}, @code{floor},
14351 @code{round} and @code{trunc}, and their @code{float} and @code{long
14352 double} variants, to generate code that raises the ``inexact''
14353 floating-point exception for noninteger arguments. ISO C99 and C11
14354 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14355 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14356 ISO C2X, does not allow these functions to do so.
14357
14358 The default is @option{-ffp-int-builtin-inexact}, allowing the
14359 exception to be raised, unless C2X or a later C standard is selected.
14360 This option does nothing unless @option{-ftrapping-math} is in effect.
14361
14362 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14363 generate a call to a library function then the ``inexact'' exception
14364 may be raised if the library implementation does not follow TS 18661.
14365
14366 @item -fsingle-precision-constant
14367 @opindex fsingle-precision-constant
14368 Treat floating-point constants as single precision instead of
14369 implicitly converting them to double-precision constants.
14370
14371 @item -fcx-limited-range
14372 @opindex fcx-limited-range
14373 When enabled, this option states that a range reduction step is not
14374 needed when performing complex division. Also, there is no checking
14375 whether the result of a complex multiplication or division is @code{NaN
14376 + I*NaN}, with an attempt to rescue the situation in that case. The
14377 default is @option{-fno-cx-limited-range}, but is enabled by
14378 @option{-ffast-math}.
14379
14380 This option controls the default setting of the ISO C99
14381 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
14382 all languages.
14383
14384 @item -fcx-fortran-rules
14385 @opindex fcx-fortran-rules
14386 Complex multiplication and division follow Fortran rules. Range
14387 reduction is done as part of complex division, but there is no checking
14388 whether the result of a complex multiplication or division is @code{NaN
14389 + I*NaN}, with an attempt to rescue the situation in that case.
14390
14391 The default is @option{-fno-cx-fortran-rules}.
14392
14393 @end table
14394
14395 The following options control optimizations that may improve
14396 performance, but are not enabled by any @option{-O} options. This
14397 section includes experimental options that may produce broken code.
14398
14399 @table @gcctabopt
14400 @item -fbranch-probabilities
14401 @opindex fbranch-probabilities
14402 After running a program compiled with @option{-fprofile-arcs}
14403 (@pxref{Instrumentation Options}),
14404 you can compile it a second time using
14405 @option{-fbranch-probabilities}, to improve optimizations based on
14406 the number of times each branch was taken. When a program
14407 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14408 counts to a file called @file{@var{sourcename}.gcda} for each source
14409 file. The information in this data file is very dependent on the
14410 structure of the generated code, so you must use the same source code
14411 and the same optimization options for both compilations.
14412 See details about the file naming in @option{-fprofile-arcs}.
14413
14414 With @option{-fbranch-probabilities}, GCC puts a
14415 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14416 These can be used to improve optimization. Currently, they are only
14417 used in one place: in @file{reorg.cc}, instead of guessing which path a
14418 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14419 exactly determine which path is taken more often.
14420
14421 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14422
14423 @item -fprofile-values
14424 @opindex fprofile-values
14425 If combined with @option{-fprofile-arcs}, it adds code so that some
14426 data about values of expressions in the program is gathered.
14427
14428 With @option{-fbranch-probabilities}, it reads back the data gathered
14429 from profiling values of expressions for usage in optimizations.
14430
14431 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14432 @option{-fauto-profile}.
14433
14434 @item -fprofile-reorder-functions
14435 @opindex fprofile-reorder-functions
14436 Function reordering based on profile instrumentation collects
14437 first time of execution of a function and orders these functions
14438 in ascending order.
14439
14440 Enabled with @option{-fprofile-use}.
14441
14442 @item -fvpt
14443 @opindex fvpt
14444 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14445 to add code to gather information about values of expressions.
14446
14447 With @option{-fbranch-probabilities}, it reads back the data gathered
14448 and actually performs the optimizations based on them.
14449 Currently the optimizations include specialization of division operations
14450 using the knowledge about the value of the denominator.
14451
14452 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14453
14454 @item -frename-registers
14455 @opindex frename-registers
14456 Attempt to avoid false dependencies in scheduled code by making use
14457 of registers left over after register allocation. This optimization
14458 most benefits processors with lots of registers. Depending on the
14459 debug information format adopted by the target, however, it can
14460 make debugging impossible, since variables no longer stay in
14461 a ``home register''.
14462
14463 Enabled by default with @option{-funroll-loops}.
14464
14465 @item -fschedule-fusion
14466 @opindex fschedule-fusion
14467 Performs a target dependent pass over the instruction stream to schedule
14468 instructions of same type together because target machine can execute them
14469 more efficiently if they are adjacent to each other in the instruction flow.
14470
14471 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14472
14473 @item -ftracer
14474 @opindex ftracer
14475 Perform tail duplication to enlarge superblock size. This transformation
14476 simplifies the control flow of the function allowing other optimizations to do
14477 a better job.
14478
14479 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14480
14481 @item -funroll-loops
14482 @opindex funroll-loops
14483 Unroll loops whose number of iterations can be determined at compile time or
14484 upon entry to the loop. @option{-funroll-loops} implies
14485 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14486 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14487 a small constant number of iterations). This option makes code larger, and may
14488 or may not make it run faster.
14489
14490 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14491
14492 @item -funroll-all-loops
14493 @opindex funroll-all-loops
14494 Unroll all loops, even if their number of iterations is uncertain when
14495 the loop is entered. This usually makes programs run more slowly.
14496 @option{-funroll-all-loops} implies the same options as
14497 @option{-funroll-loops}.
14498
14499 @item -fpeel-loops
14500 @opindex fpeel-loops
14501 Peels loops for which there is enough information that they do not
14502 roll much (from profile feedback or static analysis). It also turns on
14503 complete loop peeling (i.e.@: complete removal of loops with small constant
14504 number of iterations).
14505
14506 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14507
14508 @item -fmove-loop-invariants
14509 @opindex fmove-loop-invariants
14510 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
14511 at level @option{-O1} and higher, except for @option{-Og}.
14512
14513 @item -fmove-loop-stores
14514 @opindex fmove-loop-stores
14515 Enables the loop store motion pass in the GIMPLE loop optimizer. This
14516 moves invariant stores to after the end of the loop in exchange for
14517 carrying the stored value in a register across the iteration.
14518 Note for this option to have an effect @option{-ftree-loop-im} has to
14519 be enabled as well. Enabled at level @option{-O1} and higher, except
14520 for @option{-Og}.
14521
14522 @item -fsplit-loops
14523 @opindex fsplit-loops
14524 Split a loop into two if it contains a condition that's always true
14525 for one side of the iteration space and false for the other.
14526
14527 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14528
14529 @item -funswitch-loops
14530 @opindex funswitch-loops
14531 Move branches with loop invariant conditions out of the loop, with duplicates
14532 of the loop on both branches (modified according to result of the condition).
14533
14534 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14535
14536 @item -fversion-loops-for-strides
14537 @opindex fversion-loops-for-strides
14538 If a loop iterates over an array with a variable stride, create another
14539 version of the loop that assumes the stride is always one. For example:
14540
14541 @smallexample
14542 for (int i = 0; i < n; ++i)
14543 x[i * stride] = @dots{};
14544 @end smallexample
14545
14546 becomes:
14547
14548 @smallexample
14549 if (stride == 1)
14550 for (int i = 0; i < n; ++i)
14551 x[i] = @dots{};
14552 else
14553 for (int i = 0; i < n; ++i)
14554 x[i * stride] = @dots{};
14555 @end smallexample
14556
14557 This is particularly useful for assumed-shape arrays in Fortran where
14558 (for example) it allows better vectorization assuming contiguous accesses.
14559 This flag is enabled by default at @option{-O3}.
14560 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14561
14562 @item -ffunction-sections
14563 @itemx -fdata-sections
14564 @opindex ffunction-sections
14565 @opindex fdata-sections
14566 Place each function or data item into its own section in the output
14567 file if the target supports arbitrary sections. The name of the
14568 function or the name of the data item determines the section's name
14569 in the output file.
14570
14571 Use these options on systems where the linker can perform optimizations to
14572 improve locality of reference in the instruction space. Most systems using the
14573 ELF object format have linkers with such optimizations. On AIX, the linker
14574 rearranges sections (CSECTs) based on the call graph. The performance impact
14575 varies.
14576
14577 Together with a linker garbage collection (linker @option{--gc-sections}
14578 option) these options may lead to smaller statically-linked executables (after
14579 stripping).
14580
14581 On ELF/DWARF systems these options do not degenerate the quality of the debug
14582 information. There could be issues with other object files/debug info formats.
14583
14584 Only use these options when there are significant benefits from doing so. When
14585 you specify these options, the assembler and linker create larger object and
14586 executable files and are also slower. These options affect code generation.
14587 They prevent optimizations by the compiler and assembler using relative
14588 locations inside a translation unit since the locations are unknown until
14589 link time. An example of such an optimization is relaxing calls to short call
14590 instructions.
14591
14592 @item -fstdarg-opt
14593 @opindex fstdarg-opt
14594 Optimize the prologue of variadic argument functions with respect to usage of
14595 those arguments.
14596
14597 @item -fsection-anchors
14598 @opindex fsection-anchors
14599 Try to reduce the number of symbolic address calculations by using
14600 shared ``anchor'' symbols to address nearby objects. This transformation
14601 can help to reduce the number of GOT entries and GOT accesses on some
14602 targets.
14603
14604 For example, the implementation of the following function @code{foo}:
14605
14606 @smallexample
14607 static int a, b, c;
14608 int foo (void) @{ return a + b + c; @}
14609 @end smallexample
14610
14611 @noindent
14612 usually calculates the addresses of all three variables, but if you
14613 compile it with @option{-fsection-anchors}, it accesses the variables
14614 from a common anchor point instead. The effect is similar to the
14615 following pseudocode (which isn't valid C):
14616
14617 @smallexample
14618 int foo (void)
14619 @{
14620 register int *xr = &x;
14621 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
14622 @}
14623 @end smallexample
14624
14625 Not all targets support this option.
14626
14627 @item -fzero-call-used-regs=@var{choice}
14628 @opindex fzero-call-used-regs
14629 Zero call-used registers at function return to increase program
14630 security by either mitigating Return-Oriented Programming (ROP)
14631 attacks or preventing information leakage through registers.
14632
14633 The possible values of @var{choice} are the same as for the
14634 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
14635 The default is @samp{skip}.
14636
14637 You can control this behavior for a specific function by using the function
14638 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
14639
14640 @item --param @var{name}=@var{value}
14641 @opindex param
14642 In some places, GCC uses various constants to control the amount of
14643 optimization that is done. For example, GCC does not inline functions
14644 that contain more than a certain number of instructions. You can
14645 control some of these constants on the command line using the
14646 @option{--param} option.
14647
14648 The names of specific parameters, and the meaning of the values, are
14649 tied to the internals of the compiler, and are subject to change
14650 without notice in future releases.
14651
14652 In order to get minimal, maximal and default value of a parameter,
14653 one can use @option{--help=param -Q} options.
14654
14655 In each case, the @var{value} is an integer. The following choices
14656 of @var{name} are recognized for all targets:
14657
14658 @table @gcctabopt
14659 @item predictable-branch-outcome
14660 When branch is predicted to be taken with probability lower than this threshold
14661 (in percent), then it is considered well predictable.
14662
14663 @item max-rtl-if-conversion-insns
14664 RTL if-conversion tries to remove conditional branches around a block and
14665 replace them with conditionally executed instructions. This parameter
14666 gives the maximum number of instructions in a block which should be
14667 considered for if-conversion. The compiler will
14668 also use other heuristics to decide whether if-conversion is likely to be
14669 profitable.
14670
14671 @item max-rtl-if-conversion-predictable-cost
14672 RTL if-conversion will try to remove conditional branches around a block
14673 and replace them with conditionally executed instructions. These parameters
14674 give the maximum permissible cost for the sequence that would be generated
14675 by if-conversion depending on whether the branch is statically determined
14676 to be predictable or not. The units for this parameter are the same as
14677 those for the GCC internal seq_cost metric. The compiler will try to
14678 provide a reasonable default for this parameter using the BRANCH_COST
14679 target macro.
14680
14681 @item max-crossjump-edges
14682 The maximum number of incoming edges to consider for cross-jumping.
14683 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
14684 the number of edges incoming to each block. Increasing values mean
14685 more aggressive optimization, making the compilation time increase with
14686 probably small improvement in executable size.
14687
14688 @item min-crossjump-insns
14689 The minimum number of instructions that must be matched at the end
14690 of two blocks before cross-jumping is performed on them. This
14691 value is ignored in the case where all instructions in the block being
14692 cross-jumped from are matched.
14693
14694 @item max-grow-copy-bb-insns
14695 The maximum code size expansion factor when copying basic blocks
14696 instead of jumping. The expansion is relative to a jump instruction.
14697
14698 @item max-goto-duplication-insns
14699 The maximum number of instructions to duplicate to a block that jumps
14700 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
14701 passes, GCC factors computed gotos early in the compilation process,
14702 and unfactors them as late as possible. Only computed jumps at the
14703 end of a basic blocks with no more than max-goto-duplication-insns are
14704 unfactored.
14705
14706 @item max-delay-slot-insn-search
14707 The maximum number of instructions to consider when looking for an
14708 instruction to fill a delay slot. If more than this arbitrary number of
14709 instructions are searched, the time savings from filling the delay slot
14710 are minimal, so stop searching. Increasing values mean more
14711 aggressive optimization, making the compilation time increase with probably
14712 small improvement in execution time.
14713
14714 @item max-delay-slot-live-search
14715 When trying to fill delay slots, the maximum number of instructions to
14716 consider when searching for a block with valid live register
14717 information. Increasing this arbitrarily chosen value means more
14718 aggressive optimization, increasing the compilation time. This parameter
14719 should be removed when the delay slot code is rewritten to maintain the
14720 control-flow graph.
14721
14722 @item max-gcse-memory
14723 The approximate maximum amount of memory in @code{kB} that can be allocated in
14724 order to perform the global common subexpression elimination
14725 optimization. If more memory than specified is required, the
14726 optimization is not done.
14727
14728 @item max-gcse-insertion-ratio
14729 If the ratio of expression insertions to deletions is larger than this value
14730 for any expression, then RTL PRE inserts or removes the expression and thus
14731 leaves partially redundant computations in the instruction stream.
14732
14733 @item max-pending-list-length
14734 The maximum number of pending dependencies scheduling allows
14735 before flushing the current state and starting over. Large functions
14736 with few branches or calls can create excessively large lists which
14737 needlessly consume memory and resources.
14738
14739 @item max-modulo-backtrack-attempts
14740 The maximum number of backtrack attempts the scheduler should make
14741 when modulo scheduling a loop. Larger values can exponentially increase
14742 compilation time.
14743
14744 @item max-inline-functions-called-once-loop-depth
14745 Maximal loop depth of a call considered by inline heuristics that tries to
14746 inline all functions called once.
14747
14748 @item max-inline-functions-called-once-insns
14749 Maximal estimated size of functions produced while inlining functions called
14750 once.
14751
14752 @item max-inline-insns-single
14753 Several parameters control the tree inliner used in GCC@. This number sets the
14754 maximum number of instructions (counted in GCC's internal representation) in a
14755 single function that the tree inliner considers for inlining. This only
14756 affects functions declared inline and methods implemented in a class
14757 declaration (C++).
14758
14759
14760 @item max-inline-insns-auto
14761 When you use @option{-finline-functions} (included in @option{-O3}),
14762 a lot of functions that would otherwise not be considered for inlining
14763 by the compiler are investigated. To those functions, a different
14764 (more restrictive) limit compared to functions declared inline can
14765 be applied (@option{--param max-inline-insns-auto}).
14766
14767 @item max-inline-insns-small
14768 This is bound applied to calls which are considered relevant with
14769 @option{-finline-small-functions}.
14770
14771 @item max-inline-insns-size
14772 This is bound applied to calls which are optimized for size. Small growth
14773 may be desirable to anticipate optimization oppurtunities exposed by inlining.
14774
14775 @item uninlined-function-insns
14776 Number of instructions accounted by inliner for function overhead such as
14777 function prologue and epilogue.
14778
14779 @item uninlined-function-time
14780 Extra time accounted by inliner for function overhead such as time needed to
14781 execute function prologue and epilogue.
14782
14783 @item inline-heuristics-hint-percent
14784 The scale (in percents) applied to @option{inline-insns-single},
14785 @option{inline-insns-single-O2}, @option{inline-insns-auto}
14786 when inline heuristics hints that inlining is
14787 very profitable (will enable later optimizations).
14788
14789 @item uninlined-thunk-insns
14790 @item uninlined-thunk-time
14791 Same as @option{--param uninlined-function-insns} and
14792 @option{--param uninlined-function-time} but applied to function thunks.
14793
14794 @item inline-min-speedup
14795 When estimated performance improvement of caller + callee runtime exceeds this
14796 threshold (in percent), the function can be inlined regardless of the limit on
14797 @option{--param max-inline-insns-single} and @option{--param
14798 max-inline-insns-auto}.
14799
14800 @item large-function-insns
14801 The limit specifying really large functions. For functions larger than this
14802 limit after inlining, inlining is constrained by
14803 @option{--param large-function-growth}. This parameter is useful primarily
14804 to avoid extreme compilation time caused by non-linear algorithms used by the
14805 back end.
14806
14807 @item large-function-growth
14808 Specifies maximal growth of large function caused by inlining in percents.
14809 For example, parameter value 100 limits large function growth to 2.0 times
14810 the original size.
14811
14812 @item large-unit-insns
14813 The limit specifying large translation unit. Growth caused by inlining of
14814 units larger than this limit is limited by @option{--param inline-unit-growth}.
14815 For small units this might be too tight.
14816 For example, consider a unit consisting of function A
14817 that is inline and B that just calls A three times. If B is small relative to
14818 A, the growth of unit is 300\% and yet such inlining is very sane. For very
14819 large units consisting of small inlineable functions, however, the overall unit
14820 growth limit is needed to avoid exponential explosion of code size. Thus for
14821 smaller units, the size is increased to @option{--param large-unit-insns}
14822 before applying @option{--param inline-unit-growth}.
14823
14824 @item lazy-modules
14825 Maximum number of concurrently open C++ module files when lazy loading.
14826
14827 @item inline-unit-growth
14828 Specifies maximal overall growth of the compilation unit caused by inlining.
14829 For example, parameter value 20 limits unit growth to 1.2 times the original
14830 size. Cold functions (either marked cold via an attribute or by profile
14831 feedback) are not accounted into the unit size.
14832
14833 @item ipa-cp-unit-growth
14834 Specifies maximal overall growth of the compilation unit caused by
14835 interprocedural constant propagation. For example, parameter value 10 limits
14836 unit growth to 1.1 times the original size.
14837
14838 @item ipa-cp-large-unit-insns
14839 The size of translation unit that IPA-CP pass considers large.
14840
14841 @item large-stack-frame
14842 The limit specifying large stack frames. While inlining the algorithm is trying
14843 to not grow past this limit too much.
14844
14845 @item large-stack-frame-growth
14846 Specifies maximal growth of large stack frames caused by inlining in percents.
14847 For example, parameter value 1000 limits large stack frame growth to 11 times
14848 the original size.
14849
14850 @item max-inline-insns-recursive
14851 @itemx max-inline-insns-recursive-auto
14852 Specifies the maximum number of instructions an out-of-line copy of a
14853 self-recursive inline
14854 function can grow into by performing recursive inlining.
14855
14856 @option{--param max-inline-insns-recursive} applies to functions
14857 declared inline.
14858 For functions not declared inline, recursive inlining
14859 happens only when @option{-finline-functions} (included in @option{-O3}) is
14860 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
14861
14862 @item max-inline-recursive-depth
14863 @itemx max-inline-recursive-depth-auto
14864 Specifies the maximum recursion depth used for recursive inlining.
14865
14866 @option{--param max-inline-recursive-depth} applies to functions
14867 declared inline. For functions not declared inline, recursive inlining
14868 happens only when @option{-finline-functions} (included in @option{-O3}) is
14869 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
14870
14871 @item min-inline-recursive-probability
14872 Recursive inlining is profitable only for function having deep recursion
14873 in average and can hurt for function having little recursion depth by
14874 increasing the prologue size or complexity of function body to other
14875 optimizers.
14876
14877 When profile feedback is available (see @option{-fprofile-generate}) the actual
14878 recursion depth can be guessed from the probability that function recurses
14879 via a given call expression. This parameter limits inlining only to call
14880 expressions whose probability exceeds the given threshold (in percents).
14881
14882 @item early-inlining-insns
14883 Specify growth that the early inliner can make. In effect it increases
14884 the amount of inlining for code having a large abstraction penalty.
14885
14886 @item max-early-inliner-iterations
14887 Limit of iterations of the early inliner. This basically bounds
14888 the number of nested indirect calls the early inliner can resolve.
14889 Deeper chains are still handled by late inlining.
14890
14891 @item comdat-sharing-probability
14892 Probability (in percent) that C++ inline function with comdat visibility
14893 are shared across multiple compilation units.
14894
14895 @item modref-max-bases
14896 @item modref-max-refs
14897 @item modref-max-accesses
14898 Specifies the maximal number of base pointers, references and accesses stored
14899 for a single function by mod/ref analysis.
14900
14901 @item modref-max-tests
14902 Specifies the maxmal number of tests alias oracle can perform to disambiguate
14903 memory locations using the mod/ref information. This parameter ought to be
14904 bigger than @option{--param modref-max-bases} and @option{--param
14905 modref-max-refs}.
14906
14907 @item modref-max-depth
14908 Specifies the maximum depth of DFS walk used by modref escape analysis.
14909 Setting to 0 disables the analysis completely.
14910
14911 @item modref-max-escape-points
14912 Specifies the maximum number of escape points tracked by modref per SSA-name.
14913
14914 @item modref-max-adjustments
14915 Specifies the maximum number the access range is enlarged during modref dataflow
14916 analysis.
14917
14918 @item profile-func-internal-id
14919 A parameter to control whether to use function internal id in profile
14920 database lookup. If the value is 0, the compiler uses an id that
14921 is based on function assembler name and filename, which makes old profile
14922 data more tolerant to source changes such as function reordering etc.
14923
14924 @item min-vect-loop-bound
14925 The minimum number of iterations under which loops are not vectorized
14926 when @option{-ftree-vectorize} is used. The number of iterations after
14927 vectorization needs to be greater than the value specified by this option
14928 to allow vectorization.
14929
14930 @item gcse-cost-distance-ratio
14931 Scaling factor in calculation of maximum distance an expression
14932 can be moved by GCSE optimizations. This is currently supported only in the
14933 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
14934 is with simple expressions, i.e., the expressions that have cost
14935 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
14936 hoisting of simple expressions.
14937
14938 @item gcse-unrestricted-cost
14939 Cost, roughly measured as the cost of a single typical machine
14940 instruction, at which GCSE optimizations do not constrain
14941 the distance an expression can travel. This is currently
14942 supported only in the code hoisting pass. The lesser the cost,
14943 the more aggressive code hoisting is. Specifying 0
14944 allows all expressions to travel unrestricted distances.
14945
14946 @item max-hoist-depth
14947 The depth of search in the dominator tree for expressions to hoist.
14948 This is used to avoid quadratic behavior in hoisting algorithm.
14949 The value of 0 does not limit on the search, but may slow down compilation
14950 of huge functions.
14951
14952 @item max-tail-merge-comparisons
14953 The maximum amount of similar bbs to compare a bb with. This is used to
14954 avoid quadratic behavior in tree tail merging.
14955
14956 @item max-tail-merge-iterations
14957 The maximum amount of iterations of the pass over the function. This is used to
14958 limit compilation time in tree tail merging.
14959
14960 @item store-merging-allow-unaligned
14961 Allow the store merging pass to introduce unaligned stores if it is legal to
14962 do so.
14963
14964 @item max-stores-to-merge
14965 The maximum number of stores to attempt to merge into wider stores in the store
14966 merging pass.
14967
14968 @item max-store-chains-to-track
14969 The maximum number of store chains to track at the same time in the attempt
14970 to merge them into wider stores in the store merging pass.
14971
14972 @item max-stores-to-track
14973 The maximum number of stores to track at the same time in the attemt to
14974 to merge them into wider stores in the store merging pass.
14975
14976 @item max-unrolled-insns
14977 The maximum number of instructions that a loop may have to be unrolled.
14978 If a loop is unrolled, this parameter also determines how many times
14979 the loop code is unrolled.
14980
14981 @item max-average-unrolled-insns
14982 The maximum number of instructions biased by probabilities of their execution
14983 that a loop may have to be unrolled. If a loop is unrolled,
14984 this parameter also determines how many times the loop code is unrolled.
14985
14986 @item max-unroll-times
14987 The maximum number of unrollings of a single loop.
14988
14989 @item max-peeled-insns
14990 The maximum number of instructions that a loop may have to be peeled.
14991 If a loop is peeled, this parameter also determines how many times
14992 the loop code is peeled.
14993
14994 @item max-peel-times
14995 The maximum number of peelings of a single loop.
14996
14997 @item max-peel-branches
14998 The maximum number of branches on the hot path through the peeled sequence.
14999
15000 @item max-completely-peeled-insns
15001 The maximum number of insns of a completely peeled loop.
15002
15003 @item max-completely-peel-times
15004 The maximum number of iterations of a loop to be suitable for complete peeling.
15005
15006 @item max-completely-peel-loop-nest-depth
15007 The maximum depth of a loop nest suitable for complete peeling.
15008
15009 @item max-unswitch-insns
15010 The maximum number of insns of an unswitched loop.
15011
15012 @item max-unswitch-depth
15013 The maximum depth of a loop nest to be unswitched.
15014
15015 @item lim-expensive
15016 The minimum cost of an expensive expression in the loop invariant motion.
15017
15018 @item min-loop-cond-split-prob
15019 When FDO profile information is available, @option{min-loop-cond-split-prob}
15020 specifies minimum threshold for probability of semi-invariant condition
15021 statement to trigger loop split.
15022
15023 @item iv-consider-all-candidates-bound
15024 Bound on number of candidates for induction variables, below which
15025 all candidates are considered for each use in induction variable
15026 optimizations. If there are more candidates than this,
15027 only the most relevant ones are considered to avoid quadratic time complexity.
15028
15029 @item iv-max-considered-uses
15030 The induction variable optimizations give up on loops that contain more
15031 induction variable uses.
15032
15033 @item iv-always-prune-cand-set-bound
15034 If the number of candidates in the set is smaller than this value,
15035 always try to remove unnecessary ivs from the set
15036 when adding a new one.
15037
15038 @item avg-loop-niter
15039 Average number of iterations of a loop.
15040
15041 @item dse-max-object-size
15042 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15043 Larger values may result in larger compilation times.
15044
15045 @item dse-max-alias-queries-per-store
15046 Maximum number of queries into the alias oracle per store.
15047 Larger values result in larger compilation times and may result in more
15048 removed dead stores.
15049
15050 @item scev-max-expr-size
15051 Bound on size of expressions used in the scalar evolutions analyzer.
15052 Large expressions slow the analyzer.
15053
15054 @item scev-max-expr-complexity
15055 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15056 Complex expressions slow the analyzer.
15057
15058 @item max-tree-if-conversion-phi-args
15059 Maximum number of arguments in a PHI supported by TREE if conversion
15060 unless the loop is marked with simd pragma.
15061
15062 @item vect-max-layout-candidates
15063 The maximum number of possible vector layouts (such as permutations)
15064 to consider when optimizing to-be-vectorized code.
15065
15066 @item vect-max-version-for-alignment-checks
15067 The maximum number of run-time checks that can be performed when
15068 doing loop versioning for alignment in the vectorizer.
15069
15070 @item vect-max-version-for-alias-checks
15071 The maximum number of run-time checks that can be performed when
15072 doing loop versioning for alias in the vectorizer.
15073
15074 @item vect-max-peeling-for-alignment
15075 The maximum number of loop peels to enhance access alignment
15076 for vectorizer. Value -1 means no limit.
15077
15078 @item max-iterations-to-track
15079 The maximum number of iterations of a loop the brute-force algorithm
15080 for analysis of the number of iterations of the loop tries to evaluate.
15081
15082 @item hot-bb-count-fraction
15083 The denominator n of fraction 1/n of the maximal execution count of a
15084 basic block in the entire program that a basic block needs to at least
15085 have in order to be considered hot. The default is 10000, which means
15086 that a basic block is considered hot if its execution count is greater
15087 than 1/10000 of the maximal execution count. 0 means that it is never
15088 considered hot. Used in non-LTO mode.
15089
15090 @item hot-bb-count-ws-permille
15091 The number of most executed permilles, ranging from 0 to 1000, of the
15092 profiled execution of the entire program to which the execution count
15093 of a basic block must be part of in order to be considered hot. The
15094 default is 990, which means that a basic block is considered hot if
15095 its execution count contributes to the upper 990 permilles, or 99.0%,
15096 of the profiled execution of the entire program. 0 means that it is
15097 never considered hot. Used in LTO mode.
15098
15099 @item hot-bb-frequency-fraction
15100 The denominator n of fraction 1/n of the execution frequency of the
15101 entry block of a function that a basic block of this function needs
15102 to at least have in order to be considered hot. The default is 1000,
15103 which means that a basic block is considered hot in a function if it
15104 is executed more frequently than 1/1000 of the frequency of the entry
15105 block of the function. 0 means that it is never considered hot.
15106
15107 @item unlikely-bb-count-fraction
15108 The denominator n of fraction 1/n of the number of profiled runs of
15109 the entire program below which the execution count of a basic block
15110 must be in order for the basic block to be considered unlikely executed.
15111 The default is 20, which means that a basic block is considered unlikely
15112 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15113 the program. 0 means that it is always considered unlikely executed.
15114
15115 @item max-predicted-iterations
15116 The maximum number of loop iterations we predict statically. This is useful
15117 in cases where a function contains a single loop with known bound and
15118 another loop with unknown bound.
15119 The known number of iterations is predicted correctly, while
15120 the unknown number of iterations average to roughly 10. This means that the
15121 loop without bounds appears artificially cold relative to the other one.
15122
15123 @item builtin-expect-probability
15124 Control the probability of the expression having the specified value. This
15125 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15126
15127 @item builtin-string-cmp-inline-length
15128 The maximum length of a constant string for a builtin string cmp call
15129 eligible for inlining.
15130
15131 @item align-threshold
15132
15133 Select fraction of the maximal frequency of executions of a basic block in
15134 a function to align the basic block.
15135
15136 @item align-loop-iterations
15137
15138 A loop expected to iterate at least the selected number of iterations is
15139 aligned.
15140
15141 @item tracer-dynamic-coverage
15142 @itemx tracer-dynamic-coverage-feedback
15143
15144 This value is used to limit superblock formation once the given percentage of
15145 executed instructions is covered. This limits unnecessary code size
15146 expansion.
15147
15148 The @option{tracer-dynamic-coverage-feedback} parameter
15149 is used only when profile
15150 feedback is available. The real profiles (as opposed to statically estimated
15151 ones) are much less balanced allowing the threshold to be larger value.
15152
15153 @item tracer-max-code-growth
15154 Stop tail duplication once code growth has reached given percentage. This is
15155 a rather artificial limit, as most of the duplicates are eliminated later in
15156 cross jumping, so it may be set to much higher values than is the desired code
15157 growth.
15158
15159 @item tracer-min-branch-ratio
15160
15161 Stop reverse growth when the reverse probability of best edge is less than this
15162 threshold (in percent).
15163
15164 @item tracer-min-branch-probability
15165 @itemx tracer-min-branch-probability-feedback
15166
15167 Stop forward growth if the best edge has probability lower than this
15168 threshold.
15169
15170 Similarly to @option{tracer-dynamic-coverage} two parameters are
15171 provided. @option{tracer-min-branch-probability-feedback} is used for
15172 compilation with profile feedback and @option{tracer-min-branch-probability}
15173 compilation without. The value for compilation with profile feedback
15174 needs to be more conservative (higher) in order to make tracer
15175 effective.
15176
15177 @item stack-clash-protection-guard-size
15178 Specify the size of the operating system provided stack guard as
15179 2 raised to @var{num} bytes. Higher values may reduce the
15180 number of explicit probes, but a value larger than the operating system
15181 provided guard will leave code vulnerable to stack clash style attacks.
15182
15183 @item stack-clash-protection-probe-interval
15184 Stack clash protection involves probing stack space as it is allocated. This
15185 param controls the maximum distance between probes into the stack as 2 raised
15186 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
15187 larger than the operating system provided guard will leave code vulnerable to
15188 stack clash style attacks.
15189
15190 @item max-cse-path-length
15191
15192 The maximum number of basic blocks on path that CSE considers.
15193
15194 @item max-cse-insns
15195 The maximum number of instructions CSE processes before flushing.
15196
15197 @item ggc-min-expand
15198
15199 GCC uses a garbage collector to manage its own memory allocation. This
15200 parameter specifies the minimum percentage by which the garbage
15201 collector's heap should be allowed to expand between collections.
15202 Tuning this may improve compilation speed; it has no effect on code
15203 generation.
15204
15205 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15206 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
15207 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
15208 GCC is not able to calculate RAM on a particular platform, the lower
15209 bound of 30% is used. Setting this parameter and
15210 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15211 every opportunity. This is extremely slow, but can be useful for
15212 debugging.
15213
15214 @item ggc-min-heapsize
15215
15216 Minimum size of the garbage collector's heap before it begins bothering
15217 to collect garbage. The first collection occurs after the heap expands
15218 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
15219 tuning this may improve compilation speed, and has no effect on code
15220 generation.
15221
15222 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15223 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15224 with a lower bound of 4096 (four megabytes) and an upper bound of
15225 131072 (128 megabytes). If GCC is not able to calculate RAM on a
15226 particular platform, the lower bound is used. Setting this parameter
15227 very large effectively disables garbage collection. Setting this
15228 parameter and @option{ggc-min-expand} to zero causes a full collection
15229 to occur at every opportunity.
15230
15231 @item max-reload-search-insns
15232 The maximum number of instruction reload should look backward for equivalent
15233 register. Increasing values mean more aggressive optimization, making the
15234 compilation time increase with probably slightly better performance.
15235
15236 @item max-cselib-memory-locations
15237 The maximum number of memory locations cselib should take into account.
15238 Increasing values mean more aggressive optimization, making the compilation time
15239 increase with probably slightly better performance.
15240
15241 @item max-sched-ready-insns
15242 The maximum number of instructions ready to be issued the scheduler should
15243 consider at any given time during the first scheduling pass. Increasing
15244 values mean more thorough searches, making the compilation time increase
15245 with probably little benefit.
15246
15247 @item max-sched-region-blocks
15248 The maximum number of blocks in a region to be considered for
15249 interblock scheduling.
15250
15251 @item max-pipeline-region-blocks
15252 The maximum number of blocks in a region to be considered for
15253 pipelining in the selective scheduler.
15254
15255 @item max-sched-region-insns
15256 The maximum number of insns in a region to be considered for
15257 interblock scheduling.
15258
15259 @item max-pipeline-region-insns
15260 The maximum number of insns in a region to be considered for
15261 pipelining in the selective scheduler.
15262
15263 @item min-spec-prob
15264 The minimum probability (in percents) of reaching a source block
15265 for interblock speculative scheduling.
15266
15267 @item max-sched-extend-regions-iters
15268 The maximum number of iterations through CFG to extend regions.
15269 A value of 0 disables region extensions.
15270
15271 @item max-sched-insn-conflict-delay
15272 The maximum conflict delay for an insn to be considered for speculative motion.
15273
15274 @item sched-spec-prob-cutoff
15275 The minimal probability of speculation success (in percents), so that
15276 speculative insns are scheduled.
15277
15278 @item sched-state-edge-prob-cutoff
15279 The minimum probability an edge must have for the scheduler to save its
15280 state across it.
15281
15282 @item sched-mem-true-dep-cost
15283 Minimal distance (in CPU cycles) between store and load targeting same
15284 memory locations.
15285
15286 @item selsched-max-lookahead
15287 The maximum size of the lookahead window of selective scheduling. It is a
15288 depth of search for available instructions.
15289
15290 @item selsched-max-sched-times
15291 The maximum number of times that an instruction is scheduled during
15292 selective scheduling. This is the limit on the number of iterations
15293 through which the instruction may be pipelined.
15294
15295 @item selsched-insns-to-rename
15296 The maximum number of best instructions in the ready list that are considered
15297 for renaming in the selective scheduler.
15298
15299 @item sms-min-sc
15300 The minimum value of stage count that swing modulo scheduler
15301 generates.
15302
15303 @item max-last-value-rtl
15304 The maximum size measured as number of RTLs that can be recorded in an expression
15305 in combiner for a pseudo register as last known value of that register.
15306
15307 @item max-combine-insns
15308 The maximum number of instructions the RTL combiner tries to combine.
15309
15310 @item integer-share-limit
15311 Small integer constants can use a shared data structure, reducing the
15312 compiler's memory usage and increasing its speed. This sets the maximum
15313 value of a shared integer constant.
15314
15315 @item ssp-buffer-size
15316 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15317 protection when @option{-fstack-protector} is used.
15318
15319 @item min-size-for-stack-sharing
15320 The minimum size of variables taking part in stack slot sharing when not
15321 optimizing.
15322
15323 @item max-jump-thread-duplication-stmts
15324 Maximum number of statements allowed in a block that needs to be
15325 duplicated when threading jumps.
15326
15327 @item max-jump-thread-paths
15328 The maximum number of paths to consider when searching for jump threading
15329 opportunities. When arriving at a block, incoming edges are only considered
15330 if the number of paths to be searched so far multiplied by the number of
15331 incoming edges does not exhaust the specified maximum number of paths to
15332 consider.
15333
15334 @item max-fields-for-field-sensitive
15335 Maximum number of fields in a structure treated in
15336 a field sensitive manner during pointer analysis.
15337
15338 @item prefetch-latency
15339 Estimate on average number of instructions that are executed before
15340 prefetch finishes. The distance prefetched ahead is proportional
15341 to this constant. Increasing this number may also lead to less
15342 streams being prefetched (see @option{simultaneous-prefetches}).
15343
15344 @item simultaneous-prefetches
15345 Maximum number of prefetches that can run at the same time.
15346
15347 @item l1-cache-line-size
15348 The size of cache line in L1 data cache, in bytes.
15349
15350 @item l1-cache-size
15351 The size of L1 data cache, in kilobytes.
15352
15353 @item l2-cache-size
15354 The size of L2 data cache, in kilobytes.
15355
15356 @item prefetch-dynamic-strides
15357 Whether the loop array prefetch pass should issue software prefetch hints
15358 for strides that are non-constant. In some cases this may be
15359 beneficial, though the fact the stride is non-constant may make it
15360 hard to predict when there is clear benefit to issuing these hints.
15361
15362 Set to 1 if the prefetch hints should be issued for non-constant
15363 strides. Set to 0 if prefetch hints should be issued only for strides that
15364 are known to be constant and below @option{prefetch-minimum-stride}.
15365
15366 @item prefetch-minimum-stride
15367 Minimum constant stride, in bytes, to start using prefetch hints for. If
15368 the stride is less than this threshold, prefetch hints will not be issued.
15369
15370 This setting is useful for processors that have hardware prefetchers, in
15371 which case there may be conflicts between the hardware prefetchers and
15372 the software prefetchers. If the hardware prefetchers have a maximum
15373 stride they can handle, it should be used here to improve the use of
15374 software prefetchers.
15375
15376 A value of -1 means we don't have a threshold and therefore
15377 prefetch hints can be issued for any constant stride.
15378
15379 This setting is only useful for strides that are known and constant.
15380
15381 @item destructive-interference-size
15382 @item constructive-interference-size
15383 The values for the C++17 variables
15384 @code{std::hardware_destructive_interference_size} and
15385 @code{std::hardware_constructive_interference_size}. The destructive
15386 interference size is the minimum recommended offset between two
15387 independent concurrently-accessed objects; the constructive
15388 interference size is the maximum recommended size of contiguous memory
15389 accessed together. Typically both will be the size of an L1 cache
15390 line for the target, in bytes. For a generic target covering a range of L1
15391 cache line sizes, typically the constructive interference size will be
15392 the small end of the range and the destructive size will be the large
15393 end.
15394
15395 The destructive interference size is intended to be used for layout,
15396 and thus has ABI impact. The default value is not expected to be
15397 stable, and on some targets varies with @option{-mtune}, so use of
15398 this variable in a context where ABI stability is important, such as
15399 the public interface of a library, is strongly discouraged; if it is
15400 used in that context, users can stabilize the value using this
15401 option.
15402
15403 The constructive interference size is less sensitive, as it is
15404 typically only used in a @samp{static_assert} to make sure that a type
15405 fits within a cache line.
15406
15407 See also @option{-Winterference-size}.
15408
15409 @item loop-interchange-max-num-stmts
15410 The maximum number of stmts in a loop to be interchanged.
15411
15412 @item loop-interchange-stride-ratio
15413 The minimum ratio between stride of two loops for interchange to be profitable.
15414
15415 @item min-insn-to-prefetch-ratio
15416 The minimum ratio between the number of instructions and the
15417 number of prefetches to enable prefetching in a loop.
15418
15419 @item prefetch-min-insn-to-mem-ratio
15420 The minimum ratio between the number of instructions and the
15421 number of memory references to enable prefetching in a loop.
15422
15423 @item use-canonical-types
15424 Whether the compiler should use the ``canonical'' type system.
15425 Should always be 1, which uses a more efficient internal
15426 mechanism for comparing types in C++ and Objective-C++. However, if
15427 bugs in the canonical type system are causing compilation failures,
15428 set this value to 0 to disable canonical types.
15429
15430 @item switch-conversion-max-branch-ratio
15431 Switch initialization conversion refuses to create arrays that are
15432 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15433 branches in the switch.
15434
15435 @item max-partial-antic-length
15436 Maximum length of the partial antic set computed during the tree
15437 partial redundancy elimination optimization (@option{-ftree-pre}) when
15438 optimizing at @option{-O3} and above. For some sorts of source code
15439 the enhanced partial redundancy elimination optimization can run away,
15440 consuming all of the memory available on the host machine. This
15441 parameter sets a limit on the length of the sets that are computed,
15442 which prevents the runaway behavior. Setting a value of 0 for
15443 this parameter allows an unlimited set length.
15444
15445 @item rpo-vn-max-loop-depth
15446 Maximum loop depth that is value-numbered optimistically.
15447 When the limit hits the innermost
15448 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15449 loop nest are value-numbered optimistically and the remaining ones not.
15450
15451 @item sccvn-max-alias-queries-per-access
15452 Maximum number of alias-oracle queries we perform when looking for
15453 redundancies for loads and stores. If this limit is hit the search
15454 is aborted and the load or store is not considered redundant. The
15455 number of queries is algorithmically limited to the number of
15456 stores on all paths from the load to the function entry.
15457
15458 @item ira-max-loops-num
15459 IRA uses regional register allocation by default. If a function
15460 contains more loops than the number given by this parameter, only at most
15461 the given number of the most frequently-executed loops form regions
15462 for regional register allocation.
15463
15464 @item ira-max-conflict-table-size
15465 Although IRA uses a sophisticated algorithm to compress the conflict
15466 table, the table can still require excessive amounts of memory for
15467 huge functions. If the conflict table for a function could be more
15468 than the size in MB given by this parameter, the register allocator
15469 instead uses a faster, simpler, and lower-quality
15470 algorithm that does not require building a pseudo-register conflict table.
15471
15472 @item ira-loop-reserved-regs
15473 IRA can be used to evaluate more accurate register pressure in loops
15474 for decisions to move loop invariants (see @option{-O3}). The number
15475 of available registers reserved for some other purposes is given
15476 by this parameter. Default of the parameter
15477 is the best found from numerous experiments.
15478
15479 @item ira-consider-dup-in-all-alts
15480 Make IRA to consider matching constraint (duplicated operand number)
15481 heavily in all available alternatives for preferred register class.
15482 If it is set as zero, it means IRA only respects the matching
15483 constraint when it's in the only available alternative with an
15484 appropriate register class. Otherwise, it means IRA will check all
15485 available alternatives for preferred register class even if it has
15486 found some choice with an appropriate register class and respect the
15487 found qualified matching constraint.
15488
15489 @item lra-inheritance-ebb-probability-cutoff
15490 LRA tries to reuse values reloaded in registers in subsequent insns.
15491 This optimization is called inheritance. EBB is used as a region to
15492 do this optimization. The parameter defines a minimal fall-through
15493 edge probability in percentage used to add BB to inheritance EBB in
15494 LRA. The default value was chosen
15495 from numerous runs of SPEC2000 on x86-64.
15496
15497 @item loop-invariant-max-bbs-in-loop
15498 Loop invariant motion can be very expensive, both in compilation time and
15499 in amount of needed compile-time memory, with very large loops. Loops
15500 with more basic blocks than this parameter won't have loop invariant
15501 motion optimization performed on them.
15502
15503 @item loop-max-datarefs-for-datadeps
15504 Building data dependencies is expensive for very large loops. This
15505 parameter limits the number of data references in loops that are
15506 considered for data dependence analysis. These large loops are no
15507 handled by the optimizations using loop data dependencies.
15508
15509 @item max-vartrack-size
15510 Sets a maximum number of hash table slots to use during variable
15511 tracking dataflow analysis of any function. If this limit is exceeded
15512 with variable tracking at assignments enabled, analysis for that
15513 function is retried without it, after removing all debug insns from
15514 the function. If the limit is exceeded even without debug insns, var
15515 tracking analysis is completely disabled for the function. Setting
15516 the parameter to zero makes it unlimited.
15517
15518 @item max-vartrack-expr-depth
15519 Sets a maximum number of recursion levels when attempting to map
15520 variable names or debug temporaries to value expressions. This trades
15521 compilation time for more complete debug information. If this is set too
15522 low, value expressions that are available and could be represented in
15523 debug information may end up not being used; setting this higher may
15524 enable the compiler to find more complex debug expressions, but compile
15525 time and memory use may grow.
15526
15527 @item max-debug-marker-count
15528 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15529 markers) to avoid complexity explosion at inlining or expanding to RTL.
15530 If a function has more such gimple stmts than the set limit, such stmts
15531 will be dropped from the inlined copy of a function, and from its RTL
15532 expansion.
15533
15534 @item min-nondebug-insn-uid
15535 Use uids starting at this parameter for nondebug insns. The range below
15536 the parameter is reserved exclusively for debug insns created by
15537 @option{-fvar-tracking-assignments}, but debug insns may get
15538 (non-overlapping) uids above it if the reserved range is exhausted.
15539
15540 @item ipa-sra-deref-prob-threshold
15541 IPA-SRA replaces a pointer which is known not be NULL with one or more
15542 new parameters only when the probability (in percent, relative to
15543 function entry) of it being dereferenced is higher than this parameter.
15544
15545 @item ipa-sra-ptr-growth-factor
15546 IPA-SRA replaces a pointer to an aggregate with one or more new
15547 parameters only when their cumulative size is less or equal to
15548 @option{ipa-sra-ptr-growth-factor} times the size of the original
15549 pointer parameter.
15550
15551 @item ipa-sra-ptrwrap-growth-factor
15552 Additional maximum allowed growth of total size of new parameters
15553 that ipa-sra replaces a pointer to an aggregate with,
15554 if it points to a local variable that the caller only writes to and
15555 passes it as an argument to other functions.
15556
15557 @item ipa-sra-max-replacements
15558 Maximum pieces of an aggregate that IPA-SRA tracks. As a
15559 consequence, it is also the maximum number of replacements of a formal
15560 parameter.
15561
15562 @item sra-max-scalarization-size-Ospeed
15563 @itemx sra-max-scalarization-size-Osize
15564 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15565 replace scalar parts of aggregates with uses of independent scalar
15566 variables. These parameters control the maximum size, in storage units,
15567 of aggregate which is considered for replacement when compiling for
15568 speed
15569 (@option{sra-max-scalarization-size-Ospeed}) or size
15570 (@option{sra-max-scalarization-size-Osize}) respectively.
15571
15572 @item sra-max-propagations
15573 The maximum number of artificial accesses that Scalar Replacement of
15574 Aggregates (SRA) will track, per one local variable, in order to
15575 facilitate copy propagation.
15576
15577 @item tm-max-aggregate-size
15578 When making copies of thread-local variables in a transaction, this
15579 parameter specifies the size in bytes after which variables are
15580 saved with the logging functions as opposed to save/restore code
15581 sequence pairs. This option only applies when using
15582 @option{-fgnu-tm}.
15583
15584 @item graphite-max-nb-scop-params
15585 To avoid exponential effects in the Graphite loop transforms, the
15586 number of parameters in a Static Control Part (SCoP) is bounded.
15587 A value of zero can be used to lift
15588 the bound. A variable whose value is unknown at compilation time and
15589 defined outside a SCoP is a parameter of the SCoP.
15590
15591 @item loop-block-tile-size
15592 Loop blocking or strip mining transforms, enabled with
15593 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
15594 loop in the loop nest by a given number of iterations. The strip
15595 length can be changed using the @option{loop-block-tile-size}
15596 parameter.
15597
15598 @item ipa-jump-function-lookups
15599 Specifies number of statements visited during jump function offset discovery.
15600
15601 @item ipa-cp-value-list-size
15602 IPA-CP attempts to track all possible values and types passed to a function's
15603 parameter in order to propagate them and perform devirtualization.
15604 @option{ipa-cp-value-list-size} is the maximum number of values and types it
15605 stores per one formal parameter of a function.
15606
15607 @item ipa-cp-eval-threshold
15608 IPA-CP calculates its own score of cloning profitability heuristics
15609 and performs those cloning opportunities with scores that exceed
15610 @option{ipa-cp-eval-threshold}.
15611
15612 @item ipa-cp-max-recursive-depth
15613 Maximum depth of recursive cloning for self-recursive function.
15614
15615 @item ipa-cp-min-recursive-probability
15616 Recursive cloning only when the probability of call being executed exceeds
15617 the parameter.
15618
15619 @item ipa-cp-profile-count-base
15620 When using @option{-fprofile-use} option, IPA-CP will consider the measured
15621 execution count of a call graph edge at this percentage position in their
15622 histogram as the basis for its heuristics calculation.
15623
15624 @item ipa-cp-recursive-freq-factor
15625 The number of times interprocedural copy propagation expects recursive
15626 functions to call themselves.
15627
15628 @item ipa-cp-recursion-penalty
15629 Percentage penalty the recursive functions will receive when they
15630 are evaluated for cloning.
15631
15632 @item ipa-cp-single-call-penalty
15633 Percentage penalty functions containing a single call to another
15634 function will receive when they are evaluated for cloning.
15635
15636 @item ipa-max-agg-items
15637 IPA-CP is also capable to propagate a number of scalar values passed
15638 in an aggregate. @option{ipa-max-agg-items} controls the maximum
15639 number of such values per one parameter.
15640
15641 @item ipa-cp-loop-hint-bonus
15642 When IPA-CP determines that a cloning candidate would make the number
15643 of iterations of a loop known, it adds a bonus of
15644 @option{ipa-cp-loop-hint-bonus} to the profitability score of
15645 the candidate.
15646
15647 @item ipa-max-loop-predicates
15648 The maximum number of different predicates IPA will use to describe when
15649 loops in a function have known properties.
15650
15651 @item ipa-max-aa-steps
15652 During its analysis of function bodies, IPA-CP employs alias analysis
15653 in order to track values pointed to by function parameters. In order
15654 not spend too much time analyzing huge functions, it gives up and
15655 consider all memory clobbered after examining
15656 @option{ipa-max-aa-steps} statements modifying memory.
15657
15658 @item ipa-max-switch-predicate-bounds
15659 Maximal number of boundary endpoints of case ranges of switch statement.
15660 For switch exceeding this limit, IPA-CP will not construct cloning cost
15661 predicate, which is used to estimate cloning benefit, for default case
15662 of the switch statement.
15663
15664 @item ipa-max-param-expr-ops
15665 IPA-CP will analyze conditional statement that references some function
15666 parameter to estimate benefit for cloning upon certain constant value.
15667 But if number of operations in a parameter expression exceeds
15668 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
15669 one, and is not handled by IPA analysis.
15670
15671 @item lto-partitions
15672 Specify desired number of partitions produced during WHOPR compilation.
15673 The number of partitions should exceed the number of CPUs used for compilation.
15674
15675 @item lto-min-partition
15676 Size of minimal partition for WHOPR (in estimated instructions).
15677 This prevents expenses of splitting very small programs into too many
15678 partitions.
15679
15680 @item lto-max-partition
15681 Size of max partition for WHOPR (in estimated instructions).
15682 to provide an upper bound for individual size of partition.
15683 Meant to be used only with balanced partitioning.
15684
15685 @item lto-max-streaming-parallelism
15686 Maximal number of parallel processes used for LTO streaming.
15687
15688 @item cxx-max-namespaces-for-diagnostic-help
15689 The maximum number of namespaces to consult for suggestions when C++
15690 name lookup fails for an identifier.
15691
15692 @item sink-frequency-threshold
15693 The maximum relative execution frequency (in percents) of the target block
15694 relative to a statement's original block to allow statement sinking of a
15695 statement. Larger numbers result in more aggressive statement sinking.
15696 A small positive adjustment is applied for
15697 statements with memory operands as those are even more profitable so sink.
15698
15699 @item max-stores-to-sink
15700 The maximum number of conditional store pairs that can be sunk. Set to 0
15701 if either vectorization (@option{-ftree-vectorize}) or if-conversion
15702 (@option{-ftree-loop-if-convert}) is disabled.
15703
15704 @item case-values-threshold
15705 The smallest number of different values for which it is best to use a
15706 jump-table instead of a tree of conditional branches. If the value is
15707 0, use the default for the machine.
15708
15709 @item jump-table-max-growth-ratio-for-size
15710 The maximum code size growth ratio when expanding
15711 into a jump table (in percent). The parameter is used when
15712 optimizing for size.
15713
15714 @item jump-table-max-growth-ratio-for-speed
15715 The maximum code size growth ratio when expanding
15716 into a jump table (in percent). The parameter is used when
15717 optimizing for speed.
15718
15719 @item tree-reassoc-width
15720 Set the maximum number of instructions executed in parallel in
15721 reassociated tree. This parameter overrides target dependent
15722 heuristics used by default if has non zero value.
15723
15724 @item sched-pressure-algorithm
15725 Choose between the two available implementations of
15726 @option{-fsched-pressure}. Algorithm 1 is the original implementation
15727 and is the more likely to prevent instructions from being reordered.
15728 Algorithm 2 was designed to be a compromise between the relatively
15729 conservative approach taken by algorithm 1 and the rather aggressive
15730 approach taken by the default scheduler. It relies more heavily on
15731 having a regular register file and accurate register pressure classes.
15732 See @file{haifa-sched.cc} in the GCC sources for more details.
15733
15734 The default choice depends on the target.
15735
15736 @item max-slsr-cand-scan
15737 Set the maximum number of existing candidates that are considered when
15738 seeking a basis for a new straight-line strength reduction candidate.
15739
15740 @item asan-globals
15741 Enable buffer overflow detection for global objects. This kind
15742 of protection is enabled by default if you are using
15743 @option{-fsanitize=address} option.
15744 To disable global objects protection use @option{--param asan-globals=0}.
15745
15746 @item asan-stack
15747 Enable buffer overflow detection for stack objects. This kind of
15748 protection is enabled by default when using @option{-fsanitize=address}.
15749 To disable stack protection use @option{--param asan-stack=0} option.
15750
15751 @item asan-instrument-reads
15752 Enable buffer overflow detection for memory reads. This kind of
15753 protection is enabled by default when using @option{-fsanitize=address}.
15754 To disable memory reads protection use
15755 @option{--param asan-instrument-reads=0}.
15756
15757 @item asan-instrument-writes
15758 Enable buffer overflow detection for memory writes. This kind of
15759 protection is enabled by default when using @option{-fsanitize=address}.
15760 To disable memory writes protection use
15761 @option{--param asan-instrument-writes=0} option.
15762
15763 @item asan-memintrin
15764 Enable detection for built-in functions. This kind of protection
15765 is enabled by default when using @option{-fsanitize=address}.
15766 To disable built-in functions protection use
15767 @option{--param asan-memintrin=0}.
15768
15769 @item asan-use-after-return
15770 Enable detection of use-after-return. This kind of protection
15771 is enabled by default when using the @option{-fsanitize=address} option.
15772 To disable it use @option{--param asan-use-after-return=0}.
15773
15774 Note: By default the check is disabled at run time. To enable it,
15775 add @code{detect_stack_use_after_return=1} to the environment variable
15776 @env{ASAN_OPTIONS}.
15777
15778 @item asan-instrumentation-with-call-threshold
15779 If number of memory accesses in function being instrumented
15780 is greater or equal to this number, use callbacks instead of inline checks.
15781 E.g. to disable inline code use
15782 @option{--param asan-instrumentation-with-call-threshold=0}.
15783
15784 @item hwasan-instrument-stack
15785 Enable hwasan instrumentation of statically sized stack-allocated variables.
15786 This kind of instrumentation is enabled by default when using
15787 @option{-fsanitize=hwaddress} and disabled by default when using
15788 @option{-fsanitize=kernel-hwaddress}.
15789 To disable stack instrumentation use
15790 @option{--param hwasan-instrument-stack=0}, and to enable it use
15791 @option{--param hwasan-instrument-stack=1}.
15792
15793 @item hwasan-random-frame-tag
15794 When using stack instrumentation, decide tags for stack variables using a
15795 deterministic sequence beginning at a random tag for each frame. With this
15796 parameter unset tags are chosen using the same sequence but beginning from 1.
15797 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
15798 for @option{-fsanitize=kernel-hwaddress}.
15799 To disable it use @option{--param hwasan-random-frame-tag=0}.
15800
15801 @item hwasan-instrument-allocas
15802 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
15803 This kind of instrumentation is enabled by default when using
15804 @option{-fsanitize=hwaddress} and disabled by default when using
15805 @option{-fsanitize=kernel-hwaddress}.
15806 To disable instrumentation of such variables use
15807 @option{--param hwasan-instrument-allocas=0}, and to enable it use
15808 @option{--param hwasan-instrument-allocas=1}.
15809
15810 @item hwasan-instrument-reads
15811 Enable hwasan checks on memory reads. Instrumentation of reads is enabled by
15812 default for both @option{-fsanitize=hwaddress} and
15813 @option{-fsanitize=kernel-hwaddress}.
15814 To disable checking memory reads use
15815 @option{--param hwasan-instrument-reads=0}.
15816
15817 @item hwasan-instrument-writes
15818 Enable hwasan checks on memory writes. Instrumentation of writes is enabled by
15819 default for both @option{-fsanitize=hwaddress} and
15820 @option{-fsanitize=kernel-hwaddress}.
15821 To disable checking memory writes use
15822 @option{--param hwasan-instrument-writes=0}.
15823
15824 @item hwasan-instrument-mem-intrinsics
15825 Enable hwasan instrumentation of builtin functions. Instrumentation of these
15826 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
15827 and @option{-fsanitize=kernel-hwaddress}.
15828 To disable instrumentation of builtin functions use
15829 @option{--param hwasan-instrument-mem-intrinsics=0}.
15830
15831 @item use-after-scope-direct-emission-threshold
15832 If the size of a local variable in bytes is smaller or equal to this
15833 number, directly poison (or unpoison) shadow memory instead of using
15834 run-time callbacks.
15835
15836 @item tsan-distinguish-volatile
15837 Emit special instrumentation for accesses to volatiles.
15838
15839 @item tsan-instrument-func-entry-exit
15840 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
15841
15842 @item max-fsm-thread-path-insns
15843 Maximum number of instructions to copy when duplicating blocks on a
15844 finite state automaton jump thread path.
15845
15846 @item threader-debug
15847 threader-debug=[none|all] Enables verbose dumping of the threader solver.
15848
15849 @item parloops-chunk-size
15850 Chunk size of omp schedule for loops parallelized by parloops.
15851
15852 @item parloops-schedule
15853 Schedule type of omp schedule for loops parallelized by parloops (static,
15854 dynamic, guided, auto, runtime).
15855
15856 @item parloops-min-per-thread
15857 The minimum number of iterations per thread of an innermost parallelized
15858 loop for which the parallelized variant is preferred over the single threaded
15859 one. Note that for a parallelized loop nest the
15860 minimum number of iterations of the outermost loop per thread is two.
15861
15862 @item max-ssa-name-query-depth
15863 Maximum depth of recursion when querying properties of SSA names in things
15864 like fold routines. One level of recursion corresponds to following a
15865 use-def chain.
15866
15867 @item max-speculative-devirt-maydefs
15868 The maximum number of may-defs we analyze when looking for a must-def
15869 specifying the dynamic type of an object that invokes a virtual call
15870 we may be able to devirtualize speculatively.
15871
15872 @item evrp-sparse-threshold
15873 Maximum number of basic blocks before EVRP uses a sparse cache.
15874
15875 @item ranger-debug
15876 Specifies the type of debug output to be issued for ranges.
15877
15878 @item evrp-switch-limit
15879 Specifies the maximum number of switch cases before EVRP ignores a switch.
15880
15881 @item unroll-jam-min-percent
15882 The minimum percentage of memory references that must be optimized
15883 away for the unroll-and-jam transformation to be considered profitable.
15884
15885 @item unroll-jam-max-unroll
15886 The maximum number of times the outer loop should be unrolled by
15887 the unroll-and-jam transformation.
15888
15889 @item max-rtl-if-conversion-unpredictable-cost
15890 Maximum permissible cost for the sequence that would be generated
15891 by the RTL if-conversion pass for a branch that is considered unpredictable.
15892
15893 @item max-variable-expansions-in-unroller
15894 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
15895 of times that an individual variable will be expanded during loop unrolling.
15896
15897 @item partial-inlining-entry-probability
15898 Maximum probability of the entry BB of split region
15899 (in percent relative to entry BB of the function)
15900 to make partial inlining happen.
15901
15902 @item max-tracked-strlens
15903 Maximum number of strings for which strlen optimization pass will
15904 track string lengths.
15905
15906 @item gcse-after-reload-partial-fraction
15907 The threshold ratio for performing partial redundancy
15908 elimination after reload.
15909
15910 @item gcse-after-reload-critical-fraction
15911 The threshold ratio of critical edges execution count that
15912 permit performing redundancy elimination after reload.
15913
15914 @item max-loop-header-insns
15915 The maximum number of insns in loop header duplicated
15916 by the copy loop headers pass.
15917
15918 @item vect-epilogues-nomask
15919 Enable loop epilogue vectorization using smaller vector size.
15920
15921 @item vect-partial-vector-usage
15922 Controls when the loop vectorizer considers using partial vector loads
15923 and stores as an alternative to falling back to scalar code. 0 stops
15924 the vectorizer from ever using partial vector loads and stores. 1 allows
15925 partial vector loads and stores if vectorization removes the need for the
15926 code to iterate. 2 allows partial vector loads and stores in all loops.
15927 The parameter only has an effect on targets that support partial
15928 vector loads and stores.
15929
15930 @item vect-inner-loop-cost-factor
15931 The maximum factor which the loop vectorizer applies to the cost of statements
15932 in an inner loop relative to the loop being vectorized. The factor applied
15933 is the maximum of the estimated number of iterations of the inner loop and
15934 this parameter. The default value of this parameter is 50.
15935
15936 @item vect-induction-float
15937 Enable loop vectorization of floating point inductions.
15938
15939 @item avoid-fma-max-bits
15940 Maximum number of bits for which we avoid creating FMAs.
15941
15942 @item sms-loop-average-count-threshold
15943 A threshold on the average loop count considered by the swing modulo scheduler.
15944
15945 @item sms-dfa-history
15946 The number of cycles the swing modulo scheduler considers when checking
15947 conflicts using DFA.
15948
15949 @item graphite-allow-codegen-errors
15950 Whether codegen errors should be ICEs when @option{-fchecking}.
15951
15952 @item sms-max-ii-factor
15953 A factor for tuning the upper bound that swing modulo scheduler
15954 uses for scheduling a loop.
15955
15956 @item lra-max-considered-reload-pseudos
15957 The max number of reload pseudos which are considered during
15958 spilling a non-reload pseudo.
15959
15960 @item max-pow-sqrt-depth
15961 Maximum depth of sqrt chains to use when synthesizing exponentiation
15962 by a real constant.
15963
15964 @item max-dse-active-local-stores
15965 Maximum number of active local stores in RTL dead store elimination.
15966
15967 @item asan-instrument-allocas
15968 Enable asan allocas/VLAs protection.
15969
15970 @item max-iterations-computation-cost
15971 Bound on the cost of an expression to compute the number of iterations.
15972
15973 @item max-isl-operations
15974 Maximum number of isl operations, 0 means unlimited.
15975
15976 @item graphite-max-arrays-per-scop
15977 Maximum number of arrays per scop.
15978
15979 @item max-vartrack-reverse-op-size
15980 Max. size of loc list for which reverse ops should be added.
15981
15982 @item fsm-scale-path-stmts
15983 Scale factor to apply to the number of statements in a threading path
15984 when comparing to the number of (scaled) blocks.
15985
15986 @item uninit-control-dep-attempts
15987 Maximum number of nested calls to search for control dependencies
15988 during uninitialized variable analysis.
15989
15990 @item fsm-scale-path-blocks
15991 Scale factor to apply to the number of blocks in a threading path
15992 when comparing to the number of (scaled) statements.
15993
15994 @item sched-autopref-queue-depth
15995 Hardware autoprefetcher scheduler model control flag.
15996 Number of lookahead cycles the model looks into; at '
15997 ' only enable instruction sorting heuristic.
15998
15999 @item loop-versioning-max-inner-insns
16000 The maximum number of instructions that an inner loop can have
16001 before the loop versioning pass considers it too big to copy.
16002
16003 @item loop-versioning-max-outer-insns
16004 The maximum number of instructions that an outer loop can have
16005 before the loop versioning pass considers it too big to copy,
16006 discounting any instructions in inner loops that directly benefit
16007 from versioning.
16008
16009 @item ssa-name-def-chain-limit
16010 The maximum number of SSA_NAME assignments to follow in determining
16011 a property of a variable such as its value. This limits the number
16012 of iterations or recursive calls GCC performs when optimizing certain
16013 statements or when determining their validity prior to issuing
16014 diagnostics.
16015
16016 @item store-merging-max-size
16017 Maximum size of a single store merging region in bytes.
16018
16019 @item hash-table-verification-limit
16020 The number of elements for which hash table verification is done
16021 for each searched element.
16022
16023 @item max-find-base-term-values
16024 Maximum number of VALUEs handled during a single find_base_term call.
16025
16026 @item analyzer-max-enodes-per-program-point
16027 The maximum number of exploded nodes per program point within
16028 the analyzer, before terminating analysis of that point.
16029
16030 @item analyzer-max-constraints
16031 The maximum number of constraints per state.
16032
16033 @item analyzer-min-snodes-for-call-summary
16034 The minimum number of supernodes within a function for the
16035 analyzer to consider summarizing its effects at call sites.
16036
16037 @item analyzer-max-enodes-for-full-dump
16038 The maximum depth of exploded nodes that should appear in a dot dump
16039 before switching to a less verbose format.
16040
16041 @item analyzer-max-recursion-depth
16042 The maximum number of times a callsite can appear in a call stack
16043 within the analyzer, before terminating analysis of a call that would
16044 recurse deeper.
16045
16046 @item analyzer-max-svalue-depth
16047 The maximum depth of a symbolic value, before approximating
16048 the value as unknown.
16049
16050 @item analyzer-max-infeasible-edges
16051 The maximum number of infeasible edges to reject before declaring
16052 a diagnostic as infeasible.
16053
16054 @item gimple-fe-computed-hot-bb-threshold
16055 The number of executions of a basic block which is considered hot.
16056 The parameter is used only in GIMPLE FE.
16057
16058 @item analyzer-bb-explosion-factor
16059 The maximum number of 'after supernode' exploded nodes within the analyzer
16060 per supernode, before terminating analysis.
16061
16062 @item ranger-logical-depth
16063 Maximum depth of logical expression evaluation ranger will look through
16064 when evaluating outgoing edge ranges.
16065
16066 @item relation-block-limit
16067 Maximum number of relations the oracle will register in a basic block.
16068
16069 @item min-pagesize
16070 Minimum page size for warning purposes.
16071
16072 @item openacc-kernels
16073 Specify mode of OpenACC `kernels' constructs handling.
16074 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16075 constructs are decomposed into parts, a sequence of compute
16076 constructs, each then handled individually.
16077 This is work in progress.
16078 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16079 constructs are handled by the @samp{parloops} pass, en bloc.
16080 This is the current default.
16081
16082 @item openacc-privatization
16083 Specify mode of OpenACC privatization diagnostics for
16084 @option{-fopt-info-omp-note} and applicable
16085 @option{-fdump-tree-*-details}.
16086 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16087 This is the current default.
16088 With @option{--param=openacc-privatization=noisy}, do diagnose.
16089
16090 @end table
16091
16092 The following choices of @var{name} are available on AArch64 targets:
16093
16094 @table @gcctabopt
16095 @item aarch64-sve-compare-costs
16096 When vectorizing for SVE, consider using ``unpacked'' vectors for
16097 smaller elements and use the cost model to pick the cheapest approach.
16098 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16099
16100 Using unpacked vectors includes storing smaller elements in larger
16101 containers and accessing elements with extending loads and truncating
16102 stores.
16103
16104 @item aarch64-float-recp-precision
16105 The number of Newton iterations for calculating the reciprocal for float type.
16106 The precision of division is proportional to this param when division
16107 approximation is enabled. The default value is 1.
16108
16109 @item aarch64-double-recp-precision
16110 The number of Newton iterations for calculating the reciprocal for double type.
16111 The precision of division is propotional to this param when division
16112 approximation is enabled. The default value is 2.
16113
16114 @item aarch64-autovec-preference
16115 Force an ISA selection strategy for auto-vectorization. Accepts values from
16116 0 to 4, inclusive.
16117 @table @samp
16118 @item 0
16119 Use the default heuristics.
16120 @item 1
16121 Use only Advanced SIMD for auto-vectorization.
16122 @item 2
16123 Use only SVE for auto-vectorization.
16124 @item 3
16125 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are
16126 deemed equal.
16127 @item 4
16128 Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal.
16129 @end table
16130 The default value is 0.
16131
16132 @item aarch64-loop-vect-issue-rate-niters
16133 The tuning for some AArch64 CPUs tries to take both latencies and issue
16134 rates into account when deciding whether a loop should be vectorized
16135 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16136 If this parameter is set to @var{n}, GCC will not use this heuristic
16137 for loops that are known to execute in fewer than @var{n} Advanced
16138 SIMD iterations.
16139
16140 @item aarch64-vect-unroll-limit
16141 The vectorizer will use available tuning information to determine whether it
16142 would be beneficial to unroll the main vectorized loop and by how much. This
16143 parameter set's the upper bound of how much the vectorizer will unroll the main
16144 loop. The default value is four.
16145
16146 @end table
16147
16148 The following choices of @var{name} are available on i386 and x86_64 targets:
16149
16150 @table @gcctabopt
16151 @item x86-stlf-window-ninsns
16152 Instructions number above which STFL stall penalty can be compensated.
16153
16154 @end table
16155
16156 @end table
16157
16158 @node Instrumentation Options
16159 @section Program Instrumentation Options
16160 @cindex instrumentation options
16161 @cindex program instrumentation options
16162 @cindex run-time error checking options
16163 @cindex profiling options
16164 @cindex options, program instrumentation
16165 @cindex options, run-time error checking
16166 @cindex options, profiling
16167
16168 GCC supports a number of command-line options that control adding
16169 run-time instrumentation to the code it normally generates.
16170 For example, one purpose of instrumentation is collect profiling
16171 statistics for use in finding program hot spots, code coverage
16172 analysis, or profile-guided optimizations.
16173 Another class of program instrumentation is adding run-time checking
16174 to detect programming errors like invalid pointer
16175 dereferences or out-of-bounds array accesses, as well as deliberately
16176 hostile attacks such as stack smashing or C++ vtable hijacking.
16177 There is also a general hook which can be used to implement other
16178 forms of tracing or function-level instrumentation for debug or
16179 program analysis purposes.
16180
16181 @table @gcctabopt
16182 @cindex @command{prof}
16183 @cindex @command{gprof}
16184 @item -p
16185 @itemx -pg
16186 @opindex p
16187 @opindex pg
16188 Generate extra code to write profile information suitable for the
16189 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16190 (for @option{-pg}). You must use this option when compiling
16191 the source files you want data about, and you must also use it when
16192 linking.
16193
16194 You can use the function attribute @code{no_instrument_function} to
16195 suppress profiling of individual functions when compiling with these options.
16196 @xref{Common Function Attributes}.
16197
16198 @item -fprofile-arcs
16199 @opindex fprofile-arcs
16200 Add code so that program flow @dfn{arcs} are instrumented. During
16201 execution the program records how many times each branch and call is
16202 executed and how many times it is taken or returns. On targets that support
16203 constructors with priority support, profiling properly handles constructors,
16204 destructors and C++ constructors (and destructors) of classes which are used
16205 as a type of a global variable.
16206
16207 When the compiled
16208 program exits it saves this data to a file called
16209 @file{@var{auxname}.gcda} for each source file. The data may be used for
16210 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16211 test coverage analysis (@option{-ftest-coverage}). Each object file's
16212 @var{auxname} is generated from the name of the output file, if
16213 explicitly specified and it is not the final executable, otherwise it is
16214 the basename of the source file. In both cases any suffix is removed
16215 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16216 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16217
16218 Note that if a command line directly links source files, the corresponding
16219 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16220 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16221 @file{binary-b.gcda} files.
16222
16223 @xref{Cross-profiling}.
16224
16225 @cindex @command{gcov}
16226 @item --coverage
16227 @opindex coverage
16228
16229 This option is used to compile and link code instrumented for coverage
16230 analysis. The option is a synonym for @option{-fprofile-arcs}
16231 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16232 linking). See the documentation for those options for more details.
16233
16234 @itemize
16235
16236 @item
16237 Compile the source files with @option{-fprofile-arcs} plus optimization
16238 and code generation options. For test coverage analysis, use the
16239 additional @option{-ftest-coverage} option. You do not need to profile
16240 every source file in a program.
16241
16242 @item
16243 Compile the source files additionally with @option{-fprofile-abs-path}
16244 to create absolute path names in the @file{.gcno} files. This allows
16245 @command{gcov} to find the correct sources in projects where compilations
16246 occur with different working directories.
16247
16248 @item
16249 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16250 (the latter implies the former).
16251
16252 @item
16253 Run the program on a representative workload to generate the arc profile
16254 information. This may be repeated any number of times. You can run
16255 concurrent instances of your program, and provided that the file system
16256 supports locking, the data files will be correctly updated. Unless
16257 a strict ISO C dialect option is in effect, @code{fork} calls are
16258 detected and correctly handled without double counting.
16259
16260 Moreover, an object file can be recompiled multiple times
16261 and the corresponding @file{.gcda} file merges as long as
16262 the source file and the compiler options are unchanged.
16263
16264 @item
16265 For profile-directed optimizations, compile the source files again with
16266 the same optimization and code generation options plus
16267 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16268 Control Optimization}).
16269
16270 @item
16271 For test coverage analysis, use @command{gcov} to produce human readable
16272 information from the @file{.gcno} and @file{.gcda} files. Refer to the
16273 @command{gcov} documentation for further information.
16274
16275 @end itemize
16276
16277 With @option{-fprofile-arcs}, for each function of your program GCC
16278 creates a program flow graph, then finds a spanning tree for the graph.
16279 Only arcs that are not on the spanning tree have to be instrumented: the
16280 compiler adds code to count the number of times that these arcs are
16281 executed. When an arc is the only exit or only entrance to a block, the
16282 instrumentation code can be added to the block; otherwise, a new basic
16283 block must be created to hold the instrumentation code.
16284
16285 @need 2000
16286 @item -ftest-coverage
16287 @opindex ftest-coverage
16288 Produce a notes file that the @command{gcov} code-coverage utility
16289 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16290 show program coverage. Each source file's note file is called
16291 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
16292 above for a description of @var{auxname} and instructions on how to
16293 generate test coverage data. Coverage data matches the source files
16294 more closely if you do not optimize.
16295
16296 @item -fprofile-abs-path
16297 @opindex fprofile-abs-path
16298 Automatically convert relative source file names to absolute path names
16299 in the @file{.gcno} files. This allows @command{gcov} to find the correct
16300 sources in projects where compilations occur with different working
16301 directories.
16302
16303 @item -fprofile-dir=@var{path}
16304 @opindex fprofile-dir
16305
16306 Set the directory to search for the profile data files in to @var{path}.
16307 This option affects only the profile data generated by
16308 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16309 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16310 and its related options. Both absolute and relative paths can be used.
16311 By default, GCC uses the current directory as @var{path}, thus the
16312 profile data file appears in the same directory as the object file.
16313 In order to prevent the file name clashing, if the object file name is
16314 not an absolute path, we mangle the absolute path of the
16315 @file{@var{sourcename}.gcda} file and use it as the file name of a
16316 @file{.gcda} file. See details about the file naming in @option{-fprofile-arcs}.
16317 See similar option @option{-fprofile-note}.
16318
16319 When an executable is run in a massive parallel environment, it is recommended
16320 to save profile to different folders. That can be done with variables
16321 in @var{path} that are exported during run-time:
16322
16323 @table @gcctabopt
16324
16325 @item %p
16326 process ID.
16327
16328 @item %q@{VAR@}
16329 value of environment variable @var{VAR}
16330
16331 @end table
16332
16333 @item -fprofile-generate
16334 @itemx -fprofile-generate=@var{path}
16335 @opindex fprofile-generate
16336
16337 Enable options usually used for instrumenting application to produce
16338 profile useful for later recompilation with profile feedback based
16339 optimization. You must use @option{-fprofile-generate} both when
16340 compiling and when linking your program.
16341
16342 The following options are enabled:
16343 @option{-fprofile-arcs}, @option{-fprofile-values},
16344 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16345
16346 If @var{path} is specified, GCC looks at the @var{path} to find
16347 the profile feedback data files. See @option{-fprofile-dir}.
16348
16349 To optimize the program based on the collected profile information, use
16350 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
16351
16352 @item -fprofile-info-section
16353 @itemx -fprofile-info-section=@var{name}
16354 @opindex fprofile-info-section
16355
16356 Register the profile information in the specified section instead of using a
16357 constructor/destructor. The section name is @var{name} if it is specified,
16358 otherwise the section name defaults to @code{.gcov_info}. A pointer to the
16359 profile information generated by @option{-fprofile-arcs} is placed in the
16360 specified section for each translation unit. This option disables the profile
16361 information registration through a constructor and it disables the profile
16362 information processing through a destructor. This option is not intended to be
16363 used in hosted environments such as GNU/Linux. It targets freestanding
16364 environments (for example embedded systems) with limited resources which do not
16365 support constructors/destructors or the C library file I/O.
16366
16367 The linker could collect the input sections in a continuous memory block and
16368 define start and end symbols. A GNU linker script example which defines a
16369 linker output section follows:
16370
16371 @smallexample
16372 .gcov_info :
16373 @{
16374 PROVIDE (__gcov_info_start = .);
16375 KEEP (*(.gcov_info))
16376 PROVIDE (__gcov_info_end = .);
16377 @}
16378 @end smallexample
16379
16380 The program could dump the profiling information registered in this linker set
16381 for example like this:
16382
16383 @smallexample
16384 #include <gcov.h>
16385 #include <stdio.h>
16386 #include <stdlib.h>
16387
16388 extern const struct gcov_info *const __gcov_info_start[];
16389 extern const struct gcov_info *const __gcov_info_end[];
16390
16391 static void
16392 dump (const void *d, unsigned n, void *arg)
16393 @{
16394 const unsigned char *c = d;
16395
16396 for (unsigned i = 0; i < n; ++i)
16397 printf ("%02x", c[i]);
16398 @}
16399
16400 static void
16401 filename (const char *f, void *arg)
16402 @{
16403 __gcov_filename_to_gcfn (f, dump, arg );
16404 @}
16405
16406 static void *
16407 allocate (unsigned length, void *arg)
16408 @{
16409 return malloc (length);
16410 @}
16411
16412 static void
16413 dump_gcov_info (void)
16414 @{
16415 const struct gcov_info *const *info = __gcov_info_start;
16416 const struct gcov_info *const *end = __gcov_info_end;
16417
16418 /* Obfuscate variable to prevent compiler optimizations. */
16419 __asm__ ("" : "+r" (info));
16420
16421 while (info != end)
16422 @{
16423 void *arg = NULL;
16424 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16425 putchar ('\n');
16426 ++info;
16427 @}
16428 @}
16429
16430 int
16431 main (void)
16432 @{
16433 dump_gcov_info ();
16434 return 0;
16435 @}
16436 @end smallexample
16437
16438 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16439 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16440 @code{__gcov_info_to_gcda} functions and merge the profile information into
16441 @file{.gcda} files on the host filesystem.
16442
16443 @item -fprofile-note=@var{path}
16444 @opindex fprofile-note
16445
16446 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16447 location. If you combine the option with multiple source files,
16448 the @file{.gcno} file will be overwritten.
16449
16450 @item -fprofile-prefix-path=@var{path}
16451 @opindex fprofile-prefix-path
16452
16453 This option can be used in combination with
16454 @option{profile-generate=}@var{profile_dir} and
16455 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16456 directory of built source tree. By default @var{profile_dir} will contain
16457 files with mangled absolute paths of all object files in the built project.
16458 This is not desirable when directory used to build the instrumented binary
16459 differs from the directory used to build the binary optimized with profile
16460 feedback because the profile data will not be found during the optimized build.
16461 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16462 pointing to the base directory of the build can be used to strip the irrelevant
16463 part of the path and keep all file names relative to the main build directory.
16464
16465 @item -fprofile-prefix-map=@var{old}=@var{new}
16466 @opindex fprofile-prefix-map
16467 When compiling files residing in directory @file{@var{old}}, record
16468 profiling information (with @option{--coverage})
16469 describing them as if the files resided in
16470 directory @file{@var{new}} instead.
16471 See also @option{-ffile-prefix-map}.
16472
16473 @item -fprofile-update=@var{method}
16474 @opindex fprofile-update
16475
16476 Alter the update method for an application instrumented for profile
16477 feedback based optimization. The @var{method} argument should be one of
16478 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16479 The first one is useful for single-threaded applications,
16480 while the second one prevents profile corruption by emitting thread-safe code.
16481
16482 @strong{Warning:} When an application does not properly join all threads
16483 (or creates an detached thread), a profile file can be still corrupted.
16484
16485 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16486 when supported by a target, or to @samp{single} otherwise. The GCC driver
16487 automatically selects @samp{prefer-atomic} when @option{-pthread}
16488 is present in the command line.
16489
16490 @item -fprofile-filter-files=@var{regex}
16491 @opindex fprofile-filter-files
16492
16493 Instrument only functions from files whose name matches
16494 any of the regular expressions (separated by semi-colons).
16495
16496 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16497 only @file{main.c} and all C files starting with 'module'.
16498
16499 @item -fprofile-exclude-files=@var{regex}
16500 @opindex fprofile-exclude-files
16501
16502 Instrument only functions from files whose name does not match
16503 any of the regular expressions (separated by semi-colons).
16504
16505 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16506 of all files that are located in the @file{/usr/} folder.
16507
16508 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16509 @opindex fprofile-reproducible
16510 Control level of reproducibility of profile gathered by
16511 @code{-fprofile-generate}. This makes it possible to rebuild program
16512 with same outcome which is useful, for example, for distribution
16513 packages.
16514
16515 With @option{-fprofile-reproducible=serial} the profile gathered by
16516 @option{-fprofile-generate} is reproducible provided the trained program
16517 behaves the same at each invocation of the train run, it is not
16518 multi-threaded and profile data streaming is always done in the same
16519 order. Note that profile streaming happens at the end of program run but
16520 also before @code{fork} function is invoked.
16521
16522 Note that it is quite common that execution counts of some part of
16523 programs depends, for example, on length of temporary file names or
16524 memory space randomization (that may affect hash-table collision rate).
16525 Such non-reproducible part of programs may be annotated by
16526 @code{no_instrument_function} function attribute. @command{gcov-dump} with
16527 @option{-l} can be used to dump gathered data and verify that they are
16528 indeed reproducible.
16529
16530 With @option{-fprofile-reproducible=parallel-runs} collected profile
16531 stays reproducible regardless the order of streaming of the data into
16532 gcda files. This setting makes it possible to run multiple instances of
16533 instrumented program in parallel (such as with @code{make -j}). This
16534 reduces quality of gathered data, in particular of indirect call
16535 profiling.
16536
16537 @item -fsanitize=address
16538 @opindex fsanitize=address
16539 Enable AddressSanitizer, a fast memory error detector.
16540 Memory access instructions are instrumented to detect
16541 out-of-bounds and use-after-free bugs.
16542 The option enables @option{-fsanitize-address-use-after-scope}.
16543 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
16544 more details. The run-time behavior can be influenced using the
16545 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
16546 the available options are shown at startup of the instrumented program. See
16547 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
16548 for a list of supported options.
16549 The option cannot be combined with @option{-fsanitize=thread} or
16550 @option{-fsanitize=hwaddress}. Note that the only target
16551 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
16552
16553 To get more accurate stack traces, it is possible to use options such as
16554 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
16555 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
16556 optimizing sibling and tail recursive calls; this option is implicit for
16557 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
16558 disables Identical Code Folding for functions). Since multiple runs of the
16559 program may yield backtraces with different addresses due to ASLR (Address
16560 Space Layout Randomization), it may be desirable to turn ASLR off. On Linux,
16561 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
16562
16563 @item -fsanitize=kernel-address
16564 @opindex fsanitize=kernel-address
16565 Enable AddressSanitizer for Linux kernel.
16566 See @uref{https://github.com/google/kasan} for more details.
16567
16568 @item -fsanitize=hwaddress
16569 @opindex fsanitize=hwaddress
16570 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
16571 ignore the top byte of a pointer to allow the detection of memory errors with
16572 a low memory overhead.
16573 Memory access instructions are instrumented to detect out-of-bounds and
16574 use-after-free bugs.
16575 The option enables @option{-fsanitize-address-use-after-scope}.
16576 See
16577 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
16578 for more details. The run-time behavior can be influenced using the
16579 @env{HWASAN_OPTIONS} environment variable. When set to @code{help=1},
16580 the available options are shown at startup of the instrumented program.
16581 The option cannot be combined with @option{-fsanitize=thread} or
16582 @option{-fsanitize=address}, and is currently only available on AArch64.
16583
16584 @item -fsanitize=kernel-hwaddress
16585 @opindex fsanitize=kernel-hwaddress
16586 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
16587 Similar to @option{-fsanitize=kernel-address} but using an alternate
16588 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
16589 instrumentation differences necessary for compiling the Linux kernel.
16590 These differences are to avoid hwasan library initialization calls and to
16591 account for the stack pointer having a different value in its top byte.
16592
16593 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
16594 Instrumenting the stack and alloca calls are not on by default but are still
16595 possible by specifying the command-line options
16596 @option{--param hwasan-instrument-stack=1} and
16597 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
16598 tag is not implemented for kernel instrumentation.
16599
16600 @item -fsanitize=pointer-compare
16601 @opindex fsanitize=pointer-compare
16602 Instrument comparison operation (<, <=, >, >=) with pointer operands.
16603 The option must be combined with either @option{-fsanitize=kernel-address} or
16604 @option{-fsanitize=address}
16605 The option cannot be combined with @option{-fsanitize=thread}.
16606 Note: By default the check is disabled at run time. To enable it,
16607 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16608 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16609 invalid operation only when both pointers are non-null.
16610
16611 @item -fsanitize=pointer-subtract
16612 @opindex fsanitize=pointer-subtract
16613 Instrument subtraction with pointer operands.
16614 The option must be combined with either @option{-fsanitize=kernel-address} or
16615 @option{-fsanitize=address}
16616 The option cannot be combined with @option{-fsanitize=thread}.
16617 Note: By default the check is disabled at run time. To enable it,
16618 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16619 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16620 invalid operation only when both pointers are non-null.
16621
16622 @item -fsanitize=shadow-call-stack
16623 @opindex fsanitize=shadow-call-stack
16624 Enable ShadowCallStack, a security enhancement mechanism used to protect
16625 programs against return address overwrites (e.g. stack buffer overflows.)
16626 It works by saving a function's return address to a separately allocated
16627 shadow call stack in the function prologue and restoring the return address
16628 from the shadow call stack in the function epilogue. Instrumentation only
16629 occurs in functions that need to save the return address to the stack.
16630
16631 Currently it only supports the aarch64 platform. It is specifically
16632 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
16633 For the user space programs, runtime support is not currently provided
16634 in libc and libgcc. Users who want to use this feature in user space need
16635 to provide their own support for the runtime. It should be noted that
16636 this may cause the ABI rules to be broken.
16637
16638 On aarch64, the instrumentation makes use of the platform register @code{x18}.
16639 This generally means that any code that may run on the same thread as code
16640 compiled with ShadowCallStack must be compiled with the flag
16641 @option{-ffixed-x18}, otherwise functions compiled without
16642 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
16643 stack pointer.
16644
16645 Also, because there is no userspace runtime support, code compiled with
16646 ShadowCallStack cannot use exception handling. Use @option{-fno-exceptions}
16647 to turn off exceptions.
16648
16649 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
16650 details.
16651
16652 @item -fsanitize=thread
16653 @opindex fsanitize=thread
16654 Enable ThreadSanitizer, a fast data race detector.
16655 Memory access instructions are instrumented to detect
16656 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
16657 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
16658 environment variable; see
16659 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
16660 supported options.
16661 The option cannot be combined with @option{-fsanitize=address},
16662 @option{-fsanitize=leak}.
16663
16664 Note that sanitized atomic builtins cannot throw exceptions when
16665 operating on invalid memory addresses with non-call exceptions
16666 (@option{-fnon-call-exceptions}).
16667
16668 @item -fsanitize=leak
16669 @opindex fsanitize=leak
16670 Enable LeakSanitizer, a memory leak detector.
16671 This option only matters for linking of executables and
16672 the executable is linked against a library that overrides @code{malloc}
16673 and other allocator functions. See
16674 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
16675 details. The run-time behavior can be influenced using the
16676 @env{LSAN_OPTIONS} environment variable.
16677 The option cannot be combined with @option{-fsanitize=thread}.
16678
16679 @item -fsanitize=undefined
16680 @opindex fsanitize=undefined
16681 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
16682 Various computations are instrumented to detect undefined behavior
16683 at runtime. See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details. The run-time behavior can be influenced using the
16684 @env{UBSAN_OPTIONS} environment variable. Current suboptions are:
16685
16686 @table @gcctabopt
16687
16688 @item -fsanitize=shift
16689 @opindex fsanitize=shift
16690 This option enables checking that the result of a shift operation is
16691 not undefined. Note that what exactly is considered undefined differs
16692 slightly between C and C++, as well as between ISO C90 and C99, etc.
16693 This option has two suboptions, @option{-fsanitize=shift-base} and
16694 @option{-fsanitize=shift-exponent}.
16695
16696 @item -fsanitize=shift-exponent
16697 @opindex fsanitize=shift-exponent
16698 This option enables checking that the second argument of a shift operation
16699 is not negative and is smaller than the precision of the promoted first
16700 argument.
16701
16702 @item -fsanitize=shift-base
16703 @opindex fsanitize=shift-base
16704 If the second argument of a shift operation is within range, check that the
16705 result of a shift operation is not undefined. Note that what exactly is
16706 considered undefined differs slightly between C and C++, as well as between
16707 ISO C90 and C99, etc.
16708
16709 @item -fsanitize=integer-divide-by-zero
16710 @opindex fsanitize=integer-divide-by-zero
16711 Detect integer division by zero.
16712
16713 @item -fsanitize=unreachable
16714 @opindex fsanitize=unreachable
16715 With this option, the compiler turns the @code{__builtin_unreachable}
16716 call into a diagnostics message call instead. When reaching the
16717 @code{__builtin_unreachable} call, the behavior is undefined.
16718
16719 @item -fsanitize=vla-bound
16720 @opindex fsanitize=vla-bound
16721 This option instructs the compiler to check that the size of a variable
16722 length array is positive.
16723
16724 @item -fsanitize=null
16725 @opindex fsanitize=null
16726 This option enables pointer checking. Particularly, the application
16727 built with this option turned on will issue an error message when it
16728 tries to dereference a NULL pointer, or if a reference (possibly an
16729 rvalue reference) is bound to a NULL pointer, or if a method is invoked
16730 on an object pointed by a NULL pointer.
16731
16732 @item -fsanitize=return
16733 @opindex fsanitize=return
16734 This option enables return statement checking. Programs
16735 built with this option turned on will issue an error message
16736 when the end of a non-void function is reached without actually
16737 returning a value. This option works in C++ only.
16738
16739 @item -fsanitize=signed-integer-overflow
16740 @opindex fsanitize=signed-integer-overflow
16741 This option enables signed integer overflow checking. We check that
16742 the result of @code{+}, @code{*}, and both unary and binary @code{-}
16743 does not overflow in the signed arithmetics. This also detects
16744 @code{INT_MIN / -1} signed division. Note, integer promotion
16745 rules must be taken into account. That is, the following is not an
16746 overflow:
16747 @smallexample
16748 signed char a = SCHAR_MAX;
16749 a++;
16750 @end smallexample
16751
16752 @item -fsanitize=bounds
16753 @opindex fsanitize=bounds
16754 This option enables instrumentation of array bounds. Various out of bounds
16755 accesses are detected. Flexible array members, flexible array member-like
16756 arrays, and initializers of variables with static storage are not instrumented.
16757
16758 @item -fsanitize=bounds-strict
16759 @opindex fsanitize=bounds-strict
16760 This option enables strict instrumentation of array bounds. Most out of bounds
16761 accesses are detected, including flexible array members and flexible array
16762 member-like arrays. Initializers of variables with static storage are not
16763 instrumented.
16764
16765 @item -fsanitize=alignment
16766 @opindex fsanitize=alignment
16767
16768 This option enables checking of alignment of pointers when they are
16769 dereferenced, or when a reference is bound to insufficiently aligned target,
16770 or when a method or constructor is invoked on insufficiently aligned object.
16771
16772 @item -fsanitize=object-size
16773 @opindex fsanitize=object-size
16774 This option enables instrumentation of memory references using the
16775 @code{__builtin_dynamic_object_size} function. Various out of bounds
16776 pointer accesses are detected.
16777
16778 @item -fsanitize=float-divide-by-zero
16779 @opindex fsanitize=float-divide-by-zero
16780 Detect floating-point division by zero. Unlike other similar options,
16781 @option{-fsanitize=float-divide-by-zero} is not enabled by
16782 @option{-fsanitize=undefined}, since floating-point division by zero can
16783 be a legitimate way of obtaining infinities and NaNs.
16784
16785 @item -fsanitize=float-cast-overflow
16786 @opindex fsanitize=float-cast-overflow
16787 This option enables floating-point type to integer conversion checking.
16788 We check that the result of the conversion does not overflow.
16789 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
16790 not enabled by @option{-fsanitize=undefined}.
16791 This option does not work well with @code{FE_INVALID} exceptions enabled.
16792
16793 @item -fsanitize=nonnull-attribute
16794 @opindex fsanitize=nonnull-attribute
16795
16796 This option enables instrumentation of calls, checking whether null values
16797 are not passed to arguments marked as requiring a non-null value by the
16798 @code{nonnull} function attribute.
16799
16800 @item -fsanitize=returns-nonnull-attribute
16801 @opindex fsanitize=returns-nonnull-attribute
16802
16803 This option enables instrumentation of return statements in functions
16804 marked with @code{returns_nonnull} function attribute, to detect returning
16805 of null values from such functions.
16806
16807 @item -fsanitize=bool
16808 @opindex fsanitize=bool
16809
16810 This option enables instrumentation of loads from bool. If a value other
16811 than 0/1 is loaded, a run-time error is issued.
16812
16813 @item -fsanitize=enum
16814 @opindex fsanitize=enum
16815
16816 This option enables instrumentation of loads from an enum type. If
16817 a value outside the range of values for the enum type is loaded,
16818 a run-time error is issued.
16819
16820 @item -fsanitize=vptr
16821 @opindex fsanitize=vptr
16822
16823 This option enables instrumentation of C++ member function calls, member
16824 accesses and some conversions between pointers to base and derived classes,
16825 to verify the referenced object has the correct dynamic type.
16826
16827 @item -fsanitize=pointer-overflow
16828 @opindex fsanitize=pointer-overflow
16829
16830 This option enables instrumentation of pointer arithmetics. If the pointer
16831 arithmetics overflows, a run-time error is issued.
16832
16833 @item -fsanitize=builtin
16834 @opindex fsanitize=builtin
16835
16836 This option enables instrumentation of arguments to selected builtin
16837 functions. If an invalid value is passed to such arguments, a run-time
16838 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
16839 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
16840 by this option.
16841
16842 @end table
16843
16844 Note that sanitizers tend to increase the rate of false positive
16845 warnings, most notably those around @option{-Wmaybe-uninitialized}.
16846 We recommend against combining @option{-Werror} and [the use of]
16847 sanitizers.
16848
16849 While @option{-ftrapv} causes traps for signed overflows to be emitted,
16850 @option{-fsanitize=undefined} gives a diagnostic message.
16851 This currently works only for the C family of languages.
16852
16853 @item -fno-sanitize=all
16854 @opindex fno-sanitize=all
16855
16856 This option disables all previously enabled sanitizers.
16857 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
16858 together.
16859
16860 @item -fasan-shadow-offset=@var{number}
16861 @opindex fasan-shadow-offset
16862 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
16863 It is useful for experimenting with different shadow memory layouts in
16864 Kernel AddressSanitizer.
16865
16866 @item -fsanitize-sections=@var{s1},@var{s2},...
16867 @opindex fsanitize-sections
16868 Sanitize global variables in selected user-defined sections. @var{si} may
16869 contain wildcards.
16870
16871 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
16872 @opindex fsanitize-recover
16873 @opindex fno-sanitize-recover
16874 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
16875 mentioned in comma-separated list of @var{opts}. Enabling this option
16876 for a sanitizer component causes it to attempt to continue
16877 running the program as if no error happened. This means multiple
16878 runtime errors can be reported in a single program run, and the exit
16879 code of the program may indicate success even when errors
16880 have been reported. The @option{-fno-sanitize-recover=} option
16881 can be used to alter
16882 this behavior: only the first detected error is reported
16883 and program then exits with a non-zero exit code.
16884
16885 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
16886 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
16887 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
16888 @option{-fsanitize=bounds-strict},
16889 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
16890 For these sanitizers error recovery is turned on by default,
16891 except @option{-fsanitize=address}, for which this feature is experimental.
16892 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
16893 accepted, the former enables recovery for all sanitizers that support it,
16894 the latter disables recovery for all sanitizers that support it.
16895
16896 Even if a recovery mode is turned on the compiler side, it needs to be also
16897 enabled on the runtime library side, otherwise the failures are still fatal.
16898 The runtime library defaults to @code{halt_on_error=0} for
16899 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
16900 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
16901 setting the @code{halt_on_error} flag in the corresponding environment variable.
16902
16903 Syntax without an explicit @var{opts} parameter is deprecated. It is
16904 equivalent to specifying an @var{opts} list of:
16905
16906 @smallexample
16907 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
16908 @end smallexample
16909
16910 @item -fsanitize-address-use-after-scope
16911 @opindex fsanitize-address-use-after-scope
16912 Enable sanitization of local variables to detect use-after-scope bugs.
16913 The option sets @option{-fstack-reuse} to @samp{none}.
16914
16915 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
16916 @opindex fsanitize-trap
16917 @opindex fno-sanitize-trap
16918 The @option{-fsanitize-trap=} option instructs the compiler to
16919 report for sanitizers mentioned in comma-separated list of @var{opts}
16920 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
16921 library routine. If this option is enabled for certain sanitizer,
16922 it takes precedence over the @option{-fsanitizer-recover=} for that
16923 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
16924 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
16925
16926 The advantage of this is that the @code{libubsan} library is not needed
16927 and is not linked in, so this is usable even in freestanding environments.
16928
16929 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
16930 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
16931 @option{-fsanitize=float-divide-by-zero} and
16932 @option{-fsanitize=bounds-strict}. @code{-fsanitize-trap=all} can be also
16933 specified, which enables it for @code{undefined} suboptions,
16934 @option{-fsanitize=float-cast-overflow},
16935 @option{-fsanitize=float-divide-by-zero} and
16936 @option{-fsanitize=bounds-strict}.
16937 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
16938 and @code{-fsanitize=vptr} is enabled on the command line, the
16939 instrumentation is silently ignored as the instrumentation always needs
16940 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
16941
16942 @item -fsanitize-undefined-trap-on-error
16943 @opindex fsanitize-undefined-trap-on-error
16944 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
16945 equivalent of @option{-fsanitize-trap=all}.
16946
16947 @item -fsanitize-coverage=trace-pc
16948 @opindex fsanitize-coverage=trace-pc
16949 Enable coverage-guided fuzzing code instrumentation.
16950 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
16951
16952 @item -fsanitize-coverage=trace-cmp
16953 @opindex fsanitize-coverage=trace-cmp
16954 Enable dataflow guided fuzzing code instrumentation.
16955 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
16956 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
16957 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
16958 variable or @code{__sanitizer_cov_trace_const_cmp1},
16959 @code{__sanitizer_cov_trace_const_cmp2},
16960 @code{__sanitizer_cov_trace_const_cmp4} or
16961 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
16962 operand constant, @code{__sanitizer_cov_trace_cmpf} or
16963 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
16964 @code{__sanitizer_cov_trace_switch} for switch statements.
16965
16966 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
16967 @opindex fcf-protection
16968 Enable code instrumentation of control-flow transfers to increase
16969 program security by checking that target addresses of control-flow
16970 transfer instructions (such as indirect function call, function return,
16971 indirect jump) are valid. This prevents diverting the flow of control
16972 to an unexpected target. This is intended to protect against such
16973 threats as Return-oriented Programming (ROP), and similarly
16974 call/jmp-oriented programming (COP/JOP).
16975
16976 The value @code{branch} tells the compiler to implement checking of
16977 validity of control-flow transfer at the point of indirect branch
16978 instructions, i.e.@: call/jmp instructions. The value @code{return}
16979 implements checking of validity at the point of returning from a
16980 function. The value @code{full} is an alias for specifying both
16981 @code{branch} and @code{return}. The value @code{none} turns off
16982 instrumentation.
16983
16984 The value @code{check} is used for the final link with link-time
16985 optimization (LTO). An error is issued if LTO object files are
16986 compiled with different @option{-fcf-protection} values. The
16987 value @code{check} is ignored at the compile time.
16988
16989 The macro @code{__CET__} is defined when @option{-fcf-protection} is
16990 used. The first bit of @code{__CET__} is set to 1 for the value
16991 @code{branch} and the second bit of @code{__CET__} is set to 1 for
16992 the @code{return}.
16993
16994 You can also use the @code{nocf_check} attribute to identify
16995 which functions and calls should be skipped from instrumentation
16996 (@pxref{Function Attributes}).
16997
16998 Currently the x86 GNU/Linux target provides an implementation based
16999 on Intel Control-flow Enforcement Technology (CET) which works for
17000 i686 processor or newer.
17001
17002 @item -fharden-compares
17003 @opindex fharden-compares
17004 For every logical test that survives gimple optimizations and is
17005 @emph{not} the condition in a conditional branch (for example,
17006 conditions tested for conditional moves, or to store in boolean
17007 variables), emit extra code to compute and verify the reversed
17008 condition, and to call @code{__builtin_trap} if the results do not
17009 match. Use with @samp{-fharden-conditional-branches} to cover all
17010 conditionals.
17011
17012 @item -fharden-conditional-branches
17013 @opindex fharden-conditional-branches
17014 For every non-vectorized conditional branch that survives gimple
17015 optimizations, emit extra code to compute and verify the reversed
17016 condition, and to call @code{__builtin_trap} if the result is
17017 unexpected. Use with @samp{-fharden-compares} to cover all
17018 conditionals.
17019
17020 @item -fstack-protector
17021 @opindex fstack-protector
17022 Emit extra code to check for buffer overflows, such as stack smashing
17023 attacks. This is done by adding a guard variable to functions with
17024 vulnerable objects. This includes functions that call @code{alloca}, and
17025 functions with buffers larger than or equal to 8 bytes. The guards are
17026 initialized when a function is entered and then checked when the function
17027 exits. If a guard check fails, an error message is printed and the program
17028 exits. Only variables that are actually allocated on the stack are
17029 considered, optimized away variables or variables allocated in registers
17030 don't count.
17031
17032 @item -fstack-protector-all
17033 @opindex fstack-protector-all
17034 Like @option{-fstack-protector} except that all functions are protected.
17035
17036 @item -fstack-protector-strong
17037 @opindex fstack-protector-strong
17038 Like @option{-fstack-protector} but includes additional functions to
17039 be protected --- those that have local array definitions, or have
17040 references to local frame addresses. Only variables that are actually
17041 allocated on the stack are considered, optimized away variables or variables
17042 allocated in registers don't count.
17043
17044 @item -fstack-protector-explicit
17045 @opindex fstack-protector-explicit
17046 Like @option{-fstack-protector} but only protects those functions which
17047 have the @code{stack_protect} attribute.
17048
17049 @item -fstack-check
17050 @opindex fstack-check
17051 Generate code to verify that you do not go beyond the boundary of the
17052 stack. You should specify this flag if you are running in an
17053 environment with multiple threads, but you only rarely need to specify it in
17054 a single-threaded environment since stack overflow is automatically
17055 detected on nearly all systems if there is only one stack.
17056
17057 Note that this switch does not actually cause checking to be done; the
17058 operating system or the language runtime must do that. The switch causes
17059 generation of code to ensure that they see the stack being extended.
17060
17061 You can additionally specify a string parameter: @samp{no} means no
17062 checking, @samp{generic} means force the use of old-style checking,
17063 @samp{specific} means use the best checking method and is equivalent
17064 to bare @option{-fstack-check}.
17065
17066 Old-style checking is a generic mechanism that requires no specific
17067 target support in the compiler but comes with the following drawbacks:
17068
17069 @enumerate
17070 @item
17071 Modified allocation strategy for large objects: they are always
17072 allocated dynamically if their size exceeds a fixed threshold. Note this
17073 may change the semantics of some code.
17074
17075 @item
17076 Fixed limit on the size of the static frame of functions: when it is
17077 topped by a particular function, stack checking is not reliable and
17078 a warning is issued by the compiler.
17079
17080 @item
17081 Inefficiency: because of both the modified allocation strategy and the
17082 generic implementation, code performance is hampered.
17083 @end enumerate
17084
17085 Note that old-style stack checking is also the fallback method for
17086 @samp{specific} if no target support has been added in the compiler.
17087
17088 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17089 and stack overflows. @samp{specific} is an excellent choice when compiling
17090 Ada code. It is not generally sufficient to protect against stack-clash
17091 attacks. To protect against those you want @samp{-fstack-clash-protection}.
17092
17093 @item -fstack-clash-protection
17094 @opindex fstack-clash-protection
17095 Generate code to prevent stack clash style attacks. When this option is
17096 enabled, the compiler will only allocate one page of stack space at a time
17097 and each page is accessed immediately after allocation. Thus, it prevents
17098 allocations from jumping over any stack guard page provided by the
17099 operating system.
17100
17101 Most targets do not fully support stack clash protection. However, on
17102 those targets @option{-fstack-clash-protection} will protect dynamic stack
17103 allocations. @option{-fstack-clash-protection} may also provide limited
17104 protection for static stack allocations if the target supports
17105 @option{-fstack-check=specific}.
17106
17107 @item -fstack-limit-register=@var{reg}
17108 @itemx -fstack-limit-symbol=@var{sym}
17109 @itemx -fno-stack-limit
17110 @opindex fstack-limit-register
17111 @opindex fstack-limit-symbol
17112 @opindex fno-stack-limit
17113 Generate code to ensure that the stack does not grow beyond a certain value,
17114 either the value of a register or the address of a symbol. If a larger
17115 stack is required, a signal is raised at run time. For most targets,
17116 the signal is raised before the stack overruns the boundary, so
17117 it is possible to catch the signal without taking special precautions.
17118
17119 For instance, if the stack starts at absolute address @samp{0x80000000}
17120 and grows downwards, you can use the flags
17121 @option{-fstack-limit-symbol=__stack_limit} and
17122 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17123 of 128KB@. Note that this may only work with the GNU linker.
17124
17125 You can locally override stack limit checking by using the
17126 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17127
17128 @item -fsplit-stack
17129 @opindex fsplit-stack
17130 Generate code to automatically split the stack before it overflows.
17131 The resulting program has a discontiguous stack which can only
17132 overflow if the program is unable to allocate any more memory. This
17133 is most useful when running threaded programs, as it is no longer
17134 necessary to calculate a good stack size to use for each thread. This
17135 is currently only implemented for the x86 targets running
17136 GNU/Linux.
17137
17138 When code compiled with @option{-fsplit-stack} calls code compiled
17139 without @option{-fsplit-stack}, there may not be much stack space
17140 available for the latter code to run. If compiling all code,
17141 including library code, with @option{-fsplit-stack} is not an option,
17142 then the linker can fix up these calls so that the code compiled
17143 without @option{-fsplit-stack} always has a large stack. Support for
17144 this is implemented in the gold linker in GNU binutils release 2.21
17145 and later.
17146
17147 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17148 @opindex fvtable-verify
17149 This option is only available when compiling C++ code.
17150 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17151 feature that verifies at run time, for every virtual call, that
17152 the vtable pointer through which the call is made is valid for the type of
17153 the object, and has not been corrupted or overwritten. If an invalid vtable
17154 pointer is detected at run time, an error is reported and execution of the
17155 program is immediately halted.
17156
17157 This option causes run-time data structures to be built at program startup,
17158 which are used for verifying the vtable pointers.
17159 The options @samp{std} and @samp{preinit}
17160 control the timing of when these data structures are built. In both cases the
17161 data structures are built before execution reaches @code{main}. Using
17162 @option{-fvtable-verify=std} causes the data structures to be built after
17163 shared libraries have been loaded and initialized.
17164 @option{-fvtable-verify=preinit} causes them to be built before shared
17165 libraries have been loaded and initialized.
17166
17167 If this option appears multiple times in the command line with different
17168 values specified, @samp{none} takes highest priority over both @samp{std} and
17169 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17170
17171 @item -fvtv-debug
17172 @opindex fvtv-debug
17173 When used in conjunction with @option{-fvtable-verify=std} or
17174 @option{-fvtable-verify=preinit}, causes debug versions of the
17175 runtime functions for the vtable verification feature to be called.
17176 This flag also causes the compiler to log information about which
17177 vtable pointers it finds for each class.
17178 This information is written to a file named @file{vtv_set_ptr_data.log}
17179 in the directory named by the environment variable @env{VTV_LOGS_DIR}
17180 if that is defined or the current working directory otherwise.
17181
17182 Note: This feature @emph{appends} data to the log file. If you want a fresh log
17183 file, be sure to delete any existing one.
17184
17185 @item -fvtv-counts
17186 @opindex fvtv-counts
17187 This is a debugging flag. When used in conjunction with
17188 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17189 causes the compiler to keep track of the total number of virtual calls
17190 it encounters and the number of verifications it inserts. It also
17191 counts the number of calls to certain run-time library functions
17192 that it inserts and logs this information for each compilation unit.
17193 The compiler writes this information to a file named
17194 @file{vtv_count_data.log} in the directory named by the environment
17195 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17196 directory otherwise. It also counts the size of the vtable pointer sets
17197 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17198 in the same directory.
17199
17200 Note: This feature @emph{appends} data to the log files. To get fresh log
17201 files, be sure to delete any existing ones.
17202
17203 @item -finstrument-functions
17204 @opindex finstrument-functions
17205 Generate instrumentation calls for entry and exit to functions. Just
17206 after function entry and just before function exit, the following
17207 profiling functions are called with the address of the current
17208 function and its call site. (On some platforms,
17209 @code{__builtin_return_address} does not work beyond the current
17210 function, so the call site information may not be available to the
17211 profiling functions otherwise.)
17212
17213 @smallexample
17214 void __cyg_profile_func_enter (void *this_fn,
17215 void *call_site);
17216 void __cyg_profile_func_exit (void *this_fn,
17217 void *call_site);
17218 @end smallexample
17219
17220 The first argument is the address of the start of the current function,
17221 which may be looked up exactly in the symbol table.
17222
17223 This instrumentation is also done for functions expanded inline in other
17224 functions. The profiling calls indicate where, conceptually, the
17225 inline function is entered and exited. This means that addressable
17226 versions of such functions must be available. If all your uses of a
17227 function are expanded inline, this may mean an additional expansion of
17228 code size. If you use @code{extern inline} in your C code, an
17229 addressable version of such functions must be provided. (This is
17230 normally the case anyway, but if you get lucky and the optimizer always
17231 expands the functions inline, you might have gotten away without
17232 providing static copies.)
17233
17234 A function may be given the attribute @code{no_instrument_function}, in
17235 which case this instrumentation is not done. This can be used, for
17236 example, for the profiling functions listed above, high-priority
17237 interrupt routines, and any functions from which the profiling functions
17238 cannot safely be called (perhaps signal handlers, if the profiling
17239 routines generate output or allocate memory).
17240 @xref{Common Function Attributes}.
17241
17242 @item -finstrument-functions-once
17243 @opindex finstrument-functions-once
17244 This is similar to @option{-finstrument-functions}, but the profiling
17245 functions are called only once per instrumented function, i.e. the first
17246 profiling function is called after the first entry into the instrumented
17247 function and the second profiling function is called before the exit
17248 corresponding to this first entry.
17249
17250 The definition of @code{once} for the purpose of this option is a little
17251 vague because the implementation is not protected against data races.
17252 As a result, the implementation only guarantees that the profiling
17253 functions are called at @emph{least} once per process and at @emph{most}
17254 once per thread, but the calls are always paired, that is to say, if a
17255 thread calls the first function, then it will call the second function,
17256 unless it never reaches the exit of the instrumented function.
17257
17258 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17259 @opindex finstrument-functions-exclude-file-list
17260
17261 Set the list of functions that are excluded from instrumentation (see
17262 the description of @option{-finstrument-functions}). If the file that
17263 contains a function definition matches with one of @var{file}, then
17264 that function is not instrumented. The match is done on substrings:
17265 if the @var{file} parameter is a substring of the file name, it is
17266 considered to be a match.
17267
17268 For example:
17269
17270 @smallexample
17271 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17272 @end smallexample
17273
17274 @noindent
17275 excludes any inline function defined in files whose pathnames
17276 contain @file{/bits/stl} or @file{include/sys}.
17277
17278 If, for some reason, you want to include letter @samp{,} in one of
17279 @var{sym}, write @samp{\,}. For example,
17280 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17281 (note the single quote surrounding the option).
17282
17283 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17284 @opindex finstrument-functions-exclude-function-list
17285
17286 This is similar to @option{-finstrument-functions-exclude-file-list},
17287 but this option sets the list of function names to be excluded from
17288 instrumentation. The function name to be matched is its user-visible
17289 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17290 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
17291 match is done on substrings: if the @var{sym} parameter is a substring
17292 of the function name, it is considered to be a match. For C99 and C++
17293 extended identifiers, the function name must be given in UTF-8, not
17294 using universal character names.
17295
17296 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17297 @opindex fpatchable-function-entry
17298 Generate @var{N} NOPs right at the beginning
17299 of each function, with the function entry point before the @var{M}th NOP.
17300 If @var{M} is omitted, it defaults to @code{0} so the
17301 function entry points to the address just at the first NOP.
17302 The NOP instructions reserve extra space which can be used to patch in
17303 any desired instrumentation at run time, provided that the code segment
17304 is writable. The amount of space is controllable indirectly via
17305 the number of NOPs; the NOP instruction used corresponds to the instruction
17306 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
17307 is target-specific and may also depend on the architecture variant and/or
17308 other compilation options.
17309
17310 For run-time identification, the starting addresses of these areas,
17311 which correspond to their respective function entries minus @var{M},
17312 are additionally collected in the @code{__patchable_function_entries}
17313 section of the resulting binary.
17314
17315 Note that the value of @code{__attribute__ ((patchable_function_entry
17316 (N,M)))} takes precedence over command-line option
17317 @option{-fpatchable-function-entry=N,M}. This can be used to increase
17318 the area size or to remove it completely on a single function.
17319 If @code{N=0}, no pad location is recorded.
17320
17321 The NOP instructions are inserted at---and maybe before, depending on
17322 @var{M}---the function entry address, even before the prologue. On
17323 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17324 the local entry point is this function entry address.
17325
17326 The maximum value of @var{N} and @var{M} is 65535. On PowerPC with the
17327 ELFv2 ABI, for a function with dual entry points, the supported values
17328 for @var{M} are 0, 2, 6 and 14.
17329 @end table
17330
17331
17332 @node Preprocessor Options
17333 @section Options Controlling the Preprocessor
17334 @cindex preprocessor options
17335 @cindex options, preprocessor
17336
17337 These options control the C preprocessor, which is run on each C source
17338 file before actual compilation.
17339
17340 If you use the @option{-E} option, nothing is done except preprocessing.
17341 Some of these options make sense only together with @option{-E} because
17342 they cause the preprocessor output to be unsuitable for actual
17343 compilation.
17344
17345 In addition to the options listed here, there are a number of options
17346 to control search paths for include files documented in
17347 @ref{Directory Options}.
17348 Options to control preprocessor diagnostics are listed in
17349 @ref{Warning Options}.
17350
17351 @table @gcctabopt
17352 @include cppopts.texi
17353
17354 @item -Wp,@var{option}
17355 @opindex Wp
17356 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17357 and pass @var{option} directly through to the preprocessor. If
17358 @var{option} contains commas, it is split into multiple options at the
17359 commas. However, many options are modified, translated or interpreted
17360 by the compiler driver before being passed to the preprocessor, and
17361 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
17362 interface is undocumented and subject to change, so whenever possible
17363 you should avoid using @option{-Wp} and let the driver handle the
17364 options instead.
17365
17366 @item -Xpreprocessor @var{option}
17367 @opindex Xpreprocessor
17368 Pass @var{option} as an option to the preprocessor. You can use this to
17369 supply system-specific preprocessor options that GCC does not
17370 recognize.
17371
17372 If you want to pass an option that takes an argument, you must use
17373 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17374
17375 @item -no-integrated-cpp
17376 @opindex no-integrated-cpp
17377 Perform preprocessing as a separate pass before compilation.
17378 By default, GCC performs preprocessing as an integrated part of
17379 input tokenization and parsing.
17380 If this option is provided, the appropriate language front end
17381 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17382 and Objective-C, respectively) is instead invoked twice,
17383 once for preprocessing only and once for actual compilation
17384 of the preprocessed input.
17385 This option may be useful in conjunction with the @option{-B} or
17386 @option{-wrapper} options to specify an alternate preprocessor or
17387 perform additional processing of the program source between
17388 normal preprocessing and compilation.
17389
17390 @item -flarge-source-files
17391 @opindex flarge-source-files
17392 Adjust GCC to expect large source files, at the expense of slower
17393 compilation and higher memory usage.
17394
17395 Specifically, GCC normally tracks both column numbers and line numbers
17396 within source files and it normally prints both of these numbers in
17397 diagnostics. However, once it has processed a certain number of source
17398 lines, it stops tracking column numbers and only tracks line numbers.
17399 This means that diagnostics for later lines do not include column numbers.
17400 It also means that options like @option{-Wmisleading-indentation} cease to work
17401 at that point, although the compiler prints a note if this happens.
17402 Passing @option{-flarge-source-files} significantly increases the number
17403 of source lines that GCC can process before it stops tracking columns.
17404
17405 @end table
17406
17407 @node Assembler Options
17408 @section Passing Options to the Assembler
17409
17410 @c prevent bad page break with this line
17411 You can pass options to the assembler.
17412
17413 @table @gcctabopt
17414 @item -Wa,@var{option}
17415 @opindex Wa
17416 Pass @var{option} as an option to the assembler. If @var{option}
17417 contains commas, it is split into multiple options at the commas.
17418
17419 @item -Xassembler @var{option}
17420 @opindex Xassembler
17421 Pass @var{option} as an option to the assembler. You can use this to
17422 supply system-specific assembler options that GCC does not
17423 recognize.
17424
17425 If you want to pass an option that takes an argument, you must use
17426 @option{-Xassembler} twice, once for the option and once for the argument.
17427
17428 @end table
17429
17430 @node Link Options
17431 @section Options for Linking
17432 @cindex link options
17433 @cindex options, linking
17434
17435 These options come into play when the compiler links object files into
17436 an executable output file. They are meaningless if the compiler is
17437 not doing a link step.
17438
17439 @table @gcctabopt
17440 @cindex file names
17441 @item @var{object-file-name}
17442 A file name that does not end in a special recognized suffix is
17443 considered to name an object file or library. (Object files are
17444 distinguished from libraries by the linker according to the file
17445 contents.) If linking is done, these object files are used as input
17446 to the linker.
17447
17448 @item -c
17449 @itemx -S
17450 @itemx -E
17451 @opindex c
17452 @opindex S
17453 @opindex E
17454 If any of these options is used, then the linker is not run, and
17455 object file names should not be used as arguments. @xref{Overall
17456 Options}.
17457
17458 @item -flinker-output=@var{type}
17459 @opindex flinker-output
17460 This option controls code generation of the link-time optimizer. By
17461 default the linker output is automatically determined by the linker
17462 plugin. For debugging the compiler and if incremental linking with a
17463 non-LTO object file is desired, it may be useful to control the type
17464 manually.
17465
17466 If @var{type} is @samp{exec}, code generation produces a static
17467 binary. In this case @option{-fpic} and @option{-fpie} are both
17468 disabled.
17469
17470 If @var{type} is @samp{dyn}, code generation produces a shared
17471 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
17472 but not enabled automatically. This allows to build shared libraries
17473 without position-independent code on architectures where this is
17474 possible, i.e.@: on x86.
17475
17476 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
17477 executable. This results in similar optimizations as @samp{exec}
17478 except that @option{-fpie} is not disabled if specified at compilation
17479 time.
17480
17481 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
17482 done. The sections containing intermediate code for link-time optimization are
17483 merged, pre-optimized, and output to the resulting object file. In addition, if
17484 @option{-ffat-lto-objects} is specified, binary code is produced for future
17485 non-LTO linking. The object file produced by incremental linking is smaller
17486 than a static library produced from the same object files. At link time the
17487 result of incremental linking also loads faster than a static
17488 library assuming that the majority of objects in the library are used.
17489
17490 Finally @samp{nolto-rel} configures the compiler for incremental linking where
17491 code generation is forced, a final binary is produced, and the intermediate
17492 code for later link-time optimization is stripped. When multiple object files
17493 are linked together the resulting code is better optimized than with
17494 link-time optimizations disabled (for example, cross-module inlining
17495 happens), but most of benefits of whole program optimizations are lost.
17496
17497 During the incremental link (by @option{-r}) the linker plugin defaults to
17498 @option{rel}. With current interfaces to GNU Binutils it is however not
17499 possible to incrementally link LTO objects and non-LTO objects into a single
17500 mixed object file. If any of object files in incremental link cannot
17501 be used for link-time optimization, the linker plugin issues a warning and
17502 uses @samp{nolto-rel}. To maintain whole program optimization, it is
17503 recommended to link such objects into static library instead. Alternatively it
17504 is possible to use H.J. Lu's binutils with support for mixed objects.
17505
17506 @item -fuse-ld=bfd
17507 @opindex fuse-ld=bfd
17508 Use the @command{bfd} linker instead of the default linker.
17509
17510 @item -fuse-ld=gold
17511 @opindex fuse-ld=gold
17512 Use the @command{gold} linker instead of the default linker.
17513
17514 @item -fuse-ld=lld
17515 @opindex fuse-ld=lld
17516 Use the LLVM @command{lld} linker instead of the default linker.
17517
17518 @item -fuse-ld=mold
17519 @opindex fuse-ld=mold
17520 Use the Modern Linker (@command{mold}) instead of the default linker.
17521
17522 @cindex Libraries
17523 @item -l@var{library}
17524 @itemx -l @var{library}
17525 @opindex l
17526 Search the library named @var{library} when linking. (The second
17527 alternative with the library as a separate argument is only for
17528 POSIX compliance and is not recommended.)
17529
17530 The @option{-l} option is passed directly to the linker by GCC. Refer
17531 to your linker documentation for exact details. The general
17532 description below applies to the GNU linker.
17533
17534 The linker searches a standard list of directories for the library.
17535 The directories searched include several standard system directories
17536 plus any that you specify with @option{-L}.
17537
17538 Static libraries are archives of object files, and have file names
17539 like @file{lib@var{library}.a}. Some targets also support shared
17540 libraries, which typically have names like @file{lib@var{library}.so}.
17541 If both static and shared libraries are found, the linker gives
17542 preference to linking with the shared library unless the
17543 @option{-static} option is used.
17544
17545 It makes a difference where in the command you write this option; the
17546 linker searches and processes libraries and object files in the order they
17547 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
17548 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
17549 to functions in @samp{z}, those functions may not be loaded.
17550
17551 @item -lobjc
17552 @opindex lobjc
17553 You need this special case of the @option{-l} option in order to
17554 link an Objective-C or Objective-C++ program.
17555
17556 @item -nostartfiles
17557 @opindex nostartfiles
17558 Do not use the standard system startup files when linking.
17559 The standard system libraries are used normally, unless @option{-nostdlib},
17560 @option{-nolibc}, or @option{-nodefaultlibs} is used.
17561
17562 @item -nodefaultlibs
17563 @opindex nodefaultlibs
17564 Do not use the standard system libraries when linking.
17565 Only the libraries you specify are passed to the linker, and options
17566 specifying linkage of the system libraries, such as @option{-static-libgcc}
17567 or @option{-shared-libgcc}, are ignored.
17568 The standard startup files are used normally, unless @option{-nostartfiles}
17569 is used.
17570
17571 The compiler may generate calls to @code{memcmp},
17572 @code{memset}, @code{memcpy} and @code{memmove}.
17573 These entries are usually resolved by entries in
17574 libc. These entry points should be supplied through some other
17575 mechanism when this option is specified.
17576
17577 @item -nolibc
17578 @opindex nolibc
17579 Do not use the C library or system libraries tightly coupled with it when
17580 linking. Still link with the startup files, @file{libgcc} or toolchain
17581 provided language support libraries such as @file{libgnat}, @file{libgfortran}
17582 or @file{libstdc++} unless options preventing their inclusion are used as
17583 well. This typically removes @option{-lc} from the link command line, as well
17584 as system libraries that normally go with it and become meaningless when
17585 absence of a C library is assumed, for example @option{-lpthread} or
17586 @option{-lm} in some configurations. This is intended for bare-board
17587 targets when there is indeed no C library available.
17588
17589 @item -nostdlib
17590 @opindex nostdlib
17591 Do not use the standard system startup files or libraries when linking.
17592 No startup files and only the libraries you specify are passed to
17593 the linker, and options specifying linkage of the system libraries, such as
17594 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
17595
17596 The compiler may generate calls to @code{memcmp}, @code{memset},
17597 @code{memcpy} and @code{memmove}.
17598 These entries are usually resolved by entries in
17599 libc. These entry points should be supplied through some other
17600 mechanism when this option is specified.
17601
17602 @cindex @option{-lgcc}, use with @option{-nostdlib}
17603 @cindex @option{-nostdlib} and unresolved references
17604 @cindex unresolved references and @option{-nostdlib}
17605 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
17606 @cindex @option{-nodefaultlibs} and unresolved references
17607 @cindex unresolved references and @option{-nodefaultlibs}
17608 One of the standard libraries bypassed by @option{-nostdlib} and
17609 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
17610 which GCC uses to overcome shortcomings of particular machines, or special
17611 needs for some languages.
17612 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
17613 Collection (GCC) Internals},
17614 for more discussion of @file{libgcc.a}.)
17615 In most cases, you need @file{libgcc.a} even when you want to avoid
17616 other standard libraries. In other words, when you specify @option{-nostdlib}
17617 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
17618 This ensures that you have no unresolved references to internal GCC
17619 library subroutines.
17620 (An example of such an internal subroutine is @code{__main}, used to ensure C++
17621 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
17622 GNU Compiler Collection (GCC) Internals}.)
17623
17624 @item -nostdlib++
17625 @opindex nostdlib++
17626 Do not implicitly link with standard C++ libraries.
17627
17628 @item -e @var{entry}
17629 @itemx --entry=@var{entry}
17630 @opindex e
17631 @opindex entry
17632
17633 Specify that the program entry point is @var{entry}. The argument is
17634 interpreted by the linker; the GNU linker accepts either a symbol name
17635 or an address.
17636
17637 @item -pie
17638 @opindex pie
17639 Produce a dynamically linked position independent executable on targets
17640 that support it. For predictable results, you must also specify the same
17641 set of options used for compilation (@option{-fpie}, @option{-fPIE},
17642 or model suboptions) when you specify this linker option.
17643
17644 @item -no-pie
17645 @opindex no-pie
17646 Don't produce a dynamically linked position independent executable.
17647
17648 @item -static-pie
17649 @opindex static-pie
17650 Produce a static position independent executable on targets that support
17651 it. A static position independent executable is similar to a static
17652 executable, but can be loaded at any address without a dynamic linker.
17653 For predictable results, you must also specify the same set of options
17654 used for compilation (@option{-fpie}, @option{-fPIE}, or model
17655 suboptions) when you specify this linker option.
17656
17657 @item -pthread
17658 @opindex pthread
17659 Link with the POSIX threads library. This option is supported on
17660 GNU/Linux targets, most other Unix derivatives, and also on
17661 x86 Cygwin and MinGW targets. On some targets this option also sets
17662 flags for the preprocessor, so it should be used consistently for both
17663 compilation and linking.
17664
17665 @item -r
17666 @opindex r
17667 Produce a relocatable object as output. This is also known as partial
17668 linking.
17669
17670 @item -rdynamic
17671 @opindex rdynamic
17672 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
17673 that support it. This instructs the linker to add all symbols, not
17674 only used ones, to the dynamic symbol table. This option is needed
17675 for some uses of @code{dlopen} or to allow obtaining backtraces
17676 from within a program.
17677
17678 @item -s
17679 @opindex s
17680 Remove all symbol table and relocation information from the executable.
17681
17682 @item -static
17683 @opindex static
17684 On systems that support dynamic linking, this overrides @option{-pie}
17685 and prevents linking with the shared libraries. On other systems, this
17686 option has no effect.
17687
17688 @item -shared
17689 @opindex shared
17690 Produce a shared object which can then be linked with other objects to
17691 form an executable. Not all systems support this option. For predictable
17692 results, you must also specify the same set of options used for compilation
17693 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
17694 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
17695 needs to build supplementary stub code for constructors to work. On
17696 multi-libbed systems, @samp{gcc -shared} must select the correct support
17697 libraries to link against. Failing to supply the correct flags may lead
17698 to subtle defects. Supplying them in cases where they are not necessary
17699 is innocuous. For x86, crtfastmath.o will not be added when
17700 @option{-shared} is specified. }
17701
17702 @item -shared-libgcc
17703 @itemx -static-libgcc
17704 @opindex shared-libgcc
17705 @opindex static-libgcc
17706 On systems that provide @file{libgcc} as a shared library, these options
17707 force the use of either the shared or static version, respectively.
17708 If no shared version of @file{libgcc} was built when the compiler was
17709 configured, these options have no effect.
17710
17711 There are several situations in which an application should use the
17712 shared @file{libgcc} instead of the static version. The most common
17713 of these is when the application wishes to throw and catch exceptions
17714 across different shared libraries. In that case, each of the libraries
17715 as well as the application itself should use the shared @file{libgcc}.
17716
17717 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
17718 whenever you build a shared library or a main executable, because C++
17719 programs typically use exceptions, so this is the right thing to do.
17720
17721 If, instead, you use the GCC driver to create shared libraries, you may
17722 find that they are not always linked with the shared @file{libgcc}.
17723 If GCC finds, at its configuration time, that you have a non-GNU linker
17724 or a GNU linker that does not support option @option{--eh-frame-hdr},
17725 it links the shared version of @file{libgcc} into shared libraries
17726 by default. Otherwise, it takes advantage of the linker and optimizes
17727 away the linking with the shared version of @file{libgcc}, linking with
17728 the static version of libgcc by default. This allows exceptions to
17729 propagate through such shared libraries, without incurring relocation
17730 costs at library load time.
17731
17732 However, if a library or main executable is supposed to throw or catch
17733 exceptions, you must link it using the G++ driver, or using the option
17734 @option{-shared-libgcc}, such that it is linked with the shared
17735 @file{libgcc}.
17736
17737 @item -static-libasan
17738 @opindex static-libasan
17739 When the @option{-fsanitize=address} option is used to link a program,
17740 the GCC driver automatically links against @option{libasan}. If
17741 @file{libasan} is available as a shared library, and the @option{-static}
17742 option is not used, then this links against the shared version of
17743 @file{libasan}. The @option{-static-libasan} option directs the GCC
17744 driver to link @file{libasan} statically, without necessarily linking
17745 other libraries statically.
17746
17747 @item -static-libtsan
17748 @opindex static-libtsan
17749 When the @option{-fsanitize=thread} option is used to link a program,
17750 the GCC driver automatically links against @option{libtsan}. If
17751 @file{libtsan} is available as a shared library, and the @option{-static}
17752 option is not used, then this links against the shared version of
17753 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
17754 driver to link @file{libtsan} statically, without necessarily linking
17755 other libraries statically.
17756
17757 @item -static-liblsan
17758 @opindex static-liblsan
17759 When the @option{-fsanitize=leak} option is used to link a program,
17760 the GCC driver automatically links against @option{liblsan}. If
17761 @file{liblsan} is available as a shared library, and the @option{-static}
17762 option is not used, then this links against the shared version of
17763 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
17764 driver to link @file{liblsan} statically, without necessarily linking
17765 other libraries statically.
17766
17767 @item -static-libubsan
17768 @opindex static-libubsan
17769 When the @option{-fsanitize=undefined} option is used to link a program,
17770 the GCC driver automatically links against @option{libubsan}. If
17771 @file{libubsan} is available as a shared library, and the @option{-static}
17772 option is not used, then this links against the shared version of
17773 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
17774 driver to link @file{libubsan} statically, without necessarily linking
17775 other libraries statically.
17776
17777 @item -static-libstdc++
17778 @opindex static-libstdc++
17779 When the @command{g++} program is used to link a C++ program, it
17780 normally automatically links against @option{libstdc++}. If
17781 @file{libstdc++} is available as a shared library, and the
17782 @option{-static} option is not used, then this links against the
17783 shared version of @file{libstdc++}. That is normally fine. However, it
17784 is sometimes useful to freeze the version of @file{libstdc++} used by
17785 the program without going all the way to a fully static link. The
17786 @option{-static-libstdc++} option directs the @command{g++} driver to
17787 link @file{libstdc++} statically, without necessarily linking other
17788 libraries statically.
17789
17790 @item -symbolic
17791 @opindex symbolic
17792 Bind references to global symbols when building a shared object. Warn
17793 about any unresolved references (unless overridden by the link editor
17794 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
17795 this option.
17796
17797 @item -T @var{script}
17798 @opindex T
17799 @cindex linker script
17800 Use @var{script} as the linker script. This option is supported by most
17801 systems using the GNU linker. On some targets, such as bare-board
17802 targets without an operating system, the @option{-T} option may be required
17803 when linking to avoid references to undefined symbols.
17804
17805 @item -Xlinker @var{option}
17806 @opindex Xlinker
17807 Pass @var{option} as an option to the linker. You can use this to
17808 supply system-specific linker options that GCC does not recognize.
17809
17810 If you want to pass an option that takes a separate argument, you must use
17811 @option{-Xlinker} twice, once for the option and once for the argument.
17812 For example, to pass @option{-assert definitions}, you must write
17813 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
17814 @option{-Xlinker "-assert definitions"}, because this passes the entire
17815 string as a single argument, which is not what the linker expects.
17816
17817 When using the GNU linker, it is usually more convenient to pass
17818 arguments to linker options using the @option{@var{option}=@var{value}}
17819 syntax than as separate arguments. For example, you can specify
17820 @option{-Xlinker -Map=output.map} rather than
17821 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
17822 this syntax for command-line options.
17823
17824 @item -Wl,@var{option}
17825 @opindex Wl
17826 Pass @var{option} as an option to the linker. If @var{option} contains
17827 commas, it is split into multiple options at the commas. You can use this
17828 syntax to pass an argument to the option.
17829 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
17830 linker. When using the GNU linker, you can also get the same effect with
17831 @option{-Wl,-Map=output.map}.
17832
17833 @item -u @var{symbol}
17834 @opindex u
17835 Pretend the symbol @var{symbol} is undefined, to force linking of
17836 library modules to define it. You can use @option{-u} multiple times with
17837 different symbols to force loading of additional library modules.
17838
17839 @item -z @var{keyword}
17840 @opindex z
17841 @option{-z} is passed directly on to the linker along with the keyword
17842 @var{keyword}. See the section in the documentation of your linker for
17843 permitted values and their meanings.
17844 @end table
17845
17846 @node Directory Options
17847 @section Options for Directory Search
17848 @cindex directory options
17849 @cindex options, directory search
17850 @cindex search path
17851
17852 These options specify directories to search for header files, for
17853 libraries and for parts of the compiler:
17854
17855 @table @gcctabopt
17856 @include cppdiropts.texi
17857
17858 @item -iplugindir=@var{dir}
17859 @opindex iplugindir=
17860 Set the directory to search for plugins that are passed
17861 by @option{-fplugin=@var{name}} instead of
17862 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
17863 to be used by the user, but only passed by the driver.
17864
17865 @item -L@var{dir}
17866 @opindex L
17867 Add directory @var{dir} to the list of directories to be searched
17868 for @option{-l}.
17869
17870 @item -B@var{prefix}
17871 @opindex B
17872 This option specifies where to find the executables, libraries,
17873 include files, and data files of the compiler itself.
17874
17875 The compiler driver program runs one or more of the subprograms
17876 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
17877 @var{prefix} as a prefix for each program it tries to run, both with and
17878 without @samp{@var{machine}/@var{version}/} for the corresponding target
17879 machine and compiler version.
17880
17881 For each subprogram to be run, the compiler driver first tries the
17882 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
17883 is not specified, the driver tries two standard prefixes,
17884 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
17885 those results in a file name that is found, the unmodified program
17886 name is searched for using the directories specified in your
17887 @env{PATH} environment variable.
17888
17889 The compiler checks to see if the path provided by @option{-B}
17890 refers to a directory, and if necessary it adds a directory
17891 separator character at the end of the path.
17892
17893 @option{-B} prefixes that effectively specify directory names also apply
17894 to libraries in the linker, because the compiler translates these
17895 options into @option{-L} options for the linker. They also apply to
17896 include files in the preprocessor, because the compiler translates these
17897 options into @option{-isystem} options for the preprocessor. In this case,
17898 the compiler appends @samp{include} to the prefix.
17899
17900 The runtime support file @file{libgcc.a} can also be searched for using
17901 the @option{-B} prefix, if needed. If it is not found there, the two
17902 standard prefixes above are tried, and that is all. The file is left
17903 out of the link if it is not found by those means.
17904
17905 Another way to specify a prefix much like the @option{-B} prefix is to use
17906 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
17907 Variables}.
17908
17909 As a special kludge, if the path provided by @option{-B} is
17910 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
17911 9, then it is replaced by @file{[dir/]include}. This is to help
17912 with boot-strapping the compiler.
17913
17914 @item -no-canonical-prefixes
17915 @opindex no-canonical-prefixes
17916 Do not expand any symbolic links, resolve references to @samp{/../}
17917 or @samp{/./}, or make the path absolute when generating a relative
17918 prefix.
17919
17920 @item --sysroot=@var{dir}
17921 @opindex sysroot
17922 Use @var{dir} as the logical root directory for headers and libraries.
17923 For example, if the compiler normally searches for headers in
17924 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
17925 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
17926
17927 If you use both this option and the @option{-isysroot} option, then
17928 the @option{--sysroot} option applies to libraries, but the
17929 @option{-isysroot} option applies to header files.
17930
17931 The GNU linker (beginning with version 2.16) has the necessary support
17932 for this option. If your linker does not support this option, the
17933 header file aspect of @option{--sysroot} still works, but the
17934 library aspect does not.
17935
17936 @item --no-sysroot-suffix
17937 @opindex no-sysroot-suffix
17938 For some targets, a suffix is added to the root directory specified
17939 with @option{--sysroot}, depending on the other options used, so that
17940 headers may for example be found in
17941 @file{@var{dir}/@var{suffix}/usr/include} instead of
17942 @file{@var{dir}/usr/include}. This option disables the addition of
17943 such a suffix.
17944
17945 @end table
17946
17947 @node Code Gen Options
17948 @section Options for Code Generation Conventions
17949 @cindex code generation conventions
17950 @cindex options, code generation
17951 @cindex run-time options
17952
17953 These machine-independent options control the interface conventions
17954 used in code generation.
17955
17956 Most of them have both positive and negative forms; the negative form
17957 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
17958 one of the forms is listed---the one that is not the default. You
17959 can figure out the other form by either removing @samp{no-} or adding
17960 it.
17961
17962 @table @gcctabopt
17963 @item -fstack-reuse=@var{reuse-level}
17964 @opindex fstack_reuse
17965 This option controls stack space reuse for user declared local/auto variables
17966 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
17967 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
17968 local variables and temporaries, @samp{named_vars} enables the reuse only for
17969 user defined local variables with names, and @samp{none} disables stack reuse
17970 completely. The default value is @samp{all}. The option is needed when the
17971 program extends the lifetime of a scoped local variable or a compiler generated
17972 temporary beyond the end point defined by the language. When a lifetime of
17973 a variable ends, and if the variable lives in memory, the optimizing compiler
17974 has the freedom to reuse its stack space with other temporaries or scoped
17975 local variables whose live range does not overlap with it. Legacy code extending
17976 local lifetime is likely to break with the stack reuse optimization.
17977
17978 For example,
17979
17980 @smallexample
17981 int *p;
17982 @{
17983 int local1;
17984
17985 p = &local1;
17986 local1 = 10;
17987 ....
17988 @}
17989 @{
17990 int local2;
17991 local2 = 20;
17992 ...
17993 @}
17994
17995 if (*p == 10) // out of scope use of local1
17996 @{
17997
17998 @}
17999 @end smallexample
18000
18001 Another example:
18002 @smallexample
18003
18004 struct A
18005 @{
18006 A(int k) : i(k), j(k) @{ @}
18007 int i;
18008 int j;
18009 @};
18010
18011 A *ap;
18012
18013 void foo(const A& ar)
18014 @{
18015 ap = &ar;
18016 @}
18017
18018 void bar()
18019 @{
18020 foo(A(10)); // temp object's lifetime ends when foo returns
18021
18022 @{
18023 A a(20);
18024 ....
18025 @}
18026 ap->i+= 10; // ap references out of scope temp whose space
18027 // is reused with a. What is the value of ap->i?
18028 @}
18029
18030 @end smallexample
18031
18032 The lifetime of a compiler generated temporary is well defined by the C++
18033 standard. When a lifetime of a temporary ends, and if the temporary lives
18034 in memory, the optimizing compiler has the freedom to reuse its stack
18035 space with other temporaries or scoped local variables whose live range
18036 does not overlap with it. However some of the legacy code relies on
18037 the behavior of older compilers in which temporaries' stack space is
18038 not reused, the aggressive stack reuse can lead to runtime errors. This
18039 option is used to control the temporary stack reuse optimization.
18040
18041 @item -ftrapv
18042 @opindex ftrapv
18043 This option generates traps for signed overflow on addition, subtraction,
18044 multiplication operations.
18045 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18046 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18047 @option{-fwrapv} being effective. Note that only active options override, so
18048 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18049 results in @option{-ftrapv} being effective.
18050
18051 @item -fwrapv
18052 @opindex fwrapv
18053 This option instructs the compiler to assume that signed arithmetic
18054 overflow of addition, subtraction and multiplication wraps around
18055 using twos-complement representation. This flag enables some optimizations
18056 and disables others.
18057 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18058 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18059 @option{-fwrapv} being effective. Note that only active options override, so
18060 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18061 results in @option{-ftrapv} being effective.
18062
18063 @item -fwrapv-pointer
18064 @opindex fwrapv-pointer
18065 This option instructs the compiler to assume that pointer arithmetic
18066 overflow on addition and subtraction wraps around using twos-complement
18067 representation. This flag disables some optimizations which assume
18068 pointer overflow is invalid.
18069
18070 @item -fstrict-overflow
18071 @opindex fstrict-overflow
18072 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18073 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18074
18075 @item -fexceptions
18076 @opindex fexceptions
18077 Enable exception handling. Generates extra code needed to propagate
18078 exceptions. For some targets, this implies GCC generates frame
18079 unwind information for all functions, which can produce significant data
18080 size overhead, although it does not affect execution. If you do not
18081 specify this option, GCC enables it by default for languages like
18082 C++ that normally require exception handling, and disables it for
18083 languages like C that do not normally require it. However, you may need
18084 to enable this option when compiling C code that needs to interoperate
18085 properly with exception handlers written in C++. You may also wish to
18086 disable this option if you are compiling older C++ programs that don't
18087 use exception handling.
18088
18089 @item -fnon-call-exceptions
18090 @opindex fnon-call-exceptions
18091 Generate code that allows trapping instructions to throw exceptions.
18092 Note that this requires platform-specific runtime support that does
18093 not exist everywhere. Moreover, it only allows @emph{trapping}
18094 instructions to throw exceptions, i.e.@: memory references or floating-point
18095 instructions. It does not allow exceptions to be thrown from
18096 arbitrary signal handlers such as @code{SIGALRM}. This enables
18097 @option{-fexceptions}.
18098
18099 @item -fdelete-dead-exceptions
18100 @opindex fdelete-dead-exceptions
18101 Consider that instructions that may throw exceptions but don't otherwise
18102 contribute to the execution of the program can be optimized away.
18103 This does not affect calls to functions except those with the
18104 @code{pure} or @code{const} attributes.
18105 This option is enabled by default for the Ada and C++ compilers, as permitted by
18106 the language specifications.
18107 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18108
18109 @item -funwind-tables
18110 @opindex funwind-tables
18111 Similar to @option{-fexceptions}, except that it just generates any needed
18112 static data, but does not affect the generated code in any other way.
18113 You normally do not need to enable this option; instead, a language processor
18114 that needs this handling enables it on your behalf.
18115
18116 @item -fasynchronous-unwind-tables
18117 @opindex fasynchronous-unwind-tables
18118 Generate unwind table in DWARF format, if supported by target machine. The
18119 table is exact at each instruction boundary, so it can be used for stack
18120 unwinding from asynchronous events (such as debugger or garbage collector).
18121
18122 @item -fno-gnu-unique
18123 @opindex fno-gnu-unique
18124 @opindex fgnu-unique
18125 On systems with recent GNU assembler and C library, the C++ compiler
18126 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18127 of template static data members and static local variables in inline
18128 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18129 is necessary to avoid problems with a library used by two different
18130 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18131 therefore disagreeing with the other one about the binding of the
18132 symbol. But this causes @code{dlclose} to be ignored for affected
18133 DSOs; if your program relies on reinitialization of a DSO via
18134 @code{dlclose} and @code{dlopen}, you can use
18135 @option{-fno-gnu-unique}.
18136
18137 @item -fpcc-struct-return
18138 @opindex fpcc-struct-return
18139 Return ``short'' @code{struct} and @code{union} values in memory like
18140 longer ones, rather than in registers. This convention is less
18141 efficient, but it has the advantage of allowing intercallability between
18142 GCC-compiled files and files compiled with other compilers, particularly
18143 the Portable C Compiler (pcc).
18144
18145 The precise convention for returning structures in memory depends
18146 on the target configuration macros.
18147
18148 Short structures and unions are those whose size and alignment match
18149 that of some integer type.
18150
18151 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18152 switch is not binary compatible with code compiled with the
18153 @option{-freg-struct-return} switch.
18154 Use it to conform to a non-default application binary interface.
18155
18156 @item -freg-struct-return
18157 @opindex freg-struct-return
18158 Return @code{struct} and @code{union} values in registers when possible.
18159 This is more efficient for small structures than
18160 @option{-fpcc-struct-return}.
18161
18162 If you specify neither @option{-fpcc-struct-return} nor
18163 @option{-freg-struct-return}, GCC defaults to whichever convention is
18164 standard for the target. If there is no standard convention, GCC
18165 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18166 the principal compiler. In those cases, we can choose the standard, and
18167 we chose the more efficient register return alternative.
18168
18169 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18170 switch is not binary compatible with code compiled with the
18171 @option{-fpcc-struct-return} switch.
18172 Use it to conform to a non-default application binary interface.
18173
18174 @item -fshort-enums
18175 @opindex fshort-enums
18176 Allocate to an @code{enum} type only as many bytes as it needs for the
18177 declared range of possible values. Specifically, the @code{enum} type
18178 is equivalent to the smallest integer type that has enough room.
18179
18180 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18181 code that is not binary compatible with code generated without that switch.
18182 Use it to conform to a non-default application binary interface.
18183
18184 @item -fshort-wchar
18185 @opindex fshort-wchar
18186 Override the underlying type for @code{wchar_t} to be @code{short
18187 unsigned int} instead of the default for the target. This option is
18188 useful for building programs to run under WINE@.
18189
18190 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18191 code that is not binary compatible with code generated without that switch.
18192 Use it to conform to a non-default application binary interface.
18193
18194 @item -fcommon
18195 @opindex fcommon
18196 @opindex fno-common
18197 @cindex tentative definitions
18198 In C code, this option controls the placement of global variables
18199 defined without an initializer, known as @dfn{tentative definitions}
18200 in the C standard. Tentative definitions are distinct from declarations
18201 of a variable with the @code{extern} keyword, which do not allocate storage.
18202
18203 The default is @option{-fno-common}, which specifies that the compiler places
18204 uninitialized global variables in the BSS section of the object file.
18205 This inhibits the merging of tentative definitions by the linker so you get a
18206 multiple-definition error if the same variable is accidentally defined in more
18207 than one compilation unit.
18208
18209 The @option{-fcommon} places uninitialized global variables in a common block.
18210 This allows the linker to resolve all tentative definitions of the same variable
18211 in different compilation units to the same object, or to a non-tentative
18212 definition. This behavior is inconsistent with C++, and on many targets implies
18213 a speed and code size penalty on global variable references. It is mainly
18214 useful to enable legacy code to link without errors.
18215
18216 @item -fno-ident
18217 @opindex fno-ident
18218 @opindex fident
18219 Ignore the @code{#ident} directive.
18220
18221 @item -finhibit-size-directive
18222 @opindex finhibit-size-directive
18223 Don't output a @code{.size} assembler directive, or anything else that
18224 would cause trouble if the function is split in the middle, and the
18225 two halves are placed at locations far apart in memory. This option is
18226 used when compiling @file{crtstuff.c}; you should not need to use it
18227 for anything else.
18228
18229 @item -fverbose-asm
18230 @opindex fverbose-asm
18231 Put extra commentary information in the generated assembly code to
18232 make it more readable. This option is generally only of use to those
18233 who actually need to read the generated assembly code (perhaps while
18234 debugging the compiler itself).
18235
18236 @option{-fno-verbose-asm}, the default, causes the
18237 extra information to be omitted and is useful when comparing two assembler
18238 files.
18239
18240 The added comments include:
18241
18242 @itemize @bullet
18243
18244 @item
18245 information on the compiler version and command-line options,
18246
18247 @item
18248 the source code lines associated with the assembly instructions,
18249 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18250
18251 @item
18252 hints on which high-level expressions correspond to
18253 the various assembly instruction operands.
18254
18255 @end itemize
18256
18257 For example, given this C source file:
18258
18259 @smallexample
18260 int test (int n)
18261 @{
18262 int i;
18263 int total = 0;
18264
18265 for (i = 0; i < n; i++)
18266 total += i * i;
18267
18268 return total;
18269 @}
18270 @end smallexample
18271
18272 compiling to (x86_64) assembly via @option{-S} and emitting the result
18273 direct to stdout via @option{-o} @option{-}
18274
18275 @smallexample
18276 gcc -S test.c -fverbose-asm -Os -o -
18277 @end smallexample
18278
18279 gives output similar to this:
18280
18281 @smallexample
18282 .file "test.c"
18283 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18284 [...snip...]
18285 # options passed:
18286 [...snip...]
18287
18288 .text
18289 .globl test
18290 .type test, @@function
18291 test:
18292 .LFB0:
18293 .cfi_startproc
18294 # test.c:4: int total = 0;
18295 xorl %eax, %eax # <retval>
18296 # test.c:6: for (i = 0; i < n; i++)
18297 xorl %edx, %edx # i
18298 .L2:
18299 # test.c:6: for (i = 0; i < n; i++)
18300 cmpl %edi, %edx # n, i
18301 jge .L5 #,
18302 # test.c:7: total += i * i;
18303 movl %edx, %ecx # i, tmp92
18304 imull %edx, %ecx # i, tmp92
18305 # test.c:6: for (i = 0; i < n; i++)
18306 incl %edx # i
18307 # test.c:7: total += i * i;
18308 addl %ecx, %eax # tmp92, <retval>
18309 jmp .L2 #
18310 .L5:
18311 # test.c:10: @}
18312 ret
18313 .cfi_endproc
18314 .LFE0:
18315 .size test, .-test
18316 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
18317 .section .note.GNU-stack,"",@@progbits
18318 @end smallexample
18319
18320 The comments are intended for humans rather than machines and hence the
18321 precise format of the comments is subject to change.
18322
18323 @item -frecord-gcc-switches
18324 @opindex frecord-gcc-switches
18325 This switch causes the command line used to invoke the
18326 compiler to be recorded into the object file that is being created.
18327 This switch is only implemented on some targets and the exact format
18328 of the recording is target and binary file format dependent, but it
18329 usually takes the form of a section containing ASCII text. This
18330 switch is related to the @option{-fverbose-asm} switch, but that
18331 switch only records information in the assembler output file as
18332 comments, so it never reaches the object file.
18333 See also @option{-grecord-gcc-switches} for another
18334 way of storing compiler options into the object file.
18335
18336 @item -fpic
18337 @opindex fpic
18338 @cindex global offset table
18339 @cindex PIC
18340 Generate position-independent code (PIC) suitable for use in a shared
18341 library, if supported for the target machine. Such code accesses all
18342 constant addresses through a global offset table (GOT)@. The dynamic
18343 loader resolves the GOT entries when the program starts (the dynamic
18344 loader is not part of GCC; it is part of the operating system). If
18345 the GOT size for the linked executable exceeds a machine-specific
18346 maximum size, you get an error message from the linker indicating that
18347 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18348 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18349 on the m68k and RS/6000. The x86 has no such limit.)
18350
18351 Position-independent code requires special support, and therefore works
18352 only on certain machines. For the x86, GCC supports PIC for System V
18353 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
18354 position-independent.
18355
18356 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18357 are defined to 1.
18358
18359 @item -fPIC
18360 @opindex fPIC
18361 If supported for the target machine, emit position-independent code,
18362 suitable for dynamic linking and avoiding any limit on the size of the
18363 global offset table. This option makes a difference on AArch64, m68k,
18364 PowerPC and SPARC@.
18365
18366 Position-independent code requires special support, and therefore works
18367 only on certain machines.
18368
18369 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18370 are defined to 2.
18371
18372 @item -fpie
18373 @itemx -fPIE
18374 @opindex fpie
18375 @opindex fPIE
18376 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18377 generated position-independent code can be only linked into executables.
18378 Usually these options are used to compile code that will be linked using
18379 the @option{-pie} GCC option.
18380
18381 @option{-fpie} and @option{-fPIE} both define the macros
18382 @code{__pie__} and @code{__PIE__}. The macros have the value 1
18383 for @option{-fpie} and 2 for @option{-fPIE}.
18384
18385 @item -fno-plt
18386 @opindex fno-plt
18387 @opindex fplt
18388 Do not use the PLT for external function calls in position-independent code.
18389 Instead, load the callee address at call sites from the GOT and branch to it.
18390 This leads to more efficient code by eliminating PLT stubs and exposing
18391 GOT loads to optimizations. On architectures such as 32-bit x86 where
18392 PLT stubs expect the GOT pointer in a specific register, this gives more
18393 register allocation freedom to the compiler.
18394 Lazy binding requires use of the PLT;
18395 with @option{-fno-plt} all external symbols are resolved at load time.
18396
18397 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18398 through the PLT for specific external functions.
18399
18400 In position-dependent code, a few targets also convert calls to
18401 functions that are marked to not use the PLT to use the GOT instead.
18402
18403 @item -fno-jump-tables
18404 @opindex fno-jump-tables
18405 @opindex fjump-tables
18406 Do not use jump tables for switch statements even where it would be
18407 more efficient than other code generation strategies. This option is
18408 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18409 building code that forms part of a dynamic linker and cannot
18410 reference the address of a jump table. On some targets, jump tables
18411 do not require a GOT and this option is not needed.
18412
18413 @item -fno-bit-tests
18414 @opindex fno-bit-tests
18415 @opindex fbit-tests
18416 Do not use bit tests for switch statements even where it would be
18417 more efficient than other code generation strategies.
18418
18419 @item -ffixed-@var{reg}
18420 @opindex ffixed
18421 Treat the register named @var{reg} as a fixed register; generated code
18422 should never refer to it (except perhaps as a stack pointer, frame
18423 pointer or in some other fixed role).
18424
18425 @var{reg} must be the name of a register. The register names accepted
18426 are machine-specific and are defined in the @code{REGISTER_NAMES}
18427 macro in the machine description macro file.
18428
18429 This flag does not have a negative form, because it specifies a
18430 three-way choice.
18431
18432 @item -fcall-used-@var{reg}
18433 @opindex fcall-used
18434 Treat the register named @var{reg} as an allocable register that is
18435 clobbered by function calls. It may be allocated for temporaries or
18436 variables that do not live across a call. Functions compiled this way
18437 do not save and restore the register @var{reg}.
18438
18439 It is an error to use this flag with the frame pointer or stack pointer.
18440 Use of this flag for other registers that have fixed pervasive roles in
18441 the machine's execution model produces disastrous results.
18442
18443 This flag does not have a negative form, because it specifies a
18444 three-way choice.
18445
18446 @item -fcall-saved-@var{reg}
18447 @opindex fcall-saved
18448 Treat the register named @var{reg} as an allocable register saved by
18449 functions. It may be allocated even for temporaries or variables that
18450 live across a call. Functions compiled this way save and restore
18451 the register @var{reg} if they use it.
18452
18453 It is an error to use this flag with the frame pointer or stack pointer.
18454 Use of this flag for other registers that have fixed pervasive roles in
18455 the machine's execution model produces disastrous results.
18456
18457 A different sort of disaster results from the use of this flag for
18458 a register in which function values may be returned.
18459
18460 This flag does not have a negative form, because it specifies a
18461 three-way choice.
18462
18463 @item -fpack-struct[=@var{n}]
18464 @opindex fpack-struct
18465 Without a value specified, pack all structure members together without
18466 holes. When a value is specified (which must be a small power of two), pack
18467 structure members according to this value, representing the maximum
18468 alignment (that is, objects with default alignment requirements larger than
18469 this are output potentially unaligned at the next fitting location.
18470
18471 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18472 code that is not binary compatible with code generated without that switch.
18473 Additionally, it makes the code suboptimal.
18474 Use it to conform to a non-default application binary interface.
18475
18476 @item -fleading-underscore
18477 @opindex fleading-underscore
18478 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18479 change the way C symbols are represented in the object file. One use
18480 is to help link with legacy assembly code.
18481
18482 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18483 generate code that is not binary compatible with code generated without that
18484 switch. Use it to conform to a non-default application binary interface.
18485 Not all targets provide complete support for this switch.
18486
18487 @item -ftls-model=@var{model}
18488 @opindex ftls-model
18489 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18490 The @var{model} argument should be one of @samp{global-dynamic},
18491 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
18492 Note that the choice is subject to optimization: the compiler may use
18493 a more efficient model for symbols not visible outside of the translation
18494 unit, or if @option{-fpic} is not given on the command line.
18495
18496 The default without @option{-fpic} is @samp{initial-exec}; with
18497 @option{-fpic} the default is @samp{global-dynamic}.
18498
18499 @item -ftrampolines
18500 @opindex ftrampolines
18501 For targets that normally need trampolines for nested functions, always
18502 generate them instead of using descriptors. Otherwise, for targets that
18503 do not need them, like for example HP-PA or IA-64, do nothing.
18504
18505 A trampoline is a small piece of code that is created at run time on the
18506 stack when the address of a nested function is taken, and is used to call
18507 the nested function indirectly. Therefore, it requires the stack to be
18508 made executable in order for the program to work properly.
18509
18510 @option{-fno-trampolines} is enabled by default on a language by language
18511 basis to let the compiler avoid generating them, if it computes that this
18512 is safe, and replace them with descriptors. Descriptors are made up of data
18513 only, but the generated code must be prepared to deal with them. As of this
18514 writing, @option{-fno-trampolines} is enabled by default only for Ada.
18515
18516 Moreover, code compiled with @option{-ftrampolines} and code compiled with
18517 @option{-fno-trampolines} are not binary compatible if nested functions are
18518 present. This option must therefore be used on a program-wide basis and be
18519 manipulated with extreme care.
18520
18521 For languages other than Ada, the @code{-ftrampolines} and
18522 @code{-fno-trampolines} options currently have no effect, and
18523 trampolines are always generated on platforms that need them
18524 for nested functions.
18525
18526 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
18527 @opindex fvisibility
18528 Set the default ELF image symbol visibility to the specified option---all
18529 symbols are marked with this unless overridden within the code.
18530 Using this feature can very substantially improve linking and
18531 load times of shared object libraries, produce more optimized
18532 code, provide near-perfect API export and prevent symbol clashes.
18533 It is @strong{strongly} recommended that you use this in any shared objects
18534 you distribute.
18535
18536 Despite the nomenclature, @samp{default} always means public; i.e.,
18537 available to be linked against from outside the shared object.
18538 @samp{protected} and @samp{internal} are pretty useless in real-world
18539 usage so the only other commonly used option is @samp{hidden}.
18540 The default if @option{-fvisibility} isn't specified is
18541 @samp{default}, i.e., make every symbol public.
18542
18543 A good explanation of the benefits offered by ensuring ELF
18544 symbols have the correct visibility is given by ``How To Write
18545 Shared Libraries'' by Ulrich Drepper (which can be found at
18546 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
18547 solution made possible by this option to marking things hidden when
18548 the default is public is to make the default hidden and mark things
18549 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
18550 and @code{__attribute__ ((visibility("default")))} instead of
18551 @code{__declspec(dllexport)} you get almost identical semantics with
18552 identical syntax. This is a great boon to those working with
18553 cross-platform projects.
18554
18555 For those adding visibility support to existing code, you may find
18556 @code{#pragma GCC visibility} of use. This works by you enclosing
18557 the declarations you wish to set visibility for with (for example)
18558 @code{#pragma GCC visibility push(hidden)} and
18559 @code{#pragma GCC visibility pop}.
18560 Bear in mind that symbol visibility should be viewed @strong{as
18561 part of the API interface contract} and thus all new code should
18562 always specify visibility when it is not the default; i.e., declarations
18563 only for use within the local DSO should @strong{always} be marked explicitly
18564 as hidden as so to avoid PLT indirection overheads---making this
18565 abundantly clear also aids readability and self-documentation of the code.
18566 Note that due to ISO C++ specification requirements, @code{operator new} and
18567 @code{operator delete} must always be of default visibility.
18568
18569 Be aware that headers from outside your project, in particular system
18570 headers and headers from any other library you use, may not be
18571 expecting to be compiled with visibility other than the default. You
18572 may need to explicitly say @code{#pragma GCC visibility push(default)}
18573 before including any such headers.
18574
18575 @code{extern} declarations are not affected by @option{-fvisibility}, so
18576 a lot of code can be recompiled with @option{-fvisibility=hidden} with
18577 no modifications. However, this means that calls to @code{extern}
18578 functions with no explicit visibility use the PLT, so it is more
18579 effective to use @code{__attribute ((visibility))} and/or
18580 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
18581 declarations should be treated as hidden.
18582
18583 Note that @option{-fvisibility} does affect C++ vague linkage
18584 entities. This means that, for instance, an exception class that is
18585 be thrown between DSOs must be explicitly marked with default
18586 visibility so that the @samp{type_info} nodes are unified between
18587 the DSOs.
18588
18589 An overview of these techniques, their benefits and how to use them
18590 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
18591
18592 @item -fstrict-volatile-bitfields
18593 @opindex fstrict-volatile-bitfields
18594 This option should be used if accesses to volatile bit-fields (or other
18595 structure fields, although the compiler usually honors those types
18596 anyway) should use a single access of the width of the
18597 field's type, aligned to a natural alignment if possible. For
18598 example, targets with memory-mapped peripheral registers might require
18599 all such accesses to be 16 bits wide; with this flag you can
18600 declare all peripheral bit-fields as @code{unsigned short} (assuming short
18601 is 16 bits on these targets) to force GCC to use 16-bit accesses
18602 instead of, perhaps, a more efficient 32-bit access.
18603
18604 If this option is disabled, the compiler uses the most efficient
18605 instruction. In the previous example, that might be a 32-bit load
18606 instruction, even though that accesses bytes that do not contain
18607 any portion of the bit-field, or memory-mapped registers unrelated to
18608 the one being updated.
18609
18610 In some cases, such as when the @code{packed} attribute is applied to a
18611 structure field, it may not be possible to access the field with a single
18612 read or write that is correctly aligned for the target machine. In this
18613 case GCC falls back to generating multiple accesses rather than code that
18614 will fault or truncate the result at run time.
18615
18616 Note: Due to restrictions of the C/C++11 memory model, write accesses are
18617 not allowed to touch non bit-field members. It is therefore recommended
18618 to define all bits of the field's type as bit-field members.
18619
18620 The default value of this option is determined by the application binary
18621 interface for the target processor.
18622
18623 @item -fsync-libcalls
18624 @opindex fsync-libcalls
18625 This option controls whether any out-of-line instance of the @code{__sync}
18626 family of functions may be used to implement the C++11 @code{__atomic}
18627 family of functions.
18628
18629 The default value of this option is enabled, thus the only useful form
18630 of the option is @option{-fno-sync-libcalls}. This option is used in
18631 the implementation of the @file{libatomic} runtime library.
18632
18633 @end table
18634
18635 @node Developer Options
18636 @section GCC Developer Options
18637 @cindex developer options
18638 @cindex debugging GCC
18639 @cindex debug dump options
18640 @cindex dump options
18641 @cindex compilation statistics
18642
18643 This section describes command-line options that are primarily of
18644 interest to GCC developers, including options to support compiler
18645 testing and investigation of compiler bugs and compile-time
18646 performance problems. This includes options that produce debug dumps
18647 at various points in the compilation; that print statistics such as
18648 memory use and execution time; and that print information about GCC's
18649 configuration, such as where it searches for libraries. You should
18650 rarely need to use any of these options for ordinary compilation and
18651 linking tasks.
18652
18653 Many developer options that cause GCC to dump output to a file take an
18654 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
18655 or @samp{-} to dump to standard output, and @samp{stderr} for standard
18656 error.
18657
18658 If @samp{=@var{filename}} is omitted, a default dump file name is
18659 constructed by concatenating the base dump file name, a pass number,
18660 phase letter, and pass name. The base dump file name is the name of
18661 output file produced by the compiler if explicitly specified and not
18662 an executable; otherwise it is the source file name.
18663 The pass number is determined by the order passes are registered with
18664 the compiler's pass manager.
18665 This is generally the same as the order of execution, but passes
18666 registered by plugins, target-specific passes, or passes that are
18667 otherwise registered late are numbered higher than the pass named
18668 @samp{final}, even if they are executed earlier. The phase letter is
18669 one of @samp{i} (inter-procedural analysis), @samp{l}
18670 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
18671 The files are created in the directory of the output file.
18672
18673 @table @gcctabopt
18674
18675 @item -fcallgraph-info
18676 @itemx -fcallgraph-info=@var{MARKERS}
18677 @opindex fcallgraph-info
18678 Makes the compiler output callgraph information for the program, on a
18679 per-object-file basis. The information is generated in the common VCG
18680 format. It can be decorated with additional, per-node and/or per-edge
18681 information, if a list of comma-separated markers is additionally
18682 specified. When the @code{su} marker is specified, the callgraph is
18683 decorated with stack usage information; it is equivalent to
18684 @option{-fstack-usage}. When the @code{da} marker is specified, the
18685 callgraph is decorated with information about dynamically allocated
18686 objects.
18687
18688 When compiling with @option{-flto}, no callgraph information is output
18689 along with the object file. At LTO link time, @option{-fcallgraph-info}
18690 may generate multiple callgraph information files next to intermediate
18691 LTO output files.
18692
18693 @item -d@var{letters}
18694 @itemx -fdump-rtl-@var{pass}
18695 @itemx -fdump-rtl-@var{pass}=@var{filename}
18696 @opindex d
18697 @opindex fdump-rtl-@var{pass}
18698 Says to make debugging dumps during compilation at times specified by
18699 @var{letters}. This is used for debugging the RTL-based passes of the
18700 compiler.
18701
18702 Some @option{-d@var{letters}} switches have different meaning when
18703 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
18704 for information about preprocessor-specific dump options.
18705
18706 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
18707 @option{-d} option @var{letters}. Here are the possible
18708 letters for use in @var{pass} and @var{letters}, and their meanings:
18709
18710 @table @gcctabopt
18711
18712 @item -fdump-rtl-alignments
18713 @opindex fdump-rtl-alignments
18714 Dump after branch alignments have been computed.
18715
18716 @item -fdump-rtl-asmcons
18717 @opindex fdump-rtl-asmcons
18718 Dump after fixing rtl statements that have unsatisfied in/out constraints.
18719
18720 @item -fdump-rtl-auto_inc_dec
18721 @opindex fdump-rtl-auto_inc_dec
18722 Dump after auto-inc-dec discovery. This pass is only run on
18723 architectures that have auto inc or auto dec instructions.
18724
18725 @item -fdump-rtl-barriers
18726 @opindex fdump-rtl-barriers
18727 Dump after cleaning up the barrier instructions.
18728
18729 @item -fdump-rtl-bbpart
18730 @opindex fdump-rtl-bbpart
18731 Dump after partitioning hot and cold basic blocks.
18732
18733 @item -fdump-rtl-bbro
18734 @opindex fdump-rtl-bbro
18735 Dump after block reordering.
18736
18737 @item -fdump-rtl-btl1
18738 @itemx -fdump-rtl-btl2
18739 @opindex fdump-rtl-btl2
18740 @opindex fdump-rtl-btl2
18741 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
18742 after the two branch
18743 target load optimization passes.
18744
18745 @item -fdump-rtl-bypass
18746 @opindex fdump-rtl-bypass
18747 Dump after jump bypassing and control flow optimizations.
18748
18749 @item -fdump-rtl-combine
18750 @opindex fdump-rtl-combine
18751 Dump after the RTL instruction combination pass.
18752
18753 @item -fdump-rtl-compgotos
18754 @opindex fdump-rtl-compgotos
18755 Dump after duplicating the computed gotos.
18756
18757 @item -fdump-rtl-ce1
18758 @itemx -fdump-rtl-ce2
18759 @itemx -fdump-rtl-ce3
18760 @opindex fdump-rtl-ce1
18761 @opindex fdump-rtl-ce2
18762 @opindex fdump-rtl-ce3
18763 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
18764 @option{-fdump-rtl-ce3} enable dumping after the three
18765 if conversion passes.
18766
18767 @item -fdump-rtl-cprop_hardreg
18768 @opindex fdump-rtl-cprop_hardreg
18769 Dump after hard register copy propagation.
18770
18771 @item -fdump-rtl-csa
18772 @opindex fdump-rtl-csa
18773 Dump after combining stack adjustments.
18774
18775 @item -fdump-rtl-cse1
18776 @itemx -fdump-rtl-cse2
18777 @opindex fdump-rtl-cse1
18778 @opindex fdump-rtl-cse2
18779 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
18780 the two common subexpression elimination passes.
18781
18782 @item -fdump-rtl-dce
18783 @opindex fdump-rtl-dce
18784 Dump after the standalone dead code elimination passes.
18785
18786 @item -fdump-rtl-dbr
18787 @opindex fdump-rtl-dbr
18788 Dump after delayed branch scheduling.
18789
18790 @item -fdump-rtl-dce1
18791 @itemx -fdump-rtl-dce2
18792 @opindex fdump-rtl-dce1
18793 @opindex fdump-rtl-dce2
18794 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
18795 the two dead store elimination passes.
18796
18797 @item -fdump-rtl-eh
18798 @opindex fdump-rtl-eh
18799 Dump after finalization of EH handling code.
18800
18801 @item -fdump-rtl-eh_ranges
18802 @opindex fdump-rtl-eh_ranges
18803 Dump after conversion of EH handling range regions.
18804
18805 @item -fdump-rtl-expand
18806 @opindex fdump-rtl-expand
18807 Dump after RTL generation.
18808
18809 @item -fdump-rtl-fwprop1
18810 @itemx -fdump-rtl-fwprop2
18811 @opindex fdump-rtl-fwprop1
18812 @opindex fdump-rtl-fwprop2
18813 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
18814 dumping after the two forward propagation passes.
18815
18816 @item -fdump-rtl-gcse1
18817 @itemx -fdump-rtl-gcse2
18818 @opindex fdump-rtl-gcse1
18819 @opindex fdump-rtl-gcse2
18820 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
18821 after global common subexpression elimination.
18822
18823 @item -fdump-rtl-init-regs
18824 @opindex fdump-rtl-init-regs
18825 Dump after the initialization of the registers.
18826
18827 @item -fdump-rtl-initvals
18828 @opindex fdump-rtl-initvals
18829 Dump after the computation of the initial value sets.
18830
18831 @item -fdump-rtl-into_cfglayout
18832 @opindex fdump-rtl-into_cfglayout
18833 Dump after converting to cfglayout mode.
18834
18835 @item -fdump-rtl-ira
18836 @opindex fdump-rtl-ira
18837 Dump after iterated register allocation.
18838
18839 @item -fdump-rtl-jump
18840 @opindex fdump-rtl-jump
18841 Dump after the second jump optimization.
18842
18843 @item -fdump-rtl-loop2
18844 @opindex fdump-rtl-loop2
18845 @option{-fdump-rtl-loop2} enables dumping after the rtl
18846 loop optimization passes.
18847
18848 @item -fdump-rtl-mach
18849 @opindex fdump-rtl-mach
18850 Dump after performing the machine dependent reorganization pass, if that
18851 pass exists.
18852
18853 @item -fdump-rtl-mode_sw
18854 @opindex fdump-rtl-mode_sw
18855 Dump after removing redundant mode switches.
18856
18857 @item -fdump-rtl-rnreg
18858 @opindex fdump-rtl-rnreg
18859 Dump after register renumbering.
18860
18861 @item -fdump-rtl-outof_cfglayout
18862 @opindex fdump-rtl-outof_cfglayout
18863 Dump after converting from cfglayout mode.
18864
18865 @item -fdump-rtl-peephole2
18866 @opindex fdump-rtl-peephole2
18867 Dump after the peephole pass.
18868
18869 @item -fdump-rtl-postreload
18870 @opindex fdump-rtl-postreload
18871 Dump after post-reload optimizations.
18872
18873 @item -fdump-rtl-pro_and_epilogue
18874 @opindex fdump-rtl-pro_and_epilogue
18875 Dump after generating the function prologues and epilogues.
18876
18877 @item -fdump-rtl-sched1
18878 @itemx -fdump-rtl-sched2
18879 @opindex fdump-rtl-sched1
18880 @opindex fdump-rtl-sched2
18881 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
18882 after the basic block scheduling passes.
18883
18884 @item -fdump-rtl-ree
18885 @opindex fdump-rtl-ree
18886 Dump after sign/zero extension elimination.
18887
18888 @item -fdump-rtl-seqabstr
18889 @opindex fdump-rtl-seqabstr
18890 Dump after common sequence discovery.
18891
18892 @item -fdump-rtl-shorten
18893 @opindex fdump-rtl-shorten
18894 Dump after shortening branches.
18895
18896 @item -fdump-rtl-sibling
18897 @opindex fdump-rtl-sibling
18898 Dump after sibling call optimizations.
18899
18900 @item -fdump-rtl-split1
18901 @itemx -fdump-rtl-split2
18902 @itemx -fdump-rtl-split3
18903 @itemx -fdump-rtl-split4
18904 @itemx -fdump-rtl-split5
18905 @opindex fdump-rtl-split1
18906 @opindex fdump-rtl-split2
18907 @opindex fdump-rtl-split3
18908 @opindex fdump-rtl-split4
18909 @opindex fdump-rtl-split5
18910 These options enable dumping after five rounds of
18911 instruction splitting.
18912
18913 @item -fdump-rtl-sms
18914 @opindex fdump-rtl-sms
18915 Dump after modulo scheduling. This pass is only run on some
18916 architectures.
18917
18918 @item -fdump-rtl-stack
18919 @opindex fdump-rtl-stack
18920 Dump after conversion from GCC's ``flat register file'' registers to the
18921 x87's stack-like registers. This pass is only run on x86 variants.
18922
18923 @item -fdump-rtl-subreg1
18924 @itemx -fdump-rtl-subreg2
18925 @opindex fdump-rtl-subreg1
18926 @opindex fdump-rtl-subreg2
18927 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
18928 the two subreg expansion passes.
18929
18930 @item -fdump-rtl-unshare
18931 @opindex fdump-rtl-unshare
18932 Dump after all rtl has been unshared.
18933
18934 @item -fdump-rtl-vartrack
18935 @opindex fdump-rtl-vartrack
18936 Dump after variable tracking.
18937
18938 @item -fdump-rtl-vregs
18939 @opindex fdump-rtl-vregs
18940 Dump after converting virtual registers to hard registers.
18941
18942 @item -fdump-rtl-web
18943 @opindex fdump-rtl-web
18944 Dump after live range splitting.
18945
18946 @item -fdump-rtl-regclass
18947 @itemx -fdump-rtl-subregs_of_mode_init
18948 @itemx -fdump-rtl-subregs_of_mode_finish
18949 @itemx -fdump-rtl-dfinit
18950 @itemx -fdump-rtl-dfinish
18951 @opindex fdump-rtl-regclass
18952 @opindex fdump-rtl-subregs_of_mode_init
18953 @opindex fdump-rtl-subregs_of_mode_finish
18954 @opindex fdump-rtl-dfinit
18955 @opindex fdump-rtl-dfinish
18956 These dumps are defined but always produce empty files.
18957
18958 @item -da
18959 @itemx -fdump-rtl-all
18960 @opindex da
18961 @opindex fdump-rtl-all
18962 Produce all the dumps listed above.
18963
18964 @item -dA
18965 @opindex dA
18966 Annotate the assembler output with miscellaneous debugging information.
18967
18968 @item -dD
18969 @opindex dD
18970 Dump all macro definitions, at the end of preprocessing, in addition to
18971 normal output.
18972
18973 @item -dH
18974 @opindex dH
18975 Produce a core dump whenever an error occurs.
18976
18977 @item -dp
18978 @opindex dp
18979 Annotate the assembler output with a comment indicating which
18980 pattern and alternative is used. The length and cost of each instruction are
18981 also printed.
18982
18983 @item -dP
18984 @opindex dP
18985 Dump the RTL in the assembler output as a comment before each instruction.
18986 Also turns on @option{-dp} annotation.
18987
18988 @item -dx
18989 @opindex dx
18990 Just generate RTL for a function instead of compiling it. Usually used
18991 with @option{-fdump-rtl-expand}.
18992 @end table
18993
18994 @item -fdump-debug
18995 @opindex fdump-debug
18996 Dump debugging information generated during the debug
18997 generation phase.
18998
18999 @item -fdump-earlydebug
19000 @opindex fdump-earlydebug
19001 Dump debugging information generated during the early debug
19002 generation phase.
19003
19004 @item -fdump-noaddr
19005 @opindex fdump-noaddr
19006 When doing debugging dumps, suppress address output. This makes it more
19007 feasible to use diff on debugging dumps for compiler invocations with
19008 different compiler binaries and/or different
19009 text / bss / data / heap / stack / dso start locations.
19010
19011 @item -freport-bug
19012 @opindex freport-bug
19013 Collect and dump debug information into a temporary file if an
19014 internal compiler error (ICE) occurs.
19015
19016 @item -fdump-unnumbered
19017 @opindex fdump-unnumbered
19018 When doing debugging dumps, suppress instruction numbers and address output.
19019 This makes it more feasible to use diff on debugging dumps for compiler
19020 invocations with different options, in particular with and without
19021 @option{-g}.
19022
19023 @item -fdump-unnumbered-links
19024 @opindex fdump-unnumbered-links
19025 When doing debugging dumps (see @option{-d} option above), suppress
19026 instruction numbers for the links to the previous and next instructions
19027 in a sequence.
19028
19029 @item -fdump-ipa-@var{switch}
19030 @itemx -fdump-ipa-@var{switch}-@var{options}
19031 @opindex fdump-ipa
19032 Control the dumping at various stages of inter-procedural analysis
19033 language tree to a file. The file name is generated by appending a
19034 switch specific suffix to the source file name, and the file is created
19035 in the same directory as the output file. The following dumps are
19036 possible:
19037
19038 @table @samp
19039 @item all
19040 Enables all inter-procedural analysis dumps.
19041
19042 @item cgraph
19043 Dumps information about call-graph optimization, unused function removal,
19044 and inlining decisions.
19045
19046 @item inline
19047 Dump after function inlining.
19048
19049 @end table
19050
19051 Additionally, the options @option{-optimized}, @option{-missed},
19052 @option{-note}, and @option{-all} can be provided, with the same meaning
19053 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19054
19055 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19056 information on callsites that were inlined, along with callsites
19057 that were not inlined.
19058
19059 By default, the dump will contain messages about successful
19060 optimizations (equivalent to @option{-optimized}) together with
19061 low-level details about the analysis.
19062
19063 @item -fdump-lang
19064 @opindex fdump-lang
19065 Dump language-specific information. The file name is made by appending
19066 @file{.lang} to the source file name.
19067
19068 @item -fdump-lang-all
19069 @itemx -fdump-lang-@var{switch}
19070 @itemx -fdump-lang-@var{switch}-@var{options}
19071 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19072 @opindex fdump-lang-all
19073 @opindex fdump-lang
19074 Control the dumping of language-specific information. The @var{options}
19075 and @var{filename} portions behave as described in the
19076 @option{-fdump-tree} option. The following @var{switch} values are
19077 accepted:
19078
19079 @table @samp
19080 @item all
19081
19082 Enable all language-specific dumps.
19083
19084 @item class
19085 Dump class hierarchy information. Virtual table information is emitted
19086 unless '@option{slim}' is specified. This option is applicable to C++ only.
19087
19088 @item module
19089 Dump module information. Options @option{lineno} (locations),
19090 @option{graph} (reachability), @option{blocks} (clusters),
19091 @option{uid} (serialization), @option{alias} (mergeable),
19092 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19093 (macros) may provide additional information. This option is
19094 applicable to C++ only.
19095
19096 @item raw
19097 Dump the raw internal tree data. This option is applicable to C++ only.
19098
19099 @end table
19100
19101 @item -fdump-passes
19102 @opindex fdump-passes
19103 Print on @file{stderr} the list of optimization passes that are turned
19104 on and off by the current command-line options.
19105
19106 @item -fdump-statistics-@var{option}
19107 @opindex fdump-statistics
19108 Enable and control dumping of pass statistics in a separate file. The
19109 file name is generated by appending a suffix ending in
19110 @samp{.statistics} to the source file name, and the file is created in
19111 the same directory as the output file. If the @samp{-@var{option}}
19112 form is used, @samp{-stats} causes counters to be summed over the
19113 whole compilation unit while @samp{-details} dumps every event as
19114 the passes generate them. The default with no option is to sum
19115 counters for each function compiled.
19116
19117 @item -fdump-tree-all
19118 @itemx -fdump-tree-@var{switch}
19119 @itemx -fdump-tree-@var{switch}-@var{options}
19120 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19121 @opindex fdump-tree-all
19122 @opindex fdump-tree
19123 Control the dumping at various stages of processing the intermediate
19124 language tree to a file. If the @samp{-@var{options}}
19125 form is used, @var{options} is a list of @samp{-} separated options
19126 which control the details of the dump. Not all options are applicable
19127 to all dumps; those that are not meaningful are ignored. The
19128 following options are available
19129
19130 @table @samp
19131 @item address
19132 Print the address of each node. Usually this is not meaningful as it
19133 changes according to the environment and source file. Its primary use
19134 is for tying up a dump file with a debug environment.
19135 @item asmname
19136 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19137 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
19138 use working backward from mangled names in the assembly file.
19139 @item slim
19140 When dumping front-end intermediate representations, inhibit dumping
19141 of members of a scope or body of a function merely because that scope
19142 has been reached. Only dump such items when they are directly reachable
19143 by some other path.
19144
19145 When dumping pretty-printed trees, this option inhibits dumping the
19146 bodies of control structures.
19147
19148 When dumping RTL, print the RTL in slim (condensed) form instead of
19149 the default LISP-like representation.
19150 @item raw
19151 Print a raw representation of the tree. By default, trees are
19152 pretty-printed into a C-like representation.
19153 @item details
19154 Enable more detailed dumps (not honored by every dump option). Also
19155 include information from the optimization passes.
19156 @item stats
19157 Enable dumping various statistics about the pass (not honored by every dump
19158 option).
19159 @item blocks
19160 Enable showing basic block boundaries (disabled in raw dumps).
19161 @item graph
19162 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19163 dump a representation of the control flow graph suitable for viewing with
19164 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
19165 the file is pretty-printed as a subgraph, so that GraphViz can render them
19166 all in a single plot.
19167
19168 This option currently only works for RTL dumps, and the RTL is always
19169 dumped in slim form.
19170 @item vops
19171 Enable showing virtual operands for every statement.
19172 @item lineno
19173 Enable showing line numbers for statements.
19174 @item uid
19175 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19176 @item verbose
19177 Enable showing the tree dump for each statement.
19178 @item eh
19179 Enable showing the EH region number holding each statement.
19180 @item scev
19181 Enable showing scalar evolution analysis details.
19182 @item optimized
19183 Enable showing optimization information (only available in certain
19184 passes).
19185 @item missed
19186 Enable showing missed optimization information (only available in certain
19187 passes).
19188 @item note
19189 Enable other detailed optimization information (only available in
19190 certain passes).
19191 @item all
19192 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19193 and @option{lineno}.
19194 @item optall
19195 Turn on all optimization options, i.e., @option{optimized},
19196 @option{missed}, and @option{note}.
19197 @end table
19198
19199 To determine what tree dumps are available or find the dump for a pass
19200 of interest follow the steps below.
19201
19202 @enumerate
19203 @item
19204 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19205 look for a code that corresponds to the pass you are interested in.
19206 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19207 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19208 The number at the end distinguishes distinct invocations of the same pass.
19209 @item
19210 To enable the creation of the dump file, append the pass code to
19211 the @option{-fdump-} option prefix and invoke GCC with it. For example,
19212 to enable the dump from the Early Value Range Propagation pass, invoke
19213 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
19214 specify the name of the dump file. If you don't specify one, GCC
19215 creates as described below.
19216 @item
19217 Find the pass dump in a file whose name is composed of three components
19218 separated by a period: the name of the source file GCC was invoked to
19219 compile, a numeric suffix indicating the pass number followed by the
19220 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19221 and finally the pass code. For example, the Early VRP pass dump might
19222 be in a file named @file{myfile.c.038t.evrp} in the current working
19223 directory. Note that the numeric codes are not stable and may change
19224 from one version of GCC to another.
19225 @end enumerate
19226
19227 @item -fopt-info
19228 @itemx -fopt-info-@var{options}
19229 @itemx -fopt-info-@var{options}=@var{filename}
19230 @opindex fopt-info
19231 Controls optimization dumps from various optimization passes. If the
19232 @samp{-@var{options}} form is used, @var{options} is a list of
19233 @samp{-} separated option keywords to select the dump details and
19234 optimizations.
19235
19236 The @var{options} can be divided into three groups:
19237 @enumerate
19238 @item
19239 options describing what kinds of messages should be emitted,
19240 @item
19241 options describing the verbosity of the dump, and
19242 @item
19243 options describing which optimizations should be included.
19244 @end enumerate
19245 The options from each group can be freely mixed as they are
19246 non-overlapping. However, in case of any conflicts,
19247 the later options override the earlier options on the command
19248 line.
19249
19250 The following options control which kinds of messages should be emitted:
19251
19252 @table @samp
19253 @item optimized
19254 Print information when an optimization is successfully applied. It is
19255 up to a pass to decide which information is relevant. For example, the
19256 vectorizer passes print the source location of loops which are
19257 successfully vectorized.
19258 @item missed
19259 Print information about missed optimizations. Individual passes
19260 control which information to include in the output.
19261 @item note
19262 Print verbose information about optimizations, such as certain
19263 transformations, more detailed messages about decisions etc.
19264 @item all
19265 Print detailed optimization information. This includes
19266 @samp{optimized}, @samp{missed}, and @samp{note}.
19267 @end table
19268
19269 The following option controls the dump verbosity:
19270
19271 @table @samp
19272 @item internals
19273 By default, only ``high-level'' messages are emitted. This option enables
19274 additional, more detailed, messages, which are likely to only be of interest
19275 to GCC developers.
19276 @end table
19277
19278 One or more of the following option keywords can be used to describe a
19279 group of optimizations:
19280
19281 @table @samp
19282 @item ipa
19283 Enable dumps from all interprocedural optimizations.
19284 @item loop
19285 Enable dumps from all loop optimizations.
19286 @item inline
19287 Enable dumps from all inlining optimizations.
19288 @item omp
19289 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19290 @item vec
19291 Enable dumps from all vectorization optimizations.
19292 @item optall
19293 Enable dumps from all optimizations. This is a superset of
19294 the optimization groups listed above.
19295 @end table
19296
19297 If @var{options} is
19298 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19299 about successful optimizations from all the passes, omitting messages
19300 that are treated as ``internals''.
19301
19302 If the @var{filename} is provided, then the dumps from all the
19303 applicable optimizations are concatenated into the @var{filename}.
19304 Otherwise the dump is output onto @file{stderr}. Though multiple
19305 @option{-fopt-info} options are accepted, only one of them can include
19306 a @var{filename}. If other filenames are provided then all but the
19307 first such option are ignored.
19308
19309 Note that the output @var{filename} is overwritten
19310 in case of multiple translation units. If a combined output from
19311 multiple translation units is desired, @file{stderr} should be used
19312 instead.
19313
19314 In the following example, the optimization info is output to
19315 @file{stderr}:
19316
19317 @smallexample
19318 gcc -O3 -fopt-info
19319 @end smallexample
19320
19321 This example:
19322 @smallexample
19323 gcc -O3 -fopt-info-missed=missed.all
19324 @end smallexample
19325
19326 @noindent
19327 outputs missed optimization report from all the passes into
19328 @file{missed.all}, and this one:
19329
19330 @smallexample
19331 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19332 @end smallexample
19333
19334 @noindent
19335 prints information about missed optimization opportunities from
19336 vectorization passes on @file{stderr}.
19337 Note that @option{-fopt-info-vec-missed} is equivalent to
19338 @option{-fopt-info-missed-vec}. The order of the optimization group
19339 names and message types listed after @option{-fopt-info} does not matter.
19340
19341 As another example,
19342 @smallexample
19343 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19344 @end smallexample
19345
19346 @noindent
19347 outputs information about missed optimizations as well as
19348 optimized locations from all the inlining passes into
19349 @file{inline.txt}.
19350
19351 Finally, consider:
19352
19353 @smallexample
19354 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19355 @end smallexample
19356
19357 @noindent
19358 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19359 in conflict since only one output file is allowed. In this case, only
19360 the first option takes effect and the subsequent options are
19361 ignored. Thus only @file{vec.miss} is produced which contains
19362 dumps from the vectorizer about missed opportunities.
19363
19364 @item -fsave-optimization-record
19365 @opindex fsave-optimization-record
19366 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19367 were performed, for those optimizations that support @option{-fopt-info}.
19368
19369 This option is experimental and the format of the data within the
19370 compressed JSON file is subject to change.
19371
19372 It is roughly equivalent to a machine-readable version of
19373 @option{-fopt-info-all}, as a collection of messages with source file,
19374 line number and column number, with the following additional data for
19375 each message:
19376
19377 @itemize @bullet
19378
19379 @item
19380 the execution count of the code being optimized, along with metadata about
19381 whether this was from actual profile data, or just an estimate, allowing
19382 consumers to prioritize messages by code hotness,
19383
19384 @item
19385 the function name of the code being optimized, where applicable,
19386
19387 @item
19388 the ``inlining chain'' for the code being optimized, so that when
19389 a function is inlined into several different places (which might
19390 themselves be inlined), the reader can distinguish between the copies,
19391
19392 @item
19393 objects identifying those parts of the message that refer to expressions,
19394 statements or symbol-table nodes, which of these categories they are, and,
19395 when available, their source code location,
19396
19397 @item
19398 the GCC pass that emitted the message, and
19399
19400 @item
19401 the location in GCC's own code from which the message was emitted
19402
19403 @end itemize
19404
19405 Additionally, some messages are logically nested within other
19406 messages, reflecting implementation details of the optimization
19407 passes.
19408
19409 @item -fsched-verbose=@var{n}
19410 @opindex fsched-verbose
19411 On targets that use instruction scheduling, this option controls the
19412 amount of debugging output the scheduler prints to the dump files.
19413
19414 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19415 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19416 For @var{n} greater than one, it also output basic block probabilities,
19417 detailed ready list information and unit/insn info. For @var{n} greater
19418 than two, it includes RTL at abort point, control-flow and regions info.
19419 And for @var{n} over four, @option{-fsched-verbose} also includes
19420 dependence info.
19421
19422
19423
19424 @item -fenable-@var{kind}-@var{pass}
19425 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
19426 @opindex fdisable-
19427 @opindex fenable-
19428
19429 This is a set of options that are used to explicitly disable/enable
19430 optimization passes. These options are intended for use for debugging GCC.
19431 Compiler users should use regular options for enabling/disabling
19432 passes instead.
19433
19434 @table @gcctabopt
19435
19436 @item -fdisable-ipa-@var{pass}
19437 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
19438 statically invoked in the compiler multiple times, the pass name should be
19439 appended with a sequential number starting from 1.
19440
19441 @item -fdisable-rtl-@var{pass}
19442 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
19443 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
19444 statically invoked in the compiler multiple times, the pass name should be
19445 appended with a sequential number starting from 1. @var{range-list} is a
19446 comma-separated list of function ranges or assembler names. Each range is a number
19447 pair separated by a colon. The range is inclusive in both ends. If the range
19448 is trivial, the number pair can be simplified as a single number. If the
19449 function's call graph node's @var{uid} falls within one of the specified ranges,
19450 the @var{pass} is disabled for that function. The @var{uid} is shown in the
19451 function header of a dump file, and the pass names can be dumped by using
19452 option @option{-fdump-passes}.
19453
19454 @item -fdisable-tree-@var{pass}
19455 @itemx -fdisable-tree-@var{pass}=@var{range-list}
19456 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
19457 option arguments.
19458
19459 @item -fenable-ipa-@var{pass}
19460 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
19461 statically invoked in the compiler multiple times, the pass name should be
19462 appended with a sequential number starting from 1.
19463
19464 @item -fenable-rtl-@var{pass}
19465 @itemx -fenable-rtl-@var{pass}=@var{range-list}
19466 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
19467 description and examples.
19468
19469 @item -fenable-tree-@var{pass}
19470 @itemx -fenable-tree-@var{pass}=@var{range-list}
19471 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
19472 of option arguments.
19473
19474 @end table
19475
19476 Here are some examples showing uses of these options.
19477
19478 @smallexample
19479
19480 # disable ccp1 for all functions
19481 -fdisable-tree-ccp1
19482 # disable complete unroll for function whose cgraph node uid is 1
19483 -fenable-tree-cunroll=1
19484 # disable gcse2 for functions at the following ranges [1,1],
19485 # [300,400], and [400,1000]
19486 # disable gcse2 for functions foo and foo2
19487 -fdisable-rtl-gcse2=foo,foo2
19488 # disable early inlining
19489 -fdisable-tree-einline
19490 # disable ipa inlining
19491 -fdisable-ipa-inline
19492 # enable tree full unroll
19493 -fenable-tree-unroll
19494
19495 @end smallexample
19496
19497 @item -fchecking
19498 @itemx -fchecking=@var{n}
19499 @opindex fchecking
19500 @opindex fno-checking
19501 Enable internal consistency checking. The default depends on
19502 the compiler configuration. @option{-fchecking=2} enables further
19503 internal consistency checking that might affect code generation.
19504
19505 @item -frandom-seed=@var{string}
19506 @opindex frandom-seed
19507 This option provides a seed that GCC uses in place of
19508 random numbers in generating certain symbol names
19509 that have to be different in every compiled file. It is also used to
19510 place unique stamps in coverage data files and the object files that
19511 produce them. You can use the @option{-frandom-seed} option to produce
19512 reproducibly identical object files.
19513
19514 The @var{string} can either be a number (decimal, octal or hex) or an
19515 arbitrary string (in which case it's converted to a number by
19516 computing CRC32).
19517
19518 The @var{string} should be different for every file you compile.
19519
19520 @item -save-temps
19521 @opindex save-temps
19522 Store the usual ``temporary'' intermediate files permanently; name them
19523 as auxiliary output files, as specified described under
19524 @option{-dumpbase} and @option{-dumpdir}.
19525
19526 When used in combination with the @option{-x} command-line option,
19527 @option{-save-temps} is sensible enough to avoid overwriting an
19528 input source file with the same extension as an intermediate file.
19529 The corresponding intermediate file may be obtained by renaming the
19530 source file before using @option{-save-temps}.
19531
19532 @item -save-temps=cwd
19533 @opindex save-temps=cwd
19534 Equivalent to @option{-save-temps -dumpdir ./}.
19535
19536 @item -save-temps=obj
19537 @opindex save-temps=obj
19538 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
19539 @file{outdir/} is the directory of the output file specified after the
19540 @option{-o} option, including any directory separators. If the
19541 @option{-o} option is not used, the @option{-save-temps=obj} switch
19542 behaves like @option{-save-temps=cwd}.
19543
19544 @item -time@r{[}=@var{file}@r{]}
19545 @opindex time
19546 Report the CPU time taken by each subprocess in the compilation
19547 sequence. For C source files, this is the compiler proper and assembler
19548 (plus the linker if linking is done).
19549
19550 Without the specification of an output file, the output looks like this:
19551
19552 @smallexample
19553 # cc1 0.12 0.01
19554 # as 0.00 0.01
19555 @end smallexample
19556
19557 The first number on each line is the ``user time'', that is time spent
19558 executing the program itself. The second number is ``system time'',
19559 time spent executing operating system routines on behalf of the program.
19560 Both numbers are in seconds.
19561
19562 With the specification of an output file, the output is appended to the
19563 named file, and it looks like this:
19564
19565 @smallexample
19566 0.12 0.01 cc1 @var{options}
19567 0.00 0.01 as @var{options}
19568 @end smallexample
19569
19570 The ``user time'' and the ``system time'' are moved before the program
19571 name, and the options passed to the program are displayed, so that one
19572 can later tell what file was being compiled, and with which options.
19573
19574 @item -fdump-final-insns@r{[}=@var{file}@r{]}
19575 @opindex fdump-final-insns
19576 Dump the final internal representation (RTL) to @var{file}. If the
19577 optional argument is omitted (or if @var{file} is @code{.}), the name
19578 of the dump file is determined by appending @code{.gkd} to the
19579 dump base name, see @option{-dumpbase}.
19580
19581 @item -fcompare-debug@r{[}=@var{opts}@r{]}
19582 @opindex fcompare-debug
19583 @opindex fno-compare-debug
19584 If no error occurs during compilation, run the compiler a second time,
19585 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
19586 passed to the second compilation. Dump the final internal
19587 representation in both compilations, and print an error if they differ.
19588
19589 If the equal sign is omitted, the default @option{-gtoggle} is used.
19590
19591 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
19592 and nonzero, implicitly enables @option{-fcompare-debug}. If
19593 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
19594 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
19595 is used.
19596
19597 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
19598 is equivalent to @option{-fno-compare-debug}, which disables the dumping
19599 of the final representation and the second compilation, preventing even
19600 @env{GCC_COMPARE_DEBUG} from taking effect.
19601
19602 To verify full coverage during @option{-fcompare-debug} testing, set
19603 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
19604 which GCC rejects as an invalid option in any actual compilation
19605 (rather than preprocessing, assembly or linking). To get just a
19606 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
19607 not overridden} will do.
19608
19609 @item -fcompare-debug-second
19610 @opindex fcompare-debug-second
19611 This option is implicitly passed to the compiler for the second
19612 compilation requested by @option{-fcompare-debug}, along with options to
19613 silence warnings, and omitting other options that would cause the compiler
19614 to produce output to files or to standard output as a side effect. Dump
19615 files and preserved temporary files are renamed so as to contain the
19616 @code{.gk} additional extension during the second compilation, to avoid
19617 overwriting those generated by the first.
19618
19619 When this option is passed to the compiler driver, it causes the
19620 @emph{first} compilation to be skipped, which makes it useful for little
19621 other than debugging the compiler proper.
19622
19623 @item -gtoggle
19624 @opindex gtoggle
19625 Turn off generation of debug info, if leaving out this option
19626 generates it, or turn it on at level 2 otherwise. The position of this
19627 argument in the command line does not matter; it takes effect after all
19628 other options are processed, and it does so only once, no matter how
19629 many times it is given. This is mainly intended to be used with
19630 @option{-fcompare-debug}.
19631
19632 @item -fvar-tracking-assignments-toggle
19633 @opindex fvar-tracking-assignments-toggle
19634 @opindex fno-var-tracking-assignments-toggle
19635 Toggle @option{-fvar-tracking-assignments}, in the same way that
19636 @option{-gtoggle} toggles @option{-g}.
19637
19638 @item -Q
19639 @opindex Q
19640 Makes the compiler print out each function name as it is compiled, and
19641 print some statistics about each pass when it finishes.
19642
19643 @item -ftime-report
19644 @opindex ftime-report
19645 Makes the compiler print some statistics about the time consumed by each
19646 pass when it finishes.
19647
19648 @item -ftime-report-details
19649 @opindex ftime-report-details
19650 Record the time consumed by infrastructure parts separately for each pass.
19651
19652 @item -fira-verbose=@var{n}
19653 @opindex fira-verbose
19654 Control the verbosity of the dump file for the integrated register allocator.
19655 The default value is 5. If the value @var{n} is greater or equal to 10,
19656 the dump output is sent to stderr using the same format as @var{n} minus 10.
19657
19658 @item -flto-report
19659 @opindex flto-report
19660 Prints a report with internal details on the workings of the link-time
19661 optimizer. The contents of this report vary from version to version.
19662 It is meant to be useful to GCC developers when processing object
19663 files in LTO mode (via @option{-flto}).
19664
19665 Disabled by default.
19666
19667 @item -flto-report-wpa
19668 @opindex flto-report-wpa
19669 Like @option{-flto-report}, but only print for the WPA phase of link-time
19670 optimization.
19671
19672 @item -fmem-report
19673 @opindex fmem-report
19674 Makes the compiler print some statistics about permanent memory
19675 allocation when it finishes.
19676
19677 @item -fmem-report-wpa
19678 @opindex fmem-report-wpa
19679 Makes the compiler print some statistics about permanent memory
19680 allocation for the WPA phase only.
19681
19682 @item -fpre-ipa-mem-report
19683 @opindex fpre-ipa-mem-report
19684 @item -fpost-ipa-mem-report
19685 @opindex fpost-ipa-mem-report
19686 Makes the compiler print some statistics about permanent memory
19687 allocation before or after interprocedural optimization.
19688
19689 @item -fmultiflags
19690 @opindex fmultiflags
19691 This option enables multilib-aware @code{TFLAGS} to be used to build
19692 target libraries with options different from those the compiler is
19693 configured to use by default, through the use of specs (@xref{Spec
19694 Files}) set up by compiler internals, by the target, or by builders at
19695 configure time.
19696
19697 Like @code{TFLAGS}, this allows the target libraries to be built for
19698 portable baseline environments, while the compiler defaults to more
19699 demanding ones. That's useful because users can easily override the
19700 defaults the compiler is configured to use to build their own programs,
19701 if the defaults are not ideal for their target environment, whereas
19702 rebuilding the runtime libraries is usually not as easy or desirable.
19703
19704 Unlike @code{TFLAGS}, the use of specs enables different flags to be
19705 selected for different multilibs. The way to accomplish that is to
19706 build with @samp{make TFLAGS=-fmultiflags}, after configuring
19707 @samp{--with-specs=%@{fmultiflags:...@}}.
19708
19709 This option is discarded by the driver once it's done processing driver
19710 self spec.
19711
19712 It is also useful to check that @code{TFLAGS} are being used to build
19713 all target libraries, by configuring a non-bootstrap compiler
19714 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
19715 the compiler and target libraries.
19716
19717 @item -fprofile-report
19718 @opindex fprofile-report
19719 Makes the compiler print some statistics about consistency of the
19720 (estimated) profile and effect of individual passes.
19721
19722 @item -fstack-usage
19723 @opindex fstack-usage
19724 Makes the compiler output stack usage information for the program, on a
19725 per-function basis. The filename for the dump is made by appending
19726 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
19727 the output file, if explicitly specified and it is not an executable,
19728 otherwise it is the basename of the source file. An entry is made up
19729 of three fields:
19730
19731 @itemize
19732 @item
19733 The name of the function.
19734 @item
19735 A number of bytes.
19736 @item
19737 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
19738 @end itemize
19739
19740 The qualifier @code{static} means that the function manipulates the stack
19741 statically: a fixed number of bytes are allocated for the frame on function
19742 entry and released on function exit; no stack adjustments are otherwise made
19743 in the function. The second field is this fixed number of bytes.
19744
19745 The qualifier @code{dynamic} means that the function manipulates the stack
19746 dynamically: in addition to the static allocation described above, stack
19747 adjustments are made in the body of the function, for example to push/pop
19748 arguments around function calls. If the qualifier @code{bounded} is also
19749 present, the amount of these adjustments is bounded at compile time and
19750 the second field is an upper bound of the total amount of stack used by
19751 the function. If it is not present, the amount of these adjustments is
19752 not bounded at compile time and the second field only represents the
19753 bounded part.
19754
19755 @item -fstats
19756 @opindex fstats
19757 Emit statistics about front-end processing at the end of the compilation.
19758 This option is supported only by the C++ front end, and
19759 the information is generally only useful to the G++ development team.
19760
19761 @item -fdbg-cnt-list
19762 @opindex fdbg-cnt-list
19763 Print the name and the counter upper bound for all debug counters.
19764
19765
19766 @item -fdbg-cnt=@var{counter-value-list}
19767 @opindex fdbg-cnt
19768 Set the internal debug counter lower and upper bound. @var{counter-value-list}
19769 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
19770 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
19771 the name of the counter and list of closed intervals.
19772 The @var{lower_bound} is optional and is zero
19773 initialized if not set.
19774 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
19775 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
19776 eleventh invocation.
19777 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
19778
19779 @item -print-file-name=@var{library}
19780 @opindex print-file-name
19781 Print the full absolute name of the library file @var{library} that
19782 would be used when linking---and don't do anything else. With this
19783 option, GCC does not compile or link anything; it just prints the
19784 file name.
19785
19786 @item -print-multi-directory
19787 @opindex print-multi-directory
19788 Print the directory name corresponding to the multilib selected by any
19789 other switches present in the command line. This directory is supposed
19790 to exist in @env{GCC_EXEC_PREFIX}.
19791
19792 @item -print-multi-lib
19793 @opindex print-multi-lib
19794 Print the mapping from multilib directory names to compiler switches
19795 that enable them. The directory name is separated from the switches by
19796 @samp{;}, and each switch starts with an @samp{@@} instead of the
19797 @samp{-}, without spaces between multiple switches. This is supposed to
19798 ease shell processing.
19799
19800 @item -print-multi-os-directory
19801 @opindex print-multi-os-directory
19802 Print the path to OS libraries for the selected
19803 multilib, relative to some @file{lib} subdirectory. If OS libraries are
19804 present in the @file{lib} subdirectory and no multilibs are used, this is
19805 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
19806 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
19807 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
19808 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
19809
19810 @item -print-multiarch
19811 @opindex print-multiarch
19812 Print the path to OS libraries for the selected multiarch,
19813 relative to some @file{lib} subdirectory.
19814
19815 @item -print-prog-name=@var{program}
19816 @opindex print-prog-name
19817 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
19818
19819 @item -print-libgcc-file-name
19820 @opindex print-libgcc-file-name
19821 Same as @option{-print-file-name=libgcc.a}.
19822
19823 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
19824 but you do want to link with @file{libgcc.a}. You can do:
19825
19826 @smallexample
19827 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
19828 @end smallexample
19829
19830 @item -print-search-dirs
19831 @opindex print-search-dirs
19832 Print the name of the configured installation directory and a list of
19833 program and library directories @command{gcc} searches---and don't do anything else.
19834
19835 This is useful when @command{gcc} prints the error message
19836 @samp{installation problem, cannot exec cpp0: No such file or directory}.
19837 To resolve this you either need to put @file{cpp0} and the other compiler
19838 components where @command{gcc} expects to find them, or you can set the environment
19839 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
19840 Don't forget the trailing @samp{/}.
19841 @xref{Environment Variables}.
19842
19843 @item -print-sysroot
19844 @opindex print-sysroot
19845 Print the target sysroot directory that is used during
19846 compilation. This is the target sysroot specified either at configure
19847 time or using the @option{--sysroot} option, possibly with an extra
19848 suffix that depends on compilation options. If no target sysroot is
19849 specified, the option prints nothing.
19850
19851 @item -print-sysroot-headers-suffix
19852 @opindex print-sysroot-headers-suffix
19853 Print the suffix added to the target sysroot when searching for
19854 headers, or give an error if the compiler is not configured with such
19855 a suffix---and don't do anything else.
19856
19857 @item -dumpmachine
19858 @opindex dumpmachine
19859 Print the compiler's target machine (for example,
19860 @samp{i686-pc-linux-gnu})---and don't do anything else.
19861
19862 @item -dumpversion
19863 @opindex dumpversion
19864 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
19865 anything else. This is the compiler version used in filesystem paths and
19866 specs. Depending on how the compiler has been configured it can be just
19867 a single number (major version), two numbers separated by a dot (major and
19868 minor version) or three numbers separated by dots (major, minor and patchlevel
19869 version).
19870
19871 @item -dumpfullversion
19872 @opindex dumpfullversion
19873 Print the full compiler version---and don't do anything else. The output is
19874 always three numbers separated by dots, major, minor and patchlevel version.
19875
19876 @item -dumpspecs
19877 @opindex dumpspecs
19878 Print the compiler's built-in specs---and don't do anything else. (This
19879 is used when GCC itself is being built.) @xref{Spec Files}.
19880 @end table
19881
19882 @node Submodel Options
19883 @section Machine-Dependent Options
19884 @cindex submodel options
19885 @cindex specifying hardware config
19886 @cindex hardware models and configurations, specifying
19887 @cindex target-dependent options
19888 @cindex machine-dependent options
19889
19890 Each target machine supported by GCC can have its own options---for
19891 example, to allow you to compile for a particular processor variant or
19892 ABI, or to control optimizations specific to that machine. By
19893 convention, the names of machine-specific options start with
19894 @samp{-m}.
19895
19896 Some configurations of the compiler also support additional target-specific
19897 options, usually for compatibility with other compilers on the same
19898 platform.
19899
19900 @c This list is ordered alphanumerically by subsection name.
19901 @c It should be the same order and spelling as these options are listed
19902 @c in Machine Dependent Options
19903
19904 @menu
19905 * AArch64 Options::
19906 * Adapteva Epiphany Options::
19907 * AMD GCN Options::
19908 * ARC Options::
19909 * ARM Options::
19910 * AVR Options::
19911 * Blackfin Options::
19912 * C6X Options::
19913 * CRIS Options::
19914 * C-SKY Options::
19915 * Darwin Options::
19916 * DEC Alpha Options::
19917 * eBPF Options::
19918 * FR30 Options::
19919 * FT32 Options::
19920 * FRV Options::
19921 * GNU/Linux Options::
19922 * H8/300 Options::
19923 * HPPA Options::
19924 * IA-64 Options::
19925 * LM32 Options::
19926 * LoongArch Options::
19927 * M32C Options::
19928 * M32R/D Options::
19929 * M680x0 Options::
19930 * MCore Options::
19931 * MicroBlaze Options::
19932 * MIPS Options::
19933 * MMIX Options::
19934 * MN10300 Options::
19935 * Moxie Options::
19936 * MSP430 Options::
19937 * NDS32 Options::
19938 * Nios II Options::
19939 * Nvidia PTX Options::
19940 * OpenRISC Options::
19941 * PDP-11 Options::
19942 * PowerPC Options::
19943 * PRU Options::
19944 * RISC-V Options::
19945 * RL78 Options::
19946 * RS/6000 and PowerPC Options::
19947 * RX Options::
19948 * S/390 and zSeries Options::
19949 * SH Options::
19950 * Solaris 2 Options::
19951 * SPARC Options::
19952 * System V Options::
19953 * V850 Options::
19954 * VAX Options::
19955 * Visium Options::
19956 * VMS Options::
19957 * VxWorks Options::
19958 * x86 Options::
19959 * x86 Windows Options::
19960 * Xstormy16 Options::
19961 * Xtensa Options::
19962 * zSeries Options::
19963 @end menu
19964
19965 @node AArch64 Options
19966 @subsection AArch64 Options
19967 @cindex AArch64 Options
19968
19969 These options are defined for AArch64 implementations:
19970
19971 @table @gcctabopt
19972
19973 @item -mabi=@var{name}
19974 @opindex mabi
19975 Generate code for the specified data model. Permissible values
19976 are @samp{ilp32} for SysV-like data model where int, long int and pointers
19977 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
19978 but long int and pointers are 64 bits.
19979
19980 The default depends on the specific target configuration. Note that
19981 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
19982 entire program with the same ABI, and link with a compatible set of libraries.
19983
19984 @item -mbig-endian
19985 @opindex mbig-endian
19986 Generate big-endian code. This is the default when GCC is configured for an
19987 @samp{aarch64_be-*-*} target.
19988
19989 @item -mgeneral-regs-only
19990 @opindex mgeneral-regs-only
19991 Generate code which uses only the general-purpose registers. This will prevent
19992 the compiler from using floating-point and Advanced SIMD registers but will not
19993 impose any restrictions on the assembler.
19994
19995 @item -mlittle-endian
19996 @opindex mlittle-endian
19997 Generate little-endian code. This is the default when GCC is configured for an
19998 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
19999
20000 @item -mcmodel=tiny
20001 @opindex mcmodel=tiny
20002 Generate code for the tiny code model. The program and its statically defined
20003 symbols must be within 1MB of each other. Programs can be statically or
20004 dynamically linked.
20005
20006 @item -mcmodel=small
20007 @opindex mcmodel=small
20008 Generate code for the small code model. The program and its statically defined
20009 symbols must be within 4GB of each other. Programs can be statically or
20010 dynamically linked. This is the default code model.
20011
20012 @item -mcmodel=large
20013 @opindex mcmodel=large
20014 Generate code for the large code model. This makes no assumptions about
20015 addresses and sizes of sections. Programs can be statically linked only. The
20016 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
20017 @option{-fpic} and @option{-fPIC}.
20018
20019 @item -mstrict-align
20020 @itemx -mno-strict-align
20021 @opindex mstrict-align
20022 @opindex mno-strict-align
20023 Avoid or allow generating memory accesses that may not be aligned on a natural
20024 object boundary as described in the architecture specification.
20025
20026 @item -momit-leaf-frame-pointer
20027 @itemx -mno-omit-leaf-frame-pointer
20028 @opindex momit-leaf-frame-pointer
20029 @opindex mno-omit-leaf-frame-pointer
20030 Omit or keep the frame pointer in leaf functions. The former behavior is the
20031 default.
20032
20033 @item -mstack-protector-guard=@var{guard}
20034 @itemx -mstack-protector-guard-reg=@var{reg}
20035 @itemx -mstack-protector-guard-offset=@var{offset}
20036 @opindex mstack-protector-guard
20037 @opindex mstack-protector-guard-reg
20038 @opindex mstack-protector-guard-offset
20039 Generate stack protection code using canary at @var{guard}. Supported
20040 locations are @samp{global} for a global canary or @samp{sysreg} for a
20041 canary in an appropriate system register.
20042
20043 With the latter choice the options
20044 @option{-mstack-protector-guard-reg=@var{reg}} and
20045 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20046 which system register to use as base register for reading the canary,
20047 and from what offset from that base register. There is no default
20048 register or offset as this is entirely for use within the Linux
20049 kernel.
20050
20051 @item -mtls-dialect=desc
20052 @opindex mtls-dialect=desc
20053 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20054 of TLS variables. This is the default.
20055
20056 @item -mtls-dialect=traditional
20057 @opindex mtls-dialect=traditional
20058 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20059 of TLS variables.
20060
20061 @item -mtls-size=@var{size}
20062 @opindex mtls-size
20063 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
20064 This option requires binutils 2.26 or newer.
20065
20066 @item -mfix-cortex-a53-835769
20067 @itemx -mno-fix-cortex-a53-835769
20068 @opindex mfix-cortex-a53-835769
20069 @opindex mno-fix-cortex-a53-835769
20070 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20071 This involves inserting a NOP instruction between memory instructions and
20072 64-bit integer multiply-accumulate instructions.
20073
20074 @item -mfix-cortex-a53-843419
20075 @itemx -mno-fix-cortex-a53-843419
20076 @opindex mfix-cortex-a53-843419
20077 @opindex mno-fix-cortex-a53-843419
20078 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20079 This erratum workaround is made at link time and this will only pass the
20080 corresponding flag to the linker.
20081
20082 @item -mlow-precision-recip-sqrt
20083 @itemx -mno-low-precision-recip-sqrt
20084 @opindex mlow-precision-recip-sqrt
20085 @opindex mno-low-precision-recip-sqrt
20086 Enable or disable the reciprocal square root approximation.
20087 This option only has an effect if @option{-ffast-math} or
20088 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20089 precision of reciprocal square root results to about 16 bits for
20090 single precision and to 32 bits for double precision.
20091
20092 @item -mlow-precision-sqrt
20093 @itemx -mno-low-precision-sqrt
20094 @opindex mlow-precision-sqrt
20095 @opindex mno-low-precision-sqrt
20096 Enable or disable the square root approximation.
20097 This option only has an effect if @option{-ffast-math} or
20098 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20099 precision of square root results to about 16 bits for
20100 single precision and to 32 bits for double precision.
20101 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20102
20103 @item -mlow-precision-div
20104 @itemx -mno-low-precision-div
20105 @opindex mlow-precision-div
20106 @opindex mno-low-precision-div
20107 Enable or disable the division approximation.
20108 This option only has an effect if @option{-ffast-math} or
20109 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
20110 precision of division results to about 16 bits for
20111 single precision and to 32 bits for double precision.
20112
20113 @item -mtrack-speculation
20114 @itemx -mno-track-speculation
20115 Enable or disable generation of additional code to track speculative
20116 execution through conditional branches. The tracking state can then
20117 be used by the compiler when expanding calls to
20118 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20119 sequence to be generated.
20120
20121 @item -moutline-atomics
20122 @itemx -mno-outline-atomics
20123 Enable or disable calls to out-of-line helpers to implement atomic operations.
20124 These helpers will, at runtime, determine if the LSE instructions from
20125 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20126 instructions that are present in the base ARMv8.0 ISA.
20127
20128 This option is only applicable when compiling for the base ARMv8.0
20129 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
20130 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20131 used directly. The same applies when using @option{-mcpu=} when the
20132 selected cpu supports the @samp{lse} feature.
20133 This option is on by default.
20134
20135 @item -march=@var{name}
20136 @opindex march
20137 Specify the name of the target architecture and, optionally, one or
20138 more feature modifiers. This option has the form
20139 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20140
20141 The table below summarizes the permissible values for @var{arch}
20142 and the features that they enable by default:
20143
20144 @multitable @columnfractions 0.20 0.20 0.60
20145 @headitem @var{arch} value @tab Architecture @tab Includes by default
20146 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20147 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20148 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20149 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20150 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20151 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20152 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20153 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20154 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20155 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20156 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20157 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20158 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20159 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20160 @end multitable
20161
20162 The value @samp{native} is available on native AArch64 GNU/Linux and
20163 causes the compiler to pick the architecture of the host system. This
20164 option has no effect if the compiler is unable to recognize the
20165 architecture of the host system,
20166
20167 The permissible values for @var{feature} are listed in the sub-section
20168 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20169 Feature Modifiers}. Where conflicting feature modifiers are
20170 specified, the right-most feature is used.
20171
20172 GCC uses @var{name} to determine what kind of instructions it can emit
20173 when generating assembly code. If @option{-march} is specified
20174 without either of @option{-mtune} or @option{-mcpu} also being
20175 specified, the code is tuned to perform well across a range of target
20176 processors implementing the target architecture.
20177
20178 @item -mtune=@var{name}
20179 @opindex mtune
20180 Specify the name of the target processor for which GCC should tune the
20181 performance of the code. Permissible values for this option are:
20182 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20183 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20184 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20185 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20186 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20187 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20188 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20189 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20190 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20191 @samp{octeontx}, @samp{octeontx81}, @samp{octeontx83},
20192 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20193 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20194 @samp{octeontx2f95mm},
20195 @samp{a64fx},
20196 @samp{thunderx}, @samp{thunderxt88},
20197 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20198 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20199 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20200 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20201 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20202 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20203 @samp{cortex-x3}, @samp{cortex-a510}, @samp{cortex-a710}, @samp{cortex-a715},
20204 @samp{ampere1}, @samp{ampere1a}, and @samp{native}.
20205
20206 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20207 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20208 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20209 should tune for a big.LITTLE system.
20210
20211 The value @samp{neoverse-512tvb} specifies that GCC should tune
20212 for Neoverse cores that (a) implement SVE and (b) have a total vector
20213 bandwidth of 512 bits per cycle. In other words, the option tells GCC to
20214 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20215 instructions a cycle and that can execute an equivalent number of SVE
20216 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20217 This is more general than tuning for a specific core like Neoverse V1
20218 but is more specific than the default tuning described below.
20219
20220 Additionally on native AArch64 GNU/Linux systems the value
20221 @samp{native} tunes performance to the host system. This option has no effect
20222 if the compiler is unable to recognize the processor of the host system.
20223
20224 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20225 are specified, the code is tuned to perform well across a range
20226 of target processors.
20227
20228 This option cannot be suffixed by feature modifiers.
20229
20230 @item -mcpu=@var{name}
20231 @opindex mcpu
20232 Specify the name of the target processor, optionally suffixed by one
20233 or more feature modifiers. This option has the form
20234 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20235 the permissible values for @var{cpu} are the same as those available
20236 for @option{-mtune}. The permissible values for @var{feature} are
20237 documented in the sub-section on
20238 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20239 Feature Modifiers}. Where conflicting feature modifiers are
20240 specified, the right-most feature is used.
20241
20242 GCC uses @var{name} to determine what kind of instructions it can emit when
20243 generating assembly code (as if by @option{-march}) and to determine
20244 the target processor for which to tune for performance (as if
20245 by @option{-mtune}). Where this option is used in conjunction
20246 with @option{-march} or @option{-mtune}, those options take precedence
20247 over the appropriate part of this option.
20248
20249 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20250 to a specific core, but instead refers to all Neoverse cores that
20251 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20252 a cycle. Unless overridden by @option{-march},
20253 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20254 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20255 these properties. Unless overridden by @option{-mtune},
20256 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20257 @option{-mtune=neoverse-512tvb}.
20258
20259 @item -moverride=@var{string}
20260 @opindex moverride
20261 Override tuning decisions made by the back-end in response to a
20262 @option{-mtune=} switch. The syntax, semantics, and accepted values
20263 for @var{string} in this option are not guaranteed to be consistent
20264 across releases.
20265
20266 This option is only intended to be useful when developing GCC.
20267
20268 @item -mverbose-cost-dump
20269 @opindex mverbose-cost-dump
20270 Enable verbose cost model dumping in the debug dump files. This option is
20271 provided for use in debugging the compiler.
20272
20273 @item -mpc-relative-literal-loads
20274 @itemx -mno-pc-relative-literal-loads
20275 @opindex mpc-relative-literal-loads
20276 @opindex mno-pc-relative-literal-loads
20277 Enable or disable PC-relative literal loads. With this option literal pools are
20278 accessed using a single instruction and emitted after each function. This
20279 limits the maximum size of functions to 1MB. This is enabled by default for
20280 @option{-mcmodel=tiny}.
20281
20282 @item -msign-return-address=@var{scope}
20283 @opindex msign-return-address
20284 Select the function scope on which return address signing will be applied.
20285 Permissible values are @samp{none}, which disables return address signing,
20286 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20287 functions, and @samp{all}, which enables pointer signing for all functions. The
20288 default value is @samp{none}. This option has been deprecated by
20289 -mbranch-protection.
20290
20291 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20292 @opindex mbranch-protection
20293 Select the branch protection features to use.
20294 @samp{none} is the default and turns off all types of branch protection.
20295 @samp{standard} turns on all types of branch protection features. If a feature
20296 has additional tuning options, then @samp{standard} sets it to its standard
20297 level.
20298 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20299 level: signing functions that save the return address to memory (non-leaf
20300 functions will practically always do this) using the a-key. The optional
20301 argument @samp{leaf} can be used to extend the signing to include leaf
20302 functions. The optional argument @samp{b-key} can be used to sign the functions
20303 with the B-key instead of the A-key.
20304 @samp{bti} turns on branch target identification mechanism.
20305
20306 @item -mharden-sls=@var{opts}
20307 @opindex mharden-sls
20308 Enable compiler hardening against straight line speculation (SLS).
20309 @var{opts} is a comma-separated list of the following options:
20310 @table @samp
20311 @item retbr
20312 @item blr
20313 @end table
20314 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20315 @samp{-mharden-sls=none} disables all SLS hardening.
20316
20317 @item -msve-vector-bits=@var{bits}
20318 @opindex msve-vector-bits
20319 Specify the number of bits in an SVE vector register. This option only has
20320 an effect when SVE is enabled.
20321
20322 GCC supports two forms of SVE code generation: ``vector-length
20323 agnostic'' output that works with any size of vector register and
20324 ``vector-length specific'' output that allows GCC to make assumptions
20325 about the vector length when it is useful for optimization reasons.
20326 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20327 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20328 Specifying @samp{scalable} selects vector-length agnostic
20329 output. At present @samp{-msve-vector-bits=128} also generates vector-length
20330 agnostic output for big-endian targets. All other values generate
20331 vector-length specific code. The behavior of these values may change
20332 in future releases and no value except @samp{scalable} should be
20333 relied on for producing code that is portable across different
20334 hardware SVE vector lengths.
20335
20336 The default is @samp{-msve-vector-bits=scalable}, which produces
20337 vector-length agnostic code.
20338 @end table
20339
20340 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20341 @anchor{aarch64-feature-modifiers}
20342 @cindex @option{-march} feature modifiers
20343 @cindex @option{-mcpu} feature modifiers
20344 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20345 the following and their inverses @option{no@var{feature}}:
20346
20347 @table @samp
20348 @item crc
20349 Enable CRC extension. This is on by default for
20350 @option{-march=armv8.1-a}.
20351 @item crypto
20352 Enable Crypto extension. This also enables Advanced SIMD and floating-point
20353 instructions.
20354 @item fp
20355 Enable floating-point instructions. This is on by default for all possible
20356 values for options @option{-march} and @option{-mcpu}.
20357 @item simd
20358 Enable Advanced SIMD instructions. This also enables floating-point
20359 instructions. This is on by default for all possible values for options
20360 @option{-march} and @option{-mcpu}.
20361 @item sve
20362 Enable Scalable Vector Extension instructions. This also enables Advanced
20363 SIMD and floating-point instructions.
20364 @item lse
20365 Enable Large System Extension instructions. This is on by default for
20366 @option{-march=armv8.1-a}.
20367 @item rdma
20368 Enable Round Double Multiply Accumulate instructions. This is on by default
20369 for @option{-march=armv8.1-a}.
20370 @item fp16
20371 Enable FP16 extension. This also enables floating-point instructions.
20372 @item fp16fml
20373 Enable FP16 fmla extension. This also enables FP16 extensions and
20374 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.
20375
20376 @item rcpc
20377 Enable the RCpc extension. This enables the use of the LDAPR instructions for
20378 load-acquire atomic semantics, and passes it on to the assembler, enabling
20379 inline asm statements to use instructions from the RCpc extension.
20380 @item dotprod
20381 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
20382 @item aes
20383 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
20384 SIMD instructions.
20385 @item sha2
20386 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
20387 @item sha3
20388 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
20389 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20390 @item sm4
20391 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
20392 Use of this option with architectures prior to Armv8.2-A is not supported.
20393 @item profile
20394 Enable the Statistical Profiling extension. This option is only to enable the
20395 extension at the assembler level and does not affect code generation.
20396 @item rng
20397 Enable the Armv8.5-a Random Number instructions. This option is only to
20398 enable the extension at the assembler level and does not affect code
20399 generation.
20400 @item memtag
20401 Enable the Armv8.5-a Memory Tagging Extensions.
20402 Use of this option with architectures prior to Armv8.5-A is not supported.
20403 @item sb
20404 Enable the Armv8-a Speculation Barrier instruction. This option is only to
20405 enable the extension at the assembler level and does not affect code
20406 generation. This option is enabled by default for @option{-march=armv8.5-a}.
20407 @item ssbs
20408 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
20409 is only to enable the extension at the assembler level and does not affect code
20410 generation. This option is enabled by default for @option{-march=armv8.5-a}.
20411 @item predres
20412 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
20413 This option is only to enable the extension at the assembler level and does
20414 not affect code generation. This option is enabled by default for
20415 @option{-march=armv8.5-a}.
20416 @item sve2
20417 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
20418 instructions.
20419 @item sve2-bitperm
20420 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
20421 @item sve2-sm4
20422 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
20423 @item sve2-aes
20424 Enable SVE2 aes instructions. This also enables SVE2 instructions.
20425 @item sve2-sha3
20426 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
20427 @item tme
20428 Enable the Transactional Memory Extension.
20429 @item i8mm
20430 Enable 8-bit Integer Matrix Multiply instructions. This also enables
20431 Advanced SIMD and floating-point instructions. This option is enabled by
20432 default for @option{-march=armv8.6-a}. Use of this option with architectures
20433 prior to Armv8.2-A is not supported.
20434 @item f32mm
20435 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
20436 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
20437 not supported.
20438 @item f64mm
20439 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
20440 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
20441 not supported.
20442 @item bf16
20443 Enable brain half-precision floating-point instructions. This also enables
20444 Advanced SIMD and floating-point instructions. This option is enabled by
20445 default for @option{-march=armv8.6-a}. Use of this option with architectures
20446 prior to Armv8.2-A is not supported.
20447 @item ls64
20448 Enable the 64-byte atomic load and store instructions for accelerators.
20449 This option is enabled by default for @option{-march=armv8.7-a}.
20450 @item mops
20451 Enable the instructions to accelerate memory operations like @code{memcpy},
20452 @code{memmove}, @code{memset}. This option is enabled by default for
20453 @option{-march=armv8.8-a}
20454 @item flagm
20455 Enable the Flag Manipulation instructions Extension.
20456 @item pauth
20457 Enable the Pointer Authentication Extension.
20458 @item cssc
20459 Enable the Common Short Sequence Compression instructions.
20460
20461 @end table
20462
20463 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
20464 which implies @option{fp}.
20465 Conversely, @option{nofp} implies @option{nosimd}, which implies
20466 @option{nocrypto}, @option{noaes} and @option{nosha2}.
20467
20468 @node Adapteva Epiphany Options
20469 @subsection Adapteva Epiphany Options
20470
20471 These @samp{-m} options are defined for Adapteva Epiphany:
20472
20473 @table @gcctabopt
20474 @item -mhalf-reg-file
20475 @opindex mhalf-reg-file
20476 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
20477 That allows code to run on hardware variants that lack these registers.
20478
20479 @item -mprefer-short-insn-regs
20480 @opindex mprefer-short-insn-regs
20481 Preferentially allocate registers that allow short instruction generation.
20482 This can result in increased instruction count, so this may either reduce or
20483 increase overall code size.
20484
20485 @item -mbranch-cost=@var{num}
20486 @opindex mbranch-cost
20487 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20488 This cost is only a heuristic and is not guaranteed to produce
20489 consistent results across releases.
20490
20491 @item -mcmove
20492 @opindex mcmove
20493 Enable the generation of conditional moves.
20494
20495 @item -mnops=@var{num}
20496 @opindex mnops
20497 Emit @var{num} NOPs before every other generated instruction.
20498
20499 @item -mno-soft-cmpsf
20500 @opindex mno-soft-cmpsf
20501 @opindex msoft-cmpsf
20502 For single-precision floating-point comparisons, emit an @code{fsub} instruction
20503 and test the flags. This is faster than a software comparison, but can
20504 get incorrect results in the presence of NaNs, or when two different small
20505 numbers are compared such that their difference is calculated as zero.
20506 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
20507 software comparisons.
20508
20509 @item -mstack-offset=@var{num}
20510 @opindex mstack-offset
20511 Set the offset between the top of the stack and the stack pointer.
20512 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
20513 can be used by leaf functions without stack allocation.
20514 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
20515 Note also that this option changes the ABI; compiling a program with a
20516 different stack offset than the libraries have been compiled with
20517 generally does not work.
20518 This option can be useful if you want to evaluate if a different stack
20519 offset would give you better code, but to actually use a different stack
20520 offset to build working programs, it is recommended to configure the
20521 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
20522
20523 @item -mno-round-nearest
20524 @opindex mno-round-nearest
20525 @opindex mround-nearest
20526 Make the scheduler assume that the rounding mode has been set to
20527 truncating. The default is @option{-mround-nearest}.
20528
20529 @item -mlong-calls
20530 @opindex mlong-calls
20531 If not otherwise specified by an attribute, assume all calls might be beyond
20532 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
20533 function address into a register before performing a (otherwise direct) call.
20534 This is the default.
20535
20536 @item -mshort-calls
20537 @opindex short-calls
20538 If not otherwise specified by an attribute, assume all direct calls are
20539 in the range of the @code{b} / @code{bl} instructions, so use these instructions
20540 for direct calls. The default is @option{-mlong-calls}.
20541
20542 @item -msmall16
20543 @opindex msmall16
20544 Assume addresses can be loaded as 16-bit unsigned values. This does not
20545 apply to function addresses for which @option{-mlong-calls} semantics
20546 are in effect.
20547
20548 @item -mfp-mode=@var{mode}
20549 @opindex mfp-mode
20550 Set the prevailing mode of the floating-point unit.
20551 This determines the floating-point mode that is provided and expected
20552 at function call and return time. Making this mode match the mode you
20553 predominantly need at function start can make your programs smaller and
20554 faster by avoiding unnecessary mode switches.
20555
20556 @var{mode} can be set to one the following values:
20557
20558 @table @samp
20559 @item caller
20560 Any mode at function entry is valid, and retained or restored when
20561 the function returns, and when it calls other functions.
20562 This mode is useful for compiling libraries or other compilation units
20563 you might want to incorporate into different programs with different
20564 prevailing FPU modes, and the convenience of being able to use a single
20565 object file outweighs the size and speed overhead for any extra
20566 mode switching that might be needed, compared with what would be needed
20567 with a more specific choice of prevailing FPU mode.
20568
20569 @item truncate
20570 This is the mode used for floating-point calculations with
20571 truncating (i.e.@: round towards zero) rounding mode. That includes
20572 conversion from floating point to integer.
20573
20574 @item round-nearest
20575 This is the mode used for floating-point calculations with
20576 round-to-nearest-or-even rounding mode.
20577
20578 @item int
20579 This is the mode used to perform integer calculations in the FPU, e.g.@:
20580 integer multiply, or integer multiply-and-accumulate.
20581 @end table
20582
20583 The default is @option{-mfp-mode=caller}
20584
20585 @item -mno-split-lohi
20586 @itemx -mno-postinc
20587 @itemx -mno-postmodify
20588 @opindex mno-split-lohi
20589 @opindex msplit-lohi
20590 @opindex mno-postinc
20591 @opindex mpostinc
20592 @opindex mno-postmodify
20593 @opindex mpostmodify
20594 Code generation tweaks that disable, respectively, splitting of 32-bit
20595 loads, generation of post-increment addresses, and generation of
20596 post-modify addresses. The defaults are @option{msplit-lohi},
20597 @option{-mpost-inc}, and @option{-mpost-modify}.
20598
20599 @item -mnovect-double
20600 @opindex mno-vect-double
20601 @opindex mvect-double
20602 Change the preferred SIMD mode to SImode. The default is
20603 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
20604
20605 @item -max-vect-align=@var{num}
20606 @opindex max-vect-align
20607 The maximum alignment for SIMD vector mode types.
20608 @var{num} may be 4 or 8. The default is 8.
20609 Note that this is an ABI change, even though many library function
20610 interfaces are unaffected if they don't use SIMD vector modes
20611 in places that affect size and/or alignment of relevant types.
20612
20613 @item -msplit-vecmove-early
20614 @opindex msplit-vecmove-early
20615 Split vector moves into single word moves before reload. In theory this
20616 can give better register allocation, but so far the reverse seems to be
20617 generally the case.
20618
20619 @item -m1reg-@var{reg}
20620 @opindex m1reg-
20621 Specify a register to hold the constant @minus{}1, which makes loading small negative
20622 constants and certain bitmasks faster.
20623 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
20624 which specify use of that register as a fixed register,
20625 and @samp{none}, which means that no register is used for this
20626 purpose. The default is @option{-m1reg-none}.
20627
20628 @end table
20629
20630 @node AMD GCN Options
20631 @subsection AMD GCN Options
20632 @cindex AMD GCN Options
20633
20634 These options are defined specifically for the AMD GCN port.
20635
20636 @table @gcctabopt
20637
20638 @item -march=@var{gpu}
20639 @opindex march
20640 @itemx -mtune=@var{gpu}
20641 @opindex mtune
20642 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
20643 are
20644
20645 @table @samp
20646 @item fiji
20647 Compile for GCN3 Fiji devices (gfx803).
20648
20649 @item gfx900
20650 Compile for GCN5 Vega 10 devices (gfx900).
20651
20652 @item gfx906
20653 Compile for GCN5 Vega 20 devices (gfx906).
20654
20655 @item gfx908
20656 Compile for CDNA1 Instinct MI100 series devices (gfx908).
20657
20658 @item gfx90a
20659 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
20660
20661 @end table
20662
20663 @item -msram-ecc=on
20664 @itemx -msram-ecc=off
20665 @itemx -msram-ecc=any
20666 @opindex msram-ecc
20667 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
20668 disabled, or either mode. This feature can be enabled per-process on some
20669 devices. The compiled code must match the device mode. The default is
20670 @samp{any}, for devices that support it.
20671
20672 @item -mstack-size=@var{bytes}
20673 @opindex mstack-size
20674 Specify how many @var{bytes} of stack space will be requested for each GPU
20675 thread (wave-front). Beware that there may be many threads and limited memory
20676 available. The size of the stack allocation may also have an impact on
20677 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
20678 1MB otherwise.
20679
20680 @item -mxnack
20681 @opindex mxnack
20682 Compile binaries suitable for devices with the XNACK feature enabled. Some
20683 devices always require XNACK and some allow the user to configure XNACK. The
20684 compiled code must match the device mode. The default is @samp{-mno-xnack}.
20685 At present this option is a placeholder for support that is not yet
20686 implemented.
20687
20688 @end table
20689
20690 @node ARC Options
20691 @subsection ARC Options
20692 @cindex ARC options
20693
20694 The following options control the architecture variant for which code
20695 is being compiled:
20696
20697 @c architecture variants
20698 @table @gcctabopt
20699
20700 @item -mbarrel-shifter
20701 @opindex mbarrel-shifter
20702 Generate instructions supported by barrel shifter. This is the default
20703 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
20704
20705 @item -mjli-always
20706 @opindex mjli-always
20707 Force to call a function using jli_s instruction. This option is
20708 valid only for ARCv2 architecture.
20709
20710 @item -mcpu=@var{cpu}
20711 @opindex mcpu
20712 Set architecture type, register usage, and instruction scheduling
20713 parameters for @var{cpu}. There are also shortcut alias options
20714 available for backward compatibility and convenience. Supported
20715 values for @var{cpu} are
20716
20717 @table @samp
20718 @opindex mA6
20719 @opindex mARC600
20720 @item arc600
20721 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
20722
20723 @item arc601
20724 @opindex mARC601
20725 Compile for ARC601. Alias: @option{-mARC601}.
20726
20727 @item arc700
20728 @opindex mA7
20729 @opindex mARC700
20730 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
20731 This is the default when configured with @option{--with-cpu=arc700}@.
20732
20733 @item arcem
20734 Compile for ARC EM.
20735
20736 @item archs
20737 Compile for ARC HS.
20738
20739 @item em
20740 Compile for ARC EM CPU with no hardware extensions.
20741
20742 @item em4
20743 Compile for ARC EM4 CPU.
20744
20745 @item em4_dmips
20746 Compile for ARC EM4 DMIPS CPU.
20747
20748 @item em4_fpus
20749 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
20750 extension.
20751
20752 @item em4_fpuda
20753 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
20754 double assist instructions.
20755
20756 @item hs
20757 Compile for ARC HS CPU with no hardware extensions except the atomic
20758 instructions.
20759
20760 @item hs34
20761 Compile for ARC HS34 CPU.
20762
20763 @item hs38
20764 Compile for ARC HS38 CPU.
20765
20766 @item hs38_linux
20767 Compile for ARC HS38 CPU with all hardware extensions on.
20768
20769 @item hs4x
20770 Compile for ARC HS4x CPU.
20771
20772 @item hs4xd
20773 Compile for ARC HS4xD CPU.
20774
20775 @item hs4x_rel31
20776 Compile for ARC HS4x CPU release 3.10a.
20777
20778 @item arc600_norm
20779 Compile for ARC 600 CPU with @code{norm} instructions enabled.
20780
20781 @item arc600_mul32x16
20782 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
20783 instructions enabled.
20784
20785 @item arc600_mul64
20786 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
20787 instructions enabled.
20788
20789 @item arc601_norm
20790 Compile for ARC 601 CPU with @code{norm} instructions enabled.
20791
20792 @item arc601_mul32x16
20793 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
20794 instructions enabled.
20795
20796 @item arc601_mul64
20797 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
20798 instructions enabled.
20799
20800 @item nps400
20801 Compile for ARC 700 on NPS400 chip.
20802
20803 @item em_mini
20804 Compile for ARC EM minimalist configuration featuring reduced register
20805 set.
20806
20807 @end table
20808
20809 @item -mdpfp
20810 @opindex mdpfp
20811 @itemx -mdpfp-compact
20812 @opindex mdpfp-compact
20813 Generate double-precision FPX instructions, tuned for the compact
20814 implementation.
20815
20816 @item -mdpfp-fast
20817 @opindex mdpfp-fast
20818 Generate double-precision FPX instructions, tuned for the fast
20819 implementation.
20820
20821 @item -mno-dpfp-lrsr
20822 @opindex mno-dpfp-lrsr
20823 Disable @code{lr} and @code{sr} instructions from using FPX extension
20824 aux registers.
20825
20826 @item -mea
20827 @opindex mea
20828 Generate extended arithmetic instructions. Currently only
20829 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
20830 supported. Only valid for @option{-mcpu=ARC700}.
20831
20832 @item -mno-mpy
20833 @opindex mno-mpy
20834 @opindex mmpy
20835 Do not generate @code{mpy}-family instructions for ARC700. This option is
20836 deprecated.
20837
20838 @item -mmul32x16
20839 @opindex mmul32x16
20840 Generate 32x16-bit multiply and multiply-accumulate instructions.
20841
20842 @item -mmul64
20843 @opindex mmul64
20844 Generate @code{mul64} and @code{mulu64} instructions.
20845 Only valid for @option{-mcpu=ARC600}.
20846
20847 @item -mnorm
20848 @opindex mnorm
20849 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
20850 is in effect.
20851
20852 @item -mspfp
20853 @opindex mspfp
20854 @itemx -mspfp-compact
20855 @opindex mspfp-compact
20856 Generate single-precision FPX instructions, tuned for the compact
20857 implementation.
20858
20859 @item -mspfp-fast
20860 @opindex mspfp-fast
20861 Generate single-precision FPX instructions, tuned for the fast
20862 implementation.
20863
20864 @item -msimd
20865 @opindex msimd
20866 Enable generation of ARC SIMD instructions via target-specific
20867 builtins. Only valid for @option{-mcpu=ARC700}.
20868
20869 @item -msoft-float
20870 @opindex msoft-float
20871 This option ignored; it is provided for compatibility purposes only.
20872 Software floating-point code is emitted by default, and this default
20873 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
20874 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
20875 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
20876
20877 @item -mswap
20878 @opindex mswap
20879 Generate @code{swap} instructions.
20880
20881 @item -matomic
20882 @opindex matomic
20883 This enables use of the locked load/store conditional extension to implement
20884 atomic memory built-in functions. Not available for ARC 6xx or ARC
20885 EM cores.
20886
20887 @item -mdiv-rem
20888 @opindex mdiv-rem
20889 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
20890
20891 @item -mcode-density
20892 @opindex mcode-density
20893 Enable code density instructions for ARC EM.
20894 This option is on by default for ARC HS.
20895
20896 @item -mll64
20897 @opindex mll64
20898 Enable double load/store operations for ARC HS cores.
20899
20900 @item -mtp-regno=@var{regno}
20901 @opindex mtp-regno
20902 Specify thread pointer register number.
20903
20904 @item -mmpy-option=@var{multo}
20905 @opindex mmpy-option
20906 Compile ARCv2 code with a multiplier design option. You can specify
20907 the option using either a string or numeric value for @var{multo}.
20908 @samp{wlh1} is the default value. The recognized values are:
20909
20910 @table @samp
20911 @item 0
20912 @itemx none
20913 No multiplier available.
20914
20915 @item 1
20916 @itemx w
20917 16x16 multiplier, fully pipelined.
20918 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
20919
20920 @item 2
20921 @itemx wlh1
20922 32x32 multiplier, fully
20923 pipelined (1 stage). The following instructions are additionally
20924 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20925
20926 @item 3
20927 @itemx wlh2
20928 32x32 multiplier, fully pipelined
20929 (2 stages). The following instructions are additionally enabled: @code{mpy},
20930 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20931
20932 @item 4
20933 @itemx wlh3
20934 Two 16x16 multipliers, blocking,
20935 sequential. The following instructions are additionally enabled: @code{mpy},
20936 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20937
20938 @item 5
20939 @itemx wlh4
20940 One 16x16 multiplier, blocking,
20941 sequential. The following instructions are additionally enabled: @code{mpy},
20942 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20943
20944 @item 6
20945 @itemx wlh5
20946 One 32x4 multiplier, blocking,
20947 sequential. The following instructions are additionally enabled: @code{mpy},
20948 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
20949
20950 @item 7
20951 @itemx plus_dmpy
20952 ARC HS SIMD support.
20953
20954 @item 8
20955 @itemx plus_macd
20956 ARC HS SIMD support.
20957
20958 @item 9
20959 @itemx plus_qmacw
20960 ARC HS SIMD support.
20961
20962 @end table
20963
20964 This option is only available for ARCv2 cores@.
20965
20966 @item -mfpu=@var{fpu}
20967 @opindex mfpu
20968 Enables support for specific floating-point hardware extensions for ARCv2
20969 cores. Supported values for @var{fpu} are:
20970
20971 @table @samp
20972
20973 @item fpus
20974 Enables support for single-precision floating-point hardware
20975 extensions@.
20976
20977 @item fpud
20978 Enables support for double-precision floating-point hardware
20979 extensions. The single-precision floating-point extension is also
20980 enabled. Not available for ARC EM@.
20981
20982 @item fpuda
20983 Enables support for double-precision floating-point hardware
20984 extensions using double-precision assist instructions. The single-precision
20985 floating-point extension is also enabled. This option is
20986 only available for ARC EM@.
20987
20988 @item fpuda_div
20989 Enables support for double-precision floating-point hardware
20990 extensions using double-precision assist instructions.
20991 The single-precision floating-point, square-root, and divide
20992 extensions are also enabled. This option is
20993 only available for ARC EM@.
20994
20995 @item fpuda_fma
20996 Enables support for double-precision floating-point hardware
20997 extensions using double-precision assist instructions.
20998 The single-precision floating-point and fused multiply and add
20999 hardware extensions are also enabled. This option is
21000 only available for ARC EM@.
21001
21002 @item fpuda_all
21003 Enables support for double-precision floating-point hardware
21004 extensions using double-precision assist instructions.
21005 All single-precision floating-point hardware extensions are also
21006 enabled. This option is only available for ARC EM@.
21007
21008 @item fpus_div
21009 Enables support for single-precision floating-point, square-root and divide
21010 hardware extensions@.
21011
21012 @item fpud_div
21013 Enables support for double-precision floating-point, square-root and divide
21014 hardware extensions. This option
21015 includes option @samp{fpus_div}. Not available for ARC EM@.
21016
21017 @item fpus_fma
21018 Enables support for single-precision floating-point and
21019 fused multiply and add hardware extensions@.
21020
21021 @item fpud_fma
21022 Enables support for double-precision floating-point and
21023 fused multiply and add hardware extensions. This option
21024 includes option @samp{fpus_fma}. Not available for ARC EM@.
21025
21026 @item fpus_all
21027 Enables support for all single-precision floating-point hardware
21028 extensions@.
21029
21030 @item fpud_all
21031 Enables support for all single- and double-precision floating-point
21032 hardware extensions. Not available for ARC EM@.
21033
21034 @end table
21035
21036 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
21037 @opindex mirq-ctrl-saved
21038 Specifies general-purposes registers that the processor automatically
21039 saves/restores on interrupt entry and exit. @var{register-range} is
21040 specified as two registers separated by a dash. The register range
21041 always starts with @code{r0}, the upper limit is @code{fp} register.
21042 @var{blink} and @var{lp_count} are optional. This option is only
21043 valid for ARC EM and ARC HS cores.
21044
21045 @item -mrgf-banked-regs=@var{number}
21046 @opindex mrgf-banked-regs
21047 Specifies the number of registers replicated in second register bank
21048 on entry to fast interrupt. Fast interrupts are interrupts with the
21049 highest priority level P0. These interrupts save only PC and STATUS32
21050 registers to avoid memory transactions during interrupt entry and exit
21051 sequences. Use this option when you are using fast interrupts in an
21052 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
21053
21054 @item -mlpc-width=@var{width}
21055 @opindex mlpc-width
21056 Specify the width of the @code{lp_count} register. Valid values for
21057 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
21058 fixed to 32 bits. If the width is less than 32, the compiler does not
21059 attempt to transform loops in your program to use the zero-delay loop
21060 mechanism unless it is known that the @code{lp_count} register can
21061 hold the required loop-counter value. Depending on the width
21062 specified, the compiler and run-time library might continue to use the
21063 loop mechanism for various needs. This option defines macro
21064 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21065
21066 @item -mrf16
21067 @opindex mrf16
21068 This option instructs the compiler to generate code for a 16-entry
21069 register file. This option defines the @code{__ARC_RF16__}
21070 preprocessor macro.
21071
21072 @item -mbranch-index
21073 @opindex mbranch-index
21074 Enable use of @code{bi} or @code{bih} instructions to implement jump
21075 tables.
21076
21077 @end table
21078
21079 The following options are passed through to the assembler, and also
21080 define preprocessor macro symbols.
21081
21082 @c Flags used by the assembler, but for which we define preprocessor
21083 @c macro symbols as well.
21084 @table @gcctabopt
21085 @item -mdsp-packa
21086 @opindex mdsp-packa
21087 Passed down to the assembler to enable the DSP Pack A extensions.
21088 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
21089 deprecated.
21090
21091 @item -mdvbf
21092 @opindex mdvbf
21093 Passed down to the assembler to enable the dual Viterbi butterfly
21094 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
21095 option is deprecated.
21096
21097 @c ARC700 4.10 extension instruction
21098 @item -mlock
21099 @opindex mlock
21100 Passed down to the assembler to enable the locked load/store
21101 conditional extension. Also sets the preprocessor symbol
21102 @code{__Xlock}.
21103
21104 @item -mmac-d16
21105 @opindex mmac-d16
21106 Passed down to the assembler. Also sets the preprocessor symbol
21107 @code{__Xxmac_d16}. This option is deprecated.
21108
21109 @item -mmac-24
21110 @opindex mmac-24
21111 Passed down to the assembler. Also sets the preprocessor symbol
21112 @code{__Xxmac_24}. This option is deprecated.
21113
21114 @c ARC700 4.10 extension instruction
21115 @item -mrtsc
21116 @opindex mrtsc
21117 Passed down to the assembler to enable the 64-bit time-stamp counter
21118 extension instruction. Also sets the preprocessor symbol
21119 @code{__Xrtsc}. This option is deprecated.
21120
21121 @c ARC700 4.10 extension instruction
21122 @item -mswape
21123 @opindex mswape
21124 Passed down to the assembler to enable the swap byte ordering
21125 extension instruction. Also sets the preprocessor symbol
21126 @code{__Xswape}.
21127
21128 @item -mtelephony
21129 @opindex mtelephony
21130 Passed down to the assembler to enable dual- and single-operand
21131 instructions for telephony. Also sets the preprocessor symbol
21132 @code{__Xtelephony}. This option is deprecated.
21133
21134 @item -mxy
21135 @opindex mxy
21136 Passed down to the assembler to enable the XY memory extension. Also
21137 sets the preprocessor symbol @code{__Xxy}.
21138
21139 @end table
21140
21141 The following options control how the assembly code is annotated:
21142
21143 @c Assembly annotation options
21144 @table @gcctabopt
21145 @item -misize
21146 @opindex misize
21147 Annotate assembler instructions with estimated addresses.
21148
21149 @item -mannotate-align
21150 @opindex mannotate-align
21151 Explain what alignment considerations lead to the decision to make an
21152 instruction short or long.
21153
21154 @end table
21155
21156 The following options are passed through to the linker:
21157
21158 @c options passed through to the linker
21159 @table @gcctabopt
21160 @item -marclinux
21161 @opindex marclinux
21162 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21163 This option is enabled by default in tool chains built for
21164 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21165 when profiling is not requested.
21166
21167 @item -marclinux_prof
21168 @opindex marclinux_prof
21169 Passed through to the linker, to specify use of the
21170 @code{arclinux_prof} emulation. This option is enabled by default in
21171 tool chains built for @w{@code{arc-linux-uclibc}} and
21172 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21173
21174 @end table
21175
21176 The following options control the semantics of generated code:
21177
21178 @c semantically relevant code generation options
21179 @table @gcctabopt
21180 @item -mlong-calls
21181 @opindex mlong-calls
21182 Generate calls as register indirect calls, thus providing access
21183 to the full 32-bit address range.
21184
21185 @item -mmedium-calls
21186 @opindex mmedium-calls
21187 Don't use less than 25-bit addressing range for calls, which is the
21188 offset available for an unconditional branch-and-link
21189 instruction. Conditional execution of function calls is suppressed, to
21190 allow use of the 25-bit range, rather than the 21-bit range with
21191 conditional branch-and-link. This is the default for tool chains built
21192 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21193
21194 @item -G @var{num}
21195 @opindex G
21196 Put definitions of externally-visible data in a small data section if
21197 that data is no bigger than @var{num} bytes. The default value of
21198 @var{num} is 4 for any ARC configuration, or 8 when we have double
21199 load/store operations.
21200
21201 @item -mno-sdata
21202 @opindex mno-sdata
21203 @opindex msdata
21204 Do not generate sdata references. This is the default for tool chains
21205 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21206 targets.
21207
21208 @item -mvolatile-cache
21209 @opindex mvolatile-cache
21210 Use ordinarily cached memory accesses for volatile references. This is the
21211 default.
21212
21213 @item -mno-volatile-cache
21214 @opindex mno-volatile-cache
21215 @opindex mvolatile-cache
21216 Enable cache bypass for volatile references.
21217
21218 @end table
21219
21220 The following options fine tune code generation:
21221 @c code generation tuning options
21222 @table @gcctabopt
21223 @item -malign-call
21224 @opindex malign-call
21225 Does nothing. Preserved for backward compatibility.
21226
21227 @item -mauto-modify-reg
21228 @opindex mauto-modify-reg
21229 Enable the use of pre/post modify with register displacement.
21230
21231 @item -mbbit-peephole
21232 @opindex mbbit-peephole
21233 Enable bbit peephole2.
21234
21235 @item -mno-brcc
21236 @opindex mno-brcc
21237 This option disables a target-specific pass in @file{arc_reorg} to
21238 generate compare-and-branch (@code{br@var{cc}}) instructions.
21239 It has no effect on
21240 generation of these instructions driven by the combiner pass.
21241
21242 @item -mcase-vector-pcrel
21243 @opindex mcase-vector-pcrel
21244 Use PC-relative switch case tables to enable case table shortening.
21245 This is the default for @option{-Os}.
21246
21247 @item -mcompact-casesi
21248 @opindex mcompact-casesi
21249 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
21250 and only available for ARCv1 cores. This option is deprecated.
21251
21252 @item -mno-cond-exec
21253 @opindex mno-cond-exec
21254 Disable the ARCompact-specific pass to generate conditional
21255 execution instructions.
21256
21257 Due to delay slot scheduling and interactions between operand numbers,
21258 literal sizes, instruction lengths, and the support for conditional execution,
21259 the target-independent pass to generate conditional execution is often lacking,
21260 so the ARC port has kept a special pass around that tries to find more
21261 conditional execution generation opportunities after register allocation,
21262 branch shortening, and delay slot scheduling have been done. This pass
21263 generally, but not always, improves performance and code size, at the cost of
21264 extra compilation time, which is why there is an option to switch it off.
21265 If you have a problem with call instructions exceeding their allowable
21266 offset range because they are conditionalized, you should consider using
21267 @option{-mmedium-calls} instead.
21268
21269 @item -mearly-cbranchsi
21270 @opindex mearly-cbranchsi
21271 Enable pre-reload use of the @code{cbranchsi} pattern.
21272
21273 @item -mexpand-adddi
21274 @opindex mexpand-adddi
21275 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21276 @code{add.f}, @code{adc} etc. This option is deprecated.
21277
21278 @item -mindexed-loads
21279 @opindex mindexed-loads
21280 Enable the use of indexed loads. This can be problematic because some
21281 optimizers then assume that indexed stores exist, which is not
21282 the case.
21283
21284 @item -mlra
21285 @opindex mlra
21286 Enable Local Register Allocation. This is still experimental for ARC,
21287 so by default the compiler uses standard reload
21288 (i.e.@: @option{-mno-lra}).
21289
21290 @item -mlra-priority-none
21291 @opindex mlra-priority-none
21292 Don't indicate any priority for target registers.
21293
21294 @item -mlra-priority-compact
21295 @opindex mlra-priority-compact
21296 Indicate target register priority for r0..r3 / r12..r15.
21297
21298 @item -mlra-priority-noncompact
21299 @opindex mlra-priority-noncompact
21300 Reduce target register priority for r0..r3 / r12..r15.
21301
21302 @item -mmillicode
21303 @opindex mmillicode
21304 When optimizing for size (using @option{-Os}), prologues and epilogues
21305 that have to save or restore a large number of registers are often
21306 shortened by using call to a special function in libgcc; this is
21307 referred to as a @emph{millicode} call. As these calls can pose
21308 performance issues, and/or cause linking issues when linking in a
21309 nonstandard way, this option is provided to turn on or off millicode
21310 call generation.
21311
21312 @item -mcode-density-frame
21313 @opindex mcode-density-frame
21314 This option enable the compiler to emit @code{enter} and @code{leave}
21315 instructions. These instructions are only valid for CPUs with
21316 code-density feature.
21317
21318 @item -mmixed-code
21319 @opindex mmixed-code
21320 Does nothing. Preserved for backward compatibility.
21321
21322 @item -mq-class
21323 @opindex mq-class
21324 Ths option is deprecated. Enable @samp{q} instruction alternatives.
21325 This is the default for @option{-Os}.
21326
21327 @item -mRcq
21328 @opindex mRcq
21329 Does nothing. Preserved for backward compatibility.
21330
21331 @item -mRcw
21332 @opindex mRcw
21333 Does nothing. Preserved for backward compatibility.
21334
21335 @item -msize-level=@var{level}
21336 @opindex msize-level
21337 Fine-tune size optimization with regards to instruction lengths and alignment.
21338 The recognized values for @var{level} are:
21339 @table @samp
21340 @item 0
21341 No size optimization. This level is deprecated and treated like @samp{1}.
21342
21343 @item 1
21344 Short instructions are used opportunistically.
21345
21346 @item 2
21347 In addition, alignment of loops and of code after barriers are dropped.
21348
21349 @item 3
21350 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21351
21352 @end table
21353
21354 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
21355 the behavior when this is not set is equivalent to level @samp{1}.
21356
21357 @item -mtune=@var{cpu}
21358 @opindex mtune
21359 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21360 by @option{-mcpu=}.
21361
21362 Supported values for @var{cpu} are
21363
21364 @table @samp
21365 @item ARC600
21366 Tune for ARC600 CPU.
21367
21368 @item ARC601
21369 Tune for ARC601 CPU.
21370
21371 @item ARC700
21372 Tune for ARC700 CPU with standard multiplier block.
21373
21374 @item ARC700-xmac
21375 Tune for ARC700 CPU with XMAC block.
21376
21377 @item ARC725D
21378 Tune for ARC725D CPU.
21379
21380 @item ARC750D
21381 Tune for ARC750D CPU.
21382
21383 @item core3
21384 Tune for ARCv2 core3 type CPU. This option enable usage of
21385 @code{dbnz} instruction.
21386
21387 @item release31a
21388 Tune for ARC4x release 3.10a.
21389
21390 @end table
21391
21392 @item -mmultcost=@var{num}
21393 @opindex mmultcost
21394 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21395 normal instruction.
21396
21397 @item -munalign-prob-threshold=@var{probability}
21398 @opindex munalign-prob-threshold
21399 Does nothing. Preserved for backward compatibility.
21400
21401 @end table
21402
21403 The following options are maintained for backward compatibility, but
21404 are now deprecated and will be removed in a future release:
21405
21406 @c Deprecated options
21407 @table @gcctabopt
21408
21409 @item -margonaut
21410 @opindex margonaut
21411 Obsolete FPX.
21412
21413 @item -mbig-endian
21414 @opindex mbig-endian
21415 @itemx -EB
21416 @opindex EB
21417 Compile code for big-endian targets. Use of these options is now
21418 deprecated. Big-endian code is supported by configuring GCC to build
21419 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
21420 for which big endian is the default.
21421
21422 @item -mlittle-endian
21423 @opindex mlittle-endian
21424 @itemx -EL
21425 @opindex EL
21426 Compile code for little-endian targets. Use of these options is now
21427 deprecated. Little-endian code is supported by configuring GCC to build
21428 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
21429 for which little endian is the default.
21430
21431 @item -mbarrel_shifter
21432 @opindex mbarrel_shifter
21433 Replaced by @option{-mbarrel-shifter}.
21434
21435 @item -mdpfp_compact
21436 @opindex mdpfp_compact
21437 Replaced by @option{-mdpfp-compact}.
21438
21439 @item -mdpfp_fast
21440 @opindex mdpfp_fast
21441 Replaced by @option{-mdpfp-fast}.
21442
21443 @item -mdsp_packa
21444 @opindex mdsp_packa
21445 Replaced by @option{-mdsp-packa}.
21446
21447 @item -mEA
21448 @opindex mEA
21449 Replaced by @option{-mea}.
21450
21451 @item -mmac_24
21452 @opindex mmac_24
21453 Replaced by @option{-mmac-24}.
21454
21455 @item -mmac_d16
21456 @opindex mmac_d16
21457 Replaced by @option{-mmac-d16}.
21458
21459 @item -mspfp_compact
21460 @opindex mspfp_compact
21461 Replaced by @option{-mspfp-compact}.
21462
21463 @item -mspfp_fast
21464 @opindex mspfp_fast
21465 Replaced by @option{-mspfp-fast}.
21466
21467 @item -mtune=@var{cpu}
21468 @opindex mtune
21469 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
21470 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
21471 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
21472
21473 @item -multcost=@var{num}
21474 @opindex multcost
21475 Replaced by @option{-mmultcost}.
21476
21477 @end table
21478
21479 @node ARM Options
21480 @subsection ARM Options
21481 @cindex ARM options
21482
21483 These @samp{-m} options are defined for the ARM port:
21484
21485 @table @gcctabopt
21486 @item -mabi=@var{name}
21487 @opindex mabi
21488 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
21489 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
21490
21491 @item -mapcs-frame
21492 @opindex mapcs-frame
21493 Generate a stack frame that is compliant with the ARM Procedure Call
21494 Standard for all functions, even if this is not strictly necessary for
21495 correct execution of the code. Specifying @option{-fomit-frame-pointer}
21496 with this option causes the stack frames not to be generated for
21497 leaf functions. The default is @option{-mno-apcs-frame}.
21498 This option is deprecated.
21499
21500 @item -mapcs
21501 @opindex mapcs
21502 This is a synonym for @option{-mapcs-frame} and is deprecated.
21503
21504 @ignore
21505 @c not currently implemented
21506 @item -mapcs-stack-check
21507 @opindex mapcs-stack-check
21508 Generate code to check the amount of stack space available upon entry to
21509 every function (that actually uses some stack space). If there is
21510 insufficient space available then either the function
21511 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
21512 called, depending upon the amount of stack space required. The runtime
21513 system is required to provide these functions. The default is
21514 @option{-mno-apcs-stack-check}, since this produces smaller code.
21515
21516 @c not currently implemented
21517 @item -mapcs-reentrant
21518 @opindex mapcs-reentrant
21519 Generate reentrant, position-independent code. The default is
21520 @option{-mno-apcs-reentrant}.
21521 @end ignore
21522
21523 @item -mthumb-interwork
21524 @opindex mthumb-interwork
21525 Generate code that supports calling between the ARM and Thumb
21526 instruction sets. Without this option, on pre-v5 architectures, the
21527 two instruction sets cannot be reliably used inside one program. The
21528 default is @option{-mno-thumb-interwork}, since slightly larger code
21529 is generated when @option{-mthumb-interwork} is specified. In AAPCS
21530 configurations this option is meaningless.
21531
21532 @item -mno-sched-prolog
21533 @opindex mno-sched-prolog
21534 @opindex msched-prolog
21535 Prevent the reordering of instructions in the function prologue, or the
21536 merging of those instruction with the instructions in the function's
21537 body. This means that all functions start with a recognizable set
21538 of instructions (or in fact one of a choice from a small set of
21539 different function prologues), and this information can be used to
21540 locate the start of functions inside an executable piece of code. The
21541 default is @option{-msched-prolog}.
21542
21543 @item -mfloat-abi=@var{name}
21544 @opindex mfloat-abi
21545 Specifies which floating-point ABI to use. Permissible values
21546 are: @samp{soft}, @samp{softfp} and @samp{hard}.
21547
21548 Specifying @samp{soft} causes GCC to generate output containing
21549 library calls for floating-point operations.
21550 @samp{softfp} allows the generation of code using hardware floating-point
21551 instructions, but still uses the soft-float calling conventions.
21552 @samp{hard} allows generation of floating-point instructions
21553 and uses FPU-specific calling conventions.
21554
21555 The default depends on the specific target configuration. Note that
21556 the hard-float and soft-float ABIs are not link-compatible; you must
21557 compile your entire program with the same ABI, and link with a
21558 compatible set of libraries.
21559
21560 @item -mgeneral-regs-only
21561 @opindex mgeneral-regs-only
21562 Generate code which uses only the general-purpose registers. This will prevent
21563 the compiler from using floating-point and Advanced SIMD registers but will not
21564 impose any restrictions on the assembler.
21565
21566 @item -mlittle-endian
21567 @opindex mlittle-endian
21568 Generate code for a processor running in little-endian mode. This is
21569 the default for all standard configurations.
21570
21571 @item -mbig-endian
21572 @opindex mbig-endian
21573 Generate code for a processor running in big-endian mode; the default is
21574 to compile code for a little-endian processor.
21575
21576 @item -mbe8
21577 @itemx -mbe32
21578 @opindex mbe8
21579 When linking a big-endian image select between BE8 and BE32 formats.
21580 The option has no effect for little-endian images and is ignored. The
21581 default is dependent on the selected target architecture. For ARMv6
21582 and later architectures the default is BE8, for older architectures
21583 the default is BE32. BE32 format has been deprecated by ARM.
21584
21585 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
21586 @opindex march
21587 This specifies the name of the target ARM architecture. GCC uses this
21588 name to determine what kind of instructions it can emit when generating
21589 assembly code. This option can be used in conjunction with or instead
21590 of the @option{-mcpu=} option.
21591
21592 Permissible names are:
21593 @samp{armv4t},
21594 @samp{armv5t}, @samp{armv5te},
21595 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
21596 @samp{armv6z}, @samp{armv6zk},
21597 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
21598 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
21599 @samp{armv8.4-a},
21600 @samp{armv8.5-a},
21601 @samp{armv8.6-a},
21602 @samp{armv9-a},
21603 @samp{armv7-r},
21604 @samp{armv8-r},
21605 @samp{armv6-m}, @samp{armv6s-m},
21606 @samp{armv7-m}, @samp{armv7e-m},
21607 @samp{armv8-m.base}, @samp{armv8-m.main},
21608 @samp{armv8.1-m.main},
21609 @samp{armv9-a},
21610 @samp{iwmmxt} and @samp{iwmmxt2}.
21611
21612 Additionally, the following architectures, which lack support for the
21613 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
21614
21615 Many of the architectures support extensions. These can be added by
21616 appending @samp{+@var{extension}} to the architecture name. Extension
21617 options are processed in order and capabilities accumulate. An extension
21618 will also enable any necessary base extensions
21619 upon which it depends. For example, the @samp{+crypto} extension
21620 will always enable the @samp{+simd} extension. The exception to the
21621 additive construction is for extensions that are prefixed with
21622 @samp{+no@dots{}}: these extensions disable the specified option and
21623 any other extensions that may depend on the presence of that
21624 extension.
21625
21626 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
21627 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
21628 entirely disabled by the @samp{+nofp} option that follows it.
21629
21630 Most extension names are generically named, but have an effect that is
21631 dependent upon the architecture to which it is applied. For example,
21632 the @samp{+simd} option can be applied to both @samp{armv7-a} and
21633 @samp{armv8-a} architectures, but will enable the original ARMv7-A
21634 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
21635 variant for @samp{armv8-a}.
21636
21637 The table below lists the supported extensions for each architecture.
21638 Architectures not mentioned do not support any extensions.
21639
21640 @table @samp
21641 @item armv5te
21642 @itemx armv6
21643 @itemx armv6j
21644 @itemx armv6k
21645 @itemx armv6kz
21646 @itemx armv6t2
21647 @itemx armv6z
21648 @itemx armv6zk
21649 @table @samp
21650 @item +fp
21651 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
21652 used as an alias for this extension.
21653
21654 @item +nofp
21655 Disable the floating-point instructions.
21656 @end table
21657
21658 @item armv7
21659 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
21660 @table @samp
21661 @item +fp
21662 The VFPv3 floating-point instructions, with 16 double-precision
21663 registers. The extension @samp{+vfpv3-d16} can be used as an alias
21664 for this extension. Note that floating-point is not supported by the
21665 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
21666 ARMv7-R architectures.
21667
21668 @item +nofp
21669 Disable the floating-point instructions.
21670 @end table
21671
21672 @item armv7-a
21673 @table @samp
21674 @item +mp
21675 The multiprocessing extension.
21676
21677 @item +sec
21678 The security extension.
21679
21680 @item +fp
21681 The VFPv3 floating-point instructions, with 16 double-precision
21682 registers. The extension @samp{+vfpv3-d16} can be used as an alias
21683 for this extension.
21684
21685 @item +simd
21686 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21687 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
21688 for this extension.
21689
21690 @item +vfpv3
21691 The VFPv3 floating-point instructions, with 32 double-precision
21692 registers.
21693
21694 @item +vfpv3-d16-fp16
21695 The VFPv3 floating-point instructions, with 16 double-precision
21696 registers and the half-precision floating-point conversion operations.
21697
21698 @item +vfpv3-fp16
21699 The VFPv3 floating-point instructions, with 32 double-precision
21700 registers and the half-precision floating-point conversion operations.
21701
21702 @item +vfpv4-d16
21703 The VFPv4 floating-point instructions, with 16 double-precision
21704 registers.
21705
21706 @item +vfpv4
21707 The VFPv4 floating-point instructions, with 32 double-precision
21708 registers.
21709
21710 @item +neon-fp16
21711 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21712 the half-precision floating-point conversion operations.
21713
21714 @item +neon-vfpv4
21715 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
21716
21717 @item +nosimd
21718 Disable the Advanced SIMD instructions (does not disable floating point).
21719
21720 @item +nofp
21721 Disable the floating-point and Advanced SIMD instructions.
21722 @end table
21723
21724 @item armv7ve
21725 The extended version of the ARMv7-A architecture with support for
21726 virtualization.
21727 @table @samp
21728 @item +fp
21729 The VFPv4 floating-point instructions, with 16 double-precision registers.
21730 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
21731
21732 @item +simd
21733 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
21734 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
21735
21736 @item +vfpv3-d16
21737 The VFPv3 floating-point instructions, with 16 double-precision
21738 registers.
21739
21740 @item +vfpv3
21741 The VFPv3 floating-point instructions, with 32 double-precision
21742 registers.
21743
21744 @item +vfpv3-d16-fp16
21745 The VFPv3 floating-point instructions, with 16 double-precision
21746 registers and the half-precision floating-point conversion operations.
21747
21748 @item +vfpv3-fp16
21749 The VFPv3 floating-point instructions, with 32 double-precision
21750 registers and the half-precision floating-point conversion operations.
21751
21752 @item +vfpv4-d16
21753 The VFPv4 floating-point instructions, with 16 double-precision
21754 registers.
21755
21756 @item +vfpv4
21757 The VFPv4 floating-point instructions, with 32 double-precision
21758 registers.
21759
21760 @item +neon
21761 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
21762 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
21763
21764 @item +neon-fp16
21765 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
21766 the half-precision floating-point conversion operations.
21767
21768 @item +nosimd
21769 Disable the Advanced SIMD instructions (does not disable floating point).
21770
21771 @item +nofp
21772 Disable the floating-point and Advanced SIMD instructions.
21773 @end table
21774
21775 @item armv8-a
21776 @table @samp
21777 @item +crc
21778 The Cyclic Redundancy Check (CRC) instructions.
21779 @item +simd
21780 The ARMv8-A Advanced SIMD and floating-point instructions.
21781 @item +crypto
21782 The cryptographic instructions.
21783 @item +nocrypto
21784 Disable the cryptographic instructions.
21785 @item +nofp
21786 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21787 @item +sb
21788 Speculation Barrier Instruction.
21789 @item +predres
21790 Execution and Data Prediction Restriction Instructions.
21791 @end table
21792
21793 @item armv8.1-a
21794 @table @samp
21795 @item +simd
21796 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21797
21798 @item +crypto
21799 The cryptographic instructions. This also enables the Advanced SIMD and
21800 floating-point instructions.
21801
21802 @item +nocrypto
21803 Disable the cryptographic instructions.
21804
21805 @item +nofp
21806 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21807
21808 @item +sb
21809 Speculation Barrier Instruction.
21810
21811 @item +predres
21812 Execution and Data Prediction Restriction Instructions.
21813 @end table
21814
21815 @item armv8.2-a
21816 @itemx armv8.3-a
21817 @table @samp
21818 @item +fp16
21819 The half-precision floating-point data processing instructions.
21820 This also enables the Advanced SIMD and floating-point instructions.
21821
21822 @item +fp16fml
21823 The half-precision floating-point fmla extension. This also enables
21824 the half-precision floating-point extension and Advanced SIMD and
21825 floating-point instructions.
21826
21827 @item +simd
21828 The ARMv8.1-A Advanced SIMD and floating-point instructions.
21829
21830 @item +crypto
21831 The cryptographic instructions. This also enables the Advanced SIMD and
21832 floating-point instructions.
21833
21834 @item +dotprod
21835 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
21836
21837 @item +nocrypto
21838 Disable the cryptographic extension.
21839
21840 @item +nofp
21841 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21842
21843 @item +sb
21844 Speculation Barrier Instruction.
21845
21846 @item +predres
21847 Execution and Data Prediction Restriction Instructions.
21848
21849 @item +i8mm
21850 8-bit Integer Matrix Multiply instructions.
21851 This also enables Advanced SIMD and floating-point instructions.
21852
21853 @item +bf16
21854 Brain half-precision floating-point instructions.
21855 This also enables Advanced SIMD and floating-point instructions.
21856 @end table
21857
21858 @item armv8.4-a
21859 @table @samp
21860 @item +fp16
21861 The half-precision floating-point data processing instructions.
21862 This also enables the Advanced SIMD and floating-point instructions as well
21863 as the Dot Product extension and the half-precision floating-point fmla
21864 extension.
21865
21866 @item +simd
21867 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21868 Dot Product extension.
21869
21870 @item +crypto
21871 The cryptographic instructions. This also enables the Advanced SIMD and
21872 floating-point instructions as well as the Dot Product extension.
21873
21874 @item +nocrypto
21875 Disable the cryptographic extension.
21876
21877 @item +nofp
21878 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21879
21880 @item +sb
21881 Speculation Barrier Instruction.
21882
21883 @item +predres
21884 Execution and Data Prediction Restriction Instructions.
21885
21886 @item +i8mm
21887 8-bit Integer Matrix Multiply instructions.
21888 This also enables Advanced SIMD and floating-point instructions.
21889
21890 @item +bf16
21891 Brain half-precision floating-point instructions.
21892 This also enables Advanced SIMD and floating-point instructions.
21893 @end table
21894
21895 @item armv8.5-a
21896 @table @samp
21897 @item +fp16
21898 The half-precision floating-point data processing instructions.
21899 This also enables the Advanced SIMD and floating-point instructions as well
21900 as the Dot Product extension and the half-precision floating-point fmla
21901 extension.
21902
21903 @item +simd
21904 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21905 Dot Product extension.
21906
21907 @item +crypto
21908 The cryptographic instructions. This also enables the Advanced SIMD and
21909 floating-point instructions as well as the Dot Product extension.
21910
21911 @item +nocrypto
21912 Disable the cryptographic extension.
21913
21914 @item +nofp
21915 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21916
21917 @item +i8mm
21918 8-bit Integer Matrix Multiply instructions.
21919 This also enables Advanced SIMD and floating-point instructions.
21920
21921 @item +bf16
21922 Brain half-precision floating-point instructions.
21923 This also enables Advanced SIMD and floating-point instructions.
21924 @end table
21925
21926 @item armv8.6-a
21927 @table @samp
21928 @item +fp16
21929 The half-precision floating-point data processing instructions.
21930 This also enables the Advanced SIMD and floating-point instructions as well
21931 as the Dot Product extension and the half-precision floating-point fmla
21932 extension.
21933
21934 @item +simd
21935 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
21936 Dot Product extension.
21937
21938 @item +crypto
21939 The cryptographic instructions. This also enables the Advanced SIMD and
21940 floating-point instructions as well as the Dot Product extension.
21941
21942 @item +nocrypto
21943 Disable the cryptographic extension.
21944
21945 @item +nofp
21946 Disable the floating-point, Advanced SIMD and cryptographic instructions.
21947
21948 @item +i8mm
21949 8-bit Integer Matrix Multiply instructions.
21950 This also enables Advanced SIMD and floating-point instructions.
21951
21952 @item +bf16
21953 Brain half-precision floating-point instructions.
21954 This also enables Advanced SIMD and floating-point instructions.
21955 @end table
21956
21957 @item armv7-r
21958 @table @samp
21959 @item +fp.sp
21960 The single-precision VFPv3 floating-point instructions. The extension
21961 @samp{+vfpv3xd} can be used as an alias for this extension.
21962
21963 @item +fp
21964 The VFPv3 floating-point instructions with 16 double-precision registers.
21965 The extension +vfpv3-d16 can be used as an alias for this extension.
21966
21967 @item +vfpv3xd-d16-fp16
21968 The single-precision VFPv3 floating-point instructions with 16 double-precision
21969 registers and the half-precision floating-point conversion operations.
21970
21971 @item +vfpv3-d16-fp16
21972 The VFPv3 floating-point instructions with 16 double-precision
21973 registers and the half-precision floating-point conversion operations.
21974
21975 @item +nofp
21976 Disable the floating-point extension.
21977
21978 @item +idiv
21979 The ARM-state integer division instructions.
21980
21981 @item +noidiv
21982 Disable the ARM-state integer division extension.
21983 @end table
21984
21985 @item armv7e-m
21986 @table @samp
21987 @item +fp
21988 The single-precision VFPv4 floating-point instructions.
21989
21990 @item +fpv5
21991 The single-precision FPv5 floating-point instructions.
21992
21993 @item +fp.dp
21994 The single- and double-precision FPv5 floating-point instructions.
21995
21996 @item +nofp
21997 Disable the floating-point extensions.
21998 @end table
21999
22000 @item armv8.1-m.main
22001 @table @samp
22002
22003 @item +dsp
22004 The DSP instructions.
22005
22006 @item +mve
22007 The M-Profile Vector Extension (MVE) integer instructions.
22008
22009 @item +mve.fp
22010 The M-Profile Vector Extension (MVE) integer and single precision
22011 floating-point instructions.
22012
22013 @item +fp
22014 The single-precision floating-point instructions.
22015
22016 @item +fp.dp
22017 The single- and double-precision floating-point instructions.
22018
22019 @item +nofp
22020 Disable the floating-point extension.
22021
22022 @item +cdecp0, +cdecp1, ... , +cdecp7
22023 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22024 to the numbers given in the options in the range 0 to 7.
22025 @end table
22026
22027 @item armv8-m.main
22028 @table @samp
22029 @item +dsp
22030 The DSP instructions.
22031
22032 @item +nodsp
22033 Disable the DSP extension.
22034
22035 @item +fp
22036 The single-precision floating-point instructions.
22037
22038 @item +fp.dp
22039 The single- and double-precision floating-point instructions.
22040
22041 @item +nofp
22042 Disable the floating-point extension.
22043
22044 @item +cdecp0, +cdecp1, ... , +cdecp7
22045 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22046 to the numbers given in the options in the range 0 to 7.
22047 @end table
22048
22049 @item armv8-r
22050 @table @samp
22051 @item +crc
22052 The Cyclic Redundancy Check (CRC) instructions.
22053 @item +fp.sp
22054 The single-precision FPv5 floating-point instructions.
22055 @item +simd
22056 The ARMv8-A Advanced SIMD and floating-point instructions.
22057 @item +crypto
22058 The cryptographic instructions.
22059 @item +nocrypto
22060 Disable the cryptographic instructions.
22061 @item +nofp
22062 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22063 @end table
22064
22065 @end table
22066
22067 @option{-march=native} causes the compiler to auto-detect the architecture
22068 of the build computer. At present, this feature is only supported on
22069 GNU/Linux, and not all architectures are recognized. If the auto-detect
22070 is unsuccessful the option has no effect.
22071
22072 @item -mtune=@var{name}
22073 @opindex mtune
22074 This option specifies the name of the target ARM processor for
22075 which GCC should tune the performance of the code.
22076 For some ARM implementations better performance can be obtained by using
22077 this option.
22078 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22079 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22080 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22081 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22082 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22083 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22084 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22085 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22086 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22087 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22088 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22089 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22090 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22091 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22092 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22093 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22094 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22095 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22096 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22097 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1}, @samp{cortex-x1c},
22098 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22099 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22100 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22101 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22102 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22103 @samp{xgene1}.
22104
22105 Additionally, this option can specify that GCC should tune the performance
22106 of the code for a big.LITTLE system. Permissible names are:
22107 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22108 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22109 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22110 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22111
22112 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22113 performance for a blend of processors within architecture @var{arch}.
22114 The aim is to generate code that run well on the current most popular
22115 processors, balancing between optimizations that benefit some CPUs in the
22116 range, and avoiding performance pitfalls of other CPUs. The effects of
22117 this option may change in future GCC versions as CPU models come and go.
22118
22119 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22120 the extension options do not affect the tuning of the generated code.
22121
22122 @option{-mtune=native} causes the compiler to auto-detect the CPU
22123 of the build computer. At present, this feature is only supported on
22124 GNU/Linux, and not all architectures are recognized. If the auto-detect is
22125 unsuccessful the option has no effect.
22126
22127 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22128 @opindex mcpu
22129 This specifies the name of the target ARM processor. GCC uses this name
22130 to derive the name of the target ARM architecture (as if specified
22131 by @option{-march}) and the ARM processor type for which to tune for
22132 performance (as if specified by @option{-mtune}). Where this option
22133 is used in conjunction with @option{-march} or @option{-mtune},
22134 those options take precedence over the appropriate part of this option.
22135
22136 Many of the supported CPUs implement optional architectural
22137 extensions. Where this is so the architectural extensions are
22138 normally enabled by default. If implementations that lack the
22139 extension exist, then the extension syntax can be used to disable
22140 those extensions that have been omitted. For floating-point and
22141 Advanced SIMD (Neon) instructions, the settings of the options
22142 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22143 floating-point and Advanced SIMD instructions will only be used if
22144 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22145 @option{-mfpu} other than @samp{auto} will override the available
22146 floating-point and SIMD extension instructions.
22147
22148 For example, @samp{cortex-a9} can be found in three major
22149 configurations: integer only, with just a floating-point unit or with
22150 floating-point and Advanced SIMD. The default is to enable all the
22151 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22152 be used to disable just the SIMD or both the SIMD and floating-point
22153 instructions respectively.
22154
22155 Permissible names for this option are the same as those for
22156 @option{-mtune}.
22157
22158 The following extension options are common to the listed CPUs:
22159
22160 @table @samp
22161 @item +nodsp
22162 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}
22163 and @samp{cortex-m55}. Also disable the M-Profile Vector Extension (MVE)
22164 integer and single precision floating-point instructions on @samp{cortex-m55}.
22165
22166 @item +nomve
22167 Disable the M-Profile Vector Extension (MVE) integer and single precision
22168 floating-point instructions on @samp{cortex-m55}.
22169
22170 @item +nomve.fp
22171 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22172 instructions on @samp{cortex-m55}.
22173
22174 @item +nofp
22175 Disables the floating-point instructions on @samp{arm9e},
22176 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22177 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22178 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22179 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22180 and @samp{cortex-m55}.
22181 Disables the floating-point and SIMD instructions on
22182 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22183 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22184 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22185 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22186 @samp{cortex-a53} and @samp{cortex-a55}.
22187
22188 @item +nofp.dp
22189 Disables the double-precision component of the floating-point instructions
22190 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22191 @samp{cortex-r52plus} and @samp{cortex-m7}.
22192
22193 @item +nosimd
22194 Disables the SIMD (but not floating-point) instructions on
22195 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22196 and @samp{cortex-a9}.
22197
22198 @item +crypto
22199 Enables the cryptographic instructions on @samp{cortex-a32},
22200 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22201 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22202 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22203 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22204 @samp{cortex-a75.cortex-a55}.
22205 @end table
22206
22207 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22208 VFPv3 with 16 double-precision registers. It supports the following
22209 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22210 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22211 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22212 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
22213 the extensions to @option{-march=armv7-a}.
22214
22215 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22216 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22217 See @option{-mtune} for more information.
22218
22219 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22220 of the build computer. At present, this feature is only supported on
22221 GNU/Linux, and not all architectures are recognized. If the auto-detect
22222 is unsuccessful the option has no effect.
22223
22224 @item -mfpu=@var{name}
22225 @opindex mfpu
22226 This specifies what floating-point hardware (or hardware emulation) is
22227 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
22228 @samp{vfpv3},
22229 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22230 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22231 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22232 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22233 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22234 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22235 is an alias for @samp{vfpv2}.
22236
22237 The setting @samp{auto} is the default and is special. It causes the
22238 compiler to select the floating-point and Advanced SIMD instructions
22239 based on the settings of @option{-mcpu} and @option{-march}.
22240
22241 If the selected floating-point hardware includes the NEON extension
22242 (e.g.@: @option{-mfpu=neon}), note that floating-point
22243 operations are not generated by GCC's auto-vectorization pass unless
22244 @option{-funsafe-math-optimizations} is also specified. This is
22245 because NEON hardware does not fully implement the IEEE 754 standard for
22246 floating-point arithmetic (in particular denormal values are treated as
22247 zero), so the use of NEON instructions may lead to a loss of precision.
22248
22249 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}).
22250
22251 @item -mfp16-format=@var{name}
22252 @opindex mfp16-format
22253 Specify the format of the @code{__fp16} half-precision floating-point type.
22254 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22255 the default is @samp{none}, in which case the @code{__fp16} type is not
22256 defined. @xref{Half-Precision}, for more information.
22257
22258 @item -mstructure-size-boundary=@var{n}
22259 @opindex mstructure-size-boundary
22260 The sizes of all structures and unions are rounded up to a multiple
22261 of the number of bits set by this option. Permissible values are 8, 32
22262 and 64. The default value varies for different toolchains. For the COFF
22263 targeted toolchain the default value is 8. A value of 64 is only allowed
22264 if the underlying ABI supports it.
22265
22266 Specifying a larger number can produce faster, more efficient code, but
22267 can also increase the size of the program. Different values are potentially
22268 incompatible. Code compiled with one value cannot necessarily expect to
22269 work with code or libraries compiled with another value, if they exchange
22270 information using structures or unions.
22271
22272 This option is deprecated.
22273
22274 @item -mabort-on-noreturn
22275 @opindex mabort-on-noreturn
22276 Generate a call to the function @code{abort} at the end of a
22277 @code{noreturn} function. It is executed if the function tries to
22278 return.
22279
22280 @item -mlong-calls
22281 @itemx -mno-long-calls
22282 @opindex mlong-calls
22283 @opindex mno-long-calls
22284 Tells the compiler to perform function calls by first loading the
22285 address of the function into a register and then performing a subroutine
22286 call on this register. This switch is needed if the target function
22287 lies outside of the 64-megabyte addressing range of the offset-based
22288 version of subroutine call instruction.
22289
22290 Even if this switch is enabled, not all function calls are turned
22291 into long calls. The heuristic is that static functions, functions
22292 that have the @code{short_call} attribute, functions that are inside
22293 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22294 definitions have already been compiled within the current compilation
22295 unit are not turned into long calls. The exceptions to this rule are
22296 that weak function definitions, functions with the @code{long_call}
22297 attribute or the @code{section} attribute, and functions that are within
22298 the scope of a @code{#pragma long_calls} directive are always
22299 turned into long calls.
22300
22301 This feature is not enabled by default. Specifying
22302 @option{-mno-long-calls} restores the default behavior, as does
22303 placing the function calls within the scope of a @code{#pragma
22304 long_calls_off} directive. Note these switches have no effect on how
22305 the compiler generates code to handle function calls via function
22306 pointers.
22307
22308 @item -msingle-pic-base
22309 @opindex msingle-pic-base
22310 Treat the register used for PIC addressing as read-only, rather than
22311 loading it in the prologue for each function. The runtime system is
22312 responsible for initializing this register with an appropriate value
22313 before execution begins.
22314
22315 @item -mpic-register=@var{reg}
22316 @opindex mpic-register
22317 Specify the register to be used for PIC addressing.
22318 For standard PIC base case, the default is any suitable register
22319 determined by compiler. For single PIC base case, the default is
22320 @samp{R9} if target is EABI based or stack-checking is enabled,
22321 otherwise the default is @samp{R10}.
22322
22323 @item -mpic-data-is-text-relative
22324 @opindex mpic-data-is-text-relative
22325 Assume that the displacement between the text and data segments is fixed
22326 at static link time. This permits using PC-relative addressing
22327 operations to access data known to be in the data segment. For
22328 non-VxWorks RTP targets, this option is enabled by default. When
22329 disabled on such targets, it will enable @option{-msingle-pic-base} by
22330 default.
22331
22332 @item -mpoke-function-name
22333 @opindex mpoke-function-name
22334 Write the name of each function into the text section, directly
22335 preceding the function prologue. The generated code is similar to this:
22336
22337 @smallexample
22338 t0
22339 .ascii "arm_poke_function_name", 0
22340 .align
22341 t1
22342 .word 0xff000000 + (t1 - t0)
22343 arm_poke_function_name
22344 mov ip, sp
22345 stmfd sp!, @{fp, ip, lr, pc@}
22346 sub fp, ip, #4
22347 @end smallexample
22348
22349 When performing a stack backtrace, code can inspect the value of
22350 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
22351 location @code{pc - 12} and the top 8 bits are set, then we know that
22352 there is a function name embedded immediately preceding this location
22353 and has length @code{((pc[-3]) & 0xff000000)}.
22354
22355 @item -mthumb
22356 @itemx -marm
22357 @opindex marm
22358 @opindex mthumb
22359
22360 Select between generating code that executes in ARM and Thumb
22361 states. The default for most configurations is to generate code
22362 that executes in ARM state, but the default can be changed by
22363 configuring GCC with the @option{--with-mode=}@var{state}
22364 configure option.
22365
22366 You can also override the ARM and Thumb mode for each function
22367 by using the @code{target("thumb")} and @code{target("arm")} function attributes
22368 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22369
22370 @item -mflip-thumb
22371 @opindex mflip-thumb
22372 Switch ARM/Thumb modes on alternating functions.
22373 This option is provided for regression testing of mixed Thumb/ARM code
22374 generation, and is not intended for ordinary use in compiling code.
22375
22376 @item -mtpcs-frame
22377 @opindex mtpcs-frame
22378 Generate a stack frame that is compliant with the Thumb Procedure Call
22379 Standard for all non-leaf functions. (A leaf function is one that does
22380 not call any other functions.) The default is @option{-mno-tpcs-frame}.
22381
22382 @item -mtpcs-leaf-frame
22383 @opindex mtpcs-leaf-frame
22384 Generate a stack frame that is compliant with the Thumb Procedure Call
22385 Standard for all leaf functions. (A leaf function is one that does
22386 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
22387
22388 @item -mcallee-super-interworking
22389 @opindex mcallee-super-interworking
22390 Gives all externally visible functions in the file being compiled an ARM
22391 instruction set header which switches to Thumb mode before executing the
22392 rest of the function. This allows these functions to be called from
22393 non-interworking code. This option is not valid in AAPCS configurations
22394 because interworking is enabled by default.
22395
22396 @item -mcaller-super-interworking
22397 @opindex mcaller-super-interworking
22398 Allows calls via function pointers (including virtual functions) to
22399 execute correctly regardless of whether the target code has been
22400 compiled for interworking or not. There is a small overhead in the cost
22401 of executing a function pointer if this option is enabled. This option
22402 is not valid in AAPCS configurations because interworking is enabled
22403 by default.
22404
22405 @item -mtp=@var{name}
22406 @opindex mtp
22407 Specify the access model for the thread local storage pointer. The valid
22408 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
22409 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
22410 (supported in the arm6k architecture), and @samp{auto}, which uses the
22411 best available method for the selected processor. The default setting is
22412 @samp{auto}.
22413
22414 @item -mtls-dialect=@var{dialect}
22415 @opindex mtls-dialect
22416 Specify the dialect to use for accessing thread local storage. Two
22417 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
22418 @samp{gnu} dialect selects the original GNU scheme for supporting
22419 local and global dynamic TLS models. The @samp{gnu2} dialect
22420 selects the GNU descriptor scheme, which provides better performance
22421 for shared libraries. The GNU descriptor scheme is compatible with
22422 the original scheme, but does require new assembler, linker and
22423 library support. Initial and local exec TLS models are unaffected by
22424 this option and always use the original scheme.
22425
22426 @item -mword-relocations
22427 @opindex mword-relocations
22428 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
22429 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
22430 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
22431 is specified. This option conflicts with @option{-mslow-flash-data}.
22432
22433 @item -mfix-cortex-m3-ldrd
22434 @opindex mfix-cortex-m3-ldrd
22435 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
22436 with overlapping destination and base registers are used. This option avoids
22437 generating these instructions. This option is enabled by default when
22438 @option{-mcpu=cortex-m3} is specified.
22439
22440 @item -mfix-cortex-a57-aes-1742098
22441 @itemx -mno-fix-cortex-a57-aes-1742098
22442 @itemx -mfix-cortex-a72-aes-1655431
22443 @itemx -mno-fix-cortex-a72-aes-1655431
22444 Enable (disable) mitigation for an erratum on Cortex-A57 and
22445 Cortex-A72 that affects the AES cryptographic instructions. This
22446 option is enabled by default when either @option{-mcpu=cortex-a57} or
22447 @option{-mcpu=cortex-a72} is specified.
22448
22449 @item -munaligned-access
22450 @itemx -mno-unaligned-access
22451 @opindex munaligned-access
22452 @opindex mno-unaligned-access
22453 Enables (or disables) reading and writing of 16- and 32- bit values
22454 from addresses that are not 16- or 32- bit aligned. By default
22455 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
22456 ARMv8-M Baseline architectures, and enabled for all other
22457 architectures. If unaligned access is not enabled then words in packed
22458 data structures are accessed a byte at a time.
22459
22460 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
22461 generated object file to either true or false, depending upon the
22462 setting of this option. If unaligned access is enabled then the
22463 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
22464 defined.
22465
22466 @item -mneon-for-64bits
22467 @opindex mneon-for-64bits
22468 This option is deprecated and has no effect.
22469
22470 @item -mslow-flash-data
22471 @opindex mslow-flash-data
22472 Assume loading data from flash is slower than fetching instruction.
22473 Therefore literal load is minimized for better performance.
22474 This option is only supported when compiling for ARMv7 M-profile and
22475 off by default. It conflicts with @option{-mword-relocations}.
22476
22477 @item -masm-syntax-unified
22478 @opindex masm-syntax-unified
22479 Assume inline assembler is using unified asm syntax. The default is
22480 currently off which implies divided syntax. This option has no impact
22481 on Thumb2. However, this may change in future releases of GCC.
22482 Divided syntax should be considered deprecated.
22483
22484 @item -mrestrict-it
22485 @opindex mrestrict-it
22486 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
22487 IT blocks can only contain a single 16-bit instruction from a select
22488 set of instructions. This option is on by default for ARMv8-A Thumb mode.
22489
22490 @item -mprint-tune-info
22491 @opindex mprint-tune-info
22492 Print CPU tuning information as comment in assembler file. This is
22493 an option used only for regression testing of the compiler and not
22494 intended for ordinary use in compiling code. This option is disabled
22495 by default.
22496
22497 @item -mverbose-cost-dump
22498 @opindex mverbose-cost-dump
22499 Enable verbose cost model dumping in the debug dump files. This option is
22500 provided for use in debugging the compiler.
22501
22502 @item -mpure-code
22503 @opindex mpure-code
22504 Do not allow constant data to be placed in code sections.
22505 Additionally, when compiling for ELF object format give all text sections the
22506 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
22507 is only available when generating non-pic code for M-profile targets.
22508
22509 @item -mcmse
22510 @opindex mcmse
22511 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
22512 Development Tools Engineering Specification", which can be found on
22513 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
22514
22515 @item -mfix-cmse-cve-2021-35465
22516 @opindex mfix-cmse-cve-2021-35465
22517 Mitigate against a potential security issue with the @code{VLLDM} instruction
22518 in some M-profile devices when using CMSE (CVE-2021-365465). This option is
22519 enabled by default when the option @option{-mcpu=} is used with
22520 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55} or @code{star-mc1}.
22521 The option @option{-mno-fix-cmse-cve-2021-35465} can be used to disable
22522 the mitigation.
22523
22524 @item -mstack-protector-guard=@var{guard}
22525 @itemx -mstack-protector-guard-offset=@var{offset}
22526 @opindex mstack-protector-guard
22527 @opindex mstack-protector-guard-offset
22528 Generate stack protection code using canary at @var{guard}. Supported
22529 locations are @samp{global} for a global canary or @samp{tls} for a
22530 canary accessible via the TLS register. The option
22531 @option{-mstack-protector-guard-offset=} is for use with
22532 @option{-fstack-protector-guard=tls} and not for use in user-land code.
22533
22534 @item -mfdpic
22535 @itemx -mno-fdpic
22536 @opindex mfdpic
22537 @opindex mno-fdpic
22538 Select the FDPIC ABI, which uses 64-bit function descriptors to
22539 represent pointers to functions. When the compiler is configured for
22540 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
22541 and implies @option{-fPIE} if none of the PIC/PIE-related options is
22542 provided. On other targets, it only enables the FDPIC-specific code
22543 generation features, and the user should explicitly provide the
22544 PIC/PIE-related options as needed.
22545
22546 Note that static linking is not supported because it would still
22547 involve the dynamic linker when the program self-relocates. If such
22548 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
22549
22550 The opposite @option{-mno-fdpic} option is useful (and required) to
22551 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
22552 toolchain as the one used to build the userland programs.
22553
22554 @end table
22555
22556 @node AVR Options
22557 @subsection AVR Options
22558 @cindex AVR Options
22559
22560 These options are defined for AVR implementations:
22561
22562 @table @gcctabopt
22563 @item -mmcu=@var{mcu}
22564 @opindex mmcu
22565 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
22566
22567 The default for this option is@tie{}@samp{avr2}.
22568
22569 GCC supports the following AVR devices and ISAs:
22570
22571 @include avr-mmcu.texi
22572
22573 @item -mabsdata
22574 @opindex mabsdata
22575
22576 Assume that all data in static storage can be accessed by LDS / STS
22577 instructions. This option has only an effect on reduced Tiny devices like
22578 ATtiny40. See also the @code{absdata}
22579 @ref{AVR Variable Attributes,variable attribute}.
22580
22581 @item -maccumulate-args
22582 @opindex maccumulate-args
22583 Accumulate outgoing function arguments and acquire/release the needed
22584 stack space for outgoing function arguments once in function
22585 prologue/epilogue. Without this option, outgoing arguments are pushed
22586 before calling a function and popped afterwards.
22587
22588 Popping the arguments after the function call can be expensive on
22589 AVR so that accumulating the stack space might lead to smaller
22590 executables because arguments need not be removed from the
22591 stack after such a function call.
22592
22593 This option can lead to reduced code size for functions that perform
22594 several calls to functions that get their arguments on the stack like
22595 calls to printf-like functions.
22596
22597 @item -mbranch-cost=@var{cost}
22598 @opindex mbranch-cost
22599 Set the branch costs for conditional branch instructions to
22600 @var{cost}. Reasonable values for @var{cost} are small, non-negative
22601 integers. The default branch cost is 0.
22602
22603 @item -mcall-prologues
22604 @opindex mcall-prologues
22605 Functions prologues/epilogues are expanded as calls to appropriate
22606 subroutines. Code size is smaller.
22607
22608 @item -mdouble=@var{bits}
22609 @itemx -mlong-double=@var{bits}
22610 @opindex mdouble
22611 @opindex mlong-double
22612 Set the size (in bits) of the @code{double} or @code{long double} type,
22613 respectively. Possible values for @var{bits} are 32 and 64.
22614 Whether or not a specific value for @var{bits} is allowed depends on
22615 the @code{--with-double=} and @code{--with-long-double=}
22616 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
22617 and the same applies for the default values of the options.
22618
22619 @item -mgas-isr-prologues
22620 @opindex mgas-isr-prologues
22621 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
22622 instruction supported by GNU Binutils.
22623 If this option is on, the feature can still be disabled for individual
22624 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
22625 function attribute. This feature is activated per default
22626 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
22627 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
22628
22629 @item -mint8
22630 @opindex mint8
22631 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
22632 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
22633 and @code{long long} is 4 bytes. Please note that this option does not
22634 conform to the C standards, but it results in smaller code
22635 size.
22636
22637 @item -mmain-is-OS_task
22638 @opindex mmain-is-OS_task
22639 Do not save registers in @code{main}. The effect is the same like
22640 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
22641 to @code{main}. It is activated per default if optimization is on.
22642
22643 @item -mn-flash=@var{num}
22644 @opindex mn-flash
22645 Assume that the flash memory has a size of
22646 @var{num} times 64@tie{}KiB.
22647
22648 @item -mno-interrupts
22649 @opindex mno-interrupts
22650 Generated code is not compatible with hardware interrupts.
22651 Code size is smaller.
22652
22653 @item -mrelax
22654 @opindex mrelax
22655 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
22656 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
22657 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
22658 the assembler's command line and the @option{--relax} option to the
22659 linker's command line.
22660
22661 Jump relaxing is performed by the linker because jump offsets are not
22662 known before code is located. Therefore, the assembler code generated by the
22663 compiler is the same, but the instructions in the executable may
22664 differ from instructions in the assembler code.
22665
22666 Relaxing must be turned on if linker stubs are needed, see the
22667 section on @code{EIND} and linker stubs below.
22668
22669 @item -mrmw
22670 @opindex mrmw
22671 Assume that the device supports the Read-Modify-Write
22672 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
22673
22674 @item -mshort-calls
22675 @opindex mshort-calls
22676
22677 Assume that @code{RJMP} and @code{RCALL} can target the whole
22678 program memory.
22679
22680 This option is used internally for multilib selection. It is
22681 not an optimization option, and you don't need to set it by hand.
22682
22683 @item -msp8
22684 @opindex msp8
22685 Treat the stack pointer register as an 8-bit register,
22686 i.e.@: assume the high byte of the stack pointer is zero.
22687 In general, you don't need to set this option by hand.
22688
22689 This option is used internally by the compiler to select and
22690 build multilibs for architectures @code{avr2} and @code{avr25}.
22691 These architectures mix devices with and without @code{SPH}.
22692 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
22693 the compiler driver adds or removes this option from the compiler
22694 proper's command line, because the compiler then knows if the device
22695 or architecture has an 8-bit stack pointer and thus no @code{SPH}
22696 register or not.
22697
22698 @item -mstrict-X
22699 @opindex mstrict-X
22700 Use address register @code{X} in a way proposed by the hardware. This means
22701 that @code{X} is only used in indirect, post-increment or
22702 pre-decrement addressing.
22703
22704 Without this option, the @code{X} register may be used in the same way
22705 as @code{Y} or @code{Z} which then is emulated by additional
22706 instructions.
22707 For example, loading a value with @code{X+const} addressing with a
22708 small non-negative @code{const < 64} to a register @var{Rn} is
22709 performed as
22710
22711 @example
22712 adiw r26, const ; X += const
22713 ld @var{Rn}, X ; @var{Rn} = *X
22714 sbiw r26, const ; X -= const
22715 @end example
22716
22717 @item -mtiny-stack
22718 @opindex mtiny-stack
22719 Only change the lower 8@tie{}bits of the stack pointer.
22720
22721 @item -mfract-convert-truncate
22722 @opindex mfract-convert-truncate
22723 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
22724
22725 @item -nodevicelib
22726 @opindex nodevicelib
22727 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
22728
22729 @item -nodevicespecs
22730 @opindex nodevicespecs
22731 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
22732 command line. The user takes responsibility for supplying the sub-processes
22733 like compiler proper, assembler and linker with appropriate command line
22734 options. This means that the user has to supply her private device specs
22735 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
22736 more need for option @option{-mmcu=@var{mcu}}.
22737
22738 This option can also serve as a replacement for the older way of
22739 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
22740 which contains a folder named @code{device-specs} which contains a specs file named
22741 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
22742
22743 @item -Waddr-space-convert
22744 @opindex Waddr-space-convert
22745 @opindex Wno-addr-space-convert
22746 Warn about conversions between address spaces in the case where the
22747 resulting address space is not contained in the incoming address space.
22748
22749 @item -Wmisspelled-isr
22750 @opindex Wmisspelled-isr
22751 @opindex Wno-misspelled-isr
22752 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
22753 Enabled by default.
22754 @end table
22755
22756 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
22757 @cindex @code{EIND}
22758 Pointers in the implementation are 16@tie{}bits wide.
22759 The address of a function or label is represented as word address so
22760 that indirect jumps and calls can target any code address in the
22761 range of 64@tie{}Ki words.
22762
22763 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
22764 bytes of program memory space, there is a special function register called
22765 @code{EIND} that serves as most significant part of the target address
22766 when @code{EICALL} or @code{EIJMP} instructions are used.
22767
22768 Indirect jumps and calls on these devices are handled as follows by
22769 the compiler and are subject to some limitations:
22770
22771 @itemize @bullet
22772
22773 @item
22774 The compiler never sets @code{EIND}.
22775
22776 @item
22777 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
22778 instructions or might read @code{EIND} directly in order to emulate an
22779 indirect call/jump by means of a @code{RET} instruction.
22780
22781 @item
22782 The compiler assumes that @code{EIND} never changes during the startup
22783 code or during the application. In particular, @code{EIND} is not
22784 saved/restored in function or interrupt service routine
22785 prologue/epilogue.
22786
22787 @item
22788 For indirect calls to functions and computed goto, the linker
22789 generates @emph{stubs}. Stubs are jump pads sometimes also called
22790 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
22791 The stub contains a direct jump to the desired address.
22792
22793 @item
22794 Linker relaxation must be turned on so that the linker generates
22795 the stubs correctly in all situations. See the compiler option
22796 @option{-mrelax} and the linker option @option{--relax}.
22797 There are corner cases where the linker is supposed to generate stubs
22798 but aborts without relaxation and without a helpful error message.
22799
22800 @item
22801 The default linker script is arranged for code with @code{EIND = 0}.
22802 If code is supposed to work for a setup with @code{EIND != 0}, a custom
22803 linker script has to be used in order to place the sections whose
22804 name start with @code{.trampolines} into the segment where @code{EIND}
22805 points to.
22806
22807 @item
22808 The startup code from libgcc never sets @code{EIND}.
22809 Notice that startup code is a blend of code from libgcc and AVR-LibC.
22810 For the impact of AVR-LibC on @code{EIND}, see the
22811 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
22812
22813 @item
22814 It is legitimate for user-specific startup code to set up @code{EIND}
22815 early, for example by means of initialization code located in
22816 section @code{.init3}. Such code runs prior to general startup code
22817 that initializes RAM and calls constructors, but after the bit
22818 of startup code from AVR-LibC that sets @code{EIND} to the segment
22819 where the vector table is located.
22820 @example
22821 #include <avr/io.h>
22822
22823 static void
22824 __attribute__((section(".init3"),naked,used,no_instrument_function))
22825 init3_set_eind (void)
22826 @{
22827 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
22828 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
22829 @}
22830 @end example
22831
22832 @noindent
22833 The @code{__trampolines_start} symbol is defined in the linker script.
22834
22835 @item
22836 Stubs are generated automatically by the linker if
22837 the following two conditions are met:
22838 @itemize @minus
22839
22840 @item The address of a label is taken by means of the @code{gs} modifier
22841 (short for @emph{generate stubs}) like so:
22842 @example
22843 LDI r24, lo8(gs(@var{func}))
22844 LDI r25, hi8(gs(@var{func}))
22845 @end example
22846 @item The final location of that label is in a code segment
22847 @emph{outside} the segment where the stubs are located.
22848 @end itemize
22849
22850 @item
22851 The compiler emits such @code{gs} modifiers for code labels in the
22852 following situations:
22853 @itemize @minus
22854 @item Taking address of a function or code label.
22855 @item Computed goto.
22856 @item If prologue-save function is used, see @option{-mcall-prologues}
22857 command-line option.
22858 @item Switch/case dispatch tables. If you do not want such dispatch
22859 tables you can specify the @option{-fno-jump-tables} command-line option.
22860 @item C and C++ constructors/destructors called during startup/shutdown.
22861 @item If the tools hit a @code{gs()} modifier explained above.
22862 @end itemize
22863
22864 @item
22865 Jumping to non-symbolic addresses like so is @emph{not} supported:
22866
22867 @example
22868 int main (void)
22869 @{
22870 /* Call function at word address 0x2 */
22871 return ((int(*)(void)) 0x2)();
22872 @}
22873 @end example
22874
22875 Instead, a stub has to be set up, i.e.@: the function has to be called
22876 through a symbol (@code{func_4} in the example):
22877
22878 @example
22879 int main (void)
22880 @{
22881 extern int func_4 (void);
22882
22883 /* Call function at byte address 0x4 */
22884 return func_4();
22885 @}
22886 @end example
22887
22888 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
22889 Alternatively, @code{func_4} can be defined in the linker script.
22890 @end itemize
22891
22892 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
22893 @cindex @code{RAMPD}
22894 @cindex @code{RAMPX}
22895 @cindex @code{RAMPY}
22896 @cindex @code{RAMPZ}
22897 Some AVR devices support memories larger than the 64@tie{}KiB range
22898 that can be accessed with 16-bit pointers. To access memory locations
22899 outside this 64@tie{}KiB range, the content of a @code{RAMP}
22900 register is used as high part of the address:
22901 The @code{X}, @code{Y}, @code{Z} address register is concatenated
22902 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
22903 register, respectively, to get a wide address. Similarly,
22904 @code{RAMPD} is used together with direct addressing.
22905
22906 @itemize
22907 @item
22908 The startup code initializes the @code{RAMP} special function
22909 registers with zero.
22910
22911 @item
22912 If a @ref{AVR Named Address Spaces,named address space} other than
22913 generic or @code{__flash} is used, then @code{RAMPZ} is set
22914 as needed before the operation.
22915
22916 @item
22917 If the device supports RAM larger than 64@tie{}KiB and the compiler
22918 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
22919 is reset to zero after the operation.
22920
22921 @item
22922 If the device comes with a specific @code{RAMP} register, the ISR
22923 prologue/epilogue saves/restores that SFR and initializes it with
22924 zero in case the ISR code might (implicitly) use it.
22925
22926 @item
22927 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
22928 If you use inline assembler to read from locations outside the
22929 16-bit address range and change one of the @code{RAMP} registers,
22930 you must reset it to zero after the access.
22931
22932 @end itemize
22933
22934 @subsubsection AVR Built-in Macros
22935
22936 GCC defines several built-in macros so that the user code can test
22937 for the presence or absence of features. Almost any of the following
22938 built-in macros are deduced from device capabilities and thus
22939 triggered by the @option{-mmcu=} command-line option.
22940
22941 For even more AVR-specific built-in macros see
22942 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
22943
22944 @table @code
22945
22946 @item __AVR_ARCH__
22947 Build-in macro that resolves to a decimal number that identifies the
22948 architecture and depends on the @option{-mmcu=@var{mcu}} option.
22949 Possible values are:
22950
22951 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
22952 @code{4}, @code{5}, @code{51}, @code{6}
22953
22954 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
22955 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
22956
22957 respectively and
22958
22959 @code{100},
22960 @code{102}, @code{103}, @code{104},
22961 @code{105}, @code{106}, @code{107}
22962
22963 for @var{mcu}=@code{avrtiny},
22964 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
22965 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
22966 If @var{mcu} specifies a device, this built-in macro is set
22967 accordingly. For example, with @option{-mmcu=atmega8} the macro is
22968 defined to @code{4}.
22969
22970 @item __AVR_@var{Device}__
22971 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
22972 the device's name. For example, @option{-mmcu=atmega8} defines the
22973 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
22974 @code{__AVR_ATtiny261A__}, etc.
22975
22976 The built-in macros' names follow
22977 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
22978 the device name as from the AVR user manual. The difference between
22979 @var{Device} in the built-in macro and @var{device} in
22980 @option{-mmcu=@var{device}} is that the latter is always lowercase.
22981
22982 If @var{device} is not a device but only a core architecture like
22983 @samp{avr51}, this macro is not defined.
22984
22985 @item __AVR_DEVICE_NAME__
22986 Setting @option{-mmcu=@var{device}} defines this built-in macro to
22987 the device's name. For example, with @option{-mmcu=atmega8} the macro
22988 is defined to @code{atmega8}.
22989
22990 If @var{device} is not a device but only a core architecture like
22991 @samp{avr51}, this macro is not defined.
22992
22993 @item __AVR_XMEGA__
22994 The device / architecture belongs to the XMEGA family of devices.
22995
22996 @item __AVR_HAVE_ELPM__
22997 The device has the @code{ELPM} instruction.
22998
22999 @item __AVR_HAVE_ELPMX__
23000 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
23001 R@var{n},Z+} instructions.
23002
23003 @item __AVR_HAVE_MOVW__
23004 The device has the @code{MOVW} instruction to perform 16-bit
23005 register-register moves.
23006
23007 @item __AVR_HAVE_LPMX__
23008 The device has the @code{LPM R@var{n},Z} and
23009 @code{LPM R@var{n},Z+} instructions.
23010
23011 @item __AVR_HAVE_MUL__
23012 The device has a hardware multiplier.
23013
23014 @item __AVR_HAVE_JMP_CALL__
23015 The device has the @code{JMP} and @code{CALL} instructions.
23016 This is the case for devices with more than 8@tie{}KiB of program
23017 memory.
23018
23019 @item __AVR_HAVE_EIJMP_EICALL__
23020 @itemx __AVR_3_BYTE_PC__
23021 The device has the @code{EIJMP} and @code{EICALL} instructions.
23022 This is the case for devices with more than 128@tie{}KiB of program memory.
23023 This also means that the program counter
23024 (PC) is 3@tie{}bytes wide.
23025
23026 @item __AVR_2_BYTE_PC__
23027 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
23028 with up to 128@tie{}KiB of program memory.
23029
23030 @item __AVR_HAVE_8BIT_SP__
23031 @itemx __AVR_HAVE_16BIT_SP__
23032 The stack pointer (SP) register is treated as 8-bit respectively
23033 16-bit register by the compiler.
23034 The definition of these macros is affected by @option{-mtiny-stack}.
23035
23036 @item __AVR_HAVE_SPH__
23037 @itemx __AVR_SP8__
23038 The device has the SPH (high part of stack pointer) special function
23039 register or has an 8-bit stack pointer, respectively.
23040 The definition of these macros is affected by @option{-mmcu=} and
23041 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23042 by @option{-msp8}.
23043
23044 @item __AVR_HAVE_RAMPD__
23045 @itemx __AVR_HAVE_RAMPX__
23046 @itemx __AVR_HAVE_RAMPY__
23047 @itemx __AVR_HAVE_RAMPZ__
23048 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23049 @code{RAMPZ} special function register, respectively.
23050
23051 @item __NO_INTERRUPTS__
23052 This macro reflects the @option{-mno-interrupts} command-line option.
23053
23054 @item __AVR_ERRATA_SKIP__
23055 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23056 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23057 instructions because of a hardware erratum. Skip instructions are
23058 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23059 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23060 set.
23061
23062 @item __AVR_ISA_RMW__
23063 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23064
23065 @item __AVR_SFR_OFFSET__=@var{offset}
23066 Instructions that can address I/O special function registers directly
23067 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23068 address as if addressed by an instruction to access RAM like @code{LD}
23069 or @code{STS}. This offset depends on the device architecture and has
23070 to be subtracted from the RAM address in order to get the
23071 respective I/O@tie{}address.
23072
23073 @item __AVR_SHORT_CALLS__
23074 The @option{-mshort-calls} command line option is set.
23075
23076 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23077 Some devices support reading from flash memory by means of @code{LD*}
23078 instructions. The flash memory is seen in the data address space
23079 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
23080 is not defined, this feature is not available. If defined,
23081 the address space is linear and there is no need to put
23082 @code{.rodata} into RAM. This is handled by the default linker
23083 description file, and is currently available for
23084 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
23085 there is no need to use address spaces like @code{__flash} or
23086 features like attribute @code{progmem} and @code{pgm_read_*}.
23087
23088 @item __WITH_AVRLIBC__
23089 The compiler is configured to be used together with AVR-Libc.
23090 See the @option{--with-avrlibc} configure option.
23091
23092 @item __HAVE_DOUBLE_MULTILIB__
23093 Defined if @option{-mdouble=} acts as a multilib option.
23094
23095 @item __HAVE_DOUBLE32__
23096 @itemx __HAVE_DOUBLE64__
23097 Defined if the compiler supports 32-bit double resp. 64-bit double.
23098 The actual layout is specified by option @option{-mdouble=}.
23099
23100 @item __DEFAULT_DOUBLE__
23101 The size in bits of @code{double} if @option{-mdouble=} is not set.
23102 To test the layout of @code{double} in a program, use the built-in
23103 macro @code{__SIZEOF_DOUBLE__}.
23104
23105 @item __HAVE_LONG_DOUBLE32__
23106 @itemx __HAVE_LONG_DOUBLE64__
23107 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23108 @itemx __DEFAULT_LONG_DOUBLE__
23109 Same as above, but for @code{long double} instead of @code{double}.
23110
23111 @item __WITH_DOUBLE_COMPARISON__
23112 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23113 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23114 and is defined to @code{2} or @code{3}.
23115
23116 @item __WITH_LIBF7_LIBGCC__
23117 @itemx __WITH_LIBF7_MATH__
23118 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23119 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23120 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23121
23122 @end table
23123
23124 @node Blackfin Options
23125 @subsection Blackfin Options
23126 @cindex Blackfin Options
23127
23128 @table @gcctabopt
23129 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23130 @opindex mcpu=
23131 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
23132 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23133 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23134 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23135 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23136 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23137 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23138 @samp{bf561}, @samp{bf592}.
23139
23140 The optional @var{sirevision} specifies the silicon revision of the target
23141 Blackfin processor. Any workarounds available for the targeted silicon revision
23142 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
23143 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23144 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
23145 hexadecimal digits representing the major and minor numbers in the silicon
23146 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23147 is not defined. If @var{sirevision} is @samp{any}, the
23148 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23149 If this optional @var{sirevision} is not used, GCC assumes the latest known
23150 silicon revision of the targeted Blackfin processor.
23151
23152 GCC defines a preprocessor macro for the specified @var{cpu}.
23153 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23154 provided by libgloss to be linked in if @option{-msim} is not given.
23155
23156 Without this option, @samp{bf532} is used as the processor by default.
23157
23158 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
23159 only the preprocessor macro is defined.
23160
23161 @item -msim
23162 @opindex msim
23163 Specifies that the program will be run on the simulator. This causes
23164 the simulator BSP provided by libgloss to be linked in. This option
23165 has effect only for @samp{bfin-elf} toolchain.
23166 Certain other options, such as @option{-mid-shared-library} and
23167 @option{-mfdpic}, imply @option{-msim}.
23168
23169 @item -momit-leaf-frame-pointer
23170 @opindex momit-leaf-frame-pointer
23171 Don't keep the frame pointer in a register for leaf functions. This
23172 avoids the instructions to save, set up and restore frame pointers and
23173 makes an extra register available in leaf functions.
23174
23175 @item -mspecld-anomaly
23176 @opindex mspecld-anomaly
23177 When enabled, the compiler ensures that the generated code does not
23178 contain speculative loads after jump instructions. If this option is used,
23179 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23180
23181 @item -mno-specld-anomaly
23182 @opindex mno-specld-anomaly
23183 @opindex mspecld-anomaly
23184 Don't generate extra code to prevent speculative loads from occurring.
23185
23186 @item -mcsync-anomaly
23187 @opindex mcsync-anomaly
23188 When enabled, the compiler ensures that the generated code does not
23189 contain CSYNC or SSYNC instructions too soon after conditional branches.
23190 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23191
23192 @item -mno-csync-anomaly
23193 @opindex mno-csync-anomaly
23194 @opindex mcsync-anomaly
23195 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23196 occurring too soon after a conditional branch.
23197
23198 @item -mlow64k
23199 @opindex mlow64k
23200 When enabled, the compiler is free to take advantage of the knowledge that
23201 the entire program fits into the low 64k of memory.
23202
23203 @item -mno-low64k
23204 @opindex mno-low64k
23205 Assume that the program is arbitrarily large. This is the default.
23206
23207 @item -mstack-check-l1
23208 @opindex mstack-check-l1
23209 Do stack checking using information placed into L1 scratchpad memory by the
23210 uClinux kernel.
23211
23212 @item -mid-shared-library
23213 @opindex mid-shared-library
23214 Generate code that supports shared libraries via the library ID method.
23215 This allows for execute in place and shared libraries in an environment
23216 without virtual memory management. This option implies @option{-fPIC}.
23217 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23218
23219 @item -mno-id-shared-library
23220 @opindex mno-id-shared-library
23221 @opindex mid-shared-library
23222 Generate code that doesn't assume ID-based shared libraries are being used.
23223 This is the default.
23224
23225 @item -mleaf-id-shared-library
23226 @opindex mleaf-id-shared-library
23227 Generate code that supports shared libraries via the library ID method,
23228 but assumes that this library or executable won't link against any other
23229 ID shared libraries. That allows the compiler to use faster code for jumps
23230 and calls.
23231
23232 @item -mno-leaf-id-shared-library
23233 @opindex mno-leaf-id-shared-library
23234 @opindex mleaf-id-shared-library
23235 Do not assume that the code being compiled won't link against any ID shared
23236 libraries. Slower code is generated for jump and call insns.
23237
23238 @item -mshared-library-id=n
23239 @opindex mshared-library-id
23240 Specifies the identification number of the ID-based shared library being
23241 compiled. Specifying a value of 0 generates more compact code; specifying
23242 other values forces the allocation of that number to the current
23243 library but is no more space- or time-efficient than omitting this option.
23244
23245 @item -msep-data
23246 @opindex msep-data
23247 Generate code that allows the data segment to be located in a different
23248 area of memory from the text segment. This allows for execute in place in
23249 an environment without virtual memory management by eliminating relocations
23250 against the text section.
23251
23252 @item -mno-sep-data
23253 @opindex mno-sep-data
23254 @opindex msep-data
23255 Generate code that assumes that the data segment follows the text segment.
23256 This is the default.
23257
23258 @item -mlong-calls
23259 @itemx -mno-long-calls
23260 @opindex mlong-calls
23261 @opindex mno-long-calls
23262 Tells the compiler to perform function calls by first loading the
23263 address of the function into a register and then performing a subroutine
23264 call on this register. This switch is needed if the target function
23265 lies outside of the 24-bit addressing range of the offset-based
23266 version of subroutine call instruction.
23267
23268 This feature is not enabled by default. Specifying
23269 @option{-mno-long-calls} restores the default behavior. Note these
23270 switches have no effect on how the compiler generates code to handle
23271 function calls via function pointers.
23272
23273 @item -mfast-fp
23274 @opindex mfast-fp
23275 Link with the fast floating-point library. This library relaxes some of
23276 the IEEE floating-point standard's rules for checking inputs against
23277 Not-a-Number (NAN), in the interest of performance.
23278
23279 @item -minline-plt
23280 @opindex minline-plt
23281 Enable inlining of PLT entries in function calls to functions that are
23282 not known to bind locally. It has no effect without @option{-mfdpic}.
23283
23284 @item -mmulticore
23285 @opindex mmulticore
23286 Build a standalone application for multicore Blackfin processors.
23287 This option causes proper start files and link scripts supporting
23288 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
23289 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
23290
23291 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23292 selects the one-application-per-core programming model. Without
23293 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23294 programming model is used. In this model, the main function of Core B
23295 should be named as @code{coreb_main}.
23296
23297 If this option is not used, the single-core application programming
23298 model is used.
23299
23300 @item -mcorea
23301 @opindex mcorea
23302 Build a standalone application for Core A of BF561 when using
23303 the one-application-per-core programming model. Proper start files
23304 and link scripts are used to support Core A, and the macro
23305 @code{__BFIN_COREA} is defined.
23306 This option can only be used in conjunction with @option{-mmulticore}.
23307
23308 @item -mcoreb
23309 @opindex mcoreb
23310 Build a standalone application for Core B of BF561 when using
23311 the one-application-per-core programming model. Proper start files
23312 and link scripts are used to support Core B, and the macro
23313 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23314 should be used instead of @code{main}.
23315 This option can only be used in conjunction with @option{-mmulticore}.
23316
23317 @item -msdram
23318 @opindex msdram
23319 Build a standalone application for SDRAM. Proper start files and
23320 link scripts are used to put the application into SDRAM, and the macro
23321 @code{__BFIN_SDRAM} is defined.
23322 The loader should initialize SDRAM before loading the application.
23323
23324 @item -micplb
23325 @opindex micplb
23326 Assume that ICPLBs are enabled at run time. This has an effect on certain
23327 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
23328 are enabled; for standalone applications the default is off.
23329 @end table
23330
23331 @node C6X Options
23332 @subsection C6X Options
23333 @cindex C6X Options
23334
23335 @table @gcctabopt
23336 @item -march=@var{name}
23337 @opindex march
23338 This specifies the name of the target architecture. GCC uses this
23339 name to determine what kind of instructions it can emit when generating
23340 assembly code. Permissible names are: @samp{c62x},
23341 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
23342
23343 @item -mbig-endian
23344 @opindex mbig-endian
23345 Generate code for a big-endian target.
23346
23347 @item -mlittle-endian
23348 @opindex mlittle-endian
23349 Generate code for a little-endian target. This is the default.
23350
23351 @item -msim
23352 @opindex msim
23353 Choose startup files and linker script suitable for the simulator.
23354
23355 @item -msdata=default
23356 @opindex msdata=default
23357 Put small global and static data in the @code{.neardata} section,
23358 which is pointed to by register @code{B14}. Put small uninitialized
23359 global and static data in the @code{.bss} section, which is adjacent
23360 to the @code{.neardata} section. Put small read-only data into the
23361 @code{.rodata} section. The corresponding sections used for large
23362 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
23363
23364 @item -msdata=all
23365 @opindex msdata=all
23366 Put all data, not just small objects, into the sections reserved for
23367 small data, and use addressing relative to the @code{B14} register to
23368 access them.
23369
23370 @item -msdata=none
23371 @opindex msdata=none
23372 Make no use of the sections reserved for small data, and use absolute
23373 addresses to access all data. Put all initialized global and static
23374 data in the @code{.fardata} section, and all uninitialized data in the
23375 @code{.far} section. Put all constant data into the @code{.const}
23376 section.
23377 @end table
23378
23379 @node CRIS Options
23380 @subsection CRIS Options
23381 @cindex CRIS Options
23382
23383 These options are defined specifically for the CRIS ports.
23384
23385 @table @gcctabopt
23386 @item -march=@var{architecture-type}
23387 @itemx -mcpu=@var{architecture-type}
23388 @opindex march
23389 @opindex mcpu
23390 Generate code for the specified architecture. The choices for
23391 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
23392 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
23393 Default is @samp{v0}.
23394
23395 @item -mtune=@var{architecture-type}
23396 @opindex mtune
23397 Tune to @var{architecture-type} everything applicable about the generated
23398 code, except for the ABI and the set of available instructions. The
23399 choices for @var{architecture-type} are the same as for
23400 @option{-march=@var{architecture-type}}.
23401
23402 @item -mmax-stack-frame=@var{n}
23403 @opindex mmax-stack-frame
23404 Warn when the stack frame of a function exceeds @var{n} bytes.
23405
23406 @item -metrax4
23407 @itemx -metrax100
23408 @opindex metrax4
23409 @opindex metrax100
23410 The options @option{-metrax4} and @option{-metrax100} are synonyms for
23411 @option{-march=v3} and @option{-march=v8} respectively.
23412
23413 @item -mmul-bug-workaround
23414 @itemx -mno-mul-bug-workaround
23415 @opindex mmul-bug-workaround
23416 @opindex mno-mul-bug-workaround
23417 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
23418 models where it applies. This option is disabled by default.
23419
23420 @item -mpdebug
23421 @opindex mpdebug
23422 Enable CRIS-specific verbose debug-related information in the assembly
23423 code. This option also has the effect of turning off the @samp{#NO_APP}
23424 formatted-code indicator to the assembler at the beginning of the
23425 assembly file.
23426
23427 @item -mcc-init
23428 @opindex mcc-init
23429 Do not use condition-code results from previous instruction; always emit
23430 compare and test instructions before use of condition codes.
23431
23432 @item -mno-side-effects
23433 @opindex mno-side-effects
23434 @opindex mside-effects
23435 Do not emit instructions with side effects in addressing modes other than
23436 post-increment.
23437
23438 @item -mstack-align
23439 @itemx -mno-stack-align
23440 @itemx -mdata-align
23441 @itemx -mno-data-align
23442 @itemx -mconst-align
23443 @itemx -mno-const-align
23444 @opindex mstack-align
23445 @opindex mno-stack-align
23446 @opindex mdata-align
23447 @opindex mno-data-align
23448 @opindex mconst-align
23449 @opindex mno-const-align
23450 These options (@samp{no-} options) arrange (eliminate arrangements) for the
23451 stack frame, individual data and constants to be aligned for the maximum
23452 single data access size for the chosen CPU model. The default is to
23453 arrange for 32-bit alignment. ABI details such as structure layout are
23454 not affected by these options.
23455
23456 @item -m32-bit
23457 @itemx -m16-bit
23458 @itemx -m8-bit
23459 @opindex m32-bit
23460 @opindex m16-bit
23461 @opindex m8-bit
23462 Similar to the stack- data- and const-align options above, these options
23463 arrange for stack frame, writable data and constants to all be 32-bit,
23464 16-bit or 8-bit aligned. The default is 32-bit alignment.
23465
23466 @item -mno-prologue-epilogue
23467 @itemx -mprologue-epilogue
23468 @opindex mno-prologue-epilogue
23469 @opindex mprologue-epilogue
23470 With @option{-mno-prologue-epilogue}, the normal function prologue and
23471 epilogue which set up the stack frame are omitted and no return
23472 instructions or return sequences are generated in the code. Use this
23473 option only together with visual inspection of the compiled code: no
23474 warnings or errors are generated when call-saved registers must be saved,
23475 or storage for local variables needs to be allocated.
23476
23477 @item -melf
23478 @opindex melf
23479 Legacy no-op option.
23480
23481 @item -sim
23482 @opindex sim
23483 This option arranges
23484 to link with input-output functions from a simulator library. Code,
23485 initialized data and zero-initialized data are allocated consecutively.
23486
23487 @item -sim2
23488 @opindex sim2
23489 Like @option{-sim}, but pass linker options to locate initialized data at
23490 0x40000000 and zero-initialized data at 0x80000000.
23491 @end table
23492
23493 @node C-SKY Options
23494 @subsection C-SKY Options
23495 @cindex C-SKY Options
23496
23497 GCC supports these options when compiling for C-SKY V2 processors.
23498
23499 @table @gcctabopt
23500
23501 @item -march=@var{arch}
23502 @opindex march=
23503 Specify the C-SKY target architecture. Valid values for @var{arch} are:
23504 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
23505 The default is @samp{ck810}.
23506
23507 @item -mcpu=@var{cpu}
23508 @opindex mcpu=
23509 Specify the C-SKY target processor. Valid values for @var{cpu} are:
23510 @samp{ck801}, @samp{ck801t},
23511 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
23512 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
23513 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
23514 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
23515 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
23516 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
23517 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
23518 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
23519 @samp{ck803eftr1}, @samp{ck803efhtr1},
23520 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
23521 @samp{ck803sef}, @samp{ck803seft},
23522 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
23523 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
23524 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
23525 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
23526
23527 @item -mbig-endian
23528 @opindex mbig-endian
23529 @itemx -EB
23530 @opindex EB
23531 @itemx -mlittle-endian
23532 @opindex mlittle-endian
23533 @itemx -EL
23534 @opindex EL
23535
23536 Select big- or little-endian code. The default is little-endian.
23537
23538 @item -mfloat-abi=@var{name}
23539 @opindex mfloat-abi
23540 Specifies which floating-point ABI to use. Permissible values
23541 are: @samp{soft}, @samp{softfp} and @samp{hard}.
23542
23543 Specifying @samp{soft} causes GCC to generate output containing
23544 library calls for floating-point operations.
23545 @samp{softfp} allows the generation of code using hardware floating-point
23546 instructions, but still uses the soft-float calling conventions.
23547 @samp{hard} allows generation of floating-point instructions
23548 and uses FPU-specific calling conventions.
23549
23550 The default depends on the specific target configuration. Note that
23551 the hard-float and soft-float ABIs are not link-compatible; you must
23552 compile your entire program with the same ABI, and link with a
23553 compatible set of libraries.
23554
23555 @item -mhard-float
23556 @opindex mhard-float
23557 @itemx -msoft-float
23558 @opindex msoft-float
23559
23560 Select hardware or software floating-point implementations.
23561 The default is soft float.
23562
23563 @item -mdouble-float
23564 @itemx -mno-double-float
23565 @opindex mdouble-float
23566 When @option{-mhard-float} is in effect, enable generation of
23567 double-precision float instructions. This is the default except
23568 when compiling for CK803.
23569
23570 @item -mfdivdu
23571 @itemx -mno-fdivdu
23572 @opindex mfdivdu
23573 When @option{-mhard-float} is in effect, enable generation of
23574 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
23575 This is the default except when compiling for CK803.
23576
23577 @item -mfpu=@var{fpu}
23578 @opindex mfpu=
23579 Select the floating-point processor. This option can only be used with
23580 @option{-mhard-float}.
23581 Values for @var{fpu} are
23582 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
23583 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
23584 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
23585
23586 @item -melrw
23587 @itemx -mno-elrw
23588 @opindex melrw
23589 Enable the extended @code{lrw} instruction. This option defaults to on
23590 for CK801 and off otherwise.
23591
23592 @item -mistack
23593 @itemx -mno-istack
23594 @opindex mistack
23595 Enable interrupt stack instructions; the default is off.
23596
23597 The @option{-mistack} option is required to handle the
23598 @code{interrupt} and @code{isr} function attributes
23599 (@pxref{C-SKY Function Attributes}).
23600
23601 @item -mmp
23602 @opindex mmp
23603 Enable multiprocessor instructions; the default is off.
23604
23605 @item -mcp
23606 @opindex mcp
23607 Enable coprocessor instructions; the default is off.
23608
23609 @item -mcache
23610 @opindex mcache
23611 Enable coprocessor instructions; the default is off.
23612
23613 @item -msecurity
23614 @opindex msecurity
23615 Enable C-SKY security instructions; the default is off.
23616
23617 @item -mtrust
23618 @opindex mtrust
23619 Enable C-SKY trust instructions; the default is off.
23620
23621 @item -mdsp
23622 @opindex mdsp
23623 @itemx -medsp
23624 @opindex medsp
23625 @itemx -mvdsp
23626 @opindex mvdsp
23627 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
23628 All of these options default to off.
23629
23630 @item -mdiv
23631 @itemx -mno-div
23632 @opindex mdiv
23633 Generate divide instructions. Default is off.
23634
23635 @item -msmart
23636 @itemx -mno-smart
23637 @opindex msmart
23638 Generate code for Smart Mode, using only registers numbered 0-7 to allow
23639 use of 16-bit instructions. This option is ignored for CK801 where this
23640 is the required behavior, and it defaults to on for CK802.
23641 For other targets, the default is off.
23642
23643 @item -mhigh-registers
23644 @itemx -mno-high-registers
23645 @opindex mhigh-registers
23646 Generate code using the high registers numbered 16-31. This option
23647 is not supported on CK801, CK802, or CK803, and is enabled by default
23648 for other processors.
23649
23650 @item -manchor
23651 @itemx -mno-anchor
23652 @opindex manchor
23653 Generate code using global anchor symbol addresses.
23654
23655 @item -mpushpop
23656 @itemx -mno-pushpop
23657 @opindex mpushpop
23658 Generate code using @code{push} and @code{pop} instructions. This option
23659 defaults to on.
23660
23661 @item -mmultiple-stld
23662 @itemx -mstm
23663 @itemx -mno-multiple-stld
23664 @itemx -mno-stm
23665 @opindex mmultiple-stld
23666 Generate code using @code{stm} and @code{ldm} instructions. This option
23667 isn't supported on CK801 but is enabled by default on other processors.
23668
23669 @item -mconstpool
23670 @itemx -mno-constpool
23671 @opindex mconstpool
23672 Create constant pools in the compiler instead of deferring it to the
23673 assembler. This option is the default and required for correct code
23674 generation on CK801 and CK802, and is optional on other processors.
23675
23676 @item -mstack-size
23677 @item -mno-stack-size
23678 @opindex mstack-size
23679 Emit @code{.stack_size} directives for each function in the assembly
23680 output. This option defaults to off.
23681
23682 @item -mccrt
23683 @itemx -mno-ccrt
23684 @opindex mccrt
23685 Generate code for the C-SKY compiler runtime instead of libgcc. This
23686 option defaults to off.
23687
23688 @item -mbranch-cost=@var{n}
23689 @opindex mbranch-cost=
23690 Set the branch costs to roughly @code{n} instructions. The default is 1.
23691
23692 @item -msched-prolog
23693 @itemx -mno-sched-prolog
23694 @opindex msched-prolog
23695 Permit scheduling of function prologue and epilogue sequences. Using
23696 this option can result in code that is not compliant with the C-SKY V2 ABI
23697 prologue requirements and that cannot be debugged or backtraced.
23698 It is disabled by default.
23699
23700 @item -msim
23701 @opindex msim
23702 Links the library libsemi.a which is in compatible with simulator. Applicable
23703 to ELF compiler only.
23704
23705 @end table
23706
23707 @node Darwin Options
23708 @subsection Darwin Options
23709 @cindex Darwin options
23710
23711 These options are defined for all architectures running the Darwin operating
23712 system.
23713
23714 FSF GCC on Darwin does not create ``fat'' object files; it creates
23715 an object file for the single architecture that GCC was built to
23716 target. Apple's GCC on Darwin does create ``fat'' files if multiple
23717 @option{-arch} options are used; it does so by running the compiler or
23718 linker multiple times and joining the results together with
23719 @file{lipo}.
23720
23721 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
23722 @samp{i686}) is determined by the flags that specify the ISA
23723 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
23724 @option{-force_cpusubtype_ALL} option can be used to override this.
23725
23726 The Darwin tools vary in their behavior when presented with an ISA
23727 mismatch. The assembler, @file{as}, only permits instructions to
23728 be used that are valid for the subtype of the file it is generating,
23729 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
23730 The linker for shared libraries, @file{/usr/bin/libtool}, fails
23731 and prints an error if asked to create a shared library with a less
23732 restrictive subtype than its input files (for instance, trying to put
23733 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
23734 for executables, @command{ld}, quietly gives the executable the most
23735 restrictive subtype of any of its input files.
23736
23737 @table @gcctabopt
23738 @item -F@var{dir}
23739 @opindex F
23740 Add the framework directory @var{dir} to the head of the list of
23741 directories to be searched for header files. These directories are
23742 interleaved with those specified by @option{-I} options and are
23743 scanned in a left-to-right order.
23744
23745 A framework directory is a directory with frameworks in it. A
23746 framework is a directory with a @file{Headers} and/or
23747 @file{PrivateHeaders} directory contained directly in it that ends
23748 in @file{.framework}. The name of a framework is the name of this
23749 directory excluding the @file{.framework}. Headers associated with
23750 the framework are found in one of those two directories, with
23751 @file{Headers} being searched first. A subframework is a framework
23752 directory that is in a framework's @file{Frameworks} directory.
23753 Includes of subframework headers can only appear in a header of a
23754 framework that contains the subframework, or in a sibling subframework
23755 header. Two subframeworks are siblings if they occur in the same
23756 framework. A subframework should not have the same name as a
23757 framework; a warning is issued if this is violated. Currently a
23758 subframework cannot have subframeworks; in the future, the mechanism
23759 may be extended to support this. The standard frameworks can be found
23760 in @file{/System/Library/Frameworks} and
23761 @file{/Library/Frameworks}. An example include looks like
23762 @code{#include <Framework/header.h>}, where @file{Framework} denotes
23763 the name of the framework and @file{header.h} is found in the
23764 @file{PrivateHeaders} or @file{Headers} directory.
23765
23766 @item -iframework@var{dir}
23767 @opindex iframework
23768 Like @option{-F} except the directory is a treated as a system
23769 directory. The main difference between this @option{-iframework} and
23770 @option{-F} is that with @option{-iframework} the compiler does not
23771 warn about constructs contained within header files found via
23772 @var{dir}. This option is valid only for the C family of languages.
23773
23774 @item -gused
23775 @opindex gused
23776 Emit debugging information for symbols that are used. For stabs
23777 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
23778 This is by default ON@.
23779
23780 @item -gfull
23781 @opindex gfull
23782 Emit debugging information for all symbols and types.
23783
23784 @item -mmacosx-version-min=@var{version}
23785 The earliest version of MacOS X that this executable will run on
23786 is @var{version}. Typical values of @var{version} include @code{10.1},
23787 @code{10.2}, and @code{10.3.9}.
23788
23789 If the compiler was built to use the system's headers by default,
23790 then the default for this option is the system version on which the
23791 compiler is running, otherwise the default is to make choices that
23792 are compatible with as many systems and code bases as possible.
23793
23794 @item -mkernel
23795 @opindex mkernel
23796 Enable kernel development mode. The @option{-mkernel} option sets
23797 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
23798 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
23799 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
23800 applicable. This mode also sets @option{-mno-altivec},
23801 @option{-msoft-float}, @option{-fno-builtin} and
23802 @option{-mlong-branch} for PowerPC targets.
23803
23804 @item -mone-byte-bool
23805 @opindex mone-byte-bool
23806 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
23807 By default @code{sizeof(bool)} is @code{4} when compiling for
23808 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
23809 option has no effect on x86.
23810
23811 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
23812 to generate code that is not binary compatible with code generated
23813 without that switch. Using this switch may require recompiling all
23814 other modules in a program, including system libraries. Use this
23815 switch to conform to a non-default data model.
23816
23817 @item -mfix-and-continue
23818 @itemx -ffix-and-continue
23819 @itemx -findirect-data
23820 @opindex mfix-and-continue
23821 @opindex ffix-and-continue
23822 @opindex findirect-data
23823 Generate code suitable for fast turnaround development, such as to
23824 allow GDB to dynamically load @file{.o} files into already-running
23825 programs. @option{-findirect-data} and @option{-ffix-and-continue}
23826 are provided for backwards compatibility.
23827
23828 @item -all_load
23829 @opindex all_load
23830 Loads all members of static archive libraries.
23831 See man ld(1) for more information.
23832
23833 @item -arch_errors_fatal
23834 @opindex arch_errors_fatal
23835 Cause the errors having to do with files that have the wrong architecture
23836 to be fatal.
23837
23838 @item -bind_at_load
23839 @opindex bind_at_load
23840 Causes the output file to be marked such that the dynamic linker will
23841 bind all undefined references when the file is loaded or launched.
23842
23843 @item -bundle
23844 @opindex bundle
23845 Produce a Mach-o bundle format file.
23846 See man ld(1) for more information.
23847
23848 @item -bundle_loader @var{executable}
23849 @opindex bundle_loader
23850 This option specifies the @var{executable} that will load the build
23851 output file being linked. See man ld(1) for more information.
23852
23853 @item -dynamiclib
23854 @opindex dynamiclib
23855 When passed this option, GCC produces a dynamic library instead of
23856 an executable when linking, using the Darwin @file{libtool} command.
23857
23858 @item -force_cpusubtype_ALL
23859 @opindex force_cpusubtype_ALL
23860 This causes GCC's output file to have the @samp{ALL} subtype, instead of
23861 one controlled by the @option{-mcpu} or @option{-march} option.
23862
23863 @item -allowable_client @var{client_name}
23864 @itemx -client_name
23865 @itemx -compatibility_version
23866 @itemx -current_version
23867 @itemx -dead_strip
23868 @itemx -dependency-file
23869 @itemx -dylib_file
23870 @itemx -dylinker_install_name
23871 @itemx -dynamic
23872 @itemx -exported_symbols_list
23873 @itemx -filelist
23874 @need 800
23875 @itemx -flat_namespace
23876 @itemx -force_flat_namespace
23877 @itemx -headerpad_max_install_names
23878 @itemx -image_base
23879 @itemx -init
23880 @itemx -install_name
23881 @itemx -keep_private_externs
23882 @itemx -multi_module
23883 @itemx -multiply_defined
23884 @itemx -multiply_defined_unused
23885 @need 800
23886 @itemx -noall_load
23887 @itemx -no_dead_strip_inits_and_terms
23888 @itemx -nofixprebinding
23889 @itemx -nomultidefs
23890 @itemx -noprebind
23891 @itemx -noseglinkedit
23892 @itemx -pagezero_size
23893 @itemx -prebind
23894 @itemx -prebind_all_twolevel_modules
23895 @itemx -private_bundle
23896 @need 800
23897 @itemx -read_only_relocs
23898 @itemx -sectalign
23899 @itemx -sectobjectsymbols
23900 @itemx -whyload
23901 @itemx -seg1addr
23902 @itemx -sectcreate
23903 @itemx -sectobjectsymbols
23904 @itemx -sectorder
23905 @itemx -segaddr
23906 @itemx -segs_read_only_addr
23907 @need 800
23908 @itemx -segs_read_write_addr
23909 @itemx -seg_addr_table
23910 @itemx -seg_addr_table_filename
23911 @itemx -seglinkedit
23912 @itemx -segprot
23913 @itemx -segs_read_only_addr
23914 @itemx -segs_read_write_addr
23915 @itemx -single_module
23916 @itemx -static
23917 @itemx -sub_library
23918 @need 800
23919 @itemx -sub_umbrella
23920 @itemx -twolevel_namespace
23921 @itemx -umbrella
23922 @itemx -undefined
23923 @itemx -unexported_symbols_list
23924 @itemx -weak_reference_mismatches
23925 @itemx -whatsloaded
23926 @opindex allowable_client
23927 @opindex client_name
23928 @opindex compatibility_version
23929 @opindex current_version
23930 @opindex dead_strip
23931 @opindex dependency-file
23932 @opindex dylib_file
23933 @opindex dylinker_install_name
23934 @opindex dynamic
23935 @opindex exported_symbols_list
23936 @opindex filelist
23937 @opindex flat_namespace
23938 @opindex force_flat_namespace
23939 @opindex headerpad_max_install_names
23940 @opindex image_base
23941 @opindex init
23942 @opindex install_name
23943 @opindex keep_private_externs
23944 @opindex multi_module
23945 @opindex multiply_defined
23946 @opindex multiply_defined_unused
23947 @opindex noall_load
23948 @opindex no_dead_strip_inits_and_terms
23949 @opindex nofixprebinding
23950 @opindex nomultidefs
23951 @opindex noprebind
23952 @opindex noseglinkedit
23953 @opindex pagezero_size
23954 @opindex prebind
23955 @opindex prebind_all_twolevel_modules
23956 @opindex private_bundle
23957 @opindex read_only_relocs
23958 @opindex sectalign
23959 @opindex sectobjectsymbols
23960 @opindex whyload
23961 @opindex seg1addr
23962 @opindex sectcreate
23963 @opindex sectobjectsymbols
23964 @opindex sectorder
23965 @opindex segaddr
23966 @opindex segs_read_only_addr
23967 @opindex segs_read_write_addr
23968 @opindex seg_addr_table
23969 @opindex seg_addr_table_filename
23970 @opindex seglinkedit
23971 @opindex segprot
23972 @opindex segs_read_only_addr
23973 @opindex segs_read_write_addr
23974 @opindex single_module
23975 @opindex static
23976 @opindex sub_library
23977 @opindex sub_umbrella
23978 @opindex twolevel_namespace
23979 @opindex umbrella
23980 @opindex undefined
23981 @opindex unexported_symbols_list
23982 @opindex weak_reference_mismatches
23983 @opindex whatsloaded
23984 These options are passed to the Darwin linker. The Darwin linker man page
23985 describes them in detail.
23986 @end table
23987
23988 @node DEC Alpha Options
23989 @subsection DEC Alpha Options
23990
23991 These @samp{-m} options are defined for the DEC Alpha implementations:
23992
23993 @table @gcctabopt
23994 @item -mno-soft-float
23995 @itemx -msoft-float
23996 @opindex mno-soft-float
23997 @opindex msoft-float
23998 Use (do not use) the hardware floating-point instructions for
23999 floating-point operations. When @option{-msoft-float} is specified,
24000 functions in @file{libgcc.a} are used to perform floating-point
24001 operations. Unless they are replaced by routines that emulate the
24002 floating-point operations, or compiled in such a way as to call such
24003 emulations routines, these routines issue floating-point
24004 operations. If you are compiling for an Alpha without floating-point
24005 operations, you must ensure that the library is built so as not to call
24006 them.
24007
24008 Note that Alpha implementations without floating-point operations are
24009 required to have floating-point registers.
24010
24011 @item -mfp-reg
24012 @itemx -mno-fp-regs
24013 @opindex mfp-reg
24014 @opindex mno-fp-regs
24015 Generate code that uses (does not use) the floating-point register set.
24016 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
24017 register set is not used, floating-point operands are passed in integer
24018 registers as if they were integers and floating-point results are passed
24019 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
24020 so any function with a floating-point argument or return value called by code
24021 compiled with @option{-mno-fp-regs} must also be compiled with that
24022 option.
24023
24024 A typical use of this option is building a kernel that does not use,
24025 and hence need not save and restore, any floating-point registers.
24026
24027 @item -mieee
24028 @opindex mieee
24029 The Alpha architecture implements floating-point hardware optimized for
24030 maximum performance. It is mostly compliant with the IEEE floating-point
24031 standard. However, for full compliance, software assistance is
24032 required. This option generates code fully IEEE-compliant code
24033 @emph{except} that the @var{inexact-flag} is not maintained (see below).
24034 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
24035 defined during compilation. The resulting code is less efficient but is
24036 able to correctly support denormalized numbers and exceptional IEEE
24037 values such as not-a-number and plus/minus infinity. Other Alpha
24038 compilers call this option @option{-ieee_with_no_inexact}.
24039
24040 @item -mieee-with-inexact
24041 @opindex mieee-with-inexact
24042 This is like @option{-mieee} except the generated code also maintains
24043 the IEEE @var{inexact-flag}. Turning on this option causes the
24044 generated code to implement fully-compliant IEEE math. In addition to
24045 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24046 macro. On some Alpha implementations the resulting code may execute
24047 significantly slower than the code generated by default. Since there is
24048 very little code that depends on the @var{inexact-flag}, you should
24049 normally not specify this option. Other Alpha compilers call this
24050 option @option{-ieee_with_inexact}.
24051
24052 @item -mfp-trap-mode=@var{trap-mode}
24053 @opindex mfp-trap-mode
24054 This option controls what floating-point related traps are enabled.
24055 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24056 The trap mode can be set to one of four values:
24057
24058 @table @samp
24059 @item n
24060 This is the default (normal) setting. The only traps that are enabled
24061 are the ones that cannot be disabled in software (e.g., division by zero
24062 trap).
24063
24064 @item u
24065 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24066 as well.
24067
24068 @item su
24069 Like @samp{u}, but the instructions are marked to be safe for software
24070 completion (see Alpha architecture manual for details).
24071
24072 @item sui
24073 Like @samp{su}, but inexact traps are enabled as well.
24074 @end table
24075
24076 @item -mfp-rounding-mode=@var{rounding-mode}
24077 @opindex mfp-rounding-mode
24078 Selects the IEEE rounding mode. Other Alpha compilers call this option
24079 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
24080 of:
24081
24082 @table @samp
24083 @item n
24084 Normal IEEE rounding mode. Floating-point numbers are rounded towards
24085 the nearest machine number or towards the even machine number in case
24086 of a tie.
24087
24088 @item m
24089 Round towards minus infinity.
24090
24091 @item c
24092 Chopped rounding mode. Floating-point numbers are rounded towards zero.
24093
24094 @item d
24095 Dynamic rounding mode. A field in the floating-point control register
24096 (@var{fpcr}, see Alpha architecture reference manual) controls the
24097 rounding mode in effect. The C library initializes this register for
24098 rounding towards plus infinity. Thus, unless your program modifies the
24099 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24100 @end table
24101
24102 @item -mtrap-precision=@var{trap-precision}
24103 @opindex mtrap-precision
24104 In the Alpha architecture, floating-point traps are imprecise. This
24105 means without software assistance it is impossible to recover from a
24106 floating trap and program execution normally needs to be terminated.
24107 GCC can generate code that can assist operating system trap handlers
24108 in determining the exact location that caused a floating-point trap.
24109 Depending on the requirements of an application, different levels of
24110 precisions can be selected:
24111
24112 @table @samp
24113 @item p
24114 Program precision. This option is the default and means a trap handler
24115 can only identify which program caused a floating-point exception.
24116
24117 @item f
24118 Function precision. The trap handler can determine the function that
24119 caused a floating-point exception.
24120
24121 @item i
24122 Instruction precision. The trap handler can determine the exact
24123 instruction that caused a floating-point exception.
24124 @end table
24125
24126 Other Alpha compilers provide the equivalent options called
24127 @option{-scope_safe} and @option{-resumption_safe}.
24128
24129 @item -mieee-conformant
24130 @opindex mieee-conformant
24131 This option marks the generated code as IEEE conformant. You must not
24132 use this option unless you also specify @option{-mtrap-precision=i} and either
24133 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
24134 is to emit the line @samp{.eflag 48} in the function prologue of the
24135 generated assembly file.
24136
24137 @item -mbuild-constants
24138 @opindex mbuild-constants
24139 Normally GCC examines a 32- or 64-bit integer constant to
24140 see if it can construct it from smaller constants in two or three
24141 instructions. If it cannot, it outputs the constant as a literal and
24142 generates code to load it from the data segment at run time.
24143
24144 Use this option to require GCC to construct @emph{all} integer constants
24145 using code, even if it takes more instructions (the maximum is six).
24146
24147 You typically use this option to build a shared library dynamic
24148 loader. Itself a shared library, it must relocate itself in memory
24149 before it can find the variables and constants in its own data segment.
24150
24151 @item -mbwx
24152 @itemx -mno-bwx
24153 @itemx -mcix
24154 @itemx -mno-cix
24155 @itemx -mfix
24156 @itemx -mno-fix
24157 @itemx -mmax
24158 @itemx -mno-max
24159 @opindex mbwx
24160 @opindex mno-bwx
24161 @opindex mcix
24162 @opindex mno-cix
24163 @opindex mfix
24164 @opindex mno-fix
24165 @opindex mmax
24166 @opindex mno-max
24167 Indicate whether GCC should generate code to use the optional BWX,
24168 CIX, FIX and MAX instruction sets. The default is to use the instruction
24169 sets supported by the CPU type specified via @option{-mcpu=} option or that
24170 of the CPU on which GCC was built if none is specified.
24171
24172 @item -mfloat-vax
24173 @itemx -mfloat-ieee
24174 @opindex mfloat-vax
24175 @opindex mfloat-ieee
24176 Generate code that uses (does not use) VAX F and G floating-point
24177 arithmetic instead of IEEE single and double precision.
24178
24179 @item -mexplicit-relocs
24180 @itemx -mno-explicit-relocs
24181 @opindex mexplicit-relocs
24182 @opindex mno-explicit-relocs
24183 Older Alpha assemblers provided no way to generate symbol relocations
24184 except via assembler macros. Use of these macros does not allow
24185 optimal instruction scheduling. GNU binutils as of version 2.12
24186 supports a new syntax that allows the compiler to explicitly mark
24187 which relocations should apply to which instructions. This option
24188 is mostly useful for debugging, as GCC detects the capabilities of
24189 the assembler when it is built and sets the default accordingly.
24190
24191 @item -msmall-data
24192 @itemx -mlarge-data
24193 @opindex msmall-data
24194 @opindex mlarge-data
24195 When @option{-mexplicit-relocs} is in effect, static data is
24196 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
24197 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24198 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24199 16-bit relocations off of the @code{$gp} register. This limits the
24200 size of the small data area to 64KB, but allows the variables to be
24201 directly accessed via a single instruction.
24202
24203 The default is @option{-mlarge-data}. With this option the data area
24204 is limited to just below 2GB@. Programs that require more than 2GB of
24205 data must use @code{malloc} or @code{mmap} to allocate the data in the
24206 heap instead of in the program's data segment.
24207
24208 When generating code for shared libraries, @option{-fpic} implies
24209 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24210
24211 @item -msmall-text
24212 @itemx -mlarge-text
24213 @opindex msmall-text
24214 @opindex mlarge-text
24215 When @option{-msmall-text} is used, the compiler assumes that the
24216 code of the entire program (or shared library) fits in 4MB, and is
24217 thus reachable with a branch instruction. When @option{-msmall-data}
24218 is used, the compiler can assume that all local symbols share the
24219 same @code{$gp} value, and thus reduce the number of instructions
24220 required for a function call from 4 to 1.
24221
24222 The default is @option{-mlarge-text}.
24223
24224 @item -mcpu=@var{cpu_type}
24225 @opindex mcpu
24226 Set the instruction set and instruction scheduling parameters for
24227 machine type @var{cpu_type}. You can specify either the @samp{EV}
24228 style name or the corresponding chip number. GCC supports scheduling
24229 parameters for the EV4, EV5 and EV6 family of processors and
24230 chooses the default values for the instruction set from the processor
24231 you specify. If you do not specify a processor type, GCC defaults
24232 to the processor on which the compiler was built.
24233
24234 Supported values for @var{cpu_type} are
24235
24236 @table @samp
24237 @item ev4
24238 @itemx ev45
24239 @itemx 21064
24240 Schedules as an EV4 and has no instruction set extensions.
24241
24242 @item ev5
24243 @itemx 21164
24244 Schedules as an EV5 and has no instruction set extensions.
24245
24246 @item ev56
24247 @itemx 21164a
24248 Schedules as an EV5 and supports the BWX extension.
24249
24250 @item pca56
24251 @itemx 21164pc
24252 @itemx 21164PC
24253 Schedules as an EV5 and supports the BWX and MAX extensions.
24254
24255 @item ev6
24256 @itemx 21264
24257 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24258
24259 @item ev67
24260 @itemx 21264a
24261 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24262 @end table
24263
24264 Native toolchains also support the value @samp{native},
24265 which selects the best architecture option for the host processor.
24266 @option{-mcpu=native} has no effect if GCC does not recognize
24267 the processor.
24268
24269 @item -mtune=@var{cpu_type}
24270 @opindex mtune
24271 Set only the instruction scheduling parameters for machine type
24272 @var{cpu_type}. The instruction set is not changed.
24273
24274 Native toolchains also support the value @samp{native},
24275 which selects the best architecture option for the host processor.
24276 @option{-mtune=native} has no effect if GCC does not recognize
24277 the processor.
24278
24279 @item -mmemory-latency=@var{time}
24280 @opindex mmemory-latency
24281 Sets the latency the scheduler should assume for typical memory
24282 references as seen by the application. This number is highly
24283 dependent on the memory access patterns used by the application
24284 and the size of the external cache on the machine.
24285
24286 Valid options for @var{time} are
24287
24288 @table @samp
24289 @item @var{number}
24290 A decimal number representing clock cycles.
24291
24292 @item L1
24293 @itemx L2
24294 @itemx L3
24295 @itemx main
24296 The compiler contains estimates of the number of clock cycles for
24297 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
24298 (also called Dcache, Scache, and Bcache), as well as to main memory.
24299 Note that L3 is only valid for EV5.
24300
24301 @end table
24302 @end table
24303
24304 @node eBPF Options
24305 @subsection eBPF Options
24306 @cindex eBPF Options
24307
24308 @table @gcctabopt
24309 @item -mframe-limit=@var{bytes}
24310 This specifies the hard limit for frame sizes, in bytes. Currently,
24311 the value that can be specified should be less than or equal to
24312 @samp{32767}. Defaults to whatever limit is imposed by the version of
24313 the Linux kernel targeted.
24314
24315 @item -mkernel=@var{version}
24316 @opindex mkernel
24317 This specifies the minimum version of the kernel that will run the
24318 compiled program. GCC uses this version to determine which
24319 instructions to use, what kernel helpers to allow, etc. Currently,
24320 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
24321 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
24322 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
24323 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
24324 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
24325 @samp{5.2}, @samp{latest} and @samp{native}.
24326
24327 @item -mbig-endian
24328 @opindex mbig-endian
24329 Generate code for a big-endian target.
24330
24331 @item -mlittle-endian
24332 @opindex mlittle-endian
24333 Generate code for a little-endian target. This is the default.
24334
24335 @item -mjmpext
24336 @opindex mjmpext
24337 Enable generation of extra conditional-branch instructions.
24338 Enabled for CPU v2 and above.
24339
24340 @item -mjmp32
24341 @opindex mjmp32
24342 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
24343
24344 @item -malu32
24345 @opindex malu32
24346 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
24347
24348 @item -mcpu=@var{version}
24349 @opindex mcpu
24350 This specifies which version of the eBPF ISA to target. Newer versions
24351 may not be supported by all kernels. The default is @samp{v3}.
24352
24353 Supported values for @var{version} are:
24354
24355 @table @samp
24356 @item v1
24357 The first stable eBPF ISA with no special features or extensions.
24358
24359 @item v2
24360 Supports the jump extensions, as in @option{-mjmpext}.
24361
24362 @item v3
24363 All features of v2, plus:
24364 @itemize @minus
24365 @item 32-bit jump operations, as in @option{-mjmp32}
24366 @item 32-bit ALU operations, as in @option{-malu32}
24367 @end itemize
24368
24369 @end table
24370
24371 @item -mco-re
24372 @opindex mco-re
24373 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
24374 is implied by @option{-gbtf}.
24375
24376 @item -mno-co-re
24377 @opindex mno-co-re
24378 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
24379 support is enabled by default when generating BTF debug information for
24380 the BPF target.
24381
24382 @item -mxbpf
24383 Generate code for an expanded version of BPF, which relaxes some of
24384 the restrictions imposed by the BPF architecture:
24385 @itemize @minus
24386 @item Save and restore callee-saved registers at function entry and
24387 exit, respectively.
24388 @end itemize
24389 @end table
24390
24391 @node FR30 Options
24392 @subsection FR30 Options
24393 @cindex FR30 Options
24394
24395 These options are defined specifically for the FR30 port.
24396
24397 @table @gcctabopt
24398
24399 @item -msmall-model
24400 @opindex msmall-model
24401 Use the small address space model. This can produce smaller code, but
24402 it does assume that all symbolic values and addresses fit into a
24403 20-bit range.
24404
24405 @item -mno-lsim
24406 @opindex mno-lsim
24407 Assume that runtime support has been provided and so there is no need
24408 to include the simulator library (@file{libsim.a}) on the linker
24409 command line.
24410
24411 @end table
24412
24413 @node FT32 Options
24414 @subsection FT32 Options
24415 @cindex FT32 Options
24416
24417 These options are defined specifically for the FT32 port.
24418
24419 @table @gcctabopt
24420
24421 @item -msim
24422 @opindex msim
24423 Specifies that the program will be run on the simulator. This causes
24424 an alternate runtime startup and library to be linked.
24425 You must not use this option when generating programs that will run on
24426 real hardware; you must provide your own runtime library for whatever
24427 I/O functions are needed.
24428
24429 @item -mlra
24430 @opindex mlra
24431 Enable Local Register Allocation. This is still experimental for FT32,
24432 so by default the compiler uses standard reload.
24433
24434 @item -mnodiv
24435 @opindex mnodiv
24436 Do not use div and mod instructions.
24437
24438 @item -mft32b
24439 @opindex mft32b
24440 Enable use of the extended instructions of the FT32B processor.
24441
24442 @item -mcompress
24443 @opindex mcompress
24444 Compress all code using the Ft32B code compression scheme.
24445
24446 @item -mnopm
24447 @opindex mnopm
24448 Do not generate code that reads program memory.
24449
24450 @end table
24451
24452 @node FRV Options
24453 @subsection FRV Options
24454 @cindex FRV Options
24455
24456 @table @gcctabopt
24457 @item -mgpr-32
24458 @opindex mgpr-32
24459
24460 Only use the first 32 general-purpose registers.
24461
24462 @item -mgpr-64
24463 @opindex mgpr-64
24464
24465 Use all 64 general-purpose registers.
24466
24467 @item -mfpr-32
24468 @opindex mfpr-32
24469
24470 Use only the first 32 floating-point registers.
24471
24472 @item -mfpr-64
24473 @opindex mfpr-64
24474
24475 Use all 64 floating-point registers.
24476
24477 @item -mhard-float
24478 @opindex mhard-float
24479
24480 Use hardware instructions for floating-point operations.
24481
24482 @item -msoft-float
24483 @opindex msoft-float
24484
24485 Use library routines for floating-point operations.
24486
24487 @item -malloc-cc
24488 @opindex malloc-cc
24489
24490 Dynamically allocate condition code registers.
24491
24492 @item -mfixed-cc
24493 @opindex mfixed-cc
24494
24495 Do not try to dynamically allocate condition code registers, only
24496 use @code{icc0} and @code{fcc0}.
24497
24498 @item -mdword
24499 @opindex mdword
24500
24501 Change ABI to use double word insns.
24502
24503 @item -mno-dword
24504 @opindex mno-dword
24505 @opindex mdword
24506
24507 Do not use double word instructions.
24508
24509 @item -mdouble
24510 @opindex mdouble
24511
24512 Use floating-point double instructions.
24513
24514 @item -mno-double
24515 @opindex mno-double
24516
24517 Do not use floating-point double instructions.
24518
24519 @item -mmedia
24520 @opindex mmedia
24521
24522 Use media instructions.
24523
24524 @item -mno-media
24525 @opindex mno-media
24526
24527 Do not use media instructions.
24528
24529 @item -mmuladd
24530 @opindex mmuladd
24531
24532 Use multiply and add/subtract instructions.
24533
24534 @item -mno-muladd
24535 @opindex mno-muladd
24536
24537 Do not use multiply and add/subtract instructions.
24538
24539 @item -mfdpic
24540 @opindex mfdpic
24541
24542 Select the FDPIC ABI, which uses function descriptors to represent
24543 pointers to functions. Without any PIC/PIE-related options, it
24544 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
24545 assumes GOT entries and small data are within a 12-bit range from the
24546 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
24547 are computed with 32 bits.
24548 With a @samp{bfin-elf} target, this option implies @option{-msim}.
24549
24550 @item -minline-plt
24551 @opindex minline-plt
24552
24553 Enable inlining of PLT entries in function calls to functions that are
24554 not known to bind locally. It has no effect without @option{-mfdpic}.
24555 It's enabled by default if optimizing for speed and compiling for
24556 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
24557 optimization option such as @option{-O3} or above is present in the
24558 command line.
24559
24560 @item -mTLS
24561 @opindex mTLS
24562
24563 Assume a large TLS segment when generating thread-local code.
24564
24565 @item -mtls
24566 @opindex mtls
24567
24568 Do not assume a large TLS segment when generating thread-local code.
24569
24570 @item -mgprel-ro
24571 @opindex mgprel-ro
24572
24573 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
24574 that is known to be in read-only sections. It's enabled by default,
24575 except for @option{-fpic} or @option{-fpie}: even though it may help
24576 make the global offset table smaller, it trades 1 instruction for 4.
24577 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
24578 one of which may be shared by multiple symbols, and it avoids the need
24579 for a GOT entry for the referenced symbol, so it's more likely to be a
24580 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
24581
24582 @item -multilib-library-pic
24583 @opindex multilib-library-pic
24584
24585 Link with the (library, not FD) pic libraries. It's implied by
24586 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
24587 @option{-fpic} without @option{-mfdpic}. You should never have to use
24588 it explicitly.
24589
24590 @item -mlinked-fp
24591 @opindex mlinked-fp
24592
24593 Follow the EABI requirement of always creating a frame pointer whenever
24594 a stack frame is allocated. This option is enabled by default and can
24595 be disabled with @option{-mno-linked-fp}.
24596
24597 @item -mlong-calls
24598 @opindex mlong-calls
24599
24600 Use indirect addressing to call functions outside the current
24601 compilation unit. This allows the functions to be placed anywhere
24602 within the 32-bit address space.
24603
24604 @item -malign-labels
24605 @opindex malign-labels
24606
24607 Try to align labels to an 8-byte boundary by inserting NOPs into the
24608 previous packet. This option only has an effect when VLIW packing
24609 is enabled. It doesn't create new packets; it merely adds NOPs to
24610 existing ones.
24611
24612 @item -mlibrary-pic
24613 @opindex mlibrary-pic
24614
24615 Generate position-independent EABI code.
24616
24617 @item -macc-4
24618 @opindex macc-4
24619
24620 Use only the first four media accumulator registers.
24621
24622 @item -macc-8
24623 @opindex macc-8
24624
24625 Use all eight media accumulator registers.
24626
24627 @item -mpack
24628 @opindex mpack
24629
24630 Pack VLIW instructions.
24631
24632 @item -mno-pack
24633 @opindex mno-pack
24634
24635 Do not pack VLIW instructions.
24636
24637 @item -mno-eflags
24638 @opindex mno-eflags
24639
24640 Do not mark ABI switches in e_flags.
24641
24642 @item -mcond-move
24643 @opindex mcond-move
24644
24645 Enable the use of conditional-move instructions (default).
24646
24647 This switch is mainly for debugging the compiler and will likely be removed
24648 in a future version.
24649
24650 @item -mno-cond-move
24651 @opindex mno-cond-move
24652
24653 Disable the use of conditional-move instructions.
24654
24655 This switch is mainly for debugging the compiler and will likely be removed
24656 in a future version.
24657
24658 @item -mscc
24659 @opindex mscc
24660
24661 Enable the use of conditional set instructions (default).
24662
24663 This switch is mainly for debugging the compiler and will likely be removed
24664 in a future version.
24665
24666 @item -mno-scc
24667 @opindex mno-scc
24668
24669 Disable the use of conditional set instructions.
24670
24671 This switch is mainly for debugging the compiler and will likely be removed
24672 in a future version.
24673
24674 @item -mcond-exec
24675 @opindex mcond-exec
24676
24677 Enable the use of conditional execution (default).
24678
24679 This switch is mainly for debugging the compiler and will likely be removed
24680 in a future version.
24681
24682 @item -mno-cond-exec
24683 @opindex mno-cond-exec
24684
24685 Disable the use of conditional execution.
24686
24687 This switch is mainly for debugging the compiler and will likely be removed
24688 in a future version.
24689
24690 @item -mvliw-branch
24691 @opindex mvliw-branch
24692
24693 Run a pass to pack branches into VLIW instructions (default).
24694
24695 This switch is mainly for debugging the compiler and will likely be removed
24696 in a future version.
24697
24698 @item -mno-vliw-branch
24699 @opindex mno-vliw-branch
24700
24701 Do not run a pass to pack branches into VLIW instructions.
24702
24703 This switch is mainly for debugging the compiler and will likely be removed
24704 in a future version.
24705
24706 @item -mmulti-cond-exec
24707 @opindex mmulti-cond-exec
24708
24709 Enable optimization of @code{&&} and @code{||} in conditional execution
24710 (default).
24711
24712 This switch is mainly for debugging the compiler and will likely be removed
24713 in a future version.
24714
24715 @item -mno-multi-cond-exec
24716 @opindex mno-multi-cond-exec
24717
24718 Disable optimization of @code{&&} and @code{||} in conditional execution.
24719
24720 This switch is mainly for debugging the compiler and will likely be removed
24721 in a future version.
24722
24723 @item -mnested-cond-exec
24724 @opindex mnested-cond-exec
24725
24726 Enable nested conditional execution optimizations (default).
24727
24728 This switch is mainly for debugging the compiler and will likely be removed
24729 in a future version.
24730
24731 @item -mno-nested-cond-exec
24732 @opindex mno-nested-cond-exec
24733
24734 Disable nested conditional execution optimizations.
24735
24736 This switch is mainly for debugging the compiler and will likely be removed
24737 in a future version.
24738
24739 @item -moptimize-membar
24740 @opindex moptimize-membar
24741
24742 This switch removes redundant @code{membar} instructions from the
24743 compiler-generated code. It is enabled by default.
24744
24745 @item -mno-optimize-membar
24746 @opindex mno-optimize-membar
24747 @opindex moptimize-membar
24748
24749 This switch disables the automatic removal of redundant @code{membar}
24750 instructions from the generated code.
24751
24752 @item -mtomcat-stats
24753 @opindex mtomcat-stats
24754
24755 Cause gas to print out tomcat statistics.
24756
24757 @item -mcpu=@var{cpu}
24758 @opindex mcpu
24759
24760 Select the processor type for which to generate code. Possible values are
24761 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
24762 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
24763
24764 @end table
24765
24766 @node GNU/Linux Options
24767 @subsection GNU/Linux Options
24768
24769 These @samp{-m} options are defined for GNU/Linux targets:
24770
24771 @table @gcctabopt
24772 @item -mglibc
24773 @opindex mglibc
24774 Use the GNU C library. This is the default except
24775 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
24776 @samp{*-*-linux-*android*} targets.
24777
24778 @item -muclibc
24779 @opindex muclibc
24780 Use uClibc C library. This is the default on
24781 @samp{*-*-linux-*uclibc*} targets.
24782
24783 @item -mmusl
24784 @opindex mmusl
24785 Use the musl C library. This is the default on
24786 @samp{*-*-linux-*musl*} targets.
24787
24788 @item -mbionic
24789 @opindex mbionic
24790 Use Bionic C library. This is the default on
24791 @samp{*-*-linux-*android*} targets.
24792
24793 @item -mandroid
24794 @opindex mandroid
24795 Compile code compatible with Android platform. This is the default on
24796 @samp{*-*-linux-*android*} targets.
24797
24798 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
24799 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
24800 this option makes the GCC driver pass Android-specific options to the linker.
24801 Finally, this option causes the preprocessor macro @code{__ANDROID__}
24802 to be defined.
24803
24804 @item -tno-android-cc
24805 @opindex tno-android-cc
24806 Disable compilation effects of @option{-mandroid}, i.e., do not enable
24807 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
24808 @option{-fno-rtti} by default.
24809
24810 @item -tno-android-ld
24811 @opindex tno-android-ld
24812 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
24813 linking options to the linker.
24814
24815 @end table
24816
24817 @node H8/300 Options
24818 @subsection H8/300 Options
24819
24820 These @samp{-m} options are defined for the H8/300 implementations:
24821
24822 @table @gcctabopt
24823 @item -mrelax
24824 @opindex mrelax
24825 Shorten some address references at link time, when possible; uses the
24826 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
24827 ld, Using ld}, for a fuller description.
24828
24829 @item -mh
24830 @opindex mh
24831 Generate code for the H8/300H@.
24832
24833 @item -ms
24834 @opindex ms
24835 Generate code for the H8S@.
24836
24837 @item -mn
24838 @opindex mn
24839 Generate code for the H8S and H8/300H in the normal mode. This switch
24840 must be used either with @option{-mh} or @option{-ms}.
24841
24842 @item -ms2600
24843 @opindex ms2600
24844 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
24845
24846 @item -mexr
24847 @opindex mexr
24848 Extended registers are stored on stack before execution of function
24849 with monitor attribute. Default option is @option{-mexr}.
24850 This option is valid only for H8S targets.
24851
24852 @item -mno-exr
24853 @opindex mno-exr
24854 @opindex mexr
24855 Extended registers are not stored on stack before execution of function
24856 with monitor attribute. Default option is @option{-mno-exr}.
24857 This option is valid only for H8S targets.
24858
24859 @item -mint32
24860 @opindex mint32
24861 Make @code{int} data 32 bits by default.
24862
24863 @item -malign-300
24864 @opindex malign-300
24865 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
24866 The default for the H8/300H and H8S is to align longs and floats on
24867 4-byte boundaries.
24868 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
24869 This option has no effect on the H8/300.
24870 @end table
24871
24872 @node HPPA Options
24873 @subsection HPPA Options
24874 @cindex HPPA Options
24875
24876 These @samp{-m} options are defined for the HPPA family of computers:
24877
24878 @table @gcctabopt
24879 @item -march=@var{architecture-type}
24880 @opindex march
24881 Generate code for the specified architecture. The choices for
24882 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
24883 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
24884 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
24885 architecture option for your machine. Code compiled for lower numbered
24886 architectures runs on higher numbered architectures, but not the
24887 other way around.
24888
24889 @item -mpa-risc-1-0
24890 @itemx -mpa-risc-1-1
24891 @itemx -mpa-risc-2-0
24892 @opindex mpa-risc-1-0
24893 @opindex mpa-risc-1-1
24894 @opindex mpa-risc-2-0
24895 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
24896
24897 @item -mcaller-copies
24898 @opindex mcaller-copies
24899 The caller copies function arguments passed by hidden reference. This
24900 option should be used with care as it is not compatible with the default
24901 32-bit runtime. However, only aggregates larger than eight bytes are
24902 passed by hidden reference and the option provides better compatibility
24903 with OpenMP.
24904
24905 @item -mjump-in-delay
24906 @opindex mjump-in-delay
24907 This option is ignored and provided for compatibility purposes only.
24908
24909 @item -mdisable-fpregs
24910 @opindex mdisable-fpregs
24911 Prevent floating-point registers from being used in any manner. This is
24912 necessary for compiling kernels that perform lazy context switching of
24913 floating-point registers. If you use this option and attempt to perform
24914 floating-point operations, the compiler aborts.
24915
24916 @item -mdisable-indexing
24917 @opindex mdisable-indexing
24918 Prevent the compiler from using indexing address modes. This avoids some
24919 rather obscure problems when compiling MIG generated code under MACH@.
24920
24921 @item -mno-space-regs
24922 @opindex mno-space-regs
24923 @opindex mspace-regs
24924 Generate code that assumes the target has no space registers. This allows
24925 GCC to generate faster indirect calls and use unscaled index address modes.
24926
24927 Such code is suitable for level 0 PA systems and kernels.
24928
24929 @item -mfast-indirect-calls
24930 @opindex mfast-indirect-calls
24931 Generate code that assumes calls never cross space boundaries. This
24932 allows GCC to emit code that performs faster indirect calls.
24933
24934 This option does not work in the presence of shared libraries or nested
24935 functions.
24936
24937 @item -mfixed-range=@var{register-range}
24938 @opindex mfixed-range
24939 Generate code treating the given register range as fixed registers.
24940 A fixed register is one that the register allocator cannot use. This is
24941 useful when compiling kernel code. A register range is specified as
24942 two registers separated by a dash. Multiple register ranges can be
24943 specified separated by a comma.
24944
24945 @item -mlong-load-store
24946 @opindex mlong-load-store
24947 Generate 3-instruction load and store sequences as sometimes required by
24948 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
24949 the HP compilers.
24950
24951 @item -mportable-runtime
24952 @opindex mportable-runtime
24953 Use the portable calling conventions proposed by HP for ELF systems.
24954
24955 @item -mgas
24956 @opindex mgas
24957 Enable the use of assembler directives only GAS understands.
24958
24959 @item -mschedule=@var{cpu-type}
24960 @opindex mschedule
24961 Schedule code according to the constraints for the machine type
24962 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
24963 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
24964 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
24965 proper scheduling option for your machine. The default scheduling is
24966 @samp{8000}.
24967
24968 @item -mlinker-opt
24969 @opindex mlinker-opt
24970 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
24971 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
24972 linkers in which they give bogus error messages when linking some programs.
24973
24974 @item -msoft-float
24975 @opindex msoft-float
24976 Generate output containing library calls for floating point.
24977 @strong{Warning:} the requisite libraries are not available for all HPPA
24978 targets. Normally the facilities of the machine's usual C compiler are
24979 used, but this cannot be done directly in cross-compilation. You must make
24980 your own arrangements to provide suitable library functions for
24981 cross-compilation.
24982
24983 @option{-msoft-float} changes the calling convention in the output file;
24984 therefore, it is only useful if you compile @emph{all} of a program with
24985 this option. In particular, you need to compile @file{libgcc.a}, the
24986 library that comes with GCC, with @option{-msoft-float} in order for
24987 this to work.
24988
24989 @item -msio
24990 @opindex msio
24991 Generate the predefine, @code{_SIO}, for server IO@. The default is
24992 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
24993 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
24994 options are available under HP-UX and HI-UX@.
24995
24996 @item -mgnu-ld
24997 @opindex mgnu-ld
24998 Use options specific to GNU @command{ld}.
24999 This passes @option{-shared} to @command{ld} when
25000 building a shared library. It is the default when GCC is configured,
25001 explicitly or implicitly, with the GNU linker. This option does not
25002 affect which @command{ld} is called; it only changes what parameters
25003 are passed to that @command{ld}.
25004 The @command{ld} that is called is determined by the
25005 @option{--with-ld} configure option, GCC's program search path, and
25006 finally by the user's @env{PATH}. The linker used by GCC can be printed
25007 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
25008 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25009
25010 @item -mhp-ld
25011 @opindex mhp-ld
25012 Use options specific to HP @command{ld}.
25013 This passes @option{-b} to @command{ld} when building
25014 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
25015 links. It is the default when GCC is configured, explicitly or
25016 implicitly, with the HP linker. This option does not affect
25017 which @command{ld} is called; it only changes what parameters are passed to that
25018 @command{ld}.
25019 The @command{ld} that is called is determined by the @option{--with-ld}
25020 configure option, GCC's program search path, and finally by the user's
25021 @env{PATH}. The linker used by GCC can be printed using @samp{which
25022 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
25023 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25024
25025 @item -mlong-calls
25026 @opindex mno-long-calls
25027 @opindex mlong-calls
25028 Generate code that uses long call sequences. This ensures that a call
25029 is always able to reach linker generated stubs. The default is to generate
25030 long calls only when the distance from the call site to the beginning
25031 of the function or translation unit, as the case may be, exceeds a
25032 predefined limit set by the branch type being used. The limits for
25033 normal calls are 7,600,000 and 240,000 bytes, respectively for the
25034 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
25035 240,000 bytes.
25036
25037 Distances are measured from the beginning of functions when using the
25038 @option{-ffunction-sections} option, or when using the @option{-mgas}
25039 and @option{-mno-portable-runtime} options together under HP-UX with
25040 the SOM linker.
25041
25042 It is normally not desirable to use this option as it degrades
25043 performance. However, it may be useful in large applications,
25044 particularly when partial linking is used to build the application.
25045
25046 The types of long calls used depends on the capabilities of the
25047 assembler and linker, and the type of code being generated. The
25048 impact on systems that support long absolute calls, and long pic
25049 symbol-difference or pc-relative calls should be relatively small.
25050 However, an indirect call is used on 32-bit ELF systems in pic code
25051 and it is quite long.
25052
25053 @item -munix=@var{unix-std}
25054 @opindex march
25055 Generate compiler predefines and select a startfile for the specified
25056 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
25057 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
25058 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
25059 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
25060 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25061 and later.
25062
25063 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25064 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25065 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25066 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25067 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25068 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25069
25070 It is @emph{important} to note that this option changes the interfaces
25071 for various library routines. It also affects the operational behavior
25072 of the C library. Thus, @emph{extreme} care is needed in using this
25073 option.
25074
25075 Library code that is intended to operate with more than one UNIX
25076 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25077 as appropriate. Most GNU software doesn't provide this capability.
25078
25079 @item -nolibdld
25080 @opindex nolibdld
25081 Suppress the generation of link options to search libdld.sl when the
25082 @option{-static} option is specified on HP-UX 10 and later.
25083
25084 @item -static
25085 @opindex static
25086 The HP-UX implementation of setlocale in libc has a dependency on
25087 libdld.sl. There isn't an archive version of libdld.sl. Thus,
25088 when the @option{-static} option is specified, special link options
25089 are needed to resolve this dependency.
25090
25091 On HP-UX 10 and later, the GCC driver adds the necessary options to
25092 link with libdld.sl when the @option{-static} option is specified.
25093 This causes the resulting binary to be dynamic. On the 64-bit port,
25094 the linkers generate dynamic binaries by default in any case. The
25095 @option{-nolibdld} option can be used to prevent the GCC driver from
25096 adding these link options.
25097
25098 @item -threads
25099 @opindex threads
25100 Add support for multithreading with the @dfn{dce thread} library
25101 under HP-UX@. This option sets flags for both the preprocessor and
25102 linker.
25103 @end table
25104
25105 @node IA-64 Options
25106 @subsection IA-64 Options
25107 @cindex IA-64 Options
25108
25109 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25110
25111 @table @gcctabopt
25112 @item -mbig-endian
25113 @opindex mbig-endian
25114 Generate code for a big-endian target. This is the default for HP-UX@.
25115
25116 @item -mlittle-endian
25117 @opindex mlittle-endian
25118 Generate code for a little-endian target. This is the default for AIX5
25119 and GNU/Linux.
25120
25121 @item -mgnu-as
25122 @itemx -mno-gnu-as
25123 @opindex mgnu-as
25124 @opindex mno-gnu-as
25125 Generate (or don't) code for the GNU assembler. This is the default.
25126 @c Also, this is the default if the configure option @option{--with-gnu-as}
25127 @c is used.
25128
25129 @item -mgnu-ld
25130 @itemx -mno-gnu-ld
25131 @opindex mgnu-ld
25132 @opindex mno-gnu-ld
25133 Generate (or don't) code for the GNU linker. This is the default.
25134 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25135 @c is used.
25136
25137 @item -mno-pic
25138 @opindex mno-pic
25139 Generate code that does not use a global pointer register. The result
25140 is not position independent code, and violates the IA-64 ABI@.
25141
25142 @item -mvolatile-asm-stop
25143 @itemx -mno-volatile-asm-stop
25144 @opindex mvolatile-asm-stop
25145 @opindex mno-volatile-asm-stop
25146 Generate (or don't) a stop bit immediately before and after volatile asm
25147 statements.
25148
25149 @item -mregister-names
25150 @itemx -mno-register-names
25151 @opindex mregister-names
25152 @opindex mno-register-names
25153 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25154 the stacked registers. This may make assembler output more readable.
25155
25156 @item -mno-sdata
25157 @itemx -msdata
25158 @opindex mno-sdata
25159 @opindex msdata
25160 Disable (or enable) optimizations that use the small data section. This may
25161 be useful for working around optimizer bugs.
25162
25163 @item -mconstant-gp
25164 @opindex mconstant-gp
25165 Generate code that uses a single constant global pointer value. This is
25166 useful when compiling kernel code.
25167
25168 @item -mauto-pic
25169 @opindex mauto-pic
25170 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
25171 This is useful when compiling firmware code.
25172
25173 @item -minline-float-divide-min-latency
25174 @opindex minline-float-divide-min-latency
25175 Generate code for inline divides of floating-point values
25176 using the minimum latency algorithm.
25177
25178 @item -minline-float-divide-max-throughput
25179 @opindex minline-float-divide-max-throughput
25180 Generate code for inline divides of floating-point values
25181 using the maximum throughput algorithm.
25182
25183 @item -mno-inline-float-divide
25184 @opindex mno-inline-float-divide
25185 Do not generate inline code for divides of floating-point values.
25186
25187 @item -minline-int-divide-min-latency
25188 @opindex minline-int-divide-min-latency
25189 Generate code for inline divides of integer values
25190 using the minimum latency algorithm.
25191
25192 @item -minline-int-divide-max-throughput
25193 @opindex minline-int-divide-max-throughput
25194 Generate code for inline divides of integer values
25195 using the maximum throughput algorithm.
25196
25197 @item -mno-inline-int-divide
25198 @opindex mno-inline-int-divide
25199 @opindex minline-int-divide
25200 Do not generate inline code for divides of integer values.
25201
25202 @item -minline-sqrt-min-latency
25203 @opindex minline-sqrt-min-latency
25204 Generate code for inline square roots
25205 using the minimum latency algorithm.
25206
25207 @item -minline-sqrt-max-throughput
25208 @opindex minline-sqrt-max-throughput
25209 Generate code for inline square roots
25210 using the maximum throughput algorithm.
25211
25212 @item -mno-inline-sqrt
25213 @opindex mno-inline-sqrt
25214 Do not generate inline code for @code{sqrt}.
25215
25216 @item -mfused-madd
25217 @itemx -mno-fused-madd
25218 @opindex mfused-madd
25219 @opindex mno-fused-madd
25220 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
25221 instructions. The default is to use these instructions.
25222
25223 @item -mno-dwarf2-asm
25224 @itemx -mdwarf2-asm
25225 @opindex mno-dwarf2-asm
25226 @opindex mdwarf2-asm
25227 Don't (or do) generate assembler code for the DWARF line number debugging
25228 info. This may be useful when not using the GNU assembler.
25229
25230 @item -mearly-stop-bits
25231 @itemx -mno-early-stop-bits
25232 @opindex mearly-stop-bits
25233 @opindex mno-early-stop-bits
25234 Allow stop bits to be placed earlier than immediately preceding the
25235 instruction that triggered the stop bit. This can improve instruction
25236 scheduling, but does not always do so.
25237
25238 @item -mfixed-range=@var{register-range}
25239 @opindex mfixed-range
25240 Generate code treating the given register range as fixed registers.
25241 A fixed register is one that the register allocator cannot use. This is
25242 useful when compiling kernel code. A register range is specified as
25243 two registers separated by a dash. Multiple register ranges can be
25244 specified separated by a comma.
25245
25246 @item -mtls-size=@var{tls-size}
25247 @opindex mtls-size
25248 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
25249 64.
25250
25251 @item -mtune=@var{cpu-type}
25252 @opindex mtune
25253 Tune the instruction scheduling for a particular CPU, Valid values are
25254 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
25255 and @samp{mckinley}.
25256
25257 @item -milp32
25258 @itemx -mlp64
25259 @opindex milp32
25260 @opindex mlp64
25261 Generate code for a 32-bit or 64-bit environment.
25262 The 32-bit environment sets int, long and pointer to 32 bits.
25263 The 64-bit environment sets int to 32 bits and long and pointer
25264 to 64 bits. These are HP-UX specific flags.
25265
25266 @item -mno-sched-br-data-spec
25267 @itemx -msched-br-data-spec
25268 @opindex mno-sched-br-data-spec
25269 @opindex msched-br-data-spec
25270 (Dis/En)able data speculative scheduling before reload.
25271 This results in generation of @code{ld.a} instructions and
25272 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25273 The default setting is disabled.
25274
25275 @item -msched-ar-data-spec
25276 @itemx -mno-sched-ar-data-spec
25277 @opindex msched-ar-data-spec
25278 @opindex mno-sched-ar-data-spec
25279 (En/Dis)able data speculative scheduling after reload.
25280 This results in generation of @code{ld.a} instructions and
25281 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25282 The default setting is enabled.
25283
25284 @item -mno-sched-control-spec
25285 @itemx -msched-control-spec
25286 @opindex mno-sched-control-spec
25287 @opindex msched-control-spec
25288 (Dis/En)able control speculative scheduling. This feature is
25289 available only during region scheduling (i.e.@: before reload).
25290 This results in generation of the @code{ld.s} instructions and
25291 the corresponding check instructions @code{chk.s}.
25292 The default setting is disabled.
25293
25294 @item -msched-br-in-data-spec
25295 @itemx -mno-sched-br-in-data-spec
25296 @opindex msched-br-in-data-spec
25297 @opindex mno-sched-br-in-data-spec
25298 (En/Dis)able speculative scheduling of the instructions that
25299 are dependent on the data speculative loads before reload.
25300 This is effective only with @option{-msched-br-data-spec} enabled.
25301 The default setting is enabled.
25302
25303 @item -msched-ar-in-data-spec
25304 @itemx -mno-sched-ar-in-data-spec
25305 @opindex msched-ar-in-data-spec
25306 @opindex mno-sched-ar-in-data-spec
25307 (En/Dis)able speculative scheduling of the instructions that
25308 are dependent on the data speculative loads after reload.
25309 This is effective only with @option{-msched-ar-data-spec} enabled.
25310 The default setting is enabled.
25311
25312 @item -msched-in-control-spec
25313 @itemx -mno-sched-in-control-spec
25314 @opindex msched-in-control-spec
25315 @opindex mno-sched-in-control-spec
25316 (En/Dis)able speculative scheduling of the instructions that
25317 are dependent on the control speculative loads.
25318 This is effective only with @option{-msched-control-spec} enabled.
25319 The default setting is enabled.
25320
25321 @item -mno-sched-prefer-non-data-spec-insns
25322 @itemx -msched-prefer-non-data-spec-insns
25323 @opindex mno-sched-prefer-non-data-spec-insns
25324 @opindex msched-prefer-non-data-spec-insns
25325 If enabled, data-speculative instructions are chosen for schedule
25326 only if there are no other choices at the moment. This makes
25327 the use of the data speculation much more conservative.
25328 The default setting is disabled.
25329
25330 @item -mno-sched-prefer-non-control-spec-insns
25331 @itemx -msched-prefer-non-control-spec-insns
25332 @opindex mno-sched-prefer-non-control-spec-insns
25333 @opindex msched-prefer-non-control-spec-insns
25334 If enabled, control-speculative instructions are chosen for schedule
25335 only if there are no other choices at the moment. This makes
25336 the use of the control speculation much more conservative.
25337 The default setting is disabled.
25338
25339 @item -mno-sched-count-spec-in-critical-path
25340 @itemx -msched-count-spec-in-critical-path
25341 @opindex mno-sched-count-spec-in-critical-path
25342 @opindex msched-count-spec-in-critical-path
25343 If enabled, speculative dependencies are considered during
25344 computation of the instructions priorities. This makes the use of the
25345 speculation a bit more conservative.
25346 The default setting is disabled.
25347
25348 @item -msched-spec-ldc
25349 @opindex msched-spec-ldc
25350 Use a simple data speculation check. This option is on by default.
25351
25352 @item -msched-control-spec-ldc
25353 @opindex msched-spec-ldc
25354 Use a simple check for control speculation. This option is on by default.
25355
25356 @item -msched-stop-bits-after-every-cycle
25357 @opindex msched-stop-bits-after-every-cycle
25358 Place a stop bit after every cycle when scheduling. This option is on
25359 by default.
25360
25361 @item -msched-fp-mem-deps-zero-cost
25362 @opindex msched-fp-mem-deps-zero-cost
25363 Assume that floating-point stores and loads are not likely to cause a conflict
25364 when placed into the same instruction group. This option is disabled by
25365 default.
25366
25367 @item -msel-sched-dont-check-control-spec
25368 @opindex msel-sched-dont-check-control-spec
25369 Generate checks for control speculation in selective scheduling.
25370 This flag is disabled by default.
25371
25372 @item -msched-max-memory-insns=@var{max-insns}
25373 @opindex msched-max-memory-insns
25374 Limit on the number of memory insns per instruction group, giving lower
25375 priority to subsequent memory insns attempting to schedule in the same
25376 instruction group. Frequently useful to prevent cache bank conflicts.
25377 The default value is 1.
25378
25379 @item -msched-max-memory-insns-hard-limit
25380 @opindex msched-max-memory-insns-hard-limit
25381 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
25382 disallowing more than that number in an instruction group.
25383 Otherwise, the limit is ``soft'', meaning that non-memory operations
25384 are preferred when the limit is reached, but memory operations may still
25385 be scheduled.
25386
25387 @end table
25388
25389 @node LM32 Options
25390 @subsection LM32 Options
25391 @cindex LM32 options
25392
25393 These @option{-m} options are defined for the LatticeMico32 architecture:
25394
25395 @table @gcctabopt
25396 @item -mbarrel-shift-enabled
25397 @opindex mbarrel-shift-enabled
25398 Enable barrel-shift instructions.
25399
25400 @item -mdivide-enabled
25401 @opindex mdivide-enabled
25402 Enable divide and modulus instructions.
25403
25404 @item -mmultiply-enabled
25405 @opindex multiply-enabled
25406 Enable multiply instructions.
25407
25408 @item -msign-extend-enabled
25409 @opindex msign-extend-enabled
25410 Enable sign extend instructions.
25411
25412 @item -muser-enabled
25413 @opindex muser-enabled
25414 Enable user-defined instructions.
25415
25416 @end table
25417
25418 @node LoongArch Options
25419 @subsection LoongArch Options
25420 @cindex LoongArch Options
25421
25422 These command-line options are defined for LoongArch targets:
25423
25424 @table @gcctabopt
25425 @item -march=@var{cpu-type}
25426 @opindex march
25427 Generate instructions for the machine type @var{cpu-type}. In contrast to
25428 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
25429 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
25430 to generate code that may not run at all on processors other than the one
25431 indicated. Specifying @option{-march=@var{cpu-type}} implies
25432 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
25433
25434 The choices for @var{cpu-type} are:
25435
25436 @table @samp
25437 @item native
25438 This selects the CPU to generate code for at compilation time by determining
25439 the processor type of the compiling machine. Using @option{-march=native}
25440 enables all instruction subsets supported by the local machine (hence
25441 the result might not run on different machines). Using @option{-mtune=native}
25442 produces code optimized for the local machine under the constraints
25443 of the selected instruction set.
25444 @item loongarch64
25445 A generic CPU with 64-bit extensions.
25446 @item la464
25447 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
25448 @end table
25449
25450 @item -mtune=@var{cpu-type}
25451 @opindex mtune
25452 Optimize the output for the given processor, specified by microarchitecture
25453 name.
25454
25455 @item -mabi=@var{base-abi-type}
25456 @opindex mabi
25457 Generate code for the specified calling convention.
25458 @var{base-abi-type} can be one of:
25459 @table @samp
25460 @item lp64d
25461 Uses 64-bit general purpose registers and 32/64-bit floating-point
25462 registers for parameter passing. Data model is LP64, where @samp{int}
25463 is 32 bits, while @samp{long int} and pointers are 64 bits.
25464 @item lp64f
25465 Uses 64-bit general purpose registers and 32-bit floating-point
25466 registers for parameter passing. Data model is LP64, where @samp{int}
25467 is 32 bits, while @samp{long int} and pointers are 64 bits.
25468 @item lp64s
25469 Uses 64-bit general purpose registers and no floating-point
25470 registers for parameter passing. Data model is LP64, where @samp{int}
25471 is 32 bits, while @samp{long int} and pointers are 64 bits.
25472 @end table
25473
25474 @item -mfpu=@var{fpu-type}
25475 @opindex mfpu
25476 Generate code for the specified FPU type, which can be one of:
25477 @table @samp
25478 @item 64
25479 Allow the use of hardware floating-point instructions for 32-bit
25480 and 64-bit operations.
25481 @item 32
25482 Allow the use of hardware floating-point instructions for 32-bit
25483 operations.
25484 @item none
25485 @item 0
25486 Prevent the use of hardware floating-point instructions.
25487 @end table
25488
25489 @item -msoft-float
25490 @opindex msoft-float
25491 Force @option{-mfpu=none} and prevents the use of floating-point
25492 registers for parameter passing. This option may change the target
25493 ABI.
25494
25495 @item -msingle-float
25496 @opindex msingle-float
25497 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
25498 registers for parameter passing. This option may change the target
25499 ABI.
25500
25501 @item -mdouble-float
25502 @opindex mdouble-float
25503 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
25504 registers for parameter passing. This option may change the target
25505 ABI.
25506
25507 @item -mbranch-cost=@var{n}
25508 @opindex mbranch-cost
25509 Set the cost of branches to roughly @var{n} instructions.
25510
25511 @item -mcheck-zero-division
25512 @itemx -mno-check-zero-divison
25513 @opindex mcheck-zero-division
25514 Trap (do not trap) on integer division by zero. The default is
25515 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
25516 @option{-mno-check-zero-division} for other optimization levels.
25517
25518 @item -mcond-move-int
25519 @itemx -mno-cond-move-int
25520 @opindex mcond-move-int
25521 Conditional moves for integral data in general-purpose registers
25522 are enabled (disabled). The default is @option{-mcond-move-int}.
25523
25524 @item -mcond-move-float
25525 @itemx -mno-cond-move-float
25526 @opindex mcond-move-float
25527 Conditional moves for floating-point registers are enabled (disabled).
25528 The default is @option{-mcond-move-float}.
25529
25530 @item -mmemcpy
25531 @itemx -mno-memcpy
25532 @opindex mmemcpy
25533 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
25534 The default is @option{-mno-memcpy}, which allows GCC to inline most
25535 constant-sized copies. Setting optimization level to @option{-Os} also
25536 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
25537 behavior if explicitly specified, regardless of the order these options on
25538 the command line.
25539
25540 @item -mstrict-align
25541 @itemx -mno-strict-align
25542 @opindex mstrict-align
25543 Avoid or allow generating memory accesses that may not be aligned on a natural
25544 object boundary as described in the architecture specification. The default is
25545 @option{-mno-strict-align}.
25546
25547 @item -msmall-data-limit=@var{number}
25548 @opindex msmall-data-limit
25549 Put global and static data smaller than @var{number} bytes into a special
25550 section (on some targets). The default value is 0.
25551
25552 @item -mmax-inline-memcpy-size=@var{n}
25553 @opindex mmax-inline-memcpy-size
25554 Inline all block moves (such as calls to @code{memcpy} or structure copies)
25555 less than or equal to @var{n} bytes. The default value of @var{n} is 1024.
25556
25557 @item -mcmodel=@var{code-model}
25558 Set the code model to one of:
25559 @table @samp
25560 @item tiny-static (Not implemented yet)
25561 @item tiny (Not implemented yet)
25562
25563 @item normal
25564 The text segment must be within 128MB addressing space. The data segment must
25565 be within 2GB addressing space.
25566
25567 @item medium
25568 The text segment and data segment must be within 2GB addressing space.
25569
25570 @item large (Not implemented yet)
25571
25572 @item extreme
25573 This mode does not limit the size of the code segment and data segment.
25574 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt} and
25575 @option{-mno-explicit-relocs}.
25576 @end table
25577 The default code model is @code{normal}.
25578
25579 @item -mexplicit-relocs
25580 @itemx -mno-explicit-relocs
25581 @opindex mexplicit-relocs
25582 @opindex mno-explicit-relocs
25583 Use or do not use assembler relocation operators when dealing with symbolic
25584 addresses. The alternative is to use assembler macros instead, which may
25585 limit optimization. The default value for the option is determined during
25586 GCC build-time by detecting corresponding assembler support:
25587 @code{-mexplicit-relocs} if said support is present,
25588 @code{-mno-explicit-relocs} otherwise. This option is mostly useful for
25589 debugging, or interoperation with assemblers different from the build-time
25590 one.
25591
25592 @item -mdirect-extern-access
25593 @itemx -mno-direct-extern-access
25594 @opindex mdirect-extern-access
25595 Do not use or use GOT to access external symbols. The default is
25596 @option{-mno-direct-extern-access}: GOT is used for external symbols with
25597 default visibility, but not used for other external symbols.
25598
25599 With @option{-mdirect-extern-access}, GOT is not used and all external
25600 symbols are PC-relatively addressed. It is @strong{only} suitable for
25601 environments where no dynamic link is performed, like firmwares, OS
25602 kernels, executables linked with @option{-static} or @option{-static-pie}.
25603 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
25604 @option{-fpic}.
25605 @end table
25606
25607 @node M32C Options
25608 @subsection M32C Options
25609 @cindex M32C options
25610
25611 @table @gcctabopt
25612 @item -mcpu=@var{name}
25613 @opindex mcpu=
25614 Select the CPU for which code is generated. @var{name} may be one of
25615 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
25616 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
25617 the M32C/80 series.
25618
25619 @item -msim
25620 @opindex msim
25621 Specifies that the program will be run on the simulator. This causes
25622 an alternate runtime library to be linked in which supports, for
25623 example, file I/O@. You must not use this option when generating
25624 programs that will run on real hardware; you must provide your own
25625 runtime library for whatever I/O functions are needed.
25626
25627 @item -memregs=@var{number}
25628 @opindex memregs=
25629 Specifies the number of memory-based pseudo-registers GCC uses
25630 during code generation. These pseudo-registers are used like real
25631 registers, so there is a tradeoff between GCC's ability to fit the
25632 code into available registers, and the performance penalty of using
25633 memory instead of registers. Note that all modules in a program must
25634 be compiled with the same value for this option. Because of that, you
25635 must not use this option with GCC's default runtime libraries.
25636
25637 @end table
25638
25639 @node M32R/D Options
25640 @subsection M32R/D Options
25641 @cindex M32R/D options
25642
25643 These @option{-m} options are defined for Renesas M32R/D architectures:
25644
25645 @table @gcctabopt
25646 @item -m32r2
25647 @opindex m32r2
25648 Generate code for the M32R/2@.
25649
25650 @item -m32rx
25651 @opindex m32rx
25652 Generate code for the M32R/X@.
25653
25654 @item -m32r
25655 @opindex m32r
25656 Generate code for the M32R@. This is the default.
25657
25658 @item -mmodel=small
25659 @opindex mmodel=small
25660 Assume all objects live in the lower 16MB of memory (so that their addresses
25661 can be loaded with the @code{ld24} instruction), and assume all subroutines
25662 are reachable with the @code{bl} instruction.
25663 This is the default.
25664
25665 The addressability of a particular object can be set with the
25666 @code{model} attribute.
25667
25668 @item -mmodel=medium
25669 @opindex mmodel=medium
25670 Assume objects may be anywhere in the 32-bit address space (the compiler
25671 generates @code{seth/add3} instructions to load their addresses), and
25672 assume all subroutines are reachable with the @code{bl} instruction.
25673
25674 @item -mmodel=large
25675 @opindex mmodel=large
25676 Assume objects may be anywhere in the 32-bit address space (the compiler
25677 generates @code{seth/add3} instructions to load their addresses), and
25678 assume subroutines may not be reachable with the @code{bl} instruction
25679 (the compiler generates the much slower @code{seth/add3/jl}
25680 instruction sequence).
25681
25682 @item -msdata=none
25683 @opindex msdata=none
25684 Disable use of the small data area. Variables are put into
25685 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
25686 @code{section} attribute has been specified).
25687 This is the default.
25688
25689 The small data area consists of sections @code{.sdata} and @code{.sbss}.
25690 Objects may be explicitly put in the small data area with the
25691 @code{section} attribute using one of these sections.
25692
25693 @item -msdata=sdata
25694 @opindex msdata=sdata
25695 Put small global and static data in the small data area, but do not
25696 generate special code to reference them.
25697
25698 @item -msdata=use
25699 @opindex msdata=use
25700 Put small global and static data in the small data area, and generate
25701 special instructions to reference them.
25702
25703 @item -G @var{num}
25704 @opindex G
25705 @cindex smaller data references
25706 Put global and static objects less than or equal to @var{num} bytes
25707 into the small data or BSS sections instead of the normal data or BSS
25708 sections. The default value of @var{num} is 8.
25709 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
25710 for this option to have any effect.
25711
25712 All modules should be compiled with the same @option{-G @var{num}} value.
25713 Compiling with different values of @var{num} may or may not work; if it
25714 doesn't the linker gives an error message---incorrect code is not
25715 generated.
25716
25717 @item -mdebug
25718 @opindex mdebug
25719 Makes the M32R-specific code in the compiler display some statistics
25720 that might help in debugging programs.
25721
25722 @item -malign-loops
25723 @opindex malign-loops
25724 Align all loops to a 32-byte boundary.
25725
25726 @item -mno-align-loops
25727 @opindex mno-align-loops
25728 Do not enforce a 32-byte alignment for loops. This is the default.
25729
25730 @item -missue-rate=@var{number}
25731 @opindex missue-rate=@var{number}
25732 Issue @var{number} instructions per cycle. @var{number} can only be 1
25733 or 2.
25734
25735 @item -mbranch-cost=@var{number}
25736 @opindex mbranch-cost=@var{number}
25737 @var{number} can only be 1 or 2. If it is 1 then branches are
25738 preferred over conditional code, if it is 2, then the opposite applies.
25739
25740 @item -mflush-trap=@var{number}
25741 @opindex mflush-trap=@var{number}
25742 Specifies the trap number to use to flush the cache. The default is
25743 12. Valid numbers are between 0 and 15 inclusive.
25744
25745 @item -mno-flush-trap
25746 @opindex mno-flush-trap
25747 Specifies that the cache cannot be flushed by using a trap.
25748
25749 @item -mflush-func=@var{name}
25750 @opindex mflush-func=@var{name}
25751 Specifies the name of the operating system function to call to flush
25752 the cache. The default is @samp{_flush_cache}, but a function call
25753 is only used if a trap is not available.
25754
25755 @item -mno-flush-func
25756 @opindex mno-flush-func
25757 Indicates that there is no OS function for flushing the cache.
25758
25759 @end table
25760
25761 @node M680x0 Options
25762 @subsection M680x0 Options
25763 @cindex M680x0 options
25764
25765 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
25766 The default settings depend on which architecture was selected when
25767 the compiler was configured; the defaults for the most common choices
25768 are given below.
25769
25770 @table @gcctabopt
25771 @item -march=@var{arch}
25772 @opindex march
25773 Generate code for a specific M680x0 or ColdFire instruction set
25774 architecture. Permissible values of @var{arch} for M680x0
25775 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
25776 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
25777 architectures are selected according to Freescale's ISA classification
25778 and the permissible values are: @samp{isaa}, @samp{isaaplus},
25779 @samp{isab} and @samp{isac}.
25780
25781 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
25782 code for a ColdFire target. The @var{arch} in this macro is one of the
25783 @option{-march} arguments given above.
25784
25785 When used together, @option{-march} and @option{-mtune} select code
25786 that runs on a family of similar processors but that is optimized
25787 for a particular microarchitecture.
25788
25789 @item -mcpu=@var{cpu}
25790 @opindex mcpu
25791 Generate code for a specific M680x0 or ColdFire processor.
25792 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
25793 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
25794 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
25795 below, which also classifies the CPUs into families:
25796
25797 @multitable @columnfractions 0.20 0.80
25798 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
25799 @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}
25800 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
25801 @item @samp{5206e} @tab @samp{5206e}
25802 @item @samp{5208} @tab @samp{5207} @samp{5208}
25803 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
25804 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
25805 @item @samp{5216} @tab @samp{5214} @samp{5216}
25806 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
25807 @item @samp{5225} @tab @samp{5224} @samp{5225}
25808 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
25809 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
25810 @item @samp{5249} @tab @samp{5249}
25811 @item @samp{5250} @tab @samp{5250}
25812 @item @samp{5271} @tab @samp{5270} @samp{5271}
25813 @item @samp{5272} @tab @samp{5272}
25814 @item @samp{5275} @tab @samp{5274} @samp{5275}
25815 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
25816 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
25817 @item @samp{5307} @tab @samp{5307}
25818 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
25819 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
25820 @item @samp{5407} @tab @samp{5407}
25821 @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}
25822 @end multitable
25823
25824 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
25825 @var{arch} is compatible with @var{cpu}. Other combinations of
25826 @option{-mcpu} and @option{-march} are rejected.
25827
25828 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
25829 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
25830 where the value of @var{family} is given by the table above.
25831
25832 @item -mtune=@var{tune}
25833 @opindex mtune
25834 Tune the code for a particular microarchitecture within the
25835 constraints set by @option{-march} and @option{-mcpu}.
25836 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
25837 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
25838 and @samp{cpu32}. The ColdFire microarchitectures
25839 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
25840
25841 You can also use @option{-mtune=68020-40} for code that needs
25842 to run relatively well on 68020, 68030 and 68040 targets.
25843 @option{-mtune=68020-60} is similar but includes 68060 targets
25844 as well. These two options select the same tuning decisions as
25845 @option{-m68020-40} and @option{-m68020-60} respectively.
25846
25847 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
25848 when tuning for 680x0 architecture @var{arch}. It also defines
25849 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
25850 option is used. If GCC is tuning for a range of architectures,
25851 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
25852 it defines the macros for every architecture in the range.
25853
25854 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
25855 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
25856 of the arguments given above.
25857
25858 @item -m68000
25859 @itemx -mc68000
25860 @opindex m68000
25861 @opindex mc68000
25862 Generate output for a 68000. This is the default
25863 when the compiler is configured for 68000-based systems.
25864 It is equivalent to @option{-march=68000}.
25865
25866 Use this option for microcontrollers with a 68000 or EC000 core,
25867 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
25868
25869 @item -m68010
25870 @opindex m68010
25871 Generate output for a 68010. This is the default
25872 when the compiler is configured for 68010-based systems.
25873 It is equivalent to @option{-march=68010}.
25874
25875 @item -m68020
25876 @itemx -mc68020
25877 @opindex m68020
25878 @opindex mc68020
25879 Generate output for a 68020. This is the default
25880 when the compiler is configured for 68020-based systems.
25881 It is equivalent to @option{-march=68020}.
25882
25883 @item -m68030
25884 @opindex m68030
25885 Generate output for a 68030. This is the default when the compiler is
25886 configured for 68030-based systems. It is equivalent to
25887 @option{-march=68030}.
25888
25889 @item -m68040
25890 @opindex m68040
25891 Generate output for a 68040. This is the default when the compiler is
25892 configured for 68040-based systems. It is equivalent to
25893 @option{-march=68040}.
25894
25895 This option inhibits the use of 68881/68882 instructions that have to be
25896 emulated by software on the 68040. Use this option if your 68040 does not
25897 have code to emulate those instructions.
25898
25899 @item -m68060
25900 @opindex m68060
25901 Generate output for a 68060. This is the default when the compiler is
25902 configured for 68060-based systems. It is equivalent to
25903 @option{-march=68060}.
25904
25905 This option inhibits the use of 68020 and 68881/68882 instructions that
25906 have to be emulated by software on the 68060. Use this option if your 68060
25907 does not have code to emulate those instructions.
25908
25909 @item -mcpu32
25910 @opindex mcpu32
25911 Generate output for a CPU32. This is the default
25912 when the compiler is configured for CPU32-based systems.
25913 It is equivalent to @option{-march=cpu32}.
25914
25915 Use this option for microcontrollers with a
25916 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
25917 68336, 68340, 68341, 68349 and 68360.
25918
25919 @item -m5200
25920 @opindex m5200
25921 Generate output for a 520X ColdFire CPU@. This is the default
25922 when the compiler is configured for 520X-based systems.
25923 It is equivalent to @option{-mcpu=5206}, and is now deprecated
25924 in favor of that option.
25925
25926 Use this option for microcontroller with a 5200 core, including
25927 the MCF5202, MCF5203, MCF5204 and MCF5206.
25928
25929 @item -m5206e
25930 @opindex m5206e
25931 Generate output for a 5206e ColdFire CPU@. The option is now
25932 deprecated in favor of the equivalent @option{-mcpu=5206e}.
25933
25934 @item -m528x
25935 @opindex m528x
25936 Generate output for a member of the ColdFire 528X family.
25937 The option is now deprecated in favor of the equivalent
25938 @option{-mcpu=528x}.
25939
25940 @item -m5307
25941 @opindex m5307
25942 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
25943 in favor of the equivalent @option{-mcpu=5307}.
25944
25945 @item -m5407
25946 @opindex m5407
25947 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
25948 in favor of the equivalent @option{-mcpu=5407}.
25949
25950 @item -mcfv4e
25951 @opindex mcfv4e
25952 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
25953 This includes use of hardware floating-point instructions.
25954 The option is equivalent to @option{-mcpu=547x}, and is now
25955 deprecated in favor of that option.
25956
25957 @item -m68020-40
25958 @opindex m68020-40
25959 Generate output for a 68040, without using any of the new instructions.
25960 This results in code that can run relatively efficiently on either a
25961 68020/68881 or a 68030 or a 68040. The generated code does use the
25962 68881 instructions that are emulated on the 68040.
25963
25964 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
25965
25966 @item -m68020-60
25967 @opindex m68020-60
25968 Generate output for a 68060, without using any of the new instructions.
25969 This results in code that can run relatively efficiently on either a
25970 68020/68881 or a 68030 or a 68040. The generated code does use the
25971 68881 instructions that are emulated on the 68060.
25972
25973 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
25974
25975 @item -mhard-float
25976 @itemx -m68881
25977 @opindex mhard-float
25978 @opindex m68881
25979 Generate floating-point instructions. This is the default for 68020
25980 and above, and for ColdFire devices that have an FPU@. It defines the
25981 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
25982 on ColdFire targets.
25983
25984 @item -msoft-float
25985 @opindex msoft-float
25986 Do not generate floating-point instructions; use library calls instead.
25987 This is the default for 68000, 68010, and 68832 targets. It is also
25988 the default for ColdFire devices that have no FPU.
25989
25990 @item -mdiv
25991 @itemx -mno-div
25992 @opindex mdiv
25993 @opindex mno-div
25994 Generate (do not generate) ColdFire hardware divide and remainder
25995 instructions. If @option{-march} is used without @option{-mcpu},
25996 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
25997 architectures. Otherwise, the default is taken from the target CPU
25998 (either the default CPU, or the one specified by @option{-mcpu}). For
25999 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
26000 @option{-mcpu=5206e}.
26001
26002 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
26003
26004 @item -mshort
26005 @opindex mshort
26006 Consider type @code{int} to be 16 bits wide, like @code{short int}.
26007 Additionally, parameters passed on the stack are also aligned to a
26008 16-bit boundary even on targets whose API mandates promotion to 32-bit.
26009
26010 @item -mno-short
26011 @opindex mno-short
26012 Do not consider type @code{int} to be 16 bits wide. This is the default.
26013
26014 @item -mnobitfield
26015 @itemx -mno-bitfield
26016 @opindex mnobitfield
26017 @opindex mno-bitfield
26018 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
26019 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
26020
26021 @item -mbitfield
26022 @opindex mbitfield
26023 Do use the bit-field instructions. The @option{-m68020} option implies
26024 @option{-mbitfield}. This is the default if you use a configuration
26025 designed for a 68020.
26026
26027 @item -mrtd
26028 @opindex mrtd
26029 Use a different function-calling convention, in which functions
26030 that take a fixed number of arguments return with the @code{rtd}
26031 instruction, which pops their arguments while returning. This
26032 saves one instruction in the caller since there is no need to pop
26033 the arguments there.
26034
26035 This calling convention is incompatible with the one normally
26036 used on Unix, so you cannot use it if you need to call libraries
26037 compiled with the Unix compiler.
26038
26039 Also, you must provide function prototypes for all functions that
26040 take variable numbers of arguments (including @code{printf});
26041 otherwise incorrect code is generated for calls to those
26042 functions.
26043
26044 In addition, seriously incorrect code results if you call a
26045 function with too many arguments. (Normally, extra arguments are
26046 harmlessly ignored.)
26047
26048 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26049 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26050
26051 The default is @option{-mno-rtd}.
26052
26053 @item -malign-int
26054 @itemx -mno-align-int
26055 @opindex malign-int
26056 @opindex mno-align-int
26057 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26058 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26059 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26060 Aligning variables on 32-bit boundaries produces code that runs somewhat
26061 faster on processors with 32-bit busses at the expense of more memory.
26062
26063 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26064 aligns structures containing the above types differently than
26065 most published application binary interface specifications for the m68k.
26066
26067 @opindex mpcrel
26068 Use the pc-relative addressing mode of the 68000 directly, instead of
26069 using a global offset table. At present, this option implies @option{-fpic},
26070 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
26071 not presently supported with @option{-mpcrel}, though this could be supported for
26072 68020 and higher processors.
26073
26074 @item -mno-strict-align
26075 @itemx -mstrict-align
26076 @opindex mno-strict-align
26077 @opindex mstrict-align
26078 Do not (do) assume that unaligned memory references are handled by
26079 the system.
26080
26081 @item -msep-data
26082 Generate code that allows the data segment to be located in a different
26083 area of memory from the text segment. This allows for execute-in-place in
26084 an environment without virtual memory management. This option implies
26085 @option{-fPIC}.
26086
26087 @item -mno-sep-data
26088 Generate code that assumes that the data segment follows the text segment.
26089 This is the default.
26090
26091 @item -mid-shared-library
26092 Generate code that supports shared libraries via the library ID method.
26093 This allows for execute-in-place and shared libraries in an environment
26094 without virtual memory management. This option implies @option{-fPIC}.
26095
26096 @item -mno-id-shared-library
26097 Generate code that doesn't assume ID-based shared libraries are being used.
26098 This is the default.
26099
26100 @item -mshared-library-id=n
26101 Specifies the identification number of the ID-based shared library being
26102 compiled. Specifying a value of 0 generates more compact code; specifying
26103 other values forces the allocation of that number to the current
26104 library, but is no more space- or time-efficient than omitting this option.
26105
26106 @item -mxgot
26107 @itemx -mno-xgot
26108 @opindex mxgot
26109 @opindex mno-xgot
26110 When generating position-independent code for ColdFire, generate code
26111 that works if the GOT has more than 8192 entries. This code is
26112 larger and slower than code generated without this option. On M680x0
26113 processors, this option is not needed; @option{-fPIC} suffices.
26114
26115 GCC normally uses a single instruction to load values from the GOT@.
26116 While this is relatively efficient, it only works if the GOT
26117 is smaller than about 64k. Anything larger causes the linker
26118 to report an error such as:
26119
26120 @cindex relocation truncated to fit (ColdFire)
26121 @smallexample
26122 relocation truncated to fit: R_68K_GOT16O foobar
26123 @end smallexample
26124
26125 If this happens, you should recompile your code with @option{-mxgot}.
26126 It should then work with very large GOTs. However, code generated with
26127 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26128 the value of a global symbol.
26129
26130 Note that some linkers, including newer versions of the GNU linker,
26131 can create multiple GOTs and sort GOT entries. If you have such a linker,
26132 you should only need to use @option{-mxgot} when compiling a single
26133 object file that accesses more than 8192 GOT entries. Very few do.
26134
26135 These options have no effect unless GCC is generating
26136 position-independent code.
26137
26138 @item -mlong-jump-table-offsets
26139 @opindex mlong-jump-table-offsets
26140 Use 32-bit offsets in @code{switch} tables. The default is to use
26141 16-bit offsets.
26142
26143 @end table
26144
26145 @node MCore Options
26146 @subsection MCore Options
26147 @cindex MCore options
26148
26149 These are the @samp{-m} options defined for the Motorola M*Core
26150 processors.
26151
26152 @table @gcctabopt
26153
26154 @item -mhardlit
26155 @itemx -mno-hardlit
26156 @opindex mhardlit
26157 @opindex mno-hardlit
26158 Inline constants into the code stream if it can be done in two
26159 instructions or less.
26160
26161 @item -mdiv
26162 @itemx -mno-div
26163 @opindex mdiv
26164 @opindex mno-div
26165 Use the divide instruction. (Enabled by default).
26166
26167 @item -mrelax-immediate
26168 @itemx -mno-relax-immediate
26169 @opindex mrelax-immediate
26170 @opindex mno-relax-immediate
26171 Allow arbitrary-sized immediates in bit operations.
26172
26173 @item -mwide-bitfields
26174 @itemx -mno-wide-bitfields
26175 @opindex mwide-bitfields
26176 @opindex mno-wide-bitfields
26177 Always treat bit-fields as @code{int}-sized.
26178
26179 @item -m4byte-functions
26180 @itemx -mno-4byte-functions
26181 @opindex m4byte-functions
26182 @opindex mno-4byte-functions
26183 Force all functions to be aligned to a 4-byte boundary.
26184
26185 @item -mcallgraph-data
26186 @itemx -mno-callgraph-data
26187 @opindex mcallgraph-data
26188 @opindex mno-callgraph-data
26189 Emit callgraph information.
26190
26191 @item -mslow-bytes
26192 @itemx -mno-slow-bytes
26193 @opindex mslow-bytes
26194 @opindex mno-slow-bytes
26195 Prefer word access when reading byte quantities.
26196
26197 @item -mlittle-endian
26198 @itemx -mbig-endian
26199 @opindex mlittle-endian
26200 @opindex mbig-endian
26201 Generate code for a little-endian target.
26202
26203 @item -m210
26204 @itemx -m340
26205 @opindex m210
26206 @opindex m340
26207 Generate code for the 210 processor.
26208
26209 @item -mno-lsim
26210 @opindex mno-lsim
26211 Assume that runtime support has been provided and so omit the
26212 simulator library (@file{libsim.a)} from the linker command line.
26213
26214 @item -mstack-increment=@var{size}
26215 @opindex mstack-increment
26216 Set the maximum amount for a single stack increment operation. Large
26217 values can increase the speed of programs that contain functions
26218 that need a large amount of stack space, but they can also trigger a
26219 segmentation fault if the stack is extended too much. The default
26220 value is 0x1000.
26221
26222 @end table
26223
26224 @node MicroBlaze Options
26225 @subsection MicroBlaze Options
26226 @cindex MicroBlaze Options
26227
26228 @table @gcctabopt
26229
26230 @item -msoft-float
26231 @opindex msoft-float
26232 Use software emulation for floating point (default).
26233
26234 @item -mhard-float
26235 @opindex mhard-float
26236 Use hardware floating-point instructions.
26237
26238 @item -mmemcpy
26239 @opindex mmemcpy
26240 Do not optimize block moves, use @code{memcpy}.
26241
26242 @item -mno-clearbss
26243 @opindex mno-clearbss
26244 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
26245
26246 @item -mcpu=@var{cpu-type}
26247 @opindex mcpu=
26248 Use features of, and schedule code for, the given CPU.
26249 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
26250 where @var{X} is a major version, @var{YY} is the minor version, and
26251 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
26252 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
26253
26254 @item -mxl-soft-mul
26255 @opindex mxl-soft-mul
26256 Use software multiply emulation (default).
26257
26258 @item -mxl-soft-div
26259 @opindex mxl-soft-div
26260 Use software emulation for divides (default).
26261
26262 @item -mxl-barrel-shift
26263 @opindex mxl-barrel-shift
26264 Use the hardware barrel shifter.
26265
26266 @item -mxl-pattern-compare
26267 @opindex mxl-pattern-compare
26268 Use pattern compare instructions.
26269
26270 @item -msmall-divides
26271 @opindex msmall-divides
26272 Use table lookup optimization for small signed integer divisions.
26273
26274 @item -mxl-stack-check
26275 @opindex mxl-stack-check
26276 This option is deprecated. Use @option{-fstack-check} instead.
26277
26278 @item -mxl-gp-opt
26279 @opindex mxl-gp-opt
26280 Use GP-relative @code{.sdata}/@code{.sbss} sections.
26281
26282 @item -mxl-multiply-high
26283 @opindex mxl-multiply-high
26284 Use multiply high instructions for high part of 32x32 multiply.
26285
26286 @item -mxl-float-convert
26287 @opindex mxl-float-convert
26288 Use hardware floating-point conversion instructions.
26289
26290 @item -mxl-float-sqrt
26291 @opindex mxl-float-sqrt
26292 Use hardware floating-point square root instruction.
26293
26294 @item -mbig-endian
26295 @opindex mbig-endian
26296 Generate code for a big-endian target.
26297
26298 @item -mlittle-endian
26299 @opindex mlittle-endian
26300 Generate code for a little-endian target.
26301
26302 @item -mxl-reorder
26303 @opindex mxl-reorder
26304 Use reorder instructions (swap and byte reversed load/store).
26305
26306 @item -mxl-mode-@var{app-model}
26307 Select application model @var{app-model}. Valid models are
26308 @table @samp
26309 @item executable
26310 normal executable (default), uses startup code @file{crt0.o}.
26311
26312 @item xmdstub
26313 for use with Xilinx Microprocessor Debugger (XMD) based
26314 software intrusive debug agent called xmdstub. This uses startup file
26315 @file{crt1.o} and sets the start address of the program to 0x800.
26316
26317 @item bootstrap
26318 for applications that are loaded using a bootloader.
26319 This model uses startup file @file{crt2.o} which does not contain a processor
26320 reset vector handler. This is suitable for transferring control on a
26321 processor reset to the bootloader rather than the application.
26322
26323 @item novectors
26324 for applications that do not require any of the
26325 MicroBlaze vectors. This option may be useful for applications running
26326 within a monitoring application. This model uses @file{crt3.o} as a startup file.
26327 @end table
26328
26329 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
26330 @option{-mxl-mode-@var{app-model}}.
26331
26332 @item -mpic-data-is-text-relative
26333 @opindex mpic-data-is-text-relative
26334 Assume that the displacement between the text and data segments is fixed
26335 at static link time. This allows data to be referenced by offset from start of
26336 text address instead of GOT since PC-relative addressing is not supported.
26337
26338 @end table
26339
26340 @node MIPS Options
26341 @subsection MIPS Options
26342 @cindex MIPS options
26343
26344 @table @gcctabopt
26345
26346 @item -EB
26347 @opindex EB
26348 Generate big-endian code.
26349
26350 @item -EL
26351 @opindex EL
26352 Generate little-endian code. This is the default for @samp{mips*el-*-*}
26353 configurations.
26354
26355 @item -march=@var{arch}
26356 @opindex march
26357 Generate code that runs on @var{arch}, which can be the name of a
26358 generic MIPS ISA, or the name of a particular processor.
26359 The ISA names are:
26360 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
26361 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
26362 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
26363 @samp{mips64r5} and @samp{mips64r6}.
26364 The processor names are:
26365 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
26366 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
26367 @samp{5kc}, @samp{5kf},
26368 @samp{20kc},
26369 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
26370 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
26371 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
26372 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
26373 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
26374 @samp{i6400}, @samp{i6500},
26375 @samp{interaptiv},
26376 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
26377 @samp{gs464e}, @samp{gs264e},
26378 @samp{m4k},
26379 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
26380 @samp{m5100}, @samp{m5101},
26381 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
26382 @samp{orion},
26383 @samp{p5600}, @samp{p6600},
26384 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
26385 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
26386 @samp{r6000}, @samp{r8000},
26387 @samp{rm7000}, @samp{rm9000},
26388 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
26389 @samp{sb1},
26390 @samp{sr71000},
26391 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
26392 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
26393 @samp{xlr} and @samp{xlp}.
26394 The special value @samp{from-abi} selects the
26395 most compatible architecture for the selected ABI (that is,
26396 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
26397
26398 The native Linux/GNU toolchain also supports the value @samp{native},
26399 which selects the best architecture option for the host processor.
26400 @option{-march=native} has no effect if GCC does not recognize
26401 the processor.
26402
26403 In processor names, a final @samp{000} can be abbreviated as @samp{k}
26404 (for example, @option{-march=r2k}). Prefixes are optional, and
26405 @samp{vr} may be written @samp{r}.
26406
26407 Names of the form @samp{@var{n}f2_1} refer to processors with
26408 FPUs clocked at half the rate of the core, names of the form
26409 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
26410 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
26411 processors with FPUs clocked a ratio of 3:2 with respect to the core.
26412 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
26413 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
26414 accepted as synonyms for @samp{@var{n}f1_1}.
26415
26416 GCC defines two macros based on the value of this option. The first
26417 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
26418 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
26419 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
26420 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
26421 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
26422
26423 Note that the @code{_MIPS_ARCH} macro uses the processor names given
26424 above. In other words, it has the full prefix and does not
26425 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
26426 the macro names the resolved architecture (either @code{"mips1"} or
26427 @code{"mips3"}). It names the default architecture when no
26428 @option{-march} option is given.
26429
26430 @item -mtune=@var{arch}
26431 @opindex mtune
26432 Optimize for @var{arch}. Among other things, this option controls
26433 the way instructions are scheduled, and the perceived cost of arithmetic
26434 operations. The list of @var{arch} values is the same as for
26435 @option{-march}.
26436
26437 When this option is not used, GCC optimizes for the processor
26438 specified by @option{-march}. By using @option{-march} and
26439 @option{-mtune} together, it is possible to generate code that
26440 runs on a family of processors, but optimize the code for one
26441 particular member of that family.
26442
26443 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
26444 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
26445 @option{-march} ones described above.
26446
26447 @item -mips1
26448 @opindex mips1
26449 Equivalent to @option{-march=mips1}.
26450
26451 @item -mips2
26452 @opindex mips2
26453 Equivalent to @option{-march=mips2}.
26454
26455 @item -mips3
26456 @opindex mips3
26457 Equivalent to @option{-march=mips3}.
26458
26459 @item -mips4
26460 @opindex mips4
26461 Equivalent to @option{-march=mips4}.
26462
26463 @item -mips32
26464 @opindex mips32
26465 Equivalent to @option{-march=mips32}.
26466
26467 @item -mips32r3
26468 @opindex mips32r3
26469 Equivalent to @option{-march=mips32r3}.
26470
26471 @item -mips32r5
26472 @opindex mips32r5
26473 Equivalent to @option{-march=mips32r5}.
26474
26475 @item -mips32r6
26476 @opindex mips32r6
26477 Equivalent to @option{-march=mips32r6}.
26478
26479 @item -mips64
26480 @opindex mips64
26481 Equivalent to @option{-march=mips64}.
26482
26483 @item -mips64r2
26484 @opindex mips64r2
26485 Equivalent to @option{-march=mips64r2}.
26486
26487 @item -mips64r3
26488 @opindex mips64r3
26489 Equivalent to @option{-march=mips64r3}.
26490
26491 @item -mips64r5
26492 @opindex mips64r5
26493 Equivalent to @option{-march=mips64r5}.
26494
26495 @item -mips64r6
26496 @opindex mips64r6
26497 Equivalent to @option{-march=mips64r6}.
26498
26499 @item -mips16
26500 @itemx -mno-mips16
26501 @opindex mips16
26502 @opindex mno-mips16
26503 Generate (do not generate) MIPS16 code. If GCC is targeting a
26504 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
26505
26506 MIPS16 code generation can also be controlled on a per-function basis
26507 by means of @code{mips16} and @code{nomips16} attributes.
26508 @xref{Function Attributes}, for more information.
26509
26510 @item -mflip-mips16
26511 @opindex mflip-mips16
26512 Generate MIPS16 code on alternating functions. This option is provided
26513 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
26514 not intended for ordinary use in compiling user code.
26515
26516 @item -minterlink-compressed
26517 @itemx -mno-interlink-compressed
26518 @opindex minterlink-compressed
26519 @opindex mno-interlink-compressed
26520 Require (do not require) that code using the standard (uncompressed) MIPS ISA
26521 be link-compatible with MIPS16 and microMIPS code, and vice versa.
26522
26523 For example, code using the standard ISA encoding cannot jump directly
26524 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
26525 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
26526 knows that the target of the jump is not compressed.
26527
26528 @item -minterlink-mips16
26529 @itemx -mno-interlink-mips16
26530 @opindex minterlink-mips16
26531 @opindex mno-interlink-mips16
26532 Aliases of @option{-minterlink-compressed} and
26533 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
26534 and are retained for backwards compatibility.
26535
26536 @item -mabi=32
26537 @itemx -mabi=o64
26538 @itemx -mabi=n32
26539 @itemx -mabi=64
26540 @itemx -mabi=eabi
26541 @opindex mabi=32
26542 @opindex mabi=o64
26543 @opindex mabi=n32
26544 @opindex mabi=64
26545 @opindex mabi=eabi
26546 Generate code for the given ABI@.
26547
26548 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
26549 generates 64-bit code when you select a 64-bit architecture, but you
26550 can use @option{-mgp32} to get 32-bit code instead.
26551
26552 For information about the O64 ABI, see
26553 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
26554
26555 GCC supports a variant of the o32 ABI in which floating-point registers
26556 are 64 rather than 32 bits wide. You can select this combination with
26557 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
26558 and @code{mfhc1} instructions and is therefore only supported for
26559 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
26560
26561 The register assignments for arguments and return values remain the
26562 same, but each scalar value is passed in a single 64-bit register
26563 rather than a pair of 32-bit registers. For example, scalar
26564 floating-point values are returned in @samp{$f0} only, not a
26565 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
26566 remains the same in that the even-numbered double-precision registers
26567 are saved.
26568
26569 Two additional variants of the o32 ABI are supported to enable
26570 a transition from 32-bit to 64-bit registers. These are FPXX
26571 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
26572 The FPXX extension mandates that all code must execute correctly
26573 when run using 32-bit or 64-bit registers. The code can be interlinked
26574 with either FP32 or FP64, but not both.
26575 The FP64A extension is similar to the FP64 extension but forbids the
26576 use of odd-numbered single-precision registers. This can be used
26577 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
26578 processors and allows both FP32 and FP64A code to interlink and
26579 run in the same process without changing FPU modes.
26580
26581 @item -mabicalls
26582 @itemx -mno-abicalls
26583 @opindex mabicalls
26584 @opindex mno-abicalls
26585 Generate (do not generate) code that is suitable for SVR4-style
26586 dynamic objects. @option{-mabicalls} is the default for SVR4-based
26587 systems.
26588
26589 @item -mshared
26590 @itemx -mno-shared
26591 Generate (do not generate) code that is fully position-independent,
26592 and that can therefore be linked into shared libraries. This option
26593 only affects @option{-mabicalls}.
26594
26595 All @option{-mabicalls} code has traditionally been position-independent,
26596 regardless of options like @option{-fPIC} and @option{-fpic}. However,
26597 as an extension, the GNU toolchain allows executables to use absolute
26598 accesses for locally-binding symbols. It can also use shorter GP
26599 initialization sequences and generate direct calls to locally-defined
26600 functions. This mode is selected by @option{-mno-shared}.
26601
26602 @option{-mno-shared} depends on binutils 2.16 or higher and generates
26603 objects that can only be linked by the GNU linker. However, the option
26604 does not affect the ABI of the final executable; it only affects the ABI
26605 of relocatable objects. Using @option{-mno-shared} generally makes
26606 executables both smaller and quicker.
26607
26608 @option{-mshared} is the default.
26609
26610 @item -mplt
26611 @itemx -mno-plt
26612 @opindex mplt
26613 @opindex mno-plt
26614 Assume (do not assume) that the static and dynamic linkers
26615 support PLTs and copy relocations. This option only affects
26616 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
26617 has no effect without @option{-msym32}.
26618
26619 You can make @option{-mplt} the default by configuring
26620 GCC with @option{--with-mips-plt}. The default is
26621 @option{-mno-plt} otherwise.
26622
26623 @item -mxgot
26624 @itemx -mno-xgot
26625 @opindex mxgot
26626 @opindex mno-xgot
26627 Lift (do not lift) the usual restrictions on the size of the global
26628 offset table.
26629
26630 GCC normally uses a single instruction to load values from the GOT@.
26631 While this is relatively efficient, it only works if the GOT
26632 is smaller than about 64k. Anything larger causes the linker
26633 to report an error such as:
26634
26635 @cindex relocation truncated to fit (MIPS)
26636 @smallexample
26637 relocation truncated to fit: R_MIPS_GOT16 foobar
26638 @end smallexample
26639
26640 If this happens, you should recompile your code with @option{-mxgot}.
26641 This works with very large GOTs, although the code is also
26642 less efficient, since it takes three instructions to fetch the
26643 value of a global symbol.
26644
26645 Note that some linkers can create multiple GOTs. If you have such a
26646 linker, you should only need to use @option{-mxgot} when a single object
26647 file accesses more than 64k's worth of GOT entries. Very few do.
26648
26649 These options have no effect unless GCC is generating position
26650 independent code.
26651
26652 @item -mgp32
26653 @opindex mgp32
26654 Assume that general-purpose registers are 32 bits wide.
26655
26656 @item -mgp64
26657 @opindex mgp64
26658 Assume that general-purpose registers are 64 bits wide.
26659
26660 @item -mfp32
26661 @opindex mfp32
26662 Assume that floating-point registers are 32 bits wide.
26663
26664 @item -mfp64
26665 @opindex mfp64
26666 Assume that floating-point registers are 64 bits wide.
26667
26668 @item -mfpxx
26669 @opindex mfpxx
26670 Do not assume the width of floating-point registers.
26671
26672 @item -mhard-float
26673 @opindex mhard-float
26674 Use floating-point coprocessor instructions.
26675
26676 @item -msoft-float
26677 @opindex msoft-float
26678 Do not use floating-point coprocessor instructions. Implement
26679 floating-point calculations using library calls instead.
26680
26681 @item -mno-float
26682 @opindex mno-float
26683 Equivalent to @option{-msoft-float}, but additionally asserts that the
26684 program being compiled does not perform any floating-point operations.
26685 This option is presently supported only by some bare-metal MIPS
26686 configurations, where it may select a special set of libraries
26687 that lack all floating-point support (including, for example, the
26688 floating-point @code{printf} formats).
26689 If code compiled with @option{-mno-float} accidentally contains
26690 floating-point operations, it is likely to suffer a link-time
26691 or run-time failure.
26692
26693 @item -msingle-float
26694 @opindex msingle-float
26695 Assume that the floating-point coprocessor only supports single-precision
26696 operations.
26697
26698 @item -mdouble-float
26699 @opindex mdouble-float
26700 Assume that the floating-point coprocessor supports double-precision
26701 operations. This is the default.
26702
26703 @item -modd-spreg
26704 @itemx -mno-odd-spreg
26705 @opindex modd-spreg
26706 @opindex mno-odd-spreg
26707 Enable the use of odd-numbered single-precision floating-point registers
26708 for the o32 ABI. This is the default for processors that are known to
26709 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
26710 is set by default.
26711
26712 @item -mabs=2008
26713 @itemx -mabs=legacy
26714 @opindex mabs=2008
26715 @opindex mabs=legacy
26716 These options control the treatment of the special not-a-number (NaN)
26717 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
26718 @code{neg.@i{fmt}} machine instructions.
26719
26720 By default or when @option{-mabs=legacy} is used the legacy
26721 treatment is selected. In this case these instructions are considered
26722 arithmetic and avoided where correct operation is required and the
26723 input operand might be a NaN. A longer sequence of instructions that
26724 manipulate the sign bit of floating-point datum manually is used
26725 instead unless the @option{-ffinite-math-only} option has also been
26726 specified.
26727
26728 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
26729 this case these instructions are considered non-arithmetic and therefore
26730 operating correctly in all cases, including in particular where the
26731 input operand is a NaN. These instructions are therefore always used
26732 for the respective operations.
26733
26734 @item -mnan=2008
26735 @itemx -mnan=legacy
26736 @opindex mnan=2008
26737 @opindex mnan=legacy
26738 These options control the encoding of the special not-a-number (NaN)
26739 IEEE 754 floating-point data.
26740
26741 The @option{-mnan=legacy} option selects the legacy encoding. In this
26742 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
26743 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
26744 by the first bit of their trailing significand field being 1.
26745
26746 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
26747 this case qNaNs are denoted by the first bit of their trailing
26748 significand field being 1, whereas sNaNs are denoted by the first bit of
26749 their trailing significand field being 0.
26750
26751 The default is @option{-mnan=legacy} unless GCC has been configured with
26752 @option{--with-nan=2008}.
26753
26754 @item -mllsc
26755 @itemx -mno-llsc
26756 @opindex mllsc
26757 @opindex mno-llsc
26758 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
26759 implement atomic memory built-in functions. When neither option is
26760 specified, GCC uses the instructions if the target architecture
26761 supports them.
26762
26763 @option{-mllsc} is useful if the runtime environment can emulate the
26764 instructions and @option{-mno-llsc} can be useful when compiling for
26765 nonstandard ISAs. You can make either option the default by
26766 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
26767 respectively. @option{--with-llsc} is the default for some
26768 configurations; see the installation documentation for details.
26769
26770 @item -mdsp
26771 @itemx -mno-dsp
26772 @opindex mdsp
26773 @opindex mno-dsp
26774 Use (do not use) revision 1 of the MIPS DSP ASE@.
26775 @xref{MIPS DSP Built-in Functions}. This option defines the
26776 preprocessor macro @code{__mips_dsp}. It also defines
26777 @code{__mips_dsp_rev} to 1.
26778
26779 @item -mdspr2
26780 @itemx -mno-dspr2
26781 @opindex mdspr2
26782 @opindex mno-dspr2
26783 Use (do not use) revision 2 of the MIPS DSP ASE@.
26784 @xref{MIPS DSP Built-in Functions}. This option defines the
26785 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
26786 It also defines @code{__mips_dsp_rev} to 2.
26787
26788 @item -msmartmips
26789 @itemx -mno-smartmips
26790 @opindex msmartmips
26791 @opindex mno-smartmips
26792 Use (do not use) the MIPS SmartMIPS ASE.
26793
26794 @item -mpaired-single
26795 @itemx -mno-paired-single
26796 @opindex mpaired-single
26797 @opindex mno-paired-single
26798 Use (do not use) paired-single floating-point instructions.
26799 @xref{MIPS Paired-Single Support}. This option requires
26800 hardware floating-point support to be enabled.
26801
26802 @item -mdmx
26803 @itemx -mno-mdmx
26804 @opindex mdmx
26805 @opindex mno-mdmx
26806 Use (do not use) MIPS Digital Media Extension instructions.
26807 This option can only be used when generating 64-bit code and requires
26808 hardware floating-point support to be enabled.
26809
26810 @item -mips3d
26811 @itemx -mno-mips3d
26812 @opindex mips3d
26813 @opindex mno-mips3d
26814 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
26815 The option @option{-mips3d} implies @option{-mpaired-single}.
26816
26817 @item -mmicromips
26818 @itemx -mno-micromips
26819 @opindex mmicromips
26820 @opindex mno-mmicromips
26821 Generate (do not generate) microMIPS code.
26822
26823 MicroMIPS code generation can also be controlled on a per-function basis
26824 by means of @code{micromips} and @code{nomicromips} attributes.
26825 @xref{Function Attributes}, for more information.
26826
26827 @item -mmt
26828 @itemx -mno-mt
26829 @opindex mmt
26830 @opindex mno-mt
26831 Use (do not use) MT Multithreading instructions.
26832
26833 @item -mmcu
26834 @itemx -mno-mcu
26835 @opindex mmcu
26836 @opindex mno-mcu
26837 Use (do not use) the MIPS MCU ASE instructions.
26838
26839 @item -meva
26840 @itemx -mno-eva
26841 @opindex meva
26842 @opindex mno-eva
26843 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
26844
26845 @item -mvirt
26846 @itemx -mno-virt
26847 @opindex mvirt
26848 @opindex mno-virt
26849 Use (do not use) the MIPS Virtualization (VZ) instructions.
26850
26851 @item -mxpa
26852 @itemx -mno-xpa
26853 @opindex mxpa
26854 @opindex mno-xpa
26855 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
26856
26857 @item -mcrc
26858 @itemx -mno-crc
26859 @opindex mcrc
26860 @opindex mno-crc
26861 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
26862
26863 @item -mginv
26864 @itemx -mno-ginv
26865 @opindex mginv
26866 @opindex mno-ginv
26867 Use (do not use) the MIPS Global INValidate (GINV) instructions.
26868
26869 @item -mloongson-mmi
26870 @itemx -mno-loongson-mmi
26871 @opindex mloongson-mmi
26872 @opindex mno-loongson-mmi
26873 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
26874
26875 @item -mloongson-ext
26876 @itemx -mno-loongson-ext
26877 @opindex mloongson-ext
26878 @opindex mno-loongson-ext
26879 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
26880
26881 @item -mloongson-ext2
26882 @itemx -mno-loongson-ext2
26883 @opindex mloongson-ext2
26884 @opindex mno-loongson-ext2
26885 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
26886
26887 @item -mlong64
26888 @opindex mlong64
26889 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
26890 an explanation of the default and the way that the pointer size is
26891 determined.
26892
26893 @item -mlong32
26894 @opindex mlong32
26895 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
26896
26897 The default size of @code{int}s, @code{long}s and pointers depends on
26898 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
26899 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
26900 32-bit @code{long}s. Pointers are the same size as @code{long}s,
26901 or the same size as integer registers, whichever is smaller.
26902
26903 @item -msym32
26904 @itemx -mno-sym32
26905 @opindex msym32
26906 @opindex mno-sym32
26907 Assume (do not assume) that all symbols have 32-bit values, regardless
26908 of the selected ABI@. This option is useful in combination with
26909 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
26910 to generate shorter and faster references to symbolic addresses.
26911
26912 @item -G @var{num}
26913 @opindex G
26914 Put definitions of externally-visible data in a small data section
26915 if that data is no bigger than @var{num} bytes. GCC can then generate
26916 more efficient accesses to the data; see @option{-mgpopt} for details.
26917
26918 The default @option{-G} option depends on the configuration.
26919
26920 @item -mlocal-sdata
26921 @itemx -mno-local-sdata
26922 @opindex mlocal-sdata
26923 @opindex mno-local-sdata
26924 Extend (do not extend) the @option{-G} behavior to local data too,
26925 such as to static variables in C@. @option{-mlocal-sdata} is the
26926 default for all configurations.
26927
26928 If the linker complains that an application is using too much small data,
26929 you might want to try rebuilding the less performance-critical parts with
26930 @option{-mno-local-sdata}. You might also want to build large
26931 libraries with @option{-mno-local-sdata}, so that the libraries leave
26932 more room for the main program.
26933
26934 @item -mextern-sdata
26935 @itemx -mno-extern-sdata
26936 @opindex mextern-sdata
26937 @opindex mno-extern-sdata
26938 Assume (do not assume) that externally-defined data is in
26939 a small data section if the size of that data is within the @option{-G} limit.
26940 @option{-mextern-sdata} is the default for all configurations.
26941
26942 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
26943 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
26944 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
26945 is placed in a small data section. If @var{Var} is defined by another
26946 module, you must either compile that module with a high-enough
26947 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
26948 definition. If @var{Var} is common, you must link the application
26949 with a high-enough @option{-G} setting.
26950
26951 The easiest way of satisfying these restrictions is to compile
26952 and link every module with the same @option{-G} option. However,
26953 you may wish to build a library that supports several different
26954 small data limits. You can do this by compiling the library with
26955 the highest supported @option{-G} setting and additionally using
26956 @option{-mno-extern-sdata} to stop the library from making assumptions
26957 about externally-defined data.
26958
26959 @item -mgpopt
26960 @itemx -mno-gpopt
26961 @opindex mgpopt
26962 @opindex mno-gpopt
26963 Use (do not use) GP-relative accesses for symbols that are known to be
26964 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
26965 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
26966 configurations.
26967
26968 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
26969 might not hold the value of @code{_gp}. For example, if the code is
26970 part of a library that might be used in a boot monitor, programs that
26971 call boot monitor routines pass an unknown value in @code{$gp}.
26972 (In such situations, the boot monitor itself is usually compiled
26973 with @option{-G0}.)
26974
26975 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
26976 @option{-mno-extern-sdata}.
26977
26978 @item -membedded-data
26979 @itemx -mno-embedded-data
26980 @opindex membedded-data
26981 @opindex mno-embedded-data
26982 Allocate variables to the read-only data section first if possible, then
26983 next in the small data section if possible, otherwise in data. This gives
26984 slightly slower code than the default, but reduces the amount of RAM required
26985 when executing, and thus may be preferred for some embedded systems.
26986
26987 @item -muninit-const-in-rodata
26988 @itemx -mno-uninit-const-in-rodata
26989 @opindex muninit-const-in-rodata
26990 @opindex mno-uninit-const-in-rodata
26991 Put uninitialized @code{const} variables in the read-only data section.
26992 This option is only meaningful in conjunction with @option{-membedded-data}.
26993
26994 @item -mcode-readable=@var{setting}
26995 @opindex mcode-readable
26996 Specify whether GCC may generate code that reads from executable sections.
26997 There are three possible settings:
26998
26999 @table @gcctabopt
27000 @item -mcode-readable=yes
27001 Instructions may freely access executable sections. This is the
27002 default setting.
27003
27004 @item -mcode-readable=pcrel
27005 MIPS16 PC-relative load instructions can access executable sections,
27006 but other instructions must not do so. This option is useful on 4KSc
27007 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
27008 It is also useful on processors that can be configured to have a dual
27009 instruction/data SRAM interface and that, like the M4K, automatically
27010 redirect PC-relative loads to the instruction RAM.
27011
27012 @item -mcode-readable=no
27013 Instructions must not access executable sections. This option can be
27014 useful on targets that are configured to have a dual instruction/data
27015 SRAM interface but that (unlike the M4K) do not automatically redirect
27016 PC-relative loads to the instruction RAM.
27017 @end table
27018
27019 @item -msplit-addresses
27020 @itemx -mno-split-addresses
27021 @opindex msplit-addresses
27022 @opindex mno-split-addresses
27023 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
27024 relocation operators. This option has been superseded by
27025 @option{-mexplicit-relocs} but is retained for backwards compatibility.
27026
27027 @item -mexplicit-relocs
27028 @itemx -mno-explicit-relocs
27029 @opindex mexplicit-relocs
27030 @opindex mno-explicit-relocs
27031 Use (do not use) assembler relocation operators when dealing with symbolic
27032 addresses. The alternative, selected by @option{-mno-explicit-relocs},
27033 is to use assembler macros instead.
27034
27035 @option{-mexplicit-relocs} is the default if GCC was configured
27036 to use an assembler that supports relocation operators.
27037
27038 @item -mcheck-zero-division
27039 @itemx -mno-check-zero-division
27040 @opindex mcheck-zero-division
27041 @opindex mno-check-zero-division
27042 Trap (do not trap) on integer division by zero.
27043
27044 The default is @option{-mcheck-zero-division}.
27045
27046 @item -mdivide-traps
27047 @itemx -mdivide-breaks
27048 @opindex mdivide-traps
27049 @opindex mdivide-breaks
27050 MIPS systems check for division by zero by generating either a
27051 conditional trap or a break instruction. Using traps results in
27052 smaller code, but is only supported on MIPS II and later. Also, some
27053 versions of the Linux kernel have a bug that prevents trap from
27054 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
27055 allow conditional traps on architectures that support them and
27056 @option{-mdivide-breaks} to force the use of breaks.
27057
27058 The default is usually @option{-mdivide-traps}, but this can be
27059 overridden at configure time using @option{--with-divide=breaks}.
27060 Divide-by-zero checks can be completely disabled using
27061 @option{-mno-check-zero-division}.
27062
27063 @item -mload-store-pairs
27064 @itemx -mno-load-store-pairs
27065 @opindex mload-store-pairs
27066 @opindex mno-load-store-pairs
27067 Enable (disable) an optimization that pairs consecutive load or store
27068 instructions to enable load/store bonding. This option is enabled by
27069 default but only takes effect when the selected architecture is known
27070 to support bonding.
27071
27072 @item -munaligned-access
27073 @itemx -mno-unaligned-access
27074 @opindex munaligned-access
27075 @opindex mno-unaligned-access
27076 Enable (disable) direct unaligned access for MIPS Release 6.
27077 MIPSr6 requires load/store unaligned-access support,
27078 by hardware or trap&emulate.
27079 So @option{-mno-unaligned-access} may be needed by kernel.
27080
27081 @item -mmemcpy
27082 @itemx -mno-memcpy
27083 @opindex mmemcpy
27084 @opindex mno-memcpy
27085 Force (do not force) the use of @code{memcpy} for non-trivial block
27086 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
27087 most constant-sized copies.
27088
27089 @item -mlong-calls
27090 @itemx -mno-long-calls
27091 @opindex mlong-calls
27092 @opindex mno-long-calls
27093 Disable (do not disable) use of the @code{jal} instruction. Calling
27094 functions using @code{jal} is more efficient but requires the caller
27095 and callee to be in the same 256 megabyte segment.
27096
27097 This option has no effect on abicalls code. The default is
27098 @option{-mno-long-calls}.
27099
27100 @item -mmad
27101 @itemx -mno-mad
27102 @opindex mmad
27103 @opindex mno-mad
27104 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27105 instructions, as provided by the R4650 ISA@.
27106
27107 @item -mimadd
27108 @itemx -mno-imadd
27109 @opindex mimadd
27110 @opindex mno-imadd
27111 Enable (disable) use of the @code{madd} and @code{msub} integer
27112 instructions. The default is @option{-mimadd} on architectures
27113 that support @code{madd} and @code{msub} except for the 74k
27114 architecture where it was found to generate slower code.
27115
27116 @item -mfused-madd
27117 @itemx -mno-fused-madd
27118 @opindex mfused-madd
27119 @opindex mno-fused-madd
27120 Enable (disable) use of the floating-point multiply-accumulate
27121 instructions, when they are available. The default is
27122 @option{-mfused-madd}.
27123
27124 On the R8000 CPU when multiply-accumulate instructions are used,
27125 the intermediate product is calculated to infinite precision
27126 and is not subject to the FCSR Flush to Zero bit. This may be
27127 undesirable in some circumstances. On other processors the result
27128 is numerically identical to the equivalent computation using
27129 separate multiply, add, subtract and negate instructions.
27130
27131 @item -nocpp
27132 @opindex nocpp
27133 Tell the MIPS assembler to not run its preprocessor over user
27134 assembler files (with a @samp{.s} suffix) when assembling them.
27135
27136 @item -mfix-24k
27137 @itemx -mno-fix-24k
27138 @opindex mfix-24k
27139 @opindex mno-fix-24k
27140 Work around the 24K E48 (lost data on stores during refill) errata.
27141 The workarounds are implemented by the assembler rather than by GCC@.
27142
27143 @item -mfix-r4000
27144 @itemx -mno-fix-r4000
27145 @opindex mfix-r4000
27146 @opindex mno-fix-r4000
27147 Work around certain R4000 CPU errata:
27148 @itemize @minus
27149 @item
27150 A double-word or a variable shift may give an incorrect result if executed
27151 immediately after starting an integer division.
27152 @item
27153 A double-word or a variable shift may give an incorrect result if executed
27154 while an integer multiplication is in progress.
27155 @item
27156 An integer division may give an incorrect result if started in a delay slot
27157 of a taken branch or a jump.
27158 @end itemize
27159
27160 @item -mfix-r4400
27161 @itemx -mno-fix-r4400
27162 @opindex mfix-r4400
27163 @opindex mno-fix-r4400
27164 Work around certain R4400 CPU errata:
27165 @itemize @minus
27166 @item
27167 A double-word or a variable shift may give an incorrect result if executed
27168 immediately after starting an integer division.
27169 @end itemize
27170
27171 @item -mfix-r10000
27172 @itemx -mno-fix-r10000
27173 @opindex mfix-r10000
27174 @opindex mno-fix-r10000
27175 Work around certain R10000 errata:
27176 @itemize @minus
27177 @item
27178 @code{ll}/@code{sc} sequences may not behave atomically on revisions
27179 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
27180 @end itemize
27181
27182 This option can only be used if the target architecture supports
27183 branch-likely instructions. @option{-mfix-r10000} is the default when
27184 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
27185 otherwise.
27186
27187 @item -mfix-r5900
27188 @itemx -mno-fix-r5900
27189 @opindex mfix-r5900
27190 Do not attempt to schedule the preceding instruction into the delay slot
27191 of a branch instruction placed at the end of a short loop of six
27192 instructions or fewer and always schedule a @code{nop} instruction there
27193 instead. The short loop bug under certain conditions causes loops to
27194 execute only once or twice, due to a hardware bug in the R5900 chip. The
27195 workaround is implemented by the assembler rather than by GCC@.
27196
27197 @item -mfix-rm7000
27198 @itemx -mno-fix-rm7000
27199 @opindex mfix-rm7000
27200 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
27201 workarounds are implemented by the assembler rather than by GCC@.
27202
27203 @item -mfix-vr4120
27204 @itemx -mno-fix-vr4120
27205 @opindex mfix-vr4120
27206 Work around certain VR4120 errata:
27207 @itemize @minus
27208 @item
27209 @code{dmultu} does not always produce the correct result.
27210 @item
27211 @code{div} and @code{ddiv} do not always produce the correct result if one
27212 of the operands is negative.
27213 @end itemize
27214 The workarounds for the division errata rely on special functions in
27215 @file{libgcc.a}. At present, these functions are only provided by
27216 the @code{mips64vr*-elf} configurations.
27217
27218 Other VR4120 errata require a NOP to be inserted between certain pairs of
27219 instructions. These errata are handled by the assembler, not by GCC itself.
27220
27221 @item -mfix-vr4130
27222 @opindex mfix-vr4130
27223 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
27224 workarounds are implemented by the assembler rather than by GCC,
27225 although GCC avoids using @code{mflo} and @code{mfhi} if the
27226 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
27227 instructions are available instead.
27228
27229 @item -mfix-sb1
27230 @itemx -mno-fix-sb1
27231 @opindex mfix-sb1
27232 Work around certain SB-1 CPU core errata.
27233 (This flag currently works around the SB-1 revision 2
27234 ``F1'' and ``F2'' floating-point errata.)
27235
27236 @item -mr10k-cache-barrier=@var{setting}
27237 @opindex mr10k-cache-barrier
27238 Specify whether GCC should insert cache barriers to avoid the
27239 side effects of speculation on R10K processors.
27240
27241 In common with many processors, the R10K tries to predict the outcome
27242 of a conditional branch and speculatively executes instructions from
27243 the ``taken'' branch. It later aborts these instructions if the
27244 predicted outcome is wrong. However, on the R10K, even aborted
27245 instructions can have side effects.
27246
27247 This problem only affects kernel stores and, depending on the system,
27248 kernel loads. As an example, a speculatively-executed store may load
27249 the target memory into cache and mark the cache line as dirty, even if
27250 the store itself is later aborted. If a DMA operation writes to the
27251 same area of memory before the ``dirty'' line is flushed, the cached
27252 data overwrites the DMA-ed data. See the R10K processor manual
27253 for a full description, including other potential problems.
27254
27255 One workaround is to insert cache barrier instructions before every memory
27256 access that might be speculatively executed and that might have side
27257 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
27258 controls GCC's implementation of this workaround. It assumes that
27259 aborted accesses to any byte in the following regions does not have
27260 side effects:
27261
27262 @enumerate
27263 @item
27264 the memory occupied by the current function's stack frame;
27265
27266 @item
27267 the memory occupied by an incoming stack argument;
27268
27269 @item
27270 the memory occupied by an object with a link-time-constant address.
27271 @end enumerate
27272
27273 It is the kernel's responsibility to ensure that speculative
27274 accesses to these regions are indeed safe.
27275
27276 If the input program contains a function declaration such as:
27277
27278 @smallexample
27279 void foo (void);
27280 @end smallexample
27281
27282 then the implementation of @code{foo} must allow @code{j foo} and
27283 @code{jal foo} to be executed speculatively. GCC honors this
27284 restriction for functions it compiles itself. It expects non-GCC
27285 functions (such as hand-written assembly code) to do the same.
27286
27287 The option has three forms:
27288
27289 @table @gcctabopt
27290 @item -mr10k-cache-barrier=load-store
27291 Insert a cache barrier before a load or store that might be
27292 speculatively executed and that might have side effects even
27293 if aborted.
27294
27295 @item -mr10k-cache-barrier=store
27296 Insert a cache barrier before a store that might be speculatively
27297 executed and that might have side effects even if aborted.
27298
27299 @item -mr10k-cache-barrier=none
27300 Disable the insertion of cache barriers. This is the default setting.
27301 @end table
27302
27303 @item -mflush-func=@var{func}
27304 @itemx -mno-flush-func
27305 @opindex mflush-func
27306 Specifies the function to call to flush the I and D caches, or to not
27307 call any such function. If called, the function must take the same
27308 arguments as the common @code{_flush_func}, that is, the address of the
27309 memory range for which the cache is being flushed, the size of the
27310 memory range, and the number 3 (to flush both caches). The default
27311 depends on the target GCC was configured for, but commonly is either
27312 @code{_flush_func} or @code{__cpu_flush}.
27313
27314 @item mbranch-cost=@var{num}
27315 @opindex mbranch-cost
27316 Set the cost of branches to roughly @var{num} ``simple'' instructions.
27317 This cost is only a heuristic and is not guaranteed to produce
27318 consistent results across releases. A zero cost redundantly selects
27319 the default, which is based on the @option{-mtune} setting.
27320
27321 @item -mbranch-likely
27322 @itemx -mno-branch-likely
27323 @opindex mbranch-likely
27324 @opindex mno-branch-likely
27325 Enable or disable use of Branch Likely instructions, regardless of the
27326 default for the selected architecture. By default, Branch Likely
27327 instructions may be generated if they are supported by the selected
27328 architecture. An exception is for the MIPS32 and MIPS64 architectures
27329 and processors that implement those architectures; for those, Branch
27330 Likely instructions are not be generated by default because the MIPS32
27331 and MIPS64 architectures specifically deprecate their use.
27332
27333 @item -mcompact-branches=never
27334 @itemx -mcompact-branches=optimal
27335 @itemx -mcompact-branches=always
27336 @opindex mcompact-branches=never
27337 @opindex mcompact-branches=optimal
27338 @opindex mcompact-branches=always
27339 These options control which form of branches will be generated. The
27340 default is @option{-mcompact-branches=optimal}.
27341
27342 The @option{-mcompact-branches=never} option ensures that compact branch
27343 instructions will never be generated.
27344
27345 The @option{-mcompact-branches=always} option ensures that a compact
27346 branch instruction will be generated if available for MIPS Release 6 onwards.
27347 If a compact branch instruction is not available (or pre-R6),
27348 a delay slot form of the branch will be used instead.
27349
27350 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
27351 The behaviour for MIPS16/microMIPS may change in future,
27352 since they do have some compact branch instructions.
27353
27354 The @option{-mcompact-branches=optimal} option will cause a delay slot
27355 branch to be used if one is available in the current ISA and the delay
27356 slot is successfully filled. If the delay slot is not filled, a compact
27357 branch will be chosen if one is available.
27358
27359 @item -mfp-exceptions
27360 @itemx -mno-fp-exceptions
27361 @opindex mfp-exceptions
27362 Specifies whether FP exceptions are enabled. This affects how
27363 FP instructions are scheduled for some processors.
27364 The default is that FP exceptions are
27365 enabled.
27366
27367 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
27368 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
27369 FP pipe.
27370
27371 @item -mvr4130-align
27372 @itemx -mno-vr4130-align
27373 @opindex mvr4130-align
27374 The VR4130 pipeline is two-way superscalar, but can only issue two
27375 instructions together if the first one is 8-byte aligned. When this
27376 option is enabled, GCC aligns pairs of instructions that it
27377 thinks should execute in parallel.
27378
27379 This option only has an effect when optimizing for the VR4130.
27380 It normally makes code faster, but at the expense of making it bigger.
27381 It is enabled by default at optimization level @option{-O3}.
27382
27383 @item -msynci
27384 @itemx -mno-synci
27385 @opindex msynci
27386 Enable (disable) generation of @code{synci} instructions on
27387 architectures that support it. The @code{synci} instructions (if
27388 enabled) are generated when @code{__builtin___clear_cache} is
27389 compiled.
27390
27391 This option defaults to @option{-mno-synci}, but the default can be
27392 overridden by configuring GCC with @option{--with-synci}.
27393
27394 When compiling code for single processor systems, it is generally safe
27395 to use @code{synci}. However, on many multi-core (SMP) systems, it
27396 does not invalidate the instruction caches on all cores and may lead
27397 to undefined behavior.
27398
27399 @item -mrelax-pic-calls
27400 @itemx -mno-relax-pic-calls
27401 @opindex mrelax-pic-calls
27402 Try to turn PIC calls that are normally dispatched via register
27403 @code{$25} into direct calls. This is only possible if the linker can
27404 resolve the destination at link time and if the destination is within
27405 range for a direct call.
27406
27407 @option{-mrelax-pic-calls} is the default if GCC was configured to use
27408 an assembler and a linker that support the @code{.reloc} assembly
27409 directive and @option{-mexplicit-relocs} is in effect. With
27410 @option{-mno-explicit-relocs}, this optimization can be performed by the
27411 assembler and the linker alone without help from the compiler.
27412
27413 @item -mmcount-ra-address
27414 @itemx -mno-mcount-ra-address
27415 @opindex mmcount-ra-address
27416 @opindex mno-mcount-ra-address
27417 Emit (do not emit) code that allows @code{_mcount} to modify the
27418 calling function's return address. When enabled, this option extends
27419 the usual @code{_mcount} interface with a new @var{ra-address}
27420 parameter, which has type @code{intptr_t *} and is passed in register
27421 @code{$12}. @code{_mcount} can then modify the return address by
27422 doing both of the following:
27423 @itemize
27424 @item
27425 Returning the new address in register @code{$31}.
27426 @item
27427 Storing the new address in @code{*@var{ra-address}},
27428 if @var{ra-address} is nonnull.
27429 @end itemize
27430
27431 The default is @option{-mno-mcount-ra-address}.
27432
27433 @item -mframe-header-opt
27434 @itemx -mno-frame-header-opt
27435 @opindex mframe-header-opt
27436 Enable (disable) frame header optimization in the o32 ABI. When using the
27437 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
27438 function to write out register arguments. When enabled, this optimization
27439 will suppress the allocation of the frame header if it can be determined that
27440 it is unused.
27441
27442 This optimization is off by default at all optimization levels.
27443
27444 @item -mlxc1-sxc1
27445 @itemx -mno-lxc1-sxc1
27446 @opindex mlxc1-sxc1
27447 When applicable, enable (disable) the generation of @code{lwxc1},
27448 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
27449
27450 @item -mmadd4
27451 @itemx -mno-madd4
27452 @opindex mmadd4
27453 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
27454 @code{madd.d} and related instructions. Enabled by default.
27455
27456 @end table
27457
27458 @node MMIX Options
27459 @subsection MMIX Options
27460 @cindex MMIX Options
27461
27462 These options are defined for the MMIX:
27463
27464 @table @gcctabopt
27465 @item -mlibfuncs
27466 @itemx -mno-libfuncs
27467 @opindex mlibfuncs
27468 @opindex mno-libfuncs
27469 Specify that intrinsic library functions are being compiled, passing all
27470 values in registers, no matter the size.
27471
27472 @item -mepsilon
27473 @itemx -mno-epsilon
27474 @opindex mepsilon
27475 @opindex mno-epsilon
27476 Generate floating-point comparison instructions that compare with respect
27477 to the @code{rE} epsilon register.
27478
27479 @item -mabi=mmixware
27480 @itemx -mabi=gnu
27481 @opindex mabi=mmixware
27482 @opindex mabi=gnu
27483 Generate code that passes function parameters and return values that (in
27484 the called function) are seen as registers @code{$0} and up, as opposed to
27485 the GNU ABI which uses global registers @code{$231} and up.
27486
27487 @item -mzero-extend
27488 @itemx -mno-zero-extend
27489 @opindex mzero-extend
27490 @opindex mno-zero-extend
27491 When reading data from memory in sizes shorter than 64 bits, use (do not
27492 use) zero-extending load instructions by default, rather than
27493 sign-extending ones.
27494
27495 @item -mknuthdiv
27496 @itemx -mno-knuthdiv
27497 @opindex mknuthdiv
27498 @opindex mno-knuthdiv
27499 Make the result of a division yielding a remainder have the same sign as
27500 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
27501 remainder follows the sign of the dividend. Both methods are
27502 arithmetically valid, the latter being almost exclusively used.
27503
27504 @item -mtoplevel-symbols
27505 @itemx -mno-toplevel-symbols
27506 @opindex mtoplevel-symbols
27507 @opindex mno-toplevel-symbols
27508 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
27509 code can be used with the @code{PREFIX} assembly directive.
27510
27511 @item -melf
27512 @opindex melf
27513 Generate an executable in the ELF format, rather than the default
27514 @samp{mmo} format used by the @command{mmix} simulator.
27515
27516 @item -mbranch-predict
27517 @itemx -mno-branch-predict
27518 @opindex mbranch-predict
27519 @opindex mno-branch-predict
27520 Use (do not use) the probable-branch instructions, when static branch
27521 prediction indicates a probable branch.
27522
27523 @item -mbase-addresses
27524 @itemx -mno-base-addresses
27525 @opindex mbase-addresses
27526 @opindex mno-base-addresses
27527 Generate (do not generate) code that uses @emph{base addresses}. Using a
27528 base address automatically generates a request (handled by the assembler
27529 and the linker) for a constant to be set up in a global register. The
27530 register is used for one or more base address requests within the range 0
27531 to 255 from the value held in the register. The generally leads to short
27532 and fast code, but the number of different data items that can be
27533 addressed is limited. This means that a program that uses lots of static
27534 data may require @option{-mno-base-addresses}.
27535
27536 @item -msingle-exit
27537 @itemx -mno-single-exit
27538 @opindex msingle-exit
27539 @opindex mno-single-exit
27540 Force (do not force) generated code to have a single exit point in each
27541 function.
27542 @end table
27543
27544 @node MN10300 Options
27545 @subsection MN10300 Options
27546 @cindex MN10300 options
27547
27548 These @option{-m} options are defined for Matsushita MN10300 architectures:
27549
27550 @table @gcctabopt
27551 @item -mmult-bug
27552 @opindex mmult-bug
27553 Generate code to avoid bugs in the multiply instructions for the MN10300
27554 processors. This is the default.
27555
27556 @item -mno-mult-bug
27557 @opindex mno-mult-bug
27558 Do not generate code to avoid bugs in the multiply instructions for the
27559 MN10300 processors.
27560
27561 @item -mam33
27562 @opindex mam33
27563 Generate code using features specific to the AM33 processor.
27564
27565 @item -mno-am33
27566 @opindex mno-am33
27567 Do not generate code using features specific to the AM33 processor. This
27568 is the default.
27569
27570 @item -mam33-2
27571 @opindex mam33-2
27572 Generate code using features specific to the AM33/2.0 processor.
27573
27574 @item -mam34
27575 @opindex mam34
27576 Generate code using features specific to the AM34 processor.
27577
27578 @item -mtune=@var{cpu-type}
27579 @opindex mtune
27580 Use the timing characteristics of the indicated CPU type when
27581 scheduling instructions. This does not change the targeted processor
27582 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
27583 @samp{am33-2} or @samp{am34}.
27584
27585 @item -mreturn-pointer-on-d0
27586 @opindex mreturn-pointer-on-d0
27587 When generating a function that returns a pointer, return the pointer
27588 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
27589 only in @code{a0}, and attempts to call such functions without a prototype
27590 result in errors. Note that this option is on by default; use
27591 @option{-mno-return-pointer-on-d0} to disable it.
27592
27593 @item -mno-crt0
27594 @opindex mno-crt0
27595 Do not link in the C run-time initialization object file.
27596
27597 @item -mrelax
27598 @opindex mrelax
27599 Indicate to the linker that it should perform a relaxation optimization pass
27600 to shorten branches, calls and absolute memory addresses. This option only
27601 has an effect when used on the command line for the final link step.
27602
27603 This option makes symbolic debugging impossible.
27604
27605 @item -mliw
27606 @opindex mliw
27607 Allow the compiler to generate @emph{Long Instruction Word}
27608 instructions if the target is the @samp{AM33} or later. This is the
27609 default. This option defines the preprocessor macro @code{__LIW__}.
27610
27611 @item -mno-liw
27612 @opindex mno-liw
27613 Do not allow the compiler to generate @emph{Long Instruction Word}
27614 instructions. This option defines the preprocessor macro
27615 @code{__NO_LIW__}.
27616
27617 @item -msetlb
27618 @opindex msetlb
27619 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
27620 instructions if the target is the @samp{AM33} or later. This is the
27621 default. This option defines the preprocessor macro @code{__SETLB__}.
27622
27623 @item -mno-setlb
27624 @opindex mno-setlb
27625 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
27626 instructions. This option defines the preprocessor macro
27627 @code{__NO_SETLB__}.
27628
27629 @end table
27630
27631 @node Moxie Options
27632 @subsection Moxie Options
27633 @cindex Moxie Options
27634
27635 @table @gcctabopt
27636
27637 @item -meb
27638 @opindex meb
27639 Generate big-endian code. This is the default for @samp{moxie-*-*}
27640 configurations.
27641
27642 @item -mel
27643 @opindex mel
27644 Generate little-endian code.
27645
27646 @item -mmul.x
27647 @opindex mmul.x
27648 Generate mul.x and umul.x instructions. This is the default for
27649 @samp{moxiebox-*-*} configurations.
27650
27651 @item -mno-crt0
27652 @opindex mno-crt0
27653 Do not link in the C run-time initialization object file.
27654
27655 @end table
27656
27657 @node MSP430 Options
27658 @subsection MSP430 Options
27659 @cindex MSP430 Options
27660
27661 These options are defined for the MSP430:
27662
27663 @table @gcctabopt
27664
27665 @item -masm-hex
27666 @opindex masm-hex
27667 Force assembly output to always use hex constants. Normally such
27668 constants are signed decimals, but this option is available for
27669 testsuite and/or aesthetic purposes.
27670
27671 @item -mmcu=
27672 @opindex mmcu=
27673 Select the MCU to target. This is used to create a C preprocessor
27674 symbol based upon the MCU name, converted to upper case and pre- and
27675 post-fixed with @samp{__}. This in turn is used by the
27676 @file{msp430.h} header file to select an MCU-specific supplementary
27677 header file.
27678
27679 The option also sets the ISA to use. If the MCU name is one that is
27680 known to only support the 430 ISA then that is selected, otherwise the
27681 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
27682 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
27683 name selects the 430X ISA.
27684
27685 In addition an MCU-specific linker script is added to the linker
27686 command line. The script's name is the name of the MCU with
27687 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
27688 command line defines the C preprocessor symbol @code{__XXX__} and
27689 cause the linker to search for a script called @file{xxx.ld}.
27690
27691 The ISA and hardware multiply supported for the different MCUs is hard-coded
27692 into GCC. However, an external @samp{devices.csv} file can be used to
27693 extend device support beyond those that have been hard-coded.
27694
27695 GCC searches for the @samp{devices.csv} file using the following methods in the
27696 given precedence order, where the first method takes precendence over the
27697 second which takes precedence over the third.
27698
27699 @table @asis
27700 @item Include path specified with @code{-I} and @code{-L}
27701 @samp{devices.csv} will be searched for in each of the directories specified by
27702 include paths and linker library search paths.
27703 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
27704 Define the value of the global environment variable
27705 @samp{MSP430_GCC_INCLUDE_DIR}
27706 to the full path to the directory containing devices.csv, and GCC will search
27707 this directory for devices.csv. If devices.csv is found, this directory will
27708 also be registered as an include path, and linker library path. Header files
27709 and linker scripts in this directory can therefore be used without manually
27710 specifying @code{-I} and @code{-L} on the command line.
27711 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
27712 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
27713 toolchain root directory. This directory does not exist in a default
27714 installation, but if the user has created it and copied @samp{devices.csv}
27715 there, then the MCU data will be read. As above, this directory will
27716 also be registered as an include path, and linker library path.
27717
27718 @end table
27719 If none of the above search methods find @samp{devices.csv}, then the
27720 hard-coded MCU data is used.
27721
27722
27723 @item -mwarn-mcu
27724 @itemx -mno-warn-mcu
27725 @opindex mwarn-mcu
27726 @opindex mno-warn-mcu
27727 This option enables or disables warnings about conflicts between the
27728 MCU name specified by the @option{-mmcu} option and the ISA set by the
27729 @option{-mcpu} option and/or the hardware multiply support set by the
27730 @option{-mhwmult} option. It also toggles warnings about unrecognized
27731 MCU names. This option is on by default.
27732
27733 @item -mcpu=
27734 @opindex mcpu=
27735 Specifies the ISA to use. Accepted values are @samp{msp430},
27736 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
27737 @option{-mmcu=} option should be used to select the ISA.
27738
27739 @item -msim
27740 @opindex msim
27741 Link to the simulator runtime libraries and linker script. Overrides
27742 any scripts that would be selected by the @option{-mmcu=} option.
27743
27744 @item -mlarge
27745 @opindex mlarge
27746 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
27747
27748 @item -msmall
27749 @opindex msmall
27750 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
27751
27752 @item -mrelax
27753 @opindex mrelax
27754 This option is passed to the assembler and linker, and allows the
27755 linker to perform certain optimizations that cannot be done until
27756 the final link.
27757
27758 @item mhwmult=
27759 @opindex mhwmult=
27760 Describes the type of hardware multiply supported by the target.
27761 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
27762 for the original 16-bit-only multiply supported by early MCUs.
27763 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
27764 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
27765 A value of @samp{auto} can also be given. This tells GCC to deduce
27766 the hardware multiply support based upon the MCU name provided by the
27767 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
27768 the MCU name is not recognized then no hardware multiply support is
27769 assumed. @code{auto} is the default setting.
27770
27771 Hardware multiplies are normally performed by calling a library
27772 routine. This saves space in the generated code. When compiling at
27773 @option{-O3} or higher however the hardware multiplier is invoked
27774 inline. This makes for bigger, but faster code.
27775
27776 The hardware multiply routines disable interrupts whilst running and
27777 restore the previous interrupt state when they finish. This makes
27778 them safe to use inside interrupt handlers as well as in normal code.
27779
27780 @item -minrt
27781 @opindex minrt
27782 Enable the use of a minimum runtime environment - no static
27783 initializers or constructors. This is intended for memory-constrained
27784 devices. The compiler includes special symbols in some objects
27785 that tell the linker and runtime which code fragments are required.
27786
27787 @item -mtiny-printf
27788 @opindex mtiny-printf
27789 Enable reduced code size @code{printf} and @code{puts} library functions.
27790 The @samp{tiny} implementations of these functions are not reentrant, so
27791 must be used with caution in multi-threaded applications.
27792
27793 Support for streams has been removed and the string to be printed will
27794 always be sent to stdout via the @code{write} syscall. The string is not
27795 buffered before it is sent to write.
27796
27797 This option requires Newlib Nano IO, so GCC must be configured with
27798 @samp{--enable-newlib-nano-formatted-io}.
27799
27800 @item -mmax-inline-shift=
27801 @opindex mmax-inline-shift=
27802 This option takes an integer between 0 and 64 inclusive, and sets
27803 the maximum number of inline shift instructions which should be emitted to
27804 perform a shift operation by a constant amount. When this value needs to be
27805 exceeded, an mspabi helper function is used instead. The default value is 4.
27806
27807 This only affects cases where a shift by multiple positions cannot be
27808 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
27809
27810 Shifts of a 32-bit value are at least twice as costly, so the value passed for
27811 this option is divided by 2 and the resulting value used instead.
27812
27813 @item -mcode-region=
27814 @itemx -mdata-region=
27815 @opindex mcode-region
27816 @opindex mdata-region
27817 These options tell the compiler where to place functions and data that
27818 do not have one of the @code{lower}, @code{upper}, @code{either} or
27819 @code{section} attributes. Possible values are @code{lower},
27820 @code{upper}, @code{either} or @code{any}. The first three behave
27821 like the corresponding attribute. The fourth possible value -
27822 @code{any} - is the default. It leaves placement entirely up to the
27823 linker script and how it assigns the standard sections
27824 (@code{.text}, @code{.data}, etc) to the memory regions.
27825
27826 @item -msilicon-errata=
27827 @opindex msilicon-errata
27828 This option passes on a request to assembler to enable the fixes for
27829 the named silicon errata.
27830
27831 @item -msilicon-errata-warn=
27832 @opindex msilicon-errata-warn
27833 This option passes on a request to the assembler to enable warning
27834 messages when a silicon errata might need to be applied.
27835
27836 @item -mwarn-devices-csv
27837 @itemx -mno-warn-devices-csv
27838 @opindex mwarn-devices-csv
27839 @opindex mno-warn-devices-csv
27840 Warn if @samp{devices.csv} is not found or there are problem parsing it
27841 (default: on).
27842
27843 @end table
27844
27845 @node NDS32 Options
27846 @subsection NDS32 Options
27847 @cindex NDS32 Options
27848
27849 These options are defined for NDS32 implementations:
27850
27851 @table @gcctabopt
27852
27853 @item -mbig-endian
27854 @opindex mbig-endian
27855 Generate code in big-endian mode.
27856
27857 @item -mlittle-endian
27858 @opindex mlittle-endian
27859 Generate code in little-endian mode.
27860
27861 @item -mreduced-regs
27862 @opindex mreduced-regs
27863 Use reduced-set registers for register allocation.
27864
27865 @item -mfull-regs
27866 @opindex mfull-regs
27867 Use full-set registers for register allocation.
27868
27869 @item -mcmov
27870 @opindex mcmov
27871 Generate conditional move instructions.
27872
27873 @item -mno-cmov
27874 @opindex mno-cmov
27875 Do not generate conditional move instructions.
27876
27877 @item -mext-perf
27878 @opindex mext-perf
27879 Generate performance extension instructions.
27880
27881 @item -mno-ext-perf
27882 @opindex mno-ext-perf
27883 Do not generate performance extension instructions.
27884
27885 @item -mext-perf2
27886 @opindex mext-perf2
27887 Generate performance extension 2 instructions.
27888
27889 @item -mno-ext-perf2
27890 @opindex mno-ext-perf2
27891 Do not generate performance extension 2 instructions.
27892
27893 @item -mext-string
27894 @opindex mext-string
27895 Generate string extension instructions.
27896
27897 @item -mno-ext-string
27898 @opindex mno-ext-string
27899 Do not generate string extension instructions.
27900
27901 @item -mv3push
27902 @opindex mv3push
27903 Generate v3 push25/pop25 instructions.
27904
27905 @item -mno-v3push
27906 @opindex mno-v3push
27907 Do not generate v3 push25/pop25 instructions.
27908
27909 @item -m16-bit
27910 @opindex m16-bit
27911 Generate 16-bit instructions.
27912
27913 @item -mno-16-bit
27914 @opindex mno-16-bit
27915 Do not generate 16-bit instructions.
27916
27917 @item -misr-vector-size=@var{num}
27918 @opindex misr-vector-size
27919 Specify the size of each interrupt vector, which must be 4 or 16.
27920
27921 @item -mcache-block-size=@var{num}
27922 @opindex mcache-block-size
27923 Specify the size of each cache block,
27924 which must be a power of 2 between 4 and 512.
27925
27926 @item -march=@var{arch}
27927 @opindex march
27928 Specify the name of the target architecture.
27929
27930 @item -mcmodel=@var{code-model}
27931 @opindex mcmodel
27932 Set the code model to one of
27933 @table @asis
27934 @item @samp{small}
27935 All the data and read-only data segments must be within 512KB addressing space.
27936 The text segment must be within 16MB addressing space.
27937 @item @samp{medium}
27938 The data segment must be within 512KB while the read-only data segment can be
27939 within 4GB addressing space. The text segment should be still within 16MB
27940 addressing space.
27941 @item @samp{large}
27942 All the text and data segments can be within 4GB addressing space.
27943 @end table
27944
27945 @item -mctor-dtor
27946 @opindex mctor-dtor
27947 Enable constructor/destructor feature.
27948
27949 @item -mrelax
27950 @opindex mrelax
27951 Guide linker to relax instructions.
27952
27953 @end table
27954
27955 @node Nios II Options
27956 @subsection Nios II Options
27957 @cindex Nios II options
27958 @cindex Altera Nios II options
27959
27960 These are the options defined for the Altera Nios II processor.
27961
27962 @table @gcctabopt
27963
27964 @item -G @var{num}
27965 @opindex G
27966 @cindex smaller data references
27967 Put global and static objects less than or equal to @var{num} bytes
27968 into the small data or BSS sections instead of the normal data or BSS
27969 sections. The default value of @var{num} is 8.
27970
27971 @item -mgpopt=@var{option}
27972 @itemx -mgpopt
27973 @itemx -mno-gpopt
27974 @opindex mgpopt
27975 @opindex mno-gpopt
27976 Generate (do not generate) GP-relative accesses. The following
27977 @var{option} names are recognized:
27978
27979 @table @samp
27980
27981 @item none
27982 Do not generate GP-relative accesses.
27983
27984 @item local
27985 Generate GP-relative accesses for small data objects that are not
27986 external, weak, or uninitialized common symbols.
27987 Also use GP-relative addressing for objects that
27988 have been explicitly placed in a small data section via a @code{section}
27989 attribute.
27990
27991 @item global
27992 As for @samp{local}, but also generate GP-relative accesses for
27993 small data objects that are external, weak, or common. If you use this option,
27994 you must ensure that all parts of your program (including libraries) are
27995 compiled with the same @option{-G} setting.
27996
27997 @item data
27998 Generate GP-relative accesses for all data objects in the program. If you
27999 use this option, the entire data and BSS segments
28000 of your program must fit in 64K of memory and you must use an appropriate
28001 linker script to allocate them within the addressable range of the
28002 global pointer.
28003
28004 @item all
28005 Generate GP-relative addresses for function pointers as well as data
28006 pointers. If you use this option, the entire text, data, and BSS segments
28007 of your program must fit in 64K of memory and you must use an appropriate
28008 linker script to allocate them within the addressable range of the
28009 global pointer.
28010
28011 @end table
28012
28013 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
28014 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
28015
28016 The default is @option{-mgpopt} except when @option{-fpic} or
28017 @option{-fPIC} is specified to generate position-independent code.
28018 Note that the Nios II ABI does not permit GP-relative accesses from
28019 shared libraries.
28020
28021 You may need to specify @option{-mno-gpopt} explicitly when building
28022 programs that include large amounts of small data, including large
28023 GOT data sections. In this case, the 16-bit offset for GP-relative
28024 addressing may not be large enough to allow access to the entire
28025 small data section.
28026
28027 @item -mgprel-sec=@var{regexp}
28028 @opindex mgprel-sec
28029 This option specifies additional section names that can be accessed via
28030 GP-relative addressing. It is most useful in conjunction with
28031 @code{section} attributes on variable declarations
28032 (@pxref{Common Variable Attributes}) and a custom linker script.
28033 The @var{regexp} is a POSIX Extended Regular Expression.
28034
28035 This option does not affect the behavior of the @option{-G} option, and
28036 the specified sections are in addition to the standard @code{.sdata}
28037 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
28038
28039 @item -mr0rel-sec=@var{regexp}
28040 @opindex mr0rel-sec
28041 This option specifies names of sections that can be accessed via a
28042 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
28043 of the 32-bit address space. It is most useful in conjunction with
28044 @code{section} attributes on variable declarations
28045 (@pxref{Common Variable Attributes}) and a custom linker script.
28046 The @var{regexp} is a POSIX Extended Regular Expression.
28047
28048 In contrast to the use of GP-relative addressing for small data,
28049 zero-based addressing is never generated by default and there are no
28050 conventional section names used in standard linker scripts for sections
28051 in the low or high areas of memory.
28052
28053 @item -mel
28054 @itemx -meb
28055 @opindex mel
28056 @opindex meb
28057 Generate little-endian (default) or big-endian (experimental) code,
28058 respectively.
28059
28060 @item -march=@var{arch}
28061 @opindex march
28062 This specifies the name of the target Nios II architecture. GCC uses this
28063 name to determine what kind of instructions it can emit when generating
28064 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
28065
28066 The preprocessor macro @code{__nios2_arch__} is available to programs,
28067 with value 1 or 2, indicating the targeted ISA level.
28068
28069 @item -mbypass-cache
28070 @itemx -mno-bypass-cache
28071 @opindex mno-bypass-cache
28072 @opindex mbypass-cache
28073 Force all load and store instructions to always bypass cache by
28074 using I/O variants of the instructions. The default is not to
28075 bypass the cache.
28076
28077 @item -mno-cache-volatile
28078 @itemx -mcache-volatile
28079 @opindex mcache-volatile
28080 @opindex mno-cache-volatile
28081 Volatile memory access bypass the cache using the I/O variants of
28082 the load and store instructions. The default is not to bypass the cache.
28083
28084 @item -mno-fast-sw-div
28085 @itemx -mfast-sw-div
28086 @opindex mno-fast-sw-div
28087 @opindex mfast-sw-div
28088 Do not use table-based fast divide for small numbers. The default
28089 is to use the fast divide at @option{-O3} and above.
28090
28091 @item -mno-hw-mul
28092 @itemx -mhw-mul
28093 @itemx -mno-hw-mulx
28094 @itemx -mhw-mulx
28095 @itemx -mno-hw-div
28096 @itemx -mhw-div
28097 @opindex mno-hw-mul
28098 @opindex mhw-mul
28099 @opindex mno-hw-mulx
28100 @opindex mhw-mulx
28101 @opindex mno-hw-div
28102 @opindex mhw-div
28103 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
28104 instructions by the compiler. The default is to emit @code{mul}
28105 and not emit @code{div} and @code{mulx}.
28106
28107 @item -mbmx
28108 @itemx -mno-bmx
28109 @itemx -mcdx
28110 @itemx -mno-cdx
28111 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28112 CDX (code density) instructions. Enabling these instructions also
28113 requires @option{-march=r2}. Since these instructions are optional
28114 extensions to the R2 architecture, the default is not to emit them.
28115
28116 @item -mcustom-@var{insn}=@var{N}
28117 @itemx -mno-custom-@var{insn}
28118 @opindex mcustom-@var{insn}
28119 @opindex mno-custom-@var{insn}
28120 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28121 custom instruction with encoding @var{N} when generating code that uses
28122 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
28123 instruction 253 for single-precision floating-point add operations instead
28124 of the default behavior of using a library call.
28125
28126 The following values of @var{insn} are supported. Except as otherwise
28127 noted, floating-point operations are expected to be implemented with
28128 normal IEEE 754 semantics and correspond directly to the C operators or the
28129 equivalent GCC built-in functions (@pxref{Other Builtins}).
28130
28131 Single-precision floating point:
28132 @table @asis
28133
28134 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28135 Binary arithmetic operations.
28136
28137 @item @samp{fnegs}
28138 Unary negation.
28139
28140 @item @samp{fabss}
28141 Unary absolute value.
28142
28143 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
28144 Comparison operations.
28145
28146 @item @samp{fmins}, @samp{fmaxs}
28147 Floating-point minimum and maximum. These instructions are only
28148 generated if @option{-ffinite-math-only} is specified.
28149
28150 @item @samp{fsqrts}
28151 Unary square root operation.
28152
28153 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
28154 Floating-point trigonometric and exponential functions. These instructions
28155 are only generated if @option{-funsafe-math-optimizations} is also specified.
28156
28157 @end table
28158
28159 Double-precision floating point:
28160 @table @asis
28161
28162 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
28163 Binary arithmetic operations.
28164
28165 @item @samp{fnegd}
28166 Unary negation.
28167
28168 @item @samp{fabsd}
28169 Unary absolute value.
28170
28171 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
28172 Comparison operations.
28173
28174 @item @samp{fmind}, @samp{fmaxd}
28175 Double-precision minimum and maximum. These instructions are only
28176 generated if @option{-ffinite-math-only} is specified.
28177
28178 @item @samp{fsqrtd}
28179 Unary square root operation.
28180
28181 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
28182 Double-precision trigonometric and exponential functions. These instructions
28183 are only generated if @option{-funsafe-math-optimizations} is also specified.
28184
28185 @end table
28186
28187 Conversions:
28188 @table @asis
28189 @item @samp{fextsd}
28190 Conversion from single precision to double precision.
28191
28192 @item @samp{ftruncds}
28193 Conversion from double precision to single precision.
28194
28195 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
28196 Conversion from floating point to signed or unsigned integer types, with
28197 truncation towards zero.
28198
28199 @item @samp{round}
28200 Conversion from single-precision floating point to signed integer,
28201 rounding to the nearest integer and ties away from zero.
28202 This corresponds to the @code{__builtin_lroundf} function when
28203 @option{-fno-math-errno} is used.
28204
28205 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
28206 Conversion from signed or unsigned integer types to floating-point types.
28207
28208 @end table
28209
28210 In addition, all of the following transfer instructions for internal
28211 registers X and Y must be provided to use any of the double-precision
28212 floating-point instructions. Custom instructions taking two
28213 double-precision source operands expect the first operand in the
28214 64-bit register X. The other operand (or only operand of a unary
28215 operation) is given to the custom arithmetic instruction with the
28216 least significant half in source register @var{src1} and the most
28217 significant half in @var{src2}. A custom instruction that returns a
28218 double-precision result returns the most significant 32 bits in the
28219 destination register and the other half in 32-bit register Y.
28220 GCC automatically generates the necessary code sequences to write
28221 register X and/or read register Y when double-precision floating-point
28222 instructions are used.
28223
28224 @table @asis
28225
28226 @item @samp{fwrx}
28227 Write @var{src1} into the least significant half of X and @var{src2} into
28228 the most significant half of X.
28229
28230 @item @samp{fwry}
28231 Write @var{src1} into Y.
28232
28233 @item @samp{frdxhi}, @samp{frdxlo}
28234 Read the most or least (respectively) significant half of X and store it in
28235 @var{dest}.
28236
28237 @item @samp{frdy}
28238 Read the value of Y and store it into @var{dest}.
28239 @end table
28240
28241 Note that you can gain more local control over generation of Nios II custom
28242 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
28243 and @code{target("no-custom-@var{insn}")} function attributes
28244 (@pxref{Function Attributes})
28245 or pragmas (@pxref{Function Specific Option Pragmas}).
28246
28247 @item -mcustom-fpu-cfg=@var{name}
28248 @opindex mcustom-fpu-cfg
28249
28250 This option enables a predefined, named set of custom instruction encodings
28251 (see @option{-mcustom-@var{insn}} above).
28252 Currently, the following sets are defined:
28253
28254 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
28255 @gccoptlist{-mcustom-fmuls=252 @gol
28256 -mcustom-fadds=253 @gol
28257 -mcustom-fsubs=254 @gol
28258 -fsingle-precision-constant}
28259
28260 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
28261 @gccoptlist{-mcustom-fmuls=252 @gol
28262 -mcustom-fadds=253 @gol
28263 -mcustom-fsubs=254 @gol
28264 -mcustom-fdivs=255 @gol
28265 -fsingle-precision-constant}
28266
28267 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
28268 @gccoptlist{-mcustom-floatus=243 @gol
28269 -mcustom-fixsi=244 @gol
28270 -mcustom-floatis=245 @gol
28271 -mcustom-fcmpgts=246 @gol
28272 -mcustom-fcmples=249 @gol
28273 -mcustom-fcmpeqs=250 @gol
28274 -mcustom-fcmpnes=251 @gol
28275 -mcustom-fmuls=252 @gol
28276 -mcustom-fadds=253 @gol
28277 -mcustom-fsubs=254 @gol
28278 -mcustom-fdivs=255 @gol
28279 -fsingle-precision-constant}
28280
28281 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
28282 @gccoptlist{-mcustom-fabss=224 @gol
28283 -mcustom-fnegs=225 @gol
28284 -mcustom-fcmpnes=226 @gol
28285 -mcustom-fcmpeqs=227 @gol
28286 -mcustom-fcmpges=228 @gol
28287 -mcustom-fcmpgts=229 @gol
28288 -mcustom-fcmples=230 @gol
28289 -mcustom-fcmplts=231 @gol
28290 -mcustom-fmaxs=232 @gol
28291 -mcustom-fmins=233 @gol
28292 -mcustom-round=248 @gol
28293 -mcustom-fixsi=249 @gol
28294 -mcustom-floatis=250 @gol
28295 -mcustom-fsqrts=251 @gol
28296 -mcustom-fmuls=252 @gol
28297 -mcustom-fadds=253 @gol
28298 -mcustom-fsubs=254 @gol
28299 -mcustom-fdivs=255 @gol}
28300
28301 Custom instruction assignments given by individual
28302 @option{-mcustom-@var{insn}=} options override those given by
28303 @option{-mcustom-fpu-cfg=}, regardless of the
28304 order of the options on the command line.
28305
28306 Note that you can gain more local control over selection of a FPU
28307 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
28308 function attribute (@pxref{Function Attributes})
28309 or pragma (@pxref{Function Specific Option Pragmas}).
28310
28311 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
28312 Hardware 2 Component}. Please note that the custom instructions enabled by
28313 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
28314 if @option{-ffinite-math-only} is specified. The custom instruction enabled by
28315 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
28316 specified. In contrast to the other configurations,
28317 @option{-fsingle-precision-constant} is not set.
28318
28319 @end table
28320
28321 These additional @samp{-m} options are available for the Altera Nios II
28322 ELF (bare-metal) target:
28323
28324 @table @gcctabopt
28325
28326 @item -mhal
28327 @opindex mhal
28328 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
28329 startup and termination code, and is typically used in conjunction with
28330 @option{-msys-crt0=} to specify the location of the alternate startup code
28331 provided by the HAL BSP.
28332
28333 @item -msmallc
28334 @opindex msmallc
28335 Link with a limited version of the C library, @option{-lsmallc}, rather than
28336 Newlib.
28337
28338 @item -msys-crt0=@var{startfile}
28339 @opindex msys-crt0
28340 @var{startfile} is the file name of the startfile (crt0) to use
28341 when linking. This option is only useful in conjunction with @option{-mhal}.
28342
28343 @item -msys-lib=@var{systemlib}
28344 @opindex msys-lib
28345 @var{systemlib} is the library name of the library that provides
28346 low-level system calls required by the C library,
28347 e.g.@: @code{read} and @code{write}.
28348 This option is typically used to link with a library provided by a HAL BSP.
28349
28350 @end table
28351
28352 @node Nvidia PTX Options
28353 @subsection Nvidia PTX Options
28354 @cindex Nvidia PTX options
28355 @cindex nvptx options
28356
28357 These options are defined for Nvidia PTX:
28358
28359 @table @gcctabopt
28360
28361 @item -m64
28362 @opindex m64
28363 Ignored, but preserved for backward compatibility. Only 64-bit ABI is
28364 supported.
28365
28366 @item -march=@var{architecture-string}
28367 @opindex march
28368 Generate code for the specified PTX ISA target architecture
28369 (e.g.@: @samp{sm_35}). Valid architecture strings are @samp{sm_30},
28370 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
28371 @samp{sm_80}.
28372 The default depends on how the compiler has been configured, see
28373 @option{--with-arch}.
28374
28375 This option sets the value of the preprocessor macro
28376 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
28377 @samp{350}.
28378
28379 @item -misa=@var{architecture-string}
28380 @opindex misa
28381 Alias of @option{-march=}.
28382
28383 @item -march-map=@var{architecture-string}
28384 @opindex march
28385 Select the closest available @option{-march=} value that is not more
28386 capable. For instance, for @option{-march-map=sm_50} select
28387 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
28388 @option{-march=sm_53}.
28389
28390 @item -mptx=@var{version-string}
28391 @opindex mptx
28392 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
28393 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
28394 @samp{7.0}. The default PTX ISA version is 6.0, unless a higher
28395 version is required for specified PTX ISA target architecture via
28396 option @option{-march=}.
28397
28398 This option sets the values of the preprocessor macros
28399 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
28400 for instance, for @samp{3.1} the macros have the values @samp{3} and
28401 @samp{1}, respectively.
28402
28403 @item -mmainkernel
28404 @opindex mmainkernel
28405 Link in code for a __main kernel. This is for stand-alone instead of
28406 offloading execution.
28407
28408 @item -moptimize
28409 @opindex moptimize
28410 Apply partitioned execution optimizations. This is the default when any
28411 level of optimization is selected.
28412
28413 @item -msoft-stack
28414 @opindex msoft-stack
28415 Generate code that does not use @code{.local} memory
28416 directly for stack storage. Instead, a per-warp stack pointer is
28417 maintained explicitly. This enables variable-length stack allocation (with
28418 variable-length arrays or @code{alloca}), and when global memory is used for
28419 underlying storage, makes it possible to access automatic variables from other
28420 threads, or with atomic instructions. This code generation variant is used
28421 for OpenMP offloading, but the option is exposed on its own for the purpose
28422 of testing the compiler; to generate code suitable for linking into programs
28423 using OpenMP offloading, use option @option{-mgomp}.
28424
28425 @item -muniform-simt
28426 @opindex muniform-simt
28427 Switch to code generation variant that allows to execute all threads in each
28428 warp, while maintaining memory state and side effects as if only one thread
28429 in each warp was active outside of OpenMP SIMD regions. All atomic operations
28430 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
28431 current lane index equals the master lane index), and the register being
28432 assigned is copied via a shuffle instruction from the master lane. Outside of
28433 SIMD regions lane 0 is the master; inside, each thread sees itself as the
28434 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
28435 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
28436 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
28437 with current lane index to compute the master lane index.
28438
28439 @item -mgomp
28440 @opindex mgomp
28441 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
28442 @option{-muniform-simt} options, and selects corresponding multilib variant.
28443
28444 @end table
28445
28446 @node OpenRISC Options
28447 @subsection OpenRISC Options
28448 @cindex OpenRISC Options
28449
28450 These options are defined for OpenRISC:
28451
28452 @table @gcctabopt
28453
28454 @item -mboard=@var{name}
28455 @opindex mboard
28456 Configure a board specific runtime. This will be passed to the linker for
28457 newlib board library linking. The default is @code{or1ksim}.
28458
28459 @item -mnewlib
28460 @opindex mnewlib
28461 This option is ignored; it is for compatibility purposes only. This used to
28462 select linker and preprocessor options for use with newlib.
28463
28464 @item -msoft-div
28465 @itemx -mhard-div
28466 @opindex msoft-div
28467 @opindex mhard-div
28468 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
28469 This default is hardware divide.
28470
28471 @item -msoft-mul
28472 @itemx -mhard-mul
28473 @opindex msoft-mul
28474 @opindex mhard-mul
28475 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
28476 This default is hardware multiply.
28477
28478 @item -msoft-float
28479 @itemx -mhard-float
28480 @opindex msoft-float
28481 @opindex mhard-float
28482 Select software or hardware for floating point operations.
28483 The default is software.
28484
28485 @item -mdouble-float
28486 @opindex mdouble-float
28487 When @option{-mhard-float} is selected, enables generation of double-precision
28488 floating point instructions. By default functions from @file{libgcc} are used
28489 to perform double-precision floating point operations.
28490
28491 @item -munordered-float
28492 @opindex munordered-float
28493 When @option{-mhard-float} is selected, enables generation of unordered
28494 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
28495 functions from @file{libgcc} are used to perform unordered floating point
28496 compare and set flag operations.
28497
28498 @item -mcmov
28499 @opindex mcmov
28500 Enable generation of conditional move (@code{l.cmov}) instructions. By
28501 default the equivalent will be generated using set and branch.
28502
28503 @item -mror
28504 @opindex mror
28505 Enable generation of rotate right (@code{l.ror}) instructions. By default
28506 functions from @file{libgcc} are used to perform rotate right operations.
28507
28508 @item -mrori
28509 @opindex mrori
28510 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
28511 By default functions from @file{libgcc} are used to perform rotate right with
28512 immediate operations.
28513
28514 @item -msext
28515 @opindex msext
28516 Enable generation of sign extension (@code{l.ext*}) instructions. By default
28517 memory loads are used to perform sign extension.
28518
28519 @item -msfimm
28520 @opindex msfimm
28521 Enable generation of compare and set flag with immediate (@code{l.sf*i})
28522 instructions. By default extra instructions will be generated to store the
28523 immediate to a register first.
28524
28525 @item -mshftimm
28526 @opindex mshftimm
28527 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
28528 @code{l.slli}) instructions. By default extra instructions will be generated
28529 to store the immediate to a register first.
28530
28531 @item -mcmodel=small
28532 @opindex mcmodel=small
28533 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
28534 the default model.
28535
28536 @item -mcmodel=large
28537 @opindex mcmodel=large
28538 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
28539
28540
28541 @end table
28542
28543 @node PDP-11 Options
28544 @subsection PDP-11 Options
28545 @cindex PDP-11 Options
28546
28547 These options are defined for the PDP-11:
28548
28549 @table @gcctabopt
28550 @item -mfpu
28551 @opindex mfpu
28552 Use hardware FPP floating point. This is the default. (FIS floating
28553 point on the PDP-11/40 is not supported.) Implies -m45.
28554
28555 @item -msoft-float
28556 @opindex msoft-float
28557 Do not use hardware floating point.
28558
28559 @item -mac0
28560 @opindex mac0
28561 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
28562
28563 @item -mno-ac0
28564 @opindex mno-ac0
28565 Return floating-point results in memory. This is the default.
28566
28567 @item -m40
28568 @opindex m40
28569 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
28570
28571 @item -m45
28572 @opindex m45
28573 Generate code for a PDP-11/45. This is the default.
28574
28575 @item -m10
28576 @opindex m10
28577 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
28578
28579 @item -mint16
28580 @itemx -mno-int32
28581 @opindex mint16
28582 @opindex mno-int32
28583 Use 16-bit @code{int}. This is the default.
28584
28585 @item -mint32
28586 @itemx -mno-int16
28587 @opindex mint32
28588 @opindex mno-int16
28589 Use 32-bit @code{int}.
28590
28591 @item -msplit
28592 @opindex msplit
28593 Target has split instruction and data space. Implies -m45.
28594
28595 @item -munix-asm
28596 @opindex munix-asm
28597 Use Unix assembler syntax.
28598
28599 @item -mdec-asm
28600 @opindex mdec-asm
28601 Use DEC assembler syntax.
28602
28603 @item -mgnu-asm
28604 @opindex mgnu-asm
28605 Use GNU assembler syntax. This is the default.
28606
28607 @item -mlra
28608 @opindex mlra
28609 Use the new LRA register allocator. By default, the old ``reload''
28610 allocator is used.
28611 @end table
28612
28613 @node PowerPC Options
28614 @subsection PowerPC Options
28615 @cindex PowerPC options
28616
28617 These are listed under @xref{RS/6000 and PowerPC Options}.
28618
28619 @node PRU Options
28620 @subsection PRU Options
28621 @cindex PRU Options
28622
28623 These command-line options are defined for PRU target:
28624
28625 @table @gcctabopt
28626 @item -minrt
28627 @opindex minrt
28628 Link with a minimum runtime environment, with no support for static
28629 initializers and constructors. Using this option can significantly reduce
28630 the size of the final ELF binary. Beware that the compiler could still
28631 generate code with static initializers and constructors. It is up to the
28632 programmer to ensure that the source program will not use those features.
28633
28634 @item -mmcu=@var{mcu}
28635 @opindex mmcu
28636 Specify the PRU MCU variant to use. Check Newlib for the exact list of
28637 supported MCUs.
28638
28639 @item -mno-relax
28640 @opindex mno-relax
28641 Make GCC pass the @option{--no-relax} command-line option to the linker
28642 instead of the @option{--relax} option.
28643
28644 @item -mloop
28645 @opindex mloop
28646 Allow (or do not allow) GCC to use the LOOP instruction.
28647
28648 @item -mabi=@var{variant}
28649 @opindex mabi
28650 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
28651 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
28652 more naturally with certain GCC assumptions. These are the differences:
28653
28654 @table @samp
28655 @item Function Pointer Size
28656 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
28657 supports only 32-bit data and code pointers.
28658
28659 @item Optional Return Value Pointer
28660 Function return values larger than 64 bits are passed by using a hidden
28661 pointer as the first argument of the function. TI ABI, though, mandates that
28662 the pointer can be NULL in case the caller is not using the returned value.
28663 GNU always passes and expects a valid return value pointer.
28664
28665 @end table
28666
28667 The current @option{-mabi=ti} implementation simply raises a compile error
28668 when any of the above code constructs is detected. As a consequence
28669 the standard C library cannot be built and it is omitted when linking with
28670 @option{-mabi=ti}.
28671
28672 Relaxation is a GNU feature and for safety reasons is disabled when using
28673 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
28674 instructions, so the GNU linker cannot adjust them when shortening adjacent
28675 LDI32 pseudo instructions.
28676
28677 @end table
28678
28679 @node RISC-V Options
28680 @subsection RISC-V Options
28681 @cindex RISC-V Options
28682
28683 These command-line options are defined for RISC-V targets:
28684
28685 @table @gcctabopt
28686 @item -mbranch-cost=@var{n}
28687 @opindex mbranch-cost
28688 Set the cost of branches to roughly @var{n} instructions.
28689
28690 @item -mplt
28691 @itemx -mno-plt
28692 @opindex plt
28693 When generating PIC code, do or don't allow the use of PLTs. Ignored for
28694 non-PIC. The default is @option{-mplt}.
28695
28696 @item -mabi=@var{ABI-string}
28697 @opindex mabi
28698 Specify integer and floating-point calling convention. @var{ABI-string}
28699 contains two parts: the size of integer types and the registers used for
28700 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
28701 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
28702 32-bit), and that floating-point values up to 64 bits wide are passed in F
28703 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
28704 allows the compiler to generate code that uses the F and D extensions but only
28705 allows floating-point values up to 32 bits long to be passed in registers; or
28706 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
28707 passed in registers.
28708
28709 The default for this argument is system dependent, users who want a specific
28710 calling convention should specify one explicitly. The valid calling
28711 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
28712 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
28713 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
28714 invalid because the ABI requires 64-bit values be passed in F registers, but F
28715 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
28716 only be used with the @samp{rv32e} architecture. This ABI is not well
28717 specified at present, and is subject to change.
28718
28719 @item -mfdiv
28720 @itemx -mno-fdiv
28721 @opindex mfdiv
28722 Do or don't use hardware floating-point divide and square root instructions.
28723 This requires the F or D extensions for floating-point registers. The default
28724 is to use them if the specified architecture has these instructions.
28725
28726 @item -mdiv
28727 @itemx -mno-div
28728 @opindex mdiv
28729 Do or don't use hardware instructions for integer division. This requires the
28730 M extension. The default is to use them if the specified architecture has
28731 these instructions.
28732
28733 @item -misa-spec=@var{ISA-spec-string}
28734 @opindex misa-spec
28735 Specify the version of the RISC-V Unprivileged (formerly User-Level)
28736 ISA specification to produce code conforming to. The possibilities
28737 for @var{ISA-spec-string} are:
28738 @table @code
28739 @item 2.2
28740 Produce code conforming to version 2.2.
28741 @item 20190608
28742 Produce code conforming to version 20190608.
28743 @item 20191213
28744 Produce code conforming to version 20191213.
28745 @end table
28746 The default is @option{-misa-spec=20191213} unless GCC has been configured
28747 with @option{--with-isa-spec=} specifying a different default version.
28748
28749 @item -march=@var{ISA-string}
28750 @opindex march
28751 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
28752 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
28753 @samp{rv32imaf}.
28754
28755 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
28756
28757 If both @option{-march} and @option{-mcpu=} are not specified, the default for
28758 this argument is system dependent, users who want a specific architecture
28759 extensions should specify one explicitly.
28760
28761 @item -mcpu=@var{processor-string}
28762 @opindex mcpu
28763 Use architecture of and optimize the output for the given processor, specified
28764 by particular CPU name.
28765 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
28766 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
28767 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
28768 @samp{sifive-u54}, and @samp{sifive-u74}.
28769
28770 @item -mtune=@var{processor-string}
28771 @opindex mtune
28772 Optimize the output for the given processor, specified by microarchitecture or
28773 particular CPU name. Permissible values for this option are: @samp{rocket},
28774 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
28775 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
28776
28777 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
28778 the default is @samp{rocket} if both are not specified.
28779
28780 The @samp{size} choice is not intended for use by end-users. This is used
28781 when @option{-Os} is specified. It overrides the instruction cost info
28782 provided by @option{-mtune=}, but does not override the pipeline info. This
28783 helps reduce code size while still giving good performance.
28784
28785 @item -mpreferred-stack-boundary=@var{num}
28786 @opindex mpreferred-stack-boundary
28787 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28788 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28789 the default is 4 (16 bytes or 128-bits).
28790
28791 @strong{Warning:} If you use this switch, then you must build all modules with
28792 the same value, including any libraries. This includes the system libraries
28793 and startup modules.
28794
28795 @item -msmall-data-limit=@var{n}
28796 @opindex msmall-data-limit
28797 Put global and static data smaller than @var{n} bytes into a special section
28798 (on some targets).
28799
28800 @item -msave-restore
28801 @itemx -mno-save-restore
28802 @opindex msave-restore
28803 Do or don't use smaller but slower prologue and epilogue code that uses
28804 library function calls. The default is to use fast inline prologues and
28805 epilogues.
28806
28807 @item -mshorten-memrefs
28808 @itemx -mno-shorten-memrefs
28809 @opindex mshorten-memrefs
28810 Do or do not attempt to make more use of compressed load/store instructions by
28811 replacing a load/store of 'base register + large offset' with a new load/store
28812 of 'new base + small offset'. If the new base gets stored in a compressed
28813 register, then the new load/store can be compressed. Currently targets 32-bit
28814 integer load/stores only.
28815
28816 @item -mstrict-align
28817 @itemx -mno-strict-align
28818 @opindex mstrict-align
28819 Do not or do generate unaligned memory accesses. The default is set depending
28820 on whether the processor we are optimizing for supports fast unaligned access
28821 or not.
28822
28823 @item -mcmodel=medlow
28824 @opindex mcmodel=medlow
28825 Generate code for the medium-low code model. The program and its statically
28826 defined symbols must lie within a single 2 GiB address range and must lie
28827 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
28828 statically or dynamically linked. This is the default code model.
28829
28830 @item -mcmodel=medany
28831 @opindex mcmodel=medany
28832 Generate code for the medium-any code model. The program and its statically
28833 defined symbols must be within any single 2 GiB address range. Programs can be
28834 statically or dynamically linked.
28835
28836 The code generated by the medium-any code model is position-independent, but is
28837 not guaranteed to function correctly when linked into position-independent
28838 executables or libraries.
28839
28840 @item -mexplicit-relocs
28841 @itemx -mno-exlicit-relocs
28842 Use or do not use assembler relocation operators when dealing with symbolic
28843 addresses. The alternative is to use assembler macros instead, which may
28844 limit optimization.
28845
28846 @item -mrelax
28847 @itemx -mno-relax
28848 @opindex mrelax
28849 Take advantage of linker relaxations to reduce the number of instructions
28850 required to materialize symbol addresses. The default is to take advantage of
28851 linker relaxations.
28852
28853 @item -mriscv-attribute
28854 @itemx -mno-riscv-attribute
28855 @opindex mriscv-attribute
28856 Emit (do not emit) RISC-V attribute to record extra information into ELF
28857 objects. This feature requires at least binutils 2.32.
28858
28859 @item -mcsr-check
28860 @itemx -mno-csr-check
28861 @opindex mcsr-check
28862 Enables or disables the CSR checking.
28863
28864 @item -malign-data=@var{type}
28865 @opindex malign-data
28866 Control how GCC aligns variables and constants of array, structure, or union
28867 types. Supported values for @var{type} are @samp{xlen} which uses x register
28868 width as the alignment value, and @samp{natural} which uses natural alignment.
28869 @samp{xlen} is the default.
28870
28871 @item -mbig-endian
28872 @opindex mbig-endian
28873 Generate big-endian code. This is the default when GCC is configured for a
28874 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
28875
28876 @item -mlittle-endian
28877 @opindex mlittle-endian
28878 Generate little-endian code. This is the default when GCC is configured for a
28879 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
28880 @samp{riscv32be-*-*} target.
28881
28882 @item -mstack-protector-guard=@var{guard}
28883 @itemx -mstack-protector-guard-reg=@var{reg}
28884 @itemx -mstack-protector-guard-offset=@var{offset}
28885 @opindex mstack-protector-guard
28886 @opindex mstack-protector-guard-reg
28887 @opindex mstack-protector-guard-offset
28888 Generate stack protection code using canary at @var{guard}. Supported
28889 locations are @samp{global} for a global canary or @samp{tls} for per-thread
28890 canary in the TLS block.
28891
28892 With the latter choice the options
28893 @option{-mstack-protector-guard-reg=@var{reg}} and
28894 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28895 which register to use as base register for reading the canary,
28896 and from what offset from that base register. There is no default
28897 register or offset as this is entirely for use within the Linux
28898 kernel.
28899 @end table
28900
28901 @node RL78 Options
28902 @subsection RL78 Options
28903 @cindex RL78 Options
28904
28905 @table @gcctabopt
28906
28907 @item -msim
28908 @opindex msim
28909 Links in additional target libraries to support operation within a
28910 simulator.
28911
28912 @item -mmul=none
28913 @itemx -mmul=g10
28914 @itemx -mmul=g13
28915 @itemx -mmul=g14
28916 @itemx -mmul=rl78
28917 @opindex mmul
28918 Specifies the type of hardware multiplication and division support to
28919 be used. The simplest is @code{none}, which uses software for both
28920 multiplication and division. This is the default. The @code{g13}
28921 value is for the hardware multiply/divide peripheral found on the
28922 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
28923 the multiplication and division instructions supported by the RL78/G14
28924 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
28925 the value @code{mg10} is an alias for @code{none}.
28926
28927 In addition a C preprocessor macro is defined, based upon the setting
28928 of this option. Possible values are: @code{__RL78_MUL_NONE__},
28929 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
28930
28931 @item -mcpu=g10
28932 @itemx -mcpu=g13
28933 @itemx -mcpu=g14
28934 @itemx -mcpu=rl78
28935 @opindex mcpu
28936 Specifies the RL78 core to target. The default is the G14 core, also
28937 known as an S3 core or just RL78. The G13 or S2 core does not have
28938 multiply or divide instructions, instead it uses a hardware peripheral
28939 for these operations. The G10 or S1 core does not have register
28940 banks, so it uses a different calling convention.
28941
28942 If this option is set it also selects the type of hardware multiply
28943 support to use, unless this is overridden by an explicit
28944 @option{-mmul=none} option on the command line. Thus specifying
28945 @option{-mcpu=g13} enables the use of the G13 hardware multiply
28946 peripheral and specifying @option{-mcpu=g10} disables the use of
28947 hardware multiplications altogether.
28948
28949 Note, although the RL78/G14 core is the default target, specifying
28950 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
28951 change the behavior of the toolchain since it also enables G14
28952 hardware multiply support. If these options are not specified on the
28953 command line then software multiplication routines will be used even
28954 though the code targets the RL78 core. This is for backwards
28955 compatibility with older toolchains which did not have hardware
28956 multiply and divide support.
28957
28958 In addition a C preprocessor macro is defined, based upon the setting
28959 of this option. Possible values are: @code{__RL78_G10__},
28960 @code{__RL78_G13__} or @code{__RL78_G14__}.
28961
28962 @item -mg10
28963 @itemx -mg13
28964 @itemx -mg14
28965 @itemx -mrl78
28966 @opindex mg10
28967 @opindex mg13
28968 @opindex mg14
28969 @opindex mrl78
28970 These are aliases for the corresponding @option{-mcpu=} option. They
28971 are provided for backwards compatibility.
28972
28973 @item -mallregs
28974 @opindex mallregs
28975 Allow the compiler to use all of the available registers. By default
28976 registers @code{r24..r31} are reserved for use in interrupt handlers.
28977 With this option enabled these registers can be used in ordinary
28978 functions as well.
28979
28980 @item -m64bit-doubles
28981 @itemx -m32bit-doubles
28982 @opindex m64bit-doubles
28983 @opindex m32bit-doubles
28984 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
28985 or 32 bits (@option{-m32bit-doubles}) in size. The default is
28986 @option{-m32bit-doubles}.
28987
28988 @item -msave-mduc-in-interrupts
28989 @itemx -mno-save-mduc-in-interrupts
28990 @opindex msave-mduc-in-interrupts
28991 @opindex mno-save-mduc-in-interrupts
28992 Specifies that interrupt handler functions should preserve the
28993 MDUC registers. This is only necessary if normal code might use
28994 the MDUC registers, for example because it performs multiplication
28995 and division operations. The default is to ignore the MDUC registers
28996 as this makes the interrupt handlers faster. The target option -mg13
28997 needs to be passed for this to work as this feature is only available
28998 on the G13 target (S2 core). The MDUC registers will only be saved
28999 if the interrupt handler performs a multiplication or division
29000 operation or it calls another function.
29001
29002 @end table
29003
29004 @node RS/6000 and PowerPC Options
29005 @subsection IBM RS/6000 and PowerPC Options
29006 @cindex RS/6000 and PowerPC Options
29007 @cindex IBM RS/6000 and PowerPC Options
29008
29009 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
29010 @table @gcctabopt
29011 @item -mpowerpc-gpopt
29012 @itemx -mno-powerpc-gpopt
29013 @itemx -mpowerpc-gfxopt
29014 @itemx -mno-powerpc-gfxopt
29015 @need 800
29016 @itemx -mpowerpc64
29017 @itemx -mno-powerpc64
29018 @itemx -mmfcrf
29019 @itemx -mno-mfcrf
29020 @itemx -mpopcntb
29021 @itemx -mno-popcntb
29022 @itemx -mpopcntd
29023 @itemx -mno-popcntd
29024 @itemx -mfprnd
29025 @itemx -mno-fprnd
29026 @need 800
29027 @itemx -mcmpb
29028 @itemx -mno-cmpb
29029 @itemx -mhard-dfp
29030 @itemx -mno-hard-dfp
29031 @opindex mpowerpc-gpopt
29032 @opindex mno-powerpc-gpopt
29033 @opindex mpowerpc-gfxopt
29034 @opindex mno-powerpc-gfxopt
29035 @opindex mpowerpc64
29036 @opindex mno-powerpc64
29037 @opindex mmfcrf
29038 @opindex mno-mfcrf
29039 @opindex mpopcntb
29040 @opindex mno-popcntb
29041 @opindex mpopcntd
29042 @opindex mno-popcntd
29043 @opindex mfprnd
29044 @opindex mno-fprnd
29045 @opindex mcmpb
29046 @opindex mno-cmpb
29047 @opindex mhard-dfp
29048 @opindex mno-hard-dfp
29049 You use these options to specify which instructions are available on the
29050 processor you are using. The default value of these options is
29051 determined when configuring GCC@. Specifying the
29052 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29053 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
29054 rather than the options listed above.
29055
29056 Specifying @option{-mpowerpc-gpopt} allows
29057 GCC to use the optional PowerPC architecture instructions in the
29058 General Purpose group, including floating-point square root. Specifying
29059 @option{-mpowerpc-gfxopt} allows GCC to
29060 use the optional PowerPC architecture instructions in the Graphics
29061 group, including floating-point select.
29062
29063 The @option{-mmfcrf} option allows GCC to generate the move from
29064 condition register field instruction implemented on the POWER4
29065 processor and other processors that support the PowerPC V2.01
29066 architecture.
29067 The @option{-mpopcntb} option allows GCC to generate the popcount and
29068 double-precision FP reciprocal estimate instruction implemented on the
29069 POWER5 processor and other processors that support the PowerPC V2.02
29070 architecture.
29071 The @option{-mpopcntd} option allows GCC to generate the popcount
29072 instruction implemented on the POWER7 processor and other processors
29073 that support the PowerPC V2.06 architecture.
29074 The @option{-mfprnd} option allows GCC to generate the FP round to
29075 integer instructions implemented on the POWER5+ processor and other
29076 processors that support the PowerPC V2.03 architecture.
29077 The @option{-mcmpb} option allows GCC to generate the compare bytes
29078 instruction implemented on the POWER6 processor and other processors
29079 that support the PowerPC V2.05 architecture.
29080 The @option{-mhard-dfp} option allows GCC to generate the decimal
29081 floating-point instructions implemented on some POWER processors.
29082
29083 The @option{-mpowerpc64} option allows GCC to generate the additional
29084 64-bit instructions that are found in the full PowerPC64 architecture
29085 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
29086 @option{-mno-powerpc64}.
29087
29088 @item -mcpu=@var{cpu_type}
29089 @opindex mcpu
29090 Set architecture type, register usage, and
29091 instruction scheduling parameters for machine type @var{cpu_type}.
29092 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29093 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29094 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29095 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29096 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29097 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29098 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29099 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29100 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29101 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29102 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29103 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29104
29105 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29106 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29107 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
29108 architecture machine types, with an appropriate, generic processor
29109 model assumed for scheduling purposes.
29110
29111 Specifying @samp{native} as cpu type detects and selects the
29112 architecture option that corresponds to the host processor of the
29113 system performing the compilation.
29114 @option{-mcpu=native} has no effect if GCC does not recognize the
29115 processor.
29116
29117 The other options specify a specific processor. Code generated under
29118 those options runs best on that processor, and may not run at all on
29119 others.
29120
29121 The @option{-mcpu} options automatically enable or disable the
29122 following options:
29123
29124 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
29125 -mpopcntb -mpopcntd -mpowerpc64 @gol
29126 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
29127 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
29128 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
29129 -mquad-memory -mquad-memory-atomic -mfloat128 @gol
29130 -mfloat128-hardware -mprefixed -mpcrel -mmma @gol
29131 -mrop-protect}
29132
29133 The particular options set for any particular CPU varies between
29134 compiler versions, depending on what setting seems to produce optimal
29135 code for that CPU; it doesn't necessarily reflect the actual hardware's
29136 capabilities. If you wish to set an individual option to a particular
29137 value, you may specify it after the @option{-mcpu} option, like
29138 @option{-mcpu=970 -mno-altivec}.
29139
29140 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
29141 not enabled or disabled by the @option{-mcpu} option at present because
29142 AIX does not have full support for these options. You may still
29143 enable or disable them individually if you're sure it'll work in your
29144 environment.
29145
29146 @item -mtune=@var{cpu_type}
29147 @opindex mtune
29148 Set the instruction scheduling parameters for machine type
29149 @var{cpu_type}, but do not set the architecture type or register usage,
29150 as @option{-mcpu=@var{cpu_type}} does. The same
29151 values for @var{cpu_type} are used for @option{-mtune} as for
29152 @option{-mcpu}. If both are specified, the code generated uses the
29153 architecture and registers set by @option{-mcpu}, but the
29154 scheduling parameters set by @option{-mtune}.
29155
29156 @item -mcmodel=small
29157 @opindex mcmodel=small
29158 Generate PowerPC64 code for the small model: The TOC is limited to
29159 64k.
29160
29161 @item -mcmodel=medium
29162 @opindex mcmodel=medium
29163 Generate PowerPC64 code for the medium model: The TOC and other static
29164 data may be up to a total of 4G in size. This is the default for 64-bit
29165 Linux.
29166
29167 @item -mcmodel=large
29168 @opindex mcmodel=large
29169 Generate PowerPC64 code for the large model: The TOC may be up to 4G
29170 in size. Other data and code is only limited by the 64-bit address
29171 space.
29172
29173 @item -maltivec
29174 @itemx -mno-altivec
29175 @opindex maltivec
29176 @opindex mno-altivec
29177 Generate code that uses (does not use) AltiVec instructions, and also
29178 enable the use of built-in functions that allow more direct access to
29179 the AltiVec instruction set. You may also need to set
29180 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
29181 enhancements.
29182
29183 When @option{-maltivec} is used, the element order for AltiVec intrinsics
29184 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
29185 match array element order corresponding to the endianness of the
29186 target. That is, element zero identifies the leftmost element in a
29187 vector register when targeting a big-endian platform, and identifies
29188 the rightmost element in a vector register when targeting a
29189 little-endian platform.
29190
29191 @item -mvrsave
29192 @itemx -mno-vrsave
29193 @opindex mvrsave
29194 @opindex mno-vrsave
29195 Generate VRSAVE instructions when generating AltiVec code.
29196
29197 @item -msecure-plt
29198 @opindex msecure-plt
29199 Generate code that allows @command{ld} and @command{ld.so}
29200 to build executables and shared
29201 libraries with non-executable @code{.plt} and @code{.got} sections.
29202 This is a PowerPC
29203 32-bit SYSV ABI option.
29204
29205 @item -mbss-plt
29206 @opindex mbss-plt
29207 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
29208 fills in, and
29209 requires @code{.plt} and @code{.got}
29210 sections that are both writable and executable.
29211 This is a PowerPC 32-bit SYSV ABI option.
29212
29213 @item -misel
29214 @itemx -mno-isel
29215 @opindex misel
29216 @opindex mno-isel
29217 This switch enables or disables the generation of ISEL instructions.
29218
29219 @item -mvsx
29220 @itemx -mno-vsx
29221 @opindex mvsx
29222 @opindex mno-vsx
29223 Generate code that uses (does not use) vector/scalar (VSX)
29224 instructions, and also enable the use of built-in functions that allow
29225 more direct access to the VSX instruction set.
29226
29227 @item -mcrypto
29228 @itemx -mno-crypto
29229 @opindex mcrypto
29230 @opindex mno-crypto
29231 Enable the use (disable) of the built-in functions that allow direct
29232 access to the cryptographic instructions that were added in version
29233 2.07 of the PowerPC ISA.
29234
29235 @item -mhtm
29236 @itemx -mno-htm
29237 @opindex mhtm
29238 @opindex mno-htm
29239 Enable (disable) the use of the built-in functions that allow direct
29240 access to the Hardware Transactional Memory (HTM) instructions that
29241 were added in version 2.07 of the PowerPC ISA.
29242
29243 @item -mpower8-fusion
29244 @itemx -mno-power8-fusion
29245 @opindex mpower8-fusion
29246 @opindex mno-power8-fusion
29247 Generate code that keeps (does not keeps) some integer operations
29248 adjacent so that the instructions can be fused together on power8 and
29249 later processors.
29250
29251 @item -mpower8-vector
29252 @itemx -mno-power8-vector
29253 @opindex mpower8-vector
29254 @opindex mno-power8-vector
29255 Generate code that uses (does not use) the vector and scalar
29256 instructions that were added in version 2.07 of the PowerPC ISA. Also
29257 enable the use of built-in functions that allow more direct access to
29258 the vector instructions.
29259
29260 @item -mquad-memory
29261 @itemx -mno-quad-memory
29262 @opindex mquad-memory
29263 @opindex mno-quad-memory
29264 Generate code that uses (does not use) the non-atomic quad word memory
29265 instructions. The @option{-mquad-memory} option requires use of
29266 64-bit mode.
29267
29268 @item -mquad-memory-atomic
29269 @itemx -mno-quad-memory-atomic
29270 @opindex mquad-memory-atomic
29271 @opindex mno-quad-memory-atomic
29272 Generate code that uses (does not use) the atomic quad word memory
29273 instructions. The @option{-mquad-memory-atomic} option requires use of
29274 64-bit mode.
29275
29276 @item -mfloat128
29277 @itemx -mno-float128
29278 @opindex mfloat128
29279 @opindex mno-float128
29280 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
29281 and use either software emulation for IEEE 128-bit floating point or
29282 hardware instructions.
29283
29284 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
29285 128-bit floating point support. The IEEE 128-bit floating point is only
29286 supported on Linux.
29287
29288 The default for @option{-mfloat128} is enabled on PowerPC Linux
29289 systems using the VSX instruction set, and disabled on other systems.
29290
29291 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
29292 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
29293 point support will also enable the generation of ISA 3.0 IEEE 128-bit
29294 floating point instructions. Otherwise, if you do not specify to
29295 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
29296 system, IEEE 128-bit floating point will be done with software
29297 emulation.
29298
29299 @item -mfloat128-hardware
29300 @itemx -mno-float128-hardware
29301 @opindex mfloat128-hardware
29302 @opindex mno-float128-hardware
29303 Enable/disable using ISA 3.0 hardware instructions to support the
29304 @var{__float128} data type.
29305
29306 The default for @option{-mfloat128-hardware} is enabled on PowerPC
29307 Linux systems using the ISA 3.0 instruction set, and disabled on other
29308 systems.
29309
29310 @item -m32
29311 @itemx -m64
29312 @opindex m32
29313 @opindex m64
29314 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
29315 targets (including GNU/Linux). The 32-bit environment sets int, long
29316 and pointer to 32 bits and generates code that runs on any PowerPC
29317 variant. The 64-bit environment sets int to 32 bits and long and
29318 pointer to 64 bits, and generates code for PowerPC64, as for
29319 @option{-mpowerpc64}.
29320
29321 @item -mfull-toc
29322 @itemx -mno-fp-in-toc
29323 @itemx -mno-sum-in-toc
29324 @itemx -mminimal-toc
29325 @opindex mfull-toc
29326 @opindex mno-fp-in-toc
29327 @opindex mno-sum-in-toc
29328 @opindex mminimal-toc
29329 Modify generation of the TOC (Table Of Contents), which is created for
29330 every executable file. The @option{-mfull-toc} option is selected by
29331 default. In that case, GCC allocates at least one TOC entry for
29332 each unique non-automatic variable reference in your program. GCC
29333 also places floating-point constants in the TOC@. However, only
29334 16,384 entries are available in the TOC@.
29335
29336 If you receive a linker error message that saying you have overflowed
29337 the available TOC space, you can reduce the amount of TOC space used
29338 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
29339 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
29340 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
29341 generate code to calculate the sum of an address and a constant at
29342 run time instead of putting that sum into the TOC@. You may specify one
29343 or both of these options. Each causes GCC to produce very slightly
29344 slower and larger code at the expense of conserving TOC space.
29345
29346 If you still run out of space in the TOC even when you specify both of
29347 these options, specify @option{-mminimal-toc} instead. This option causes
29348 GCC to make only one TOC entry for every file. When you specify this
29349 option, GCC produces code that is slower and larger but which
29350 uses extremely little TOC space. You may wish to use this option
29351 only on files that contain less frequently-executed code.
29352
29353 @item -maix64
29354 @itemx -maix32
29355 @opindex maix64
29356 @opindex maix32
29357 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
29358 @code{long} type, and the infrastructure needed to support them.
29359 Specifying @option{-maix64} implies @option{-mpowerpc64},
29360 while @option{-maix32} disables the 64-bit ABI and
29361 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
29362
29363 @item -mxl-compat
29364 @itemx -mno-xl-compat
29365 @opindex mxl-compat
29366 @opindex mno-xl-compat
29367 Produce code that conforms more closely to IBM XL compiler semantics
29368 when using AIX-compatible ABI@. Pass floating-point arguments to
29369 prototyped functions beyond the register save area (RSA) on the stack
29370 in addition to argument FPRs. Do not assume that most significant
29371 double in 128-bit long double value is properly rounded when comparing
29372 values and converting to double. Use XL symbol names for long double
29373 support routines.
29374
29375 The AIX calling convention was extended but not initially documented to
29376 handle an obscure K&R C case of calling a function that takes the
29377 address of its arguments with fewer arguments than declared. IBM XL
29378 compilers access floating-point arguments that do not fit in the
29379 RSA from the stack when a subroutine is compiled without
29380 optimization. Because always storing floating-point arguments on the
29381 stack is inefficient and rarely needed, this option is not enabled by
29382 default and only is necessary when calling subroutines compiled by IBM
29383 XL compilers without optimization.
29384
29385 @item -mpe
29386 @opindex mpe
29387 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
29388 application written to use message passing with special startup code to
29389 enable the application to run. The system must have PE installed in the
29390 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
29391 must be overridden with the @option{-specs=} option to specify the
29392 appropriate directory location. The Parallel Environment does not
29393 support threads, so the @option{-mpe} option and the @option{-pthread}
29394 option are incompatible.
29395
29396 @item -malign-natural
29397 @itemx -malign-power
29398 @opindex malign-natural
29399 @opindex malign-power
29400 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
29401 @option{-malign-natural} overrides the ABI-defined alignment of larger
29402 types, such as floating-point doubles, on their natural size-based boundary.
29403 The option @option{-malign-power} instructs GCC to follow the ABI-specified
29404 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
29405
29406 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
29407 is not supported.
29408
29409 @item -msoft-float
29410 @itemx -mhard-float
29411 @opindex msoft-float
29412 @opindex mhard-float
29413 Generate code that does not use (uses) the floating-point register set.
29414 Software floating-point emulation is provided if you use the
29415 @option{-msoft-float} option, and pass the option to GCC when linking.
29416
29417 @item -mmultiple
29418 @itemx -mno-multiple
29419 @opindex mmultiple
29420 @opindex mno-multiple
29421 Generate code that uses (does not use) the load multiple word
29422 instructions and the store multiple word instructions. These
29423 instructions are generated by default on POWER systems, and not
29424 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
29425 PowerPC systems, since those instructions do not work when the
29426 processor is in little-endian mode. The exceptions are PPC740 and
29427 PPC750 which permit these instructions in little-endian mode.
29428
29429 @item -mupdate
29430 @itemx -mno-update
29431 @opindex mupdate
29432 @opindex mno-update
29433 Generate code that uses (does not use) the load or store instructions
29434 that update the base register to the address of the calculated memory
29435 location. These instructions are generated by default. If you use
29436 @option{-mno-update}, there is a small window between the time that the
29437 stack pointer is updated and the address of the previous frame is
29438 stored, which means code that walks the stack frame across interrupts or
29439 signals may get corrupted data.
29440
29441 @item -mavoid-indexed-addresses
29442 @itemx -mno-avoid-indexed-addresses
29443 @opindex mavoid-indexed-addresses
29444 @opindex mno-avoid-indexed-addresses
29445 Generate code that tries to avoid (not avoid) the use of indexed load
29446 or store instructions. These instructions can incur a performance
29447 penalty on Power6 processors in certain situations, such as when
29448 stepping through large arrays that cross a 16M boundary. This option
29449 is enabled by default when targeting Power6 and disabled otherwise.
29450
29451 @item -mfused-madd
29452 @itemx -mno-fused-madd
29453 @opindex mfused-madd
29454 @opindex mno-fused-madd
29455 Generate code that uses (does not use) the floating-point multiply and
29456 accumulate instructions. These instructions are generated by default
29457 if hardware floating point is used. The machine-dependent
29458 @option{-mfused-madd} option is now mapped to the machine-independent
29459 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29460 mapped to @option{-ffp-contract=off}.
29461
29462 @item -mmulhw
29463 @itemx -mno-mulhw
29464 @opindex mmulhw
29465 @opindex mno-mulhw
29466 Generate code that uses (does not use) the half-word multiply and
29467 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
29468 These instructions are generated by default when targeting those
29469 processors.
29470
29471 @item -mdlmzb
29472 @itemx -mno-dlmzb
29473 @opindex mdlmzb
29474 @opindex mno-dlmzb
29475 Generate code that uses (does not use) the string-search @samp{dlmzb}
29476 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
29477 generated by default when targeting those processors.
29478
29479 @item -mno-bit-align
29480 @itemx -mbit-align
29481 @opindex mno-bit-align
29482 @opindex mbit-align
29483 On System V.4 and embedded PowerPC systems do not (do) force structures
29484 and unions that contain bit-fields to be aligned to the base type of the
29485 bit-field.
29486
29487 For example, by default a structure containing nothing but 8
29488 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
29489 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
29490 the structure is aligned to a 1-byte boundary and is 1 byte in
29491 size.
29492
29493 @item -mno-strict-align
29494 @itemx -mstrict-align
29495 @opindex mno-strict-align
29496 @opindex mstrict-align
29497 On System V.4 and embedded PowerPC systems do not (do) assume that
29498 unaligned memory references are handled by the system.
29499
29500 @item -mrelocatable
29501 @itemx -mno-relocatable
29502 @opindex mrelocatable
29503 @opindex mno-relocatable
29504 Generate code that allows (does not allow) a static executable to be
29505 relocated to a different address at run time. A simple embedded
29506 PowerPC system loader should relocate the entire contents of
29507 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
29508 a table of 32-bit addresses generated by this option. For this to
29509 work, all objects linked together must be compiled with
29510 @option{-mrelocatable} or @option{-mrelocatable-lib}.
29511 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
29512
29513 @item -mrelocatable-lib
29514 @itemx -mno-relocatable-lib
29515 @opindex mrelocatable-lib
29516 @opindex mno-relocatable-lib
29517 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
29518 @code{.fixup} section to allow static executables to be relocated at
29519 run time, but @option{-mrelocatable-lib} does not use the smaller stack
29520 alignment of @option{-mrelocatable}. Objects compiled with
29521 @option{-mrelocatable-lib} may be linked with objects compiled with
29522 any combination of the @option{-mrelocatable} options.
29523
29524 @item -mno-toc
29525 @itemx -mtoc
29526 @opindex mno-toc
29527 @opindex mtoc
29528 On System V.4 and embedded PowerPC systems do not (do) assume that
29529 register 2 contains a pointer to a global area pointing to the addresses
29530 used in the program.
29531
29532 @item -mlittle
29533 @itemx -mlittle-endian
29534 @opindex mlittle
29535 @opindex mlittle-endian
29536 On System V.4 and embedded PowerPC systems compile code for the
29537 processor in little-endian mode. The @option{-mlittle-endian} option is
29538 the same as @option{-mlittle}.
29539
29540 @item -mbig
29541 @itemx -mbig-endian
29542 @opindex mbig
29543 @opindex mbig-endian
29544 On System V.4 and embedded PowerPC systems compile code for the
29545 processor in big-endian mode. The @option{-mbig-endian} option is
29546 the same as @option{-mbig}.
29547
29548 @item -mdynamic-no-pic
29549 @opindex mdynamic-no-pic
29550 On Darwin and Mac OS X systems, compile code so that it is not
29551 relocatable, but that its external references are relocatable. The
29552 resulting code is suitable for applications, but not shared
29553 libraries.
29554
29555 @item -msingle-pic-base
29556 @opindex msingle-pic-base
29557 Treat the register used for PIC addressing as read-only, rather than
29558 loading it in the prologue for each function. The runtime system is
29559 responsible for initializing this register with an appropriate value
29560 before execution begins.
29561
29562 @item -mprioritize-restricted-insns=@var{priority}
29563 @opindex mprioritize-restricted-insns
29564 This option controls the priority that is assigned to
29565 dispatch-slot restricted instructions during the second scheduling
29566 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
29567 or @samp{2} to assign no, highest, or second-highest (respectively)
29568 priority to dispatch-slot restricted
29569 instructions.
29570
29571 @item -msched-costly-dep=@var{dependence_type}
29572 @opindex msched-costly-dep
29573 This option controls which dependences are considered costly
29574 by the target during instruction scheduling. The argument
29575 @var{dependence_type} takes one of the following values:
29576
29577 @table @asis
29578 @item @samp{no}
29579 No dependence is costly.
29580
29581 @item @samp{all}
29582 All dependences are costly.
29583
29584 @item @samp{true_store_to_load}
29585 A true dependence from store to load is costly.
29586
29587 @item @samp{store_to_load}
29588 Any dependence from store to load is costly.
29589
29590 @item @var{number}
29591 Any dependence for which the latency is greater than or equal to
29592 @var{number} is costly.
29593 @end table
29594
29595 @item -minsert-sched-nops=@var{scheme}
29596 @opindex minsert-sched-nops
29597 This option controls which NOP insertion scheme is used during
29598 the second scheduling pass. The argument @var{scheme} takes one of the
29599 following values:
29600
29601 @table @asis
29602 @item @samp{no}
29603 Don't insert NOPs.
29604
29605 @item @samp{pad}
29606 Pad with NOPs any dispatch group that has vacant issue slots,
29607 according to the scheduler's grouping.
29608
29609 @item @samp{regroup_exact}
29610 Insert NOPs to force costly dependent insns into
29611 separate groups. Insert exactly as many NOPs as needed to force an insn
29612 to a new group, according to the estimated processor grouping.
29613
29614 @item @var{number}
29615 Insert NOPs to force costly dependent insns into
29616 separate groups. Insert @var{number} NOPs to force an insn to a new group.
29617 @end table
29618
29619 @item -mcall-sysv
29620 @opindex mcall-sysv
29621 On System V.4 and embedded PowerPC systems compile code using calling
29622 conventions that adhere to the March 1995 draft of the System V
29623 Application Binary Interface, PowerPC processor supplement. This is the
29624 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
29625
29626 @item -mcall-sysv-eabi
29627 @itemx -mcall-eabi
29628 @opindex mcall-sysv-eabi
29629 @opindex mcall-eabi
29630 Specify both @option{-mcall-sysv} and @option{-meabi} options.
29631
29632 @item -mcall-sysv-noeabi
29633 @opindex mcall-sysv-noeabi
29634 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
29635
29636 @item -mcall-aixdesc
29637 @opindex mcall-aixdesc
29638 On System V.4 and embedded PowerPC systems compile code for the AIX
29639 operating system.
29640
29641 @item -mcall-linux
29642 @opindex mcall-linux
29643 On System V.4 and embedded PowerPC systems compile code for the
29644 Linux-based GNU system.
29645
29646 @item -mcall-freebsd
29647 @opindex mcall-freebsd
29648 On System V.4 and embedded PowerPC systems compile code for the
29649 FreeBSD operating system.
29650
29651 @item -mcall-netbsd
29652 @opindex mcall-netbsd
29653 On System V.4 and embedded PowerPC systems compile code for the
29654 NetBSD operating system.
29655
29656 @item -mcall-openbsd
29657 @opindex mcall-openbsd
29658 On System V.4 and embedded PowerPC systems compile code for the
29659 OpenBSD operating system.
29660
29661 @item -mtraceback=@var{traceback_type}
29662 @opindex mtraceback
29663 Select the type of traceback table. Valid values for @var{traceback_type}
29664 are @samp{full}, @samp{part}, and @samp{no}.
29665
29666 @item -maix-struct-return
29667 @opindex maix-struct-return
29668 Return all structures in memory (as specified by the AIX ABI)@.
29669
29670 @item -msvr4-struct-return
29671 @opindex msvr4-struct-return
29672 Return structures smaller than 8 bytes in registers (as specified by the
29673 SVR4 ABI)@.
29674
29675 @item -mabi=@var{abi-type}
29676 @opindex mabi
29677 Extend the current ABI with a particular extension, or remove such extension.
29678 Valid values are: @samp{altivec}, @samp{no-altivec},
29679 @samp{ibmlongdouble}, @samp{ieeelongdouble},
29680 @samp{elfv1}, @samp{elfv2},
29681 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
29682
29683 @item -mabi=ibmlongdouble
29684 @opindex mabi=ibmlongdouble
29685 Change the current ABI to use IBM extended-precision long double.
29686 This is not likely to work if your system defaults to using IEEE
29687 extended-precision long double. If you change the long double type
29688 from IEEE extended-precision, the compiler will issue a warning unless
29689 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
29690 to be enabled.
29691
29692 @item -mabi=ieeelongdouble
29693 @opindex mabi=ieeelongdouble
29694 Change the current ABI to use IEEE extended-precision long double.
29695 This is not likely to work if your system defaults to using IBM
29696 extended-precision long double. If you change the long double type
29697 from IBM extended-precision, the compiler will issue a warning unless
29698 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
29699 to be enabled.
29700
29701 @item -mabi=elfv1
29702 @opindex mabi=elfv1
29703 Change the current ABI to use the ELFv1 ABI.
29704 This is the default ABI for big-endian PowerPC 64-bit Linux.
29705 Overriding the default ABI requires special system support and is
29706 likely to fail in spectacular ways.
29707
29708 @item -mabi=elfv2
29709 @opindex mabi=elfv2
29710 Change the current ABI to use the ELFv2 ABI.
29711 This is the default ABI for little-endian PowerPC 64-bit Linux.
29712 Overriding the default ABI requires special system support and is
29713 likely to fail in spectacular ways.
29714
29715 @item -mgnu-attribute
29716 @itemx -mno-gnu-attribute
29717 @opindex mgnu-attribute
29718 @opindex mno-gnu-attribute
29719 Emit .gnu_attribute assembly directives to set tag/value pairs in a
29720 .gnu.attributes section that specify ABI variations in function
29721 parameters or return values.
29722
29723 @item -mprototype
29724 @itemx -mno-prototype
29725 @opindex mprototype
29726 @opindex mno-prototype
29727 On System V.4 and embedded PowerPC systems assume that all calls to
29728 variable argument functions are properly prototyped. Otherwise, the
29729 compiler must insert an instruction before every non-prototyped call to
29730 set or clear bit 6 of the condition code register (@code{CR}) to
29731 indicate whether floating-point values are passed in the floating-point
29732 registers in case the function takes variable arguments. With
29733 @option{-mprototype}, only calls to prototyped variable argument functions
29734 set or clear the bit.
29735
29736 @item -msim
29737 @opindex msim
29738 On embedded PowerPC systems, assume that the startup module is called
29739 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
29740 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
29741 configurations.
29742
29743 @item -mmvme
29744 @opindex mmvme
29745 On embedded PowerPC systems, assume that the startup module is called
29746 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
29747 @file{libc.a}.
29748
29749 @item -mads
29750 @opindex mads
29751 On embedded PowerPC systems, assume that the startup module is called
29752 @file{crt0.o} and the standard C libraries are @file{libads.a} and
29753 @file{libc.a}.
29754
29755 @item -myellowknife
29756 @opindex myellowknife
29757 On embedded PowerPC systems, assume that the startup module is called
29758 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
29759 @file{libc.a}.
29760
29761 @item -mvxworks
29762 @opindex mvxworks
29763 On System V.4 and embedded PowerPC systems, specify that you are
29764 compiling for a VxWorks system.
29765
29766 @item -memb
29767 @opindex memb
29768 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
29769 header to indicate that @samp{eabi} extended relocations are used.
29770
29771 @item -meabi
29772 @itemx -mno-eabi
29773 @opindex meabi
29774 @opindex mno-eabi
29775 On System V.4 and embedded PowerPC systems do (do not) adhere to the
29776 Embedded Applications Binary Interface (EABI), which is a set of
29777 modifications to the System V.4 specifications. Selecting @option{-meabi}
29778 means that the stack is aligned to an 8-byte boundary, a function
29779 @code{__eabi} is called from @code{main} to set up the EABI
29780 environment, and the @option{-msdata} option can use both @code{r2} and
29781 @code{r13} to point to two separate small data areas. Selecting
29782 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
29783 no EABI initialization function is called from @code{main}, and the
29784 @option{-msdata} option only uses @code{r13} to point to a single
29785 small data area. The @option{-meabi} option is on by default if you
29786 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
29787
29788 @item -msdata=eabi
29789 @opindex msdata=eabi
29790 On System V.4 and embedded PowerPC systems, put small initialized
29791 @code{const} global and static data in the @code{.sdata2} section, which
29792 is pointed to by register @code{r2}. Put small initialized
29793 non-@code{const} global and static data in the @code{.sdata} section,
29794 which is pointed to by register @code{r13}. Put small uninitialized
29795 global and static data in the @code{.sbss} section, which is adjacent to
29796 the @code{.sdata} section. The @option{-msdata=eabi} option is
29797 incompatible with the @option{-mrelocatable} option. The
29798 @option{-msdata=eabi} option also sets the @option{-memb} option.
29799
29800 @item -msdata=sysv
29801 @opindex msdata=sysv
29802 On System V.4 and embedded PowerPC systems, put small global and static
29803 data in the @code{.sdata} section, which is pointed to by register
29804 @code{r13}. Put small uninitialized global and static data in the
29805 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
29806 The @option{-msdata=sysv} option is incompatible with the
29807 @option{-mrelocatable} option.
29808
29809 @item -msdata=default
29810 @itemx -msdata
29811 @opindex msdata=default
29812 @opindex msdata
29813 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
29814 compile code the same as @option{-msdata=eabi}, otherwise compile code the
29815 same as @option{-msdata=sysv}.
29816
29817 @item -msdata=data
29818 @opindex msdata=data
29819 On System V.4 and embedded PowerPC systems, put small global
29820 data in the @code{.sdata} section. Put small uninitialized global
29821 data in the @code{.sbss} section. Do not use register @code{r13}
29822 to address small data however. This is the default behavior unless
29823 other @option{-msdata} options are used.
29824
29825 @item -msdata=none
29826 @itemx -mno-sdata
29827 @opindex msdata=none
29828 @opindex mno-sdata
29829 On embedded PowerPC systems, put all initialized global and static data
29830 in the @code{.data} section, and all uninitialized data in the
29831 @code{.bss} section.
29832
29833 @item -mreadonly-in-sdata
29834 @opindex mreadonly-in-sdata
29835 @opindex mno-readonly-in-sdata
29836 Put read-only objects in the @code{.sdata} section as well. This is the
29837 default.
29838
29839 @item -mblock-move-inline-limit=@var{num}
29840 @opindex mblock-move-inline-limit
29841 Inline all block moves (such as calls to @code{memcpy} or structure
29842 copies) less than or equal to @var{num} bytes. The minimum value for
29843 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
29844 targets. The default value is target-specific.
29845
29846 @item -mblock-compare-inline-limit=@var{num}
29847 @opindex mblock-compare-inline-limit
29848 Generate non-looping inline code for all block compares (such as calls
29849 to @code{memcmp} or structure compares) less than or equal to @var{num}
29850 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
29851 block compare is disabled. The default value is target-specific.
29852
29853 @item -mblock-compare-inline-loop-limit=@var{num}
29854 @opindex mblock-compare-inline-loop-limit
29855 Generate an inline expansion using loop code for all block compares that
29856 are less than or equal to @var{num} bytes, but greater than the limit
29857 for non-loop inline block compare expansion. If the block length is not
29858 constant, at most @var{num} bytes will be compared before @code{memcmp}
29859 is called to compare the remainder of the block. The default value is
29860 target-specific.
29861
29862 @item -mstring-compare-inline-limit=@var{num}
29863 @opindex mstring-compare-inline-limit
29864 Compare at most @var{num} string bytes with inline code.
29865 If the difference or end of string is not found at the
29866 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
29867 take care of the rest of the comparison. The default is 64 bytes.
29868
29869 @item -G @var{num}
29870 @opindex G
29871 @cindex smaller data references (PowerPC)
29872 @cindex .sdata/.sdata2 references (PowerPC)
29873 On embedded PowerPC systems, put global and static items less than or
29874 equal to @var{num} bytes into the small data or BSS sections instead of
29875 the normal data or BSS section. By default, @var{num} is 8. The
29876 @option{-G @var{num}} switch is also passed to the linker.
29877 All modules should be compiled with the same @option{-G @var{num}} value.
29878
29879 @item -mregnames
29880 @itemx -mno-regnames
29881 @opindex mregnames
29882 @opindex mno-regnames
29883 On System V.4 and embedded PowerPC systems do (do not) emit register
29884 names in the assembly language output using symbolic forms.
29885
29886 @item -mlongcall
29887 @itemx -mno-longcall
29888 @opindex mlongcall
29889 @opindex mno-longcall
29890 By default assume that all calls are far away so that a longer and more
29891 expensive calling sequence is required. This is required for calls
29892 farther than 32 megabytes (33,554,432 bytes) from the current location.
29893 A short call is generated if the compiler knows
29894 the call cannot be that far away. This setting can be overridden by
29895 the @code{shortcall} function attribute, or by @code{#pragma
29896 longcall(0)}.
29897
29898 Some linkers are capable of detecting out-of-range calls and generating
29899 glue code on the fly. On these systems, long calls are unnecessary and
29900 generate slower code. As of this writing, the AIX linker can do this,
29901 as can the GNU linker for PowerPC/64. It is planned to add this feature
29902 to the GNU linker for 32-bit PowerPC systems as well.
29903
29904 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
29905 GCC can generate long calls using an inline PLT call sequence (see
29906 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
29907 ELFv1 (big-endian) do not support inline PLT calls.
29908
29909 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
29910 callee, L42}, plus a @dfn{branch island} (glue code). The two target
29911 addresses represent the callee and the branch island. The
29912 Darwin/PPC linker prefers the first address and generates a @code{bl
29913 callee} if the PPC @code{bl} instruction reaches the callee directly;
29914 otherwise, the linker generates @code{bl L42} to call the branch
29915 island. The branch island is appended to the body of the
29916 calling function; it computes the full 32-bit address of the callee
29917 and jumps to it.
29918
29919 On Mach-O (Darwin) systems, this option directs the compiler emit to
29920 the glue for every direct call, and the Darwin linker decides whether
29921 to use or discard it.
29922
29923 In the future, GCC may ignore all longcall specifications
29924 when the linker is known to generate glue.
29925
29926 @item -mpltseq
29927 @itemx -mno-pltseq
29928 @opindex mpltseq
29929 @opindex mno-pltseq
29930 Implement (do not implement) -fno-plt and long calls using an inline
29931 PLT call sequence that supports lazy linking and long calls to
29932 functions in dlopen'd shared libraries. Inline PLT calls are only
29933 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
29934 linkers, and are enabled by default if the support is detected when
29935 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
29936 configured with @option{--enable-secureplt}. @option{-mpltseq} code
29937 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
29938 linked together.
29939
29940 @item -mtls-markers
29941 @itemx -mno-tls-markers
29942 @opindex mtls-markers
29943 @opindex mno-tls-markers
29944 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
29945 specifying the function argument. The relocation allows the linker to
29946 reliably associate function call with argument setup instructions for
29947 TLS optimization, which in turn allows GCC to better schedule the
29948 sequence.
29949
29950 @item -mrecip
29951 @itemx -mno-recip
29952 @opindex mrecip
29953 This option enables use of the reciprocal estimate and
29954 reciprocal square root estimate instructions with additional
29955 Newton-Raphson steps to increase precision instead of doing a divide or
29956 square root and divide for floating-point arguments. You should use
29957 the @option{-ffast-math} option when using @option{-mrecip} (or at
29958 least @option{-funsafe-math-optimizations},
29959 @option{-ffinite-math-only}, @option{-freciprocal-math} and
29960 @option{-fno-trapping-math}). Note that while the throughput of the
29961 sequence is generally higher than the throughput of the non-reciprocal
29962 instruction, the precision of the sequence can be decreased by up to 2
29963 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
29964 roots.
29965
29966 @item -mrecip=@var{opt}
29967 @opindex mrecip=opt
29968 This option controls which reciprocal estimate instructions
29969 may be used. @var{opt} is a comma-separated list of options, which may
29970 be preceded by a @code{!} to invert the option:
29971
29972 @table @samp
29973
29974 @item all
29975 Enable all estimate instructions.
29976
29977 @item default
29978 Enable the default instructions, equivalent to @option{-mrecip}.
29979
29980 @item none
29981 Disable all estimate instructions, equivalent to @option{-mno-recip}.
29982
29983 @item div
29984 Enable the reciprocal approximation instructions for both
29985 single and double precision.
29986
29987 @item divf
29988 Enable the single-precision reciprocal approximation instructions.
29989
29990 @item divd
29991 Enable the double-precision reciprocal approximation instructions.
29992
29993 @item rsqrt
29994 Enable the reciprocal square root approximation instructions for both
29995 single and double precision.
29996
29997 @item rsqrtf
29998 Enable the single-precision reciprocal square root approximation instructions.
29999
30000 @item rsqrtd
30001 Enable the double-precision reciprocal square root approximation instructions.
30002
30003 @end table
30004
30005 So, for example, @option{-mrecip=all,!rsqrtd} enables
30006 all of the reciprocal estimate instructions, except for the
30007 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
30008 which handle the double-precision reciprocal square root calculations.
30009
30010 @item -mrecip-precision
30011 @itemx -mno-recip-precision
30012 @opindex mrecip-precision
30013 Assume (do not assume) that the reciprocal estimate instructions
30014 provide higher-precision estimates than is mandated by the PowerPC
30015 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
30016 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
30017 The double-precision square root estimate instructions are not generated by
30018 default on low-precision machines, since they do not provide an
30019 estimate that converges after three steps.
30020
30021 @item -mveclibabi=@var{type}
30022 @opindex mveclibabi
30023 Specifies the ABI type to use for vectorizing intrinsics using an
30024 external library. The only type supported at present is @samp{mass},
30025 which specifies to use IBM's Mathematical Acceleration Subsystem
30026 (MASS) libraries for vectorizing intrinsics using external libraries.
30027 GCC currently emits calls to @code{acosd2}, @code{acosf4},
30028 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
30029 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
30030 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
30031 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
30032 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
30033 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
30034 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
30035 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
30036 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
30037 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
30038 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
30039 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
30040 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30041 for power7. Both @option{-ftree-vectorize} and
30042 @option{-funsafe-math-optimizations} must also be enabled. The MASS
30043 libraries must be specified at link time.
30044
30045 @item -mfriz
30046 @itemx -mno-friz
30047 @opindex mfriz
30048 Generate (do not generate) the @code{friz} instruction when the
30049 @option{-funsafe-math-optimizations} option is used to optimize
30050 rounding of floating-point values to 64-bit integer and back to floating
30051 point. The @code{friz} instruction does not return the same value if
30052 the floating-point number is too large to fit in an integer.
30053
30054 @item -mpointers-to-nested-functions
30055 @itemx -mno-pointers-to-nested-functions
30056 @opindex mpointers-to-nested-functions
30057 Generate (do not generate) code to load up the static chain register
30058 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30059 systems where a function pointer points to a 3-word descriptor giving
30060 the function address, TOC value to be loaded in register @code{r2}, and
30061 static chain value to be loaded in register @code{r11}. The
30062 @option{-mpointers-to-nested-functions} is on by default. You cannot
30063 call through pointers to nested functions or pointers
30064 to functions compiled in other languages that use the static chain if
30065 you use @option{-mno-pointers-to-nested-functions}.
30066
30067 @item -msave-toc-indirect
30068 @itemx -mno-save-toc-indirect
30069 @opindex msave-toc-indirect
30070 Generate (do not generate) code to save the TOC value in the reserved
30071 stack location in the function prologue if the function calls through
30072 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
30073 saved in the prologue, it is saved just before the call through the
30074 pointer. The @option{-mno-save-toc-indirect} option is the default.
30075
30076 @item -mcompat-align-parm
30077 @itemx -mno-compat-align-parm
30078 @opindex mcompat-align-parm
30079 Generate (do not generate) code to pass structure parameters with a
30080 maximum alignment of 64 bits, for compatibility with older versions
30081 of GCC.
30082
30083 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30084 structure parameter on a 128-bit boundary when that structure contained
30085 a member requiring 128-bit alignment. This is corrected in more
30086 recent versions of GCC. This option may be used to generate code
30087 that is compatible with functions compiled with older versions of
30088 GCC.
30089
30090 The @option{-mno-compat-align-parm} option is the default.
30091
30092 @item -mstack-protector-guard=@var{guard}
30093 @itemx -mstack-protector-guard-reg=@var{reg}
30094 @itemx -mstack-protector-guard-offset=@var{offset}
30095 @itemx -mstack-protector-guard-symbol=@var{symbol}
30096 @opindex mstack-protector-guard
30097 @opindex mstack-protector-guard-reg
30098 @opindex mstack-protector-guard-offset
30099 @opindex mstack-protector-guard-symbol
30100 Generate stack protection code using canary at @var{guard}. Supported
30101 locations are @samp{global} for global canary or @samp{tls} for per-thread
30102 canary in the TLS block (the default with GNU libc version 2.4 or later).
30103
30104 With the latter choice the options
30105 @option{-mstack-protector-guard-reg=@var{reg}} and
30106 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30107 which register to use as base register for reading the canary, and from what
30108 offset from that base register. The default for those is as specified in the
30109 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
30110 the offset with a symbol reference to a canary in the TLS block.
30111
30112 @item -mpcrel
30113 @itemx -mno-pcrel
30114 @opindex mpcrel
30115 @opindex mno-pcrel
30116 Generate (do not generate) pc-relative addressing. The @option{-mpcrel}
30117 option requires that the medium code model (@option{-mcmodel=medium})
30118 and prefixed addressing (@option{-mprefixed}) options are enabled.
30119
30120 @item -mprefixed
30121 @itemx -mno-prefixed
30122 @opindex mprefixed
30123 @opindex mno-prefixed
30124 Generate (do not generate) addressing modes using prefixed load and
30125 store instructions. The @option{-mprefixed} option requires that
30126 the option @option{-mcpu=power10} (or later) is enabled.
30127
30128 @item -mmma
30129 @itemx -mno-mma
30130 @opindex mmma
30131 @opindex mno-mma
30132 Generate (do not generate) the MMA instructions. The @option{-mma}
30133 option requires that the option @option{-mcpu=power10} (or later)
30134 is enabled.
30135
30136 @item -mrop-protect
30137 @itemx -mno-rop-protect
30138 @opindex mrop-protect
30139 @opindex mno-rop-protect
30140 Generate (do not generate) ROP protection instructions when the target
30141 processor supports them. Currently this option disables the shrink-wrap
30142 optimization (@option{-fshrink-wrap}).
30143
30144 @item -mprivileged
30145 @itemx -mno-privileged
30146 @opindex mprivileged
30147 @opindex mno-privileged
30148 Generate (do not generate) code that will run in privileged state.
30149
30150 @item -mblock-ops-unaligned-vsx
30151 @itemx -mno-block-ops-unaligned-vsx
30152 @opindex block-ops-unaligned-vsx
30153 @opindex no-block-ops-unaligned-vsx
30154 Generate (do not generate) unaligned vsx loads and stores for
30155 inline expansion of @code{memcpy} and @code{memmove}.
30156
30157 @item --param rs6000-vect-unroll-limit=
30158 The vectorizer will check with target information to determine whether it
30159 would be beneficial to unroll the main vectorized loop and by how much. This
30160 parameter sets the upper bound of how much the vectorizer will unroll the main
30161 loop. The default value is four.
30162
30163 @end table
30164
30165 @node RX Options
30166 @subsection RX Options
30167 @cindex RX Options
30168
30169 These command-line options are defined for RX targets:
30170
30171 @table @gcctabopt
30172 @item -m64bit-doubles
30173 @itemx -m32bit-doubles
30174 @opindex m64bit-doubles
30175 @opindex m32bit-doubles
30176 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30177 or 32 bits (@option{-m32bit-doubles}) in size. The default is
30178 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
30179 works on 32-bit values, which is why the default is
30180 @option{-m32bit-doubles}.
30181
30182 @item -fpu
30183 @itemx -nofpu
30184 @opindex fpu
30185 @opindex nofpu
30186 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
30187 floating-point hardware. The default is enabled for the RX600
30188 series and disabled for the RX200 series.
30189
30190 Floating-point instructions are only generated for 32-bit floating-point
30191 values, however, so the FPU hardware is not used for doubles if the
30192 @option{-m64bit-doubles} option is used.
30193
30194 @emph{Note} If the @option{-fpu} option is enabled then
30195 @option{-funsafe-math-optimizations} is also enabled automatically.
30196 This is because the RX FPU instructions are themselves unsafe.
30197
30198 @item -mcpu=@var{name}
30199 @opindex mcpu
30200 Selects the type of RX CPU to be targeted. Currently three types are
30201 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
30202 the specific @samp{RX610} CPU. The default is @samp{RX600}.
30203
30204 The only difference between @samp{RX600} and @samp{RX610} is that the
30205 @samp{RX610} does not support the @code{MVTIPL} instruction.
30206
30207 The @samp{RX200} series does not have a hardware floating-point unit
30208 and so @option{-nofpu} is enabled by default when this type is
30209 selected.
30210
30211 @item -mbig-endian-data
30212 @itemx -mlittle-endian-data
30213 @opindex mbig-endian-data
30214 @opindex mlittle-endian-data
30215 Store data (but not code) in the big-endian format. The default is
30216 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
30217 format.
30218
30219 @item -msmall-data-limit=@var{N}
30220 @opindex msmall-data-limit
30221 Specifies the maximum size in bytes of global and static variables
30222 which can be placed into the small data area. Using the small data
30223 area can lead to smaller and faster code, but the size of area is
30224 limited and it is up to the programmer to ensure that the area does
30225 not overflow. Also when the small data area is used one of the RX's
30226 registers (usually @code{r13}) is reserved for use pointing to this
30227 area, so it is no longer available for use by the compiler. This
30228 could result in slower and/or larger code if variables are pushed onto
30229 the stack instead of being held in this register.
30230
30231 Note, common variables (variables that have not been initialized) and
30232 constants are not placed into the small data area as they are assigned
30233 to other sections in the output executable.
30234
30235 The default value is zero, which disables this feature. Note, this
30236 feature is not enabled by default with higher optimization levels
30237 (@option{-O2} etc) because of the potentially detrimental effects of
30238 reserving a register. It is up to the programmer to experiment and
30239 discover whether this feature is of benefit to their program. See the
30240 description of the @option{-mpid} option for a description of how the
30241 actual register to hold the small data area pointer is chosen.
30242
30243 @item -msim
30244 @itemx -mno-sim
30245 @opindex msim
30246 @opindex mno-sim
30247 Use the simulator runtime. The default is to use the libgloss
30248 board-specific runtime.
30249
30250 @item -mas100-syntax
30251 @itemx -mno-as100-syntax
30252 @opindex mas100-syntax
30253 @opindex mno-as100-syntax
30254 When generating assembler output use a syntax that is compatible with
30255 Renesas's AS100 assembler. This syntax can also be handled by the GAS
30256 assembler, but it has some restrictions so it is not generated by default.
30257
30258 @item -mmax-constant-size=@var{N}
30259 @opindex mmax-constant-size
30260 Specifies the maximum size, in bytes, of a constant that can be used as
30261 an operand in a RX instruction. Although the RX instruction set does
30262 allow constants of up to 4 bytes in length to be used in instructions,
30263 a longer value equates to a longer instruction. Thus in some
30264 circumstances it can be beneficial to restrict the size of constants
30265 that are used in instructions. Constants that are too big are instead
30266 placed into a constant pool and referenced via register indirection.
30267
30268 The value @var{N} can be between 0 and 4. A value of 0 (the default)
30269 or 4 means that constants of any size are allowed.
30270
30271 @item -mrelax
30272 @opindex mrelax
30273 Enable linker relaxation. Linker relaxation is a process whereby the
30274 linker attempts to reduce the size of a program by finding shorter
30275 versions of various instructions. Disabled by default.
30276
30277 @item -mint-register=@var{N}
30278 @opindex mint-register
30279 Specify the number of registers to reserve for fast interrupt handler
30280 functions. The value @var{N} can be between 0 and 4. A value of 1
30281 means that register @code{r13} is reserved for the exclusive use
30282 of fast interrupt handlers. A value of 2 reserves @code{r13} and
30283 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
30284 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
30285 A value of 0, the default, does not reserve any registers.
30286
30287 @item -msave-acc-in-interrupts
30288 @opindex msave-acc-in-interrupts
30289 Specifies that interrupt handler functions should preserve the
30290 accumulator register. This is only necessary if normal code might use
30291 the accumulator register, for example because it performs 64-bit
30292 multiplications. The default is to ignore the accumulator as this
30293 makes the interrupt handlers faster.
30294
30295 @item -mpid
30296 @itemx -mno-pid
30297 @opindex mpid
30298 @opindex mno-pid
30299 Enables the generation of position independent data. When enabled any
30300 access to constant data is done via an offset from a base address
30301 held in a register. This allows the location of constant data to be
30302 determined at run time without requiring the executable to be
30303 relocated, which is a benefit to embedded applications with tight
30304 memory constraints. Data that can be modified is not affected by this
30305 option.
30306
30307 Note, using this feature reserves a register, usually @code{r13}, for
30308 the constant data base address. This can result in slower and/or
30309 larger code, especially in complicated functions.
30310
30311 The actual register chosen to hold the constant data base address
30312 depends upon whether the @option{-msmall-data-limit} and/or the
30313 @option{-mint-register} command-line options are enabled. Starting
30314 with register @code{r13} and proceeding downwards, registers are
30315 allocated first to satisfy the requirements of @option{-mint-register},
30316 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
30317 is possible for the small data area register to be @code{r8} if both
30318 @option{-mint-register=4} and @option{-mpid} are specified on the
30319 command line.
30320
30321 By default this feature is not enabled. The default can be restored
30322 via the @option{-mno-pid} command-line option.
30323
30324 @item -mno-warn-multiple-fast-interrupts
30325 @itemx -mwarn-multiple-fast-interrupts
30326 @opindex mno-warn-multiple-fast-interrupts
30327 @opindex mwarn-multiple-fast-interrupts
30328 Prevents GCC from issuing a warning message if it finds more than one
30329 fast interrupt handler when it is compiling a file. The default is to
30330 issue a warning for each extra fast interrupt handler found, as the RX
30331 only supports one such interrupt.
30332
30333 @item -mallow-string-insns
30334 @itemx -mno-allow-string-insns
30335 @opindex mallow-string-insns
30336 @opindex mno-allow-string-insns
30337 Enables or disables the use of the string manipulation instructions
30338 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
30339 @code{SWHILE} and also the @code{RMPA} instruction. These
30340 instructions may prefetch data, which is not safe to do if accessing
30341 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
30342 for more information).
30343
30344 The default is to allow these instructions, but it is not possible for
30345 GCC to reliably detect all circumstances where a string instruction
30346 might be used to access an I/O register, so their use cannot be
30347 disabled automatically. Instead it is reliant upon the programmer to
30348 use the @option{-mno-allow-string-insns} option if their program
30349 accesses I/O space.
30350
30351 When the instructions are enabled GCC defines the C preprocessor
30352 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
30353 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
30354
30355 @item -mjsr
30356 @itemx -mno-jsr
30357 @opindex mjsr
30358 @opindex mno-jsr
30359 Use only (or not only) @code{JSR} instructions to access functions.
30360 This option can be used when code size exceeds the range of @code{BSR}
30361 instructions. Note that @option{-mno-jsr} does not mean to not use
30362 @code{JSR} but instead means that any type of branch may be used.
30363 @end table
30364
30365 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
30366 has special significance to the RX port when used with the
30367 @code{interrupt} function attribute. This attribute indicates a
30368 function intended to process fast interrupts. GCC ensures
30369 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
30370 and/or @code{r13} and only provided that the normal use of the
30371 corresponding registers have been restricted via the
30372 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
30373 options.
30374
30375 @node S/390 and zSeries Options
30376 @subsection S/390 and zSeries Options
30377 @cindex S/390 and zSeries Options
30378
30379 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
30380
30381 @table @gcctabopt
30382 @item -mhard-float
30383 @itemx -msoft-float
30384 @opindex mhard-float
30385 @opindex msoft-float
30386 Use (do not use) the hardware floating-point instructions and registers
30387 for floating-point operations. When @option{-msoft-float} is specified,
30388 functions in @file{libgcc.a} are used to perform floating-point
30389 operations. When @option{-mhard-float} is specified, the compiler
30390 generates IEEE floating-point instructions. This is the default.
30391
30392 @item -mhard-dfp
30393 @itemx -mno-hard-dfp
30394 @opindex mhard-dfp
30395 @opindex mno-hard-dfp
30396 Use (do not use) the hardware decimal-floating-point instructions for
30397 decimal-floating-point operations. When @option{-mno-hard-dfp} is
30398 specified, functions in @file{libgcc.a} are used to perform
30399 decimal-floating-point operations. When @option{-mhard-dfp} is
30400 specified, the compiler generates decimal-floating-point hardware
30401 instructions. This is the default for @option{-march=z9-ec} or higher.
30402
30403 @item -mlong-double-64
30404 @itemx -mlong-double-128
30405 @opindex mlong-double-64
30406 @opindex mlong-double-128
30407 These switches control the size of @code{long double} type. A size
30408 of 64 bits makes the @code{long double} type equivalent to the @code{double}
30409 type. This is the default.
30410
30411 @item -mbackchain
30412 @itemx -mno-backchain
30413 @opindex mbackchain
30414 @opindex mno-backchain
30415 Store (do not store) the address of the caller's frame as backchain pointer
30416 into the callee's stack frame.
30417 A backchain may be needed to allow debugging using tools that do not understand
30418 DWARF call frame information.
30419 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
30420 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
30421 the backchain is placed into the topmost word of the 96/160 byte register
30422 save area.
30423
30424 In general, code compiled with @option{-mbackchain} is call-compatible with
30425 code compiled with @option{-mno-backchain}; however, use of the backchain
30426 for debugging purposes usually requires that the whole binary is built with
30427 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
30428 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
30429 to build a linux kernel use @option{-msoft-float}.
30430
30431 The default is to not maintain the backchain.
30432
30433 @item -mpacked-stack
30434 @itemx -mno-packed-stack
30435 @opindex mpacked-stack
30436 @opindex mno-packed-stack
30437 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
30438 specified, the compiler uses the all fields of the 96/160 byte register save
30439 area only for their default purpose; unused fields still take up stack space.
30440 When @option{-mpacked-stack} is specified, register save slots are densely
30441 packed at the top of the register save area; unused space is reused for other
30442 purposes, allowing for more efficient use of the available stack space.
30443 However, when @option{-mbackchain} is also in effect, the topmost word of
30444 the save area is always used to store the backchain, and the return address
30445 register is always saved two words below the backchain.
30446
30447 As long as the stack frame backchain is not used, code generated with
30448 @option{-mpacked-stack} is call-compatible with code generated with
30449 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
30450 S/390 or zSeries generated code that uses the stack frame backchain at run
30451 time, not just for debugging purposes. Such code is not call-compatible
30452 with code compiled with @option{-mpacked-stack}. Also, note that the
30453 combination of @option{-mbackchain},
30454 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
30455 to build a linux kernel use @option{-msoft-float}.
30456
30457 The default is to not use the packed stack layout.
30458
30459 @item -msmall-exec
30460 @itemx -mno-small-exec
30461 @opindex msmall-exec
30462 @opindex mno-small-exec
30463 Generate (or do not generate) code using the @code{bras} instruction
30464 to do subroutine calls.
30465 This only works reliably if the total executable size does not
30466 exceed 64k. The default is to use the @code{basr} instruction instead,
30467 which does not have this limitation.
30468
30469 @item -m64
30470 @itemx -m31
30471 @opindex m64
30472 @opindex m31
30473 When @option{-m31} is specified, generate code compliant to the
30474 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
30475 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
30476 particular to generate 64-bit instructions. For the @samp{s390}
30477 targets, the default is @option{-m31}, while the @samp{s390x}
30478 targets default to @option{-m64}.
30479
30480 @item -mzarch
30481 @itemx -mesa
30482 @opindex mzarch
30483 @opindex mesa
30484 When @option{-mzarch} is specified, generate code using the
30485 instructions available on z/Architecture.
30486 When @option{-mesa} is specified, generate code using the
30487 instructions available on ESA/390. Note that @option{-mesa} is
30488 not possible with @option{-m64}.
30489 When generating code compliant to the GNU/Linux for S/390 ABI,
30490 the default is @option{-mesa}. When generating code compliant
30491 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
30492
30493 @item -mhtm
30494 @itemx -mno-htm
30495 @opindex mhtm
30496 @opindex mno-htm
30497 The @option{-mhtm} option enables a set of builtins making use of
30498 instructions available with the transactional execution facility
30499 introduced with the IBM zEnterprise EC12 machine generation
30500 @ref{S/390 System z Built-in Functions}.
30501 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
30502
30503 @item -mvx
30504 @itemx -mno-vx
30505 @opindex mvx
30506 @opindex mno-vx
30507 When @option{-mvx} is specified, generate code using the instructions
30508 available with the vector extension facility introduced with the IBM
30509 z13 machine generation.
30510 This option changes the ABI for some vector type values with regard to
30511 alignment and calling conventions. In case vector type values are
30512 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
30513 command will be added to mark the resulting binary with the ABI used.
30514 @option{-mvx} is enabled by default when using @option{-march=z13}.
30515
30516 @item -mzvector
30517 @itemx -mno-zvector
30518 @opindex mzvector
30519 @opindex mno-zvector
30520 The @option{-mzvector} option enables vector language extensions and
30521 builtins using instructions available with the vector extension
30522 facility introduced with the IBM z13 machine generation.
30523 This option adds support for @samp{vector} to be used as a keyword to
30524 define vector type variables and arguments. @samp{vector} is only
30525 available when GNU extensions are enabled. It will not be expanded
30526 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
30527 In addition to the GCC low-level builtins @option{-mzvector} enables
30528 a set of builtins added for compatibility with AltiVec-style
30529 implementations like Power and Cell. In order to make use of these
30530 builtins the header file @file{vecintrin.h} needs to be included.
30531 @option{-mzvector} is disabled by default.
30532
30533 @item -mmvcle
30534 @itemx -mno-mvcle
30535 @opindex mmvcle
30536 @opindex mno-mvcle
30537 Generate (or do not generate) code using the @code{mvcle} instruction
30538 to perform block moves. When @option{-mno-mvcle} is specified,
30539 use a @code{mvc} loop instead. This is the default unless optimizing for
30540 size.
30541
30542 @item -mdebug
30543 @itemx -mno-debug
30544 @opindex mdebug
30545 @opindex mno-debug
30546 Print (or do not print) additional debug information when compiling.
30547 The default is to not print debug information.
30548
30549 @item -march=@var{cpu-type}
30550 @opindex march
30551 Generate code that runs on @var{cpu-type}, which is the name of a
30552 system representing a certain processor type. Possible values for
30553 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
30554 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
30555 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
30556 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
30557 @samp{z16}/@samp{arch14}, and @samp{native}.
30558
30559 The default is @option{-march=z900}.
30560
30561 Specifying @samp{native} as cpu type can be used to select the best
30562 architecture option for the host processor.
30563 @option{-march=native} has no effect if GCC does not recognize the
30564 processor.
30565
30566 @item -mtune=@var{cpu-type}
30567 @opindex mtune
30568 Tune to @var{cpu-type} everything applicable about the generated code,
30569 except for the ABI and the set of available instructions.
30570 The list of @var{cpu-type} values is the same as for @option{-march}.
30571 The default is the value used for @option{-march}.
30572
30573 @item -mtpf-trace
30574 @itemx -mno-tpf-trace
30575 @opindex mtpf-trace
30576 @opindex mno-tpf-trace
30577 Generate code that adds (does not add) in TPF OS specific branches to trace
30578 routines in the operating system. This option is off by default, even
30579 when compiling for the TPF OS@.
30580
30581 @item -mtpf-trace-skip
30582 @itemx -mno-tpf-trace-skip
30583 @opindex mtpf-trace-skip
30584 @opindex mno-tpf-trace-skip
30585 Generate code that changes (does not change) the default branch
30586 targets enabled by @option{-mtpf-trace} to point to specialized trace
30587 routines providing the ability of selectively skipping function trace
30588 entries for the TPF OS. This option is off by default, even when
30589 compiling for the TPF OS and specifying @option{-mtpf-trace}.
30590
30591 @item -mfused-madd
30592 @itemx -mno-fused-madd
30593 @opindex mfused-madd
30594 @opindex mno-fused-madd
30595 Generate code that uses (does not use) the floating-point multiply and
30596 accumulate instructions. These instructions are generated by default if
30597 hardware floating point is used.
30598
30599 @item -mwarn-framesize=@var{framesize}
30600 @opindex mwarn-framesize
30601 Emit a warning if the current function exceeds the given frame size. Because
30602 this is a compile-time check it doesn't need to be a real problem when the program
30603 runs. It is intended to identify functions that most probably cause
30604 a stack overflow. It is useful to be used in an environment with limited stack
30605 size e.g.@: the linux kernel.
30606
30607 @item -mwarn-dynamicstack
30608 @opindex mwarn-dynamicstack
30609 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
30610 arrays. This is generally a bad idea with a limited stack size.
30611
30612 @item -mstack-guard=@var{stack-guard}
30613 @itemx -mstack-size=@var{stack-size}
30614 @opindex mstack-guard
30615 @opindex mstack-size
30616 If these options are provided the S/390 back end emits additional instructions in
30617 the function prologue that trigger a trap if the stack size is @var{stack-guard}
30618 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
30619 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
30620 the frame size of the compiled function is chosen.
30621 These options are intended to be used to help debugging stack overflow problems.
30622 The additionally emitted code causes only little overhead and hence can also be
30623 used in production-like systems without greater performance degradation. The given
30624 values have to be exact powers of 2 and @var{stack-size} has to be greater than
30625 @var{stack-guard} without exceeding 64k.
30626 In order to be efficient the extra code makes the assumption that the stack starts
30627 at an address aligned to the value given by @var{stack-size}.
30628 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
30629
30630 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
30631 @opindex mhotpatch
30632 If the hotpatch option is enabled, a ``hot-patching'' function
30633 prologue is generated for all functions in the compilation unit.
30634 The funtion label is prepended with the given number of two-byte
30635 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
30636 the label, 2 * @var{post-halfwords} bytes are appended, using the
30637 largest NOP like instructions the architecture allows (maximum
30638 1000000).
30639
30640 If both arguments are zero, hotpatching is disabled.
30641
30642 This option can be overridden for individual functions with the
30643 @code{hotpatch} attribute.
30644 @end table
30645
30646 @node SH Options
30647 @subsection SH Options
30648
30649 These @samp{-m} options are defined for the SH implementations:
30650
30651 @table @gcctabopt
30652 @item -m1
30653 @opindex m1
30654 Generate code for the SH1.
30655
30656 @item -m2
30657 @opindex m2
30658 Generate code for the SH2.
30659
30660 @item -m2e
30661 Generate code for the SH2e.
30662
30663 @item -m2a-nofpu
30664 @opindex m2a-nofpu
30665 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
30666 that the floating-point unit is not used.
30667
30668 @item -m2a-single-only
30669 @opindex m2a-single-only
30670 Generate code for the SH2a-FPU, in such a way that no double-precision
30671 floating-point operations are used.
30672
30673 @item -m2a-single
30674 @opindex m2a-single
30675 Generate code for the SH2a-FPU assuming the floating-point unit is in
30676 single-precision mode by default.
30677
30678 @item -m2a
30679 @opindex m2a
30680 Generate code for the SH2a-FPU assuming the floating-point unit is in
30681 double-precision mode by default.
30682
30683 @item -m3
30684 @opindex m3
30685 Generate code for the SH3.
30686
30687 @item -m3e
30688 @opindex m3e
30689 Generate code for the SH3e.
30690
30691 @item -m4-nofpu
30692 @opindex m4-nofpu
30693 Generate code for the SH4 without a floating-point unit.
30694
30695 @item -m4-single-only
30696 @opindex m4-single-only
30697 Generate code for the SH4 with a floating-point unit that only
30698 supports single-precision arithmetic.
30699
30700 @item -m4-single
30701 @opindex m4-single
30702 Generate code for the SH4 assuming the floating-point unit is in
30703 single-precision mode by default.
30704
30705 @item -m4
30706 @opindex m4
30707 Generate code for the SH4.
30708
30709 @item -m4-100
30710 @opindex m4-100
30711 Generate code for SH4-100.
30712
30713 @item -m4-100-nofpu
30714 @opindex m4-100-nofpu
30715 Generate code for SH4-100 in such a way that the
30716 floating-point unit is not used.
30717
30718 @item -m4-100-single
30719 @opindex m4-100-single
30720 Generate code for SH4-100 assuming the floating-point unit is in
30721 single-precision mode by default.
30722
30723 @item -m4-100-single-only
30724 @opindex m4-100-single-only
30725 Generate code for SH4-100 in such a way that no double-precision
30726 floating-point operations are used.
30727
30728 @item -m4-200
30729 @opindex m4-200
30730 Generate code for SH4-200.
30731
30732 @item -m4-200-nofpu
30733 @opindex m4-200-nofpu
30734 Generate code for SH4-200 without in such a way that the
30735 floating-point unit is not used.
30736
30737 @item -m4-200-single
30738 @opindex m4-200-single
30739 Generate code for SH4-200 assuming the floating-point unit is in
30740 single-precision mode by default.
30741
30742 @item -m4-200-single-only
30743 @opindex m4-200-single-only
30744 Generate code for SH4-200 in such a way that no double-precision
30745 floating-point operations are used.
30746
30747 @item -m4-300
30748 @opindex m4-300
30749 Generate code for SH4-300.
30750
30751 @item -m4-300-nofpu
30752 @opindex m4-300-nofpu
30753 Generate code for SH4-300 without in such a way that the
30754 floating-point unit is not used.
30755
30756 @item -m4-300-single
30757 @opindex m4-300-single
30758 Generate code for SH4-300 in such a way that no double-precision
30759 floating-point operations are used.
30760
30761 @item -m4-300-single-only
30762 @opindex m4-300-single-only
30763 Generate code for SH4-300 in such a way that no double-precision
30764 floating-point operations are used.
30765
30766 @item -m4-340
30767 @opindex m4-340
30768 Generate code for SH4-340 (no MMU, no FPU).
30769
30770 @item -m4-500
30771 @opindex m4-500
30772 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
30773 assembler.
30774
30775 @item -m4a-nofpu
30776 @opindex m4a-nofpu
30777 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
30778 floating-point unit is not used.
30779
30780 @item -m4a-single-only
30781 @opindex m4a-single-only
30782 Generate code for the SH4a, in such a way that no double-precision
30783 floating-point operations are used.
30784
30785 @item -m4a-single
30786 @opindex m4a-single
30787 Generate code for the SH4a assuming the floating-point unit is in
30788 single-precision mode by default.
30789
30790 @item -m4a
30791 @opindex m4a
30792 Generate code for the SH4a.
30793
30794 @item -m4al
30795 @opindex m4al
30796 Same as @option{-m4a-nofpu}, except that it implicitly passes
30797 @option{-dsp} to the assembler. GCC doesn't generate any DSP
30798 instructions at the moment.
30799
30800 @item -mb
30801 @opindex mb
30802 Compile code for the processor in big-endian mode.
30803
30804 @item -ml
30805 @opindex ml
30806 Compile code for the processor in little-endian mode.
30807
30808 @item -mdalign
30809 @opindex mdalign
30810 Align doubles at 64-bit boundaries. Note that this changes the calling
30811 conventions, and thus some functions from the standard C library do
30812 not work unless you recompile it first with @option{-mdalign}.
30813
30814 @item -mrelax
30815 @opindex mrelax
30816 Shorten some address references at link time, when possible; uses the
30817 linker option @option{-relax}.
30818
30819 @item -mbigtable
30820 @opindex mbigtable
30821 Use 32-bit offsets in @code{switch} tables. The default is to use
30822 16-bit offsets.
30823
30824 @item -mbitops
30825 @opindex mbitops
30826 Enable the use of bit manipulation instructions on SH2A.
30827
30828 @item -mfmovd
30829 @opindex mfmovd
30830 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
30831 alignment constraints.
30832
30833 @item -mrenesas
30834 @opindex mrenesas
30835 Comply with the calling conventions defined by Renesas.
30836
30837 @item -mno-renesas
30838 @opindex mno-renesas
30839 Comply with the calling conventions defined for GCC before the Renesas
30840 conventions were available. This option is the default for all
30841 targets of the SH toolchain.
30842
30843 @item -mnomacsave
30844 @opindex mnomacsave
30845 Mark the @code{MAC} register as call-clobbered, even if
30846 @option{-mrenesas} is given.
30847
30848 @item -mieee
30849 @itemx -mno-ieee
30850 @opindex mieee
30851 @opindex mno-ieee
30852 Control the IEEE compliance of floating-point comparisons, which affects the
30853 handling of cases where the result of a comparison is unordered. By default
30854 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
30855 enabled @option{-mno-ieee} is implicitly set, which results in faster
30856 floating-point greater-equal and less-equal comparisons. The implicit settings
30857 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
30858
30859 @item -minline-ic_invalidate
30860 @opindex minline-ic_invalidate
30861 Inline code to invalidate instruction cache entries after setting up
30862 nested function trampolines.
30863 This option has no effect if @option{-musermode} is in effect and the selected
30864 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
30865 instruction.
30866 If the selected code generation option does not allow the use of the @code{icbi}
30867 instruction, and @option{-musermode} is not in effect, the inlined code
30868 manipulates the instruction cache address array directly with an associative
30869 write. This not only requires privileged mode at run time, but it also
30870 fails if the cache line had been mapped via the TLB and has become unmapped.
30871
30872 @item -misize
30873 @opindex misize
30874 Dump instruction size and location in the assembly code.
30875
30876 @item -mpadstruct
30877 @opindex mpadstruct
30878 This option is deprecated. It pads structures to multiple of 4 bytes,
30879 which is incompatible with the SH ABI@.
30880
30881 @item -matomic-model=@var{model}
30882 @opindex matomic-model=@var{model}
30883 Sets the model of atomic operations and additional parameters as a comma
30884 separated list. For details on the atomic built-in functions see
30885 @ref{__atomic Builtins}. The following models and parameters are supported:
30886
30887 @table @samp
30888
30889 @item none
30890 Disable compiler generated atomic sequences and emit library calls for atomic
30891 operations. This is the default if the target is not @code{sh*-*-linux*}.
30892
30893 @item soft-gusa
30894 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
30895 built-in functions. The generated atomic sequences require additional support
30896 from the interrupt/exception handling code of the system and are only suitable
30897 for SH3* and SH4* single-core systems. This option is enabled by default when
30898 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
30899 this option also partially utilizes the hardware atomic instructions
30900 @code{movli.l} and @code{movco.l} to create more efficient code, unless
30901 @samp{strict} is specified.
30902
30903 @item soft-tcb
30904 Generate software atomic sequences that use a variable in the thread control
30905 block. This is a variation of the gUSA sequences which can also be used on
30906 SH1* and SH2* targets. The generated atomic sequences require additional
30907 support from the interrupt/exception handling code of the system and are only
30908 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
30909 parameter has to be specified as well.
30910
30911 @item soft-imask
30912 Generate software atomic sequences that temporarily disable interrupts by
30913 setting @code{SR.IMASK = 1111}. This model works only when the program runs
30914 in privileged mode and is only suitable for single-core systems. Additional
30915 support from the interrupt/exception handling code of the system is not
30916 required. This model is enabled by default when the target is
30917 @code{sh*-*-linux*} and SH1* or SH2*.
30918
30919 @item hard-llcs
30920 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
30921 instructions only. This is only available on SH4A and is suitable for
30922 multi-core systems. Since the hardware instructions support only 32 bit atomic
30923 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
30924 Code compiled with this option is also compatible with other software
30925 atomic model interrupt/exception handling systems if executed on an SH4A
30926 system. Additional support from the interrupt/exception handling code of the
30927 system is not required for this model.
30928
30929 @item gbr-offset=
30930 This parameter specifies the offset in bytes of the variable in the thread
30931 control block structure that should be used by the generated atomic sequences
30932 when the @samp{soft-tcb} model has been selected. For other models this
30933 parameter is ignored. The specified value must be an integer multiple of four
30934 and in the range 0-1020.
30935
30936 @item strict
30937 This parameter prevents mixed usage of multiple atomic models, even if they
30938 are compatible, and makes the compiler generate atomic sequences of the
30939 specified model only.
30940
30941 @end table
30942
30943 @item -mtas
30944 @opindex mtas
30945 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
30946 Notice that depending on the particular hardware and software configuration
30947 this can degrade overall performance due to the operand cache line flushes
30948 that are implied by the @code{tas.b} instruction. On multi-core SH4A
30949 processors the @code{tas.b} instruction must be used with caution since it
30950 can result in data corruption for certain cache configurations.
30951
30952 @item -mprefergot
30953 @opindex mprefergot
30954 When generating position-independent code, emit function calls using
30955 the Global Offset Table instead of the Procedure Linkage Table.
30956
30957 @item -musermode
30958 @itemx -mno-usermode
30959 @opindex musermode
30960 @opindex mno-usermode
30961 Don't allow (allow) the compiler generating privileged mode code. Specifying
30962 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
30963 inlined code would not work in user mode. @option{-musermode} is the default
30964 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
30965 @option{-musermode} has no effect, since there is no user mode.
30966
30967 @item -multcost=@var{number}
30968 @opindex multcost=@var{number}
30969 Set the cost to assume for a multiply insn.
30970
30971 @item -mdiv=@var{strategy}
30972 @opindex mdiv=@var{strategy}
30973 Set the division strategy to be used for integer division operations.
30974 @var{strategy} can be one of:
30975
30976 @table @samp
30977
30978 @item call-div1
30979 Calls a library function that uses the single-step division instruction
30980 @code{div1} to perform the operation. Division by zero calculates an
30981 unspecified result and does not trap. This is the default except for SH4,
30982 SH2A and SHcompact.
30983
30984 @item call-fp
30985 Calls a library function that performs the operation in double precision
30986 floating point. Division by zero causes a floating-point exception. This is
30987 the default for SHcompact with FPU. Specifying this for targets that do not
30988 have a double precision FPU defaults to @code{call-div1}.
30989
30990 @item call-table
30991 Calls a library function that uses a lookup table for small divisors and
30992 the @code{div1} instruction with case distinction for larger divisors. Division
30993 by zero calculates an unspecified result and does not trap. This is the default
30994 for SH4. Specifying this for targets that do not have dynamic shift
30995 instructions defaults to @code{call-div1}.
30996
30997 @end table
30998
30999 When a division strategy has not been specified the default strategy is
31000 selected based on the current target. For SH2A the default strategy is to
31001 use the @code{divs} and @code{divu} instructions instead of library function
31002 calls.
31003
31004 @item -maccumulate-outgoing-args
31005 @opindex maccumulate-outgoing-args
31006 Reserve space once for outgoing arguments in the function prologue rather
31007 than around each call. Generally beneficial for performance and size. Also
31008 needed for unwinding to avoid changing the stack frame around conditional code.
31009
31010 @item -mdivsi3_libfunc=@var{name}
31011 @opindex mdivsi3_libfunc=@var{name}
31012 Set the name of the library function used for 32-bit signed division to
31013 @var{name}.
31014 This only affects the name used in the @samp{call} division strategies, and
31015 the compiler still expects the same sets of input/output/clobbered registers as
31016 if this option were not present.
31017
31018 @item -mfixed-range=@var{register-range}
31019 @opindex mfixed-range
31020 Generate code treating the given register range as fixed registers.
31021 A fixed register is one that the register allocator cannot use. This is
31022 useful when compiling kernel code. A register range is specified as
31023 two registers separated by a dash. Multiple register ranges can be
31024 specified separated by a comma.
31025
31026 @item -mbranch-cost=@var{num}
31027 @opindex mbranch-cost=@var{num}
31028 Assume @var{num} to be the cost for a branch instruction. Higher numbers
31029 make the compiler try to generate more branch-free code if possible.
31030 If not specified the value is selected depending on the processor type that
31031 is being compiled for.
31032
31033 @item -mzdcbranch
31034 @itemx -mno-zdcbranch
31035 @opindex mzdcbranch
31036 @opindex mno-zdcbranch
31037 Assume (do not assume) that zero displacement conditional branch instructions
31038 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
31039 compiler prefers zero displacement branch code sequences. This is
31040 enabled by default when generating code for SH4 and SH4A. It can be explicitly
31041 disabled by specifying @option{-mno-zdcbranch}.
31042
31043 @item -mcbranch-force-delay-slot
31044 @opindex mcbranch-force-delay-slot
31045 Force the usage of delay slots for conditional branches, which stuffs the delay
31046 slot with a @code{nop} if a suitable instruction cannot be found. By default
31047 this option is disabled. It can be enabled to work around hardware bugs as
31048 found in the original SH7055.
31049
31050 @item -mfused-madd
31051 @itemx -mno-fused-madd
31052 @opindex mfused-madd
31053 @opindex mno-fused-madd
31054 Generate code that uses (does not use) the floating-point multiply and
31055 accumulate instructions. These instructions are generated by default
31056 if hardware floating point is used. The machine-dependent
31057 @option{-mfused-madd} option is now mapped to the machine-independent
31058 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31059 mapped to @option{-ffp-contract=off}.
31060
31061 @item -mfsca
31062 @itemx -mno-fsca
31063 @opindex mfsca
31064 @opindex mno-fsca
31065 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31066 and cosine approximations. The option @option{-mfsca} must be used in
31067 combination with @option{-funsafe-math-optimizations}. It is enabled by default
31068 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
31069 approximations even if @option{-funsafe-math-optimizations} is in effect.
31070
31071 @item -mfsrra
31072 @itemx -mno-fsrra
31073 @opindex mfsrra
31074 @opindex mno-fsrra
31075 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31076 reciprocal square root approximations. The option @option{-mfsrra} must be used
31077 in combination with @option{-funsafe-math-optimizations} and
31078 @option{-ffinite-math-only}. It is enabled by default when generating code for
31079 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
31080 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31081 in effect.
31082
31083 @item -mpretend-cmove
31084 @opindex mpretend-cmove
31085 Prefer zero-displacement conditional branches for conditional move instruction
31086 patterns. This can result in faster code on the SH4 processor.
31087
31088 @item -mfdpic
31089 @opindex fdpic
31090 Generate code using the FDPIC ABI.
31091
31092 @end table
31093
31094 @node Solaris 2 Options
31095 @subsection Solaris 2 Options
31096 @cindex Solaris 2 options
31097
31098 These @samp{-m} options are supported on Solaris 2:
31099
31100 @table @gcctabopt
31101 @item -mclear-hwcap
31102 @opindex mclear-hwcap
31103 @option{-mclear-hwcap} tells the compiler to remove the hardware
31104 capabilities generated by the Solaris assembler. This is only necessary
31105 when object files use ISA extensions not supported by the current
31106 machine, but check at runtime whether or not to use them.
31107
31108 @item -mimpure-text
31109 @opindex mimpure-text
31110 @option{-mimpure-text}, used in addition to @option{-shared}, tells
31111 the compiler to not pass @option{-z text} to the linker when linking a
31112 shared object. Using this option, you can link position-dependent
31113 code into a shared object.
31114
31115 @option{-mimpure-text} suppresses the ``relocations remain against
31116 allocatable but non-writable sections'' linker error message.
31117 However, the necessary relocations trigger copy-on-write, and the
31118 shared object is not actually shared across processes. Instead of
31119 using @option{-mimpure-text}, you should compile all source code with
31120 @option{-fpic} or @option{-fPIC}.
31121
31122 @end table
31123
31124 These switches are supported in addition to the above on Solaris 2:
31125
31126 @table @gcctabopt
31127 @item -pthreads
31128 @opindex pthreads
31129 This is a synonym for @option{-pthread}.
31130 @end table
31131
31132 @node SPARC Options
31133 @subsection SPARC Options
31134 @cindex SPARC options
31135
31136 These @samp{-m} options are supported on the SPARC:
31137
31138 @table @gcctabopt
31139 @item -mno-app-regs
31140 @itemx -mapp-regs
31141 @opindex mno-app-regs
31142 @opindex mapp-regs
31143 Specify @option{-mapp-regs} to generate output using the global registers
31144 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
31145 global register 1, each global register 2 through 4 is then treated as an
31146 allocable register that is clobbered by function calls. This is the default.
31147
31148 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31149 specify @option{-mno-app-regs}. You should compile libraries and system
31150 software with this option.
31151
31152 @item -mflat
31153 @itemx -mno-flat
31154 @opindex mflat
31155 @opindex mno-flat
31156 With @option{-mflat}, the compiler does not generate save/restore instructions
31157 and uses a ``flat'' or single register window model. This model is compatible
31158 with the regular register window model. The local registers and the input
31159 registers (0--5) are still treated as ``call-saved'' registers and are
31160 saved on the stack as needed.
31161
31162 With @option{-mno-flat} (the default), the compiler generates save/restore
31163 instructions (except for leaf functions). This is the normal operating mode.
31164
31165 @item -mfpu
31166 @itemx -mhard-float
31167 @opindex mfpu
31168 @opindex mhard-float
31169 Generate output containing floating-point instructions. This is the
31170 default.
31171
31172 @item -mno-fpu
31173 @itemx -msoft-float
31174 @opindex mno-fpu
31175 @opindex msoft-float
31176 Generate output containing library calls for floating point.
31177 @strong{Warning:} the requisite libraries are not available for all SPARC
31178 targets. Normally the facilities of the machine's usual C compiler are
31179 used, but this cannot be done directly in cross-compilation. You must make
31180 your own arrangements to provide suitable library functions for
31181 cross-compilation. The embedded targets @samp{sparc-*-aout} and
31182 @samp{sparclite-*-*} do provide software floating-point support.
31183
31184 @option{-msoft-float} changes the calling convention in the output file;
31185 therefore, it is only useful if you compile @emph{all} of a program with
31186 this option. In particular, you need to compile @file{libgcc.a}, the
31187 library that comes with GCC, with @option{-msoft-float} in order for
31188 this to work.
31189
31190 @item -mhard-quad-float
31191 @opindex mhard-quad-float
31192 Generate output containing quad-word (long double) floating-point
31193 instructions.
31194
31195 @item -msoft-quad-float
31196 @opindex msoft-quad-float
31197 Generate output containing library calls for quad-word (long double)
31198 floating-point instructions. The functions called are those specified
31199 in the SPARC ABI@. This is the default.
31200
31201 As of this writing, there are no SPARC implementations that have hardware
31202 support for the quad-word floating-point instructions. They all invoke
31203 a trap handler for one of these instructions, and then the trap handler
31204 emulates the effect of the instruction. Because of the trap handler overhead,
31205 this is much slower than calling the ABI library routines. Thus the
31206 @option{-msoft-quad-float} option is the default.
31207
31208 @item -mno-unaligned-doubles
31209 @itemx -munaligned-doubles
31210 @opindex mno-unaligned-doubles
31211 @opindex munaligned-doubles
31212 Assume that doubles have 8-byte alignment. This is the default.
31213
31214 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
31215 alignment only if they are contained in another type, or if they have an
31216 absolute address. Otherwise, it assumes they have 4-byte alignment.
31217 Specifying this option avoids some rare compatibility problems with code
31218 generated by other compilers. It is not the default because it results
31219 in a performance loss, especially for floating-point code.
31220
31221 @item -muser-mode
31222 @itemx -mno-user-mode
31223 @opindex muser-mode
31224 @opindex mno-user-mode
31225 Do not generate code that can only run in supervisor mode. This is relevant
31226 only for the @code{casa} instruction emitted for the LEON3 processor. This
31227 is the default.
31228
31229 @item -mfaster-structs
31230 @itemx -mno-faster-structs
31231 @opindex mfaster-structs
31232 @opindex mno-faster-structs
31233 With @option{-mfaster-structs}, the compiler assumes that structures
31234 should have 8-byte alignment. This enables the use of pairs of
31235 @code{ldd} and @code{std} instructions for copies in structure
31236 assignment, in place of twice as many @code{ld} and @code{st} pairs.
31237 However, the use of this changed alignment directly violates the SPARC
31238 ABI@. Thus, it's intended only for use on targets where the developer
31239 acknowledges that their resulting code is not directly in line with
31240 the rules of the ABI@.
31241
31242 @item -mstd-struct-return
31243 @itemx -mno-std-struct-return
31244 @opindex mstd-struct-return
31245 @opindex mno-std-struct-return
31246 With @option{-mstd-struct-return}, the compiler generates checking code
31247 in functions returning structures or unions to detect size mismatches
31248 between the two sides of function calls, as per the 32-bit ABI@.
31249
31250 The default is @option{-mno-std-struct-return}. This option has no effect
31251 in 64-bit mode.
31252
31253 @item -mlra
31254 @itemx -mno-lra
31255 @opindex mlra
31256 @opindex mno-lra
31257 Enable Local Register Allocation. This is the default for SPARC since GCC 7
31258 so @option{-mno-lra} needs to be passed to get old Reload.
31259
31260 @item -mcpu=@var{cpu_type}
31261 @opindex mcpu
31262 Set the instruction set, register set, and instruction scheduling parameters
31263 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
31264 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
31265 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
31266 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
31267 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
31268 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
31269 @samp{m8}.
31270
31271 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
31272 which selects the best architecture option for the host processor.
31273 @option{-mcpu=native} has no effect if GCC does not recognize
31274 the processor.
31275
31276 Default instruction scheduling parameters are used for values that select
31277 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
31278 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
31279
31280 Here is a list of each supported architecture and their supported
31281 implementations.
31282
31283 @table @asis
31284 @item v7
31285 cypress, leon3v7
31286
31287 @item v8
31288 supersparc, hypersparc, leon, leon3, leon5
31289
31290 @item sparclite
31291 f930, f934, sparclite86x
31292
31293 @item sparclet
31294 tsc701
31295
31296 @item v9
31297 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
31298 niagara7, m8
31299 @end table
31300
31301 By default (unless configured otherwise), GCC generates code for the V7
31302 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
31303 additionally optimizes it for the Cypress CY7C602 chip, as used in the
31304 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
31305 SPARCStation 1, 2, IPX etc.
31306
31307 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
31308 architecture. The only difference from V7 code is that the compiler emits
31309 the integer multiply and integer divide instructions which exist in SPARC-V8
31310 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
31311 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
31312 2000 series.
31313
31314 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
31315 the SPARC architecture. This adds the integer multiply, integer divide step
31316 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
31317 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
31318 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
31319 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
31320 MB86934 chip, which is the more recent SPARClite with FPU@.
31321
31322 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
31323 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
31324 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
31325 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
31326 optimizes it for the TEMIC SPARClet chip.
31327
31328 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
31329 architecture. This adds 64-bit integer and floating-point move instructions,
31330 3 additional floating-point condition code registers and conditional move
31331 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
31332 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
31333 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
31334 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
31335 @option{-mcpu=niagara}, the compiler additionally optimizes it for
31336 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
31337 additionally optimizes it for Sun UltraSPARC T2 chips. With
31338 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
31339 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
31340 additionally optimizes it for Sun UltraSPARC T4 chips. With
31341 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
31342 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
31343 additionally optimizes it for Oracle M8 chips.
31344
31345 @item -mtune=@var{cpu_type}
31346 @opindex mtune
31347 Set the instruction scheduling parameters for machine type
31348 @var{cpu_type}, but do not set the instruction set or register set that the
31349 option @option{-mcpu=@var{cpu_type}} does.
31350
31351 The same values for @option{-mcpu=@var{cpu_type}} can be used for
31352 @option{-mtune=@var{cpu_type}}, but the only useful values are those
31353 that select a particular CPU implementation. Those are
31354 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
31355 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
31356 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
31357 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
31358 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
31359 and GNU/Linux toolchains, @samp{native} can also be used.
31360
31361 @item -mv8plus
31362 @itemx -mno-v8plus
31363 @opindex mv8plus
31364 @opindex mno-v8plus
31365 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
31366 difference from the V8 ABI is that the global and out registers are
31367 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
31368 mode for all SPARC-V9 processors.
31369
31370 @item -mvis
31371 @itemx -mno-vis
31372 @opindex mvis
31373 @opindex mno-vis
31374 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
31375 Visual Instruction Set extensions. The default is @option{-mno-vis}.
31376
31377 @item -mvis2
31378 @itemx -mno-vis2
31379 @opindex mvis2
31380 @opindex mno-vis2
31381 With @option{-mvis2}, GCC generates code that takes advantage of
31382 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
31383 default is @option{-mvis2} when targeting a cpu that supports such
31384 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
31385 also sets @option{-mvis}.
31386
31387 @item -mvis3
31388 @itemx -mno-vis3
31389 @opindex mvis3
31390 @opindex mno-vis3
31391 With @option{-mvis3}, GCC generates code that takes advantage of
31392 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
31393 default is @option{-mvis3} when targeting a cpu that supports such
31394 instructions, such as niagara-3 and later. Setting @option{-mvis3}
31395 also sets @option{-mvis2} and @option{-mvis}.
31396
31397 @item -mvis4
31398 @itemx -mno-vis4
31399 @opindex mvis4
31400 @opindex mno-vis4
31401 With @option{-mvis4}, GCC generates code that takes advantage of
31402 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
31403 default is @option{-mvis4} when targeting a cpu that supports such
31404 instructions, such as niagara-7 and later. Setting @option{-mvis4}
31405 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
31406
31407 @item -mvis4b
31408 @itemx -mno-vis4b
31409 @opindex mvis4b
31410 @opindex mno-vis4b
31411 With @option{-mvis4b}, GCC generates code that takes advantage of
31412 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
31413 the additional VIS instructions introduced in the Oracle SPARC
31414 Architecture 2017. The default is @option{-mvis4b} when targeting a
31415 cpu that supports such instructions, such as m8 and later. Setting
31416 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
31417 @option{-mvis2} and @option{-mvis}.
31418
31419 @item -mcbcond
31420 @itemx -mno-cbcond
31421 @opindex mcbcond
31422 @opindex mno-cbcond
31423 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
31424 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
31425 when targeting a CPU that supports such instructions, such as Niagara-4 and
31426 later.
31427
31428 @item -mfmaf
31429 @itemx -mno-fmaf
31430 @opindex mfmaf
31431 @opindex mno-fmaf
31432 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
31433 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
31434 when targeting a CPU that supports such instructions, such as Niagara-3 and
31435 later.
31436
31437 @item -mfsmuld
31438 @itemx -mno-fsmuld
31439 @opindex mfsmuld
31440 @opindex mno-fsmuld
31441 With @option{-mfsmuld}, GCC generates code that takes advantage of the
31442 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
31443 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
31444 or V9 with FPU except @option{-mcpu=leon}.
31445
31446 @item -mpopc
31447 @itemx -mno-popc
31448 @opindex mpopc
31449 @opindex mno-popc
31450 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
31451 Population Count instruction. The default is @option{-mpopc}
31452 when targeting a CPU that supports such an instruction, such as Niagara-2 and
31453 later.
31454
31455 @item -msubxc
31456 @itemx -mno-subxc
31457 @opindex msubxc
31458 @opindex mno-subxc
31459 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
31460 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
31461 when targeting a CPU that supports such an instruction, such as Niagara-7 and
31462 later.
31463
31464 @item -mfix-at697f
31465 @opindex mfix-at697f
31466 Enable the documented workaround for the single erratum of the Atmel AT697F
31467 processor (which corresponds to erratum #13 of the AT697E processor).
31468
31469 @item -mfix-ut699
31470 @opindex mfix-ut699
31471 Enable the documented workarounds for the floating-point errata and the data
31472 cache nullify errata of the UT699 processor.
31473
31474 @item -mfix-ut700
31475 @opindex mfix-ut700
31476 Enable the documented workaround for the back-to-back store errata of
31477 the UT699E/UT700 processor.
31478
31479 @item -mfix-gr712rc
31480 @opindex mfix-gr712rc
31481 Enable the documented workaround for the back-to-back store errata of
31482 the GR712RC processor.
31483 @end table
31484
31485 These @samp{-m} options are supported in addition to the above
31486 on SPARC-V9 processors in 64-bit environments:
31487
31488 @table @gcctabopt
31489 @item -m32
31490 @itemx -m64
31491 @opindex m32
31492 @opindex m64
31493 Generate code for a 32-bit or 64-bit environment.
31494 The 32-bit environment sets int, long and pointer to 32 bits.
31495 The 64-bit environment sets int to 32 bits and long and pointer
31496 to 64 bits.
31497
31498 @item -mcmodel=@var{which}
31499 @opindex mcmodel
31500 Set the code model to one of
31501
31502 @table @samp
31503 @item medlow
31504 The Medium/Low code model: 64-bit addresses, programs
31505 must be linked in the low 32 bits of memory. Programs can be statically
31506 or dynamically linked.
31507
31508 @item medmid
31509 The Medium/Middle code model: 64-bit addresses, programs
31510 must be linked in the low 44 bits of memory, the text and data segments must
31511 be less than 2GB in size and the data segment must be located within 2GB of
31512 the text segment.
31513
31514 @item medany
31515 The Medium/Anywhere code model: 64-bit addresses, programs
31516 may be linked anywhere in memory, the text and data segments must be less
31517 than 2GB in size and the data segment must be located within 2GB of the
31518 text segment.
31519
31520 @item embmedany
31521 The Medium/Anywhere code model for embedded systems:
31522 64-bit addresses, the text and data segments must be less than 2GB in
31523 size, both starting anywhere in memory (determined at link time). The
31524 global register %g4 points to the base of the data segment. Programs
31525 are statically linked and PIC is not supported.
31526 @end table
31527
31528 @item -mmemory-model=@var{mem-model}
31529 @opindex mmemory-model
31530 Set the memory model in force on the processor to one of
31531
31532 @table @samp
31533 @item default
31534 The default memory model for the processor and operating system.
31535
31536 @item rmo
31537 Relaxed Memory Order
31538
31539 @item pso
31540 Partial Store Order
31541
31542 @item tso
31543 Total Store Order
31544
31545 @item sc
31546 Sequential Consistency
31547 @end table
31548
31549 These memory models are formally defined in Appendix D of the SPARC-V9
31550 architecture manual, as set in the processor's @code{PSTATE.MM} field.
31551
31552 @item -mstack-bias
31553 @itemx -mno-stack-bias
31554 @opindex mstack-bias
31555 @opindex mno-stack-bias
31556 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
31557 frame pointer if present, are offset by @minus{}2047 which must be added back
31558 when making stack frame references. This is the default in 64-bit mode.
31559 Otherwise, assume no such offset is present.
31560 @end table
31561
31562 @node System V Options
31563 @subsection Options for System V
31564
31565 These additional options are available on System V Release 4 for
31566 compatibility with other compilers on those systems:
31567
31568 @table @gcctabopt
31569 @item -G
31570 @opindex G
31571 Create a shared object.
31572 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
31573
31574 @item -Qy
31575 @opindex Qy
31576 Identify the versions of each tool used by the compiler, in a
31577 @code{.ident} assembler directive in the output.
31578
31579 @item -Qn
31580 @opindex Qn
31581 Refrain from adding @code{.ident} directives to the output file (this is
31582 the default).
31583
31584 @item -YP,@var{dirs}
31585 @opindex YP
31586 Search the directories @var{dirs}, and no others, for libraries
31587 specified with @option{-l}.
31588
31589 @item -Ym,@var{dir}
31590 @opindex Ym
31591 Look in the directory @var{dir} to find the M4 preprocessor.
31592 The assembler uses this option.
31593 @c This is supposed to go with a -Yd for predefined M4 macro files, but
31594 @c the generic assembler that comes with Solaris takes just -Ym.
31595 @end table
31596
31597 @node V850 Options
31598 @subsection V850 Options
31599 @cindex V850 Options
31600
31601 These @samp{-m} options are defined for V850 implementations:
31602
31603 @table @gcctabopt
31604 @item -mlong-calls
31605 @itemx -mno-long-calls
31606 @opindex mlong-calls
31607 @opindex mno-long-calls
31608 Treat all calls as being far away (near). If calls are assumed to be
31609 far away, the compiler always loads the function's address into a
31610 register, and calls indirect through the pointer.
31611
31612 @item -mno-ep
31613 @itemx -mep
31614 @opindex mno-ep
31615 @opindex mep
31616 Do not optimize (do optimize) basic blocks that use the same index
31617 pointer 4 or more times to copy pointer into the @code{ep} register, and
31618 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
31619 option is on by default if you optimize.
31620
31621 @item -mno-prolog-function
31622 @itemx -mprolog-function
31623 @opindex mno-prolog-function
31624 @opindex mprolog-function
31625 Do not use (do use) external functions to save and restore registers
31626 at the prologue and epilogue of a function. The external functions
31627 are slower, but use less code space if more than one function saves
31628 the same number of registers. The @option{-mprolog-function} option
31629 is on by default if you optimize.
31630
31631 @item -mspace
31632 @opindex mspace
31633 Try to make the code as small as possible. At present, this just turns
31634 on the @option{-mep} and @option{-mprolog-function} options.
31635
31636 @item -mtda=@var{n}
31637 @opindex mtda
31638 Put static or global variables whose size is @var{n} bytes or less into
31639 the tiny data area that register @code{ep} points to. The tiny data
31640 area can hold up to 256 bytes in total (128 bytes for byte references).
31641
31642 @item -msda=@var{n}
31643 @opindex msda
31644 Put static or global variables whose size is @var{n} bytes or less into
31645 the small data area that register @code{gp} points to. The small data
31646 area can hold up to 64 kilobytes.
31647
31648 @item -mzda=@var{n}
31649 @opindex mzda
31650 Put static or global variables whose size is @var{n} bytes or less into
31651 the first 32 kilobytes of memory.
31652
31653 @item -mv850
31654 @opindex mv850
31655 Specify that the target processor is the V850.
31656
31657 @item -mv850e3v5
31658 @opindex mv850e3v5
31659 Specify that the target processor is the V850E3V5. The preprocessor
31660 constant @code{__v850e3v5__} is defined if this option is used.
31661
31662 @item -mv850e2v4
31663 @opindex mv850e2v4
31664 Specify that the target processor is the V850E3V5. This is an alias for
31665 the @option{-mv850e3v5} option.
31666
31667 @item -mv850e2v3
31668 @opindex mv850e2v3
31669 Specify that the target processor is the V850E2V3. The preprocessor
31670 constant @code{__v850e2v3__} is defined if this option is used.
31671
31672 @item -mv850e2
31673 @opindex mv850e2
31674 Specify that the target processor is the V850E2. The preprocessor
31675 constant @code{__v850e2__} is defined if this option is used.
31676
31677 @item -mv850e1
31678 @opindex mv850e1
31679 Specify that the target processor is the V850E1. The preprocessor
31680 constants @code{__v850e1__} and @code{__v850e__} are defined if
31681 this option is used.
31682
31683 @item -mv850es
31684 @opindex mv850es
31685 Specify that the target processor is the V850ES. This is an alias for
31686 the @option{-mv850e1} option.
31687
31688 @item -mv850e
31689 @opindex mv850e
31690 Specify that the target processor is the V850E@. The preprocessor
31691 constant @code{__v850e__} is defined if this option is used.
31692
31693 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
31694 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
31695 are defined then a default target processor is chosen and the
31696 relevant @samp{__v850*__} preprocessor constant is defined.
31697
31698 The preprocessor constants @code{__v850} and @code{__v851__} are always
31699 defined, regardless of which processor variant is the target.
31700
31701 @item -mdisable-callt
31702 @itemx -mno-disable-callt
31703 @opindex mdisable-callt
31704 @opindex mno-disable-callt
31705 This option suppresses generation of the @code{CALLT} instruction for the
31706 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
31707 architecture.
31708
31709 This option is enabled by default when the RH850 ABI is
31710 in use (see @option{-mrh850-abi}), and disabled by default when the
31711 GCC ABI is in use. If @code{CALLT} instructions are being generated
31712 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
31713
31714 @item -mrelax
31715 @itemx -mno-relax
31716 @opindex mrelax
31717 @opindex mno-relax
31718 Pass on (or do not pass on) the @option{-mrelax} command-line option
31719 to the assembler.
31720
31721 @item -mlong-jumps
31722 @itemx -mno-long-jumps
31723 @opindex mlong-jumps
31724 @opindex mno-long-jumps
31725 Disable (or re-enable) the generation of PC-relative jump instructions.
31726
31727 @item -msoft-float
31728 @itemx -mhard-float
31729 @opindex msoft-float
31730 @opindex mhard-float
31731 Disable (or re-enable) the generation of hardware floating point
31732 instructions. This option is only significant when the target
31733 architecture is @samp{V850E2V3} or higher. If hardware floating point
31734 instructions are being generated then the C preprocessor symbol
31735 @code{__FPU_OK__} is defined, otherwise the symbol
31736 @code{__NO_FPU__} is defined.
31737
31738 @item -mloop
31739 @opindex mloop
31740 Enables the use of the e3v5 LOOP instruction. The use of this
31741 instruction is not enabled by default when the e3v5 architecture is
31742 selected because its use is still experimental.
31743
31744 @item -mrh850-abi
31745 @itemx -mghs
31746 @opindex mrh850-abi
31747 @opindex mghs
31748 Enables support for the RH850 version of the V850 ABI. This is the
31749 default. With this version of the ABI the following rules apply:
31750
31751 @itemize
31752 @item
31753 Integer sized structures and unions are returned via a memory pointer
31754 rather than a register.
31755
31756 @item
31757 Large structures and unions (more than 8 bytes in size) are passed by
31758 value.
31759
31760 @item
31761 Functions are aligned to 16-bit boundaries.
31762
31763 @item
31764 The @option{-m8byte-align} command-line option is supported.
31765
31766 @item
31767 The @option{-mdisable-callt} command-line option is enabled by
31768 default. The @option{-mno-disable-callt} command-line option is not
31769 supported.
31770 @end itemize
31771
31772 When this version of the ABI is enabled the C preprocessor symbol
31773 @code{__V850_RH850_ABI__} is defined.
31774
31775 @item -mgcc-abi
31776 @opindex mgcc-abi
31777 Enables support for the old GCC version of the V850 ABI. With this
31778 version of the ABI the following rules apply:
31779
31780 @itemize
31781 @item
31782 Integer sized structures and unions are returned in register @code{r10}.
31783
31784 @item
31785 Large structures and unions (more than 8 bytes in size) are passed by
31786 reference.
31787
31788 @item
31789 Functions are aligned to 32-bit boundaries, unless optimizing for
31790 size.
31791
31792 @item
31793 The @option{-m8byte-align} command-line option is not supported.
31794
31795 @item
31796 The @option{-mdisable-callt} command-line option is supported but not
31797 enabled by default.
31798 @end itemize
31799
31800 When this version of the ABI is enabled the C preprocessor symbol
31801 @code{__V850_GCC_ABI__} is defined.
31802
31803 @item -m8byte-align
31804 @itemx -mno-8byte-align
31805 @opindex m8byte-align
31806 @opindex mno-8byte-align
31807 Enables support for @code{double} and @code{long long} types to be
31808 aligned on 8-byte boundaries. The default is to restrict the
31809 alignment of all objects to at most 4-bytes. When
31810 @option{-m8byte-align} is in effect the C preprocessor symbol
31811 @code{__V850_8BYTE_ALIGN__} is defined.
31812
31813 @item -mbig-switch
31814 @opindex mbig-switch
31815 Generate code suitable for big switch tables. Use this option only if
31816 the assembler/linker complain about out of range branches within a switch
31817 table.
31818
31819 @item -mapp-regs
31820 @opindex mapp-regs
31821 This option causes r2 and r5 to be used in the code generated by
31822 the compiler. This setting is the default.
31823
31824 @item -mno-app-regs
31825 @opindex mno-app-regs
31826 This option causes r2 and r5 to be treated as fixed registers.
31827
31828 @end table
31829
31830 @node VAX Options
31831 @subsection VAX Options
31832 @cindex VAX options
31833
31834 These @samp{-m} options are defined for the VAX:
31835
31836 @table @gcctabopt
31837 @item -munix
31838 @opindex munix
31839 Do not output certain jump instructions (@code{aobleq} and so on)
31840 that the Unix assembler for the VAX cannot handle across long
31841 ranges.
31842
31843 @item -mgnu
31844 @opindex mgnu
31845 Do output those jump instructions, on the assumption that the
31846 GNU assembler is being used.
31847
31848 @item -mg
31849 @opindex mg
31850 Output code for G-format floating-point numbers instead of D-format.
31851
31852 @item -mlra
31853 @itemx -mno-lra
31854 @opindex mlra
31855 @opindex mno-lra
31856 Enable Local Register Allocation. This is still experimental for the VAX,
31857 so by default the compiler uses standard reload.
31858 @end table
31859
31860 @node Visium Options
31861 @subsection Visium Options
31862 @cindex Visium options
31863
31864 @table @gcctabopt
31865
31866 @item -mdebug
31867 @opindex mdebug
31868 A program which performs file I/O and is destined to run on an MCM target
31869 should be linked with this option. It causes the libraries libc.a and
31870 libdebug.a to be linked. The program should be run on the target under
31871 the control of the GDB remote debugging stub.
31872
31873 @item -msim
31874 @opindex msim
31875 A program which performs file I/O and is destined to run on the simulator
31876 should be linked with option. This causes libraries libc.a and libsim.a to
31877 be linked.
31878
31879 @item -mfpu
31880 @itemx -mhard-float
31881 @opindex mfpu
31882 @opindex mhard-float
31883 Generate code containing floating-point instructions. This is the
31884 default.
31885
31886 @item -mno-fpu
31887 @itemx -msoft-float
31888 @opindex mno-fpu
31889 @opindex msoft-float
31890 Generate code containing library calls for floating-point.
31891
31892 @option{-msoft-float} changes the calling convention in the output file;
31893 therefore, it is only useful if you compile @emph{all} of a program with
31894 this option. In particular, you need to compile @file{libgcc.a}, the
31895 library that comes with GCC, with @option{-msoft-float} in order for
31896 this to work.
31897
31898 @item -mcpu=@var{cpu_type}
31899 @opindex mcpu
31900 Set the instruction set, register set, and instruction scheduling parameters
31901 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
31902 @samp{mcm}, @samp{gr5} and @samp{gr6}.
31903
31904 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
31905
31906 By default (unless configured otherwise), GCC generates code for the GR5
31907 variant of the Visium architecture.
31908
31909 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
31910 architecture. The only difference from GR5 code is that the compiler will
31911 generate block move instructions.
31912
31913 @item -mtune=@var{cpu_type}
31914 @opindex mtune
31915 Set the instruction scheduling parameters for machine type @var{cpu_type},
31916 but do not set the instruction set or register set that the option
31917 @option{-mcpu=@var{cpu_type}} would.
31918
31919 @item -msv-mode
31920 @opindex msv-mode
31921 Generate code for the supervisor mode, where there are no restrictions on
31922 the access to general registers. This is the default.
31923
31924 @item -muser-mode
31925 @opindex muser-mode
31926 Generate code for the user mode, where the access to some general registers
31927 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
31928 mode; on the GR6, only registers r29 to r31 are affected.
31929 @end table
31930
31931 @node VMS Options
31932 @subsection VMS Options
31933
31934 These @samp{-m} options are defined for the VMS implementations:
31935
31936 @table @gcctabopt
31937 @item -mvms-return-codes
31938 @opindex mvms-return-codes
31939 Return VMS condition codes from @code{main}. The default is to return POSIX-style
31940 condition (e.g.@: error) codes.
31941
31942 @item -mdebug-main=@var{prefix}
31943 @opindex mdebug-main=@var{prefix}
31944 Flag the first routine whose name starts with @var{prefix} as the main
31945 routine for the debugger.
31946
31947 @item -mmalloc64
31948 @opindex mmalloc64
31949 Default to 64-bit memory allocation routines.
31950
31951 @item -mpointer-size=@var{size}
31952 @opindex mpointer-size=@var{size}
31953 Set the default size of pointers. Possible options for @var{size} are
31954 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
31955 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
31956 The later option disables @code{pragma pointer_size}.
31957 @end table
31958
31959 @node VxWorks Options
31960 @subsection VxWorks Options
31961 @cindex VxWorks Options
31962
31963 The options in this section are defined for all VxWorks targets.
31964 Options specific to the target hardware are listed with the other
31965 options for that target.
31966
31967 @table @gcctabopt
31968 @item -mrtp
31969 @opindex mrtp
31970 GCC can generate code for both VxWorks kernels and real time processes
31971 (RTPs). This option switches from the former to the latter. It also
31972 defines the preprocessor macro @code{__RTP__}.
31973
31974 @item -non-static
31975 @opindex non-static
31976 Link an RTP executable against shared libraries rather than static
31977 libraries. The options @option{-static} and @option{-shared} can
31978 also be used for RTPs (@pxref{Link Options}); @option{-static}
31979 is the default.
31980
31981 @item -Bstatic
31982 @itemx -Bdynamic
31983 @opindex Bstatic
31984 @opindex Bdynamic
31985 These options are passed down to the linker. They are defined for
31986 compatibility with Diab.
31987
31988 @item -Xbind-lazy
31989 @opindex Xbind-lazy
31990 Enable lazy binding of function calls. This option is equivalent to
31991 @option{-Wl,-z,now} and is defined for compatibility with Diab.
31992
31993 @item -Xbind-now
31994 @opindex Xbind-now
31995 Disable lazy binding of function calls. This option is the default and
31996 is defined for compatibility with Diab.
31997 @end table
31998
31999 @node x86 Options
32000 @subsection x86 Options
32001 @cindex x86 Options
32002
32003 These @samp{-m} options are defined for the x86 family of computers.
32004
32005 @table @gcctabopt
32006
32007 @item -march=@var{cpu-type}
32008 @opindex march
32009 Generate instructions for the machine type @var{cpu-type}. In contrast to
32010 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
32011 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
32012 to generate code that may not run at all on processors other than the one
32013 indicated. Specifying @option{-march=@var{cpu-type}} implies
32014 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
32015
32016 The choices for @var{cpu-type} are:
32017
32018 @table @samp
32019 @item native
32020 This selects the CPU to generate code for at compilation time by determining
32021 the processor type of the compiling machine. Using @option{-march=native}
32022 enables all instruction subsets supported by the local machine (hence
32023 the result might not run on different machines). Using @option{-mtune=native}
32024 produces code optimized for the local machine under the constraints
32025 of the selected instruction set.
32026
32027 @item x86-64
32028 A generic CPU with 64-bit extensions.
32029
32030 @item x86-64-v2
32031 @itemx x86-64-v3
32032 @itemx x86-64-v4
32033 These choices for @var{cpu-type} select the corresponding
32034 micro-architecture level from the x86-64 psABI. On ABIs other than
32035 the x86-64 psABI they select the same CPU features as the x86-64 psABI
32036 documents for the particular micro-architecture level.
32037
32038 Since these @var{cpu-type} values do not have a corresponding
32039 @option{-mtune} setting, using @option{-march} with these values enables
32040 generic tuning. Specific tuning can be enabled using the
32041 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32042 @var{other-cpu-type} value.
32043
32044 @item i386
32045 Original Intel i386 CPU@.
32046
32047 @item i486
32048 Intel i486 CPU@. (No scheduling is implemented for this chip.)
32049
32050 @item i586
32051 @itemx pentium
32052 Intel Pentium CPU with no MMX support.
32053
32054 @item lakemont
32055 Intel Lakemont MCU, based on Intel Pentium CPU.
32056
32057 @item pentium-mmx
32058 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32059
32060 @item pentiumpro
32061 Intel Pentium Pro CPU@.
32062
32063 @item i686
32064 When used with @option{-march}, the Pentium Pro
32065 instruction set is used, so the code runs on all i686 family chips.
32066 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32067
32068 @item pentium2
32069 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32070 set support.
32071
32072 @item pentium3
32073 @itemx pentium3m
32074 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32075 instruction set support.
32076
32077 @item pentium-m
32078 Intel Pentium M; low-power version of Intel Pentium III CPU
32079 with MMX, SSE, SSE2 and FXSR instruction set support. Used by Centrino
32080 notebooks.
32081
32082 @item pentium4
32083 @itemx pentium4m
32084 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32085
32086 @item prescott
32087 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32088 instruction set support.
32089
32090 @item nocona
32091 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32092 SSE2, SSE3 and FXSR instruction set support.
32093
32094 @item core2
32095 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32096 SAHF and FXSR instruction set support.
32097
32098 @item nehalem
32099 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32100 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
32101
32102 @item westmere
32103 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32104 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
32105
32106 @item sandybridge
32107 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32108 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
32109 support.
32110
32111 @item ivybridge
32112 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32113 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
32114 and F16C instruction set support.
32115
32116 @item haswell
32117 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32118 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32119 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32120
32121 @item broadwell
32122 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32123 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32124 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32125 instruction set support.
32126
32127 @item skylake
32128 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32129 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32130 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32131 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32132
32133 @item bonnell
32134 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32135 instruction set support.
32136
32137 @item silvermont
32138 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32139 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32140 instruction set support.
32141
32142 @item goldmont
32143 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32144 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32145 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32146 set support.
32147
32148 @item goldmont-plus
32149 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32150 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32151 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32152 RDPID and SGX instruction set support.
32153
32154 @item tremont
32155 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32156 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32157 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32158 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32159 support.
32160
32161 @item sierraforest
32162 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32163 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32164 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32165 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32166 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32167 AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support.
32168
32169 @item grandridge
32170 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32171 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32172 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32173 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32174 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32175 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD and RAOINT instruction set
32176 support.
32177
32178 @item knl
32179 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32180 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32181 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32182 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
32183
32184 @item knm
32185 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32186 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32187 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32188 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
32189 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
32190
32191 @item skylake-avx512
32192 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32193 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32194 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32195 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
32196 AVX512DQ and AVX512CD instruction set support.
32197
32198 @item cannonlake
32199 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
32200 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
32201 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
32202 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
32203 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
32204 support.
32205
32206 @item icelake-client
32207 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32208 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32209 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32210 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32211 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32212 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32213
32214 @item icelake-server
32215 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32216 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32217 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32218 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32219 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32220 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
32221 instruction set support.
32222
32223 @item cascadelake
32224 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32225 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32226 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32227 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32228 AVX512CD and AVX512VNNI instruction set support.
32229
32230 @item cooperlake
32231 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32232 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32233 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32234 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32235 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
32236
32237 @item tigerlake
32238 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32239 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32240 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32241 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32242 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32243 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
32244 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
32245
32246 @item sapphirerapids
32247 Intel sapphirerapids 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, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32253 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32254 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16 and AVX512BF16
32255 instruction set support.
32256
32257 @item alderlake
32258 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32259 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
32260 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
32261 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
32262 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
32263 support.
32264
32265 @item rocketlake
32266 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
32267 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32268 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32269 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32270 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32271 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32272
32273 @item graniterapids
32274 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32275 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32276 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32277 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32278 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32279 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32280 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
32281 SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16,
32282 AVX512BF16, AMX-FP16 and PREFETCHI instruction set support.
32283
32284 @item k6
32285 AMD K6 CPU with MMX instruction set support.
32286
32287 @item k6-2
32288 @itemx k6-3
32289 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
32290
32291 @item athlon
32292 @itemx athlon-tbird
32293 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
32294 support.
32295
32296 @item athlon-4
32297 @itemx athlon-xp
32298 @itemx athlon-mp
32299 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
32300 instruction set support.
32301
32302 @item k8
32303 @itemx opteron
32304 @itemx athlon64
32305 @itemx athlon-fx
32306 Processors based on the AMD K8 core with x86-64 instruction set support,
32307 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
32308 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
32309 instruction set extensions.)
32310
32311 @item k8-sse3
32312 @itemx opteron-sse3
32313 @itemx athlon64-sse3
32314 Improved versions of AMD K8 cores with SSE3 instruction set support.
32315
32316 @item amdfam10
32317 @itemx barcelona
32318 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
32319 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
32320 instruction set extensions.)
32321
32322 @item bdver1
32323 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
32324 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
32325 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
32326
32327 @item bdver2
32328 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32329 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
32330 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
32331 extensions.)
32332
32333 @item bdver3
32334 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32335 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
32336 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
32337 64-bit instruction set extensions.)
32338
32339 @item bdver4
32340 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
32341 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
32342 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
32343 SSE4.2, ABM and 64-bit instruction set extensions.)
32344
32345 @item znver1
32346 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32347 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
32348 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
32349 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
32350 instruction set extensions.)
32351
32352 @item znver2
32353 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32354 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32355 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32356 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32357 WBNOINVD, and 64-bit instruction set extensions.)
32358
32359 @item znver3
32360 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32361 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32362 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32363 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32364 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
32365
32366 @item znver4
32367 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32368 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32369 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32370 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32371 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
32372 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
32373 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
32374
32375 @item btver1
32376 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
32377 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
32378 instruction set extensions.)
32379
32380 @item btver2
32381 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
32382 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
32383 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
32384
32385 @item winchip-c6
32386 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
32387 set support.
32388
32389 @item winchip2
32390 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
32391 instruction set support.
32392
32393 @item c3
32394 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
32395 (No scheduling is implemented for this chip.)
32396
32397 @item c3-2
32398 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
32399 (No scheduling is implemented for this chip.)
32400
32401 @item c7
32402 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32403 (No scheduling is implemented for this chip.)
32404
32405 @item samuel-2
32406 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
32407 (No scheduling is implemented for this chip.)
32408
32409 @item nehemiah
32410 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
32411 (No scheduling is implemented for this chip.)
32412
32413 @item esther
32414 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32415 (No scheduling is implemented for this chip.)
32416
32417 @item eden-x2
32418 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
32419 (No scheduling is implemented for this chip.)
32420
32421 @item eden-x4
32422 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
32423 AVX and AVX2 instruction set support.
32424 (No scheduling is implemented for this chip.)
32425
32426 @item nano
32427 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32428 instruction set support.
32429 (No scheduling is implemented for this chip.)
32430
32431 @item nano-1000
32432 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32433 instruction set support.
32434 (No scheduling is implemented for this chip.)
32435
32436 @item nano-2000
32437 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32438 instruction set support.
32439 (No scheduling is implemented for this chip.)
32440
32441 @item nano-3000
32442 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32443 instruction set support.
32444 (No scheduling is implemented for this chip.)
32445
32446 @item nano-x2
32447 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32448 instruction set support.
32449 (No scheduling is implemented for this chip.)
32450
32451 @item nano-x4
32452 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
32453 instruction set support.
32454 (No scheduling is implemented for this chip.)
32455
32456 @item lujiazui
32457 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
32458 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
32459 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
32460
32461 @item geode
32462 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
32463 @end table
32464
32465 @item -mtune=@var{cpu-type}
32466 @opindex mtune
32467 Tune to @var{cpu-type} everything applicable about the generated code, except
32468 for the ABI and the set of available instructions.
32469 While picking a specific @var{cpu-type} schedules things appropriately
32470 for that particular chip, the compiler does not generate any code that
32471 cannot run on the default machine type unless you use a
32472 @option{-march=@var{cpu-type}} option.
32473 For example, if GCC is configured for i686-pc-linux-gnu
32474 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
32475 but still runs on i686 machines.
32476
32477 The choices for @var{cpu-type} are the same as for @option{-march}.
32478 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
32479
32480 @table @samp
32481 @item generic
32482 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
32483 If you know the CPU on which your code will run, then you should use
32484 the corresponding @option{-mtune} or @option{-march} option instead of
32485 @option{-mtune=generic}. But, if you do not know exactly what CPU users
32486 of your application will have, then you should use this option.
32487
32488 As new processors are deployed in the marketplace, the behavior of this
32489 option will change. Therefore, if you upgrade to a newer version of
32490 GCC, code generation controlled by this option will change to reflect
32491 the processors
32492 that are most common at the time that version of GCC is released.
32493
32494 There is no @option{-march=generic} option because @option{-march}
32495 indicates the instruction set the compiler can use, and there is no
32496 generic instruction set applicable to all processors. In contrast,
32497 @option{-mtune} indicates the processor (or, in this case, collection of
32498 processors) for which the code is optimized.
32499
32500 @item intel
32501 Produce code optimized for the most current Intel processors, which are
32502 Haswell and Silvermont for this version of GCC. If you know the CPU
32503 on which your code will run, then you should use the corresponding
32504 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
32505 But, if you want your application performs better on both Haswell and
32506 Silvermont, then you should use this option.
32507
32508 As new Intel processors are deployed in the marketplace, the behavior of
32509 this option will change. Therefore, if you upgrade to a newer version of
32510 GCC, code generation controlled by this option will change to reflect
32511 the most current Intel processors at the time that version of GCC is
32512 released.
32513
32514 There is no @option{-march=intel} option because @option{-march} indicates
32515 the instruction set the compiler can use, and there is no common
32516 instruction set applicable to all processors. In contrast,
32517 @option{-mtune} indicates the processor (or, in this case, collection of
32518 processors) for which the code is optimized.
32519 @end table
32520
32521 @item -mcpu=@var{cpu-type}
32522 @opindex mcpu
32523 A deprecated synonym for @option{-mtune}.
32524
32525 @item -mfpmath=@var{unit}
32526 @opindex mfpmath
32527 Generate floating-point arithmetic for selected unit @var{unit}. The choices
32528 for @var{unit} are:
32529
32530 @table @samp
32531 @item 387
32532 Use the standard 387 floating-point coprocessor present on the majority of chips and
32533 emulated otherwise. Code compiled with this option runs almost everywhere.
32534 The temporary results are computed in 80-bit precision instead of the precision
32535 specified by the type, resulting in slightly different results compared to most
32536 of other chips. See @option{-ffloat-store} for more detailed description.
32537
32538 This is the default choice for non-Darwin x86-32 targets.
32539
32540 @item sse
32541 Use scalar floating-point instructions present in the SSE instruction set.
32542 This instruction set is supported by Pentium III and newer chips,
32543 and in the AMD line
32544 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
32545 instruction set supports only single-precision arithmetic, thus the double and
32546 extended-precision arithmetic are still done using 387. A later version, present
32547 only in Pentium 4 and AMD x86-64 chips, supports double-precision
32548 arithmetic too.
32549
32550 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
32551 or @option{-msse2} switches to enable SSE extensions and make this option
32552 effective. For the x86-64 compiler, these extensions are enabled by default.
32553
32554 The resulting code should be considerably faster in the majority of cases and avoid
32555 the numerical instability problems of 387 code, but may break some existing
32556 code that expects temporaries to be 80 bits.
32557
32558 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
32559 and the default choice for x86-32 targets with the SSE2 instruction set
32560 when @option{-ffast-math} is enabled.
32561
32562 @item sse,387
32563 @itemx sse+387
32564 @itemx both
32565 Attempt to utilize both instruction sets at once. This effectively doubles the
32566 amount of available registers, and on chips with separate execution units for
32567 387 and SSE the execution resources too. Use this option with care, as it is
32568 still experimental, because the GCC register allocator does not model separate
32569 functional units well, resulting in unstable performance.
32570 @end table
32571
32572 @item -masm=@var{dialect}
32573 @opindex masm=@var{dialect}
32574 Output assembly instructions using selected @var{dialect}. Also affects
32575 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
32576 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
32577 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
32578 not support @samp{intel}.
32579
32580 @item -mieee-fp
32581 @itemx -mno-ieee-fp
32582 @opindex mieee-fp
32583 @opindex mno-ieee-fp
32584 Control whether or not the compiler uses IEEE floating-point
32585 comparisons. These correctly handle the case where the result of a
32586 comparison is unordered.
32587
32588 @item -m80387
32589 @itemx -mhard-float
32590 @opindex m80387
32591 @opindex mhard-float
32592 Generate output containing 80387 instructions for floating point.
32593
32594 @item -mno-80387
32595 @itemx -msoft-float
32596 @opindex no-80387
32597 @opindex msoft-float
32598 Generate output containing library calls for floating point.
32599
32600 @strong{Warning:} the requisite libraries are not part of GCC@.
32601 Normally the facilities of the machine's usual C compiler are used, but
32602 this cannot be done directly in cross-compilation. You must make your
32603 own arrangements to provide suitable library functions for
32604 cross-compilation.
32605
32606 On machines where a function returns floating-point results in the 80387
32607 register stack, some floating-point opcodes may be emitted even if
32608 @option{-msoft-float} is used.
32609
32610 @item -mno-fp-ret-in-387
32611 @opindex mno-fp-ret-in-387
32612 @opindex mfp-ret-in-387
32613 Do not use the FPU registers for return values of functions.
32614
32615 The usual calling convention has functions return values of types
32616 @code{float} and @code{double} in an FPU register, even if there
32617 is no FPU@. The idea is that the operating system should emulate
32618 an FPU@.
32619
32620 The option @option{-mno-fp-ret-in-387} causes such values to be returned
32621 in ordinary CPU registers instead.
32622
32623 @item -mno-fancy-math-387
32624 @opindex mno-fancy-math-387
32625 @opindex mfancy-math-387
32626 Some 387 emulators do not support the @code{sin}, @code{cos} and
32627 @code{sqrt} instructions for the 387. Specify this option to avoid
32628 generating those instructions.
32629 This option is overridden when @option{-march}
32630 indicates that the target CPU always has an FPU and so the
32631 instruction does not need emulation. These
32632 instructions are not generated unless you also use the
32633 @option{-funsafe-math-optimizations} switch.
32634
32635 @item -malign-double
32636 @itemx -mno-align-double
32637 @opindex malign-double
32638 @opindex mno-align-double
32639 Control whether GCC aligns @code{double}, @code{long double}, and
32640 @code{long long} variables on a two-word boundary or a one-word
32641 boundary. Aligning @code{double} variables on a two-word boundary
32642 produces code that runs somewhat faster on a Pentium at the
32643 expense of more memory.
32644
32645 On x86-64, @option{-malign-double} is enabled by default.
32646
32647 @strong{Warning:} if you use the @option{-malign-double} switch,
32648 structures containing the above types are aligned differently than
32649 the published application binary interface specifications for the x86-32
32650 and are not binary compatible with structures in code compiled
32651 without that switch.
32652
32653 @item -m96bit-long-double
32654 @itemx -m128bit-long-double
32655 @opindex m96bit-long-double
32656 @opindex m128bit-long-double
32657 These switches control the size of @code{long double} type. The x86-32
32658 application binary interface specifies the size to be 96 bits,
32659 so @option{-m96bit-long-double} is the default in 32-bit mode.
32660
32661 Modern architectures (Pentium and newer) prefer @code{long double}
32662 to be aligned to an 8- or 16-byte boundary. In arrays or structures
32663 conforming to the ABI, this is not possible. So specifying
32664 @option{-m128bit-long-double} aligns @code{long double}
32665 to a 16-byte boundary by padding the @code{long double} with an additional
32666 32-bit zero.
32667
32668 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
32669 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
32670
32671 Notice that neither of these options enable any extra precision over the x87
32672 standard of 80 bits for a @code{long double}.
32673
32674 @strong{Warning:} if you override the default value for your target ABI, this
32675 changes the size of
32676 structures and arrays containing @code{long double} variables,
32677 as well as modifying the function calling convention for functions taking
32678 @code{long double}. Hence they are not binary-compatible
32679 with code compiled without that switch.
32680
32681 @item -mlong-double-64
32682 @itemx -mlong-double-80
32683 @itemx -mlong-double-128
32684 @opindex mlong-double-64
32685 @opindex mlong-double-80
32686 @opindex mlong-double-128
32687 These switches control the size of @code{long double} type. A size
32688 of 64 bits makes the @code{long double} type equivalent to the @code{double}
32689 type. This is the default for 32-bit Bionic C library. A size
32690 of 128 bits makes the @code{long double} type equivalent to the
32691 @code{__float128} type. This is the default for 64-bit Bionic C library.
32692
32693 @strong{Warning:} if you override the default value for your target ABI, this
32694 changes the size of
32695 structures and arrays containing @code{long double} variables,
32696 as well as modifying the function calling convention for functions taking
32697 @code{long double}. Hence they are not binary-compatible
32698 with code compiled without that switch.
32699
32700 @item -malign-data=@var{type}
32701 @opindex malign-data
32702 Control how GCC aligns variables. Supported values for @var{type} are
32703 @samp{compat} uses increased alignment value compatible uses GCC 4.8
32704 and earlier, @samp{abi} uses alignment value as specified by the
32705 psABI, and @samp{cacheline} uses increased alignment value to match
32706 the cache line size. @samp{compat} is the default.
32707
32708 @item -mlarge-data-threshold=@var{threshold}
32709 @opindex mlarge-data-threshold
32710 When @option{-mcmodel=medium} is specified, data objects larger than
32711 @var{threshold} are placed in the large data section. This value must be the
32712 same across all objects linked into the binary, and defaults to 65535.
32713
32714 @item -mrtd
32715 @opindex mrtd
32716 Use a different function-calling convention, in which functions that
32717 take a fixed number of arguments return with the @code{ret @var{num}}
32718 instruction, which pops their arguments while returning. This saves one
32719 instruction in the caller since there is no need to pop the arguments
32720 there.
32721
32722 You can specify that an individual function is called with this calling
32723 sequence with the function attribute @code{stdcall}. You can also
32724 override the @option{-mrtd} option by using the function attribute
32725 @code{cdecl}. @xref{Function Attributes}.
32726
32727 @strong{Warning:} this calling convention is incompatible with the one
32728 normally used on Unix, so you cannot use it if you need to call
32729 libraries compiled with the Unix compiler.
32730
32731 Also, you must provide function prototypes for all functions that
32732 take variable numbers of arguments (including @code{printf});
32733 otherwise incorrect code is generated for calls to those
32734 functions.
32735
32736 In addition, seriously incorrect code results if you call a
32737 function with too many arguments. (Normally, extra arguments are
32738 harmlessly ignored.)
32739
32740 @item -mregparm=@var{num}
32741 @opindex mregparm
32742 Control how many registers are used to pass integer arguments. By
32743 default, no registers are used to pass arguments, and at most 3
32744 registers can be used. You can control this behavior for a specific
32745 function by using the function attribute @code{regparm}.
32746 @xref{Function Attributes}.
32747
32748 @strong{Warning:} if you use this switch, and
32749 @var{num} is nonzero, then you must build all modules with the same
32750 value, including any libraries. This includes the system libraries and
32751 startup modules.
32752
32753 @item -msseregparm
32754 @opindex msseregparm
32755 Use SSE register passing conventions for float and double arguments
32756 and return values. You can control this behavior for a specific
32757 function by using the function attribute @code{sseregparm}.
32758 @xref{Function Attributes}.
32759
32760 @strong{Warning:} if you use this switch then you must build all
32761 modules with the same value, including any libraries. This includes
32762 the system libraries and startup modules.
32763
32764 @item -mvect8-ret-in-mem
32765 @opindex mvect8-ret-in-mem
32766 Return 8-byte vectors in memory instead of MMX registers. This is the
32767 default on VxWorks to match the ABI of the Sun Studio compilers until
32768 version 12. @emph{Only} use this option if you need to remain
32769 compatible with existing code produced by those previous compiler
32770 versions or older versions of GCC@.
32771
32772 @item -mpc32
32773 @itemx -mpc64
32774 @itemx -mpc80
32775 @opindex mpc32
32776 @opindex mpc64
32777 @opindex mpc80
32778
32779 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
32780 is specified, the significands of results of floating-point operations are
32781 rounded to 24 bits (single precision); @option{-mpc64} rounds the
32782 significands of results of floating-point operations to 53 bits (double
32783 precision) and @option{-mpc80} rounds the significands of results of
32784 floating-point operations to 64 bits (extended double precision), which is
32785 the default. When this option is used, floating-point operations in higher
32786 precisions are not available to the programmer without setting the FPU
32787 control word explicitly.
32788
32789 Setting the rounding of floating-point operations to less than the default
32790 80 bits can speed some programs by 2% or more. Note that some mathematical
32791 libraries assume that extended-precision (80-bit) floating-point operations
32792 are enabled by default; routines in such libraries could suffer significant
32793 loss of accuracy, typically through so-called ``catastrophic cancellation'',
32794 when this option is used to set the precision to less than extended precision.
32795
32796 @item -mdaz-ftz
32797 @opindex mdaz-ftz
32798
32799 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
32800 are used to control floating-point calculations.SSE and AVX instructions
32801 including scalar and vector instructions could benefit from enabling the FTZ
32802 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
32803 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
32804 will set FTZ/DAZ flags even with @option{-shared}.
32805
32806 @item -mstackrealign
32807 @opindex mstackrealign
32808 Realign the stack at entry. On the x86, the @option{-mstackrealign}
32809 option generates an alternate prologue and epilogue that realigns the
32810 run-time stack if necessary. This supports mixing legacy codes that keep
32811 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
32812 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
32813 applicable to individual functions.
32814
32815 @item -mpreferred-stack-boundary=@var{num}
32816 @opindex mpreferred-stack-boundary
32817 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
32818 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
32819 the default is 4 (16 bytes or 128 bits).
32820
32821 @strong{Warning:} When generating code for the x86-64 architecture with
32822 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
32823 used to keep the stack boundary aligned to 8 byte boundary. Since
32824 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
32825 intended to be used in controlled environment where stack space is
32826 important limitation. This option leads to wrong code when functions
32827 compiled with 16 byte stack alignment (such as functions from a standard
32828 library) are called with misaligned stack. In this case, SSE
32829 instructions may lead to misaligned memory access traps. In addition,
32830 variable arguments are handled incorrectly for 16 byte aligned
32831 objects (including x87 long double and __int128), leading to wrong
32832 results. You must build all modules with
32833 @option{-mpreferred-stack-boundary=3}, including any libraries. This
32834 includes the system libraries and startup modules.
32835
32836 @item -mincoming-stack-boundary=@var{num}
32837 @opindex mincoming-stack-boundary
32838 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
32839 boundary. If @option{-mincoming-stack-boundary} is not specified,
32840 the one specified by @option{-mpreferred-stack-boundary} is used.
32841
32842 On Pentium and Pentium Pro, @code{double} and @code{long double} values
32843 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
32844 suffer significant run time performance penalties. On Pentium III, the
32845 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
32846 properly if it is not 16-byte aligned.
32847
32848 To ensure proper alignment of this values on the stack, the stack boundary
32849 must be as aligned as that required by any value stored on the stack.
32850 Further, every function must be generated such that it keeps the stack
32851 aligned. Thus calling a function compiled with a higher preferred
32852 stack boundary from a function compiled with a lower preferred stack
32853 boundary most likely misaligns the stack. It is recommended that
32854 libraries that use callbacks always use the default setting.
32855
32856 This extra alignment does consume extra stack space, and generally
32857 increases code size. Code that is sensitive to stack space usage, such
32858 as embedded systems and operating system kernels, may want to reduce the
32859 preferred alignment to @option{-mpreferred-stack-boundary=2}.
32860
32861 @need 200
32862 @item -mmmx
32863 @opindex mmmx
32864 @need 200
32865 @itemx -msse
32866 @opindex msse
32867 @need 200
32868 @itemx -msse2
32869 @opindex msse2
32870 @need 200
32871 @itemx -msse3
32872 @opindex msse3
32873 @need 200
32874 @itemx -mssse3
32875 @opindex mssse3
32876 @need 200
32877 @itemx -msse4
32878 @opindex msse4
32879 @need 200
32880 @itemx -msse4a
32881 @opindex msse4a
32882 @need 200
32883 @itemx -msse4.1
32884 @opindex msse4.1
32885 @need 200
32886 @itemx -msse4.2
32887 @opindex msse4.2
32888 @need 200
32889 @itemx -mavx
32890 @opindex mavx
32891 @need 200
32892 @itemx -mavx2
32893 @opindex mavx2
32894 @need 200
32895 @itemx -mavx512f
32896 @opindex mavx512f
32897 @need 200
32898 @itemx -mavx512pf
32899 @opindex mavx512pf
32900 @need 200
32901 @itemx -mavx512er
32902 @opindex mavx512er
32903 @need 200
32904 @itemx -mavx512cd
32905 @opindex mavx512cd
32906 @need 200
32907 @itemx -mavx512vl
32908 @opindex mavx512vl
32909 @need 200
32910 @itemx -mavx512bw
32911 @opindex mavx512bw
32912 @need 200
32913 @itemx -mavx512dq
32914 @opindex mavx512dq
32915 @need 200
32916 @itemx -mavx512ifma
32917 @opindex mavx512ifma
32918 @need 200
32919 @itemx -mavx512vbmi
32920 @opindex mavx512vbmi
32921 @need 200
32922 @itemx -msha
32923 @opindex msha
32924 @need 200
32925 @itemx -maes
32926 @opindex maes
32927 @need 200
32928 @itemx -mpclmul
32929 @opindex mpclmul
32930 @need 200
32931 @itemx -mclflushopt
32932 @opindex mclflushopt
32933 @need 200
32934 @itemx -mclwb
32935 @opindex mclwb
32936 @need 200
32937 @itemx -mfsgsbase
32938 @opindex mfsgsbase
32939 @need 200
32940 @itemx -mptwrite
32941 @opindex mptwrite
32942 @need 200
32943 @itemx -mrdrnd
32944 @opindex mrdrnd
32945 @need 200
32946 @itemx -mf16c
32947 @opindex mf16c
32948 @need 200
32949 @itemx -mfma
32950 @opindex mfma
32951 @need 200
32952 @itemx -mpconfig
32953 @opindex mpconfig
32954 @need 200
32955 @itemx -mwbnoinvd
32956 @opindex mwbnoinvd
32957 @need 200
32958 @itemx -mfma4
32959 @opindex mfma4
32960 @need 200
32961 @itemx -mprfchw
32962 @opindex mprfchw
32963 @need 200
32964 @itemx -mrdpid
32965 @opindex mrdpid
32966 @need 200
32967 @itemx -mprefetchwt1
32968 @opindex mprefetchwt1
32969 @need 200
32970 @itemx -mrdseed
32971 @opindex mrdseed
32972 @need 200
32973 @itemx -msgx
32974 @opindex msgx
32975 @need 200
32976 @itemx -mxop
32977 @opindex mxop
32978 @need 200
32979 @itemx -mlwp
32980 @opindex mlwp
32981 @need 200
32982 @itemx -m3dnow
32983 @opindex m3dnow
32984 @need 200
32985 @itemx -m3dnowa
32986 @opindex m3dnowa
32987 @need 200
32988 @itemx -mpopcnt
32989 @opindex mpopcnt
32990 @need 200
32991 @itemx -mabm
32992 @opindex mabm
32993 @need 200
32994 @itemx -madx
32995 @opindex madx
32996 @need 200
32997 @itemx -mbmi
32998 @opindex mbmi
32999 @need 200
33000 @itemx -mbmi2
33001 @opindex mbmi2
33002 @need 200
33003 @itemx -mlzcnt
33004 @opindex mlzcnt
33005 @need 200
33006 @itemx -mfxsr
33007 @opindex mfxsr
33008 @need 200
33009 @itemx -mxsave
33010 @opindex mxsave
33011 @need 200
33012 @itemx -mxsaveopt
33013 @opindex mxsaveopt
33014 @need 200
33015 @itemx -mxsavec
33016 @opindex mxsavec
33017 @need 200
33018 @itemx -mxsaves
33019 @opindex mxsaves
33020 @need 200
33021 @itemx -mrtm
33022 @opindex mrtm
33023 @need 200
33024 @itemx -mhle
33025 @opindex mhle
33026 @need 200
33027 @itemx -mtbm
33028 @opindex mtbm
33029 @need 200
33030 @itemx -mmwaitx
33031 @opindex mmwaitx
33032 @need 200
33033 @itemx -mclzero
33034 @opindex mclzero
33035 @need 200
33036 @itemx -mpku
33037 @opindex mpku
33038 @need 200
33039 @itemx -mavx512vbmi2
33040 @opindex mavx512vbmi2
33041 @need 200
33042 @itemx -mavx512bf16
33043 @opindex mavx512bf16
33044 @need 200
33045 @itemx -mavx512fp16
33046 @opindex mavx512fp16
33047 @need 200
33048 @itemx -mgfni
33049 @opindex mgfni
33050 @need 200
33051 @itemx -mvaes
33052 @opindex mvaes
33053 @need 200
33054 @itemx -mwaitpkg
33055 @opindex mwaitpkg
33056 @need 200
33057 @itemx -mvpclmulqdq
33058 @opindex mvpclmulqdq
33059 @need 200
33060 @itemx -mavx512bitalg
33061 @opindex mavx512bitalg
33062 @need 200
33063 @itemx -mmovdiri
33064 @opindex mmovdiri
33065 @need 200
33066 @itemx -mmovdir64b
33067 @opindex mmovdir64b
33068 @need 200
33069 @itemx -menqcmd
33070 @opindex menqcmd
33071 @itemx -muintr
33072 @opindex muintr
33073 @need 200
33074 @itemx -mtsxldtrk
33075 @opindex mtsxldtrk
33076 @need 200
33077 @itemx -mavx512vpopcntdq
33078 @opindex mavx512vpopcntdq
33079 @need 200
33080 @itemx -mavx512vp2intersect
33081 @opindex mavx512vp2intersect
33082 @need 200
33083 @itemx -mavx5124fmaps
33084 @opindex mavx5124fmaps
33085 @need 200
33086 @itemx -mavx512vnni
33087 @opindex mavx512vnni
33088 @need 200
33089 @itemx -mavxvnni
33090 @opindex mavxvnni
33091 @need 200
33092 @itemx -mavx5124vnniw
33093 @opindex mavx5124vnniw
33094 @need 200
33095 @itemx -mcldemote
33096 @opindex mcldemote
33097 @need 200
33098 @itemx -mserialize
33099 @opindex mserialize
33100 @need 200
33101 @itemx -mamx-tile
33102 @opindex mamx-tile
33103 @need 200
33104 @itemx -mamx-int8
33105 @opindex mamx-int8
33106 @need 200
33107 @itemx -mamx-bf16
33108 @opindex mamx-bf16
33109 @need 200
33110 @itemx -mhreset
33111 @opindex mhreset
33112 @itemx -mkl
33113 @opindex mkl
33114 @need 200
33115 @itemx -mwidekl
33116 @opindex mwidekl
33117 @need 200
33118 @itemx -mavxifma
33119 @opindex mavxifma
33120 @need 200
33121 @itemx -mavxvnniint8
33122 @opindex mavxvnniint8
33123 @need 200
33124 @itemx -mavxneconvert
33125 @opindex mavxneconvert
33126 @need 200
33127 @itemx -mcmpccxadd
33128 @opindex mcmpccxadd
33129 @need 200
33130 @itemx -mamx-fp16
33131 @opindex mamx-fp16
33132 @need 200
33133 @itemx -mprefetchi
33134 @opindex mprefetchi
33135 @need 200
33136 @itemx -mraoint
33137 @opindex mraoint
33138 These switches enable the use of instructions in the MMX, SSE,
33139 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
33140 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
33141 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
33142 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
33143 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
33144 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
33145 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
33146 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
33147 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16,
33148 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT or
33149 CLDEMOTE extended instruction sets. Each has a corresponding @option{-mno-}
33150 option to disable use of these instructions.
33151
33152 These extensions are also available as built-in functions: see
33153 @ref{x86 Built-in Functions}, for details of the functions enabled and
33154 disabled by these switches.
33155
33156 To generate SSE/SSE2 instructions automatically from floating-point
33157 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
33158
33159 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
33160 generates new AVX instructions or AVX equivalence for all SSEx instructions
33161 when needed.
33162
33163 These options enable GCC to use these extended instructions in
33164 generated code, even without @option{-mfpmath=sse}. Applications that
33165 perform run-time CPU detection must compile separate files for each
33166 supported architecture, using the appropriate flags. In particular,
33167 the file containing the CPU detection code should be compiled without
33168 these options.
33169
33170 @item -mdump-tune-features
33171 @opindex mdump-tune-features
33172 This option instructs GCC to dump the names of the x86 performance
33173 tuning features and default settings. The names can be used in
33174 @option{-mtune-ctrl=@var{feature-list}}.
33175
33176 @item -mtune-ctrl=@var{feature-list}
33177 @opindex mtune-ctrl=@var{feature-list}
33178 This option is used to do fine grain control of x86 code generation features.
33179 @var{feature-list} is a comma separated list of @var{feature} names. See also
33180 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
33181 on if it is not preceded with @samp{^}, otherwise, it is turned off.
33182 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
33183 developers. Using it may lead to code paths not covered by testing and can
33184 potentially result in compiler ICEs or runtime errors.
33185
33186 @item -mno-default
33187 @opindex mno-default
33188 This option instructs GCC to turn off all tunable features. See also
33189 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
33190
33191 @item -mcld
33192 @opindex mcld
33193 This option instructs GCC to emit a @code{cld} instruction in the prologue
33194 of functions that use string instructions. String instructions depend on
33195 the DF flag to select between autoincrement or autodecrement mode. While the
33196 ABI specifies the DF flag to be cleared on function entry, some operating
33197 systems violate this specification by not clearing the DF flag in their
33198 exception dispatchers. The exception handler can be invoked with the DF flag
33199 set, which leads to wrong direction mode when string instructions are used.
33200 This option can be enabled by default on 32-bit x86 targets by configuring
33201 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
33202 instructions can be suppressed with the @option{-mno-cld} compiler option
33203 in this case.
33204
33205 @item -mvzeroupper
33206 @opindex mvzeroupper
33207 This option instructs GCC to emit a @code{vzeroupper} instruction
33208 before a transfer of control flow out of the function to minimize
33209 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
33210 intrinsics.
33211
33212 @item -mprefer-avx128
33213 @opindex mprefer-avx128
33214 This option instructs GCC to use 128-bit AVX instructions instead of
33215 256-bit AVX instructions in the auto-vectorizer.
33216
33217 @item -mprefer-vector-width=@var{opt}
33218 @opindex mprefer-vector-width
33219 This option instructs GCC to use @var{opt}-bit vector width in instructions
33220 instead of default on the selected platform.
33221
33222 @item -mmove-max=@var{bits}
33223 @opindex mmove-max
33224 This option instructs GCC to set the maximum number of bits can be
33225 moved from memory to memory efficiently to @var{bits}. The valid
33226 @var{bits} are 128, 256 and 512.
33227
33228 @item -mstore-max=@var{bits}
33229 @opindex mstore-max
33230 This option instructs GCC to set the maximum number of bits can be
33231 stored to memory efficiently to @var{bits}. The valid @var{bits} are
33232 128, 256 and 512.
33233
33234 @table @samp
33235 @item none
33236 No extra limitations applied to GCC other than defined by the selected platform.
33237
33238 @item 128
33239 Prefer 128-bit vector width for instructions.
33240
33241 @item 256
33242 Prefer 256-bit vector width for instructions.
33243
33244 @item 512
33245 Prefer 512-bit vector width for instructions.
33246 @end table
33247
33248 @item -mcx16
33249 @opindex mcx16
33250 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
33251 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
33252 objects. This is useful for atomic updates of data structures exceeding one
33253 machine word in size. The compiler uses this instruction to implement
33254 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
33255 128-bit integers, a library call is always used.
33256
33257 @item -msahf
33258 @opindex msahf
33259 This option enables generation of @code{SAHF} instructions in 64-bit code.
33260 Early Intel Pentium 4 CPUs with Intel 64 support,
33261 prior to the introduction of Pentium 4 G1 step in December 2005,
33262 lacked the @code{LAHF} and @code{SAHF} instructions
33263 which are supported by AMD64.
33264 These are load and store instructions, respectively, for certain status flags.
33265 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
33266 @code{drem}, and @code{remainder} built-in functions;
33267 see @ref{Other Builtins} for details.
33268
33269 @item -mmovbe
33270 @opindex mmovbe
33271 This option enables use of the @code{movbe} instruction to implement
33272 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
33273
33274 @item -mshstk
33275 @opindex mshstk
33276 The @option{-mshstk} option enables shadow stack built-in functions
33277 from x86 Control-flow Enforcement Technology (CET).
33278
33279 @item -mcrc32
33280 @opindex mcrc32
33281 This option enables built-in functions @code{__builtin_ia32_crc32qi},
33282 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
33283 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
33284
33285 @item -mmwait
33286 @opindex mmwait
33287 This option enables built-in functions @code{__builtin_ia32_monitor},
33288 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
33289 @code{mwait} machine instructions.
33290
33291 @item -mrecip
33292 @opindex mrecip
33293 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
33294 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
33295 with an additional Newton-Raphson step
33296 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
33297 (and their vectorized
33298 variants) for single-precision floating-point arguments. These instructions
33299 are generated only when @option{-funsafe-math-optimizations} is enabled
33300 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
33301 Note that while the throughput of the sequence is higher than the throughput
33302 of the non-reciprocal instruction, the precision of the sequence can be
33303 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
33304
33305 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
33306 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
33307 combination), and doesn't need @option{-mrecip}.
33308
33309 Also note that GCC emits the above sequence with additional Newton-Raphson step
33310 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
33311 already with @option{-ffast-math} (or the above option combination), and
33312 doesn't need @option{-mrecip}.
33313
33314 @item -mrecip=@var{opt}
33315 @opindex mrecip=opt
33316 This option controls which reciprocal estimate instructions
33317 may be used. @var{opt} is a comma-separated list of options, which may
33318 be preceded by a @samp{!} to invert the option:
33319
33320 @table @samp
33321 @item all
33322 Enable all estimate instructions.
33323
33324 @item default
33325 Enable the default instructions, equivalent to @option{-mrecip}.
33326
33327 @item none
33328 Disable all estimate instructions, equivalent to @option{-mno-recip}.
33329
33330 @item div
33331 Enable the approximation for scalar division.
33332
33333 @item vec-div
33334 Enable the approximation for vectorized division.
33335
33336 @item sqrt
33337 Enable the approximation for scalar square root.
33338
33339 @item vec-sqrt
33340 Enable the approximation for vectorized square root.
33341 @end table
33342
33343 So, for example, @option{-mrecip=all,!sqrt} enables
33344 all of the reciprocal approximations, except for square root.
33345
33346 @item -mveclibabi=@var{type}
33347 @opindex mveclibabi
33348 Specifies the ABI type to use for vectorizing intrinsics using an
33349 external library. Supported values for @var{type} are @samp{svml}
33350 for the Intel short
33351 vector math library and @samp{acml} for the AMD math core library.
33352 To use this option, both @option{-ftree-vectorize} and
33353 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
33354 ABI-compatible library must be specified at link time.
33355
33356 GCC currently emits calls to @code{vmldExp2},
33357 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
33358 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
33359 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
33360 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
33361 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
33362 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
33363 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
33364 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
33365 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
33366 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
33367 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
33368 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
33369 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
33370 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
33371 when @option{-mveclibabi=acml} is used.
33372
33373 @item -mabi=@var{name}
33374 @opindex mabi
33375 Generate code for the specified calling convention. Permissible values
33376 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
33377 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
33378 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
33379 You can control this behavior for specific functions by
33380 using the function attributes @code{ms_abi} and @code{sysv_abi}.
33381 @xref{Function Attributes}.
33382
33383 @item -mforce-indirect-call
33384 @opindex mforce-indirect-call
33385 Force all calls to functions to be indirect. This is useful
33386 when using Intel Processor Trace where it generates more precise timing
33387 information for function calls.
33388
33389 @item -mmanual-endbr
33390 @opindex mmanual-endbr
33391 Insert ENDBR instruction at function entry only via the @code{cf_check}
33392 function attribute. This is useful when used with the option
33393 @option{-fcf-protection=branch} to control ENDBR insertion at the
33394 function entry.
33395
33396 @item -mcet-switch
33397 @opindex mcet-switch
33398 By default, CET instrumentation is turned off on switch statements that
33399 use a jump table and indirect branch track is disabled. Since jump
33400 tables are stored in read-only memory, this does not result in a direct
33401 loss of hardening. But if the jump table index is attacker-controlled,
33402 the indirect jump may not be constrained by CET. This option turns on
33403 CET instrumentation to enable indirect branch track for switch statements
33404 with jump tables which leads to the jump targets reachable via any indirect
33405 jumps.
33406
33407 @item -mcall-ms2sysv-xlogues
33408 @opindex mcall-ms2sysv-xlogues
33409 @opindex mno-call-ms2sysv-xlogues
33410 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
33411 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
33412 default, the code for saving and restoring these registers is emitted inline,
33413 resulting in fairly lengthy prologues and epilogues. Using
33414 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
33415 use stubs in the static portion of libgcc to perform these saves and restores,
33416 thus reducing function size at the cost of a few extra instructions.
33417
33418 @item -mtls-dialect=@var{type}
33419 @opindex mtls-dialect
33420 Generate code to access thread-local storage using the @samp{gnu} or
33421 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
33422 @samp{gnu2} is more efficient, but it may add compile- and run-time
33423 requirements that cannot be satisfied on all systems.
33424
33425 @item -mpush-args
33426 @itemx -mno-push-args
33427 @opindex mpush-args
33428 @opindex mno-push-args
33429 Use PUSH operations to store outgoing parameters. This method is shorter
33430 and usually equally fast as method using SUB/MOV operations and is enabled
33431 by default. In some cases disabling it may improve performance because of
33432 improved scheduling and reduced dependencies.
33433
33434 @item -maccumulate-outgoing-args
33435 @opindex maccumulate-outgoing-args
33436 If enabled, the maximum amount of space required for outgoing arguments is
33437 computed in the function prologue. This is faster on most modern CPUs
33438 because of reduced dependencies, improved scheduling and reduced stack usage
33439 when the preferred stack boundary is not equal to 2. The drawback is a notable
33440 increase in code size. This switch implies @option{-mno-push-args}.
33441
33442 @item -mthreads
33443 @opindex mthreads
33444 Support thread-safe exception handling on MinGW. Programs that rely
33445 on thread-safe exception handling must compile and link all code with the
33446 @option{-mthreads} option. When compiling, @option{-mthreads} defines
33447 @option{-D_MT}; when linking, it links in a special thread helper library
33448 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
33449
33450 @item -mms-bitfields
33451 @itemx -mno-ms-bitfields
33452 @opindex mms-bitfields
33453 @opindex mno-ms-bitfields
33454
33455 Enable/disable bit-field layout compatible with the native Microsoft
33456 Windows compiler.
33457
33458 If @code{packed} is used on a structure, or if bit-fields are used,
33459 it may be that the Microsoft ABI lays out the structure differently
33460 than the way GCC normally does. Particularly when moving packed
33461 data between functions compiled with GCC and the native Microsoft compiler
33462 (either via function call or as data in a file), it may be necessary to access
33463 either format.
33464
33465 This option is enabled by default for Microsoft Windows
33466 targets. This behavior can also be controlled locally by use of variable
33467 or type attributes. For more information, see @ref{x86 Variable Attributes}
33468 and @ref{x86 Type Attributes}.
33469
33470 The Microsoft structure layout algorithm is fairly simple with the exception
33471 of the bit-field packing.
33472 The padding and alignment of members of structures and whether a bit-field
33473 can straddle a storage-unit boundary are determine by these rules:
33474
33475 @enumerate
33476 @item Structure members are stored sequentially in the order in which they are
33477 declared: the first member has the lowest memory address and the last member
33478 the highest.
33479
33480 @item Every data object has an alignment requirement. The alignment requirement
33481 for all data except structures, unions, and arrays is either the size of the
33482 object or the current packing size (specified with either the
33483 @code{aligned} attribute or the @code{pack} pragma),
33484 whichever is less. For structures, unions, and arrays,
33485 the alignment requirement is the largest alignment requirement of its members.
33486 Every object is allocated an offset so that:
33487
33488 @smallexample
33489 offset % alignment_requirement == 0
33490 @end smallexample
33491
33492 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
33493 unit if the integral types are the same size and if the next bit-field fits
33494 into the current allocation unit without crossing the boundary imposed by the
33495 common alignment requirements of the bit-fields.
33496 @end enumerate
33497
33498 MSVC interprets zero-length bit-fields in the following ways:
33499
33500 @enumerate
33501 @item If a zero-length bit-field is inserted between two bit-fields that
33502 are normally coalesced, the bit-fields are not coalesced.
33503
33504 For example:
33505
33506 @smallexample
33507 struct
33508 @{
33509 unsigned long bf_1 : 12;
33510 unsigned long : 0;
33511 unsigned long bf_2 : 12;
33512 @} t1;
33513 @end smallexample
33514
33515 @noindent
33516 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
33517 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
33518
33519 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
33520 alignment of the zero-length bit-field is greater than the member that follows it,
33521 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
33522
33523 For example:
33524
33525 @smallexample
33526 struct
33527 @{
33528 char foo : 4;
33529 short : 0;
33530 char bar;
33531 @} t2;
33532
33533 struct
33534 @{
33535 char foo : 4;
33536 short : 0;
33537 double bar;
33538 @} t3;
33539 @end smallexample
33540
33541 @noindent
33542 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
33543 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
33544 bit-field does not affect the alignment of @code{bar} or, as a result, the size
33545 of the structure.
33546
33547 Taking this into account, it is important to note the following:
33548
33549 @enumerate
33550 @item If a zero-length bit-field follows a normal bit-field, the type of the
33551 zero-length bit-field may affect the alignment of the structure as whole. For
33552 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
33553 normal bit-field, and is of type short.
33554
33555 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
33556 still affect the alignment of the structure:
33557
33558 @smallexample
33559 struct
33560 @{
33561 char foo : 6;
33562 long : 0;
33563 @} t4;
33564 @end smallexample
33565
33566 @noindent
33567 Here, @code{t4} takes up 4 bytes.
33568 @end enumerate
33569
33570 @item Zero-length bit-fields following non-bit-field members are ignored:
33571
33572 @smallexample
33573 struct
33574 @{
33575 char foo;
33576 long : 0;
33577 char bar;
33578 @} t5;
33579 @end smallexample
33580
33581 @noindent
33582 Here, @code{t5} takes up 2 bytes.
33583 @end enumerate
33584
33585
33586 @item -mno-align-stringops
33587 @opindex mno-align-stringops
33588 @opindex malign-stringops
33589 Do not align the destination of inlined string operations. This switch reduces
33590 code size and improves performance in case the destination is already aligned,
33591 but GCC doesn't know about it.
33592
33593 @item -minline-all-stringops
33594 @opindex minline-all-stringops
33595 By default GCC inlines string operations only when the destination is
33596 known to be aligned to least a 4-byte boundary.
33597 This enables more inlining and increases code
33598 size, but may improve performance of code that depends on fast
33599 @code{memcpy} and @code{memset} for short lengths.
33600 The option enables inline expansion of @code{strlen} for all
33601 pointer alignments.
33602
33603 @item -minline-stringops-dynamically
33604 @opindex minline-stringops-dynamically
33605 For string operations of unknown size, use run-time checks with
33606 inline code for small blocks and a library call for large blocks.
33607
33608 @item -mstringop-strategy=@var{alg}
33609 @opindex mstringop-strategy=@var{alg}
33610 Override the internal decision heuristic for the particular algorithm to use
33611 for inlining string operations. The allowed values for @var{alg} are:
33612
33613 @table @samp
33614 @item rep_byte
33615 @itemx rep_4byte
33616 @itemx rep_8byte
33617 Expand using i386 @code{rep} prefix of the specified size.
33618
33619 @item byte_loop
33620 @itemx loop
33621 @itemx unrolled_loop
33622 Expand into an inline loop.
33623
33624 @item libcall
33625 Always use a library call.
33626 @end table
33627
33628 @item -mmemcpy-strategy=@var{strategy}
33629 @opindex mmemcpy-strategy=@var{strategy}
33630 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
33631 should be inlined and what inline algorithm to use when the expected size
33632 of the copy operation is known. @var{strategy}
33633 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
33634 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
33635 the max byte size with which inline algorithm @var{alg} is allowed. For the last
33636 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
33637 in the list must be specified in increasing order. The minimal byte size for
33638 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
33639 preceding range.
33640
33641 @item -mmemset-strategy=@var{strategy}
33642 @opindex mmemset-strategy=@var{strategy}
33643 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
33644 @code{__builtin_memset} expansion.
33645
33646 @item -momit-leaf-frame-pointer
33647 @opindex momit-leaf-frame-pointer
33648 Don't keep the frame pointer in a register for leaf functions. This
33649 avoids the instructions to save, set up, and restore frame pointers and
33650 makes an extra register available in leaf functions. The option
33651 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
33652 which might make debugging harder.
33653
33654 @item -mtls-direct-seg-refs
33655 @itemx -mno-tls-direct-seg-refs
33656 @opindex mtls-direct-seg-refs
33657 Controls whether TLS variables may be accessed with offsets from the
33658 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
33659 or whether the thread base pointer must be added. Whether or not this
33660 is valid depends on the operating system, and whether it maps the
33661 segment to cover the entire TLS area.
33662
33663 For systems that use the GNU C Library, the default is on.
33664
33665 @item -msse2avx
33666 @itemx -mno-sse2avx
33667 @opindex msse2avx
33668 Specify that the assembler should encode SSE instructions with VEX
33669 prefix. The option @option{-mavx} turns this on by default.
33670
33671 @item -mfentry
33672 @itemx -mno-fentry
33673 @opindex mfentry
33674 If profiling is active (@option{-pg}), put the profiling
33675 counter call before the prologue.
33676 Note: On x86 architectures the attribute @code{ms_hook_prologue}
33677 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
33678
33679 @item -mrecord-mcount
33680 @itemx -mno-record-mcount
33681 @opindex mrecord-mcount
33682 If profiling is active (@option{-pg}), generate a __mcount_loc section
33683 that contains pointers to each profiling call. This is useful for
33684 automatically patching and out calls.
33685
33686 @item -mnop-mcount
33687 @itemx -mno-nop-mcount
33688 @opindex mnop-mcount
33689 If profiling is active (@option{-pg}), generate the calls to
33690 the profiling functions as NOPs. This is useful when they
33691 should be patched in later dynamically. This is likely only
33692 useful together with @option{-mrecord-mcount}.
33693
33694 @item -minstrument-return=@var{type}
33695 @opindex minstrument-return
33696 Instrument function exit in -pg -mfentry instrumented functions with
33697 call to specified function. This only instruments true returns ending
33698 with ret, but not sibling calls ending with jump. Valid types
33699 are @var{none} to not instrument, @var{call} to generate a call to __return__,
33700 or @var{nop5} to generate a 5 byte nop.
33701
33702 @item -mrecord-return
33703 @itemx -mno-record-return
33704 @opindex mrecord-return
33705 Generate a __return_loc section pointing to all return instrumentation code.
33706
33707 @item -mfentry-name=@var{name}
33708 @opindex mfentry-name
33709 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
33710
33711 @item -mfentry-section=@var{name}
33712 @opindex mfentry-section
33713 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
33714
33715 @item -mskip-rax-setup
33716 @itemx -mno-skip-rax-setup
33717 @opindex mskip-rax-setup
33718 When generating code for the x86-64 architecture with SSE extensions
33719 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
33720 register when there are no variable arguments passed in vector registers.
33721
33722 @strong{Warning:} Since RAX register is used to avoid unnecessarily
33723 saving vector registers on stack when passing variable arguments, the
33724 impacts of this option are callees may waste some stack space,
33725 misbehave or jump to a random location. GCC 4.4 or newer don't have
33726 those issues, regardless the RAX register value.
33727
33728 @item -m8bit-idiv
33729 @itemx -mno-8bit-idiv
33730 @opindex m8bit-idiv
33731 On some processors, like Intel Atom, 8-bit unsigned integer divide is
33732 much faster than 32-bit/64-bit integer divide. This option generates a
33733 run-time check. If both dividend and divisor are within range of 0
33734 to 255, 8-bit unsigned integer divide is used instead of
33735 32-bit/64-bit integer divide.
33736
33737 @item -mavx256-split-unaligned-load
33738 @itemx -mavx256-split-unaligned-store
33739 @opindex mavx256-split-unaligned-load
33740 @opindex mavx256-split-unaligned-store
33741 Split 32-byte AVX unaligned load and store.
33742
33743 @item -mstack-protector-guard=@var{guard}
33744 @itemx -mstack-protector-guard-reg=@var{reg}
33745 @itemx -mstack-protector-guard-offset=@var{offset}
33746 @opindex mstack-protector-guard
33747 @opindex mstack-protector-guard-reg
33748 @opindex mstack-protector-guard-offset
33749 Generate stack protection code using canary at @var{guard}. Supported
33750 locations are @samp{global} for global canary or @samp{tls} for per-thread
33751 canary in the TLS block (the default). This option has effect only when
33752 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
33753
33754 With the latter choice the options
33755 @option{-mstack-protector-guard-reg=@var{reg}} and
33756 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
33757 which segment register (@code{%fs} or @code{%gs}) to use as base register
33758 for reading the canary, and from what offset from that base register.
33759 The default for those is as specified in the relevant ABI.
33760
33761 @item -mgeneral-regs-only
33762 @opindex mgeneral-regs-only
33763 Generate code that uses only the general-purpose registers. This
33764 prevents the compiler from using floating-point, vector, mask and bound
33765 registers.
33766
33767 @item -mrelax-cmpxchg-loop
33768 @opindex mrelax-cmpxchg-loop
33769 When emitting a compare-and-swap loop for @ref{__sync Builtins}
33770 and @ref{__atomic Builtins} lacking a native instruction, optimize
33771 for the highly contended case by issuing an atomic load before the
33772 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
33773 to save CPU power when restarting the loop.
33774
33775 @item -mindirect-branch=@var{choice}
33776 @opindex mindirect-branch
33777 Convert indirect call and jump with @var{choice}. The default is
33778 @samp{keep}, which keeps indirect call and jump unmodified.
33779 @samp{thunk} converts indirect call and jump to call and return thunk.
33780 @samp{thunk-inline} converts indirect call and jump to inlined call
33781 and return thunk. @samp{thunk-extern} converts indirect call and jump
33782 to external call and return thunk provided in a separate object file.
33783 You can control this behavior for a specific function by using the
33784 function attribute @code{indirect_branch}. @xref{Function Attributes}.
33785
33786 Note that @option{-mcmodel=large} is incompatible with
33787 @option{-mindirect-branch=thunk} and
33788 @option{-mindirect-branch=thunk-extern} since the thunk function may
33789 not be reachable in the large code model.
33790
33791 Note that @option{-mindirect-branch=thunk-extern} is compatible with
33792 @option{-fcf-protection=branch} since the external thunk can be made
33793 to enable control-flow check.
33794
33795 @item -mfunction-return=@var{choice}
33796 @opindex mfunction-return
33797 Convert function return with @var{choice}. The default is @samp{keep},
33798 which keeps function return unmodified. @samp{thunk} converts function
33799 return to call and return thunk. @samp{thunk-inline} converts function
33800 return to inlined call and return thunk. @samp{thunk-extern} converts
33801 function return to external call and return thunk provided in a separate
33802 object file. You can control this behavior for a specific function by
33803 using the function attribute @code{function_return}.
33804 @xref{Function Attributes}.
33805
33806 Note that @option{-mindirect-return=thunk-extern} is compatible with
33807 @option{-fcf-protection=branch} since the external thunk can be made
33808 to enable control-flow check.
33809
33810 Note that @option{-mcmodel=large} is incompatible with
33811 @option{-mfunction-return=thunk} and
33812 @option{-mfunction-return=thunk-extern} since the thunk function may
33813 not be reachable in the large code model.
33814
33815
33816 @item -mindirect-branch-register
33817 @opindex mindirect-branch-register
33818 Force indirect call and jump via register.
33819
33820 @item -mharden-sls=@var{choice}
33821 @opindex mharden-sls
33822 Generate code to mitigate against straight line speculation (SLS) with
33823 @var{choice}. The default is @samp{none} which disables all SLS
33824 hardening. @samp{return} enables SLS hardening for function returns.
33825 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
33826 @samp{all} enables all SLS hardening.
33827
33828 @item -mindirect-branch-cs-prefix
33829 @opindex mindirect-branch-cs-prefix
33830 Add CS prefix to call and jmp to indirect thunk with branch target in
33831 r8-r15 registers so that the call and jmp instruction length is 6 bytes
33832 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
33833 @samp{lfence; jmp *%r8-r15} at run-time.
33834
33835 @end table
33836
33837 These @samp{-m} switches are supported in addition to the above
33838 on x86-64 processors in 64-bit environments.
33839
33840 @table @gcctabopt
33841 @item -m32
33842 @itemx -m64
33843 @itemx -mx32
33844 @itemx -m16
33845 @itemx -miamcu
33846 @opindex m32
33847 @opindex m64
33848 @opindex mx32
33849 @opindex m16
33850 @opindex miamcu
33851 Generate code for a 16-bit, 32-bit or 64-bit environment.
33852 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
33853 to 32 bits, and
33854 generates code that runs on any i386 system.
33855
33856 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
33857 types to 64 bits, and generates code for the x86-64 architecture.
33858 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
33859 and @option{-mdynamic-no-pic} options.
33860
33861 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
33862 to 32 bits, and
33863 generates code for the x86-64 architecture.
33864
33865 The @option{-m16} option is the same as @option{-m32}, except for that
33866 it outputs the @code{.code16gcc} assembly directive at the beginning of
33867 the assembly output so that the binary can run in 16-bit mode.
33868
33869 The @option{-miamcu} option generates code which conforms to Intel MCU
33870 psABI. It requires the @option{-m32} option to be turned on.
33871
33872 @item -mno-red-zone
33873 @opindex mno-red-zone
33874 @opindex mred-zone
33875 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
33876 by the x86-64 ABI; it is a 128-byte area beyond the location of the
33877 stack pointer that is not modified by signal or interrupt handlers
33878 and therefore can be used for temporary data without adjusting the stack
33879 pointer. The flag @option{-mno-red-zone} disables this red zone.
33880
33881 @item -mcmodel=small
33882 @opindex mcmodel=small
33883 Generate code for the small code model: the program and its symbols must
33884 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
33885 Programs can be statically or dynamically linked. This is the default
33886 code model.
33887
33888 @item -mcmodel=kernel
33889 @opindex mcmodel=kernel
33890 Generate code for the kernel code model. The kernel runs in the
33891 negative 2 GB of the address space.
33892 This model has to be used for Linux kernel code.
33893
33894 @item -mcmodel=medium
33895 @opindex mcmodel=medium
33896 Generate code for the medium model: the program is linked in the lower 2
33897 GB of the address space. Small symbols are also placed there. Symbols
33898 with sizes larger than @option{-mlarge-data-threshold} are put into
33899 large data or BSS sections and can be located above 2GB. Programs can
33900 be statically or dynamically linked.
33901
33902 @item -mcmodel=large
33903 @opindex mcmodel=large
33904 Generate code for the large model. This model makes no assumptions
33905 about addresses and sizes of sections.
33906
33907 @item -maddress-mode=long
33908 @opindex maddress-mode=long
33909 Generate code for long address mode. This is only supported for 64-bit
33910 and x32 environments. It is the default address mode for 64-bit
33911 environments.
33912
33913 @item -maddress-mode=short
33914 @opindex maddress-mode=short
33915 Generate code for short address mode. This is only supported for 32-bit
33916 and x32 environments. It is the default address mode for 32-bit and
33917 x32 environments.
33918
33919 @item -mneeded
33920 @itemx -mno-needed
33921 @opindex mneeded
33922 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
33923 indicate the micro-architecture ISA level required to execute the binary.
33924
33925 @item -mno-direct-extern-access
33926 @opindex mno-direct-extern-access
33927 @opindex mdirect-extern-access
33928 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
33929 to access external symbols. With @option{-fpic} or @option{-fPIC},
33930 treat access to protected symbols as local symbols. The default is
33931 @option{-mdirect-extern-access}.
33932
33933 @strong{Warning:} shared libraries compiled with
33934 @option{-mno-direct-extern-access} and executable compiled with
33935 @option{-mdirect-extern-access} may not be binary compatible if
33936 protected symbols are used in shared libraries and executable.
33937
33938 @item -munroll-only-small-loops
33939 @opindex munroll-only-small-loops
33940 @opindex mno-unroll-only-small-loops
33941 Controls conservative small loop unrolling. It is default enabled by
33942 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
33943 -f[no-]unroll-[all-]loops would disable this flag to avoid any
33944 unintended unrolling behavior that user does not want.
33945
33946 @item -mlam=@var{choice}
33947 @opindex mlam
33948 LAM(linear-address masking) allows special bits in the pointer to be used
33949 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
33950 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
33951 positions 62:57 can be used for metadata.
33952 @end table
33953
33954 @node x86 Windows Options
33955 @subsection x86 Windows Options
33956 @cindex x86 Windows Options
33957 @cindex Windows Options for x86
33958
33959 These additional options are available for Microsoft Windows targets:
33960
33961 @table @gcctabopt
33962 @item -mconsole
33963 @opindex mconsole
33964 This option
33965 specifies that a console application is to be generated, by
33966 instructing the linker to set the PE header subsystem type
33967 required for console applications.
33968 This option is available for Cygwin and MinGW targets and is
33969 enabled by default on those targets.
33970
33971 @item -mdll
33972 @opindex mdll
33973 This option is available for Cygwin and MinGW targets. It
33974 specifies that a DLL---a dynamic link library---is to be
33975 generated, enabling the selection of the required runtime
33976 startup object and entry point.
33977
33978 @item -mnop-fun-dllimport
33979 @opindex mnop-fun-dllimport
33980 This option is available for Cygwin and MinGW targets. It
33981 specifies that the @code{dllimport} attribute should be ignored.
33982
33983 @item -mthreads
33984 @opindex mthreads
33985 This option is available for MinGW targets. It specifies
33986 that MinGW-specific thread support is to be used.
33987
33988 @item -municode
33989 @opindex municode
33990 This option is available for MinGW-w64 targets. It causes
33991 the @code{UNICODE} preprocessor macro to be predefined, and
33992 chooses Unicode-capable runtime startup code.
33993
33994 @item -mwin32
33995 @opindex mwin32
33996 This option is available for Cygwin and MinGW targets. It
33997 specifies that the typical Microsoft Windows predefined macros are to
33998 be set in the pre-processor, but does not influence the choice
33999 of runtime library/startup code.
34000
34001 @item -mwindows
34002 @opindex mwindows
34003 This option is available for Cygwin and MinGW targets. It
34004 specifies that a GUI application is to be generated by
34005 instructing the linker to set the PE header subsystem type
34006 appropriately.
34007
34008 @item -fno-set-stack-executable
34009 @opindex fno-set-stack-executable
34010 @opindex fset-stack-executable
34011 This option is available for MinGW targets. It specifies that
34012 the executable flag for the stack used by nested functions isn't
34013 set. This is necessary for binaries running in kernel mode of
34014 Microsoft Windows, as there the User32 API, which is used to set executable
34015 privileges, isn't available.
34016
34017 @item -fwritable-relocated-rdata
34018 @opindex fno-writable-relocated-rdata
34019 @opindex fwritable-relocated-rdata
34020 This option is available for MinGW and Cygwin targets. It specifies
34021 that relocated-data in read-only section is put into the @code{.data}
34022 section. This is a necessary for older runtimes not supporting
34023 modification of @code{.rdata} sections for pseudo-relocation.
34024
34025 @item -mpe-aligned-commons
34026 @opindex mpe-aligned-commons
34027 This option is available for Cygwin and MinGW targets. It
34028 specifies that the GNU extension to the PE file format that
34029 permits the correct alignment of COMMON variables should be
34030 used when generating code. It is enabled by default if
34031 GCC detects that the target assembler found during configuration
34032 supports the feature.
34033 @end table
34034
34035 See also under @ref{x86 Options} for standard options.
34036
34037 @node Xstormy16 Options
34038 @subsection Xstormy16 Options
34039 @cindex Xstormy16 Options
34040
34041 These options are defined for Xstormy16:
34042
34043 @table @gcctabopt
34044 @item -msim
34045 @opindex msim
34046 Choose startup files and linker script suitable for the simulator.
34047 @end table
34048
34049 @node Xtensa Options
34050 @subsection Xtensa Options
34051 @cindex Xtensa Options
34052
34053 These options are supported for Xtensa targets:
34054
34055 @table @gcctabopt
34056 @item -mconst16
34057 @itemx -mno-const16
34058 @opindex mconst16
34059 @opindex mno-const16
34060 Enable or disable use of @code{CONST16} instructions for loading
34061 constant values. The @code{CONST16} instruction is currently not a
34062 standard option from Tensilica. When enabled, @code{CONST16}
34063 instructions are always used in place of the standard @code{L32R}
34064 instructions. The use of @code{CONST16} is enabled by default only if
34065 the @code{L32R} instruction is not available.
34066
34067 @item -mfused-madd
34068 @itemx -mno-fused-madd
34069 @opindex mfused-madd
34070 @opindex mno-fused-madd
34071 Enable or disable use of fused multiply/add and multiply/subtract
34072 instructions in the floating-point option. This has no effect if the
34073 floating-point option is not also enabled. Disabling fused multiply/add
34074 and multiply/subtract instructions forces the compiler to use separate
34075 instructions for the multiply and add/subtract operations. This may be
34076 desirable in some cases where strict IEEE 754-compliant results are
34077 required: the fused multiply add/subtract instructions do not round the
34078 intermediate result, thereby producing results with @emph{more} bits of
34079 precision than specified by the IEEE standard. Disabling fused multiply
34080 add/subtract instructions also ensures that the program output is not
34081 sensitive to the compiler's ability to combine multiply and add/subtract
34082 operations.
34083
34084 @item -mserialize-volatile
34085 @itemx -mno-serialize-volatile
34086 @opindex mserialize-volatile
34087 @opindex mno-serialize-volatile
34088 When this option is enabled, GCC inserts @code{MEMW} instructions before
34089 @code{volatile} memory references to guarantee sequential consistency.
34090 The default is @option{-mserialize-volatile}. Use
34091 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
34092
34093 @item -mforce-no-pic
34094 @opindex mforce-no-pic
34095 For targets, like GNU/Linux, where all user-mode Xtensa code must be
34096 position-independent code (PIC), this option disables PIC for compiling
34097 kernel code.
34098
34099 @item -mtext-section-literals
34100 @itemx -mno-text-section-literals
34101 @opindex mtext-section-literals
34102 @opindex mno-text-section-literals
34103 These options control the treatment of literal pools. The default is
34104 @option{-mno-text-section-literals}, which places literals in a separate
34105 section in the output file. This allows the literal pool to be placed
34106 in a data RAM/ROM, and it also allows the linker to combine literal
34107 pools from separate object files to remove redundant literals and
34108 improve code size. With @option{-mtext-section-literals}, the literals
34109 are interspersed in the text section in order to keep them as close as
34110 possible to their references. This may be necessary for large assembly
34111 files. Literals for each function are placed right before that function.
34112
34113 @item -mauto-litpools
34114 @itemx -mno-auto-litpools
34115 @opindex mauto-litpools
34116 @opindex mno-auto-litpools
34117 These options control the treatment of literal pools. The default is
34118 @option{-mno-auto-litpools}, which places literals in a separate
34119 section in the output file unless @option{-mtext-section-literals} is
34120 used. With @option{-mauto-litpools} the literals are interspersed in
34121 the text section by the assembler. Compiler does not produce explicit
34122 @code{.literal} directives and loads literals into registers with
34123 @code{MOVI} instructions instead of @code{L32R} to let the assembler
34124 do relaxation and place literals as necessary. This option allows
34125 assembler to create several literal pools per function and assemble
34126 very big functions, which may not be possible with
34127 @option{-mtext-section-literals}.
34128
34129 @item -mtarget-align
34130 @itemx -mno-target-align
34131 @opindex mtarget-align
34132 @opindex mno-target-align
34133 When this option is enabled, GCC instructs the assembler to
34134 automatically align instructions to reduce branch penalties at the
34135 expense of some code density. The assembler attempts to widen density
34136 instructions to align branch targets and the instructions following call
34137 instructions. If there are not enough preceding safe density
34138 instructions to align a target, no widening is performed. The
34139 default is @option{-mtarget-align}. These options do not affect the
34140 treatment of auto-aligned instructions like @code{LOOP}, which the
34141 assembler always aligns, either by widening density instructions or
34142 by inserting NOP instructions.
34143
34144 @item -mlongcalls
34145 @itemx -mno-longcalls
34146 @opindex mlongcalls
34147 @opindex mno-longcalls
34148 When this option is enabled, GCC instructs the assembler to translate
34149 direct calls to indirect calls unless it can determine that the target
34150 of a direct call is in the range allowed by the call instruction. This
34151 translation typically occurs for calls to functions in other source
34152 files. Specifically, the assembler translates a direct @code{CALL}
34153 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
34154 The default is @option{-mno-longcalls}. This option should be used in
34155 programs where the call target can potentially be out of range. This
34156 option is implemented in the assembler, not the compiler, so the
34157 assembly code generated by GCC still shows direct call
34158 instructions---look at the disassembled object code to see the actual
34159 instructions. Note that the assembler uses an indirect call for
34160 every cross-file call, not just those that really are out of range.
34161
34162 @item -mabi=@var{name}
34163 @opindex mabi
34164 Generate code for the specified ABI@. Permissible values are: @samp{call0},
34165 @samp{windowed}. Default ABI is chosen by the Xtensa core configuration.
34166
34167 @item -mabi=call0
34168 @opindex mabi=call0
34169 When this option is enabled function parameters are passed in registers
34170 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
34171 caller-saved, and register @code{a15} may be used as a frame pointer.
34172 When this version of the ABI is enabled the C preprocessor symbol
34173 @code{__XTENSA_CALL0_ABI__} is defined.
34174
34175 @item -mabi=windowed
34176 @opindex mabi=windowed
34177 When this option is enabled function parameters are passed in registers
34178 @code{a10} through @code{a15}, and called function rotates register window
34179 by 8 registers on entry so that its arguments are found in registers
34180 @code{a2} through @code{a7}. Register @code{a7} may be used as a frame
34181 pointer. Register window is rotated 8 registers back upon return.
34182 When this version of the ABI is enabled the C preprocessor symbol
34183 @code{__XTENSA_WINDOWED_ABI__} is defined.
34184
34185 @item -mextra-l32r-costs=@var{n}
34186 @opindex mextra-l32r-costs
34187 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
34188 instructions, in clock cycles. This affects, when optimizing for speed,
34189 whether loading a constant from literal pool using @code{L32R} or
34190 synthesizing the constant from a small one with a couple of arithmetic
34191 instructions. The default value is 0.
34192 @end table
34193
34194 @node zSeries Options
34195 @subsection zSeries Options
34196 @cindex zSeries options
34197
34198 These are listed under @xref{S/390 and zSeries Options}.
34199
34200
34201 @c man end
34202
34203 @node Spec Files
34204 @section Specifying Subprocesses and the Switches to Pass to Them
34205 @cindex Spec Files
34206
34207 @command{gcc} is a driver program. It performs its job by invoking a
34208 sequence of other programs to do the work of compiling, assembling and
34209 linking. GCC interprets its command-line parameters and uses these to
34210 deduce which programs it should invoke, and which command-line options
34211 it ought to place on their command lines. This behavior is controlled
34212 by @dfn{spec strings}. In most cases there is one spec string for each
34213 program that GCC can invoke, but a few programs have multiple spec
34214 strings to control their behavior. The spec strings built into GCC can
34215 be overridden by using the @option{-specs=} command-line switch to specify
34216 a spec file.
34217
34218 @dfn{Spec files} are plain-text files that are used to construct spec
34219 strings. They consist of a sequence of directives separated by blank
34220 lines. The type of directive is determined by the first non-whitespace
34221 character on the line, which can be one of the following:
34222
34223 @table @code
34224 @item %@var{command}
34225 Issues a @var{command} to the spec file processor. The commands that can
34226 appear here are:
34227
34228 @table @code
34229 @item %include <@var{file}>
34230 @cindex @code{%include}
34231 Search for @var{file} and insert its text at the current point in the
34232 specs file.
34233
34234 @item %include_noerr <@var{file}>
34235 @cindex @code{%include_noerr}
34236 Just like @samp{%include}, but do not generate an error message if the include
34237 file cannot be found.
34238
34239 @item %rename @var{old_name} @var{new_name}
34240 @cindex @code{%rename}
34241 Rename the spec string @var{old_name} to @var{new_name}.
34242
34243 @end table
34244
34245 @item *[@var{spec_name}]:
34246 This tells the compiler to create, override or delete the named spec
34247 string. All lines after this directive up to the next directive or
34248 blank line are considered to be the text for the spec string. If this
34249 results in an empty string then the spec is deleted. (Or, if the
34250 spec did not exist, then nothing happens.) Otherwise, if the spec
34251 does not currently exist a new spec is created. If the spec does
34252 exist then its contents are overridden by the text of this
34253 directive, unless the first character of that text is the @samp{+}
34254 character, in which case the text is appended to the spec.
34255
34256 @item [@var{suffix}]:
34257 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
34258 and up to the next directive or blank line are considered to make up the
34259 spec string for the indicated suffix. When the compiler encounters an
34260 input file with the named suffix, it processes the spec string in
34261 order to work out how to compile that file. For example:
34262
34263 @smallexample
34264 .ZZ:
34265 z-compile -input %i
34266 @end smallexample
34267
34268 This says that any input file whose name ends in @samp{.ZZ} should be
34269 passed to the program @samp{z-compile}, which should be invoked with the
34270 command-line switch @option{-input} and with the result of performing the
34271 @samp{%i} substitution. (See below.)
34272
34273 As an alternative to providing a spec string, the text following a
34274 suffix directive can be one of the following:
34275
34276 @table @code
34277 @item @@@var{language}
34278 This says that the suffix is an alias for a known @var{language}. This is
34279 similar to using the @option{-x} command-line switch to GCC to specify a
34280 language explicitly. For example:
34281
34282 @smallexample
34283 .ZZ:
34284 @@c++
34285 @end smallexample
34286
34287 Says that .ZZ files are, in fact, C++ source files.
34288
34289 @item #@var{name}
34290 This causes an error messages saying:
34291
34292 @smallexample
34293 @var{name} compiler not installed on this system.
34294 @end smallexample
34295 @end table
34296
34297 GCC already has an extensive list of suffixes built into it.
34298 This directive adds an entry to the end of the list of suffixes, but
34299 since the list is searched from the end backwards, it is effectively
34300 possible to override earlier entries using this technique.
34301
34302 @end table
34303
34304 GCC has the following spec strings built into it. Spec files can
34305 override these strings or create their own. Note that individual
34306 targets can also add their own spec strings to this list.
34307
34308 @smallexample
34309 asm Options to pass to the assembler
34310 asm_final Options to pass to the assembler post-processor
34311 cpp Options to pass to the C preprocessor
34312 cc1 Options to pass to the C compiler
34313 cc1plus Options to pass to the C++ compiler
34314 endfile Object files to include at the end of the link
34315 link Options to pass to the linker
34316 lib Libraries to include on the command line to the linker
34317 libgcc Decides which GCC support library to pass to the linker
34318 linker Sets the name of the linker
34319 predefines Defines to be passed to the C preprocessor
34320 signed_char Defines to pass to CPP to say whether @code{char} is signed
34321 by default
34322 startfile Object files to include at the start of the link
34323 @end smallexample
34324
34325 Here is a small example of a spec file:
34326
34327 @smallexample
34328 %rename lib old_lib
34329
34330 *lib:
34331 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
34332 @end smallexample
34333
34334 This example renames the spec called @samp{lib} to @samp{old_lib} and
34335 then overrides the previous definition of @samp{lib} with a new one.
34336 The new definition adds in some extra command-line options before
34337 including the text of the old definition.
34338
34339 @dfn{Spec strings} are a list of command-line options to be passed to their
34340 corresponding program. In addition, the spec strings can contain
34341 @samp{%}-prefixed sequences to substitute variable text or to
34342 conditionally insert text into the command line. Using these constructs
34343 it is possible to generate quite complex command lines.
34344
34345 Here is a table of all defined @samp{%}-sequences for spec
34346 strings. Note that spaces are not generated automatically around the
34347 results of expanding these sequences. Therefore you can concatenate them
34348 together or combine them with constant text in a single argument.
34349
34350 @table @code
34351 @item %%
34352 Substitute one @samp{%} into the program name or argument.
34353
34354 @item %"
34355 Substitute an empty argument.
34356
34357 @item %i
34358 Substitute the name of the input file being processed.
34359
34360 @item %b
34361 Substitute the basename for outputs related with the input file being
34362 processed. This is often the substring up to (and not including) the
34363 last period and not including the directory but, unless %w is active, it
34364 expands to the basename for auxiliary outputs, which may be influenced
34365 by an explicit output name, and by various other options that control
34366 how auxiliary outputs are named.
34367
34368 @item %B
34369 This is the same as @samp{%b}, but include the file suffix (text after
34370 the last period). Without %w, it expands to the basename for dump
34371 outputs.
34372
34373 @item %d
34374 Marks the argument containing or following the @samp{%d} as a
34375 temporary file name, so that that file is deleted if GCC exits
34376 successfully. Unlike @samp{%g}, this contributes no text to the
34377 argument.
34378
34379 @item %g@var{suffix}
34380 Substitute a file name that has suffix @var{suffix} and is chosen
34381 once per compilation, and mark the argument in the same way as
34382 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
34383 name is now chosen in a way that is hard to predict even when previously
34384 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
34385 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
34386 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
34387 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
34388 was simply substituted with a file name chosen once per compilation,
34389 without regard to any appended suffix (which was therefore treated
34390 just like ordinary text), making such attacks more likely to succeed.
34391
34392 @item %u@var{suffix}
34393 Like @samp{%g}, but generates a new temporary file name
34394 each time it appears instead of once per compilation.
34395
34396 @item %U@var{suffix}
34397 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
34398 new one if there is no such last file name. In the absence of any
34399 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
34400 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
34401 involves the generation of two distinct file names, one
34402 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
34403 simply substituted with a file name chosen for the previous @samp{%u},
34404 without regard to any appended suffix.
34405
34406 @item %j@var{suffix}
34407 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
34408 writable, and if @option{-save-temps} is not used;
34409 otherwise, substitute the name
34410 of a temporary file, just like @samp{%u}. This temporary file is not
34411 meant for communication between processes, but rather as a junk
34412 disposal mechanism.
34413
34414 @item %|@var{suffix}
34415 @itemx %m@var{suffix}
34416 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
34417 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
34418 all. These are the two most common ways to instruct a program that it
34419 should read from standard input or write to standard output. If you
34420 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
34421 construct: see for example @file{gcc/fortran/lang-specs.h}.
34422
34423 @item %.@var{SUFFIX}
34424 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
34425 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
34426 terminated by the next space or %.
34427
34428 @item %w
34429 Marks the argument containing or following the @samp{%w} as the
34430 designated output file of this compilation. This puts the argument
34431 into the sequence of arguments that @samp{%o} substitutes.
34432
34433 @item %V
34434 Indicates that this compilation produces no output file.
34435
34436 @item %o
34437 Substitutes the names of all the output files, with spaces
34438 automatically placed around them. You should write spaces
34439 around the @samp{%o} as well or the results are undefined.
34440 @samp{%o} is for use in the specs for running the linker.
34441 Input files whose names have no recognized suffix are not compiled
34442 at all, but they are included among the output files, so they are
34443 linked.
34444
34445 @item %O
34446 Substitutes the suffix for object files. Note that this is
34447 handled specially when it immediately follows @samp{%g, %u, or %U},
34448 because of the need for those to form complete file names. The
34449 handling is such that @samp{%O} is treated exactly as if it had already
34450 been substituted, except that @samp{%g, %u, and %U} do not currently
34451 support additional @var{suffix} characters following @samp{%O} as they do
34452 following, for example, @samp{.o}.
34453
34454 @item %I
34455 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
34456 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
34457 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
34458 and @option{-imultilib} as necessary.
34459
34460 @item %s
34461 Current argument is the name of a library or startup file of some sort.
34462 Search for that file in a standard list of directories and substitute
34463 the full name found. The current working directory is included in the
34464 list of directories scanned.
34465
34466 @item %T
34467 Current argument is the name of a linker script. Search for that file
34468 in the current list of directories to scan for libraries. If the file
34469 is located insert a @option{--script} option into the command line
34470 followed by the full path name found. If the file is not found then
34471 generate an error message. Note: the current working directory is not
34472 searched.
34473
34474 @item %e@var{str}
34475 Print @var{str} as an error message. @var{str} is terminated by a newline.
34476 Use this when inconsistent options are detected.
34477
34478 @item %n@var{str}
34479 Print @var{str} as a notice. @var{str} is terminated by a newline.
34480
34481 @item %(@var{name})
34482 Substitute the contents of spec string @var{name} at this point.
34483
34484 @item %x@{@var{option}@}
34485 Accumulate an option for @samp{%X}.
34486
34487 @item %X
34488 Output the accumulated linker options specified by a @samp{%x} spec string.
34489
34490 @item %Y
34491 Output the accumulated assembler options specified by @option{-Wa}.
34492
34493 @item %Z
34494 Output the accumulated preprocessor options specified by @option{-Wp}.
34495
34496 @item %M
34497 Output @code{multilib_os_dir}.
34498
34499 @item %R
34500 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
34501
34502 @item %a
34503 Process the @code{asm} spec. This is used to compute the
34504 switches to be passed to the assembler.
34505
34506 @item %A
34507 Process the @code{asm_final} spec. This is a spec string for
34508 passing switches to an assembler post-processor, if such a program is
34509 needed.
34510
34511 @item %l
34512 Process the @code{link} spec. This is the spec for computing the
34513 command line passed to the linker. Typically it makes use of the
34514 @samp{%L %G %S %D and %E} sequences.
34515
34516 @item %D
34517 Dump out a @option{-L} option for each directory that GCC believes might
34518 contain startup files. If the target supports multilibs then the
34519 current multilib directory is prepended to each of these paths.
34520
34521 @item %L
34522 Process the @code{lib} spec. This is a spec string for deciding which
34523 libraries are included on the command line to the linker.
34524
34525 @item %G
34526 Process the @code{libgcc} spec. This is a spec string for deciding
34527 which GCC support library is included on the command line to the linker.
34528
34529 @item %S
34530 Process the @code{startfile} spec. This is a spec for deciding which
34531 object files are the first ones passed to the linker. Typically
34532 this might be a file named @file{crt0.o}.
34533
34534 @item %E
34535 Process the @code{endfile} spec. This is a spec string that specifies
34536 the last object files that are passed to the linker.
34537
34538 @item %C
34539 Process the @code{cpp} spec. This is used to construct the arguments
34540 to be passed to the C preprocessor.
34541
34542 @item %1
34543 Process the @code{cc1} spec. This is used to construct the options to be
34544 passed to the actual C compiler (@command{cc1}).
34545
34546 @item %2
34547 Process the @code{cc1plus} spec. This is used to construct the options to be
34548 passed to the actual C++ compiler (@command{cc1plus}).
34549
34550 @item %*
34551 Substitute the variable part of a matched option. See below.
34552 Note that each comma in the substituted string is replaced by
34553 a single space.
34554
34555 @item %<S
34556 Remove all occurrences of @code{-S} from the command line. Note---this
34557 command is position dependent. @samp{%} commands in the spec string
34558 before this one see @code{-S}, @samp{%} commands in the spec string
34559 after this one do not.
34560
34561 @item %<S*
34562 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
34563
34564 @item %>S
34565 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
34566
34567 @item %:@var{function}(@var{args})
34568 Call the named function @var{function}, passing it @var{args}.
34569 @var{args} is first processed as a nested spec string, then split
34570 into an argument vector in the usual fashion. The function returns
34571 a string which is processed as if it had appeared literally as part
34572 of the current spec.
34573
34574 The following built-in spec functions are provided:
34575
34576 @table @code
34577 @item @code{getenv}
34578 The @code{getenv} spec function takes two arguments: an environment
34579 variable name and a string. If the environment variable is not
34580 defined, a fatal error is issued. Otherwise, the return value is the
34581 value of the environment variable concatenated with the string. For
34582 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
34583
34584 @smallexample
34585 %:getenv(TOPDIR /include)
34586 @end smallexample
34587
34588 expands to @file{/path/to/top/include}.
34589
34590 @item @code{if-exists}
34591 The @code{if-exists} spec function takes one argument, an absolute
34592 pathname to a file. If the file exists, @code{if-exists} returns the
34593 pathname. Here is a small example of its usage:
34594
34595 @smallexample
34596 *startfile:
34597 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
34598 @end smallexample
34599
34600 @item @code{if-exists-else}
34601 The @code{if-exists-else} spec function is similar to the @code{if-exists}
34602 spec function, except that it takes two arguments. The first argument is
34603 an absolute pathname to a file. If the file exists, @code{if-exists-else}
34604 returns the pathname. If it does not exist, it returns the second argument.
34605 This way, @code{if-exists-else} can be used to select one file or another,
34606 based on the existence of the first. Here is a small example of its usage:
34607
34608 @smallexample
34609 *startfile:
34610 crt0%O%s %:if-exists(crti%O%s) \
34611 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
34612 @end smallexample
34613
34614 @item @code{if-exists-then-else}
34615 The @code{if-exists-then-else} spec function takes at least two arguments
34616 and an optional third one. The first argument is an absolute pathname to a
34617 file. If the file exists, the function returns the second argument.
34618 If the file does not exist, the function returns the third argument if there
34619 is one, or NULL otherwise. This can be used to expand one text, or optionally
34620 another, based on the existence of a file. Here is a small example of its
34621 usage:
34622
34623 @smallexample
34624 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
34625 @end smallexample
34626
34627 @item @code{sanitize}
34628 The @code{sanitize} spec function takes no arguments. It returns non-NULL if
34629 any address, thread or undefined behavior sanitizers are active.
34630
34631 @smallexample
34632 %@{%:sanitize(address):-funwind-tables@}
34633 @end smallexample
34634
34635 @item @code{replace-outfile}
34636 The @code{replace-outfile} spec function takes two arguments. It looks for the
34637 first argument in the outfiles array and replaces it with the second argument. Here
34638 is a small example of its usage:
34639
34640 @smallexample
34641 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
34642 @end smallexample
34643
34644 @item @code{remove-outfile}
34645 The @code{remove-outfile} spec function takes one argument. It looks for the
34646 first argument in the outfiles array and removes it. Here is a small example
34647 its usage:
34648
34649 @smallexample
34650 %:remove-outfile(-lm)
34651 @end smallexample
34652
34653 @item @code{version-compare}
34654 The @code{version-compare} spec function takes four or five arguments of the following
34655 form:
34656
34657 @smallexample
34658 <comparison-op> <arg1> [<arg2>] <switch> <result>
34659 @end smallexample
34660
34661 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
34662 The supported @code{comparison-op} values are:
34663
34664 @table @code
34665 @item >=
34666 True if @code{switch} is a later (or same) version than @code{arg1}
34667
34668 @item !>
34669 Opposite of @code{>=}
34670
34671 @item <
34672 True if @code{switch} is an earlier version than @code{arg1}
34673
34674 @item !<
34675 Opposite of @code{<}
34676
34677 @item ><
34678 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
34679
34680 @item <>
34681 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
34682 @end table
34683
34684 If the @code{switch} is not present at all, the condition is false unless the first character
34685 of the @code{comparison-op} is @code{!}.
34686
34687 @smallexample
34688 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
34689 @end smallexample
34690
34691 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
34692 passed.
34693
34694 @item @code{include}
34695 The @code{include} spec function behaves much like @code{%include}, with the advantage
34696 that it can be nested inside a spec and thus be conditionalized. It takes one argument,
34697 the filename, and looks for it in the startfile path. It always returns NULL.
34698
34699 @smallexample
34700 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
34701 @end smallexample
34702
34703 @item @code{pass-through-libs}
34704 The @code{pass-through-libs} spec function takes any number of arguments. It
34705 finds any @option{-l} options and any non-options ending in @file{.a} (which it
34706 assumes are the names of linker input library archive files) and returns a
34707 result containing all the found arguments each prepended by
34708 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
34709 intended to be passed to the LTO linker plugin.
34710
34711 @smallexample
34712 %:pass-through-libs(%G %L %G)
34713 @end smallexample
34714
34715 @item @code{print-asm-header}
34716 The @code{print-asm-header} function takes no arguments and simply
34717 prints a banner like:
34718
34719 @smallexample
34720 Assembler options
34721 =================
34722
34723 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
34724 @end smallexample
34725
34726 It is used to separate compiler options from assembler options
34727 in the @option{--target-help} output.
34728
34729 @item @code{gt}
34730 The @code{gt} spec function takes two or more arguments. It returns @code{""} (the
34731 empty string) if the second-to-last argument is greater than the last argument, and NULL
34732 otherwise. The following example inserts the @code{link_gomp} spec if the last
34733 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
34734
34735 @smallexample
34736 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
34737 @end smallexample
34738
34739 @item @code{debug-level-gt}
34740 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
34741 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
34742 otherwise.
34743
34744 @smallexample
34745 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
34746 @end smallexample
34747 @end table
34748
34749 @item %@{S@}
34750 Substitutes the @code{-S} switch, if that switch is given to GCC@.
34751 If that switch is not specified, this substitutes nothing. Note that
34752 the leading dash is omitted when specifying this option, and it is
34753 automatically inserted if the substitution is performed. Thus the spec
34754 string @samp{%@{foo@}} matches the command-line option @option{-foo}
34755 and outputs the command-line option @option{-foo}.
34756
34757 @item %W@{S@}
34758 Like %@{@code{S}@} but mark last argument supplied within as a file to be
34759 deleted on failure.
34760
34761 @item %@@@{S@}
34762 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
34763 @code{@@FILE} if an @code{@@file} argument has been supplied.
34764
34765 @item %@{S*@}
34766 Substitutes all the switches specified to GCC whose names start
34767 with @code{-S}, but which also take an argument. This is used for
34768 switches like @option{-o}, @option{-D}, @option{-I}, etc.
34769 GCC considers @option{-o foo} as being
34770 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
34771 text, including the space. Thus two arguments are generated.
34772
34773 @item %@{S*&T*@}
34774 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
34775 (the order of @code{S} and @code{T} in the spec is not significant).
34776 There can be any number of ampersand-separated variables; for each the
34777 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
34778
34779 @item %@{S:X@}
34780 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
34781
34782 @item %@{!S:X@}
34783 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
34784
34785 @item %@{S*:X@}
34786 Substitutes @code{X} if one or more switches whose names start with
34787 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
34788 once, no matter how many such switches appeared. However, if @code{%*}
34789 appears somewhere in @code{X}, then @code{X} is substituted once
34790 for each matching switch, with the @code{%*} replaced by the part of
34791 that switch matching the @code{*}.
34792
34793 If @code{%*} appears as the last part of a spec sequence then a space
34794 is added after the end of the last substitution. If there is more
34795 text in the sequence, however, then a space is not generated. This
34796 allows the @code{%*} substitution to be used as part of a larger
34797 string. For example, a spec string like this:
34798
34799 @smallexample
34800 %@{mcu=*:--script=%*/memory.ld@}
34801 @end smallexample
34802
34803 @noindent
34804 when matching an option like @option{-mcu=newchip} produces:
34805
34806 @smallexample
34807 --script=newchip/memory.ld
34808 @end smallexample
34809
34810 @item %@{.S:X@}
34811 Substitutes @code{X}, if processing a file with suffix @code{S}.
34812
34813 @item %@{!.S:X@}
34814 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
34815
34816 @item %@{,S:X@}
34817 Substitutes @code{X}, if processing a file for language @code{S}.
34818
34819 @item %@{!,S:X@}
34820 Substitutes @code{X}, if not processing a file for language @code{S}.
34821
34822 @item %@{S|P:X@}
34823 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
34824 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
34825 @code{*} sequences as well, although they have a stronger binding than
34826 the @samp{|}. If @code{%*} appears in @code{X}, all of the
34827 alternatives must be starred, and only the first matching alternative
34828 is substituted.
34829
34830 For example, a spec string like this:
34831
34832 @smallexample
34833 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
34834 @end smallexample
34835
34836 @noindent
34837 outputs the following command-line options from the following input
34838 command-line options:
34839
34840 @smallexample
34841 fred.c -foo -baz
34842 jim.d -bar -boggle
34843 -d fred.c -foo -baz -boggle
34844 -d jim.d -bar -baz -boggle
34845 @end smallexample
34846
34847 @item %@{%:@var{function}(@var{args}):X@}
34848
34849 Call function named @var{function} with args @var{args}. If the
34850 function returns non-NULL, then @code{X} is substituted, if it returns
34851 NULL, it isn't substituted.
34852
34853 @item %@{S:X; T:Y; :D@}
34854
34855 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
34856 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
34857 be as many clauses as you need. This may be combined with @code{.},
34858 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
34859
34860
34861 @end table
34862
34863 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
34864 or similar construct can use a backslash to ignore the special meaning
34865 of the character following it, thus allowing literal matching of a
34866 character that is otherwise specially treated. For example,
34867 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
34868 @option{-std=iso9899:1999} option is given.
34869
34870 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
34871 construct may contain other nested @samp{%} constructs or spaces, or
34872 even newlines. They are processed as usual, as described above.
34873 Trailing white space in @code{X} is ignored. White space may also
34874 appear anywhere on the left side of the colon in these constructs,
34875 except between @code{.} or @code{*} and the corresponding word.
34876
34877 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
34878 handled specifically in these constructs. If another value of
34879 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
34880 @option{-W} switch is found later in the command line, the earlier
34881 switch value is ignored, except with @{@code{S}*@} where @code{S} is
34882 just one letter, which passes all matching options.
34883
34884 The character @samp{|} at the beginning of the predicate text is used to
34885 indicate that a command should be piped to the following command, but
34886 only if @option{-pipe} is specified.
34887
34888 It is built into GCC which switches take arguments and which do not.
34889 (You might think it would be useful to generalize this to allow each
34890 compiler's spec to say which switches take arguments. But this cannot
34891 be done in a consistent fashion. GCC cannot even decide which input
34892 files have been specified without knowing which switches take arguments,
34893 and it must know which input files to compile in order to tell which
34894 compilers to run).
34895
34896 GCC also knows implicitly that arguments starting in @option{-l} are to be
34897 treated as compiler output files, and passed to the linker in their
34898 proper position among the other output files.
34899
34900 @node Environment Variables
34901 @section Environment Variables Affecting GCC
34902 @cindex environment variables
34903
34904 @c man begin ENVIRONMENT
34905 This section describes several environment variables that affect how GCC
34906 operates. Some of them work by specifying directories or prefixes to use
34907 when searching for various kinds of files. Some are used to specify other
34908 aspects of the compilation environment.
34909
34910 Note that you can also specify places to search using options such as
34911 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
34912 take precedence over places specified using environment variables, which
34913 in turn take precedence over those specified by the configuration of GCC@.
34914 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
34915 GNU Compiler Collection (GCC) Internals}.
34916
34917 @table @env
34918 @item LANG
34919 @itemx LC_CTYPE
34920 @c @itemx LC_COLLATE
34921 @itemx LC_MESSAGES
34922 @c @itemx LC_MONETARY
34923 @c @itemx LC_NUMERIC
34924 @c @itemx LC_TIME
34925 @itemx LC_ALL
34926 @findex LANG
34927 @findex LC_CTYPE
34928 @c @findex LC_COLLATE
34929 @findex LC_MESSAGES
34930 @c @findex LC_MONETARY
34931 @c @findex LC_NUMERIC
34932 @c @findex LC_TIME
34933 @findex LC_ALL
34934 @cindex locale
34935 These environment variables control the way that GCC uses
34936 localization information which allows GCC to work with different
34937 national conventions. GCC inspects the locale categories
34938 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
34939 so. These locale categories can be set to any value supported by your
34940 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
34941 Kingdom encoded in UTF-8.
34942
34943 The @env{LC_CTYPE} environment variable specifies character
34944 classification. GCC uses it to determine the character boundaries in
34945 a string; this is needed for some multibyte encodings that contain quote
34946 and escape characters that are otherwise interpreted as a string
34947 end or escape.
34948
34949 The @env{LC_MESSAGES} environment variable specifies the language to
34950 use in diagnostic messages.
34951
34952 If the @env{LC_ALL} environment variable is set, it overrides the value
34953 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
34954 and @env{LC_MESSAGES} default to the value of the @env{LANG}
34955 environment variable. If none of these variables are set, GCC
34956 defaults to traditional C English behavior.
34957
34958 @item TMPDIR
34959 @findex TMPDIR
34960 If @env{TMPDIR} is set, it specifies the directory to use for temporary
34961 files. GCC uses temporary files to hold the output of one stage of
34962 compilation which is to be used as input to the next stage: for example,
34963 the output of the preprocessor, which is the input to the compiler
34964 proper.
34965
34966 @item GCC_COMPARE_DEBUG
34967 @findex GCC_COMPARE_DEBUG
34968 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
34969 @option{-fcompare-debug} to the compiler driver. See the documentation
34970 of this option for more details.
34971
34972 @item GCC_EXEC_PREFIX
34973 @findex GCC_EXEC_PREFIX
34974 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
34975 names of the subprograms executed by the compiler. No slash is added
34976 when this prefix is combined with the name of a subprogram, but you can
34977 specify a prefix that ends with a slash if you wish.
34978
34979 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
34980 an appropriate prefix to use based on the pathname it is invoked with.
34981
34982 If GCC cannot find the subprogram using the specified prefix, it
34983 tries looking in the usual places for the subprogram.
34984
34985 The default value of @env{GCC_EXEC_PREFIX} is
34986 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
34987 the installed compiler. In many cases @var{prefix} is the value
34988 of @code{prefix} when you ran the @file{configure} script.
34989
34990 Other prefixes specified with @option{-B} take precedence over this prefix.
34991
34992 This prefix is also used for finding files such as @file{crt0.o} that are
34993 used for linking.
34994
34995 In addition, the prefix is used in an unusual way in finding the
34996 directories to search for header files. For each of the standard
34997 directories whose name normally begins with @samp{/usr/local/lib/gcc}
34998 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
34999 replacing that beginning with the specified prefix to produce an
35000 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
35001 @file{foo/bar} just before it searches the standard directory
35002 @file{/usr/local/lib/bar}.
35003 If a standard directory begins with the configured
35004 @var{prefix} then the value of @var{prefix} is replaced by
35005 @env{GCC_EXEC_PREFIX} when looking for header files.
35006
35007 @item COMPILER_PATH
35008 @findex COMPILER_PATH
35009 The value of @env{COMPILER_PATH} is a colon-separated list of
35010 directories, much like @env{PATH}. GCC tries the directories thus
35011 specified when searching for subprograms, if it cannot find the
35012 subprograms using @env{GCC_EXEC_PREFIX}.
35013
35014 @item LIBRARY_PATH
35015 @findex LIBRARY_PATH
35016 The value of @env{LIBRARY_PATH} is a colon-separated list of
35017 directories, much like @env{PATH}. When configured as a native compiler,
35018 GCC tries the directories thus specified when searching for special
35019 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
35020 using GCC also uses these directories when searching for ordinary
35021 libraries for the @option{-l} option (but directories specified with
35022 @option{-L} come first).
35023
35024 @item LANG
35025 @findex LANG
35026 @cindex locale definition
35027 This variable is used to pass locale information to the compiler. One way in
35028 which this information is used is to determine the character set to be used
35029 when character literals, string literals and comments are parsed in C and C++.
35030 When the compiler is configured to allow multibyte characters,
35031 the following values for @env{LANG} are recognized:
35032
35033 @table @samp
35034 @item C-JIS
35035 Recognize JIS characters.
35036 @item C-SJIS
35037 Recognize SJIS characters.
35038 @item C-EUCJP
35039 Recognize EUCJP characters.
35040 @end table
35041
35042 If @env{LANG} is not defined, or if it has some other value, then the
35043 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
35044 recognize and translate multibyte characters.
35045
35046 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
35047 @findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
35048 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
35049 then additional text will be emitted to stderr when fix-it hints are
35050 emitted. @option{-fdiagnostics-parseable-fixits} and
35051 @option{-fno-diagnostics-parseable-fixits} take precedence over this
35052 environment variable.
35053
35054 @table @samp
35055 @item fixits-v1
35056 Emit parseable fix-it hints, equivalent to
35057 @option{-fdiagnostics-parseable-fixits}. In particular, columns are
35058 expressed as a count of bytes, starting at byte 1 for the initial column.
35059
35060 @item fixits-v2
35061 As @code{fixits-v1}, but columns are expressed as display columns,
35062 as per @option{-fdiagnostics-column-unit=display}.
35063 @end table
35064
35065 @end table
35066
35067 @noindent
35068 Some additional environment variables affect the behavior of the
35069 preprocessor.
35070
35071 @include cppenv.texi
35072
35073 @c man end
35074
35075 @node Precompiled Headers
35076 @section Using Precompiled Headers
35077 @cindex precompiled headers
35078 @cindex speed of compilation
35079
35080 Often large projects have many header files that are included in every
35081 source file. The time the compiler takes to process these header files
35082 over and over again can account for nearly all of the time required to
35083 build the project. To make builds faster, GCC allows you to
35084 @dfn{precompile} a header file.
35085
35086 To create a precompiled header file, simply compile it as you would any
35087 other file, if necessary using the @option{-x} option to make the driver
35088 treat it as a C or C++ header file. You may want to use a
35089 tool like @command{make} to keep the precompiled header up-to-date when
35090 the headers it contains change.
35091
35092 A precompiled header file is searched for when @code{#include} is
35093 seen in the compilation. As it searches for the included file
35094 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
35095 compiler looks for a precompiled header in each directory just before it
35096 looks for the include file in that directory. The name searched for is
35097 the name specified in the @code{#include} with @samp{.gch} appended. If
35098 the precompiled header file cannot be used, it is ignored.
35099
35100 For instance, if you have @code{#include "all.h"}, and you have
35101 @file{all.h.gch} in the same directory as @file{all.h}, then the
35102 precompiled header file is used if possible, and the original
35103 header is used otherwise.
35104
35105 Alternatively, you might decide to put the precompiled header file in a
35106 directory and use @option{-I} to ensure that directory is searched
35107 before (or instead of) the directory containing the original header.
35108 Then, if you want to check that the precompiled header file is always
35109 used, you can put a file of the same name as the original header in this
35110 directory containing an @code{#error} command.
35111
35112 This also works with @option{-include}. So yet another way to use
35113 precompiled headers, good for projects not designed with precompiled
35114 header files in mind, is to simply take most of the header files used by
35115 a project, include them from another header file, precompile that header
35116 file, and @option{-include} the precompiled header. If the header files
35117 have guards against multiple inclusion, they are skipped because
35118 they've already been included (in the precompiled header).
35119
35120 If you need to precompile the same header file for different
35121 languages, targets, or compiler options, you can instead make a
35122 @emph{directory} named like @file{all.h.gch}, and put each precompiled
35123 header in the directory, perhaps using @option{-o}. It doesn't matter
35124 what you call the files in the directory; every precompiled header in
35125 the directory is considered. The first precompiled header
35126 encountered in the directory that is valid for this compilation is
35127 used; they're searched in no particular order.
35128
35129 There are many other possibilities, limited only by your imagination,
35130 good sense, and the constraints of your build system.
35131
35132 A precompiled header file can be used only when these conditions apply:
35133
35134 @itemize
35135 @item
35136 Only one precompiled header can be used in a particular compilation.
35137
35138 @item
35139 A precompiled header cannot be used once the first C token is seen. You
35140 can have preprocessor directives before a precompiled header; you cannot
35141 include a precompiled header from inside another header.
35142
35143 @item
35144 The precompiled header file must be produced for the same language as
35145 the current compilation. You cannot use a C precompiled header for a C++
35146 compilation.
35147
35148 @item
35149 The precompiled header file must have been produced by the same compiler
35150 binary as the current compilation is using.
35151
35152 @item
35153 Any macros defined before the precompiled header is included must
35154 either be defined in the same way as when the precompiled header was
35155 generated, or must not affect the precompiled header, which usually
35156 means that they don't appear in the precompiled header at all.
35157
35158 The @option{-D} option is one way to define a macro before a
35159 precompiled header is included; using a @code{#define} can also do it.
35160 There are also some options that define macros implicitly, like
35161 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
35162 defined this way.
35163
35164 @item If debugging information is output when using the precompiled
35165 header, using @option{-g} or similar, the same kind of debugging information
35166 must have been output when building the precompiled header. However,
35167 a precompiled header built using @option{-g} can be used in a compilation
35168 when no debugging information is being output.
35169
35170 @item The same @option{-m} options must generally be used when building
35171 and using the precompiled header. @xref{Submodel Options},
35172 for any cases where this rule is relaxed.
35173
35174 @item Each of the following options must be the same when building and using
35175 the precompiled header:
35176
35177 @gccoptlist{-fexceptions}
35178
35179 @item
35180 Some other command-line options starting with @option{-f},
35181 @option{-p}, or @option{-O} must be defined in the same way as when
35182 the precompiled header was generated. At present, it's not clear
35183 which options are safe to change and which are not; the safest choice
35184 is to use exactly the same options when generating and using the
35185 precompiled header. The following are known to be safe:
35186
35187 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
35188 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
35189 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
35190 -pedantic-errors}
35191
35192 @item Address space layout randomization (ASLR) can lead to not binary identical
35193 PCH files. If you rely on stable PCH file contents disable ASLR when generating
35194 PCH files.
35195
35196 @end itemize
35197
35198 For all of these except the last, the compiler automatically
35199 ignores the precompiled header if the conditions aren't met. If you
35200 find an option combination that doesn't work and doesn't cause the
35201 precompiled header to be ignored, please consider filing a bug report,
35202 see @ref{Bugs}.
35203
35204 If you do use differing options when generating and using the
35205 precompiled header, the actual behavior is a mixture of the
35206 behavior for the options. For instance, if you use @option{-g} to
35207 generate the precompiled header but not when using it, you may or may
35208 not get debugging information for routines in the precompiled header.
35209
35210 @node C++ Modules
35211 @section C++ Modules
35212 @cindex speed of compilation
35213
35214 Modules are a C++20 language feature. As the name suggests, they
35215 provides a modular compilation system, intending to provide both
35216 faster builds and better library isolation. The ``Merging Modules''
35217 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
35218 of changes to the standard, although it does not capture later
35219 changes.
35220
35221 @emph{G++'s modules support is not complete.} Other than bugs, the
35222 known missing pieces are:
35223
35224 @table @emph
35225
35226 @item Private Module Fragment
35227 The Private Module Fragment is recognized, but an error is emitted.
35228
35229 @item Partition definition visibility rules
35230 Entities may be defined in implementation partitions, and those
35231 definitions are not available outside of the module. This is not
35232 implemented, and the definitions are available to extra-module use.
35233
35234 @item Textual merging of reachable GM entities
35235 Entities may be multiply defined across different header-units.
35236 These must be de-duplicated, and this is implemented across imports,
35237 or when an import redefines a textually-defined entity. However the
35238 reverse is not implemented---textually redefining an entity that has
35239 been defined in an imported header-unit. A redefinition error is
35240 emitted.
35241
35242 @item Translation-Unit local referencing rules
35243 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
35244 (@uref{https://wg21.link/p2003}) add limitations on which entities an
35245 exported region may reference (for instance, the entities an exported
35246 template definition may reference). These are not fully implemented.
35247
35248 @item Standard Library Header Units
35249 The Standard Library is not provided as importable header units. If
35250 you want to import such units, you must explicitly build them first.
35251 If you do not do this with care, you may have multiple declarations,
35252 which the module machinery must merge---compiler resource usage can be
35253 affected by how you partition header files into header units.
35254
35255 @end table
35256
35257 Modular compilation is @emph{not} enabled with just the
35258 @option{-std=c++20} option. You must explicitly enable it with the
35259 @option{-fmodules-ts} option. It is independent of the language
35260 version selected, although in pre-C++20 versions, it is of course an
35261 extension.
35262
35263 No new source file suffixes are required or supported. If you wish to
35264 use a non-standard suffix (@pxref{Overall Options}), you also need
35265 to provide a @option{-x c++} option too.@footnote{Some users like to
35266 distinguish module interface files with a new suffix, such as naming
35267 the source @code{module.cppm}, which involves
35268 teaching all tools about the new suffix. A different scheme, such as
35269 naming @code{module-m.cpp} would be less invasive.}
35270
35271 Compiling a module interface unit produces an additional output (to
35272 the assembly or object file), called a Compiled Module Interface
35273 (CMI). This encodes the exported declarations of the module.
35274 Importing a module reads in the CMI. The import graph is a Directed
35275 Acyclic Graph (DAG). You must build imports before the importer.
35276
35277 Header files may themselves be compiled to header units, which are a
35278 transitional ability aiming at faster compilation. The
35279 @option{-fmodule-header} option is used to enable this, and implies
35280 the @option{-fmodules-ts} option. These CMIs are named by the fully
35281 resolved underlying header file, and thus may be a complete pathname
35282 containing subdirectories. If the header file is found at an absolute
35283 pathname, the CMI location is still relative to a CMI root directory.
35284
35285 As header files often have no suffix, you commonly have to specify a
35286 @option{-x} option to tell the compiler the source is a header file.
35287 You may use @option{-x c++-header}, @option{-x c++-user-header} or
35288 @option{-x c++-system-header}. When used in conjunction with
35289 @option{-fmodules-ts}, these all imply an appropriate
35290 @option{-fmodule-header} option. The latter two variants use the
35291 user or system include path to search for the file specified. This
35292 allows you to, for instance, compile standard library header files as
35293 header units, without needing to know exactly where they are
35294 installed. Specifying the language as one of these variants also
35295 inhibits output of the object file, as header files have no associated
35296 object file.
35297
35298 The @option{-fmodule-only} option disables generation of the
35299 associated object file for compiling a module interface. Only the CMI
35300 is generated. This option is implied when using the
35301 @option{-fmodule-header} option.
35302
35303 The @option{-flang-info-include-translate} and
35304 @option{-flang-info-include-translate-not} options notes whether
35305 include translation occurs or not. With no argument, the first will
35306 note all include translation. The second will note all
35307 non-translations of include files not known to intentionally be
35308 textual. With an argument, queries about include translation of a
35309 header files with that particular trailing pathname are noted. You
35310 may repeat this form to cover several different header files. This
35311 option may be helpful in determining whether include translation is
35312 happening---if it is working correctly, it behaves as if it isn't
35313 there at all.
35314
35315 The @option{-flang-info-module-cmi} option can be used to determine
35316 where the compiler is reading a CMI from. Without the option, the
35317 compiler is silent when such a read is successful. This option has an
35318 optional argument, which will restrict the notification to just the
35319 set of named modules or header units specified.
35320
35321 The @option{-Winvalid-imported-macros} option causes all imported macros
35322 to be resolved at the end of compilation. Without this, imported
35323 macros are only resolved when expanded or (re)defined. This option
35324 detects conflicting import definitions for all macros.
35325
35326 For details of the @option{-fmodule-mapper} family of options,
35327 @pxref{C++ Module Mapper}.
35328
35329 @menu
35330 * C++ Module Mapper:: Module Mapper
35331 * C++ Module Preprocessing:: Module Preprocessing
35332 * C++ Compiled Module Interface:: Compiled Module Interface
35333 @end menu
35334
35335 @node C++ Module Mapper
35336 @subsection Module Mapper
35337 @cindex C++ Module Mapper
35338
35339 A module mapper provides a server or file that the compiler queries to
35340 determine the mapping between module names and CMI files. It is also
35341 used to build CMIs on demand. @emph{Mapper functionality is in its
35342 infancy and is intended for experimentation with build system
35343 interactions.}
35344
35345 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
35346 option or @env{CXX_MODULE_MAPPER} environment variable. The value may
35347 have one of the following forms:
35348
35349 @table @gcctabopt
35350
35351 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
35352 An optional hostname and a numeric port number to connect to. If the
35353 hostname is omitted, the loopback address is used. If the hostname
35354 corresponds to multiple IPV6 addresses, these are tried in turn, until
35355 one is successful. If your host lacks IPv6, this form is
35356 non-functional. If you must use IPv4 use
35357 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
35358
35359 @item =@var{socket}@r{[}?@var{ident}@r{]}
35360 A local domain socket. If your host lacks local domain sockets, this
35361 form is non-functional.
35362
35363 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
35364 A program to spawn, and communicate with on its stdin/stdout streams.
35365 Your @var{PATH} environment variable is searched for the program.
35366 Arguments are separated by space characters, (it is not possible for
35367 one of the arguments delivered to the program to contain a space). An
35368 exception is if @var{program} begins with @@. In that case
35369 @var{program} (sans @@) is looked for in the compiler's internal
35370 binary directory. Thus the sample mapper-server can be specified
35371 with @code{@@g++-mapper-server}.
35372
35373 @item <>@r{[}?@var{ident}@r{]}
35374 @item <>@var{inout}@r{[}?@var{ident}@r{]}
35375 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
35376 Named pipes or file descriptors to communicate over. The first form,
35377 @option{<>}, communicates over stdin and stdout. The other forms
35378 allow you to specify a file descriptor or name a pipe. A numeric value
35379 is interpreted as a file descriptor, otherwise named pipe is opened.
35380 The second form specifies a bidirectional pipe and the last form
35381 allows specifying two independent pipes. Using file descriptors
35382 directly in this manner is fragile in general, as it can require the
35383 cooperation of intermediate processes. In particular using stdin &
35384 stdout is fraught with danger as other compiler options might also
35385 cause the compiler to read stdin or write stdout, and it can have
35386 unfortunate interactions with signal delivery from the terminal.
35387
35388 @item @var{file}@r{[}?@var{ident}@r{]}
35389 A mapping file consisting of space-separated module-name, filename
35390 pairs, one per line. Only the mappings for the direct imports and any
35391 module export name need be provided. If other mappings are provided,
35392 they override those stored in any imported CMI files. A repository
35393 root may be specified in the mapping file by using @samp{$root} as the
35394 module name in the first active line. Use of this option will disable
35395 any default module->CMI name mapping.
35396
35397 @end table
35398
35399 As shown, an optional @var{ident} may suffix the first word of the
35400 option, indicated by a @samp{?} prefix. The value is used in the
35401 initial handshake with the module server, or to specify a prefix on
35402 mapping file lines. In the server case, the main source file name is
35403 used if no @var{ident} is specified. In the file case, all non-blank
35404 lines are significant, unless a value is specified, in which case only
35405 lines beginning with @var{ident} are significant. The @var{ident}
35406 must be separated by whitespace from the module name. Be aware that
35407 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
35408 significant to the shell, and therefore may need quoting.
35409
35410 The mapper is connected to or loaded lazily, when the first module
35411 mapping is required. The networking protocols are only supported on
35412 hosts that provide networking. If no mapper is specified a default is
35413 provided.
35414
35415 A project-specific mapper is expected to be provided by the build
35416 system that invokes the compiler. It is not expected that a
35417 general-purpose server is provided for all compilations. As such, the
35418 server will know the build configuration, the compiler it invoked, and
35419 the environment (such as working directory) in which that is
35420 operating. As it may parallelize builds, several compilations may
35421 connect to the same socket.
35422
35423 The default mapper generates CMI files in a @samp{gcm.cache}
35424 directory. CMI files have a @samp{.gcm} suffix. The module unit name
35425 is used directly to provide the basename. Header units construct a
35426 relative path using the underlying header file name. If the path is
35427 already relative, a @samp{,} directory is prepended. Internal
35428 @samp{..} components are translated to @samp{,,}. No attempt is made
35429 to canonicalize these filenames beyond that done by the preprocessor's
35430 include search algorithm, as in general it is ambiguous when symbolic
35431 links are present.
35432
35433 The mapper protocol was published as ``A Module Mapper''
35434 @uref{https://wg21.link/p1184}. The implementation is provided by
35435 @command{libcody}, @uref{https://github.com/urnathan/libcody},
35436 which specifies the canonical protocol definition. A proof of concept
35437 server implementation embedded in @command{make} was described in
35438 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
35439
35440 @node C++ Module Preprocessing
35441 @subsection Module Preprocessing
35442 @cindex C++ Module Preprocessing
35443
35444 Modules affect preprocessing because of header units and include
35445 translation. Some uses of the preprocessor as a separate step either
35446 do not produce a correct output, or require CMIs to be available.
35447
35448 Header units import macros. These macros can affect later conditional
35449 inclusion, which therefore can cascade to differing import sets. When
35450 preprocessing, it is necessary to load the CMI. If a header unit is
35451 unavailable, the preprocessor issues a warning and continue (when
35452 not just preprocessing, an error is emitted). Detecting such imports
35453 requires preprocessor tokenization of the input stream to phase 4
35454 (macro expansion).
35455
35456 Include translation converts @code{#include}, @code{#include_next} and
35457 @code{#import} directives to internal @code{import} declarations.
35458 Whether a particular directive is translated is controlled by the
35459 module mapper. Header unit names are canonicalized during
35460 preprocessing.
35461
35462 Dependency information can be emitted for macro import, extending the
35463 functionality of @option{-MD} and @option{-MMD} options. Detection of
35464 import declarations also requires phase 4 preprocessing, and thus
35465 requires full preprocessing (or compilation).
35466
35467 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
35468 preprocessing before phase 4.
35469
35470 The @option{-save-temps} option uses @option{-fdirectives-only} for
35471 preprocessing, and preserve the macro definitions in the preprocessed
35472 output. Usually you also want to use this option when explicitly
35473 preprocessing a header-unit, or consuming such preprocessed output:
35474
35475 @smallexample
35476 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
35477 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
35478 @end smallexample
35479
35480 @node C++ Compiled Module Interface
35481 @subsection Compiled Module Interface
35482 @cindex C++ Compiled Module Interface
35483
35484 CMIs are an additional artifact when compiling named module
35485 interfaces, partitions or header units. These are read when
35486 importing. CMI contents are implementation-specific, and in GCC's
35487 case tied to the compiler version. Consider them a rebuildable cache
35488 artifact, not a distributable object.
35489
35490 When creating an output CMI, any missing directory components are
35491 created in a manner that is safe for concurrent builds creating
35492 multiple, different, CMIs within a common subdirectory tree.
35493
35494 CMI contents are written to a temporary file, which is then atomically
35495 renamed. Observers either see old contents (if there is an
35496 existing file), or complete new contents. They do not observe the
35497 CMI during its creation. This is unlike object file writing, which
35498 may be observed by an external process.
35499
35500 CMIs are read in lazily, if the host OS provides @code{mmap}
35501 functionality. Generally blocks are read when name lookup or template
35502 instantiation occurs. To inhibit this, the @option{-fno-module-lazy}
35503 option may be used.
35504
35505 The @option{--param lazy-modules=@var{n}} parameter controls the limit
35506 on the number of concurrently open module files during lazy loading.
35507 Should more modules be imported, an LRU algorithm is used to determine
35508 which files to close---until that file is needed again. This limit
35509 may be exceeded with deep module dependency hierarchies. With large
35510 code bases there may be more imports than the process limit of file
35511 descriptors. By default, the limit is a few less than the per-process
35512 file descriptor hard limit, if that is determinable.@footnote{Where
35513 applicable the soft limit is incremented as needed towards the hard limit.}
35514
35515 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
35516 You may use @command{readelf} to inspect them, although section
35517 contents are largely undecipherable. There is a section named
35518 @code{.gnu.c++.README}, which contains human-readable text. Other
35519 than the first line, each line consists of @code{@var{tag}: @code{value}}
35520 tuples.
35521
35522 @smallexample
35523 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
35524
35525 String dump of section '.gnu.c++.README':
35526 [ 0] GNU C++ primary module interface
35527 [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
35528 [ 6f] version: 2020/11/16-04:54
35529 [ 89] module: foo
35530 [ 95] source: c_b.ii
35531 [ a4] dialect: C++20/coroutines
35532 [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc
35533 [ ee] repository: gcm.cache
35534 [ 104] buildtime: 2020/11/16 15:03:21 UTC
35535 [ 127] localtime: 2020/11/16 07:03:21 PST
35536 [ 14a] export: foo:part1 foo-part1.gcm
35537 @end smallexample
35538
35539 Amongst other things, this lists the source that was built, C++
35540 dialect used and imports of the module.@footnote{The precise contents
35541 of this output may change.} The timestamp is the same value as that
35542 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
35543 explicitly specified with the environment variable
35544 @code{SOURCE_DATE_EPOCH}. For further details
35545 @pxref{Environment Variables}.
35546
35547 A set of related CMIs may be copied, provided the relative pathnames
35548 are preserved.
35549
35550 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
35551 it may be removed or altered. The section numbering of the sections
35552 whose names do not begin with @code{.gnu.c++.}, or are not the string
35553 section is significant and must not be altered.
This page took 1.597655 seconds and 5 git commands to generate.